@servicenow/sdk-build-plugins 2.0.1 → 2.1.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/AttachmentPlugin.d.ts +8 -6
- package/dist/AttachmentPlugin.js +4 -2
- package/dist/AttachmentPlugin.js.map +1 -1
- package/dist/BusinessRulePlugin.d.ts +5 -31
- package/dist/BusinessRulePlugin.js +45 -72
- package/dist/BusinessRulePlugin.js.map +1 -1
- package/dist/CrossScopePrivilegePlugin.d.ts +14 -1
- package/dist/CrossScopePrivilegePlugin.js +36 -1
- package/dist/CrossScopePrivilegePlugin.js.map +1 -1
- package/dist/DefaultPlugin.d.ts +60 -57
- package/dist/DefaultPlugin.js +151 -146
- package/dist/DefaultPlugin.js.map +1 -1
- package/dist/HtmlTemplatePlugin.d.ts +21 -0
- package/dist/HtmlTemplatePlugin.js +52 -0
- package/dist/HtmlTemplatePlugin.js.map +1 -0
- package/dist/IdPlugin.d.ts +18 -8
- package/dist/IdPlugin.js +55 -28
- package/dist/IdPlugin.js.map +1 -1
- package/dist/JsonPlugin.d.ts +23 -0
- package/dist/JsonPlugin.js +74 -0
- package/dist/JsonPlugin.js.map +1 -0
- package/dist/ListPlugin.d.ts +7 -13
- package/dist/ListPlugin.js +32 -15
- package/dist/ListPlugin.js.map +1 -1
- package/dist/NowConfigPlugin.d.ts +45 -0
- package/dist/NowConfigPlugin.js +90 -0
- package/dist/NowConfigPlugin.js.map +1 -0
- package/dist/PackageJsonPlugin.d.ts +20 -0
- package/dist/PackageJsonPlugin.js +48 -0
- package/dist/PackageJsonPlugin.js.map +1 -0
- package/dist/PropertyPlugin.d.ts +9 -35
- package/dist/PropertyPlugin.js +53 -32
- package/dist/PropertyPlugin.js.map +1 -1
- package/dist/ScriptTemplatePlugin.d.ts +3 -20
- package/dist/ScriptTemplatePlugin.js +20 -138
- package/dist/ScriptTemplatePlugin.js.map +1 -1
- package/dist/ServerModulePlugin.d.ts +62 -0
- package/dist/ServerModulePlugin.js +231 -0
- package/dist/ServerModulePlugin.js.map +1 -0
- package/dist/UserPreferencePlugin.d.ts +4 -1
- package/dist/UserPreferencePlugin.js +12 -10
- package/dist/UserPreferencePlugin.js.map +1 -1
- package/dist/aclAndRole/AclPlugin.d.ts +41 -79
- package/dist/aclAndRole/AclPlugin.js +50 -72
- package/dist/aclAndRole/AclPlugin.js.map +1 -1
- package/dist/aclAndRole/RolePlugin.d.ts +27 -18
- package/dist/aclAndRole/RolePlugin.js +66 -41
- package/dist/aclAndRole/RolePlugin.js.map +1 -1
- package/dist/app/ApplicationMenuPlugin.d.ts +4 -2
- package/dist/app/ApplicationMenuPlugin.js +12 -7
- package/dist/app/ApplicationMenuPlugin.js.map +1 -1
- package/dist/atf/ATFComposer.js +324 -324
- package/dist/atf/TestPlugin.d.ts +12 -10
- package/dist/atf/TestPlugin.js +14 -12
- package/dist/atf/TestPlugin.js.map +1 -1
- package/dist/db/ColumnPlugins.d.ts +559 -97
- package/dist/db/ColumnPlugins.js +28 -24
- package/dist/db/ColumnPlugins.js.map +1 -1
- package/dist/db/DBUtils.d.ts +2 -0
- package/dist/db/DBUtils.js +27 -0
- package/dist/db/DBUtils.js.map +1 -0
- package/dist/db/DocumentationPlugin.d.ts +58 -0
- package/dist/db/DocumentationPlugin.js +248 -0
- package/dist/db/DocumentationPlugin.js.map +1 -0
- package/dist/db/RecordPlugin.d.ts +15 -13
- package/dist/db/RecordPlugin.js +74 -79
- package/dist/db/RecordPlugin.js.map +1 -1
- package/dist/db/TablePlugin.d.ts +38 -105
- package/dist/db/TablePlugin.js +205 -111
- package/dist/db/TablePlugin.js.map +1 -1
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +4 -1
- package/dist/db/index.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/scriptedRESTAPI/RESTDeserializationUtils.js +8 -6
- package/dist/scriptedRESTAPI/RESTDeserializationUtils.js.map +1 -1
- package/dist/scriptedRESTAPI/RESTSerializationUtils.js +7 -6
- package/dist/scriptedRESTAPI/RESTSerializationUtils.js.map +1 -1
- package/dist/scriptedRESTAPI/RestApiPlugin.d.ts +74 -85
- package/dist/scriptedRESTAPI/RestApiPlugin.js +71 -54
- package/dist/scriptedRESTAPI/RestApiPlugin.js.map +1 -1
- package/dist/scriptedRESTAPI/RestUtils.d.ts +2 -0
- package/dist/scriptedRESTAPI/RestUtils.js +37 -9
- package/dist/scriptedRESTAPI/RestUtils.js.map +1 -1
- package/dist/scripts/ClientScriptPlugin.d.ts +18 -16
- package/dist/scripts/ClientScriptPlugin.js +48 -45
- package/dist/scripts/ClientScriptPlugin.js.map +1 -1
- package/dist/scripts/scriptUtils.d.ts +0 -14
- package/dist/scripts/scriptUtils.js +0 -74
- package/dist/scripts/scriptUtils.js.map +1 -1
- package/dist/uxf/ExperiencePlugin.d.ts +31 -3
- package/dist/uxf/ExperiencePlugin.js +10 -4
- package/dist/uxf/ExperiencePlugin.js.map +1 -1
- package/dist/uxf/RoutesPlugin.d.ts +10 -3
- package/dist/uxf/RoutesPlugin.js +20 -14
- package/dist/uxf/RoutesPlugin.js.map +1 -1
- package/package.json +6 -6
- package/src/AttachmentPlugin.ts +10 -2
- package/src/BusinessRulePlugin.ts +79 -104
- package/src/CrossScopePrivilegePlugin.ts +65 -5
- package/src/DefaultPlugin.ts +181 -173
- package/src/HtmlTemplatePlugin.ts +31 -0
- package/src/IdPlugin.ts +59 -28
- package/src/JsonPlugin.ts +81 -0
- package/src/ListPlugin.ts +38 -19
- package/src/NowConfigPlugin.ts +72 -0
- package/src/PackageJsonPlugin.ts +24 -0
- package/src/PropertyPlugin.ts +60 -38
- package/src/ScriptTemplatePlugin.ts +22 -179
- package/src/ServerModulePlugin.ts +267 -0
- package/src/UserPreferencePlugin.ts +28 -19
- package/src/aclAndRole/AclPlugin.ts +78 -109
- package/src/aclAndRole/RolePlugin.ts +85 -58
- package/src/app/ApplicationMenuPlugin.ts +15 -11
- package/src/atf/ATFComposer.ts +1 -1
- package/src/atf/TestPlugin.ts +14 -12
- package/src/db/ColumnPlugins.ts +36 -37
- package/src/db/DBUtils.ts +36 -0
- package/src/db/DocumentationPlugin.ts +282 -0
- package/src/db/RecordPlugin.ts +96 -98
- package/src/db/TablePlugin.ts +278 -152
- package/src/db/index.ts +2 -0
- package/src/index.ts +7 -2
- package/src/scriptedRESTAPI/RESTDeserializationUtils.ts +15 -7
- package/src/scriptedRESTAPI/RESTSerializationUtils.ts +7 -6
- package/src/scriptedRESTAPI/RestApiPlugin.ts +85 -75
- package/src/scriptedRESTAPI/RestUtils.ts +44 -11
- package/src/scripts/ClientScriptPlugin.ts +64 -68
- package/src/scripts/scriptUtils.ts +0 -76
- package/src/uxf/ExperiencePlugin.ts +14 -13
- package/src/uxf/RoutesPlugin.ts +22 -27
package/dist/DefaultPlugin.js
CHANGED
|
@@ -30,176 +30,181 @@ exports.default = (0, sdk_build_core_1.Plugin)({
|
|
|
30
30
|
name: 'Default',
|
|
31
31
|
extractors: {
|
|
32
32
|
raw: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
handled: true,
|
|
36
|
-
diagnostics: [],
|
|
37
|
-
data: [new sdk_build_core_1.BooleanData(true, node)],
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
FalseKeyword(node) {
|
|
41
|
-
return {
|
|
42
|
-
handled: true,
|
|
43
|
-
diagnostics: [],
|
|
44
|
-
data: [new sdk_build_core_1.BooleanData(false, node)],
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
StringLiteral(node) {
|
|
48
|
-
return {
|
|
49
|
-
handled: true,
|
|
50
|
-
diagnostics: [],
|
|
51
|
-
data: [new sdk_build_core_1.StringData(node.getLiteralValue(), node)],
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
NoSubstitutionTemplateLiteral(node) {
|
|
55
|
-
return {
|
|
56
|
-
handled: true,
|
|
57
|
-
diagnostics: [],
|
|
58
|
-
data: [new sdk_build_core_1.StringData(node.getLiteralValue(), node)],
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
NumericLiteral(node) {
|
|
62
|
-
return {
|
|
63
|
-
handled: true,
|
|
64
|
-
diagnostics: [],
|
|
65
|
-
data: [new sdk_build_core_1.NumberData(node.getLiteralValue(), node)],
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
AsExpression(node, context) {
|
|
69
|
-
return context.extractAst(node.getExpression());
|
|
70
|
-
},
|
|
71
|
-
ComputedPropertyName(node, context) {
|
|
72
|
-
return context.extractAst(node.getExpression());
|
|
73
|
-
},
|
|
74
|
-
Identifier(node, context) {
|
|
75
|
-
return context.extractAst((0, sdk_build_core_1.getValueDeclaration)(node));
|
|
76
|
-
},
|
|
77
|
-
PropertyAccessExpression(node, context) {
|
|
78
|
-
return context.extractAst(node.getNameNode());
|
|
79
|
-
},
|
|
80
|
-
ShorthandPropertyAssignment(node, context) {
|
|
81
|
-
return context.extractAst(node.getNameNode());
|
|
82
|
-
},
|
|
83
|
-
VariableDeclaration(node, context) {
|
|
84
|
-
const initializer = node.getInitializer();
|
|
85
|
-
if (!initializer) {
|
|
33
|
+
any: {
|
|
34
|
+
TrueKeyword(node) {
|
|
86
35
|
return {
|
|
87
36
|
handled: true,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
new sdk_build_core_1.FluentDiagnostic(node, `Expected variable declaration to have an initializer: ${node.getText()}`),
|
|
91
|
-
],
|
|
37
|
+
diagnostics: [],
|
|
38
|
+
data: [new sdk_build_core_1.BooleanData(true, node)],
|
|
92
39
|
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
PropertyAssignment(node, context) {
|
|
97
|
-
const initializer = node.getInitializer();
|
|
98
|
-
if (!initializer) {
|
|
40
|
+
},
|
|
41
|
+
FalseKeyword(node) {
|
|
99
42
|
return {
|
|
100
43
|
handled: true,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
new sdk_build_core_1.FluentDiagnostic(node, `Expected property assignment to have an initializer: ${node.getText()}`),
|
|
104
|
-
],
|
|
44
|
+
diagnostics: [],
|
|
45
|
+
data: [new sdk_build_core_1.BooleanData(false, node)],
|
|
105
46
|
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
47
|
+
},
|
|
48
|
+
StringLiteral(node) {
|
|
49
|
+
return {
|
|
50
|
+
handled: true,
|
|
51
|
+
diagnostics: [],
|
|
52
|
+
data: [new sdk_build_core_1.StringData(node.getLiteralValue(), node)],
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
NoSubstitutionTemplateLiteral(node) {
|
|
56
|
+
return {
|
|
57
|
+
handled: true,
|
|
58
|
+
diagnostics: [],
|
|
59
|
+
data: [new sdk_build_core_1.StringData(node.getLiteralValue(), node)],
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
NumericLiteral(node) {
|
|
63
|
+
return {
|
|
64
|
+
handled: true,
|
|
65
|
+
diagnostics: [],
|
|
66
|
+
data: [new sdk_build_core_1.NumberData(node.getLiteralValue(), node)],
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
AsExpression(node, context) {
|
|
70
|
+
return context.extractAst(node.getExpression());
|
|
71
|
+
},
|
|
72
|
+
ExportAssignment(node, context) {
|
|
73
|
+
return context.extractAst(node.getExpression());
|
|
74
|
+
},
|
|
75
|
+
ComputedPropertyName(node, context) {
|
|
76
|
+
return context.extractAst(node.getExpression());
|
|
77
|
+
},
|
|
78
|
+
Identifier(node, context) {
|
|
79
|
+
return context.extractAst((0, sdk_build_core_1.getValueDeclaration)(node));
|
|
80
|
+
},
|
|
81
|
+
PropertyAccessExpression(node, context) {
|
|
82
|
+
return context.extractAst(node.getNameNode());
|
|
83
|
+
},
|
|
84
|
+
ShorthandPropertyAssignment(node, context) {
|
|
85
|
+
return context.extractAst(node.getNameNode());
|
|
86
|
+
},
|
|
87
|
+
VariableDeclaration(node, context) {
|
|
88
|
+
const initializer = node.getInitializer();
|
|
89
|
+
if (!initializer) {
|
|
115
90
|
return {
|
|
116
91
|
handled: true,
|
|
117
92
|
data: [],
|
|
118
|
-
diagnostics: [
|
|
93
|
+
diagnostics: [
|
|
94
|
+
new sdk_build_core_1.FluentDiagnostic(node, `Expected variable declaration to have an initializer: ${node.getText()}`),
|
|
95
|
+
],
|
|
119
96
|
};
|
|
120
97
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
diagnostics,
|
|
127
|
-
data: [new sdk_build_core_1.ArrayData(data, node)],
|
|
128
|
-
};
|
|
129
|
-
},
|
|
130
|
-
ObjectLiteralExpression(node, context) {
|
|
131
|
-
const diagnostics = [];
|
|
132
|
-
const data = {};
|
|
133
|
-
for (const prop of node.getProperties()) {
|
|
134
|
-
if (!ts.Node.isPropertyAssignment(prop) && !ts.Node.isShorthandPropertyAssignment(prop)) {
|
|
135
|
-
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(prop, 'Only property assignments are allowed'));
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
const nameNode = prop.getNameNode();
|
|
139
|
-
const result = context.extractAst(prop);
|
|
140
|
-
if (!result.handled) {
|
|
98
|
+
return context.extractAst(initializer);
|
|
99
|
+
},
|
|
100
|
+
PropertyAssignment(node, context) {
|
|
101
|
+
const initializer = node.getInitializer();
|
|
102
|
+
if (!initializer) {
|
|
141
103
|
return {
|
|
142
104
|
handled: true,
|
|
143
105
|
data: [],
|
|
144
|
-
diagnostics: [
|
|
106
|
+
diagnostics: [
|
|
107
|
+
new sdk_build_core_1.FluentDiagnostic(node, `Expected property assignment to have an initializer: ${node.getText()}`),
|
|
108
|
+
],
|
|
145
109
|
};
|
|
146
110
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
111
|
+
return context.extractAst(initializer);
|
|
112
|
+
},
|
|
113
|
+
ArrayLiteralExpression(node, context) {
|
|
114
|
+
const diagnostics = [];
|
|
115
|
+
const data = [];
|
|
116
|
+
for (const element of node.getElements()) {
|
|
117
|
+
const result = context.extractAst(element);
|
|
118
|
+
if (!result.handled) {
|
|
119
|
+
return {
|
|
120
|
+
handled: true,
|
|
121
|
+
data: [],
|
|
122
|
+
diagnostics: [new sdk_build_core_1.FluentDiagnostic(element, 'Unsupported array element')],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
diagnostics.push(...result.diagnostics);
|
|
126
|
+
data.push(...result.data);
|
|
151
127
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
.
|
|
167
|
-
const result = context.extractAst(
|
|
128
|
+
return {
|
|
129
|
+
handled: true,
|
|
130
|
+
diagnostics,
|
|
131
|
+
data: [new sdk_build_core_1.ArrayData(data, node)],
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
ObjectLiteralExpression(node, context) {
|
|
135
|
+
const diagnostics = [];
|
|
136
|
+
const data = {};
|
|
137
|
+
for (const prop of node.getProperties()) {
|
|
138
|
+
if (!ts.Node.isPropertyAssignment(prop) && !ts.Node.isShorthandPropertyAssignment(prop)) {
|
|
139
|
+
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(prop, 'Only property assignments are allowed'));
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const nameNode = prop.getNameNode();
|
|
143
|
+
const result = context.extractAst(prop);
|
|
168
144
|
if (!result.handled) {
|
|
169
|
-
|
|
170
|
-
|
|
145
|
+
return {
|
|
146
|
+
handled: true,
|
|
147
|
+
data: [],
|
|
148
|
+
diagnostics: [new sdk_build_core_1.FluentDiagnostic(prop, 'Unsupported property assignment')],
|
|
149
|
+
};
|
|
171
150
|
}
|
|
151
|
+
diagnostics.push(...result.diagnostics);
|
|
172
152
|
if (!(0 in result.data) || result.data.length !== 1) {
|
|
173
|
-
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(
|
|
174
|
-
|
|
153
|
+
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(nameNode, `Property assignment has unsupported structure`));
|
|
154
|
+
continue;
|
|
175
155
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
.join('');
|
|
180
|
-
return {
|
|
181
|
-
handled: true,
|
|
182
|
-
diagnostics,
|
|
183
|
-
data: [new sdk_build_core_1.StringData(text, node)],
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
//Added support for -ve number alone. Can be upgraded later to support other expressions as required.
|
|
187
|
-
PrefixUnaryExpression(node) {
|
|
188
|
-
if (!ts.Node.isNumericLiteral(node.getOperand()) ||
|
|
189
|
-
node.getOperatorToken() !== ts.SyntaxKind.MinusToken) {
|
|
156
|
+
const name = ts.Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : prop.getName();
|
|
157
|
+
data[name] = result.data[0];
|
|
158
|
+
}
|
|
190
159
|
return {
|
|
191
160
|
handled: true,
|
|
192
|
-
|
|
193
|
-
|
|
161
|
+
diagnostics,
|
|
162
|
+
data: [new sdk_build_core_1.ObjectData(data, node)],
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
TemplateExpression(node, context) {
|
|
166
|
+
const diagnostics = [];
|
|
167
|
+
const text = node.getHead().getLiteralText() +
|
|
168
|
+
node
|
|
169
|
+
.getTemplateSpans()
|
|
170
|
+
.map((s) => {
|
|
171
|
+
const result = context.extractAst(s.getExpression());
|
|
172
|
+
if (!result.handled) {
|
|
173
|
+
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(s, 'Unsupported expression in template'));
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
if (!(0 in result.data) || result.data.length !== 1) {
|
|
177
|
+
diagnostics.push(new sdk_build_core_1.FluentDiagnostic(s, `Unsupported expression in template`));
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
diagnostics.push(...result.diagnostics);
|
|
181
|
+
return `${result.data[0].getValue()}${s.getLiteral().getLiteralText()}`;
|
|
182
|
+
})
|
|
183
|
+
.join('');
|
|
184
|
+
return {
|
|
185
|
+
handled: true,
|
|
186
|
+
diagnostics,
|
|
187
|
+
data: [new sdk_build_core_1.StringData(text, node)],
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
//Added support for -ve number alone. Can be upgraded later to support other expressions as required.
|
|
191
|
+
PrefixUnaryExpression(node) {
|
|
192
|
+
if (!ts.Node.isNumericLiteral(node.getOperand()) ||
|
|
193
|
+
node.getOperatorToken() !== ts.SyntaxKind.MinusToken) {
|
|
194
|
+
return {
|
|
195
|
+
handled: true,
|
|
196
|
+
data: [],
|
|
197
|
+
diagnostics: [new sdk_build_core_1.FluentDiagnostic(node, 'Unsupported prefix unary expression')],
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
handled: true,
|
|
202
|
+
diagnostics: [],
|
|
203
|
+
data: [
|
|
204
|
+
new sdk_build_core_1.NumberData(-node.getOperand().asKind(ts.SyntaxKind.NumericLiteral).getLiteralValue(), node),
|
|
205
|
+
],
|
|
194
206
|
};
|
|
195
|
-
}
|
|
196
|
-
return {
|
|
197
|
-
handled: true,
|
|
198
|
-
diagnostics: [],
|
|
199
|
-
data: [
|
|
200
|
-
new sdk_build_core_1.NumberData(-node.getOperand().asKind(ts.SyntaxKind.NumericLiteral).getLiteralValue(), node),
|
|
201
|
-
],
|
|
202
|
-
};
|
|
207
|
+
},
|
|
203
208
|
},
|
|
204
209
|
},
|
|
205
210
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultPlugin.js","sourceRoot":"","sources":["../src/DefaultPlugin.ts"],"names":[],"mappings":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YAAY,EAAE,CAAC;QAChB,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC;aACvC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aACjC,MAAM,CACH,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;YACrB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7C,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA,CAAC,2CAA2C;YACnE,CAAC;YAED,OAAO,KAAK,CAAA;QAChB,CAAC,EACD,EAAmC,CACtC,CAAA;IACT,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;AACvC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StringData, UndefinedData } from '@servicenow/sdk-build-core';
|
|
2
|
+
import * as ts from 'ts-morph';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
readonly name: "htmlTemplate";
|
|
5
|
+
readonly extractors: {
|
|
6
|
+
readonly raw: {
|
|
7
|
+
readonly fluent: {
|
|
8
|
+
readonly TaggedTemplateExpression: (node: ts.TaggedTemplateExpression) => {
|
|
9
|
+
handled: false;
|
|
10
|
+
diagnostics?: never;
|
|
11
|
+
data?: never;
|
|
12
|
+
} | {
|
|
13
|
+
handled: true;
|
|
14
|
+
diagnostics: never[];
|
|
15
|
+
data: (StringData<string> | UndefinedData)[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const sdk_build_core_1 = require("@servicenow/sdk-build-core");
|
|
27
|
+
const ts = __importStar(require("ts-morph"));
|
|
28
|
+
const TEMPLATE_LITERAL_TAG = 'html';
|
|
29
|
+
exports.default = (0, sdk_build_core_1.Plugin)({
|
|
30
|
+
name: 'htmlTemplate',
|
|
31
|
+
extractors: {
|
|
32
|
+
raw: {
|
|
33
|
+
fluent: {
|
|
34
|
+
TaggedTemplateExpression: (node) => {
|
|
35
|
+
if (node.getTag().getText() !== TEMPLATE_LITERAL_TAG) {
|
|
36
|
+
return { handled: false };
|
|
37
|
+
}
|
|
38
|
+
const value = getTemplateLiteralValue(node)?.trim();
|
|
39
|
+
return {
|
|
40
|
+
handled: true,
|
|
41
|
+
diagnostics: [],
|
|
42
|
+
data: [typeof value === 'string' ? new sdk_build_core_1.StringData(value, node) : new sdk_build_core_1.UndefinedData(node)],
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
function getTemplateLiteralValue(node) {
|
|
50
|
+
return node?.getTemplate().asKind(ts.SyntaxKind.NoSubstitutionTemplateLiteral)?.getLiteralValue();
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=HtmlTemplatePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlTemplatePlugin.js","sourceRoot":"","sources":["../src/HtmlTemplatePlugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8E;AAC9E,6CAA8B;AAE9B,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAEnC,kBAAe,IAAA,uBAAM,EAAC;IAClB,IAAI,EAAE,cAAc;IACpB,UAAU,EAAE;QACR,GAAG,EAAE;YACD,MAAM,EAAE;gBACJ,wBAAwB,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC/B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,oBAAoB,EAAE,CAAC;wBACnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;oBAC7B,CAAC;oBAED,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;oBAEnD,OAAO;wBACH,OAAO,EAAE,IAAI;wBACb,WAAW,EAAE,EAAE;wBACf,IAAI,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,2BAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,8BAAa,CAAC,IAAI,CAAC,CAAC;qBAC5F,CAAA;gBACL,CAAC;aACJ;SACJ;KACJ;CACJ,CAAC,CAAA;AAEF,SAAS,uBAAuB,CAAC,IAAiC;IAC9D,OAAO,IAAI,EAAE,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,6BAA6B,CAAC,EAAE,eAAe,EAAE,CAAA;AACrG,CAAC"}
|
package/dist/IdPlugin.d.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FluentDiagnostic } from '@servicenow/sdk-build-core';
|
|
1
|
+
import { FluentDiagnostic, StringData, Data } from '@servicenow/sdk-build-core';
|
|
3
2
|
declare const _default: {
|
|
4
3
|
readonly name: "NowID";
|
|
5
4
|
readonly extractors: {
|
|
6
5
|
readonly raw: {
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
readonly fluent: {
|
|
7
|
+
readonly ElementAccessExpression: (node: import("ts-morph").ElementAccessExpression<import("ts-morph").ts.ElementAccessExpression>, context: import("@servicenow/sdk-build-core").Context) => {
|
|
8
|
+
handled: true;
|
|
9
|
+
data: Data<unknown>[];
|
|
10
|
+
diagnostics: FluentDiagnostic[];
|
|
11
|
+
} | {
|
|
12
|
+
handled: false;
|
|
13
|
+
};
|
|
14
|
+
readonly PropertyAccessExpression: (node: import("ts-morph").PropertyAccessExpression<import("ts-morph").ts.PropertyAccessExpression>, context: import("@servicenow/sdk-build-core").Context) => {
|
|
15
|
+
handled: false;
|
|
16
|
+
diagnostics?: never;
|
|
17
|
+
data?: never;
|
|
18
|
+
} | {
|
|
19
|
+
handled: true;
|
|
20
|
+
diagnostics: never[];
|
|
21
|
+
data: StringData<string>[];
|
|
22
|
+
};
|
|
13
23
|
};
|
|
14
24
|
};
|
|
15
25
|
};
|
package/dist/IdPlugin.js
CHANGED
|
@@ -7,37 +7,64 @@ exports.default = (0, sdk_build_core_1.Plugin)({
|
|
|
7
7
|
name: 'NowID',
|
|
8
8
|
extractors: {
|
|
9
9
|
raw: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
10
|
+
fluent: {
|
|
11
|
+
ElementAccessExpression(node, context) {
|
|
12
|
+
const nowIdExpression = node.getExpressionIfKind(ts_morph_1.SyntaxKind.PropertyAccessExpression);
|
|
13
|
+
if (!nowIdExpression || nowIdExpression.getText() !== 'Now.ID') {
|
|
14
|
+
return {
|
|
15
|
+
handled: false,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const argExpression = node.getArgumentExpression();
|
|
19
|
+
if (!argExpression || !(0, sdk_project_1.isSupportedNode)(argExpression)) {
|
|
20
|
+
return {
|
|
21
|
+
handled: true,
|
|
22
|
+
data: [],
|
|
23
|
+
diagnostics: [new sdk_build_core_1.FluentDiagnostic(node, 'Now.ID must have an argument')],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const result = context.extractRaw(argExpression);
|
|
27
|
+
if (!result.handled) {
|
|
28
|
+
return {
|
|
29
|
+
handled: true,
|
|
30
|
+
data: [],
|
|
31
|
+
diagnostics: [new sdk_build_core_1.FluentDiagnostic(node, 'Unsupported Now.ID argument')],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (!(0 in result.data) || result.data.length !== 1) {
|
|
35
|
+
return {
|
|
36
|
+
handled: true,
|
|
37
|
+
data: [],
|
|
38
|
+
diagnostics: [
|
|
39
|
+
...result.diagnostics,
|
|
40
|
+
new sdk_build_core_1.FluentDiagnostic(node, 'Unsupported Now.ID argument'),
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
},
|
|
46
|
+
PropertyAccessExpression(node, context) {
|
|
47
|
+
if (node.getName() !== '$id') {
|
|
48
|
+
return { handled: false };
|
|
49
|
+
}
|
|
50
|
+
const identifier = node.getExpressionIfKind(ts_morph_1.SyntaxKind.Identifier);
|
|
51
|
+
if (!identifier) {
|
|
52
|
+
return { handled: false };
|
|
53
|
+
}
|
|
54
|
+
const extraction = context.extractAst(identifier);
|
|
55
|
+
if (!extraction.handled) {
|
|
56
|
+
return { handled: false };
|
|
57
|
+
}
|
|
58
|
+
const entity = extraction.data[0];
|
|
59
|
+
if (!sdk_build_core_1.Data.isEntity(entity)) {
|
|
60
|
+
return { handled: false };
|
|
61
|
+
}
|
|
34
62
|
return {
|
|
35
63
|
handled: true,
|
|
36
|
-
|
|
37
|
-
|
|
64
|
+
diagnostics: [],
|
|
65
|
+
data: [new sdk_build_core_1.StringData(entity.getGuid(), node)],
|
|
38
66
|
};
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
67
|
+
},
|
|
41
68
|
},
|
|
42
69
|
},
|
|
43
70
|
},
|
package/dist/IdPlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdPlugin.js","sourceRoot":"","sources":["../src/IdPlugin.ts"],"names":[],"mappings":";;AAAA,yDAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"IdPlugin.js","sourceRoot":"","sources":["../src/IdPlugin.ts"],"names":[],"mappings":";;AAAA,yDAAyD;AACzD,uCAAqC;AACrC,+DAAuF;AAEvF,kBAAe,IAAA,uBAAM,EAAC;IAClB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE;QACR,GAAG,EAAE;YACD,MAAM,EAAE;gBACJ,uBAAuB,CAAC,IAAI,EAAE,OAAO;oBACjC,MAAM,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,qBAAU,CAAC,wBAAwB,CAAC,CAAA;oBACrF,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,OAAO,EAAE,KAAK,QAAQ,EAAE,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AC,UAAU,CAAC,CAAA;oBAClE,IAAI,CAAC,UAAU,EAAE,CAAC;wBACd,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;oBAC7B,CAAC;oBAED,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;oBACjD,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;wBACtB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;oBAC7B,CAAC;oBAED,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;oBACjC,IAAI,CAAC,qBAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;wBACzB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;oBAC7B,CAAC;oBAED,OAAO;wBACH,OAAO,EAAE,IAAI;wBACb,WAAW,EAAE,EAAE;wBACf,IAAI,EAAE,CAAC,IAAI,2BAAU,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;qBACjD,CAAA;gBACL,CAAC;aACJ;SACJ;KACJ;CACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FluentDiagnostic, StringData } from '@servicenow/sdk-build-core';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
readonly name: "JSON";
|
|
4
|
+
readonly extractors: {
|
|
5
|
+
readonly raw: {
|
|
6
|
+
readonly json: {
|
|
7
|
+
readonly SourceFile: (node: import("ts-morph").SourceFile, context: import("@servicenow/sdk-build-core").Context) => import("@servicenow/sdk-build-core").ExtractionResult;
|
|
8
|
+
};
|
|
9
|
+
readonly fluent: {
|
|
10
|
+
readonly CallExpression: (node: import("ts-morph").CallExpression<import("ts-morph").ts.CallExpression>, context: import("@servicenow/sdk-build-core").Context) => {
|
|
11
|
+
handled: false;
|
|
12
|
+
diagnostics?: never;
|
|
13
|
+
data?: never;
|
|
14
|
+
} | {
|
|
15
|
+
handled: true;
|
|
16
|
+
diagnostics: FluentDiagnostic[];
|
|
17
|
+
data: StringData<string>[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|