@servicenow/sdk-build-plugins 3.0.3 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acl-plugin.d.ts +19 -0
- package/dist/acl-plugin.js +210 -0
- package/dist/acl-plugin.js.map +1 -0
- package/dist/application-menu-plugin.d.ts +18 -0
- package/dist/application-menu-plugin.js +104 -0
- package/dist/application-menu-plugin.js.map +1 -0
- package/dist/arrow-function-plugin.d.ts +16 -0
- package/dist/arrow-function-plugin.js +107 -0
- package/dist/arrow-function-plugin.js.map +1 -0
- package/dist/atf/step-configs.d.ts +39 -0
- package/dist/atf/step-configs.js +2334 -0
- package/dist/atf/step-configs.js.map +1 -0
- package/dist/atf/test-plugin.d.ts +4 -0
- package/dist/atf/test-plugin.js +600 -0
- package/dist/atf/test-plugin.js.map +1 -0
- package/dist/basic-syntax-plugin.d.ts +2 -0
- package/dist/basic-syntax-plugin.js +636 -0
- package/dist/basic-syntax-plugin.js.map +1 -0
- package/dist/business-rule-plugin.d.ts +3 -0
- package/dist/business-rule-plugin.js +205 -0
- package/dist/business-rule-plugin.js.map +1 -0
- package/dist/call-expression-plugin.d.ts +2 -0
- package/dist/call-expression-plugin.js +175 -0
- package/dist/call-expression-plugin.js.map +1 -0
- package/dist/client-script-plugin.d.ts +29 -0
- package/dist/client-script-plugin.js +164 -0
- package/dist/client-script-plugin.js.map +1 -0
- package/dist/column/column-helper.d.ts +12 -0
- package/dist/column/column-helper.js +84 -0
- package/dist/column/column-helper.js.map +1 -0
- package/dist/column/column-to-record.d.ts +3 -0
- package/dist/column/column-to-record.js +105 -0
- package/dist/column/column-to-record.js.map +1 -0
- package/dist/column-plugin.d.ts +8 -0
- package/dist/column-plugin.js +453 -0
- package/dist/column-plugin.js.map +1 -0
- package/dist/cross-scope-privilege-plugin.d.ts +15 -0
- package/dist/cross-scope-privilege-plugin.js +82 -0
- package/dist/cross-scope-privilege-plugin.js.map +1 -0
- package/dist/html-import-plugin.d.ts +2 -0
- package/dist/html-import-plugin.js +72 -0
- package/dist/html-import-plugin.js.map +1 -0
- package/dist/index.d.ts +37 -21
- package/dist/index.js +40 -45
- package/dist/index.js.map +1 -1
- package/dist/json-plugin.d.ts +15 -0
- package/dist/json-plugin.js +104 -0
- package/dist/json-plugin.js.map +1 -0
- package/dist/list-plugin.d.ts +2 -0
- package/dist/list-plugin.js +191 -0
- package/dist/list-plugin.js.map +1 -0
- package/dist/now-config-plugin.d.ts +4 -0
- package/dist/now-config-plugin.js +154 -0
- package/dist/now-config-plugin.js.map +1 -0
- package/dist/now-id-plugin.d.ts +11 -0
- package/dist/now-id-plugin.js +71 -0
- package/dist/now-id-plugin.js.map +1 -0
- package/dist/now-include-plugin.d.ts +16 -0
- package/dist/now-include-plugin.js +118 -0
- package/dist/now-include-plugin.js.map +1 -0
- package/dist/now-ref-plugin.d.ts +2 -0
- package/dist/now-ref-plugin.js +43 -0
- package/dist/now-ref-plugin.js.map +1 -0
- package/dist/now-unresolved-plugin.d.ts +2 -0
- package/dist/now-unresolved-plugin.js +32 -0
- package/dist/now-unresolved-plugin.js.map +1 -0
- package/dist/package-json-plugin.d.ts +2 -0
- package/dist/package-json-plugin.js +70 -0
- package/dist/package-json-plugin.js.map +1 -0
- package/dist/property-plugin.d.ts +2 -0
- package/dist/property-plugin.js +105 -0
- package/dist/property-plugin.js.map +1 -0
- package/dist/record-plugin.d.ts +43 -0
- package/dist/record-plugin.js +147 -0
- package/dist/record-plugin.js.map +1 -0
- package/dist/repack/index.d.ts +1 -0
- package/dist/repack/index.js +10 -2
- package/dist/repack/index.js.map +1 -1
- package/dist/repack/lint/Rules.d.ts +1 -1
- package/dist/repack/lint/Rules.js +7 -3
- package/dist/repack/lint/Rules.js.map +1 -1
- package/dist/repack/lint/index.js +1 -1
- package/dist/rest-api-plugin.d.ts +2 -0
- package/dist/rest-api-plugin.js +469 -0
- package/dist/rest-api-plugin.js.map +1 -0
- package/dist/role-plugin.d.ts +2 -0
- package/dist/role-plugin.js +117 -0
- package/dist/role-plugin.js.map +1 -0
- package/dist/script-action-plugin.d.ts +2 -0
- package/dist/script-action-plugin.js +62 -0
- package/dist/script-action-plugin.js.map +1 -0
- package/dist/script-include-plugin.d.ts +2 -0
- package/dist/script-include-plugin.js +102 -0
- package/dist/script-include-plugin.js.map +1 -0
- package/dist/server-module-plugin/index.d.ts +14 -0
- package/dist/server-module-plugin/index.js +378 -0
- package/dist/server-module-plugin/index.js.map +1 -0
- package/dist/server-module-plugin/sbom-builder.d.ts +45 -0
- package/dist/server-module-plugin/sbom-builder.js +179 -0
- package/dist/server-module-plugin/sbom-builder.js.map +1 -0
- package/dist/service-portal/angular-provider-plugin.d.ts +2 -0
- package/dist/service-portal/angular-provider-plugin.js +78 -0
- package/dist/service-portal/angular-provider-plugin.js.map +1 -0
- package/dist/service-portal/dependency-plugin.d.ts +2 -0
- package/dist/service-portal/dependency-plugin.js +235 -0
- package/dist/service-portal/dependency-plugin.js.map +1 -0
- package/dist/service-portal/widget-plugin.d.ts +6 -0
- package/dist/service-portal/widget-plugin.js +230 -0
- package/dist/service-portal/widget-plugin.js.map +1 -0
- package/dist/static-content-plugin.d.ts +2 -0
- package/dist/static-content-plugin.js +272 -0
- package/dist/static-content-plugin.js.map +1 -0
- package/dist/table-plugin.d.ts +3 -0
- package/dist/table-plugin.js +1324 -0
- package/dist/table-plugin.js.map +1 -0
- package/dist/ui-action-plugin.d.ts +2 -0
- package/dist/ui-action-plugin.js +291 -0
- package/dist/ui-action-plugin.js.map +1 -0
- package/dist/ui-page-plugin.d.ts +2 -0
- package/dist/ui-page-plugin.js +165 -0
- package/dist/ui-page-plugin.js.map +1 -0
- package/dist/user-preference-plugin.d.ts +15 -0
- package/dist/user-preference-plugin.js +63 -0
- package/dist/user-preference-plugin.js.map +1 -0
- package/dist/utils.d.ts +17 -0
- package/dist/utils.js +72 -0
- package/dist/utils.js.map +1 -0
- package/dist/view-plugin.d.ts +2 -0
- package/dist/view-plugin.js +45 -0
- package/dist/view-plugin.js.map +1 -0
- package/package.json +17 -13
- package/src/acl-plugin.ts +256 -0
- package/src/application-menu-plugin.ts +109 -0
- package/src/arrow-function-plugin.ts +127 -0
- package/src/atf/step-configs.ts +2384 -0
- package/src/atf/test-plugin.ts +739 -0
- package/src/basic-syntax-plugin.ts +729 -0
- package/src/business-rule-plugin.ts +266 -0
- package/src/call-expression-plugin.ts +202 -0
- package/src/client-script-plugin.ts +179 -0
- package/src/column/column-helper.ts +119 -0
- package/src/column/column-to-record.ts +131 -0
- package/src/column-plugin.ts +506 -0
- package/src/cross-scope-privilege-plugin.ts +82 -0
- package/src/html-import-plugin.ts +79 -0
- package/src/index.ts +39 -21
- package/src/json-plugin.ts +128 -0
- package/src/list-plugin.ts +222 -0
- package/src/now-config-plugin.ts +194 -0
- package/src/now-id-plugin.ts +78 -0
- package/src/now-include-plugin.ts +140 -0
- package/src/now-ref-plugin.ts +48 -0
- package/src/now-unresolved-plugin.ts +30 -0
- package/src/package-json-plugin.ts +87 -0
- package/src/property-plugin.ts +118 -0
- package/src/record-plugin.ts +171 -0
- package/src/repack/index.ts +10 -1
- package/src/repack/lint/Rules.ts +5 -4
- package/src/repack/lint/index.ts +1 -1
- package/src/rest-api-plugin.ts +658 -0
- package/src/role-plugin.ts +128 -0
- package/src/script-action-plugin.ts +63 -0
- package/src/script-include-plugin.ts +110 -0
- package/src/server-module-plugin/index.ts +470 -0
- package/src/server-module-plugin/sbom-builder.ts +183 -0
- package/src/service-portal/angular-provider-plugin.ts +83 -0
- package/src/service-portal/dependency-plugin.ts +284 -0
- package/src/service-portal/widget-plugin.ts +263 -0
- package/src/static-content-plugin.ts +254 -0
- package/src/table-plugin.ts +1698 -0
- package/src/ui-action-plugin.ts +324 -0
- package/src/ui-page-plugin.ts +168 -0
- package/src/user-preference-plugin.ts +62 -0
- package/src/utils.ts +69 -0
- package/src/view-plugin.ts +46 -0
- package/dist/AttachmentPlugin.d.ts +0 -254
- package/dist/AttachmentPlugin.js +0 -220
- package/dist/AttachmentPlugin.js.map +0 -1
- package/dist/BusinessRulePlugin.d.ts +0 -30
- package/dist/BusinessRulePlugin.js +0 -149
- package/dist/BusinessRulePlugin.js.map +0 -1
- package/dist/CrossScopePrivilegePlugin.d.ts +0 -35
- package/dist/CrossScopePrivilegePlugin.js +0 -80
- package/dist/CrossScopePrivilegePlugin.js.map +0 -1
- package/dist/DefaultPlugin.d.ts +0 -86
- package/dist/DefaultPlugin.js +0 -226
- package/dist/DefaultPlugin.js.map +0 -1
- package/dist/HtmlTemplatePlugin.d.ts +0 -21
- package/dist/HtmlTemplatePlugin.js +0 -29
- package/dist/HtmlTemplatePlugin.js.map +0 -1
- package/dist/IdPlugin.d.ts +0 -28
- package/dist/IdPlugin.js +0 -68
- package/dist/IdPlugin.js.map +0 -1
- package/dist/IncludePlugin.d.ts +0 -34
- package/dist/IncludePlugin.js +0 -155
- package/dist/IncludePlugin.js.map +0 -1
- package/dist/JsonPlugin.d.ts +0 -28
- package/dist/JsonPlugin.js +0 -69
- package/dist/JsonPlugin.js.map +0 -1
- package/dist/ListPlugin.d.ts +0 -93
- package/dist/ListPlugin.js +0 -456
- package/dist/ListPlugin.js.map +0 -1
- package/dist/NowConfigPlugin.d.ts +0 -45
- package/dist/NowConfigPlugin.js +0 -64
- package/dist/NowConfigPlugin.js.map +0 -1
- package/dist/PackageJsonPlugin.d.ts +0 -34
- package/dist/PackageJsonPlugin.js +0 -63
- package/dist/PackageJsonPlugin.js.map +0 -1
- package/dist/PropertyPlugin.d.ts +0 -51
- package/dist/PropertyPlugin.js +0 -181
- package/dist/PropertyPlugin.js.map +0 -1
- package/dist/ScriptTemplatePlugin.d.ts +0 -13
- package/dist/ScriptTemplatePlugin.js +0 -55
- package/dist/ScriptTemplatePlugin.js.map +0 -1
- package/dist/ServerModulePlugin.d.ts +0 -75
- package/dist/ServerModulePlugin.js +0 -368
- package/dist/ServerModulePlugin.js.map +0 -1
- package/dist/UserPreferencePlugin.d.ts +0 -19
- package/dist/UserPreferencePlugin.js +0 -32
- package/dist/UserPreferencePlugin.js.map +0 -1
- package/dist/aclAndRole/AclPlugin.d.ts +0 -82
- package/dist/aclAndRole/AclPlugin.js +0 -262
- package/dist/aclAndRole/AclPlugin.js.map +0 -1
- package/dist/aclAndRole/RolePlugin.d.ts +0 -66
- package/dist/aclAndRole/RolePlugin.js +0 -179
- package/dist/aclAndRole/RolePlugin.js.map +0 -1
- package/dist/aclAndRole/Util.d.ts +0 -3
- package/dist/aclAndRole/Util.js +0 -90
- package/dist/aclAndRole/Util.js.map +0 -1
- package/dist/app/ApplicationMenuPlugin.d.ts +0 -34
- package/dist/app/ApplicationMenuPlugin.js +0 -112
- package/dist/app/ApplicationMenuPlugin.js.map +0 -1
- package/dist/db/ColumnPlugins.d.ts +0 -750
- package/dist/db/ColumnPlugins.js +0 -114
- package/dist/db/ColumnPlugins.js.map +0 -1
- package/dist/db/DBUtils.d.ts +0 -2
- package/dist/db/DBUtils.js +0 -27
- package/dist/db/DBUtils.js.map +0 -1
- package/dist/db/DocumentationPlugin.d.ts +0 -67
- package/dist/db/DocumentationPlugin.js +0 -258
- package/dist/db/DocumentationPlugin.js.map +0 -1
- package/dist/db/LicensingPlugin.d.ts +0 -60
- package/dist/db/LicensingPlugin.js +0 -117
- package/dist/db/LicensingPlugin.js.map +0 -1
- package/dist/db/RecordPlugin.d.ts +0 -133
- package/dist/db/RecordPlugin.js +0 -337
- package/dist/db/RecordPlugin.js.map +0 -1
- package/dist/db/TablePlugin.d.ts +0 -231
- package/dist/db/TablePlugin.js +0 -1630
- package/dist/db/TablePlugin.js.map +0 -1
- package/dist/db/index.d.ts +0 -6
- package/dist/db/index.js +0 -32
- package/dist/db/index.js.map +0 -1
- package/dist/scriptedRESTAPI/RESTDeserializationUtils.d.ts +0 -10
- package/dist/scriptedRESTAPI/RESTDeserializationUtils.js +0 -373
- package/dist/scriptedRESTAPI/RESTDeserializationUtils.js.map +0 -1
- package/dist/scriptedRESTAPI/RESTSerializationUtils.d.ts +0 -13
- package/dist/scriptedRESTAPI/RESTSerializationUtils.js +0 -177
- package/dist/scriptedRESTAPI/RESTSerializationUtils.js.map +0 -1
- package/dist/scriptedRESTAPI/RestApiPlugin.d.ts +0 -81
- package/dist/scriptedRESTAPI/RestApiPlugin.js +0 -345
- package/dist/scriptedRESTAPI/RestApiPlugin.js.map +0 -1
- package/dist/scriptedRESTAPI/RestSchemaUtils.d.ts +0 -190
- package/dist/scriptedRESTAPI/RestSchemaUtils.js +0 -53
- package/dist/scriptedRESTAPI/RestSchemaUtils.js.map +0 -1
- package/dist/scriptedRESTAPI/RestUtils.d.ts +0 -69
- package/dist/scriptedRESTAPI/RestUtils.js +0 -497
- package/dist/scriptedRESTAPI/RestUtils.js.map +0 -1
- package/dist/scripts/ClientScriptPlugin.d.ts +0 -64
- package/dist/scripts/ClientScriptPlugin.js +0 -170
- package/dist/scripts/ClientScriptPlugin.js.map +0 -1
- package/dist/scripts/scriptUtils.d.ts +0 -1
- package/dist/scripts/scriptUtils.js +0 -9
- package/dist/scripts/scriptUtils.js.map +0 -1
- package/dist/uxf/ExperiencePlugin.d.ts +0 -45
- package/dist/uxf/ExperiencePlugin.js +0 -61
- package/dist/uxf/ExperiencePlugin.js.map +0 -1
- package/dist/uxf/RoutesPlugin.d.ts +0 -29
- package/dist/uxf/RoutesPlugin.js +0 -181
- package/dist/uxf/RoutesPlugin.js.map +0 -1
- package/dist/uxf/UxfFormulaParser/cleanUxValue.d.ts +0 -4
- package/dist/uxf/UxfFormulaParser/cleanUxValue.js +0 -65
- package/dist/uxf/UxfFormulaParser/cleanUxValue.js.map +0 -1
- package/dist/uxf/UxfFormulaParser/grammerParser/api.d.ts +0 -189
- package/dist/uxf/UxfFormulaParser/grammerParser/api.js +0 -158
- package/dist/uxf/UxfFormulaParser/grammerParser/api.js.map +0 -1
- package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.d.ts +0 -13
- package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js +0 -604
- package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js.map +0 -1
- package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.d.ts +0 -12
- package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.js +0 -551
- package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.js.map +0 -1
- package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.d.ts +0 -31
- package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.js +0 -64
- package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.js.map +0 -1
- package/dist/uxf/UxfFormulaParser/index.d.ts +0 -3
- package/dist/uxf/UxfFormulaParser/index.js +0 -11
- package/dist/uxf/UxfFormulaParser/index.js.map +0 -1
- package/dist/uxf/UxfFormulaParser/parser.d.ts +0 -8
- package/dist/uxf/UxfFormulaParser/parser.js +0 -87
- package/dist/uxf/UxfFormulaParser/parser.js.map +0 -1
- package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.d.ts +0 -8
- package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.js +0 -17
- package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.js.map +0 -1
- package/dist/uxf/constants.d.ts +0 -2
- package/dist/uxf/constants.js +0 -8
- package/dist/uxf/constants.js.map +0 -1
- package/dist/uxf/index.d.ts +0 -2
- package/dist/uxf/index.js +0 -11
- package/dist/uxf/index.js.map +0 -1
- package/dist/uxf/tectonicIdGenerator.d.ts +0 -12
- package/dist/uxf/tectonicIdGenerator.js +0 -79
- package/dist/uxf/tectonicIdGenerator.js.map +0 -1
- package/src/AttachmentPlugin.ts +0 -268
- package/src/BusinessRulePlugin.ts +0 -238
- package/src/CrossScopePrivilegePlugin.ts +0 -115
- package/src/DefaultPlugin.ts +0 -288
- package/src/HtmlTemplatePlugin.ts +0 -31
- package/src/IdPlugin.ts +0 -74
- package/src/IncludePlugin.ts +0 -206
- package/src/JsonPlugin.ts +0 -76
- package/src/ListPlugin.ts +0 -570
- package/src/NowConfigPlugin.ts +0 -69
- package/src/PackageJsonPlugin.ts +0 -68
- package/src/PropertyPlugin.ts +0 -237
- package/src/ScriptTemplatePlugin.ts +0 -53
- package/src/ServerModulePlugin.ts +0 -480
- package/src/UserPreferencePlugin.ts +0 -45
- package/src/aclAndRole/AclPlugin.ts +0 -420
- package/src/aclAndRole/RolePlugin.ts +0 -254
- package/src/aclAndRole/Util.ts +0 -113
- package/src/app/ApplicationMenuPlugin.ts +0 -165
- package/src/db/ColumnPlugins.ts +0 -114
- package/src/db/DBUtils.ts +0 -36
- package/src/db/DocumentationPlugin.ts +0 -316
- package/src/db/LicensingPlugin.ts +0 -138
- package/src/db/RecordPlugin.ts +0 -459
- package/src/db/TablePlugin.ts +0 -2072
- package/src/db/index.ts +0 -6
- package/src/scriptedRESTAPI/RESTDeserializationUtils.ts +0 -419
- package/src/scriptedRESTAPI/RESTSerializationUtils.ts +0 -228
- package/src/scriptedRESTAPI/RestApiPlugin.ts +0 -469
- package/src/scriptedRESTAPI/RestSchemaUtils.ts +0 -72
- package/src/scriptedRESTAPI/RestUtils.ts +0 -569
- package/src/scripts/ClientScriptPlugin.ts +0 -257
- package/src/scripts/scriptUtils.ts +0 -5
- package/src/uxf/ExperiencePlugin.ts +0 -67
- package/src/uxf/RoutesPlugin.ts +0 -211
- package/src/uxf/UxfFormulaParser/cleanUxValue.ts +0 -73
- package/src/uxf/UxfFormulaParser/grammerParser/api.js +0 -166
- package/src/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js +0 -606
- package/src/uxf/UxfFormulaParser/grammerParser/grammarParser.js +0 -551
- package/src/uxf/UxfFormulaParser/grammerParser/spanHelpers.js +0 -65
- package/src/uxf/UxfFormulaParser/index.ts +0 -4
- package/src/uxf/UxfFormulaParser/parser.ts +0 -64
- package/src/uxf/UxfFormulaParser/utils/getErrorMsg.ts +0 -13
- package/src/uxf/constants.ts +0 -4
- package/src/uxf/index.ts +0 -2
- package/src/uxf/tectonicIdGenerator.ts +0 -78
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copied from sn-uxf-formula-parser-library - https://code.devsnc.com/dev/uxf-formula-parser
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.tokenSpan = tokenSpan;
|
|
5
|
-
exports.getBinarySpan = getBinarySpan;
|
|
6
|
-
exports.getUnarySpan = getUnarySpan;
|
|
7
|
-
exports.getBindingSpan = getBindingSpan;
|
|
8
|
-
/**
|
|
9
|
-
* https://code.devsnc.com/dev/uxf-formula-parser/blob/ci/master/src/uxf-formula-parser/grammar-parser/spanHelpers.js
|
|
10
|
-
*/
|
|
11
|
-
// given a token, gets the line and col where it starts (helper function, no need to export)
|
|
12
|
-
function tokenStart(token) {
|
|
13
|
-
return {
|
|
14
|
-
line: token.line,
|
|
15
|
-
col: token.col,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
// given a token, gets the line and col where it ends (helper function, no need to export)
|
|
19
|
-
function tokenEnd(token) {
|
|
20
|
-
const lastNewLine = token.text?.lastIndexOf('\n') ?? -1;
|
|
21
|
-
if (lastNewLine !== -1) {
|
|
22
|
-
throw new Error('Unsupported case: token with line breaks');
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
line: token.line,
|
|
26
|
-
col: token.col + token.text.length,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
// given two tokens, returns the span of the two tokens
|
|
30
|
-
function tokenSpan(token, endToken = null) {
|
|
31
|
-
const start = tokenStart(token);
|
|
32
|
-
const end = tokenEnd(endToken ?? token);
|
|
33
|
-
return { start, end };
|
|
34
|
-
}
|
|
35
|
-
// given two ux values (left and right operands in a binary expression), return the span of the entire expression
|
|
36
|
-
function getBinarySpan(left, right) {
|
|
37
|
-
const start = left._span.start;
|
|
38
|
-
const end = right._span.end;
|
|
39
|
-
return { start, end };
|
|
40
|
-
}
|
|
41
|
-
// given the token of the unary operator and the operand ux value, returns the span of a unary expression
|
|
42
|
-
function getUnarySpan(token, operand) {
|
|
43
|
-
const start = tokenStart(token);
|
|
44
|
-
const end = operand._span.end;
|
|
45
|
-
return { start, end };
|
|
46
|
-
}
|
|
47
|
-
// given the binding token and the address of a binding, returns the span of the binding
|
|
48
|
-
function getBindingSpan(token, address) {
|
|
49
|
-
const start = tokenStart(token);
|
|
50
|
-
const { line, col } = start;
|
|
51
|
-
var totalLength = 0;
|
|
52
|
-
if (address) {
|
|
53
|
-
for (let i = 0; i < address.length; i++) {
|
|
54
|
-
totalLength += address[i].length;
|
|
55
|
-
if (i !== 0) {
|
|
56
|
-
totalLength += 1;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const endCol = col + token.value.length + totalLength;
|
|
61
|
-
const end = { line, col: endCol };
|
|
62
|
-
return { start, end };
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=spanHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spanHelpers.js","sourceRoot":"","sources":["../../../../src/uxf/UxfFormulaParser/grammerParser/spanHelpers.js"],"names":[],"mappings":";AAAA,6FAA6F;;AA2B7F,8BAKC;AAGD,sCAIC;AAGD,oCAIC;AAGD,wCAeC;AA9DD;;GAEG;AAEH,4FAA4F;AAC5F,SAAS,UAAU,CAAC,KAAK;IACrB,OAAO;QACH,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,GAAG,EAAE,KAAK,CAAC,GAAG;KACjB,CAAA;AACL,CAAC;AAED,0FAA0F;AAC1F,SAAS,QAAQ,CAAC,KAAK;IACnB,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACvD,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC/D,CAAC;IACD,OAAO;QACH,IAAI,EAAE,KAAK,CAA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;YAChC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACV,WAAW,IAAI,CAAC,CAAA;YACpB,CAAC;QACL,CAAC;IACL,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAA;IACrD,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;IACjC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;AACzB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.cleanUxValue = exports.parser = void 0;
|
|
7
|
-
const parser_1 = __importDefault(require("./parser"));
|
|
8
|
-
exports.parser = parser_1.default;
|
|
9
|
-
const cleanUxValue_1 = require("./cleanUxValue");
|
|
10
|
-
Object.defineProperty(exports, "cleanUxValue", { enumerable: true, get: function () { return cleanUxValue_1.cleanUxValue; } });
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/uxf/UxfFormulaParser/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAuC;AAGV,iBAHtB,gBAAgB,CAGY;AAFnC,iDAA6C;AAER,6FAF5B,2BAAY,OAE4B"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copied from sn-uxf-formula-parser-library - https://code.devsnc.com/dev/uxf-formula-parser
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
/**
|
|
31
|
-
* https://code.devsnc.com/dev/uxf-formula-parser/blob/ci/master/src/uxf-formula-parser/parser/expressionParser.js
|
|
32
|
-
*/
|
|
33
|
-
const nearley_1 = __importDefault(require("nearley"));
|
|
34
|
-
const grammar = __importStar(require("./grammerParser/grammarParser.js"));
|
|
35
|
-
const getErrorMsg_1 = require("./utils/getErrorMsg");
|
|
36
|
-
class UxfFormulaParser {
|
|
37
|
-
constructor() { }
|
|
38
|
-
parse(expression) {
|
|
39
|
-
let ans;
|
|
40
|
-
const parser = new nearley_1.default.Parser(nearley_1.default.Grammar.fromCompiled(grammar));
|
|
41
|
-
parser.reportError = function (token) {
|
|
42
|
-
const message = token.value
|
|
43
|
-
? `Invalid Syntax: did not expect the token "${token.value}" when parsing expression.`
|
|
44
|
-
: 'Invalid Syntax: unparsable expression entered';
|
|
45
|
-
throw (0, getErrorMsg_1.getErrorMsg)(message, {
|
|
46
|
-
start: { line: token.line, col: token.col },
|
|
47
|
-
end: { line: token.line, col: token.col + token.value.length },
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
try {
|
|
51
|
-
// Make a parser and feed the input
|
|
52
|
-
ans = parser.feed(expression);
|
|
53
|
-
// Check if there are any results
|
|
54
|
-
if (ans.results.length) {
|
|
55
|
-
return {
|
|
56
|
-
result: ans.results[0],
|
|
57
|
-
errors: [],
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
// This means the input is incomplete.
|
|
62
|
-
const out = 'Error: incomplete input, parse failed. :(';
|
|
63
|
-
return {
|
|
64
|
-
result: out,
|
|
65
|
-
errors: [
|
|
66
|
-
{
|
|
67
|
-
message: 'Syntax error: Incomplete formula.',
|
|
68
|
-
severity: '8',
|
|
69
|
-
startLineNumber: ans.lexerState.line,
|
|
70
|
-
startColumn: ans.lexerState.col,
|
|
71
|
-
endLineNumber: ans.lexerState.line,
|
|
72
|
-
endColumn: ans.lexerState.col + 1,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
return {
|
|
80
|
-
result: e.message,
|
|
81
|
-
errors: [e],
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.default = UxfFormulaParser;
|
|
87
|
-
//# sourceMappingURL=parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/uxf/UxfFormulaParser/parser.ts"],"names":[],"mappings":";AAAA,6FAA6F;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7F;;GAEG;A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AC,IAAI;4BACpC,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG;4BAC/B,aAAa,EAAE,GAAG,CAAC,UAAU,CAAC,IAAI;4BAClC,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC;yBACpC;qBACJ;iBACJ,CAAA;YACL,CAAC;QACL,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,OAAO;gBACH,MAAM,EAAE,CAAC,CAAC,OAAO;gBACjB,MAAM,EAAE,CAAC,CAAC,CAAC;aACd,CAAA;QACL,CAAC;IACL,CAAC;CACJ;AAED,kBAAe,gBAAgB,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copied from https://code.devsnc.com/dev/uxf-formula-parser/blob/ci/master/src/utils/getErrorMsg.js
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getErrorMsg = void 0;
|
|
5
|
-
// function that generates an object with error information
|
|
6
|
-
const getErrorMsg = (message, span) => {
|
|
7
|
-
return {
|
|
8
|
-
message,
|
|
9
|
-
severity: '8',
|
|
10
|
-
startLineNumber: span.start.line,
|
|
11
|
-
startColumn: span.start.col,
|
|
12
|
-
endLineNumber: span.end.line,
|
|
13
|
-
endColumn: span.end.col,
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
exports.getErrorMsg = getErrorMsg;
|
|
17
|
-
//# sourceMappingURL=getErrorMsg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getErrorMsg.js","sourceRoot":"","sources":["../../../../src/uxf/UxfFormulaParser/utils/getErrorMsg.ts"],"names":[],"mappings":";AAAA,qGAAqG;;;AAErG,2DAA2D;AACpD,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;IACzC,OAAO;QACH,OAAO;QACP,QAAQ,EAAE,GAAG;QACb,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;QAChC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;QAC3B,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI;QAC5B,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG;KAC1B,CAAA;AACL,CAAC,CAAA;AATY,QAAA,WAAW,eASvB"}
|
package/dist/uxf/constants.d.ts
DELETED
package/dist/uxf/constants.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PARENT_APP_SHELL_ID = exports.WORKSPACE_APP_SHELL_ID = void 0;
|
|
4
|
-
// Workspace app shell ID
|
|
5
|
-
exports.WORKSPACE_APP_SHELL_ID = 'c276387cc331101080d6d3658940ddd2';
|
|
6
|
-
// Polaris app shell ID
|
|
7
|
-
exports.PARENT_APP_SHELL_ID = 'c86a62e2c7022010099a308dc7c26022';
|
|
8
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/uxf/constants.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACZ,QAAA,sBAAsB,GAAG,kCAAkC,CAAA;AACxE,uBAAuB;AACV,QAAA,mBAAmB,GAAG,kCAAkC,CAAA"}
|
package/dist/uxf/index.d.ts
DELETED
package/dist/uxf/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RoutesPlugin = exports.ExperiencePlugin = void 0;
|
|
7
|
-
var ExperiencePlugin_1 = require("./ExperiencePlugin");
|
|
8
|
-
Object.defineProperty(exports, "ExperiencePlugin", { enumerable: true, get: function () { return __importDefault(ExperiencePlugin_1).default; } });
|
|
9
|
-
var RoutesPlugin_1 = require("./RoutesPlugin");
|
|
10
|
-
Object.defineProperty(exports, "RoutesPlugin", { enumerable: true, get: function () { return __importDefault(RoutesPlugin_1).default; } });
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
package/dist/uxf/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/uxf/index.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgE;AAAvD,qIAAA,OAAO,OAAoB;AACpC,+CAAwD;AAA/C,6HAAA,OAAO,OAAgB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TODO: This functionality is copied pretty directly from @tectonic/metadata-transform-core,
|
|
3
|
-
* which implements an id generator. Unfortunately, we can't use it due to some
|
|
4
|
-
* code in Tectonic doing weird stuff with Yargs, which breaks our `fluent --help`
|
|
5
|
-
* command.
|
|
6
|
-
*
|
|
7
|
-
* If this file is deleted in favor of leveraging a dependency on Tectonic instead
|
|
8
|
-
* (which is a good idea), we need to fix the above issue first. Test that `fluent --help` works.
|
|
9
|
-
*
|
|
10
|
-
* STRY56098244
|
|
11
|
-
*/
|
|
12
|
-
export declare function idGenerator(componentTagName: string): any;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* TODO: This functionality is copied pretty directly from @tectonic/metadata-transform-core,
|
|
4
|
-
* which implements an id generator. Unfortunately, we can't use it due to some
|
|
5
|
-
* code in Tectonic doing weird stuff with Yargs, which breaks our `fluent --help`
|
|
6
|
-
* command.
|
|
7
|
-
*
|
|
8
|
-
* If this file is deleted in favor of leveraging a dependency on Tectonic instead
|
|
9
|
-
* (which is a good idea), we need to fix the above issue first. Test that `fluent --help` works.
|
|
10
|
-
*
|
|
11
|
-
* STRY56098244
|
|
12
|
-
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.idGenerator = idGenerator;
|
|
18
|
-
const md5_js_1 = __importDefault(require("md5.js"));
|
|
19
|
-
const lodash_1 = require("lodash");
|
|
20
|
-
const HASH_SEPARATOR = ':';
|
|
21
|
-
const ID_PREFIX = 'tectonic-mvp';
|
|
22
|
-
const hash = (parts) => {
|
|
23
|
-
const hash = new md5_js_1.default().update((0, lodash_1.join)(parts, HASH_SEPARATOR));
|
|
24
|
-
return hash.digest('hex');
|
|
25
|
-
};
|
|
26
|
-
const componentAliasTable = {
|
|
27
|
-
'now-alert': 'eds-alert',
|
|
28
|
-
'now-alert-list': 'eds-alert-list',
|
|
29
|
-
'now-avatar': 'eds-avatar',
|
|
30
|
-
'now-badge': 'eds-badge',
|
|
31
|
-
'now-button': 'eds-button',
|
|
32
|
-
'now-button-bare': 'eds-button-bare',
|
|
33
|
-
'now-button-iconic': 'eds-button-iconic',
|
|
34
|
-
'now-checkbox': 'sn-checkbox',
|
|
35
|
-
'now-collapse': 'eds-collapse',
|
|
36
|
-
'now-collapse-trigger': 'eds-collapse-trigger',
|
|
37
|
-
'now-content-tree': 'eds-content-tree',
|
|
38
|
-
'now-date-picker': 'sn-date',
|
|
39
|
-
'now-date-range-picker': 'now-date-range-picker',
|
|
40
|
-
'now-dropdown': 'eds-dropdown',
|
|
41
|
-
'now-dropdown-panel': 'eds-dropdown-panel',
|
|
42
|
-
'now-glide-field-lookup': 'glide-field-lookup',
|
|
43
|
-
'now-heading': 'eds-heading',
|
|
44
|
-
'now-highlighted-value': 'eds-highlighted-value',
|
|
45
|
-
'now-html-editor': 'sn-html-editor',
|
|
46
|
-
'now-icon': 'eds-icon',
|
|
47
|
-
'now-icon-presence': 'eds-icon-presence',
|
|
48
|
-
'now-ip-address': 'sn-glide-ip-address',
|
|
49
|
-
'now-label-value-inline': 'eds-label-value-inline',
|
|
50
|
-
'now-label-value-stacked': 'eds-label-value-stacked',
|
|
51
|
-
'now-label-value-tabbed': 'eds-label-value-tabbed',
|
|
52
|
-
'now-legacy-icon': 'eds-legacy-icon',
|
|
53
|
-
'now-loader': 'eds-loader',
|
|
54
|
-
'now-mini-calendar': 'sn-calendar',
|
|
55
|
-
'now-modal': 'eds-modal',
|
|
56
|
-
'now-multi-record-associator': 'sn-declarative-edit-action',
|
|
57
|
-
'now-number': 'glide-number',
|
|
58
|
-
'now-pill': 'eds-pill',
|
|
59
|
-
'now-radio': 'sn-radio',
|
|
60
|
-
'now-reference': 'sn-reference',
|
|
61
|
-
'now-split-button': 'eds-split-button',
|
|
62
|
-
'now-text-link': 'eds-text-link',
|
|
63
|
-
'now-toggle': 'eds-toggle',
|
|
64
|
-
'now-tooltip': 'eds-tooltip',
|
|
65
|
-
'now-list': 'sn-component-list',
|
|
66
|
-
'sn-workspace-list-menu': 'sn-component-workspace-list-menu',
|
|
67
|
-
'sn-workspace-list-module': 'sn-component-workspace-list-module',
|
|
68
|
-
'sn-glide-currency': 'glide-currency',
|
|
69
|
-
'sn-glide-email': 'glide-email',
|
|
70
|
-
'sn-glide-input': 'glide-input',
|
|
71
|
-
'sn-glide-phone': 'glide-phone',
|
|
72
|
-
'sn-glide-reference': 'glide-reference',
|
|
73
|
-
'sn-url': 'glide-url',
|
|
74
|
-
};
|
|
75
|
-
const resolveComponentName = (componentName) => componentAliasTable[componentName] || componentName;
|
|
76
|
-
function idGenerator(componentTagName) {
|
|
77
|
-
return hash([ID_PREFIX, resolveComponentName(componentTagName), 'macroponent']);
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=tectonicIdGenerator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tectonicIdGenerator.js","sourceRoot":"","sources":["../../src/uxf/tectonicIdGenerator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;AAiEH,kCAEC;AAjED,oDAAwB;AAC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AAW,EAAE,UAAU;IACvB,eAAe,EAAE,cAAc;IAC/B,kBAAkB,EAAE,kBAAkB;IACtC,eAAe,EAAE,eAAe;IAChC,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,UAAU,EAAE,mBAAmB;IAC/B,wBAAwB,EAAE,kCAAkC;IAC5D,0BAA0B,EAAE,oCAAoC;IAChE,mBAAmB,EAAE,gBAAgB;IACrC,gBAAgB,EAAE,aAAa;IAC/B,gBAAgB,EAAE,aAAa;IAC/B,gBAAgB,EAAE,aAAa;IAC/B,oBAAoB,EAAE,iBAAiB;IACvC,QAAQ,EAAE,WAAW;CACxB,CAAA;AAED,MAAM,oBAAoB,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC,mBAAmB,CAAC,aAAa,CAAC,IAAI,aAAa,CAAA;AAEnG,SAAgB,WAAW,CAAC,gBAAwB;IAChD,OAAO,IAAI,CAAC,CAAC,SAAS,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAA;AACnF,CAAC"}
|
package/src/AttachmentPlugin.ts
DELETED
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Plugin,
|
|
3
|
-
extractCallExpression,
|
|
4
|
-
generateCallExpression,
|
|
5
|
-
getSysUpdateName,
|
|
6
|
-
getCallExpressionName,
|
|
7
|
-
getOrCreateEntitySourceFile,
|
|
8
|
-
linkDocument,
|
|
9
|
-
recordXml,
|
|
10
|
-
removeNode,
|
|
11
|
-
transformFunctionArguments,
|
|
12
|
-
unloadBuilder,
|
|
13
|
-
} from '@servicenow/sdk-build-core'
|
|
14
|
-
import * as zlib from 'node:zlib'
|
|
15
|
-
import md5 from 'md5.js'
|
|
16
|
-
import { RecordXmlSchema } from './db/RecordPlugin'
|
|
17
|
-
import * as z from 'zod'
|
|
18
|
-
import { SysAttachment, SysAttachmentConfig } from '@servicenow/sdk-core/runtime/sys'
|
|
19
|
-
import { Diagnostic, FileSystem, path, ts } from '@servicenow/sdk-project'
|
|
20
|
-
|
|
21
|
-
export const AttachmentPlugin = Plugin({
|
|
22
|
-
name: 'Attachment',
|
|
23
|
-
ownedTables: {
|
|
24
|
-
sys_attachment: { diagnosticLevel: Diagnostic.Level.Warn },
|
|
25
|
-
},
|
|
26
|
-
extractors: {
|
|
27
|
-
entity: {
|
|
28
|
-
fluent: {
|
|
29
|
-
CallExpression: (node, context) => {
|
|
30
|
-
return extractCallExpression(
|
|
31
|
-
SysAttachment,
|
|
32
|
-
'attachment',
|
|
33
|
-
node,
|
|
34
|
-
context,
|
|
35
|
-
(attachment) => attachment.id
|
|
36
|
-
)
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
composers: {
|
|
43
|
-
entity: {
|
|
44
|
-
attachment(entity) {
|
|
45
|
-
return Promise.resolve({
|
|
46
|
-
kind: 'attachment',
|
|
47
|
-
node: entity.getNode(),
|
|
48
|
-
guid: entity.getGuid(),
|
|
49
|
-
data: entity.getValue() as SysAttachmentConfig,
|
|
50
|
-
})
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
xml: {
|
|
55
|
-
record(xml) {
|
|
56
|
-
const parseResult = AttachmentXmlSchema.safeParse(xml.data['record_update'])
|
|
57
|
-
if (!parseResult.success) {
|
|
58
|
-
return undefined
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const { sys_attachment, sys_attachment_doc } = parseResult.data
|
|
62
|
-
|
|
63
|
-
const data: AttachmentEntityData = {
|
|
64
|
-
attachment: sys_attachment,
|
|
65
|
-
attachmentDocs: Array.isArray(sys_attachment_doc) ? sys_attachment_doc : [sys_attachment_doc],
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
action: sys_attachment['@_action'],
|
|
70
|
-
kind: 'attachment',
|
|
71
|
-
guid: sys_attachment.sys_id,
|
|
72
|
-
data,
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
generators: {
|
|
79
|
-
attachment(document, context) {
|
|
80
|
-
return linkDocument(
|
|
81
|
-
document,
|
|
82
|
-
generateCallExpression(
|
|
83
|
-
context,
|
|
84
|
-
getOrCreateEntitySourceFile(context, getSysUpdateName(document, 'sys_attachment')),
|
|
85
|
-
'@servicenow/sdk/core',
|
|
86
|
-
SysAttachment,
|
|
87
|
-
{}
|
|
88
|
-
)
|
|
89
|
-
)
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
transformers: {
|
|
94
|
-
attachment: {
|
|
95
|
-
CallExpression(document, context) {
|
|
96
|
-
const expressionName = getCallExpressionName(document.node)
|
|
97
|
-
if (expressionName !== SysAttachment.name) {
|
|
98
|
-
return false
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (document.action === 'DELETE') {
|
|
102
|
-
removeNode(document.node)
|
|
103
|
-
return true
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (document.action !== 'INSERT_OR_UPDATE') {
|
|
107
|
-
return false
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const { attachment, attachmentDocs } = document.data as AttachmentEntityData
|
|
111
|
-
|
|
112
|
-
transformFunctionArguments(document.node, SysAttachment, {
|
|
113
|
-
id: document.guid,
|
|
114
|
-
fileName: attachment.file_name,
|
|
115
|
-
contentType: attachment.content_type,
|
|
116
|
-
filePath: `./${attachment.file_name}`,
|
|
117
|
-
tableName: attachment.table_name as SysAttachmentConfig['tableName'],
|
|
118
|
-
tableSysId: attachment.table_sys_id,
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Attachments are gzip compressed and base64 encoded into multiple sys_attachment_doc chunks
|
|
123
|
-
* Rebuild the archive and decompress it to disk
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
const dataBuffer = Buffer.alloc(attachment.size_compressed)
|
|
127
|
-
|
|
128
|
-
let position = 0
|
|
129
|
-
|
|
130
|
-
attachmentDocs
|
|
131
|
-
.sort((a, b) => a.position - b.position)
|
|
132
|
-
.forEach((doc) => {
|
|
133
|
-
position += dataBuffer.write(doc.data, position, 'base64')
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
const filePath = getSourceFileDirectory(document.node.getSourceFile())
|
|
137
|
-
|
|
138
|
-
if (!FileSystem.existsSync(context.fs, filePath)) {
|
|
139
|
-
context.fs.mkdirSync(filePath, { recursive: true })
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
context.fs.writeFileSync(path.join(filePath, attachment.file_name), zlib.gunzipSync(dataBuffer), {
|
|
143
|
-
encoding: 'binary',
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
return true
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
serializers: {
|
|
152
|
-
attachment(document, context) {
|
|
153
|
-
/**
|
|
154
|
-
<unload>
|
|
155
|
-
<sys_attachment/>
|
|
156
|
-
<sys_attachment_doc/>
|
|
157
|
-
<sys_attachment_doc/>
|
|
158
|
-
</unload>
|
|
159
|
-
*/
|
|
160
|
-
const data = document.data as SysAttachmentConfig
|
|
161
|
-
|
|
162
|
-
const xmlBuilder = unloadBuilder(context)
|
|
163
|
-
|
|
164
|
-
const CHUNK_SIZE = 4 * 1024
|
|
165
|
-
|
|
166
|
-
const attachmentEle = recordXml(xmlBuilder.xml, 'sys_attachment', document.guid)
|
|
167
|
-
attachmentEle.addSysScope(context)
|
|
168
|
-
attachmentEle.fields({
|
|
169
|
-
compressed: true,
|
|
170
|
-
content_type: data.contentType,
|
|
171
|
-
file_name: data.fileName,
|
|
172
|
-
table_name: data.tableName,
|
|
173
|
-
table_sys_id: data.tableSysId,
|
|
174
|
-
chunk_size: CHUNK_SIZE,
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
const directoryPath = getSourceFileDirectory(document.node!.getSourceFile())
|
|
178
|
-
const contentFilePath = path.join(directoryPath, data.filePath)
|
|
179
|
-
if (!FileSystem.existsSync(context.fs, contentFilePath)) {
|
|
180
|
-
throw new Error(`Attachment file not found for attachment ${document.guid}: ${contentFilePath}`)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Compress the file with gzip, then break into chuncks and base64 encode for each sys_attachment_doc
|
|
184
|
-
const hash = new md5()
|
|
185
|
-
|
|
186
|
-
const contents = context.fs.readFileSync(contentFilePath, { flag: 'r' })
|
|
187
|
-
|
|
188
|
-
attachmentEle.field('size_bites', contents.length)
|
|
189
|
-
|
|
190
|
-
const zipEncoded = zlib.gzipSync(contents)
|
|
191
|
-
attachmentEle.field('size_compressed', zipEncoded.length)
|
|
192
|
-
|
|
193
|
-
hash.update(zipEncoded)
|
|
194
|
-
attachmentEle.field('hash', hash.digest('hex'))
|
|
195
|
-
|
|
196
|
-
const dataArray = Uint8Array.from(zipEncoded)
|
|
197
|
-
|
|
198
|
-
let position = 0
|
|
199
|
-
let readOffset = position * CHUNK_SIZE
|
|
200
|
-
while (readOffset < dataArray.length) {
|
|
201
|
-
const dataChunk = dataArray.slice(readOffset, readOffset + CHUNK_SIZE)
|
|
202
|
-
|
|
203
|
-
const dataChunkBase64 = Buffer.from(dataChunk).toString('base64')
|
|
204
|
-
const attachmentDoc = recordXml(
|
|
205
|
-
xmlBuilder.xml,
|
|
206
|
-
'sys_attachment_doc',
|
|
207
|
-
context.keys.registerCompositeId('sys_attachment_doc', {
|
|
208
|
-
attachment: document.guid,
|
|
209
|
-
data: dataChunkBase64,
|
|
210
|
-
})
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
attachmentDoc.fields({
|
|
214
|
-
data: dataChunkBase64,
|
|
215
|
-
length: dataChunkBase64.length,
|
|
216
|
-
position,
|
|
217
|
-
sys_attachment: document.guid,
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
position++
|
|
221
|
-
|
|
222
|
-
readOffset = position * CHUNK_SIZE
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return {
|
|
226
|
-
name: `sys_attachment_${document.guid}.xml`,
|
|
227
|
-
directory: 'update',
|
|
228
|
-
content: xmlBuilder.end(),
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
})
|
|
233
|
-
|
|
234
|
-
function getSourceFileDirectory(sourceFile: ts.SourceFile): string {
|
|
235
|
-
const parsedPath = path.parse(sourceFile.getFilePath())
|
|
236
|
-
return parsedPath.dir
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const TextStringSchema = z.object({ '#text': z.string() }).transform((val) => val['#text'])
|
|
240
|
-
const TextIntSchema = z.object({ '#text': z.number() }).transform((val) => val['#text'])
|
|
241
|
-
|
|
242
|
-
const SysAttachmentSchema = RecordXmlSchema.extend({
|
|
243
|
-
sys_id: TextStringSchema,
|
|
244
|
-
content_type: TextStringSchema,
|
|
245
|
-
file_name: TextStringSchema,
|
|
246
|
-
hash: TextStringSchema,
|
|
247
|
-
table_name: TextStringSchema,
|
|
248
|
-
table_sys_id: TextStringSchema,
|
|
249
|
-
size_bytes: TextIntSchema,
|
|
250
|
-
size_compressed: TextIntSchema,
|
|
251
|
-
})
|
|
252
|
-
|
|
253
|
-
const SysAttachmentDocSchema = RecordXmlSchema.extend({
|
|
254
|
-
data: TextStringSchema,
|
|
255
|
-
length: TextIntSchema,
|
|
256
|
-
position: TextIntSchema,
|
|
257
|
-
sys_attachment: TextStringSchema,
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
const AttachmentXmlSchema = z.object({
|
|
261
|
-
sys_attachment: SysAttachmentSchema,
|
|
262
|
-
sys_attachment_doc: z.union([z.array(SysAttachmentDocSchema), SysAttachmentDocSchema]),
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
type AttachmentEntityData = {
|
|
266
|
-
attachment: z.infer<typeof SysAttachmentSchema>
|
|
267
|
-
attachmentDocs: Array<z.infer<typeof SysAttachmentDocSchema>>
|
|
268
|
-
}
|