This commit is contained in:
CHEVALLIER Abel
2025-11-13 16:23:22 +01:00
parent de9c515a47
commit cb235644dc
34924 changed files with 3811102 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { <%= classify(name) %>Interceptor } from './<%= dasherize(name) %><%= typeSeparator %>interceptor';
describe('<%= classify(name) %>Interceptor', () => {
beforeEach(() => TestBed.configureTestingModule({
providers: [
<%= classify(name) %>Interceptor
]
}));
it('should be created', () => {
const interceptor: <%= classify(name) %>Interceptor = TestBed.inject(<%= classify(name) %>Interceptor);
expect(interceptor).toBeTruthy();
});
});

View File

@@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import {
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor
} from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable()
export class <%= classify(name) %>Interceptor implements HttpInterceptor {
constructor() {}
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
return next.handle(request);
}
}

View File

@@ -0,0 +1,17 @@
import { TestBed } from '@angular/core/testing';
import { HttpInterceptorFn } from '@angular/common/http';
import { <%= camelize(name) %>Interceptor } from './<%= dasherize(name) %><%= typeSeparator %>interceptor';
describe('<%= camelize(name) %>Interceptor', () => {
const interceptor: HttpInterceptorFn = (req, next) =>
TestBed.runInInjectionContext(() => <%= camelize(name) %>Interceptor(req, next));
beforeEach(() => {
TestBed.configureTestingModule({});
});
it('should be created', () => {
expect(interceptor).toBeTruthy();
});
});

View File

@@ -0,0 +1,5 @@
import { HttpInterceptorFn } from '@angular/common/http';
export const <%= camelize(name) %>Interceptor: HttpInterceptorFn = (req, next) => {
return next(req);
};

10
node_modules/@schematics/angular/interceptor/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,10 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import type { Rule } from '@angular-devkit/schematics';
import type { Schema as InterceptorOptions } from './schema';
export default function (options: InterceptorOptions): Rule;

15
node_modules/@schematics/angular/interceptor/index.js generated vendored Executable file
View File

@@ -0,0 +1,15 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const generate_from_files_1 = require("../utility/generate-from-files");
function default_1(options) {
const templateFilesDirectory = options.functional ? './functional-files' : './class-files';
return (0, generate_from_files_1.generateFromFiles)({ ...options, templateFilesDirectory });
}

51
node_modules/@schematics/angular/interceptor/schema.d.ts generated vendored Executable file
View File

@@ -0,0 +1,51 @@
/**
* Creates a new interceptor in your project. Interceptors are used to intercept and modify
* HTTP requests and responses before they reach their destination. This allows you to
* perform tasks like adding authentication headers, handling errors, or logging requests.
* This schematic generates the necessary files and boilerplate code for a new interceptor.
*/
export type Schema = {
/**
* Creates the new interceptor files at the top level of the current project. If set to
* false, a new folder with the interceptor's name will be created to contain the files.
*/
flat?: boolean;
/**
* Creates the interceptor as a function `HttpInterceptorFn` instead of a class. Functional
* interceptors can be simpler for basic scenarios.
*/
functional?: boolean;
/**
* The name for the new interceptor. This will be used to create the interceptor's class and
* spec files (e.g., `my-interceptor.interceptor.ts` and
* `my-interceptor.interceptor.spec.ts`).
*/
name: string;
/**
* The path where the interceptor files should be created, relative to the workspace root.
* If not provided, the interceptor will be created in the current directory.
*/
path?: string;
/**
* The name of the project where the interceptor should be created. If not specified, the
* CLI will determine the project from the current directory.
*/
project: string;
/**
* Skip the generation of a unit test file `spec.ts` for the new interceptor.
*/
skipTests?: boolean;
/**
* The separator character to use before the type within the generated file's name. For
* example, if you set the option to `.`, the file will be named `example.interceptor.ts`.
*/
typeSeparator?: TypeSeparator;
};
/**
* The separator character to use before the type within the generated file's name. For
* example, if you set the option to `.`, the file will be named `example.interceptor.ts`.
*/
export declare enum TypeSeparator {
Empty = "-",
TypeSeparator = "."
}

14
node_modules/@schematics/angular/interceptor/schema.js generated vendored Executable file
View File

@@ -0,0 +1,14 @@
"use strict";
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeSeparator = void 0;
/**
* The separator character to use before the type within the generated file's name. For
* example, if you set the option to `.`, the file will be named `example.interceptor.ts`.
*/
var TypeSeparator;
(function (TypeSeparator) {
TypeSeparator["Empty"] = "-";
TypeSeparator["TypeSeparator"] = ".";
})(TypeSeparator || (exports.TypeSeparator = TypeSeparator = {}));

57
node_modules/@schematics/angular/interceptor/schema.json generated vendored Executable file
View File

@@ -0,0 +1,57 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "SchematicsAngularInterceptor",
"title": "Angular Interceptor Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Creates a new interceptor in your project. Interceptors are used to intercept and modify HTTP requests and responses before they reach their destination. This allows you to perform tasks like adding authentication headers, handling errors, or logging requests. This schematic generates the necessary files and boilerplate code for a new interceptor.",
"properties": {
"name": {
"type": "string",
"description": "The name for the new interceptor. This will be used to create the interceptor's class and spec files (e.g., `my-interceptor.interceptor.ts` and `my-interceptor.interceptor.spec.ts`).",
"$default": {
"$source": "argv",
"index": 0
},
"x-prompt": "What name would you like to use for the interceptor?"
},
"path": {
"type": "string",
"format": "path",
"$default": {
"$source": "workingDirectory"
},
"description": "The path where the interceptor files should be created, relative to the workspace root. If not provided, the interceptor will be created in the current directory.",
"visible": false
},
"project": {
"type": "string",
"description": "The name of the project where the interceptor should be created. If not specified, the CLI will determine the project from the current directory.",
"$default": {
"$source": "projectName"
}
},
"flat": {
"type": "boolean",
"default": true,
"description": "Creates the new interceptor files at the top level of the current project. If set to false, a new folder with the interceptor's name will be created to contain the files."
},
"skipTests": {
"type": "boolean",
"description": "Skip the generation of a unit test file `spec.ts` for the new interceptor.",
"default": false
},
"functional": {
"type": "boolean",
"description": "Creates the interceptor as a function `HttpInterceptorFn` instead of a class. Functional interceptors can be simpler for basic scenarios.",
"default": true
},
"typeSeparator": {
"type": "string",
"default": "-",
"enum": ["-", "."],
"description": "The separator character to use before the type within the generated file's name. For example, if you set the option to `.`, the file will be named `example.interceptor.ts`."
}
},
"required": ["name", "project"]
}