@servicenow/sdk-build-core 3.0.2 → 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.
- package/dist/app.d.ts +25 -0
- package/dist/app.js +8 -0
- package/dist/app.js.map +1 -0
- package/dist/compiler.d.ts +60 -0
- package/dist/compiler.js +320 -0
- package/dist/compiler.js.map +1 -0
- package/dist/compression.d.ts +7 -0
- package/dist/compression.js +79 -0
- package/dist/compression.js.map +1 -0
- package/dist/crypto.d.ts +1 -0
- package/dist/crypto.js +9 -0
- package/dist/crypto.js.map +1 -0
- package/dist/diagnostic.d.ts +41 -0
- package/dist/diagnostic.js +130 -0
- package/dist/diagnostic.js.map +1 -0
- package/dist/{plugins/Diagnostic.d.ts → fluent-diagnostic.d.ts} +3 -2
- package/dist/fluent-diagnostic.js +23 -0
- package/dist/fluent-diagnostic.js.map +1 -0
- package/dist/fluent-directive.d.ts +8 -0
- package/dist/fluent-directive.js +54 -0
- package/dist/fluent-directive.js.map +1 -0
- package/dist/fluent-file.d.ts +5 -0
- package/dist/fluent-file.js +15 -0
- package/dist/fluent-file.js.map +1 -0
- package/dist/formatter.d.ts +11 -0
- package/dist/formatter.js +77 -0
- package/dist/formatter.js.map +1 -0
- package/dist/fs.d.ts +174 -0
- package/dist/fs.js +313 -0
- package/dist/fs.js.map +1 -0
- package/dist/guid.d.ts +2 -0
- package/dist/{GUID.js → guid.js} +3 -6
- package/dist/guid.js.map +1 -0
- package/dist/index.d.ts +19 -5
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +5 -0
- package/dist/json.js +43 -0
- package/dist/json.js.map +1 -0
- package/dist/keys-registry.d.ts +64 -0
- package/dist/keys-registry.js +339 -0
- package/dist/keys-registry.js.map +1 -0
- package/dist/logger.d.ts +8 -0
- package/dist/logger.js +17 -0
- package/dist/logger.js.map +1 -0
- package/dist/now-config.d.ts +348 -0
- package/dist/now-config.js +283 -0
- package/dist/now-config.js.map +1 -0
- package/dist/path.d.ts +3 -0
- package/dist/path.js +12 -0
- package/dist/path.js.map +1 -0
- package/dist/plugins/cache.d.ts +20 -0
- package/dist/plugins/cache.js +46 -0
- package/dist/plugins/cache.js.map +1 -0
- package/dist/plugins/context.d.ts +85 -0
- package/dist/plugins/{Context.js → context.js} +1 -1
- package/dist/plugins/context.js.map +1 -0
- package/dist/plugins/database.d.ts +27 -0
- package/dist/plugins/database.js +102 -0
- package/dist/plugins/database.js.map +1 -0
- package/dist/plugins/file.d.ts +10 -0
- package/dist/plugins/{behaviors/Arranger.js → file.js} +1 -1
- package/dist/plugins/file.js.map +1 -0
- package/dist/plugins/index.d.ts +9 -5
- package/dist/plugins/index.js +9 -6
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/plugin.d.ts +478 -0
- package/dist/plugins/plugin.js +533 -0
- package/dist/plugins/plugin.js.map +1 -0
- package/dist/plugins/product.d.ts +15 -0
- package/dist/plugins/product.js +38 -0
- package/dist/plugins/product.js.map +1 -0
- package/dist/plugins/project.d.ts +25 -0
- package/dist/plugins/{behaviors/Generator.js → project.js} +1 -1
- package/dist/plugins/project.js.map +1 -0
- package/dist/plugins/shape.d.ts +424 -0
- package/dist/plugins/shape.js +1181 -0
- package/dist/plugins/shape.js.map +1 -0
- package/dist/plugins/time.d.ts +12 -0
- package/dist/plugins/time.js +84 -0
- package/dist/plugins/time.js.map +1 -0
- package/dist/plugins/usage.d.ts +11 -0
- package/dist/plugins/usage.js +26 -0
- package/dist/plugins/usage.js.map +1 -0
- package/dist/prettier/config-loader.d.ts +13 -0
- package/dist/prettier/config-loader.js +105 -0
- package/dist/prettier/config-loader.js.map +1 -0
- package/dist/telemetry/index.d.ts +25 -0
- package/dist/telemetry/index.js +18 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/typescript.d.ts +293 -0
- package/dist/typescript.js +454 -0
- package/dist/typescript.js.map +1 -0
- package/dist/util/get-file-type.d.ts +2 -0
- package/dist/util/get-file-type.js +13 -0
- package/dist/util/get-file-type.js.map +1 -0
- package/dist/util/index.d.ts +2 -6
- package/dist/util/index.js +2 -6
- package/dist/util/index.js.map +1 -1
- package/dist/util/{Scope.js → is-sn-scope.js} +1 -1
- package/dist/util/is-sn-scope.js.map +1 -0
- package/dist/xml.d.ts +24 -0
- package/dist/xml.js +71 -0
- package/dist/xml.js.map +1 -0
- package/now.config.schema.json +336 -0
- package/package.json +22 -12
- package/src/app.ts +33 -0
- package/src/compiler.ts +384 -0
- package/src/compression.ts +93 -0
- package/src/crypto.ts +5 -0
- package/src/diagnostic.ts +108 -0
- package/src/{plugins/Diagnostic.ts → fluent-diagnostic.ts} +3 -10
- package/src/fluent-directive.ts +63 -0
- package/src/fluent-file.ts +13 -0
- package/src/formatter.ts +58 -0
- package/src/fs.ts +438 -0
- package/src/{GUID.ts → guid.ts} +2 -6
- package/src/index.ts +19 -5
- package/src/json.ts +20 -0
- package/src/keys-registry.ts +384 -0
- package/src/logger.ts +20 -0
- package/src/now-config.ts +337 -0
- package/src/path.ts +9 -0
- package/src/plugins/cache.ts +45 -0
- package/src/plugins/context.ts +93 -0
- package/src/plugins/database.ts +121 -0
- package/src/plugins/file.ts +19 -0
- package/src/plugins/index.ts +9 -5
- package/src/plugins/plugin.ts +995 -0
- package/src/plugins/product.ts +44 -0
- package/src/plugins/project.ts +39 -0
- package/src/plugins/shape.ts +1532 -0
- package/src/plugins/time.ts +108 -0
- package/src/plugins/usage.ts +26 -0
- package/src/prettier/config-loader.ts +130 -0
- package/src/telemetry/index.ts +27 -0
- package/src/typescript.ts +502 -0
- package/src/util/get-file-type.ts +11 -0
- package/src/util/index.ts +2 -6
- package/src/xml.ts +86 -0
- package/dist/GUID.d.ts +0 -2
- package/dist/GUID.js.map +0 -1
- package/dist/IncludePaths.d.ts +0 -25
- package/dist/IncludePaths.js +0 -97
- package/dist/IncludePaths.js.map +0 -1
- package/dist/Keys.d.ts +0 -32
- package/dist/Keys.js +0 -245
- package/dist/Keys.js.map +0 -1
- package/dist/TypeScript.d.ts +0 -5
- package/dist/TypeScript.js +0 -58
- package/dist/TypeScript.js.map +0 -1
- package/dist/XML.d.ts +0 -32
- package/dist/XML.js +0 -77
- package/dist/XML.js.map +0 -1
- package/dist/plugins/Context.d.ts +0 -190
- package/dist/plugins/Context.js.map +0 -1
- package/dist/plugins/Diagnostic.js +0 -28
- package/dist/plugins/Diagnostic.js.map +0 -1
- package/dist/plugins/Plugin.d.ts +0 -175
- package/dist/plugins/Plugin.js +0 -15
- package/dist/plugins/Plugin.js.map +0 -1
- package/dist/plugins/behaviors/Arranger.d.ts +0 -26
- package/dist/plugins/behaviors/Arranger.js.map +0 -1
- package/dist/plugins/behaviors/Composer.d.ts +0 -102
- package/dist/plugins/behaviors/Composer.js +0 -15
- package/dist/plugins/behaviors/Composer.js.map +0 -1
- package/dist/plugins/behaviors/Diagnostics.d.ts +0 -7
- package/dist/plugins/behaviors/Diagnostics.js +0 -3
- package/dist/plugins/behaviors/Diagnostics.js.map +0 -1
- package/dist/plugins/behaviors/Generator.d.ts +0 -21
- package/dist/plugins/behaviors/Generator.js.map +0 -1
- package/dist/plugins/behaviors/OwnedTables.d.ts +0 -6
- package/dist/plugins/behaviors/OwnedTables.js +0 -3
- package/dist/plugins/behaviors/OwnedTables.js.map +0 -1
- package/dist/plugins/behaviors/PostProcessor.d.ts +0 -5
- package/dist/plugins/behaviors/PostProcessor.js +0 -3
- package/dist/plugins/behaviors/PostProcessor.js.map +0 -1
- package/dist/plugins/behaviors/Serializer.d.ts +0 -30
- package/dist/plugins/behaviors/Serializer.js +0 -3
- package/dist/plugins/behaviors/Serializer.js.map +0 -1
- package/dist/plugins/behaviors/Transformer.d.ts +0 -23
- package/dist/plugins/behaviors/Transformer.js +0 -3
- package/dist/plugins/behaviors/Transformer.js.map +0 -1
- package/dist/plugins/behaviors/extractors/Data.d.ts +0 -119
- package/dist/plugins/behaviors/extractors/Data.js +0 -244
- package/dist/plugins/behaviors/extractors/Data.js.map +0 -1
- package/dist/plugins/behaviors/extractors/Extractors.d.ts +0 -63
- package/dist/plugins/behaviors/extractors/Extractors.js +0 -3
- package/dist/plugins/behaviors/extractors/Extractors.js.map +0 -1
- package/dist/plugins/behaviors/extractors/index.d.ts +0 -2
- package/dist/plugins/behaviors/extractors/index.js +0 -19
- package/dist/plugins/behaviors/extractors/index.js.map +0 -1
- package/dist/plugins/behaviors/index.d.ts +0 -9
- package/dist/plugins/behaviors/index.js +0 -26
- package/dist/plugins/behaviors/index.js.map +0 -1
- package/dist/plugins/util/CallExpression.d.ts +0 -5
- package/dist/plugins/util/CallExpression.js +0 -88
- package/dist/plugins/util/CallExpression.js.map +0 -1
- package/dist/plugins/util/CodeTransformation.d.ts +0 -95
- package/dist/plugins/util/CodeTransformation.js +0 -624
- package/dist/plugins/util/CodeTransformation.js.map +0 -1
- package/dist/plugins/util/ObjectLiteral.d.ts +0 -9
- package/dist/plugins/util/ObjectLiteral.js +0 -37
- package/dist/plugins/util/ObjectLiteral.js.map +0 -1
- package/dist/plugins/util/index.d.ts +0 -3
- package/dist/plugins/util/index.js +0 -20
- package/dist/plugins/util/index.js.map +0 -1
- package/dist/util/Debug.d.ts +0 -4
- package/dist/util/Debug.js +0 -20
- package/dist/util/Debug.js.map +0 -1
- package/dist/util/Directive.d.ts +0 -16
- package/dist/util/Directive.js +0 -107
- package/dist/util/Directive.js.map +0 -1
- package/dist/util/RuntimeTableSchema.d.ts +0 -5
- package/dist/util/RuntimeTableSchema.js +0 -58
- package/dist/util/RuntimeTableSchema.js.map +0 -1
- package/dist/util/Scope.js.map +0 -1
- package/dist/util/Util.d.ts +0 -1
- package/dist/util/Util.js +0 -12
- package/dist/util/Util.js.map +0 -1
- package/dist/util/XMLUploadParser.d.ts +0 -22
- package/dist/util/XMLUploadParser.js +0 -67
- package/dist/util/XMLUploadParser.js.map +0 -1
- package/src/IncludePaths.ts +0 -122
- package/src/Keys.ts +0 -274
- package/src/TypeScript.ts +0 -65
- package/src/XML.ts +0 -92
- package/src/plugins/Context.ts +0 -239
- package/src/plugins/Plugin.ts +0 -278
- package/src/plugins/behaviors/Arranger.ts +0 -42
- package/src/plugins/behaviors/Composer.ts +0 -125
- package/src/plugins/behaviors/Diagnostics.ts +0 -12
- package/src/plugins/behaviors/Generator.ts +0 -31
- package/src/plugins/behaviors/OwnedTables.ts +0 -5
- package/src/plugins/behaviors/PostProcessor.ts +0 -6
- package/src/plugins/behaviors/Serializer.ts +0 -40
- package/src/plugins/behaviors/Transformer.ts +0 -32
- package/src/plugins/behaviors/extractors/Data.ts +0 -332
- package/src/plugins/behaviors/extractors/Extractors.ts +0 -73
- package/src/plugins/behaviors/extractors/index.ts +0 -2
- package/src/plugins/behaviors/index.ts +0 -9
- package/src/plugins/util/CallExpression.ts +0 -110
- package/src/plugins/util/CodeTransformation.ts +0 -731
- package/src/plugins/util/ObjectLiteral.ts +0 -37
- package/src/plugins/util/index.ts +0 -3
- package/src/util/Debug.ts +0 -24
- package/src/util/Directive.ts +0 -123
- package/src/util/RuntimeTableSchema.ts +0 -44
- package/src/util/Util.ts +0 -7
- package/src/util/XMLUploadParser.ts +0 -90
- /package/dist/util/{Scope.d.ts → is-sn-scope.d.ts} +0 -0
- /package/src/util/{Scope.ts → is-sn-scope.ts} +0 -0
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Plugins = exports.Plugin = void 0;
|
|
4
|
+
const typescript_1 = require("../typescript");
|
|
5
|
+
const shape_1 = require("./shape");
|
|
6
|
+
const database_1 = require("./database");
|
|
7
|
+
const util_1 = require("../util");
|
|
8
|
+
const cache_1 = require("./cache");
|
|
9
|
+
function setCreator(creator, result) {
|
|
10
|
+
if (result.success) {
|
|
11
|
+
result.value = Array.isArray(result.value)
|
|
12
|
+
? result.value.map((r) => r.setCreator(creator))
|
|
13
|
+
: result.value.setCreator(creator);
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
class Plugin {
|
|
18
|
+
config;
|
|
19
|
+
nodeToShapeCache = new cache_1.Cache();
|
|
20
|
+
shapeToSubclassCache = new cache_1.Cache();
|
|
21
|
+
shapeToRecordCache = new cache_1.Cache();
|
|
22
|
+
relationships = {};
|
|
23
|
+
references = {};
|
|
24
|
+
constructor(config) {
|
|
25
|
+
this.config = config;
|
|
26
|
+
for (const [table, config] of Object.entries(this.config.records ?? {})) {
|
|
27
|
+
this.parseRelationships([table, config.relationships]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
parseRelationships([table, relationships]) {
|
|
31
|
+
if (table === '*' || !relationships) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.relationships[table] = { ...this.relationships[table], ...relationships };
|
|
35
|
+
for (const [subTable, subConfig] of Object.entries(relationships)) {
|
|
36
|
+
if (typeof subConfig.via === 'string') {
|
|
37
|
+
const [parent, child] = subConfig.inverse ? [subTable, table] : [table, subTable];
|
|
38
|
+
this.references[child] = { ...this.references[child], [subConfig.via]: parent };
|
|
39
|
+
}
|
|
40
|
+
this.parseRelationships([subTable, subConfig.relationships]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new Fluent plugin from the provided configuration.
|
|
45
|
+
*
|
|
46
|
+
* Plugins are the primary mechanism for extending the Fluent DSL and providing support for
|
|
47
|
+
* new types of ServiceNow entities. Plugins implement handlers responsible for parsing and
|
|
48
|
+
* transforming Fluent code, ServiceNow records, and any other files that exist within a
|
|
49
|
+
* Fluent project.
|
|
50
|
+
*
|
|
51
|
+
* The build system orchestrates the plugins together to carry a project through all the
|
|
52
|
+
* stages of building and bidirectionally syncing a Fluent project, invoking each plugin's
|
|
53
|
+
* handlers at the appropriate points in the process, and providing the relevant inputs and
|
|
54
|
+
* context.
|
|
55
|
+
*
|
|
56
|
+
* During a regular build, the stages are:
|
|
57
|
+
*
|
|
58
|
+
* 1. Traverse the full AST of all the Fluent code, transforming each node into a shape
|
|
59
|
+
* 2. Transform each shape into a more specific subclass of that shape
|
|
60
|
+
* 3. Transform each subclassed shape into one or more ServiceNow records
|
|
61
|
+
* 4. Serialize each record into an output file
|
|
62
|
+
*
|
|
63
|
+
* During bidirectional sync, the stages are:
|
|
64
|
+
*
|
|
65
|
+
* 1. Perform stage 1 from the regular build process to get the existing shapes
|
|
66
|
+
* 2. Perform stage 2 from the regular build process to subclass those existing shapes
|
|
67
|
+
* 3. Perform stage 3 from the regular build process to get the existing records
|
|
68
|
+
* 4. Parse input files (usually XML from a ServiceNow instance) to get the incoming records
|
|
69
|
+
* 5. Merge the incoming records into the existing records so that all changes are reflected
|
|
70
|
+
* 6. Transform each merged record into a shape
|
|
71
|
+
* 7. Commit each shape to the Fluent AST, generating new nodes as needed
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Stages of a regular build
|
|
75
|
+
* const CoolPlugin = Plugin.create({
|
|
76
|
+
* name: 'CoolPlugin',
|
|
77
|
+
* nodes: [
|
|
78
|
+
* {
|
|
79
|
+
* node: 'CallExpression',
|
|
80
|
+
* toShape(node) {
|
|
81
|
+
* // BUILD STAGE 1: A CallExpression node is transformed into a CallExpressionShape.
|
|
82
|
+
* }
|
|
83
|
+
* }
|
|
84
|
+
* ],
|
|
85
|
+
* shapes: [
|
|
86
|
+
* {
|
|
87
|
+
* shape: CallExpressionShape,
|
|
88
|
+
* toSubclass(shape) {
|
|
89
|
+
* // BUILD STAGE 2: The CallExpressionShape from stage 1 is transformed into a CoolShape.
|
|
90
|
+
* }
|
|
91
|
+
* },
|
|
92
|
+
* {
|
|
93
|
+
* shape: CoolShape,
|
|
94
|
+
* toRecord(shape) {
|
|
95
|
+
* // BUILD STAGE 3: The CoolShape from stage 2 is transformed into a cool_table record.
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
* ],
|
|
99
|
+
* records: {
|
|
100
|
+
* cool_table: {
|
|
101
|
+
* toFile(record) {
|
|
102
|
+
* // BUILD STAGE 4: The cool_table record from stage 3 is serialized into an output file.
|
|
103
|
+
* }
|
|
104
|
+
* }
|
|
105
|
+
* },
|
|
106
|
+
* })
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* // Stages of bidirectional sync
|
|
110
|
+
* const CoolPlugin = Plugin.create({
|
|
111
|
+
* name: 'CoolPlugin',
|
|
112
|
+
* nodes: [
|
|
113
|
+
* {
|
|
114
|
+
* node: 'CallExpression',
|
|
115
|
+
* toShape(node) {
|
|
116
|
+
* // SYNC STAGE 1: An existing CallExpression node is transformed into a CallExpressionShape.
|
|
117
|
+
* }
|
|
118
|
+
* }
|
|
119
|
+
* ],
|
|
120
|
+
* shapes: [
|
|
121
|
+
* {
|
|
122
|
+
* shape: CallExpressionShape,
|
|
123
|
+
* toSubclass(shape) {
|
|
124
|
+
* // SYNC STAGE 2: The existing CallExpressionShape from stage 1 is transformed into a CoolShape
|
|
125
|
+
* },
|
|
126
|
+
* commit(shape, target) {
|
|
127
|
+
* // SYNC STAGE 7: The new CoolShape from stage 6, which now contains the changes from the
|
|
128
|
+
* // incoming cool_table record, is committed to the original CallExpression node.
|
|
129
|
+
* //
|
|
130
|
+
* // NOTES:
|
|
131
|
+
* // - Since CoolShape extends CallExpressionShape, and there is no commit function
|
|
132
|
+
* // for CoolShape, this commit function is used. If, for some reason, CoolShape
|
|
133
|
+
* // needed to be committed differently than other CallExpressionShapes, then this
|
|
134
|
+
* // plugin would need to implement a commit function for CoolShape.
|
|
135
|
+
* // - If the incoming cool_table record didn't already exist in the code, then the
|
|
136
|
+
* // build system would generate an arbitrary new node before passing it into this
|
|
137
|
+
* // commit function as the target. So the implementation should never assume that
|
|
138
|
+
* // the target is a CallExpression node.
|
|
139
|
+
* }
|
|
140
|
+
* },
|
|
141
|
+
* {
|
|
142
|
+
* shape: CoolShape,
|
|
143
|
+
* toRecord(shape) {
|
|
144
|
+
* // SYNC STAGE 3: The existing CoolShape from stage 2 is transformed into a cool_table record.
|
|
145
|
+
* }
|
|
146
|
+
* }
|
|
147
|
+
* ],
|
|
148
|
+
* files: [
|
|
149
|
+
* {
|
|
150
|
+
* extension: 'xml',
|
|
151
|
+
* toRecord(file) {
|
|
152
|
+
* // SYNC STAGE 4: An incoming XML file with changes is parsed into a cool_table record.
|
|
153
|
+
* }
|
|
154
|
+
* }
|
|
155
|
+
* ],
|
|
156
|
+
* records: {
|
|
157
|
+
* cool_table: {
|
|
158
|
+
* toShape(record) {
|
|
159
|
+
* // SYNC STAGE 6: After the incoming cool_table record from stage 4 is merged into the
|
|
160
|
+
* // existing one from stage 3, the merged record is transformed back into a CoolShape.
|
|
161
|
+
* }
|
|
162
|
+
* }
|
|
163
|
+
* },
|
|
164
|
+
* })
|
|
165
|
+
*/
|
|
166
|
+
static create(config) {
|
|
167
|
+
return new Plugin(config);
|
|
168
|
+
}
|
|
169
|
+
getName() {
|
|
170
|
+
return this.config.name;
|
|
171
|
+
}
|
|
172
|
+
getDescendants(parent, database) {
|
|
173
|
+
const descendantRelationships = Object.entries(this.relationships[parent.getTable()] ?? {}).filter(([, { descendant }]) => descendant);
|
|
174
|
+
const descendants = [];
|
|
175
|
+
const push = (children) => {
|
|
176
|
+
for (const child of [children].flat()) {
|
|
177
|
+
if (child) {
|
|
178
|
+
descendants.push(child);
|
|
179
|
+
descendants.push(...this.getDescendants(child, database));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
for (const [childTable, { via, inverse = false }] of descendantRelationships) {
|
|
184
|
+
if (typeof via === 'string') {
|
|
185
|
+
if (inverse) {
|
|
186
|
+
parent
|
|
187
|
+
.get(via)
|
|
188
|
+
.ifDefined()
|
|
189
|
+
?.toString()
|
|
190
|
+
.pipe((v) => push(database.get(childTable, v.getValue())));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
push(database.query(childTable, { [via]: parent.toString().getValue() }));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (typeof via === 'function') {
|
|
197
|
+
push(database.query(childTable).filter((child) => via(parent, child)));
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
push(database.query(childTable, Object.fromEntries(Object.entries(via).map((entry) => {
|
|
201
|
+
const [parentColumn, childColumn] = inverse ? entry : [entry[1], entry[0]];
|
|
202
|
+
return [childColumn, parent.get(parentColumn).getValue()];
|
|
203
|
+
}))));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return descendants;
|
|
207
|
+
}
|
|
208
|
+
getCoalesceStrategy(table) {
|
|
209
|
+
return (this.config.records ?? {})[table]?.coalesce;
|
|
210
|
+
}
|
|
211
|
+
getCoalesceTables() {
|
|
212
|
+
return Object.entries(this.config.records ?? {})
|
|
213
|
+
.filter(([_, val]) => val.coalesce)
|
|
214
|
+
.map(([table]) => table);
|
|
215
|
+
}
|
|
216
|
+
getTables(relationships, tables = []) {
|
|
217
|
+
const tableEntries = relationships
|
|
218
|
+
? Object.entries(relationships).filter(([, val]) => val.descendant)
|
|
219
|
+
: Object.entries(this.config.records ?? {}).filter(([, val]) => val.toShape);
|
|
220
|
+
tables.push(...tableEntries.filter(([table]) => table !== '*').map(([table]) => table));
|
|
221
|
+
tableEntries
|
|
222
|
+
.filter(([_, val]) => val.relationships)
|
|
223
|
+
.forEach(([_, val]) => this.getTables(val.relationships, tables));
|
|
224
|
+
return new Set(tables);
|
|
225
|
+
}
|
|
226
|
+
getReferenceColumns(table) {
|
|
227
|
+
return this.references[table] ?? {};
|
|
228
|
+
}
|
|
229
|
+
getRelationships() {
|
|
230
|
+
return this.relationships;
|
|
231
|
+
}
|
|
232
|
+
flushCache() {
|
|
233
|
+
this.nodeToShapeCache.clear();
|
|
234
|
+
this.shapeToRecordCache.clear();
|
|
235
|
+
}
|
|
236
|
+
async nodeToShape(node, context) {
|
|
237
|
+
const entry = this.nodeToShapeCache.get(node.compilerNode);
|
|
238
|
+
if (entry) {
|
|
239
|
+
return entry.isError() ? { success: false } : entry.unwrap();
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
for (const config of this.config.nodes ?? []) {
|
|
243
|
+
if (config.toShape &&
|
|
244
|
+
(0, typescript_1.getKindName)(node) === config.node &&
|
|
245
|
+
(!config.fileTypes || config.fileTypes.includes((0, util_1.getFileType)(node.getSourceFile().getFilePath())))) {
|
|
246
|
+
const result = setCreator(this, await config.toShape.bind(this)(node, { ...context, self: this }));
|
|
247
|
+
if (result.success) {
|
|
248
|
+
return this.nodeToShapeCache.put(node.compilerNode, result);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return this.nodeToShapeCache.put(node.compilerNode, { success: false });
|
|
253
|
+
}
|
|
254
|
+
catch (e) {
|
|
255
|
+
throw this.nodeToShapeCache.error(node.compilerNode, e);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
async commit(shape, target, context) {
|
|
259
|
+
for (const { shape: shapeClass, commit } of this.config.shapes ?? []) {
|
|
260
|
+
if (shape.is(shapeClass) && commit) {
|
|
261
|
+
const result = await commit.bind(this)(shape, target, { ...context, self: this });
|
|
262
|
+
if (result.success) {
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return { success: false };
|
|
268
|
+
}
|
|
269
|
+
shapeToSubclass(shape, context) {
|
|
270
|
+
const entry = this.shapeToSubclassCache.get(shape);
|
|
271
|
+
if (entry) {
|
|
272
|
+
return entry.isError() ? { success: false } : entry.unwrap();
|
|
273
|
+
}
|
|
274
|
+
try {
|
|
275
|
+
for (const config of this.config.shapes ?? []) {
|
|
276
|
+
if (config.toSubclass &&
|
|
277
|
+
shape.constructor === config.shape &&
|
|
278
|
+
(!config.fileTypes || config.fileTypes.includes((0, util_1.getFileType)(shape.getOriginalFilePath())))) {
|
|
279
|
+
const result = setCreator(this, config.toSubclass.bind(this)(shape, {
|
|
280
|
+
...context,
|
|
281
|
+
self: this,
|
|
282
|
+
}));
|
|
283
|
+
if (result.success) {
|
|
284
|
+
if (result.value.constructor === config.shape) {
|
|
285
|
+
throw new Error(`Result of subclassing "${config.shape.name}" is an instance of the same class. The result MUST be a subclass.`);
|
|
286
|
+
}
|
|
287
|
+
return this.shapeToSubclassCache.put(shape, result);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return this.shapeToSubclassCache.put(shape, { success: false });
|
|
292
|
+
}
|
|
293
|
+
catch (e) {
|
|
294
|
+
throw this.shapeToSubclassCache.error(shape, e);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
async shapeToRecord(shape, context) {
|
|
298
|
+
const entry = this.shapeToRecordCache.get(shape);
|
|
299
|
+
if (entry) {
|
|
300
|
+
return entry.isError() ? { success: false } : entry.unwrap();
|
|
301
|
+
}
|
|
302
|
+
try {
|
|
303
|
+
for (const config of this.config.shapes ?? []) {
|
|
304
|
+
if (config.toRecord &&
|
|
305
|
+
shape.is(config.shape) &&
|
|
306
|
+
(!config.fileTypes || config.fileTypes.includes((0, util_1.getFileType)(shape.getOriginalFilePath())))) {
|
|
307
|
+
const result = setCreator(this, await config.toRecord.bind(this)(shape, { ...context, self: this }));
|
|
308
|
+
if (result.success) {
|
|
309
|
+
return this.shapeToRecordCache.put(shape, result);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return this.shapeToRecordCache.put(shape, { success: false });
|
|
314
|
+
}
|
|
315
|
+
catch (e) {
|
|
316
|
+
throw this.shapeToRecordCache.error(shape, e);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
async recordToShape0(record, context) {
|
|
320
|
+
if (record.getAction() !== 'INSERT_OR_UPDATE') {
|
|
321
|
+
return { success: true, value: new shape_1.DeletedShape({ source: record }) };
|
|
322
|
+
}
|
|
323
|
+
const table = record.getTable();
|
|
324
|
+
for (const [configTable, { toShape }] of Object.entries(this.config.records ?? {})) {
|
|
325
|
+
if ((configTable === '*' || configTable === table) && toShape) {
|
|
326
|
+
const result = setCreator(this, await toShape.bind(this)(record, { ...context, self: this }));
|
|
327
|
+
if (result.success) {
|
|
328
|
+
return result;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return { success: false };
|
|
333
|
+
}
|
|
334
|
+
async recordToShape({ record, database, context, }) {
|
|
335
|
+
context.logger.debug(`Transforming record into shape: ${record.getTable()}.${record.getId().getValue()}`);
|
|
336
|
+
const descendants = this.getDescendants(record, database);
|
|
337
|
+
return this.recordToShape0(record, {
|
|
338
|
+
...context,
|
|
339
|
+
database,
|
|
340
|
+
descendants: new database_1.Database(descendants.filter((r) => r.getAction() === 'INSERT_OR_UPDATE')),
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
async recordsToShapes({ database, creatorOnly, changedOnly = false, mode, handledRecords, context, }) {
|
|
344
|
+
let success = false;
|
|
345
|
+
const shapes = [];
|
|
346
|
+
for (const [table, { toShape }] of Object.entries(this.config.records ?? {})) {
|
|
347
|
+
if (!toShape) {
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
else if (mode === 'explicit' && table === '*') {
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
else if (mode === 'catch-all' && table !== '*') {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
for (const record of table === '*' ? database.query() : database.query(table)) {
|
|
357
|
+
if (handledRecords.resolve(record.getId())) {
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (creatorOnly && record.getCreator() !== this) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
context.logger.debug(`Transforming record into shape: ${record.getTable()}.${record.getId().getValue()}`);
|
|
364
|
+
const descendants = this.getDescendants(record, database);
|
|
365
|
+
if (changedOnly) {
|
|
366
|
+
if (!(database instanceof database_1.DiffDatabase)) {
|
|
367
|
+
throw new Error(`Tried to check for changed records while creating shapes, but the provided database does not support diffing.`);
|
|
368
|
+
}
|
|
369
|
+
if (![record, ...descendants].some((r) => database.isChanged(r))) {
|
|
370
|
+
continue; // If neither the record nor its descendants are in the diff, skip it
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const result = await this.recordToShape0(record, {
|
|
374
|
+
...context,
|
|
375
|
+
database,
|
|
376
|
+
descendants: new database_1.Database(descendants.filter((r) => r.getAction() === 'INSERT_OR_UPDATE')),
|
|
377
|
+
});
|
|
378
|
+
if (result.success) {
|
|
379
|
+
success = true;
|
|
380
|
+
handledRecords.insert(record);
|
|
381
|
+
descendants.forEach((d) => handledRecords.insert(d));
|
|
382
|
+
shapes.push(...[result.value].flat());
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return { success, value: shapes };
|
|
387
|
+
}
|
|
388
|
+
async recordToFile(record, context) {
|
|
389
|
+
const table = record.getTable();
|
|
390
|
+
for (const [configTable, { toFile }] of Object.entries(this.config.records ?? {})) {
|
|
391
|
+
if ((configTable === '*' || configTable === table) && toFile) {
|
|
392
|
+
const result = await toFile.bind(this)(record, { ...context, self: this });
|
|
393
|
+
if (result.success) {
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return { success: false };
|
|
399
|
+
}
|
|
400
|
+
async recordsToFiles({ database, mode, handledGuids, context, }) {
|
|
401
|
+
let success = false;
|
|
402
|
+
const files = [];
|
|
403
|
+
for (const [table, { toFile }] of Object.entries(this.config.records ?? {})) {
|
|
404
|
+
if (!toFile) {
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
else if (mode === 'explicit' && table === '*') {
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
else if (mode === 'catch-all' && table !== '*') {
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
for (const record of table === '*' ? database.query() : database.query(table)) {
|
|
414
|
+
if (handledGuids.has(record.getId().getValue())) {
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
const descendants = this.getDescendants(record, database);
|
|
418
|
+
const result = await this.recordToFile(record, {
|
|
419
|
+
...context,
|
|
420
|
+
database,
|
|
421
|
+
descendants: new database_1.Database(descendants.filter((r) => r.getAction() === 'INSERT_OR_UPDATE')),
|
|
422
|
+
});
|
|
423
|
+
if (result.success) {
|
|
424
|
+
success = true;
|
|
425
|
+
handledGuids.add(record.getId().getValue());
|
|
426
|
+
descendants.forEach((r) => handledGuids.add(r.getId().getValue()));
|
|
427
|
+
files.push(...[result.value].flat());
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return { success, value: files };
|
|
432
|
+
}
|
|
433
|
+
async isEntryPoint(pathOrNode, context) {
|
|
434
|
+
if (typescript_1.ts.Node.isNode(pathOrNode)) {
|
|
435
|
+
for (const config of this.config.nodes ?? []) {
|
|
436
|
+
if ((0, typescript_1.getKindName)(pathOrNode) !== config.node) {
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
const fileType = (0, util_1.getFileType)(pathOrNode.getSourceFile().getFilePath());
|
|
440
|
+
if (config.fileTypes && !config.fileTypes.includes(fileType)) {
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
return !!config.entryPoint;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
for (const config of this.config.files ?? []) {
|
|
448
|
+
if (config.matcher instanceof RegExp && !config.matcher.test(pathOrNode)) {
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
if (typeof config.matcher === 'function' &&
|
|
452
|
+
!(await config.matcher(pathOrNode, { ...context, self: this }))) {
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
return !!config.entryPoint;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
async fileToRecord(file, context) {
|
|
461
|
+
for (const config of this.config.files ?? []) {
|
|
462
|
+
if (!config.toRecord) {
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
if (config.matcher instanceof RegExp && !config.matcher.test(file.path)) {
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
if (typeof config.matcher === 'function' && !config.matcher(file.path, { ...context, self: this })) {
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
const result = setCreator(this, await config.toRecord.bind(this)(file, { ...context, self: this }));
|
|
472
|
+
if (result.success) {
|
|
473
|
+
return result;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return { success: false };
|
|
477
|
+
}
|
|
478
|
+
inspect(shape, context) {
|
|
479
|
+
for (const config of this.config.shapes ?? []) {
|
|
480
|
+
if (shape.is(config.shape) && config.inspect) {
|
|
481
|
+
config.inspect.bind(this)(shape, context);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
exports.Plugin = Plugin;
|
|
487
|
+
class Plugins {
|
|
488
|
+
plugins;
|
|
489
|
+
constructor(plugins) {
|
|
490
|
+
this.plugins = plugins;
|
|
491
|
+
}
|
|
492
|
+
toArray() {
|
|
493
|
+
return this.plugins;
|
|
494
|
+
}
|
|
495
|
+
add(plugin) {
|
|
496
|
+
this.plugins.push(plugin);
|
|
497
|
+
}
|
|
498
|
+
getCoalesceStrategy(table) {
|
|
499
|
+
for (const plugin of this.plugins) {
|
|
500
|
+
const coalesceStrategy = plugin.getCoalesceStrategy(table);
|
|
501
|
+
if (coalesceStrategy) {
|
|
502
|
+
return coalesceStrategy;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return undefined;
|
|
506
|
+
}
|
|
507
|
+
getCoalesceTables() {
|
|
508
|
+
const tables = new Set();
|
|
509
|
+
for (const plugin of this.plugins) {
|
|
510
|
+
plugin.getCoalesceTables().forEach((t) => {
|
|
511
|
+
tables.add(t);
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
return tables;
|
|
515
|
+
}
|
|
516
|
+
getReferenceColumns(table) {
|
|
517
|
+
const refColumnEntries = [];
|
|
518
|
+
for (const plugin of this.plugins) {
|
|
519
|
+
refColumnEntries.push(...Object.entries(plugin.getReferenceColumns(table)));
|
|
520
|
+
}
|
|
521
|
+
return Object.fromEntries(refColumnEntries);
|
|
522
|
+
}
|
|
523
|
+
async isEntryPoint(pathOrNode, context) {
|
|
524
|
+
for (const plugin of this.plugins) {
|
|
525
|
+
if (await plugin.isEntryPoint(pathOrNode, context)) {
|
|
526
|
+
return true;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
exports.Plugins = Plugins;
|
|
533
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugins/plugin.ts"],"names":[],"mappings":";;;AAAA,8CAMsB;AACtB,mCAAoH;AAGpH,yCAAmD;AAEnD,kCAAqC;AACrC,mCAA+B;AAuU/B,SAAS,UAAU,CAAgC,OAAe,EAAE,MAAiB;IACjF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;YACtC,CAAC,CAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAO;YACvD,CAAC,CAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAO,CAAA;IACjD,CAAC;IAED,OAAO,MAAM,CAAA;AACjB,CAAC;AAYD,MAAa,MAAM;IAOsB;IANpB,gBAAgB,GAAG,IAAI,aAAK,EAA6B,CAAA;IACzD,oBAAoB,GAAG,IAAI,aAAK,EAAwB,CAAA;IACxD,kBAAkB,GAAG,IAAI,aAAK,EAAyB,CAAA;IACvD,aAAa,GAA4B,EAAE,CAAA;IAC3C,UAAU,GAAyB,EAA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ts } from '../typescript';
|
|
2
|
+
import type { File } from './file';
|
|
3
|
+
import type { Plugin } from './plugin';
|
|
4
|
+
export type Source = ts.Node | File | Product;
|
|
5
|
+
export declare abstract class Product {
|
|
6
|
+
private readonly source;
|
|
7
|
+
private creator?;
|
|
8
|
+
protected constructor(source: Source);
|
|
9
|
+
getSource(): Source;
|
|
10
|
+
getOriginalSource(): Exclude<Source, Product>;
|
|
11
|
+
getOriginalFilePath(): string;
|
|
12
|
+
getOriginalNode(): ts.Node;
|
|
13
|
+
setCreator(creator: Plugin | undefined, overwrite?: boolean): this;
|
|
14
|
+
getCreator(): Plugin | undefined;
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Product = void 0;
|
|
4
|
+
const typescript_1 = require("../typescript");
|
|
5
|
+
class Product {
|
|
6
|
+
source;
|
|
7
|
+
creator;
|
|
8
|
+
constructor(source) {
|
|
9
|
+
this.source = source;
|
|
10
|
+
}
|
|
11
|
+
getSource() {
|
|
12
|
+
return this.source;
|
|
13
|
+
}
|
|
14
|
+
getOriginalSource() {
|
|
15
|
+
return this.source instanceof Product ? this.source.getOriginalSource() : this.source;
|
|
16
|
+
}
|
|
17
|
+
getOriginalFilePath() {
|
|
18
|
+
const origin = this.getOriginalSource();
|
|
19
|
+
return typescript_1.ts.Node.isNode(origin) ? origin.getSourceFile().getFilePath() : origin.path;
|
|
20
|
+
}
|
|
21
|
+
getOriginalNode() {
|
|
22
|
+
const origin = this.getOriginalSource();
|
|
23
|
+
// Important to do instanceof check instead of isNode() which will throw if the node was forgotten
|
|
24
|
+
if (origin instanceof typescript_1.ts.Node) {
|
|
25
|
+
return origin;
|
|
26
|
+
}
|
|
27
|
+
throw new Error('Product origin is not a node');
|
|
28
|
+
}
|
|
29
|
+
setCreator(creator, overwrite = false) {
|
|
30
|
+
this.creator = overwrite ? creator : (this.creator ?? creator);
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
getCreator() {
|
|
34
|
+
return this.creator;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Product = Product;
|
|
38
|
+
//# sourceMappingURL=product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../src/plugins/product.ts"],"names":[],"mappings":";;;AAAA,8CAAkC;AAMlC,MAAsB,OAAO;IAGc;IAF/B,OAAO,CAAqB;IAEpC,YAAuC,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEzD,SAAS;QACL,OAAO,IAAI,CAAC,MAAM,CAAA;IACtB,CAAC;IAED,iBAAiB;QACb,OAAO,IAAI,CAAC,MAAM,YAAY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAA;IACzF,CAAC;IAED,mBAAmB;QACf,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACvC,OAAO,eAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAA;IACtF,CAAC;IAED,eAAe;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAEvC,kGAAkG;QAClG,IAAI,MAAM,YAAY,eAAE,CAAC,IAAI,EAAE,CAAC;YAC5B,OAAO,MAAM,CAAA;QACjB,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACnD,CAAC;IAED,UAAU,CAAC,OAA2B,EAAE,SAAS,GAAG,KAAK;QACrD,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,CAAA;QAC9D,OAAO,IAAI,CAAA;IACf,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAA;IACvB,CAAC;CACJ;AArCD,0BAqCC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ProjectFile {
|
|
2
|
+
getPath(): string;
|
|
3
|
+
getName(): string;
|
|
4
|
+
getContent(): string;
|
|
5
|
+
setContent(content: string): void;
|
|
6
|
+
}
|
|
7
|
+
export interface Project {
|
|
8
|
+
getFiles(): ProjectFile[];
|
|
9
|
+
getFileIfExists(path: string): ProjectFile | undefined;
|
|
10
|
+
getFile(path: string): ProjectFile;
|
|
11
|
+
findFile(nameOrPredicate: string | ((entry: [path: string, file: ProjectFile]) => boolean)): ProjectFile | undefined;
|
|
12
|
+
addFile(path: string, options?: {
|
|
13
|
+
resolveDependencies?: boolean;
|
|
14
|
+
excludeFromCompiler?: boolean;
|
|
15
|
+
}): ProjectFile;
|
|
16
|
+
removeFile(fileOrPath: ProjectFile | string): void;
|
|
17
|
+
isInDir(dir: string, path: string): boolean;
|
|
18
|
+
getRootDir(): string;
|
|
19
|
+
isInRootDir(path: string): boolean;
|
|
20
|
+
getMetadataDir(): string;
|
|
21
|
+
isInMetadataDir(path: string): boolean;
|
|
22
|
+
getFluentDir(): string;
|
|
23
|
+
isInFluentDir(path: string): boolean;
|
|
24
|
+
resolvePath(...paths: string[]): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/plugins/project.ts"],"names":[],"mappings":""}
|