@servicenow/sdk-build-core 4.6.1 → 4.7.1

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.
Files changed (53) hide show
  1. package/dist/compiler.d.ts +2 -0
  2. package/dist/compiler.js +13 -7
  3. package/dist/compiler.js.map +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/now-config.d.ts +37 -0
  8. package/dist/now-config.js +9 -0
  9. package/dist/now-config.js.map +1 -1
  10. package/dist/package-inventory.d.ts +15 -0
  11. package/dist/package-inventory.js +59 -0
  12. package/dist/package-inventory.js.map +1 -0
  13. package/dist/plugins/context.d.ts +2 -2
  14. package/dist/plugins/index.d.ts +0 -1
  15. package/dist/plugins/index.js +0 -1
  16. package/dist/plugins/index.js.map +1 -1
  17. package/dist/plugins/plugin.d.ts +41 -53
  18. package/dist/plugins/plugin.js +502 -160
  19. package/dist/plugins/plugin.js.map +1 -1
  20. package/dist/plugins/shape.d.ts +13 -2
  21. package/dist/plugins/shape.js +96 -15
  22. package/dist/plugins/shape.js.map +1 -1
  23. package/dist/taxonomy.js +7 -2
  24. package/dist/taxonomy.js.map +1 -1
  25. package/dist/telemetry/clients/detect-agent.d.ts +4 -0
  26. package/dist/telemetry/clients/detect-agent.js +84 -0
  27. package/dist/telemetry/clients/detect-agent.js.map +1 -0
  28. package/dist/telemetry/clients/node-client.d.ts +2 -0
  29. package/dist/telemetry/clients/node-client.js +10 -9
  30. package/dist/telemetry/clients/node-client.js.map +1 -1
  31. package/dist/telemetry/index.d.ts +1 -1
  32. package/now.config.schema.json +19 -0
  33. package/package.json +9 -5
  34. package/src/compiler.ts +14 -7
  35. package/src/index.ts +1 -0
  36. package/src/now-config.ts +11 -0
  37. package/src/package-inventory.ts +75 -0
  38. package/src/plugins/context.ts +2 -2
  39. package/src/plugins/index.ts +0 -1
  40. package/src/plugins/plugin.ts +682 -228
  41. package/src/plugins/shape.ts +115 -24
  42. package/src/taxonomy.ts +8 -2
  43. package/src/telemetry/clients/detect-agent.ts +88 -0
  44. package/src/telemetry/clients/node-client.ts +12 -8
  45. package/src/telemetry/index.ts +1 -1
  46. package/dist/plugins/cache.d.ts +0 -15
  47. package/dist/plugins/cache.js +0 -22
  48. package/dist/plugins/cache.js.map +0 -1
  49. package/dist/plugins/usage.d.ts +0 -11
  50. package/dist/plugins/usage.js +0 -26
  51. package/dist/plugins/usage.js.map +0 -1
  52. package/src/plugins/cache.ts +0 -23
  53. package/src/plugins/usage.ts +0 -26
@@ -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 | ((path: string, context: Context) => boolean | Promise<boolean>);
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
- isEntryPoint(pathOrNode: string | SupportedNode, context: Omit<Context, 'self'>): Promise<boolean>;
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 readonly plugins;
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
- toArray(): Plugin[];
582
- remove(name: string): void;
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
- getDocsMetadata(): {
593
- [apiName: string]: {
594
- tags: string[];
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 {};