From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schematics/src/engine/engine.d.ts | 77 ++++++ .../schematics/src/engine/engine.js | 295 +++++++++++++++++++++ .../schematics/src/engine/index.d.ts | 10 + .../@angular-devkit/schematics/src/engine/index.js | 22 ++ .../schematics/src/engine/interface.d.ts | 157 +++++++++++ .../schematics/src/engine/interface.js | 9 + .../schematics/src/engine/schematic.d.ts | 24 ++ .../schematics/src/engine/schematic.js | 67 +++++ 8 files changed, 661 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.js (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine') diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.d.ts new file mode 100644 index 00000000..02063733 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.d.ts @@ -0,0 +1,77 @@ +/** + * @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 { BaseException } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Url } from 'url'; +import { MergeStrategy } from '../tree/interface'; +import { Workflow } from '../workflow/interface'; +import { Collection, CollectionDescription, Engine, EngineHost, ExecutionOptions, Schematic, SchematicContext, SchematicDescription, Source, TaskConfiguration, TaskId, TaskInfo, TypedSchematicContext } from './interface'; +export declare class UnknownUrlSourceProtocol extends BaseException { + constructor(url: string); +} +export declare class UnknownCollectionException extends BaseException { + constructor(name: string); +} +export declare class CircularCollectionException extends BaseException { + constructor(name: string); +} +export declare class UnknownSchematicException extends BaseException { + constructor(name: string, collection: CollectionDescription<{}>); +} +export declare class PrivateSchematicException extends BaseException { + constructor(name: string, collection: CollectionDescription<{}>); +} +export declare class SchematicEngineConflictingException extends BaseException { + constructor(); +} +export declare class UnregisteredTaskException extends BaseException { + constructor(name: string, schematic?: SchematicDescription<{}, {}>); +} +export declare class UnknownTaskDependencyException extends BaseException { + constructor(id: TaskId); +} +export declare class CollectionImpl implements Collection { + private _description; + private _engine; + readonly baseDescriptions?: CollectionDescription[] | undefined; + constructor(_description: CollectionDescription, _engine: SchematicEngine, baseDescriptions?: CollectionDescription[] | undefined); + get description(): CollectionDescription; + get name(): string; + createSchematic(name: string, allowPrivate?: boolean): Schematic; + listSchematicNames(): string[]; +} +export declare class TaskScheduler { + private _context; + private _queue; + private _taskIds; + private static _taskIdCounter; + constructor(_context: SchematicContext); + private _calculatePriority; + private _mapDependencies; + schedule(taskConfiguration: TaskConfiguration): TaskId; + finalize(): ReadonlyArray; +} +export declare class SchematicEngine implements Engine { + private _host; + protected _workflow?: Workflow | undefined; + private _collectionCache; + private _schematicCache; + private _taskSchedulers; + constructor(_host: EngineHost, _workflow?: Workflow | undefined); + get workflow(): Workflow | null; + get defaultMergeStrategy(): MergeStrategy; + createCollection(name: string, requester?: Collection): Collection; + private _createCollectionDescription; + createContext(schematic: Schematic, parent?: Partial>, executionOptions?: Partial): TypedSchematicContext; + createSchematic(name: string, collection: Collection, allowPrivate?: boolean): Schematic; + listSchematicNames(collection: Collection): string[]; + transformOptions(schematic: Schematic, options: OptionT, context?: TypedSchematicContext): Observable; + createSourceFromUrl(url: Url, context: TypedSchematicContext): Source; + executePostTasks(): Observable; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.js new file mode 100644 index 00000000..64941062 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.js @@ -0,0 +1,295 @@ +"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 }); +exports.SchematicEngine = exports.TaskScheduler = exports.CollectionImpl = exports.UnknownTaskDependencyException = exports.UnregisteredTaskException = exports.SchematicEngineConflictingException = exports.PrivateSchematicException = exports.UnknownSchematicException = exports.CircularCollectionException = exports.UnknownCollectionException = exports.UnknownUrlSourceProtocol = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const interface_1 = require("../tree/interface"); +const null_1 = require("../tree/null"); +const static_1 = require("../tree/static"); +const schematic_1 = require("./schematic"); +class UnknownUrlSourceProtocol extends core_1.BaseException { + constructor(url) { + super(`Unknown Protocol on url "${url}".`); + } +} +exports.UnknownUrlSourceProtocol = UnknownUrlSourceProtocol; +class UnknownCollectionException extends core_1.BaseException { + constructor(name) { + super(`Unknown collection "${name}".`); + } +} +exports.UnknownCollectionException = UnknownCollectionException; +class CircularCollectionException extends core_1.BaseException { + constructor(name) { + super(`Circular collection reference "${name}".`); + } +} +exports.CircularCollectionException = CircularCollectionException; +class UnknownSchematicException extends core_1.BaseException { + constructor(name, collection) { + super(`Schematic "${name}" not found in collection "${collection.name}".`); + } +} +exports.UnknownSchematicException = UnknownSchematicException; +class PrivateSchematicException extends core_1.BaseException { + constructor(name, collection) { + super(`Schematic "${name}" not found in collection "${collection.name}".`); + } +} +exports.PrivateSchematicException = PrivateSchematicException; +class SchematicEngineConflictingException extends core_1.BaseException { + constructor() { + super(`A schematic was called from a different engine as its parent.`); + } +} +exports.SchematicEngineConflictingException = SchematicEngineConflictingException; +class UnregisteredTaskException extends core_1.BaseException { + constructor(name, schematic) { + const addendum = schematic ? ` in schematic "${schematic.name}"` : ''; + super(`Unregistered task "${name}"${addendum}.`); + } +} +exports.UnregisteredTaskException = UnregisteredTaskException; +class UnknownTaskDependencyException extends core_1.BaseException { + constructor(id) { + super(`Unknown task dependency [ID: ${id.id}].`); + } +} +exports.UnknownTaskDependencyException = UnknownTaskDependencyException; +class CollectionImpl { + constructor(_description, _engine, baseDescriptions) { + this._description = _description; + this._engine = _engine; + this.baseDescriptions = baseDescriptions; + } + get description() { + return this._description; + } + get name() { + return this.description.name || ''; + } + createSchematic(name, allowPrivate = false) { + return this._engine.createSchematic(name, this, allowPrivate); + } + listSchematicNames() { + return this._engine.listSchematicNames(this); + } +} +exports.CollectionImpl = CollectionImpl; +class TaskScheduler { + constructor(_context) { + this._context = _context; + this._queue = new core_1.PriorityQueue((x, y) => x.priority - y.priority); + this._taskIds = new Map(); + } + _calculatePriority(dependencies) { + if (dependencies.size === 0) { + return 0; + } + const prio = [...dependencies].reduce((prio, task) => prio + task.priority, 1); + return prio; + } + _mapDependencies(dependencies) { + if (!dependencies) { + return new Set(); + } + const tasks = dependencies.map((dep) => { + const task = this._taskIds.get(dep); + if (!task) { + throw new UnknownTaskDependencyException(dep); + } + return task; + }); + return new Set(tasks); + } + schedule(taskConfiguration) { + const dependencies = this._mapDependencies(taskConfiguration.dependencies); + const priority = this._calculatePriority(dependencies); + const task = { + id: TaskScheduler._taskIdCounter++, + priority, + configuration: taskConfiguration, + context: this._context, + }; + this._queue.push(task); + const id = { id: task.id }; + this._taskIds.set(id, task); + return id; + } + finalize() { + const tasks = this._queue.toArray(); + this._queue.clear(); + this._taskIds.clear(); + return tasks; + } +} +exports.TaskScheduler = TaskScheduler; +TaskScheduler._taskIdCounter = 1; +class SchematicEngine { + constructor(_host, _workflow) { + this._host = _host; + this._workflow = _workflow; + this._collectionCache = new Map(); + this._schematicCache = new WeakMap(); + this._taskSchedulers = new Array(); + } + get workflow() { + return this._workflow || null; + } + get defaultMergeStrategy() { + return this._host.defaultMergeStrategy || interface_1.MergeStrategy.Default; + } + createCollection(name, requester) { + let collection = this._collectionCache.get(name); + if (collection) { + return collection; + } + const [description, bases] = this._createCollectionDescription(name, requester === null || requester === void 0 ? void 0 : requester.description); + collection = new CollectionImpl(description, this, bases); + this._collectionCache.set(name, collection); + this._schematicCache.set(collection, new Map()); + return collection; + } + _createCollectionDescription(name, requester, parentNames) { + const description = this._host.createCollectionDescription(name, requester); + if (!description) { + throw new UnknownCollectionException(name); + } + if (parentNames && parentNames.has(description.name)) { + throw new CircularCollectionException(name); + } + const bases = new Array(); + if (description.extends) { + parentNames = (parentNames || new Set()).add(description.name); + for (const baseName of description.extends) { + const [base, baseBases] = this._createCollectionDescription(baseName, description, new Set(parentNames)); + bases.unshift(base, ...baseBases); + } + } + return [description, bases]; + } + createContext(schematic, parent, executionOptions) { + // Check for inconsistencies. + if (parent && parent.engine && parent.engine !== this) { + throw new SchematicEngineConflictingException(); + } + let interactive = true; + if (executionOptions && executionOptions.interactive != undefined) { + interactive = executionOptions.interactive; + } + else if (parent && parent.interactive != undefined) { + interactive = parent.interactive; + } + let context = { + debug: (parent && parent.debug) || false, + engine: this, + logger: (parent && parent.logger && parent.logger.createChild(schematic.description.name)) || + new core_1.logging.NullLogger(), + schematic, + strategy: parent && parent.strategy !== undefined ? parent.strategy : this.defaultMergeStrategy, + interactive, + addTask, + }; + const maybeNewContext = this._host.transformContext(context); + if (maybeNewContext) { + context = maybeNewContext; + } + const taskScheduler = new TaskScheduler(context); + const host = this._host; + this._taskSchedulers.push(taskScheduler); + function addTask(task, dependencies) { + const config = task.toConfiguration(); + if (!host.hasTaskExecutor(config.name)) { + throw new UnregisteredTaskException(config.name, schematic.description); + } + config.dependencies = config.dependencies || []; + if (dependencies) { + config.dependencies.unshift(...dependencies); + } + return taskScheduler.schedule(config); + } + return context; + } + createSchematic(name, collection, allowPrivate = false) { + const schematicMap = this._schematicCache.get(collection); + let schematic = schematicMap === null || schematicMap === void 0 ? void 0 : schematicMap.get(name); + if (schematic) { + return schematic; + } + let collectionDescription = collection.description; + let description = this._host.createSchematicDescription(name, collection.description); + if (!description) { + if (collection.baseDescriptions) { + for (const base of collection.baseDescriptions) { + description = this._host.createSchematicDescription(name, base); + if (description) { + collectionDescription = base; + break; + } + } + } + if (!description) { + // Report the error for the top level schematic collection + throw new UnknownSchematicException(name, collection.description); + } + } + if (description.private && !allowPrivate) { + throw new PrivateSchematicException(name, collection.description); + } + const factory = this._host.getSchematicRuleFactory(description, collectionDescription); + schematic = new schematic_1.SchematicImpl(description, factory, collection, this); + schematicMap === null || schematicMap === void 0 ? void 0 : schematicMap.set(name, schematic); + return schematic; + } + listSchematicNames(collection) { + const names = this._host.listSchematicNames(collection.description); + if (collection.baseDescriptions) { + for (const base of collection.baseDescriptions) { + names.push(...this._host.listSchematicNames(base)); + } + } + // remove duplicates + return [...new Set(names)].sort(); + } + transformOptions(schematic, options, context) { + return this._host.transformOptions(schematic.description, options, context); + } + createSourceFromUrl(url, context) { + switch (url.protocol) { + case 'null:': + return () => new null_1.NullTree(); + case 'empty:': + return () => (0, static_1.empty)(); + default: + const hostSource = this._host.createSourceFromUrl(url, context); + if (!hostSource) { + throw new UnknownUrlSourceProtocol(url.toString()); + } + return hostSource; + } + } + executePostTasks() { + const executors = new Map(); + const taskObservable = (0, rxjs_1.from)(this._taskSchedulers).pipe((0, operators_1.concatMap)((scheduler) => scheduler.finalize()), (0, operators_1.concatMap)((task) => { + const { name, options } = task.configuration; + const executor = executors.get(name); + if (executor) { + return executor(options, task.context); + } + return this._host.createTaskExecutor(name).pipe((0, operators_1.concatMap)((executor) => { + executors.set(name, executor); + return executor(options, task.context); + })); + })); + return taskObservable; + } +} +exports.SchematicEngine = SchematicEngine; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.d.ts new file mode 100644 index 00000000..666c8c40 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/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 + */ +export * from './engine'; +export * from './interface'; +export * from './schematic'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.js new file mode 100644 index 00000000..c2ca0f07 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.js @@ -0,0 +1,22 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./engine"), exports); +__exportStar(require("./interface"), exports); +__exportStar(require("./schematic"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.d.ts new file mode 100644 index 00000000..790cfbfb --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.d.ts @@ -0,0 +1,157 @@ +/** + * @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 { analytics, logging } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Url } from 'url'; +import { FileEntry, MergeStrategy, Tree } from '../tree/interface'; +import { Workflow } from '../workflow/interface'; +export interface TaskConfiguration { + name: string; + dependencies?: Array; + options?: T; +} +export interface TaskConfigurationGenerator { + toConfiguration(): TaskConfiguration; +} +export declare type TaskExecutor = (options: T | undefined, context: SchematicContext) => Promise | Observable; +export interface TaskExecutorFactory { + readonly name: string; + create(options?: T): Promise | Observable; +} +export interface TaskId { + readonly id: number; +} +export interface TaskInfo { + readonly id: number; + readonly priority: number; + readonly configuration: TaskConfiguration; + readonly context: SchematicContext; +} +export interface ExecutionOptions { + scope: string; + interactive: boolean; +} +/** + * The description (metadata) of a collection. This type contains every information the engine + * needs to run. The CollectionMetadataT type parameter contains additional metadata that you + * want to store while remaining type-safe. + */ +export declare type CollectionDescription = CollectionMetadataT & { + readonly name: string; + readonly extends?: string[]; +}; +/** + * The description (metadata) of a schematic. This type contains every information the engine + * needs to run. The SchematicMetadataT and CollectionMetadataT type parameters contain additional + * metadata that you want to store while remaining type-safe. + */ +export declare type SchematicDescription = SchematicMetadataT & { + readonly collection: CollectionDescription; + readonly name: string; + readonly private?: boolean; + readonly hidden?: boolean; +}; +/** + * The Host for the Engine. Specifically, the piece of the tooling responsible for resolving + * collections and schematics descriptions. The SchematicMetadataT and CollectionMetadataT type + * parameters contain additional metadata that you want to store while remaining type-safe. + */ +export interface EngineHost { + createCollectionDescription(name: string, requester?: CollectionDescription): CollectionDescription; + listSchematicNames(collection: CollectionDescription): string[]; + createSchematicDescription(name: string, collection: CollectionDescription): SchematicDescription | null; + getSchematicRuleFactory(schematic: SchematicDescription, collection: CollectionDescription): RuleFactory; + createSourceFromUrl(url: Url, context: TypedSchematicContext): Source | null; + transformOptions(schematic: SchematicDescription, options: OptionT, context?: TypedSchematicContext): Observable; + transformContext(context: TypedSchematicContext): TypedSchematicContext | void; + createTaskExecutor(name: string): Observable; + hasTaskExecutor(name: string): boolean; + readonly defaultMergeStrategy?: MergeStrategy; +} +/** + * The root Engine for creating and running schematics and collections. Everything related to + * a schematic execution starts from this interface. + * + * CollectionMetadataT is, by default, a generic Collection metadata type. This is used throughout + * the engine typings so that you can use a type that's merged into descriptions, while being + * type-safe. + * + * SchematicMetadataT is a type that contains additional typing for the Schematic Description. + */ +export interface Engine { + createCollection(name: string, requester?: Collection): Collection; + createContext(schematic: Schematic, parent?: Partial>, executionOptions?: Partial): TypedSchematicContext; + createSchematic(name: string, collection: Collection): Schematic; + createSourceFromUrl(url: Url, context: TypedSchematicContext): Source; + transformOptions(schematic: Schematic, options: OptionT, context?: TypedSchematicContext): Observable; + executePostTasks(): Observable; + readonly defaultMergeStrategy: MergeStrategy; + readonly workflow: Workflow | null; +} +/** + * A Collection as created by the Engine. This should be used by the tool to create schematics, + * or by rules to create other schematics as well. + */ +export interface Collection { + readonly description: CollectionDescription; + readonly baseDescriptions?: Array>; + createSchematic(name: string, allowPrivate?: boolean): Schematic; + listSchematicNames(): string[]; +} +/** + * A Schematic as created by the Engine. This should be used by the tool to execute the main + * schematics, or by rules to execute other schematics as well. + */ +export interface Schematic { + readonly description: SchematicDescription; + readonly collection: Collection; + call(options: OptionT, host: Observable, parentContext?: Partial>, executionOptions?: Partial): Observable; +} +/** + * A SchematicContext. Contains information necessary for Schematics to execute some rules, for + * example when using another schematics, as we need the engine and collection. + */ +export interface TypedSchematicContext { + readonly debug: boolean; + readonly engine: Engine; + readonly logger: logging.LoggerApi; + readonly schematic: Schematic; + readonly strategy: MergeStrategy; + readonly interactive: boolean; + addTask(task: TaskConfigurationGenerator, dependencies?: Array): TaskId; + /** @deprecated since version 11 - as it's unused. */ + readonly analytics?: analytics.Analytics; +} +/** + * This is used by the Schematics implementations in order to avoid needing to have typing from + * the tooling. Schematics are not specific to a tool. + */ +export declare type SchematicContext = TypedSchematicContext<{}, {}>; +/** + * A rule factory, which is normally the way schematics are implemented. Returned by the tooling + * after loading a schematic description. + */ +export declare type RuleFactory = (options: T) => Rule; +/** + * A FileOperator applies changes synchronously to a FileEntry. An async operator returns + * asynchronously. We separate them so that the type system can catch early errors. + */ +export declare type FileOperator = (entry: FileEntry) => FileEntry | null; +export declare type AsyncFileOperator = (tree: FileEntry) => Observable; +/** + * A source is a function that generates a Tree from a specific context. A rule transforms a tree + * into another tree from a specific context. In both cases, an Observable can be returned if + * the source or the rule are asynchronous. Only the last Tree generated in the observable will + * be used though. + * + * We obfuscate the context of Source and Rule because the schematic implementation should not + * know which types is the schematic or collection metadata, as they are both tooling specific. + */ +export declare type Source = (context: SchematicContext) => Tree | Observable; +export declare type Rule = (tree: Tree, context: SchematicContext) => Tree | Observable | Rule | Promise | void; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.js @@ -0,0 +1,9 @@ +"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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.d.ts new file mode 100644 index 00000000..718b6849 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.d.ts @@ -0,0 +1,24 @@ +/** + * @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 { BaseException } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Tree } from '../tree/interface'; +import { Collection, Engine, ExecutionOptions, RuleFactory, Schematic, SchematicDescription, TypedSchematicContext } from './interface'; +export declare class InvalidSchematicsNameException extends BaseException { + constructor(name: string); +} +export declare class SchematicImpl implements Schematic { + private _description; + private _factory; + private _collection; + private _engine; + constructor(_description: SchematicDescription, _factory: RuleFactory<{}>, _collection: Collection, _engine: Engine); + get description(): SchematicDescription; + get collection(): Collection; + call(options: OptionT, host: Observable, parentContext?: Partial>, executionOptions?: Partial): Observable; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.js new file mode 100644 index 00000000..2b33c2f5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.js @@ -0,0 +1,67 @@ +"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 }); +exports.SchematicImpl = exports.InvalidSchematicsNameException = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const call_1 = require("../rules/call"); +const scoped_1 = require("../tree/scoped"); +class InvalidSchematicsNameException extends core_1.BaseException { + constructor(name) { + super(`Schematics has invalid name: "${name}".`); + } +} +exports.InvalidSchematicsNameException = InvalidSchematicsNameException; +class SchematicImpl { + constructor(_description, _factory, _collection, _engine) { + this._description = _description; + this._factory = _factory; + this._collection = _collection; + this._engine = _engine; + if (!_description.name.match(/^[-@/_.a-zA-Z0-9]+$/)) { + throw new InvalidSchematicsNameException(_description.name); + } + } + get description() { + return this._description; + } + get collection() { + return this._collection; + } + call(options, host, parentContext, executionOptions) { + const context = this._engine.createContext(this, parentContext, executionOptions); + return host.pipe((0, operators_1.first)(), (0, operators_1.concatMap)((tree) => this._engine + .transformOptions(this, options, context) + .pipe((0, operators_1.map)((o) => [tree, o]))), (0, operators_1.concatMap)(([tree, transformedOptions]) => { + let input; + let scoped = false; + if (executionOptions && executionOptions.scope) { + scoped = true; + input = new scoped_1.ScopedTree(tree, executionOptions.scope); + } + else { + input = tree; + } + return (0, call_1.callRule)(this._factory(transformedOptions), (0, rxjs_1.of)(input), context).pipe((0, operators_1.map)((output) => { + if (output === input) { + return tree; + } + else if (scoped) { + tree.merge(output); + return tree; + } + else { + return output; + } + })); + })); + } +} +exports.SchematicImpl = SchematicImpl; -- cgit v1.2.3