@servicenow/sdk-build-core 3.0.3 → 4.0.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.
Files changed (252) hide show
  1. package/dist/app.d.ts +25 -0
  2. package/dist/app.js +8 -0
  3. package/dist/app.js.map +1 -0
  4. package/dist/compiler.d.ts +60 -0
  5. package/dist/compiler.js +320 -0
  6. package/dist/compiler.js.map +1 -0
  7. package/dist/compression.d.ts +7 -0
  8. package/dist/compression.js +79 -0
  9. package/dist/compression.js.map +1 -0
  10. package/dist/crypto.d.ts +1 -0
  11. package/dist/crypto.js +9 -0
  12. package/dist/crypto.js.map +1 -0
  13. package/dist/diagnostic.d.ts +41 -0
  14. package/dist/diagnostic.js +130 -0
  15. package/dist/diagnostic.js.map +1 -0
  16. package/dist/{plugins/Diagnostic.d.ts → fluent-diagnostic.d.ts} +3 -2
  17. package/dist/fluent-diagnostic.js +23 -0
  18. package/dist/fluent-diagnostic.js.map +1 -0
  19. package/dist/fluent-directive.d.ts +8 -0
  20. package/dist/fluent-directive.js +54 -0
  21. package/dist/fluent-directive.js.map +1 -0
  22. package/dist/fluent-file.d.ts +5 -0
  23. package/dist/fluent-file.js +15 -0
  24. package/dist/fluent-file.js.map +1 -0
  25. package/dist/formatter.d.ts +11 -0
  26. package/dist/formatter.js +77 -0
  27. package/dist/formatter.js.map +1 -0
  28. package/dist/fs.d.ts +174 -0
  29. package/dist/fs.js +313 -0
  30. package/dist/fs.js.map +1 -0
  31. package/dist/guid.d.ts +2 -0
  32. package/dist/{GUID.js → guid.js} +3 -6
  33. package/dist/guid.js.map +1 -0
  34. package/dist/index.d.ts +19 -5
  35. package/dist/index.js +19 -5
  36. package/dist/index.js.map +1 -1
  37. package/dist/json.d.ts +5 -0
  38. package/dist/json.js +43 -0
  39. package/dist/json.js.map +1 -0
  40. package/dist/keys-registry.d.ts +64 -0
  41. package/dist/keys-registry.js +339 -0
  42. package/dist/keys-registry.js.map +1 -0
  43. package/dist/logger.d.ts +8 -0
  44. package/dist/logger.js +17 -0
  45. package/dist/logger.js.map +1 -0
  46. package/dist/now-config.d.ts +348 -0
  47. package/dist/now-config.js +283 -0
  48. package/dist/now-config.js.map +1 -0
  49. package/dist/path.d.ts +3 -0
  50. package/dist/path.js +12 -0
  51. package/dist/path.js.map +1 -0
  52. package/dist/plugins/cache.d.ts +20 -0
  53. package/dist/plugins/cache.js +46 -0
  54. package/dist/plugins/cache.js.map +1 -0
  55. package/dist/plugins/context.d.ts +85 -0
  56. package/dist/plugins/{Context.js → context.js} +1 -1
  57. package/dist/plugins/context.js.map +1 -0
  58. package/dist/plugins/database.d.ts +27 -0
  59. package/dist/plugins/database.js +102 -0
  60. package/dist/plugins/database.js.map +1 -0
  61. package/dist/plugins/file.d.ts +10 -0
  62. package/dist/plugins/{behaviors/Arranger.js → file.js} +1 -1
  63. package/dist/plugins/file.js.map +1 -0
  64. package/dist/plugins/index.d.ts +9 -5
  65. package/dist/plugins/index.js +9 -6
  66. package/dist/plugins/index.js.map +1 -1
  67. package/dist/plugins/plugin.d.ts +478 -0
  68. package/dist/plugins/plugin.js +533 -0
  69. package/dist/plugins/plugin.js.map +1 -0
  70. package/dist/plugins/product.d.ts +15 -0
  71. package/dist/plugins/product.js +38 -0
  72. package/dist/plugins/product.js.map +1 -0
  73. package/dist/plugins/project.d.ts +25 -0
  74. package/dist/plugins/{behaviors/Generator.js → project.js} +1 -1
  75. package/dist/plugins/project.js.map +1 -0
  76. package/dist/plugins/shape.d.ts +424 -0
  77. package/dist/plugins/shape.js +1181 -0
  78. package/dist/plugins/shape.js.map +1 -0
  79. package/dist/plugins/time.d.ts +12 -0
  80. package/dist/plugins/time.js +84 -0
  81. package/dist/plugins/time.js.map +1 -0
  82. package/dist/plugins/usage.d.ts +11 -0
  83. package/dist/plugins/usage.js +26 -0
  84. package/dist/plugins/usage.js.map +1 -0
  85. package/dist/prettier/config-loader.d.ts +13 -0
  86. package/dist/prettier/config-loader.js +105 -0
  87. package/dist/prettier/config-loader.js.map +1 -0
  88. package/dist/telemetry/index.d.ts +25 -0
  89. package/dist/telemetry/index.js +18 -0
  90. package/dist/telemetry/index.js.map +1 -0
  91. package/dist/typescript.d.ts +293 -0
  92. package/dist/typescript.js +454 -0
  93. package/dist/typescript.js.map +1 -0
  94. package/dist/util/get-file-type.d.ts +2 -0
  95. package/dist/util/get-file-type.js +13 -0
  96. package/dist/util/get-file-type.js.map +1 -0
  97. package/dist/util/index.d.ts +2 -6
  98. package/dist/util/index.js +2 -6
  99. package/dist/util/index.js.map +1 -1
  100. package/dist/util/{Scope.js → is-sn-scope.js} +1 -1
  101. package/dist/util/is-sn-scope.js.map +1 -0
  102. package/dist/xml.d.ts +24 -0
  103. package/dist/xml.js +71 -0
  104. package/dist/xml.js.map +1 -0
  105. package/now.config.schema.json +336 -0
  106. package/package.json +22 -12
  107. package/src/app.ts +33 -0
  108. package/src/compiler.ts +384 -0
  109. package/src/compression.ts +93 -0
  110. package/src/crypto.ts +5 -0
  111. package/src/diagnostic.ts +108 -0
  112. package/src/{plugins/Diagnostic.ts → fluent-diagnostic.ts} +3 -10
  113. package/src/fluent-directive.ts +63 -0
  114. package/src/fluent-file.ts +13 -0
  115. package/src/formatter.ts +58 -0
  116. package/src/fs.ts +438 -0
  117. package/src/{GUID.ts → guid.ts} +2 -6
  118. package/src/index.ts +19 -5
  119. package/src/json.ts +20 -0
  120. package/src/keys-registry.ts +384 -0
  121. package/src/logger.ts +20 -0
  122. package/src/now-config.ts +337 -0
  123. package/src/path.ts +9 -0
  124. package/src/plugins/cache.ts +45 -0
  125. package/src/plugins/context.ts +93 -0
  126. package/src/plugins/database.ts +121 -0
  127. package/src/plugins/file.ts +19 -0
  128. package/src/plugins/index.ts +9 -5
  129. package/src/plugins/plugin.ts +995 -0
  130. package/src/plugins/product.ts +44 -0
  131. package/src/plugins/project.ts +39 -0
  132. package/src/plugins/shape.ts +1532 -0
  133. package/src/plugins/time.ts +108 -0
  134. package/src/plugins/usage.ts +26 -0
  135. package/src/prettier/config-loader.ts +130 -0
  136. package/src/telemetry/index.ts +27 -0
  137. package/src/typescript.ts +502 -0
  138. package/src/util/get-file-type.ts +11 -0
  139. package/src/util/index.ts +2 -6
  140. package/src/xml.ts +86 -0
  141. package/dist/GUID.d.ts +0 -2
  142. package/dist/GUID.js.map +0 -1
  143. package/dist/IncludePaths.d.ts +0 -25
  144. package/dist/IncludePaths.js +0 -97
  145. package/dist/IncludePaths.js.map +0 -1
  146. package/dist/Keys.d.ts +0 -32
  147. package/dist/Keys.js +0 -245
  148. package/dist/Keys.js.map +0 -1
  149. package/dist/TypeScript.d.ts +0 -5
  150. package/dist/TypeScript.js +0 -58
  151. package/dist/TypeScript.js.map +0 -1
  152. package/dist/XML.d.ts +0 -32
  153. package/dist/XML.js +0 -83
  154. package/dist/XML.js.map +0 -1
  155. package/dist/plugins/Context.d.ts +0 -190
  156. package/dist/plugins/Context.js.map +0 -1
  157. package/dist/plugins/Diagnostic.js +0 -28
  158. package/dist/plugins/Diagnostic.js.map +0 -1
  159. package/dist/plugins/Plugin.d.ts +0 -175
  160. package/dist/plugins/Plugin.js +0 -15
  161. package/dist/plugins/Plugin.js.map +0 -1
  162. package/dist/plugins/behaviors/Arranger.d.ts +0 -26
  163. package/dist/plugins/behaviors/Arranger.js.map +0 -1
  164. package/dist/plugins/behaviors/Composer.d.ts +0 -102
  165. package/dist/plugins/behaviors/Composer.js +0 -15
  166. package/dist/plugins/behaviors/Composer.js.map +0 -1
  167. package/dist/plugins/behaviors/Diagnostics.d.ts +0 -7
  168. package/dist/plugins/behaviors/Diagnostics.js +0 -3
  169. package/dist/plugins/behaviors/Diagnostics.js.map +0 -1
  170. package/dist/plugins/behaviors/Generator.d.ts +0 -21
  171. package/dist/plugins/behaviors/Generator.js.map +0 -1
  172. package/dist/plugins/behaviors/OwnedTables.d.ts +0 -6
  173. package/dist/plugins/behaviors/OwnedTables.js +0 -3
  174. package/dist/plugins/behaviors/OwnedTables.js.map +0 -1
  175. package/dist/plugins/behaviors/PostProcessor.d.ts +0 -5
  176. package/dist/plugins/behaviors/PostProcessor.js +0 -3
  177. package/dist/plugins/behaviors/PostProcessor.js.map +0 -1
  178. package/dist/plugins/behaviors/Serializer.d.ts +0 -30
  179. package/dist/plugins/behaviors/Serializer.js +0 -3
  180. package/dist/plugins/behaviors/Serializer.js.map +0 -1
  181. package/dist/plugins/behaviors/Transformer.d.ts +0 -23
  182. package/dist/plugins/behaviors/Transformer.js +0 -3
  183. package/dist/plugins/behaviors/Transformer.js.map +0 -1
  184. package/dist/plugins/behaviors/extractors/Data.d.ts +0 -119
  185. package/dist/plugins/behaviors/extractors/Data.js +0 -244
  186. package/dist/plugins/behaviors/extractors/Data.js.map +0 -1
  187. package/dist/plugins/behaviors/extractors/Extractors.d.ts +0 -63
  188. package/dist/plugins/behaviors/extractors/Extractors.js +0 -3
  189. package/dist/plugins/behaviors/extractors/Extractors.js.map +0 -1
  190. package/dist/plugins/behaviors/extractors/index.d.ts +0 -2
  191. package/dist/plugins/behaviors/extractors/index.js +0 -19
  192. package/dist/plugins/behaviors/extractors/index.js.map +0 -1
  193. package/dist/plugins/behaviors/index.d.ts +0 -9
  194. package/dist/plugins/behaviors/index.js +0 -26
  195. package/dist/plugins/behaviors/index.js.map +0 -1
  196. package/dist/plugins/util/CallExpression.d.ts +0 -5
  197. package/dist/plugins/util/CallExpression.js +0 -88
  198. package/dist/plugins/util/CallExpression.js.map +0 -1
  199. package/dist/plugins/util/CodeTransformation.d.ts +0 -95
  200. package/dist/plugins/util/CodeTransformation.js +0 -624
  201. package/dist/plugins/util/CodeTransformation.js.map +0 -1
  202. package/dist/plugins/util/ObjectLiteral.d.ts +0 -9
  203. package/dist/plugins/util/ObjectLiteral.js +0 -37
  204. package/dist/plugins/util/ObjectLiteral.js.map +0 -1
  205. package/dist/plugins/util/index.d.ts +0 -3
  206. package/dist/plugins/util/index.js +0 -20
  207. package/dist/plugins/util/index.js.map +0 -1
  208. package/dist/util/Debug.d.ts +0 -4
  209. package/dist/util/Debug.js +0 -20
  210. package/dist/util/Debug.js.map +0 -1
  211. package/dist/util/Directive.d.ts +0 -16
  212. package/dist/util/Directive.js +0 -107
  213. package/dist/util/Directive.js.map +0 -1
  214. package/dist/util/RuntimeTableSchema.d.ts +0 -5
  215. package/dist/util/RuntimeTableSchema.js +0 -58
  216. package/dist/util/RuntimeTableSchema.js.map +0 -1
  217. package/dist/util/Scope.js.map +0 -1
  218. package/dist/util/Util.d.ts +0 -1
  219. package/dist/util/Util.js +0 -12
  220. package/dist/util/Util.js.map +0 -1
  221. package/dist/util/XMLUploadParser.d.ts +0 -22
  222. package/dist/util/XMLUploadParser.js +0 -67
  223. package/dist/util/XMLUploadParser.js.map +0 -1
  224. package/src/IncludePaths.ts +0 -122
  225. package/src/Keys.ts +0 -274
  226. package/src/TypeScript.ts +0 -65
  227. package/src/XML.ts +0 -98
  228. package/src/plugins/Context.ts +0 -239
  229. package/src/plugins/Plugin.ts +0 -278
  230. package/src/plugins/behaviors/Arranger.ts +0 -42
  231. package/src/plugins/behaviors/Composer.ts +0 -125
  232. package/src/plugins/behaviors/Diagnostics.ts +0 -12
  233. package/src/plugins/behaviors/Generator.ts +0 -31
  234. package/src/plugins/behaviors/OwnedTables.ts +0 -5
  235. package/src/plugins/behaviors/PostProcessor.ts +0 -6
  236. package/src/plugins/behaviors/Serializer.ts +0 -40
  237. package/src/plugins/behaviors/Transformer.ts +0 -32
  238. package/src/plugins/behaviors/extractors/Data.ts +0 -332
  239. package/src/plugins/behaviors/extractors/Extractors.ts +0 -73
  240. package/src/plugins/behaviors/extractors/index.ts +0 -2
  241. package/src/plugins/behaviors/index.ts +0 -9
  242. package/src/plugins/util/CallExpression.ts +0 -110
  243. package/src/plugins/util/CodeTransformation.ts +0 -731
  244. package/src/plugins/util/ObjectLiteral.ts +0 -37
  245. package/src/plugins/util/index.ts +0 -3
  246. package/src/util/Debug.ts +0 -24
  247. package/src/util/Directive.ts +0 -123
  248. package/src/util/RuntimeTableSchema.ts +0 -44
  249. package/src/util/Util.ts +0 -7
  250. package/src/util/XMLUploadParser.ts +0 -90
  251. /package/dist/util/{Scope.d.ts → is-sn-scope.d.ts} +0 -0
  252. /package/src/util/{Scope.ts → is-sn-scope.ts} +0 -0
@@ -0,0 +1,424 @@
1
+ import { type Source, Product } from './product';
2
+ import { ts } from '../typescript';
3
+ import type { Plugin } from './plugin';
4
+ import type { InstallCategory } from './file';
5
+ export type ShapeClass<P extends Shape = Shape> = (abstract new (...args: any[]) => P) & {
6
+ prototype: P;
7
+ };
8
+ export declare abstract class Shape<T = unknown> extends Product {
9
+ constructor({ source }: {
10
+ source: Source;
11
+ });
12
+ /**
13
+ * Instantiate an appropriate shape from the given value. If the value is already
14
+ * a shape, it will be returned as-is.
15
+ */
16
+ static from(source: Source, value: unknown): Shape;
17
+ /**
18
+ * Instantiate a NoOpShape which has no value and will not generate or update
19
+ * any code. Useful for shapes that are not supported for bidirectional sync.
20
+ */
21
+ static noOp(source: Source): NoOpShape;
22
+ /**
23
+ * Gets the value of the shape.
24
+ */
25
+ getValue(): T;
26
+ equals(value: unknown): boolean;
27
+ pipe<T>(pipeFn: (shape: this) => T): T;
28
+ isResolvable(): this is ResolvableShape;
29
+ isIdentifier(): this is IdentifierShape;
30
+ isString(): this is StringShape;
31
+ isStringLiteral(): this is StringLiteralShape;
32
+ isNumber(): this is NumberShape;
33
+ isBoolean(): this is BooleanShape;
34
+ isNoOp(): this is NoOpShape;
35
+ isUnresolved(): this is UnresolvedShape;
36
+ isUndefined(): this is UndefinedShape;
37
+ isDefined(): this is this;
38
+ isArray(): this is ArrayShape;
39
+ isObject(): this is ObjectShape;
40
+ isRecord(): this is Record;
41
+ isRecordId(): this is RecordId;
42
+ is<const T extends [Shape, Shape, ...Shape[]]>(shapeClasses: {
43
+ [I in keyof T]: ShapeClass<T[I]>;
44
+ }, failureMessage?: string): this is T[number];
45
+ is<const S extends Shape>(shapeClass: ShapeClass<S>, failureMessage?: string): this is S;
46
+ ifResolvable(): ResolvableShape | undefined;
47
+ ifIdentifier(): IdentifierShape | undefined;
48
+ ifString(): StringShape | undefined;
49
+ ifStringLiteral(): StringLiteralShape | undefined;
50
+ ifNumber(): NumberShape | undefined;
51
+ ifBoolean(): BooleanShape | undefined;
52
+ ifUnresolved(): UnresolvedShape | undefined;
53
+ ifUndefined(): UndefinedShape | undefined;
54
+ ifDefined(): this | undefined;
55
+ ifArray(): ArrayShape | undefined;
56
+ ifObject(): ObjectShape | undefined;
57
+ ifRecord(): Record | undefined;
58
+ ifRecordId(): RecordId | undefined;
59
+ if<const T extends [Shape, Shape, ...Shape[]]>(shapeClasses: {
60
+ [I in keyof T]: ShapeClass<T[I]>;
61
+ }, failureMessage?: string): T[number] | undefined;
62
+ if<const S extends Shape>(shapeClass: ShapeClass<S>, failureMessage?: string): S | undefined;
63
+ asResolvable(failureMessage?: string): ResolvableShape;
64
+ asIdentifier(failureMessage?: string): IdentifierShape;
65
+ asString(failureMessage?: string): StringShape;
66
+ asStringLiteral(failureMessage?: string): StringLiteralShape;
67
+ asNumber(failureMessage?: string): NumberShape;
68
+ asBoolean(failureMessage?: string): BooleanShape;
69
+ asUnresolved(failureMessage?: string): UnresolvedShape;
70
+ asUndefined(failureMessage?: string): UndefinedShape;
71
+ asArray(failureMessage?: string): ArrayShape;
72
+ asObject(failureMessage?: string): ObjectShape;
73
+ asRecord(failureMessage?: string): Record;
74
+ asRecordId(failureMessage?: string): RecordId;
75
+ as<const T extends [Shape, Shape, ...Shape[]]>(shapeClasses: {
76
+ [I in keyof T]: ShapeClass<T[I]>;
77
+ }, failureMessage?: string): T[number];
78
+ as<const S extends Shape>(shapeClass: ShapeClass<S>, failureMessage?: string): S;
79
+ toString(): StringShape;
80
+ toNumber(): NumberShape;
81
+ toBoolean(): BooleanShape;
82
+ toRecordId(): RecordId;
83
+ getKind(): string;
84
+ getDescription(): string;
85
+ getCode(): string;
86
+ }
87
+ export declare class NoOpShape extends Shape<never> {
88
+ constructor(source: Source);
89
+ getValue(): never;
90
+ }
91
+ export declare class UnresolvedShape extends Shape<symbol> {
92
+ static readonly CODE = "Now.UNRESOLVED";
93
+ static readonly VALUE: unique symbol;
94
+ getValue(): symbol;
95
+ getCode(): string;
96
+ }
97
+ export declare class UndefinedShape extends Shape<undefined> {
98
+ constructor({ source }: {
99
+ source: Source;
100
+ });
101
+ getValue(): undefined;
102
+ equals(other: unknown): boolean;
103
+ toString(): StringShape;
104
+ }
105
+ export declare class DeletedShape extends UndefinedShape {
106
+ }
107
+ export declare abstract class ResolvableShape extends Shape {
108
+ abstract resolve(deep?: boolean): Shape;
109
+ equals(other: unknown): boolean;
110
+ getValue(): unknown;
111
+ toString(): StringShape;
112
+ toNumber(): NumberShape;
113
+ toBoolean(): BooleanShape;
114
+ toRecordId(): RecordId;
115
+ }
116
+ export declare class IdentifierShape extends ResolvableShape {
117
+ private readonly name;
118
+ private readonly value;
119
+ constructor({ source, name, value, }: {
120
+ source: Source;
121
+ name: string;
122
+ value?: unknown;
123
+ });
124
+ getName(): string;
125
+ resolve(deep?: boolean): Shape;
126
+ getCode(): string;
127
+ equals(other: unknown): boolean;
128
+ }
129
+ type PropertyAccessElements = readonly [IdentifierShape, IdentifierShape, ...IdentifierShape[]];
130
+ export declare class PropertyAccessShape extends ResolvableShape {
131
+ private readonly elements;
132
+ constructor({ source, elements }: {
133
+ source: Source;
134
+ elements: readonly [unknown, unknown, ...unknown[]];
135
+ });
136
+ getElements(): PropertyAccessElements;
137
+ getElement(index: number): IdentifierShape;
138
+ getFirstElement(): IdentifierShape;
139
+ getLastElement(): IdentifierShape;
140
+ resolve(deep?: boolean): Shape<unknown>;
141
+ getCode(): string;
142
+ }
143
+ type StringContentType = 'plain' | 'cdata';
144
+ export declare abstract class StringShape extends Shape<string> {
145
+ private contentType;
146
+ startsWith(substring: string): boolean;
147
+ endsWith(substring: string): boolean;
148
+ includes(substring: string): boolean;
149
+ split(separator: string): string[];
150
+ isEmpty(): boolean;
151
+ ifNotEmpty(): StringShape | undefined;
152
+ replace(regex: string | RegExp, replacement: string): StringShape;
153
+ replaceAll(regex: string | RegExp, replacement: string): StringShape;
154
+ parseJson(): ObjectShape | ArrayShape;
155
+ withContentType(contentType: StringContentType): this;
156
+ getContentType(): StringContentType;
157
+ toBoolean(): BooleanShape;
158
+ static escapeSingleQuotes(str: string): string;
159
+ static escapeBackticks(str: string): string;
160
+ static escapeCdataTags(str: string): string;
161
+ }
162
+ export declare class StringLiteralShape extends StringShape {
163
+ private readonly literalText;
164
+ constructor({ source, literalText }: {
165
+ source: Source;
166
+ literalText: string | Shape;
167
+ });
168
+ getValue(): string;
169
+ getCode(): string;
170
+ }
171
+ type TemplateSubstitutionValue = Shape | string | boolean | number;
172
+ export type TemplateSubstitutions = ((expression: Shape) => TemplateSubstitutionValue) | globalThis.Record<number, ((expression: Shape) => TemplateSubstitutionValue) | TemplateSubstitutionValue>;
173
+ export declare class TemplateSpanShape extends StringShape {
174
+ private readonly literalText;
175
+ private readonly expression;
176
+ constructor({ source, literalText, expression, }: {
177
+ source: Source;
178
+ literalText: string | Shape;
179
+ expression: Shape;
180
+ });
181
+ getLiteralText(): string;
182
+ getExpression(): Shape;
183
+ getValue(substitution?: ((expression: Shape) => TemplateSubstitutionValue) | TemplateSubstitutionValue): string;
184
+ getCode(): string;
185
+ }
186
+ export declare class TemplateExpressionShape extends StringShape {
187
+ private readonly literalText;
188
+ private readonly spans;
189
+ constructor({ source, literalText, spans, }: {
190
+ source: Source;
191
+ literalText: string | Shape;
192
+ spans?: TemplateSpanShape[];
193
+ });
194
+ getLiteralText(): string;
195
+ hasSubstitution(): boolean;
196
+ getSpans(): TemplateSpanShape[];
197
+ getValue(substitutions?: TemplateSubstitutions): string;
198
+ getCode(): string;
199
+ }
200
+ export declare class TaggedTemplateExpressionShape extends StringShape {
201
+ private readonly tag;
202
+ private readonly template;
203
+ constructor({ source, tag, template }: {
204
+ source: Source;
205
+ tag: string | Shape;
206
+ template: Shape;
207
+ });
208
+ getTag(): string;
209
+ getTemplate(): TemplateExpressionShape;
210
+ getValue(substitutions?: TemplateSubstitutions): string;
211
+ getCode(): string;
212
+ }
213
+ export declare class NumberShape extends Shape<number> {
214
+ private readonly value;
215
+ constructor({ source, value }: {
216
+ source: Source;
217
+ value: number;
218
+ });
219
+ getValue(): number;
220
+ }
221
+ export declare class BooleanShape extends Shape<boolean> {
222
+ private readonly value;
223
+ constructor({ source, value }: {
224
+ source: Source;
225
+ value: boolean;
226
+ });
227
+ getValue(): boolean;
228
+ }
229
+ export declare class ArrayShape extends Shape<unknown[]> {
230
+ private readonly elements;
231
+ constructor({ source, elements }: {
232
+ source: Source;
233
+ elements: unknown[];
234
+ });
235
+ getValue(): unknown[];
236
+ getElements(resolve?: boolean): Shape[];
237
+ getElement(index: number, resolve?: boolean): Shape;
238
+ hasElement(index: number): boolean;
239
+ map<T>(mapFunction: (element: Shape) => T, resolve?: boolean): T[];
240
+ equals(other: unknown): boolean;
241
+ static from(source: Source, value: unknown): ArrayShape;
242
+ getCode(): string;
243
+ }
244
+ declare const MERGE: unique symbol;
245
+ declare class Transform {
246
+ private readonly shape;
247
+ private readonly resolve;
248
+ private readonly _from;
249
+ private readonly _map;
250
+ private readonly _def;
251
+ private readonly _coerce;
252
+ constructor(shape: ObjectShape, resolve?: boolean, _from?: [string, ...string[]] | undefined, _map?: ((...from: Shape[]) => unknown) | undefined, _def?: unknown, _coerce?: 'string' | 'number' | 'boolean' | 'cdata' | undefined);
253
+ _(to: string | typeof MERGE): {
254
+ def: unknown;
255
+ val: unknown;
256
+ };
257
+ from(...properties: [string, ...string[]]): Transform;
258
+ map(mapFunction: (...from: Shape[]) => unknown): Transform;
259
+ val(value: unknown): Transform;
260
+ def(value: unknown): Transform;
261
+ toCdata(): Transform;
262
+ toString(): Transform;
263
+ toNumber(): Transform;
264
+ toBoolean(): Transform;
265
+ }
266
+ type ObjectPropertyOptions = {
267
+ nonDefaultsOnly?: boolean;
268
+ resolve?: boolean;
269
+ };
270
+ export declare class ObjectShape extends Shape<globalThis.Record<string, unknown>> {
271
+ protected readonly setProperties: globalThis.Record<string, Shape>;
272
+ private defaultProperties;
273
+ private aliasedKeys;
274
+ constructor({ source, properties }: {
275
+ source: Source;
276
+ properties: NonNullable<object>;
277
+ });
278
+ withAliasedKeys(aliasedKeys: globalThis.Record<string, string[]>): this;
279
+ getAliasedKeys(): globalThis.Record<string, string[]>;
280
+ findAliasUsed(key: string): string | undefined;
281
+ getAliases(key: string): string[];
282
+ properties({ nonDefaultsOnly, resolve, }?: ObjectPropertyOptions): globalThis.Record<string, Shape>;
283
+ getValue(nonDefaultsOnly?: boolean): globalThis.Record<string, unknown>;
284
+ get(propertyOrPath: string | [string, ...string[]], resolve?: boolean): Shape;
285
+ getDefault(property: string): Shape;
286
+ keys(nonDefaultsOnly?: boolean): string[];
287
+ values(options?: ObjectPropertyOptions): Shape[];
288
+ entries(options?: ObjectPropertyOptions): [string, Shape][];
289
+ has(property: string): boolean;
290
+ omit(properties: string | [string, ...string[]], options?: ObjectPropertyOptions): globalThis.Record<string, Shape>;
291
+ pick(properties: string | [string, ...string[]], options?: ObjectPropertyOptions): globalThis.Record<string, Shape>;
292
+ private setDefaults;
293
+ transform(schema: (utils: {
294
+ $: Transform;
295
+ merge: typeof MERGE;
296
+ }) => {
297
+ [P in string | typeof MERGE]?: Transform;
298
+ }, resolve?: boolean): ObjectShape;
299
+ merge(other: NonNullable<object>): ObjectShape;
300
+ equals(other: unknown): boolean;
301
+ getCode(): string;
302
+ static quotePropertyNameIfNeeded(name: string): string;
303
+ }
304
+ export declare class CallExpressionShape extends Shape {
305
+ private readonly callee;
306
+ private readonly args;
307
+ constructor({ source, callee, args }: {
308
+ source: Source;
309
+ callee: string;
310
+ args: unknown[];
311
+ });
312
+ getCallee(): string;
313
+ getArguments(resolve?: boolean): Shape[];
314
+ getArgument(index: number, resolve?: boolean): Shape;
315
+ hasArgument(index: number): boolean;
316
+ getDescription(): string;
317
+ getCode(): string;
318
+ }
319
+ export declare class SourceFileShape extends StringShape {
320
+ private readonly path;
321
+ private readonly content;
322
+ constructor({ file }: {
323
+ file: ts.SourceFile;
324
+ });
325
+ getPath(): string;
326
+ getBaseName(): string;
327
+ getExtension(): string;
328
+ getContent(): string;
329
+ getSource(): ts.SourceFile;
330
+ getValue(): string;
331
+ getCode(): string;
332
+ }
333
+ export declare class ElementAccessExpressionShape extends Shape {
334
+ private readonly callee;
335
+ private readonly arg;
336
+ constructor({ source, callee, arg }: {
337
+ source: Source;
338
+ callee: string;
339
+ arg: unknown;
340
+ });
341
+ getCallee(): string;
342
+ getArg(): StringShape | NumberShape;
343
+ }
344
+ export declare class VariableStatementShape extends Shape {
345
+ private readonly variableName;
346
+ private readonly initializer;
347
+ private readonly _isExported;
348
+ constructor({ source, variableName, initializer, isExported, }: {
349
+ source: Source;
350
+ variableName: IdentifierShape | string;
351
+ initializer: unknown;
352
+ isExported?: boolean;
353
+ });
354
+ getVariableName(): IdentifierShape;
355
+ getInitializer(): Shape;
356
+ isExported(): boolean;
357
+ getCode(): string;
358
+ }
359
+ export declare function getInstallCategory(source: Source, table: string): InstallCategory;
360
+ export type Action = 'INSERT_OR_UPDATE' | 'UPDATE' | 'DELETE' | 'delete_multiple';
361
+ export declare class Record extends ObjectShape {
362
+ private readonly id;
363
+ private readonly related;
364
+ private readonly action;
365
+ private readonly installCategory;
366
+ constructor({ source, id, properties, action, installCategory, }: {
367
+ source: Source;
368
+ id: RecordId;
369
+ properties: NonNullable<object>;
370
+ action?: Action;
371
+ installCategory?: InstallCategory;
372
+ });
373
+ static isDeleteAction(action: Action): boolean;
374
+ getId(): RecordId;
375
+ getInstallCategory(): InstallCategory;
376
+ getTable(): string;
377
+ getAction(): Action;
378
+ isDeleted(): boolean;
379
+ getUpdateName(): string;
380
+ with(...related: Record[]): this;
381
+ flat(): Record[];
382
+ getCount(): number;
383
+ merge(other: NonNullable<object>): Record;
384
+ equals(other: unknown): boolean;
385
+ /**
386
+ * Useful when you need to know if this record is equal to another not
387
+ * just in terms of its identity but also its data.
388
+ */
389
+ strictEquals(other: unknown): boolean;
390
+ setCreator(creator: Plugin | undefined, overwrite?: boolean): this;
391
+ toRecordId(): RecordId;
392
+ toString(): StringShape;
393
+ }
394
+ export type CoalesceKeys = globalThis.Record<string, string | RecordId>;
395
+ export type ResolvedCoalesceKeys = globalThis.Record<string, string>;
396
+ export declare class RecordId extends StringShape {
397
+ private readonly table;
398
+ private readonly guid;
399
+ private readonly keys;
400
+ private readonly nowIdKey;
401
+ constructor({ source, table, guid, keys: rawKeys, nowIdKey, }: {
402
+ source: Source;
403
+ table: string;
404
+ guid: string | (() => string);
405
+ keys?: CoalesceKeys | ObjectShape | undefined;
406
+ nowIdKey?: string | number | undefined;
407
+ });
408
+ getTable(): string;
409
+ getGuidProducer(): string | (() => string);
410
+ getNowIdKey(): string | number | undefined;
411
+ getKeys(): CoalesceKeys | undefined;
412
+ /**
413
+ * Similar to `getKeys`, but resolves any nested record IDs to their GUID values
414
+ */
415
+ resolveKeys(): ResolvedCoalesceKeys | undefined;
416
+ getKey(key: string): string | RecordId | undefined;
417
+ getPrimaryKey(): string;
418
+ hasPrimaryKey(): boolean;
419
+ getUpdateName(): string;
420
+ getValue(): string;
421
+ equals(other: unknown): boolean;
422
+ getCode(): string;
423
+ }
424
+ export {};