@servicenow/sdk-build-core 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler.d.ts +2 -0
- package/dist/compiler.js +13 -7
- package/dist/compiler.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/now-config.d.ts +51 -3
- package/dist/now-config.js +44 -1
- package/dist/now-config.js.map +1 -1
- package/dist/package-inventory.d.ts +15 -0
- package/dist/package-inventory.js +59 -0
- package/dist/package-inventory.js.map +1 -0
- package/dist/plugins/context.d.ts +2 -2
- package/dist/plugins/file.d.ts +1 -0
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/index.js +0 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/plugin.d.ts +41 -53
- package/dist/plugins/plugin.js +517 -162
- package/dist/plugins/plugin.js.map +1 -1
- package/dist/plugins/shape.d.ts +13 -2
- package/dist/plugins/shape.js +96 -15
- package/dist/plugins/shape.js.map +1 -1
- package/dist/taxonomy.js +7 -2
- package/dist/taxonomy.js.map +1 -1
- package/dist/telemetry/clients/detect-agent.d.ts +4 -0
- package/dist/telemetry/clients/detect-agent.js +84 -0
- package/dist/telemetry/clients/detect-agent.js.map +1 -0
- package/dist/telemetry/clients/node-client.d.ts +2 -0
- package/dist/telemetry/clients/node-client.js +10 -9
- package/dist/telemetry/clients/node-client.js.map +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/xml.d.ts +2 -2
- package/dist/xml.js +2 -2
- package/dist/xml.js.map +1 -1
- package/now.config.schema.json +54 -0
- package/package.json +9 -5
- package/src/compiler.ts +14 -7
- package/src/index.ts +1 -0
- package/src/now-config.ts +56 -1
- package/src/package-inventory.ts +75 -0
- package/src/plugins/context.ts +2 -2
- package/src/plugins/file.ts +1 -0
- package/src/plugins/index.ts +0 -1
- package/src/plugins/plugin.ts +704 -231
- package/src/plugins/shape.ts +115 -24
- package/src/taxonomy.ts +8 -2
- package/src/telemetry/clients/detect-agent.ts +88 -0
- package/src/telemetry/clients/node-client.ts +12 -8
- package/src/telemetry/index.ts +1 -1
- package/src/xml.ts +11 -2
- package/dist/plugins/cache.d.ts +0 -15
- package/dist/plugins/cache.js +0 -22
- package/dist/plugins/cache.js.map +0 -1
- package/dist/plugins/usage.d.ts +0 -11
- package/dist/plugins/usage.js +0 -26
- package/dist/plugins/usage.js.map +0 -1
- package/src/plugins/cache.ts +0 -23
- package/src/plugins/usage.ts +0 -26
package/dist/plugins/plugin.d.ts
CHANGED
|
@@ -67,37 +67,12 @@ export type Relationship = {
|
|
|
67
67
|
};
|
|
68
68
|
export type CoalesceStrategy = [string, ...string[]] | ((properties: ObjectShape) => globalThis.Record<string, string | StringShape> | ObjectShape);
|
|
69
69
|
export type FileType = 'fluent' | 'module' | 'json' | 'unknown';
|
|
70
|
-
export type PluginApiDoc = {
|
|
71
|
-
/**
|
|
72
|
-
* The name of the API (e.g., 'BusinessRule', 'Acl', 'Table')
|
|
73
|
-
* This is the callee name used in fluent code.
|
|
74
|
-
*/
|
|
75
|
-
apiName: string;
|
|
76
|
-
/**
|
|
77
|
-
* Tags for categorizing and organizing the API documentation
|
|
78
|
-
*/
|
|
79
|
-
tags: string[];
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Manifest structure for API documentation.
|
|
83
|
-
*/
|
|
84
|
-
export type DocsManifest = {
|
|
85
|
-
[apiName: string]: {
|
|
86
|
-
docPath: string;
|
|
87
|
-
tags: string[];
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
70
|
export type PluginConfig<Nodes extends SupportedKindName[] = SupportedKindName[], Shapes extends ShapeClass[] = ShapeClass[], Records extends string[] = string[]> = {
|
|
91
71
|
/**
|
|
92
72
|
* The name of the plugin. Must end with "Plugin" suffix. This name is used in metrics
|
|
93
73
|
* and error messages.
|
|
94
74
|
*/
|
|
95
75
|
name: `${string}Plugin`;
|
|
96
|
-
/**
|
|
97
|
-
* Documentation for the APIs provided by this plugin. This is used to automatically
|
|
98
|
-
* generate documentation that can be retrieved via the getDocsMetadata() method.
|
|
99
|
-
*/
|
|
100
|
-
docs: PluginApiDoc[];
|
|
101
76
|
/**
|
|
102
77
|
* The TypeScript AST nodes this plugin handles. Plugins that do not introduce new
|
|
103
78
|
* syntax should not need to define any handlers here.
|
|
@@ -364,7 +339,7 @@ export type PluginConfig<Nodes extends SupportedKindName[] = SupportedKindName[]
|
|
|
364
339
|
/**
|
|
365
340
|
* A regex pattern or predicate to apply to a file's path to determine if it should be handled by this plugin.
|
|
366
341
|
*/
|
|
367
|
-
matcher?: RegExp |
|
|
342
|
+
matcher?: RegExp | FileMatcher;
|
|
368
343
|
/**
|
|
369
344
|
* Indicates whether this file should be parsed as an entry point when generating output. (Default: false)
|
|
370
345
|
*/
|
|
@@ -379,15 +354,25 @@ export type PluginConfig<Nodes extends SupportedKindName[] = SupportedKindName[]
|
|
|
379
354
|
*/
|
|
380
355
|
toRecord?(file: File, context: Context): Result<Record> | Promise<Result<Record>>;
|
|
381
356
|
}[];
|
|
357
|
+
/**
|
|
358
|
+
* @deprecated This property is no longer read and will be removed in a
|
|
359
|
+
* future release.
|
|
360
|
+
*/
|
|
361
|
+
docs?: any[];
|
|
382
362
|
};
|
|
383
363
|
type SearchableRelationships = {
|
|
384
364
|
[table: string]: Relationships;
|
|
385
365
|
};
|
|
366
|
+
type FileMatcher = (path: string, context: Context) => boolean | Promise<boolean>;
|
|
367
|
+
type EntryPoints = {
|
|
368
|
+
readonly nodes: Map<SupportedKindName, Set<FileType | '*'>>;
|
|
369
|
+
readonly files: {
|
|
370
|
+
readonly plugin: Plugin;
|
|
371
|
+
readonly matcher: RegExp | FileMatcher;
|
|
372
|
+
}[];
|
|
373
|
+
};
|
|
386
374
|
export declare class Plugin {
|
|
387
375
|
private readonly config;
|
|
388
|
-
private readonly nodeToShapeCache;
|
|
389
|
-
private readonly shapeToSubclassCache;
|
|
390
|
-
private readonly shapeToRecordCache;
|
|
391
376
|
private readonly relationships;
|
|
392
377
|
private readonly references;
|
|
393
378
|
private constructor();
|
|
@@ -518,14 +503,6 @@ export declare class Plugin {
|
|
|
518
503
|
*/
|
|
519
504
|
static create<const N extends SupportedKindName[], const S extends ShapeClass[]>(config: PluginConfig<N, S>): Plugin;
|
|
520
505
|
getName(): string;
|
|
521
|
-
/**
|
|
522
|
-
* Get documentation metadata for APIs provided by this plugin.
|
|
523
|
-
*/
|
|
524
|
-
getDocsMetadata(): {
|
|
525
|
-
[apiName: string]: {
|
|
526
|
-
tags: string[];
|
|
527
|
-
};
|
|
528
|
-
} | undefined;
|
|
529
506
|
getDescendants(parent: Record, database: Database): Record[];
|
|
530
507
|
private traverseDescendants;
|
|
531
508
|
getCoalesceStrategy(table: string): CoalesceStrategy | undefined;
|
|
@@ -535,20 +512,18 @@ export declare class Plugin {
|
|
|
535
512
|
[column: string]: string;
|
|
536
513
|
};
|
|
537
514
|
getRelationships(): SearchableRelationships;
|
|
538
|
-
flushCache(): void;
|
|
539
|
-
nodeToShape(node: SupportedNode, context: Omit<Context, 'self'>): Promise<Result<Shape>>;
|
|
540
515
|
commit(shape: Shape, target: ts.Node, context: Omit<CommitContext, 'self'>): Promise<CommitResult>;
|
|
541
516
|
getTarget(shape: Shape, context: Omit<Context, 'self'>): Promise<Result<ts.Node>>;
|
|
542
|
-
shapeToSubclass<const S extends Shape>(shape: S, context: Omit<Context, 'self'>): Promise<Result<S>>;
|
|
543
|
-
shapeToRecord(shape: Shape, context: Omit<Context, 'self'>): Promise<Result<Record>>;
|
|
544
517
|
private recordToShape0;
|
|
545
|
-
recordToShape({ record, database, context, }: {
|
|
518
|
+
recordToShape({ record, database, existingDatabase, context, }: {
|
|
546
519
|
record: Record;
|
|
547
520
|
database: Database;
|
|
521
|
+
existingDatabase?: Database;
|
|
548
522
|
context: Omit<Context, 'self'>;
|
|
549
523
|
}): Promise<Result<Shape>>;
|
|
550
|
-
recordsToShapes({ database, creatorOnly, changedOnly, mode, handledRecords, context, }: {
|
|
524
|
+
recordsToShapes({ database, existingDatabase, creatorOnly, changedOnly, mode, handledRecords, context, }: {
|
|
551
525
|
database: Database;
|
|
526
|
+
existingDatabase?: Database;
|
|
552
527
|
creatorOnly: boolean;
|
|
553
528
|
changedOnly?: boolean;
|
|
554
529
|
mode: 'explicit' | 'catch-all';
|
|
@@ -570,18 +545,30 @@ export declare class Plugin {
|
|
|
570
545
|
handledGuids: Set<string>;
|
|
571
546
|
context: Omit<Context, 'self'>;
|
|
572
547
|
}): Promise<Result<OutputFile[]>>;
|
|
573
|
-
|
|
548
|
+
getEntryPoints(): EntryPoints;
|
|
574
549
|
fileToRecord(file: File, context: Omit<Context, 'self'>): Promise<Result<Record>>;
|
|
575
550
|
inspect(shape: Shape, context: Omit<Context, 'self'>): void;
|
|
576
551
|
getUpdateName(record: Record, context: Omit<Context, 'self'>): Promise<Result<string>>;
|
|
552
|
+
getConfig(): PluginConfig;
|
|
577
553
|
}
|
|
578
|
-
export declare class Plugins {
|
|
579
|
-
private
|
|
554
|
+
export declare class Plugins implements Iterable<Plugin> {
|
|
555
|
+
private plugins;
|
|
556
|
+
private nodeToShapeCache;
|
|
557
|
+
private shapeToSubclassCache;
|
|
558
|
+
private shapeToRecordCache;
|
|
559
|
+
private readonly entryPoints;
|
|
580
560
|
constructor(plugins: Plugin[]);
|
|
581
|
-
|
|
582
|
-
|
|
561
|
+
private static createEntry;
|
|
562
|
+
private get;
|
|
563
|
+
[Symbol.iterator](): Iterator<Plugin>;
|
|
564
|
+
reload(): void;
|
|
583
565
|
prepend(...plugins: Plugin[]): void;
|
|
584
566
|
append(...plugins: Plugin[]): void;
|
|
567
|
+
getShapeCountPerPlugin(): {
|
|
568
|
+
plugin: string;
|
|
569
|
+
count: number;
|
|
570
|
+
}[];
|
|
571
|
+
clearShapeCounts(): void;
|
|
585
572
|
getCoalesceStrategy(table: string): CoalesceStrategy | undefined;
|
|
586
573
|
isComposite(table: string): boolean;
|
|
587
574
|
getCoalesceTables(): Set<string>;
|
|
@@ -589,10 +576,11 @@ export declare class Plugins {
|
|
|
589
576
|
[column: string]: string;
|
|
590
577
|
};
|
|
591
578
|
isEntryPoint(pathOrNode: string | SupportedNode, context: Omit<Context, 'self'>): Promise<boolean>;
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
579
|
+
nodeToShape(node: SupportedNode, context: Omit<Context, 'self'>, ...plugins: (string | Plugin)[]): Promise<Result<Shape>>;
|
|
580
|
+
private nodeToShape0;
|
|
581
|
+
shapeToSubclass<const S extends Shape>(shape: S, context: Omit<Context, 'self'>, ...plugins: (string | Plugin)[]): Promise<S>;
|
|
582
|
+
private shapeToSubclass0;
|
|
583
|
+
shapeToRecord(shape: Shape, context: Omit<Context, 'self'>, ...plugins: (string | Plugin)[]): Promise<Result<Record>>;
|
|
584
|
+
private shapeToRecord0;
|
|
597
585
|
}
|
|
598
586
|
export {};
|