@servicenow/sdk-build-plugins 3.0.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +37 -0
- package/dist/atf/step-configs.js +2236 -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 +591 -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 +157 -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 +2284 -0
- package/src/atf/test-plugin.ts +728 -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 +170 -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 +651 -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,257 +0,0 @@
|
|
|
1
|
-
import { ClientScript } from '@servicenow/sdk-core/runtime/clientscript'
|
|
2
|
-
import {
|
|
3
|
-
Context,
|
|
4
|
-
Plugin,
|
|
5
|
-
extractCallExpression,
|
|
6
|
-
getCallExpressionName,
|
|
7
|
-
removeNode,
|
|
8
|
-
getOrCreateEntitySourceFile,
|
|
9
|
-
generateCallExpressionExportForDocument,
|
|
10
|
-
linkDocument,
|
|
11
|
-
mergeDataIntoObjectLiteral,
|
|
12
|
-
writeCustomProperty,
|
|
13
|
-
stringify,
|
|
14
|
-
getSysUpdateName,
|
|
15
|
-
FluentDiagnostic,
|
|
16
|
-
EntityData,
|
|
17
|
-
ObjectData,
|
|
18
|
-
transformCustomizedProperties,
|
|
19
|
-
} from '@servicenow/sdk-build-core'
|
|
20
|
-
import { Record } from '@servicenow/sdk-core/runtime/db'
|
|
21
|
-
import { ClientScriptSchema } from '@servicenow/sdk-core/runtime/clientscript'
|
|
22
|
-
import { z } from 'zod'
|
|
23
|
-
import { ts } from '@servicenow/sdk-project'
|
|
24
|
-
import { processScript } from '../ScriptTemplatePlugin'
|
|
25
|
-
import { Diagnostic } from '@servicenow/sdk-project'
|
|
26
|
-
import { except } from './scriptUtils'
|
|
27
|
-
import { additionalProperties } from '@servicenow/sdk-core/runtime/util'
|
|
28
|
-
|
|
29
|
-
const UITypeMapping = {
|
|
30
|
-
desktop: 0,
|
|
31
|
-
mobile_or_service_portal: 1,
|
|
32
|
-
all: 10,
|
|
33
|
-
}
|
|
34
|
-
const ClientScriptXmlSchema = ClientScriptSchema.extend({
|
|
35
|
-
table: z.string(),
|
|
36
|
-
ui_type: z.union([z.literal(0), z.literal(1), z.literal(10)]),
|
|
37
|
-
sys_class_name: z.literal('sys_script_client'),
|
|
38
|
-
})
|
|
39
|
-
const PartialClientScriptXMLSchema = ClientScriptXmlSchema.partial()
|
|
40
|
-
|
|
41
|
-
type ClientScriptSchema = z.infer<typeof ClientScriptSchema>
|
|
42
|
-
type PatialClientScriptConfig = z.infer<typeof PartialClientScriptXMLSchema>
|
|
43
|
-
|
|
44
|
-
export default Plugin({
|
|
45
|
-
name: 'ClientScript',
|
|
46
|
-
ownedTables: {
|
|
47
|
-
sys_script_client: { diagnosticLevel: Diagnostic.Level.Warn },
|
|
48
|
-
},
|
|
49
|
-
extractors: {
|
|
50
|
-
entity: {
|
|
51
|
-
fluent: {
|
|
52
|
-
CallExpression: (node, context) => {
|
|
53
|
-
const result = extractCallExpression(ClientScript, 'clientScript', node, context, (script) =>
|
|
54
|
-
context.registerExplicitId('sys_script_client', script.$id as string)
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
if (!result.handled || !result.data) {
|
|
58
|
-
return result
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const clientScriptEntityData = result.data
|
|
62
|
-
const args = node.getArguments()[0] as ts.ObjectLiteralExpression
|
|
63
|
-
|
|
64
|
-
if (!args) {
|
|
65
|
-
result.diagnostics.push(new FluentDiagnostic(node, 'Client script arguments are missing'))
|
|
66
|
-
return result
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const diagnostics = result.diagnostics
|
|
70
|
-
const data = ClientScriptSchema.and(z.any()).parse(clientScriptEntityData.getValue())
|
|
71
|
-
const { script, type, field } = data
|
|
72
|
-
|
|
73
|
-
if (field && !type) {
|
|
74
|
-
diagnostics.push(
|
|
75
|
-
new FluentDiagnostic(
|
|
76
|
-
args.getProperty('field')!,
|
|
77
|
-
`Field values are allowed only when type is set to onChange or onCellEdit`
|
|
78
|
-
)
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (script && !validateClientSideScripts(script, context)) {
|
|
83
|
-
diagnostics.push(
|
|
84
|
-
new FluentDiagnostic(
|
|
85
|
-
args.getProperty('script')!,
|
|
86
|
-
`Client side scripts cannot import or require modules.`
|
|
87
|
-
)
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Removing this diagnostic : Currently on instance if you empty script field and click update, it would show basic template set
|
|
93
|
-
* for the field but the xml is not updated. Only after saving it again the xml gets updated with basic template.
|
|
94
|
-
*/
|
|
95
|
-
// if (type && !script) {
|
|
96
|
-
// diagnostics.push(
|
|
97
|
-
// new FluentDiagnostic(
|
|
98
|
-
// args.getProperty('type')!,
|
|
99
|
-
// `Cannot have empty script value for type: ${type}`
|
|
100
|
-
// )
|
|
101
|
-
// )
|
|
102
|
-
// }
|
|
103
|
-
|
|
104
|
-
const record = createClientScriptRecord(data, script)
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
handled: true,
|
|
108
|
-
diagnostics,
|
|
109
|
-
data: new EntityData(
|
|
110
|
-
'record',
|
|
111
|
-
clientScriptEntityData.getGuid(),
|
|
112
|
-
ObjectData.fromObjectValue(record, node),
|
|
113
|
-
node,
|
|
114
|
-
clientScriptEntityData.getInstallMethod(),
|
|
115
|
-
clientScriptEntityData.getExplicitIds()
|
|
116
|
-
),
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
generators: {
|
|
124
|
-
record(document, context) {
|
|
125
|
-
const tableName = document.data!['table']
|
|
126
|
-
if (tableName !== 'sys_script_client') {
|
|
127
|
-
return undefined
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return linkDocument(
|
|
131
|
-
document,
|
|
132
|
-
generateCallExpressionExportForDocument(
|
|
133
|
-
context,
|
|
134
|
-
{
|
|
135
|
-
sourceFile: getOrCreateEntitySourceFile(
|
|
136
|
-
context,
|
|
137
|
-
getSysUpdateName(document, 'sys_script_client')
|
|
138
|
-
),
|
|
139
|
-
moduleSpecifier: '@servicenow/sdk/core',
|
|
140
|
-
},
|
|
141
|
-
ClientScript,
|
|
142
|
-
{
|
|
143
|
-
$id: document.guid,
|
|
144
|
-
}
|
|
145
|
-
).getExpressionIfKindOrThrow(ts.SyntaxKind.CallExpression)
|
|
146
|
-
)
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
transformers: {
|
|
151
|
-
record: {
|
|
152
|
-
CallExpression(document) {
|
|
153
|
-
if (getCallExpressionName(document.node) !== ClientScript.name) {
|
|
154
|
-
return false
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (document.action === 'DELETE') {
|
|
158
|
-
removeNode(document.node)
|
|
159
|
-
return true
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const modifiedClientScriptProps = ClientScriptXmlSchema.partial().safeParse(
|
|
163
|
-
(document.changedData as any).data
|
|
164
|
-
)
|
|
165
|
-
|
|
166
|
-
if (!modifiedClientScriptProps.success) {
|
|
167
|
-
return false
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
transformCustomizedProperties(
|
|
171
|
-
ClientScript,
|
|
172
|
-
document.node,
|
|
173
|
-
(document.changedData as any).data,
|
|
174
|
-
modifiedClientScriptProps.data
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
return transformClientScriptArguments(
|
|
178
|
-
document.node,
|
|
179
|
-
except(modifiedClientScriptProps.data, (key) => key === 'sys_class_name')
|
|
180
|
-
)
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
function validateClientSideScripts(script: string, context: Context) {
|
|
187
|
-
const source = context.compiler.createSourceFile('tmp-file.ts', script)
|
|
188
|
-
const importDeclarations = source.getDescendantsOfKind(ts.SyntaxKind.ImportDeclaration)
|
|
189
|
-
const requireCalls = source.getDescendantsOfKind(ts.SyntaxKind.CallExpression).filter((callExpression) => {
|
|
190
|
-
return isRequire(callExpression)
|
|
191
|
-
})
|
|
192
|
-
const isValid = !(importDeclarations.length > 0 || requireCalls.length > 0)
|
|
193
|
-
context.compiler.removeSourceFile(source)
|
|
194
|
-
return isValid
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function getUITypeFromId(id: number) {
|
|
198
|
-
const type = Object.keys(UITypeMapping).find((e) => UITypeMapping[e] === id)
|
|
199
|
-
if (!type) {
|
|
200
|
-
throw Error('Invalid UI Type encountered, check XML data before transforming again.')
|
|
201
|
-
}
|
|
202
|
-
return type
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function transformClientScriptArguments(node: ts.CallExpression, data: PatialClientScriptConfig) {
|
|
206
|
-
const argNode = node.getArguments()[0]!.asKindOrThrow(ts.SyntaxKind.ObjectLiteralExpression)
|
|
207
|
-
const { script, table, ui_type, type, ...rest } = data
|
|
208
|
-
|
|
209
|
-
if (type !== undefined) {
|
|
210
|
-
if (type) {
|
|
211
|
-
writeCustomProperty(argNode, 'type', '', stringify(type))
|
|
212
|
-
} else {
|
|
213
|
-
argNode.getProperty('type')?.remove()
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (Object.values(UITypeMapping).some((value) => value === ui_type)) {
|
|
218
|
-
const uiType = getUITypeFromId(ui_type!)
|
|
219
|
-
writeCustomProperty(argNode, 'ui_type', '', stringify(uiType))
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (table) {
|
|
223
|
-
writeCustomProperty(argNode, 'table', '{}', stringify(table))
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (script !== undefined) {
|
|
227
|
-
processScript(argNode, 'script', script)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
mergeDataIntoObjectLiteral(argNode, rest)
|
|
231
|
-
|
|
232
|
-
return true
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function createClientScriptRecord(data: ClientScriptSchema, script: string) {
|
|
236
|
-
data.script = script as any
|
|
237
|
-
const { $id, ...csData } = ClientScriptSchema.parse(data)
|
|
238
|
-
const rest = additionalProperties(data, ClientScriptSchema)
|
|
239
|
-
csData.ui_type = getUITypeId(csData.ui_type)
|
|
240
|
-
return Record({
|
|
241
|
-
table: 'sys_script_client',
|
|
242
|
-
$id,
|
|
243
|
-
data: { ...(csData as any), ...rest },
|
|
244
|
-
})
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function getUITypeId(value: string) {
|
|
248
|
-
if (value in UITypeMapping) {
|
|
249
|
-
return UITypeMapping[value]
|
|
250
|
-
}
|
|
251
|
-
throw Error('Invalid ui_type found in xml')
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function isRequire(callExpression: ts.CallExpression): boolean {
|
|
255
|
-
const expression = callExpression.getExpression()
|
|
256
|
-
return ts.Node.isIdentifier(expression) && expression.getText() === 'require'
|
|
257
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Experience, ExperienceSchema } from '@servicenow/sdk-core/runtime/experience'
|
|
2
|
-
import { Record } from '@servicenow/sdk-core/runtime/db'
|
|
3
|
-
import { Plugin, extractCallExpression } from '@servicenow/sdk-build-core'
|
|
4
|
-
import { PARENT_APP_SHELL_ID, WORKSPACE_APP_SHELL_ID } from './constants'
|
|
5
|
-
|
|
6
|
-
export default Plugin({
|
|
7
|
-
name: 'Experience',
|
|
8
|
-
ownedTables: {
|
|
9
|
-
//TODO:: Uncomment below config once we start supporting Experience plugin.
|
|
10
|
-
//sys_ux_app_config: { diagnosticLevel: Diagnostic.Level.Warn },
|
|
11
|
-
},
|
|
12
|
-
extractors: {
|
|
13
|
-
entity: {
|
|
14
|
-
fluent: {
|
|
15
|
-
CallExpression: (node, context) =>
|
|
16
|
-
extractCallExpression(Experience, 'experience', node, context, (experience) =>
|
|
17
|
-
context.registerExplicitId('sys_ux_app_config', experience.$id as string)
|
|
18
|
-
),
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
composers: {
|
|
23
|
-
entity: {
|
|
24
|
-
experience(entity, context) {
|
|
25
|
-
const node = entity.getNode()
|
|
26
|
-
const data = entity.getValue()
|
|
27
|
-
const guid = entity.getGuid()
|
|
28
|
-
const recordData = ExperienceSchema.parse(data)
|
|
29
|
-
|
|
30
|
-
const appConfig = Record({
|
|
31
|
-
table: 'sys_ux_app_config',
|
|
32
|
-
$id: guid,
|
|
33
|
-
data: {
|
|
34
|
-
name: recordData.name,
|
|
35
|
-
active: recordData.active,
|
|
36
|
-
base_url_path: recordData.baseUrlPath,
|
|
37
|
-
landing_path: recordData.landingPath,
|
|
38
|
-
description: recordData.description,
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
const pageRegistry = Record({
|
|
43
|
-
table: 'sys_ux_page_registry',
|
|
44
|
-
$id: context.registerExplicitId('sys_ux_page_registry', `${guid}_registry`),
|
|
45
|
-
data: {
|
|
46
|
-
title: recordData.name,
|
|
47
|
-
active: recordData.active,
|
|
48
|
-
admin_panel: appConfig.$id as any,
|
|
49
|
-
admin_panel_table: 'sys_ux_app_config',
|
|
50
|
-
parent_app: PARENT_APP_SHELL_ID,
|
|
51
|
-
path: recordData.baseUrlPath,
|
|
52
|
-
root_macroponent: WORKSPACE_APP_SHELL_ID,
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
return Promise.resolve(
|
|
57
|
-
[appConfig, pageRegistry].map((r) => ({
|
|
58
|
-
kind: 'record',
|
|
59
|
-
guid: r.$id,
|
|
60
|
-
node,
|
|
61
|
-
data: r,
|
|
62
|
-
}))
|
|
63
|
-
)
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
})
|
package/src/uxf/RoutesPlugin.ts
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { BaseUXRouteSchema, ExperienceSchema, Routes } from '@servicenow/sdk-core/runtime/experience'
|
|
2
|
-
import { Record } from '@servicenow/sdk-core/runtime/db'
|
|
3
|
-
import { Plugin, extractCallExpression } from '@servicenow/sdk-build-core'
|
|
4
|
-
import { parser as uxValueParser, cleanUxValue } from './UxfFormulaParser'
|
|
5
|
-
import { idGenerator } from './tectonicIdGenerator'
|
|
6
|
-
import { WORKSPACE_APP_SHELL_ID } from './constants'
|
|
7
|
-
import { Diagnostic } from '@servicenow/sdk-project'
|
|
8
|
-
|
|
9
|
-
const PAGE_TEMPLATE_SYS_ID = '19be392623033300f4b4c50947bf65ba'
|
|
10
|
-
type Component = Routes['routes'][string]['component']
|
|
11
|
-
|
|
12
|
-
type RouteParts = {
|
|
13
|
-
pathname: string
|
|
14
|
-
parameters: {
|
|
15
|
-
required: string[]
|
|
16
|
-
optional: string[]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function getRouteParts(route: string): RouteParts {
|
|
21
|
-
const chunks = route.split('/').filter((chunk) => chunk && chunk.length > 0)
|
|
22
|
-
if (chunks.length === 0) {
|
|
23
|
-
throw new Error('Invalid route - routes may not be empty')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const parts: RouteParts = {
|
|
27
|
-
pathname: chunks[0] || '',
|
|
28
|
-
parameters: {
|
|
29
|
-
required: [],
|
|
30
|
-
optional: [],
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
chunks.forEach((part) => {
|
|
35
|
-
if (part.startsWith(':')) {
|
|
36
|
-
if (part.endsWith('?')) {
|
|
37
|
-
parts.parameters.optional.push(part.slice(1, -1))
|
|
38
|
-
} else {
|
|
39
|
-
parts.parameters.required.push(part.slice(1))
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
return parts
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const HARDCODED_LAYOUT = {
|
|
48
|
-
default: {
|
|
49
|
-
children: null,
|
|
50
|
-
items: [{ element_id: 'x', styles: {} }],
|
|
51
|
-
root: null,
|
|
52
|
-
rules: null,
|
|
53
|
-
styles: { 'flex-direction': 'column' },
|
|
54
|
-
templateId: '5832fd4d53c31010e6bcddeeff7b12db',
|
|
55
|
-
type: 'flex',
|
|
56
|
-
},
|
|
57
|
-
version: '3.0.0',
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const createComposition = (component: Component) => {
|
|
61
|
-
const { tagName, properties = {} } = component
|
|
62
|
-
const componentId = idGenerator(tagName)
|
|
63
|
-
|
|
64
|
-
const UxfFormulaParser = new uxValueParser()
|
|
65
|
-
const propertyValues = Object.keys(properties).reduce((newObj, key) => {
|
|
66
|
-
const parseResult = UxfFormulaParser.parse(properties[key])
|
|
67
|
-
if (parseResult.errors.length) {
|
|
68
|
-
throw new Error('Failed to parse formula.')
|
|
69
|
-
}
|
|
70
|
-
newObj[key] = cleanUxValue(parseResult.result.uxValue)
|
|
71
|
-
return newObj
|
|
72
|
-
}, {})
|
|
73
|
-
|
|
74
|
-
return [
|
|
75
|
-
{
|
|
76
|
-
definition: { id: componentId, type: 'MACROPONENT' },
|
|
77
|
-
elementId: 'x',
|
|
78
|
-
elementLabel: tagName,
|
|
79
|
-
eventMappings: [],
|
|
80
|
-
isHidden: { type: 'JSON_LITERAL', value: null },
|
|
81
|
-
preset: null,
|
|
82
|
-
propertyValues,
|
|
83
|
-
slot: null,
|
|
84
|
-
styles: null,
|
|
85
|
-
},
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export default Plugin({
|
|
90
|
-
name: 'Routes',
|
|
91
|
-
ownedTables: {
|
|
92
|
-
sys_ux_app_route: { diagnosticLevel: Diagnostic.Level.Warn },
|
|
93
|
-
},
|
|
94
|
-
extractors: {
|
|
95
|
-
entity: {
|
|
96
|
-
fluent: {
|
|
97
|
-
// TODO: This needs to extract separate entities for each route and the experience. Currently it is extracting an
|
|
98
|
-
// anonymous "container" entity which goes against the design of the plugin architecture.
|
|
99
|
-
CallExpression: (node, context) =>
|
|
100
|
-
extractCallExpression(Routes, 'routes', node, context, () => 'NO_GUID_GENERATED'), // TODO: Generate GUID
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
composers: {
|
|
105
|
-
entity: {
|
|
106
|
-
routes(entity, context) {
|
|
107
|
-
const node = entity.getNode()
|
|
108
|
-
const experience = entity.getPropertyOrThrow('experience').getValue() as Routes['experience']
|
|
109
|
-
const routes = entity.getPropertyOrThrow('routes').getValue() as Routes['routes']
|
|
110
|
-
|
|
111
|
-
const { $id: appConfigId } = ExperienceSchema.parse(experience)
|
|
112
|
-
const appConfigSysId = context.registerExplicitId('sys_ux_app_config', appConfigId)
|
|
113
|
-
|
|
114
|
-
const records: Record[] = []
|
|
115
|
-
for (const [path, route] of Object.entries(routes)) {
|
|
116
|
-
const { $id: routeId, name, component, active, description } = BaseUXRouteSchema.parse(route)
|
|
117
|
-
const routeParts = getRouteParts(path)
|
|
118
|
-
|
|
119
|
-
const screenType = Record({
|
|
120
|
-
table: 'sys_ux_screen_type',
|
|
121
|
-
$id: context.registerExplicitId('sys_ux_screen_type', `${routeId}_screen_type`),
|
|
122
|
-
data: {
|
|
123
|
-
name,
|
|
124
|
-
},
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
const routeRecord = Record({
|
|
128
|
-
table: 'sys_ux_app_route',
|
|
129
|
-
$id: context.registerExplicitId('sys_ux_app_route', routeId),
|
|
130
|
-
data: {
|
|
131
|
-
name,
|
|
132
|
-
app_config: appConfigSysId,
|
|
133
|
-
route_type: routeParts.pathname,
|
|
134
|
-
fields: routeParts.parameters.required.join(','),
|
|
135
|
-
optional_parameters: routeParts.parameters.optional.join(','),
|
|
136
|
-
screen_type: screenType.$id,
|
|
137
|
-
},
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
const routeParameters = [...routeParts.parameters.required, ...routeParts.parameters.optional]
|
|
141
|
-
const screenMcp = Record({
|
|
142
|
-
table: 'sys_ux_macroponent',
|
|
143
|
-
$id: context.registerExplicitId('sys_ux_macroponent', `${routeId}_page`),
|
|
144
|
-
data: {
|
|
145
|
-
category: 'page',
|
|
146
|
-
composition: JSON.stringify(createComposition(component), null, 2),
|
|
147
|
-
extends: PAGE_TEMPLATE_SYS_ID,
|
|
148
|
-
internal_event_mappings: JSON.stringify({}),
|
|
149
|
-
layout: JSON.stringify(HARDCODED_LAYOUT, null, 2),
|
|
150
|
-
name: `${name} - Page`,
|
|
151
|
-
// Injecting Route parameters as props of the page, so that they can be passed into the
|
|
152
|
-
// component in the composition.
|
|
153
|
-
props: JSON.stringify(
|
|
154
|
-
routeParameters.map((param) => {
|
|
155
|
-
return {
|
|
156
|
-
defaultValue: '',
|
|
157
|
-
description: null,
|
|
158
|
-
disabled: false,
|
|
159
|
-
fieldType: 'string',
|
|
160
|
-
label: param,
|
|
161
|
-
mandatory: false,
|
|
162
|
-
name: param,
|
|
163
|
-
readOnly: true,
|
|
164
|
-
selectable: false,
|
|
165
|
-
typeMetadata: null,
|
|
166
|
-
valueType: 'string',
|
|
167
|
-
}
|
|
168
|
-
}),
|
|
169
|
-
null,
|
|
170
|
-
2
|
|
171
|
-
),
|
|
172
|
-
schema_version: '1.0.0',
|
|
173
|
-
},
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
// TODO(patrick): Still a lot of hardcoded stuff in here - needs
|
|
177
|
-
// to be represented in the config, at least optionally.
|
|
178
|
-
const screen = Record({
|
|
179
|
-
table: 'sys_ux_screen',
|
|
180
|
-
$id: context.registerExplicitId('sys_ux_screen', `${routeId}_screen`),
|
|
181
|
-
data: {
|
|
182
|
-
active: active!,
|
|
183
|
-
app_config: appConfigSysId,
|
|
184
|
-
description: description!,
|
|
185
|
-
disable_auto_reflow: false,
|
|
186
|
-
event_mappings: JSON.stringify([]),
|
|
187
|
-
macroponent: screenMcp.$id,
|
|
188
|
-
macroponent_config: JSON.stringify({}),
|
|
189
|
-
name: `${name} - Default`,
|
|
190
|
-
order: 0,
|
|
191
|
-
parent_macroponent: WORKSPACE_APP_SHELL_ID,
|
|
192
|
-
required_translations: JSON.stringify([]),
|
|
193
|
-
screen_type: screenType.$id,
|
|
194
|
-
},
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
records.push(screenType, routeRecord, screenMcp, screen)
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return Promise.resolve(
|
|
201
|
-
records.map((r) => ({
|
|
202
|
-
kind: 'record',
|
|
203
|
-
guid: r.$id as string,
|
|
204
|
-
node,
|
|
205
|
-
data: r,
|
|
206
|
-
}))
|
|
207
|
-
)
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
})
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Copied from sn-uxf-formula-parser-library - https://code.devsnc.com/dev/uxf-formula-parser
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* https://code.devsnc.com/dev/uxf-formula-parser/blob/ci/master/src/uxf-formula-parser/clean/cleanUxValue.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const cleanUxValue = (uxValue) => {
|
|
8
|
-
switch (uxValue?.type) {
|
|
9
|
-
case 'JSON_LITERAL':
|
|
10
|
-
return { type: uxValue.type, value: uxValue.value }
|
|
11
|
-
|
|
12
|
-
case 'CONTEXT_BINDING':
|
|
13
|
-
case 'DATA_OUTPUT_BINDING':
|
|
14
|
-
case 'STATE_BINDING':
|
|
15
|
-
case 'EVENT_PAYLOAD_BINDING':
|
|
16
|
-
case 'ELEMENT_BINDING':
|
|
17
|
-
case 'REPEATER_ITEM_BINDING':
|
|
18
|
-
case 'ENV_BINDING':
|
|
19
|
-
return { type: uxValue.type, binding: uxValue.binding }
|
|
20
|
-
|
|
21
|
-
case 'CLIENT_TRANSFORM':
|
|
22
|
-
return {
|
|
23
|
-
type: uxValue.type,
|
|
24
|
-
transform: {
|
|
25
|
-
operator: uxValue.transform.operator,
|
|
26
|
-
operands: cleanUxValue(uxValue.transform.operands),
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
case 'UNARY':
|
|
31
|
-
return {
|
|
32
|
-
type: uxValue.type,
|
|
33
|
-
operation: {
|
|
34
|
-
...uxValue.operation,
|
|
35
|
-
operand: cleanUxValue(uxValue.operation.operand),
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
case 'BINARY':
|
|
40
|
-
return {
|
|
41
|
-
type: uxValue.type,
|
|
42
|
-
operation: {
|
|
43
|
-
...uxValue.operation,
|
|
44
|
-
operator: uxValue.operation.operator,
|
|
45
|
-
left: cleanUxValue(uxValue.operation.left),
|
|
46
|
-
right: cleanUxValue(uxValue.operation.right),
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
case 'LIST_CONTAINER':
|
|
51
|
-
return {
|
|
52
|
-
type: uxValue.type,
|
|
53
|
-
container: uxValue.container.map((item) => cleanUxValue(item)),
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
case 'MAP_CONTAINER':
|
|
57
|
-
return {
|
|
58
|
-
type: uxValue.type,
|
|
59
|
-
container: Object.entries(uxValue.container).reduce(
|
|
60
|
-
(acc, [key, item]) => ({
|
|
61
|
-
...acc,
|
|
62
|
-
[key]: cleanUxValue(item),
|
|
63
|
-
}),
|
|
64
|
-
{}
|
|
65
|
-
),
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
case 'TRANSLATION_LITERAL':
|
|
69
|
-
return { type: uxValue.type, value: uxValue.value }
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return uxValue
|
|
73
|
-
}
|