/
_golden-api.d.ts
703 lines (574 loc) · 27.5 KB
/
_golden-api.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
export declare type Action = CreateFileAction | OverwriteFileAction | RenameFileAction | DeleteFileAction;
export interface ActionBase {
readonly id: number;
readonly parent: number;
readonly path: Path;
}
export declare class ActionList implements Iterable<Action> {
readonly length: number;
[Symbol.iterator](): IterableIterator<Action>;
protected _action(action: Partial<Action>): void;
create(path: Path, content: Buffer): void;
delete(path: Path): void;
find(predicate: (value: Action) => boolean): Action | null;
forEach(fn: (value: Action, index: number, array: Action[]) => void, thisArg?: {}): void;
get(i: number): Action;
has(action: Action): boolean;
optimize(): void;
overwrite(path: Path, content: Buffer): void;
push(action: Action): void;
rename(path: Path, to: Path): void;
}
export declare function apply(source: Source, rules: Rule[]): Source;
export declare function applyContentTemplate<T>(options: T): FileOperator;
export declare function applyPathTemplate<T extends PathTemplateData>(data: T, options?: PathTemplateOptions): FileOperator;
export declare function applyTemplates<T>(options: T): Rule;
export declare function applyToSubtree(path: string, rules: Rule[]): Rule;
export declare function asSource(rule: Rule): Source;
export declare type AsyncFileOperator = (tree: FileEntry) => Observable<FileEntry | null>;
export declare abstract class BaseWorkflow implements Workflow {
protected _context: WorkflowExecutionContext[];
protected _dryRun: boolean;
protected _engine: SchematicEngine<{}, {}>;
protected _engineHost: EngineHost<{}, {}>;
protected _force: boolean;
protected _host: virtualFs.Host;
protected _lifeCycle: Subject<LifeCycleEvent>;
protected _registry: schema.CoreSchemaRegistry;
protected _reporter: Subject<DryRunEvent>;
readonly context: Readonly<WorkflowExecutionContext>;
readonly lifeCycle: Observable<LifeCycleEvent>;
readonly registry: schema.SchemaRegistry;
readonly reporter: Observable<DryRunEvent>;
constructor(options: BaseWorkflowOptions);
protected _createSinks(): Sink[];
execute(options: Partial<WorkflowExecutionContext> & RequiredWorkflowExecutionContext): Observable<void>;
}
export interface BaseWorkflowOptions {
dryRun?: boolean;
engineHost: EngineHost<{}, {}>;
force?: boolean;
host: virtualFs.Host;
registry?: schema.CoreSchemaRegistry;
}
export declare function branchAndMerge(rule: Rule, strategy?: MergeStrategy): Rule;
export declare function callRule(rule: Rule, input: Observable<Tree>, context: SchematicContext): Observable<Tree>;
export declare function callSource(source: Source, context: SchematicContext): Observable<Tree>;
export declare function chain(rules: Rule[]): Rule;
export declare class CircularCollectionException extends BaseException {
constructor(name: string);
}
export interface Collection<CollectionMetadataT extends object, SchematicMetadataT extends object> {
readonly baseDescriptions?: Array<CollectionDescription<CollectionMetadataT>>;
readonly description: CollectionDescription<CollectionMetadataT>;
createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionMetadataT, SchematicMetadataT>;
listSchematicNames(): string[];
}
export declare type CollectionDescription<CollectionMetadataT extends object> = CollectionMetadataT & {
readonly name: string;
readonly extends?: string[];
};
export declare class CollectionImpl<CollectionT extends object, SchematicT extends object> implements Collection<CollectionT, SchematicT> {
readonly baseDescriptions?: CollectionDescription<CollectionT>[] | undefined;
readonly description: CollectionDescription<CollectionT>;
readonly name: string;
constructor(_description: CollectionDescription<CollectionT>, _engine: SchematicEngine<CollectionT, SchematicT>, baseDescriptions?: CollectionDescription<CollectionT>[] | undefined);
createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionT, SchematicT>;
listSchematicNames(): string[];
}
export declare function composeFileOperators(operators: FileOperator[]): FileOperator;
export declare class ContentHasMutatedException extends BaseException {
constructor(path: string);
}
export declare function contentTemplate<T>(options: T): Rule;
export interface CreateFileAction extends ActionBase {
readonly content: Buffer;
readonly kind: 'c';
}
export declare class DelegateTree implements Tree {
protected _other: Tree;
readonly actions: Action[];
readonly root: DirEntry;
constructor(_other: Tree);
apply(action: Action, strategy?: MergeStrategy): void;
beginUpdate(path: string): UpdateRecorder;
branch(): Tree;
commitUpdate(record: UpdateRecorder): void;
create(path: string, content: Buffer | string): void;
delete(path: string): void;
exists(path: string): boolean;
get(path: string): FileEntry | null;
getDir(path: string): DirEntry;
merge(other: Tree, strategy?: MergeStrategy): void;
overwrite(path: string, content: Buffer | string): void;
read(path: string): Buffer | null;
rename(from: string, to: string): void;
visit(visitor: FileVisitor): void;
}
export interface DeleteFileAction extends ActionBase {
readonly kind: 'd';
}
export interface DirEntry {
readonly parent: DirEntry | null;
readonly path: Path;
readonly subdirs: PathFragment[];
readonly subfiles: PathFragment[];
dir(name: PathFragment): DirEntry;
file(name: PathFragment): FileEntry | null;
visit(visitor: FileVisitor): void;
}
export interface DryRunCreateEvent {
content: Buffer;
kind: 'create';
path: string;
}
export interface DryRunDeleteEvent {
kind: 'delete';
path: string;
}
export interface DryRunErrorEvent {
description: 'alreadyExist' | 'doesNotExist';
kind: 'error';
path: string;
}
export declare type DryRunEvent = DryRunErrorEvent | DryRunDeleteEvent | DryRunCreateEvent | DryRunUpdateEvent | DryRunRenameEvent;
export interface DryRunRenameEvent {
kind: 'rename';
path: string;
to: string;
}
export declare class DryRunSink extends HostSink {
protected _fileAlreadyExistExceptionSet: Set<string>;
protected _fileDoesNotExistExceptionSet: Set<string>;
protected _subject: Subject<DryRunEvent>;
readonly reporter: Observable<DryRunEvent>;
constructor(dir: string, force?: boolean);
constructor(host: virtualFs.Host, force?: boolean);
_done(): Observable<void>;
protected _fileAlreadyExistException(path: string): void;
protected _fileDoesNotExistException(path: string): void;
}
export interface DryRunUpdateEvent {
content: Buffer;
kind: 'update';
path: string;
}
export declare function empty(): Source;
export declare class EmptyTree extends HostTree {
constructor();
}
export interface Engine<CollectionMetadataT extends object, SchematicMetadataT extends object> {
readonly defaultMergeStrategy: MergeStrategy;
readonly workflow: Workflow | null;
createCollection(name: string): 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;
executePostTasks(): Observable<void>;
transformOptions<OptionT extends object, ResultT extends object>(schematic: Schematic<CollectionMetadataT, SchematicMetadataT>, options: OptionT, context?: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Observable<ResultT>;
}
export interface EngineHost<CollectionMetadataT extends object, SchematicMetadataT extends object> {
readonly defaultMergeStrategy?: MergeStrategy;
createCollectionDescription(name: string): CollectionDescription<CollectionMetadataT>;
createSchematicDescription(name: string, collection: CollectionDescription<CollectionMetadataT>): SchematicDescription<CollectionMetadataT, SchematicMetadataT> | null;
createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Source | null;
createTaskExecutor(name: string): Observable<TaskExecutor>;
getSchematicRuleFactory<OptionT extends object>(schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, collection: CollectionDescription<CollectionMetadataT>): RuleFactory<OptionT>;
hasTaskExecutor(name: string): boolean;
listSchematicNames(collection: CollectionDescription<CollectionMetadataT>): string[];
listSchematics(collection: Collection<CollectionMetadataT, SchematicMetadataT>): string[];
transformContext(context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): TypedSchematicContext<CollectionMetadataT, SchematicMetadataT> | void;
transformOptions<OptionT extends object, ResultT extends object>(schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, options: OptionT, context?: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Observable<ResultT>;
}
export interface ExecutionOptions {
interactive: boolean;
scope: string;
}
export declare function externalSchematic<OptionT extends object>(collectionName: string, schematicName: string, options: OptionT, executionOptions?: Partial<ExecutionOptions>): Rule;
export declare class FileAlreadyExistException extends BaseException {
constructor(path: string);
}
export declare class FileDoesNotExistException extends BaseException {
constructor(path: string);
}
export interface FileEntry {
readonly content: Buffer;
readonly path: Path;
}
export declare type FileOperator = (entry: FileEntry) => FileEntry | null;
export interface FilePredicate<T> {
(path: Path, entry?: Readonly<FileEntry> | null): T;
}
export declare class FileSystemCreateTree extends FileSystemTree {
constructor(host: virtualFs.Host);
}
export declare class FileSystemDirEntry extends VirtualDirEntry {
protected _host: virtualFs.SyncDelegateHost<{}>;
readonly parent: DirEntry | null;
readonly subdirs: PathFragment[];
readonly subfiles: PathFragment[];
constructor(_host: virtualFs.SyncDelegateHost<{}>, tree: FileSystemTree, path?: Path);
protected _createDir(name: PathFragment): DirEntry;
file(name: PathFragment): FileEntry | null;
}
export declare class FileSystemSink extends HostSink {
constructor(dir: string, force?: boolean);
}
export declare class FileSystemTree extends VirtualTree {
protected _host: virtualFs.SyncDelegateHost<{}>;
protected _initialized: boolean;
readonly tree: Map<Path, FileEntry>;
constructor(host: virtualFs.Host);
protected _copyTo<T extends VirtualTree>(tree: T): void;
protected _recursiveFileList(): Path[];
branch(): Tree;
get(path: string): FileEntry | null;
}
export declare type FileVisitor = FilePredicate<void>;
export declare const FileVisitorCancelToken: symbol;
export declare function filter(predicate: FilePredicate<boolean>): Rule;
export declare class FilterHostTree extends HostTree {
constructor(tree: HostTree, filter?: FilePredicate<boolean>);
}
export declare function forEach(operator: FileOperator): Rule;
export declare class HostCreateTree extends HostTree {
constructor(host: virtualFs.ReadonlyHost);
}
export declare class HostDirEntry implements DirEntry {
protected _host: virtualFs.SyncDelegateHost;
protected _tree: Tree;
readonly parent: DirEntry | null;
readonly path: Path;
readonly subdirs: PathFragment[];
readonly subfiles: PathFragment[];
constructor(parent: DirEntry | null, path: Path, _host: virtualFs.SyncDelegateHost, _tree: Tree);
dir(name: PathFragment): DirEntry;
file(name: PathFragment): FileEntry | null;
visit(visitor: FileVisitor): void;
}
export declare class HostSink extends SimpleSinkBase {
protected _filesToCreate: Map<Path, UpdateBuffer>;
protected _filesToDelete: Set<Path>;
protected _filesToRename: Set<[Path, Path]>;
protected _filesToUpdate: Map<Path, UpdateBuffer>;
protected _force: boolean;
protected _host: virtualFs.Host;
constructor(_host: virtualFs.Host, _force?: boolean);
protected _createFile(path: Path, content: Buffer): Observable<void>;
protected _deleteFile(path: Path): Observable<void>;
_done(): Observable<void>;
protected _overwriteFile(path: Path, content: Buffer): Observable<void>;
protected _renameFile(from: Path, to: Path): Observable<void>;
protected _validateCreateAction(action: CreateFileAction): Observable<void>;
protected _validateFileExists(p: Path): Observable<boolean>;
}
export declare class HostTree implements Tree {
protected _backend: virtualFs.ReadonlyHost<{}>;
readonly actions: Action[];
readonly root: DirEntry;
constructor(_backend?: virtualFs.ReadonlyHost<{}>);
protected _normalizePath(path: string): Path;
protected _willCreate(path: Path): boolean;
protected _willDelete(path: Path): boolean;
protected _willOverwrite(path: Path): boolean;
protected _willRename(path: Path): boolean;
apply(action: Action, strategy?: MergeStrategy): void;
beginUpdate(path: string): UpdateRecorder;
branch(): Tree;
commitUpdate(record: UpdateRecorder): void;
create(path: string, content: Buffer | string): void;
delete(path: string): void;
exists(path: string): boolean;
get(path: string): FileEntry | null;
getDir(path: string): DirEntry;
merge(other: Tree, strategy?: MergeStrategy): void;
optimize(): this;
overwrite(path: string, content: Buffer | string): void;
read(path: string): Buffer | null;
rename(from: string, to: string): void;
visit(visitor: FileVisitor): void;
static isHostTree(tree: Tree): tree is HostTree;
}
export declare const htmlSelectorFormat: schema.SchemaFormat;
export declare class InvalidPipeException extends BaseException {
constructor(name: string);
}
export declare class InvalidRuleResultException extends BaseException {
constructor(value?: {});
}
export declare class InvalidSchematicsNameException extends BaseException {
constructor(name: string);
}
export declare class InvalidSourceResultException extends BaseException {
constructor(value?: {});
}
export declare class InvalidUpdateRecordException extends BaseException {
constructor();
}
export declare function isAction(action: any): action is Action;
export declare function isContentAction(action: Action): action is CreateFileAction | OverwriteFileAction;
export interface LifeCycleEvent {
kind: 'start' | 'end' | 'workflow-start' | 'workflow-end' | 'post-tasks-start' | 'post-tasks-end';
}
export declare class MergeConflictException extends BaseException {
constructor(path: string);
}
export declare enum MergeStrategy {
AllowOverwriteConflict = 2,
AllowCreationConflict = 4,
AllowDeleteConflict = 8,
Default = 0,
Error = 1,
ContentOnly = 2,
Overwrite = 14
}
export declare function mergeWith(source: Source, strategy?: MergeStrategy): Rule;
export declare function move(from: string, to?: string): Rule;
export declare function noop(): Rule;
export declare class OptionIsNotDefinedException extends BaseException {
constructor(name: string);
}
export interface OverwriteFileAction extends ActionBase {
readonly content: Buffer;
readonly kind: 'o';
}
export declare function partitionApplyMerge(predicate: FilePredicate<boolean>, ruleYes: Rule, ruleNo?: Rule): Rule;
export declare const pathFormat: schema.SchemaFormat;
export declare function pathTemplate<T extends PathTemplateData>(options: T): Rule;
export declare type PathTemplateData = {
[key: string]: PathTemplateValue | PathTemplateData | PathTemplatePipeFunction;
};
export interface PathTemplateOptions {
interpolationEnd: string;
interpolationStart: string;
pipeSeparator?: string;
}
export declare type PathTemplatePipeFunction = (x: string) => PathTemplateValue;
export declare type PathTemplateValue = boolean | string | number | undefined;
export declare class PrivateSchematicException extends BaseException {
constructor(name: string, collection: CollectionDescription<{}>);
}
export interface RandomOptions {
multi?: boolean | number;
multiFiles?: boolean | number;
root?: string;
}
export interface RenameFileAction extends ActionBase {
readonly kind: 'r';
readonly to: Path;
}
export declare function renameTemplateFiles(): Rule;
export interface RequiredWorkflowExecutionContext {
collection: string;
options: object;
schematic: string;
}
export declare type Rule = (tree: Tree, context: SchematicContext) => Tree | Observable<Tree> | Rule | void;
export declare type RuleFactory<T extends object> = (options: T) => Rule;
export declare function schematic<OptionT extends object>(schematicName: string, options: OptionT, executionOptions?: Partial<ExecutionOptions>): Rule;
export interface Schematic<CollectionMetadataT extends object, SchematicMetadataT extends object> {
readonly collection: Collection<CollectionMetadataT, SchematicMetadataT>;
readonly description: SchematicDescription<CollectionMetadataT, SchematicMetadataT>;
call<OptionT extends object>(options: OptionT, host: Observable<Tree>, parentContext?: Partial<TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>>, executionOptions?: Partial<ExecutionOptions>): Observable<Tree>;
}
export declare type SchematicContext = TypedSchematicContext<{}, {}>;
export declare type SchematicDescription<CollectionMetadataT extends object, SchematicMetadataT extends object> = SchematicMetadataT & {
readonly collection: CollectionDescription<CollectionMetadataT>;
readonly name: string;
readonly private?: boolean;
readonly hidden?: boolean;
};
export declare class SchematicEngine<CollectionT extends object, SchematicT extends object> implements Engine<CollectionT, SchematicT> {
protected _workflow?: Workflow | undefined;
readonly defaultMergeStrategy: MergeStrategy;
readonly workflow: Workflow | null;
constructor(_host: EngineHost<CollectionT, SchematicT>, _workflow?: Workflow | undefined);
createCollection(name: string): Collection<CollectionT, SchematicT>;
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>;
createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionT, SchematicT>): Source;
executePostTasks(): Observable<void>;
listSchematicNames(collection: Collection<CollectionT, SchematicT>): string[];
transformOptions<OptionT extends object, ResultT extends object>(schematic: Schematic<CollectionT, SchematicT>, options: OptionT, context?: TypedSchematicContext<CollectionT, SchematicT>): Observable<ResultT>;
}
export declare class SchematicEngineConflictingException extends BaseException {
constructor();
}
export declare class SchematicImpl<CollectionT extends object, SchematicT extends object> implements Schematic<CollectionT, SchematicT> {
readonly collection: Collection<CollectionT, SchematicT>;
readonly description: SchematicDescription<CollectionT, SchematicT>;
constructor(_description: SchematicDescription<CollectionT, SchematicT>, _factory: RuleFactory<{}>, _collection: Collection<CollectionT, SchematicT>, _engine: Engine<CollectionT, SchematicT>);
call<OptionT extends object>(options: OptionT, host: Observable<Tree>, parentContext?: Partial<TypedSchematicContext<CollectionT, SchematicT>>, executionOptions?: Partial<ExecutionOptions>): Observable<Tree>;
}
export declare class SchematicsException extends BaseException {
}
export declare abstract class SimpleSinkBase implements Sink {
postCommit: () => void | Observable<void>;
postCommitAction: (action: Action) => void | Observable<void>;
preCommit: () => void | Observable<void>;
preCommitAction: (action: Action) => void | Action | PromiseLike<Action> | Observable<Action>;
protected abstract _createFile(path: string, content: Buffer): Observable<void>;
protected abstract _deleteFile(path: string): Observable<void>;
protected abstract _done(): Observable<void>;
protected _fileAlreadyExistException(path: string): void;
protected _fileDoesNotExistException(path: string): void;
protected abstract _overwriteFile(path: string, content: Buffer): Observable<void>;
protected abstract _renameFile(path: string, to: string): Observable<void>;
protected _validateCreateAction(action: CreateFileAction): Observable<void>;
protected _validateDeleteAction(action: DeleteFileAction): Observable<void>;
protected abstract _validateFileExists(p: string): Observable<boolean>;
protected _validateOverwriteAction(action: OverwriteFileAction): Observable<void>;
protected _validateRenameAction(action: RenameFileAction): Observable<void>;
commit(tree: Tree): Observable<void>;
commitSingleAction(action: Action): Observable<void>;
validateSingleAction(action: Action): Observable<void>;
}
export interface Sink {
commit(tree: Tree): Observable<void>;
}
export declare function source(tree: Tree): Source;
export declare type Source = (context: SchematicContext) => Tree | Observable<Tree>;
export declare const standardFormats: schema.SchemaFormat[];
export interface TaskConfiguration<T = {}> {
dependencies?: Array<TaskId>;
name: string;
options?: T;
}
export interface TaskConfigurationGenerator<T = {}> {
toConfiguration(): TaskConfiguration<T>;
}
export declare 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 configuration: TaskConfiguration;
readonly context: SchematicContext;
readonly id: number;
readonly priority: number;
}
export declare class TaskScheduler {
constructor(_context: SchematicContext);
finalize(): ReadonlyArray<TaskInfo>;
schedule<T>(taskConfiguration: TaskConfiguration<T>): TaskId;
}
export declare function template<T>(options: T): Rule;
export declare const TEMPLATE_FILENAME_RE: RegExp;
export declare type Tree = TreeInterface;
export interface TreeConstructor {
branch(tree: TreeInterface): TreeInterface;
empty(): TreeInterface;
merge(tree: TreeInterface, other: TreeInterface, strategy?: MergeStrategy): TreeInterface;
optimize(tree: TreeInterface): TreeInterface;
partition(tree: TreeInterface, predicate: FilePredicate<boolean>): [TreeInterface, TreeInterface];
}
export declare const TreeSymbol: symbol;
export interface TypedSchematicContext<CollectionMetadataT extends object, SchematicMetadataT extends object> {
readonly debug: boolean;
readonly engine: Engine<CollectionMetadataT, SchematicMetadataT>;
readonly interactive: boolean;
readonly logger: logging.LoggerApi;
readonly schematic: Schematic<CollectionMetadataT, SchematicMetadataT>;
readonly strategy: MergeStrategy;
addTask<T>(task: TaskConfigurationGenerator<T>, dependencies?: Array<TaskId>): TaskId;
}
export declare class UnimplementedException extends BaseException {
constructor();
}
export declare class UnknownActionException extends BaseException {
constructor(action: Action);
}
export declare class UnknownCollectionException extends BaseException {
constructor(name: string);
}
export declare class UnknownPipeException extends BaseException {
constructor(name: string);
}
export declare class UnknownSchematicException extends BaseException {
constructor(name: string, collection: CollectionDescription<{}>);
}
export declare class UnknownTaskDependencyException extends BaseException {
constructor(id: TaskId);
}
export declare class UnknownUrlSourceProtocol extends BaseException {
constructor(url: string);
}
export declare class UnregisteredTaskException extends BaseException {
constructor(name: string, schematic?: SchematicDescription<{}, {}>);
}
export declare class UnsuccessfulWorkflowExecution extends BaseException {
constructor();
}
export interface UpdateRecorder {
insertLeft(index: number, content: Buffer | string): UpdateRecorder;
insertRight(index: number, content: Buffer | string): UpdateRecorder;
remove(index: number, length: number): UpdateRecorder;
}
export declare function url(urlString: string): Source;
export declare class VirtualDirEntry implements DirEntry {
protected _path: Path;
protected _subdirs: Map<PathFragment, DirEntry>;
protected _tree: VirtualTree;
readonly parent: DirEntry | null;
readonly path: Path;
readonly subdirs: PathFragment[];
readonly subfiles: PathFragment[];
constructor(_tree: VirtualTree, _path?: Path);
protected _createDir(name: PathFragment): DirEntry;
dir(name: PathFragment): DirEntry;
file(name: PathFragment): FileEntry | null;
visit(visitor: FileVisitor): void;
}
export declare class VirtualTree implements Tree {
protected _actions: ActionList;
protected _cacheMap: Map<Path, FileEntry>;
protected _root: VirtualDirEntry;
protected _tree: Map<Path, FileEntry>;
readonly actions: Action[];
readonly files: Path[];
readonly root: DirEntry;
readonly staging: ReadonlyMap<Path, FileEntry>;
protected readonly tree: ReadonlyMap<Path, FileEntry>;
protected _copyTo<T extends VirtualTree>(tree: T): void;
protected _create(path: Path, content: Buffer, action?: Action): void;
protected _delete(path: Path, action?: Action): void;
protected _normalizePath(path: string): Path;
protected _overwrite(path: Path, content: Buffer, action?: Action): void;
protected _rename(path: Path, to: Path, action?: Action, force?: boolean): void;
apply(action: Action, strategy: MergeStrategy): void;
beginUpdate(path: string): UpdateRecorder;
branch(): Tree;
commitUpdate(record: UpdateRecorder): void;
create(path: string, content: Buffer | string): void;
delete(path: string): void;
exists(path: string): boolean;
get(path: string): FileEntry | null;
getDir(path: string): DirEntry;
has(path: string): boolean;
merge(other: Tree, strategy?: MergeStrategy): void;
optimize(): void;
overwrite(path: string, content: Buffer | string): void;
read(path: string): Buffer | null;
rename(path: string, to: string): void;
set(entry: FileEntry): Map<Path, FileEntry>;
visit(visitor: FileVisitor): void;
static branch(tree: Tree): Tree;
static isVirtualTree(tree: Tree): tree is VirtualTree;
static merge(tree: Tree, other: Tree, strategy?: MergeStrategy): Tree;
static optimize(tree: Tree): VirtualTree;
}
export declare function when(predicate: FilePredicate<boolean>, operator: FileOperator): FileOperator;
export interface Workflow {
readonly context: Readonly<WorkflowExecutionContext>;
execute(options: Partial<WorkflowExecutionContext> & RequiredWorkflowExecutionContext): Observable<void>;
}
export interface WorkflowExecutionContext extends RequiredWorkflowExecutionContext {
allowPrivate?: boolean;
debug: boolean;
logger: logging.Logger;
parentContext?: Readonly<WorkflowExecutionContext>;
}