diff options
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard')
7 files changed, 199 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template new file mode 100644 index 00000000..0ce1ff44 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { <%= classify(name) %>Guard } from './<%= dasherize(name) %>.guard'; + +describe('<%= classify(name) %>Guard', () => { + let guard: <%= classify(name) %>Guard; + + beforeEach(() => { + TestBed.configureTestingModule({}); + guard = TestBed.inject(<%= classify(name) %>Guard); + }); + + it('should be created', () => { + expect(guard).toBeTruthy(); + }); +}); diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.ts.template b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.ts.template new file mode 100644 index 00000000..3dc36a01 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/files/__name@dasherize__.guard.ts.template @@ -0,0 +1,31 @@ +import { Injectable } from '@angular/core'; +import { <%= implementationImports %> } from '@angular/router'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class <%= classify(name) %>Guard implements <%= implementations %> { + <% if (implements.includes('CanActivate')) { %>canActivate( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree { + return true; + } + <% } %><% if (implements.includes('CanActivateChild')) { %>canActivateChild( + childRoute: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree { + return true; + } + <% } %><% if (implements.includes('CanDeactivate')) { %>canDeactivate( + component: unknown, + currentRoute: ActivatedRouteSnapshot, + currentState: RouterStateSnapshot, + nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree { + return true; + } + <% } %><% if (implements.includes('CanLoad')) { %>canLoad( + route: Route, + segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree { + return true; + }<% } %> +} diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/index.d.ts new file mode 100644 index 00000000..b3c5969e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/index.d.ts @@ -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.io/license + */ +import { Rule } from '@angular-devkit/schematics'; +import { Schema as GuardOptions } from './schema'; +export default function (options: GuardOptions): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/index.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/index.js new file mode 100644 index 00000000..bfec75da --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/index.js @@ -0,0 +1,38 @@ +"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.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +const schematics_1 = require("@angular-devkit/schematics"); +const generate_from_files_1 = require("../utility/generate-from-files"); +const schema_1 = require("./schema"); +function default_1(options) { + if (!options.implements) { + throw new schematics_1.SchematicsException('Option "implements" is required.'); + } + const implementations = options.implements + .map((implement) => (implement === 'CanDeactivate' ? 'CanDeactivate<unknown>' : implement)) + .join(', '); + const commonRouterNameImports = ['ActivatedRouteSnapshot', 'RouterStateSnapshot']; + const routerNamedImports = [...options.implements, 'UrlTree']; + if (options.implements.includes(schema_1.Implement.CanLoad)) { + routerNamedImports.push('Route', 'UrlSegment'); + if (options.implements.length > 1) { + routerNamedImports.push(...commonRouterNameImports); + } + } + else { + routerNamedImports.push(...commonRouterNameImports); + } + routerNamedImports.sort(); + const implementationImports = routerNamedImports.join(', '); + return (0, generate_from_files_1.generateFromFiles)(options, { + implementations, + implementationImports, + }); +} +exports.default = default_1; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.d.ts new file mode 100644 index 00000000..c4f7f68a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.d.ts @@ -0,0 +1,36 @@ +/** + * Generates a new, generic route guard definition in the given or default project. + */ +export interface Schema { + /** + * When true (the default), creates the new files at the top level of the current project. + */ + flat?: boolean; + /** + * Specifies which interfaces to implement. + */ + implements?: Implement[]; + /** + * The name of the new route guard. + */ + name: string; + /** + * The path at which to create the interface that defines the guard, relative to the current + * workspace. + */ + path?: string; + /** + * The name of the project. + */ + project?: string; + /** + * Do not create "spec.ts" test files for the new guard. + */ + skipTests?: boolean; +} +export declare enum Implement { + CanActivate = "CanActivate", + CanActivateChild = "CanActivateChild", + CanDeactivate = "CanDeactivate", + CanLoad = "CanLoad" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.js new file mode 100644 index 00000000..fd0c3469 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.js @@ -0,0 +1,12 @@ +"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.Implement = void 0; +var Implement; +(function (Implement) { + Implement["CanActivate"] = "CanActivate"; + Implement["CanActivateChild"] = "CanActivateChild"; + Implement["CanDeactivate"] = "CanDeactivate"; + Implement["CanLoad"] = "CanLoad"; +})(Implement = exports.Implement || (exports.Implement = {})); diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.json b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.json new file mode 100644 index 00000000..76c55dfe --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/guard/schema.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "SchematicsAngularGuard", + "title": "Angular Guard Options Schema", + "type": "object", + "description": "Generates a new, generic route guard definition in the given or default project.", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of the new route guard.", + "$default": { + "$source": "argv", + "index": 0 + }, + "x-prompt": "What name would you like to use for the guard?" + }, + "skipTests": { + "type": "boolean", + "description": "Do not create \"spec.ts\" test files for the new guard.", + "default": false, + "x-user-analytics": 12 + }, + "flat": { + "type": "boolean", + "description": "When true (the default), creates the new files at the top level of the current project.", + "default": true + }, + "path": { + "type": "string", + "format": "path", + "description": "The path at which to create the interface that defines the guard, relative to the current workspace.", + "visible": false + }, + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { + "$source": "projectName" + } + }, + "implements": { + "type": "array", + "description": "Specifies which interfaces to implement.", + "uniqueItems": true, + "minItems": 1, + "items": { + "enum": ["CanActivate", "CanActivateChild", "CanDeactivate", "CanLoad"], + "type": "string" + }, + "default": ["CanActivate"], + "x-prompt": "Which interfaces would you like to implement?" + } + }, + "required": ["name"] +} |