Add comprehensive e2e test suites for Tasks 16-25

Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date)
- Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class
- Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting
- Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states
- Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions
- Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation

Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares)
- Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline
- Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements
- Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations
- Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary
- Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds

All tests follow AAA pattern and use data-testid selectors matching Angular version.
Total: 245 tests across 10 feature suites.
This commit is contained in:
gnezim
2026-04-05 19:25:03 +03:00
parent 21c6ed4f82
commit 60e2149072
31032 changed files with 5222883 additions and 2 deletions
+76
View File
@@ -0,0 +1,76 @@
/**
* @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 { BaseException } from '@angular-devkit/core';
import { Url } from 'node:url';
import { Observable } from 'rxjs';
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<CollectionT extends object, SchematicT extends object> implements Collection<CollectionT, SchematicT> {
private _description;
private _engine;
readonly baseDescriptions?: CollectionDescription<CollectionT>[] | undefined;
constructor(_description: CollectionDescription<CollectionT>, _engine: SchematicEngine<CollectionT, SchematicT>, baseDescriptions?: CollectionDescription<CollectionT>[] | undefined);
get description(): CollectionDescription<CollectionT>;
get name(): string;
createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionT, SchematicT>;
listSchematicNames(includeHidden?: boolean): string[];
}
export declare class TaskScheduler {
private _context;
private _queue;
private _taskIds;
private static _taskIdCounter;
constructor(_context: SchematicContext);
private _calculatePriority;
private _mapDependencies;
schedule<T extends object>(taskConfiguration: TaskConfiguration<T>): TaskId;
finalize(): ReadonlyArray<TaskInfo>;
}
export declare class SchematicEngine<CollectionT extends object, SchematicT extends object> implements Engine<CollectionT, SchematicT> {
private _host;
protected _workflow?: Workflow | undefined;
private _collectionCache;
private _schematicCache;
private _taskSchedulers;
constructor(_host: EngineHost<CollectionT, SchematicT>, _workflow?: Workflow | undefined);
get workflow(): Workflow | null;
get defaultMergeStrategy(): MergeStrategy;
createCollection(name: string, requester?: Collection<CollectionT, SchematicT>): Collection<CollectionT, SchematicT>;
private _createCollectionDescription;
createContext(schematic: Schematic<CollectionT, SchematicT>, parent?: Partial<TypedSchematicContext<CollectionT, SchematicT>>, executionOptions?: Partial<ExecutionOptions>): TypedSchematicContext<CollectionT, SchematicT>;
createSchematic(name: string, collection: Collection<CollectionT, SchematicT>, allowPrivate?: boolean): Schematic<CollectionT, SchematicT>;
listSchematicNames(collection: Collection<CollectionT, SchematicT>, includeHidden?: boolean): string[];
transformOptions<OptionT extends object, ResultT extends object>(schematic: Schematic<CollectionT, SchematicT>, options: OptionT, context?: TypedSchematicContext<CollectionT, SchematicT>): Observable<ResultT>;
createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionT, SchematicT>): Source;
executePostTasks(): Observable<void>;
}
+300
View File
@@ -0,0 +1,300 @@
"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.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 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 {
_description;
_engine;
baseDescriptions;
constructor(_description, _engine, baseDescriptions) {
this._description = _description;
this._engine = _engine;
this.baseDescriptions = baseDescriptions;
}
get description() {
return this._description;
}
get name() {
return this.description.name || '<unknown>';
}
createSchematic(name, allowPrivate = false) {
return this._engine.createSchematic(name, this, allowPrivate);
}
listSchematicNames(includeHidden) {
return this._engine.listSchematicNames(this, includeHidden);
}
}
exports.CollectionImpl = CollectionImpl;
class TaskScheduler {
_context;
_queue = new core_1.PriorityQueue((x, y) => x.priority - y.priority);
_taskIds = new Map();
static _taskIdCounter = 1;
constructor(_context) {
this._context = _context;
}
_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;
class SchematicEngine {
_host;
_workflow;
_collectionCache = new Map();
_schematicCache = new WeakMap();
_taskSchedulers = new Array();
constructor(_host, _workflow) {
this._host = _host;
this._workflow = _workflow;
}
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?.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?.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?.set(name, schematic);
return schematic;
}
listSchematicNames(collection, includeHidden) {
const names = this._host.listSchematicNames(collection.description, includeHidden);
if (collection.baseDescriptions) {
for (const base of collection.baseDescriptions) {
names.push(...this._host.listSchematicNames(base, includeHidden));
}
}
// 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)();
}
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, rxjs_1.concatMap)((scheduler) => scheduler.finalize()), (0, rxjs_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, rxjs_1.concatMap)((executor) => {
executors.set(name, executor);
return executor(options, task.context);
}));
}));
return taskObservable;
}
}
exports.SchematicEngine = SchematicEngine;
//# sourceMappingURL=engine.js.map
File diff suppressed because one or more lines are too long
+10
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
*/
export * from './engine';
export * from './interface';
export * from './schematic';
+27
View File
@@ -0,0 +1,27 @@
"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
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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);
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,8CAA4B;AAC5B,8CAA4B"}
+154
View File
@@ -0,0 +1,154 @@
/**
* @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 { logging } from '@angular-devkit/core';
import { Url } from 'node:url';
import { Observable } from 'rxjs';
import { FileEntry, MergeStrategy, Tree } from '../tree/interface';
import { Workflow } from '../workflow/interface';
export interface TaskConfiguration<T = {}> {
name: string;
dependencies?: Array<TaskId>;
options?: T;
}
export interface TaskConfigurationGenerator<T = {}> {
toConfiguration(): TaskConfiguration<T>;
}
export type TaskExecutor<T = {}> = (options: T | undefined, context: SchematicContext) => Promise<void> | Observable<void>;
export interface TaskExecutorFactory<T> {
readonly name: string;
create(options?: T): Promise<TaskExecutor> | Observable<TaskExecutor>;
}
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 type CollectionDescription<CollectionMetadataT extends object> = 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 type SchematicDescription<CollectionMetadataT extends object, SchematicMetadataT extends object> = SchematicMetadataT & {
readonly collection: CollectionDescription<CollectionMetadataT>;
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<CollectionMetadataT extends object, SchematicMetadataT extends object> {
createCollectionDescription(name: string, requester?: CollectionDescription<CollectionMetadataT>): CollectionDescription<CollectionMetadataT>;
listSchematicNames(collection: CollectionDescription<CollectionMetadataT>, includeHidden?: boolean): string[];
createSchematicDescription(name: string, collection: CollectionDescription<CollectionMetadataT>): SchematicDescription<CollectionMetadataT, SchematicMetadataT> | null;
getSchematicRuleFactory<OptionT extends object>(schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, collection: CollectionDescription<CollectionMetadataT>): RuleFactory<OptionT>;
createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Source | null;
transformOptions<OptionT extends object, ResultT extends object>(schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, options: OptionT, context?: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Observable<ResultT>;
transformContext(context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): TypedSchematicContext<CollectionMetadataT, SchematicMetadataT> | void;
createTaskExecutor(name: string): Observable<TaskExecutor>;
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<CollectionMetadataT extends object, SchematicMetadataT extends object> {
createCollection(name: string, requester?: Collection<CollectionMetadataT, SchematicMetadataT>): Collection<CollectionMetadataT, SchematicMetadataT>;
createContext(schematic: Schematic<CollectionMetadataT, SchematicMetadataT>, parent?: Partial<TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>>, executionOptions?: Partial<ExecutionOptions>): TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>;
createSchematic(name: string, collection: Collection<CollectionMetadataT, SchematicMetadataT>): Schematic<CollectionMetadataT, SchematicMetadataT>;
createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Source;
transformOptions<OptionT extends object, ResultT extends object>(schematic: Schematic<CollectionMetadataT, SchematicMetadataT>, options: OptionT, context?: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Observable<ResultT>;
executePostTasks(): Observable<void>;
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<CollectionMetadataT extends object, SchematicMetadataT extends object> {
readonly description: CollectionDescription<CollectionMetadataT>;
readonly baseDescriptions?: Array<CollectionDescription<CollectionMetadataT>>;
createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionMetadataT, SchematicMetadataT>;
listSchematicNames(includeHidden?: boolean): 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<CollectionMetadataT extends object, SchematicMetadataT extends object> {
readonly description: SchematicDescription<CollectionMetadataT, SchematicMetadataT>;
readonly collection: Collection<CollectionMetadataT, SchematicMetadataT>;
call<OptionT extends object>(options: OptionT, host: Observable<Tree>, parentContext?: Partial<TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>>, executionOptions?: Partial<ExecutionOptions>): Observable<Tree>;
}
/**
* 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<CollectionMetadataT extends object, SchematicMetadataT extends object> {
readonly debug: boolean;
readonly engine: Engine<CollectionMetadataT, SchematicMetadataT>;
readonly logger: logging.LoggerApi;
readonly schematic: Schematic<CollectionMetadataT, SchematicMetadataT>;
readonly strategy: MergeStrategy;
readonly interactive: boolean;
addTask<T extends object>(task: TaskConfigurationGenerator<T>, dependencies?: Array<TaskId>): TaskId;
}
/**
* 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 type SchematicContext = TypedSchematicContext<{}, {}>;
/**
* A rule factory, which is normally the way schematics are implemented. Returned by the tooling
* after loading a schematic description.
*/
export type RuleFactory<T extends object> = (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 type FileOperator = (entry: FileEntry) => FileEntry | null;
export type AsyncFileOperator = (tree: FileEntry) => Observable<FileEntry | null>;
/**
* 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 type Source = (context: SchematicContext) => Tree | Observable<Tree>;
export type Rule = (tree: Tree, context: SchematicContext) => Tree | Observable<Tree> | Rule | Promise<void | Tree | Rule> | void;
+10
View File
@@ -0,0 +1,10 @@
"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 });
//# sourceMappingURL=interface.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["interface.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
+24
View File
@@ -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.dev/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<CollectionT extends object, SchematicT extends object> implements Schematic<CollectionT, SchematicT> {
private _description;
private _factory;
private _collection;
private _engine;
constructor(_description: SchematicDescription<CollectionT, SchematicT>, _factory: RuleFactory<{}>, _collection: Collection<CollectionT, SchematicT>, _engine: Engine<CollectionT, SchematicT>);
get description(): SchematicDescription<CollectionT, SchematicT>;
get collection(): Collection<CollectionT, SchematicT>;
call<OptionT extends object>(options: OptionT, host: Observable<Tree>, parentContext?: Partial<TypedSchematicContext<CollectionT, SchematicT>>, executionOptions?: Partial<ExecutionOptions>): Observable<Tree>;
}
+71
View File
@@ -0,0 +1,71 @@
"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.SchematicImpl = exports.InvalidSchematicsNameException = void 0;
const core_1 = require("@angular-devkit/core");
const rxjs_1 = require("rxjs");
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 {
_description;
_factory;
_collection;
_engine;
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, rxjs_1.first)(), (0, rxjs_1.concatMap)((tree) => this._engine
.transformOptions(this, options, context)
.pipe((0, rxjs_1.map)((o) => [tree, o]))), (0, rxjs_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), input, context).pipe((0, rxjs_1.map)((output) => {
if (output === input) {
return tree;
}
else if (scoped) {
tree.merge(output);
return tree;
}
else {
return output;
}
}));
}));
}
}
exports.SchematicImpl = SchematicImpl;
//# sourceMappingURL=schematic.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"schematic.js","sourceRoot":"","sources":["schematic.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAAqD;AACrD,+BAAyD;AACzD,wCAAyC;AAEzC,2CAA4C;AAW5C,MAAa,8BAA+B,SAAQ,oBAAa;IAC/D,YAAY,IAAY;QACtB,KAAK,CAAC,iCAAiC,IAAI,IAAI,CAAC,CAAC;IACnD,CAAC;CACF;AAJD,wEAIC;AAED,MAAa,aAAa;IAId;IACA;IACA;IACA;IAJV,YACU,YAA2D,EAC3D,QAAyB,EACzB,WAAgD,EAChD,OAAwC;QAHxC,iBAAY,GAAZ,YAAY,CAA+C;QAC3D,aAAQ,GAAR,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