@servicenow/sdk-build-plugins 3.0.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 -1628
- 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 -2070
- 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
package/dist/IncludePlugin.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ts } from '@servicenow/sdk-project';
|
|
2
|
-
import { FluentDiagnostic, StringData, Context } from '@servicenow/sdk-build-core';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
readonly name: "Include";
|
|
5
|
-
readonly extractors: {
|
|
6
|
-
readonly raw: {
|
|
7
|
-
readonly fluent: {
|
|
8
|
-
readonly CallExpression: (node: ts.CallExpression<ts.ts.CallExpression>, context: Context) => {
|
|
9
|
-
handled: false;
|
|
10
|
-
diagnostics?: never;
|
|
11
|
-
data?: never;
|
|
12
|
-
} | {
|
|
13
|
-
handled: true;
|
|
14
|
-
diagnostics: FluentDiagnostic[];
|
|
15
|
-
data: StringData<"">;
|
|
16
|
-
} | {
|
|
17
|
-
handled: true;
|
|
18
|
-
diagnostics: never[];
|
|
19
|
-
data: StringData<string>;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
readonly transformers: {
|
|
25
|
-
readonly record: {
|
|
26
|
-
readonly CallExpression: (document: import("@servicenow/sdk-build-core").Document<any, ts.CallExpression<ts.ts.CallExpression>> & {
|
|
27
|
-
entity?: import("@servicenow/sdk-build-core").EntityData;
|
|
28
|
-
node: ts.CallExpression<ts.ts.CallExpression>;
|
|
29
|
-
} & import("@servicenow/sdk-build-core").Arranged, context: Context) => false;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export default _default;
|
|
34
|
-
export declare function fieldHasNowIncludeCallExpression(objectLiteralExpression: ts.ObjectLiteralExpression, field: string): boolean;
|
package/dist/IncludePlugin.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fieldHasNowIncludeCallExpression = fieldHasNowIncludeCallExpression;
|
|
4
|
-
const sdk_project_1 = require("@servicenow/sdk-project");
|
|
5
|
-
const sdk_build_core_1 = require("@servicenow/sdk-build-core");
|
|
6
|
-
const sdk_project_2 = require("@servicenow/sdk-project");
|
|
7
|
-
const db_1 = require("@servicenow/sdk-core/runtime/db");
|
|
8
|
-
exports.default = (0, sdk_build_core_1.Plugin)({
|
|
9
|
-
name: 'Include',
|
|
10
|
-
extractors: {
|
|
11
|
-
raw: {
|
|
12
|
-
fluent: {
|
|
13
|
-
CallExpression(node, context) {
|
|
14
|
-
if (!(0, sdk_build_core_1.isNowIncludeCall)(node)) {
|
|
15
|
-
return { handled: false };
|
|
16
|
-
}
|
|
17
|
-
const args = node.getArguments();
|
|
18
|
-
const isStringLiteral = args[0]?.isKind(sdk_project_1.ts.SyntaxKind.StringLiteral);
|
|
19
|
-
if (args[0] && !isStringLiteral) {
|
|
20
|
-
return {
|
|
21
|
-
handled: true,
|
|
22
|
-
diagnostics: [new sdk_build_core_1.FluentDiagnostic(args[0], 'Invalid argument, String literal expected')],
|
|
23
|
-
data: new sdk_build_core_1.StringData('', node),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const filePath = args[0]?.asKind(sdk_project_1.ts.SyntaxKind.StringLiteral)?.getLiteralText();
|
|
27
|
-
if (!filePath) {
|
|
28
|
-
return {
|
|
29
|
-
handled: true,
|
|
30
|
-
diagnostics: [new sdk_build_core_1.FluentDiagnostic(args[0], 'File path cannot be empty')],
|
|
31
|
-
data: new sdk_build_core_1.StringData('', node),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const thisDir = sdk_project_2.path.dirname(node.getSourceFile().getFilePath());
|
|
35
|
-
const resolvedPath = sdk_project_2.path.resolve(thisDir, filePath);
|
|
36
|
-
if (!sdk_project_1.FileSystem.existsSync(context.fs, resolvedPath)) {
|
|
37
|
-
return {
|
|
38
|
-
handled: true,
|
|
39
|
-
diagnostics: [new sdk_build_core_1.FluentDiagnostic(args[0], 'File not found')],
|
|
40
|
-
data: new sdk_build_core_1.StringData('', node),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const rootDir = sdk_project_2.path.resolve(context.app.rootDir);
|
|
44
|
-
const relativePath = sdk_project_2.path.relative(rootDir, resolvedPath);
|
|
45
|
-
if (relativePath.startsWith('..')) {
|
|
46
|
-
return {
|
|
47
|
-
handled: true,
|
|
48
|
-
diagnostics: [new sdk_build_core_1.FluentDiagnostic(args[0], 'File not within project')],
|
|
49
|
-
data: new sdk_build_core_1.StringData('', node),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
handled: true,
|
|
54
|
-
diagnostics: [],
|
|
55
|
-
data: new sdk_build_core_1.StringData(context.fs.readFileSync(resolvedPath).toString(), node, {
|
|
56
|
-
needsCDATA: true,
|
|
57
|
-
}),
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
transformers: {
|
|
64
|
-
record: {
|
|
65
|
-
CallExpression(document, context) {
|
|
66
|
-
if (document.action === 'DELETE') {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
const { table } = document.data;
|
|
70
|
-
const [args] = document.node.getArguments();
|
|
71
|
-
if (!sdk_project_1.ts.Node.isObjectLiteralExpression(args)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
if (!document.changedData) {
|
|
75
|
-
// If we aren't changing anything, no need to update Now.include
|
|
76
|
-
// The root Plugin for the CallExpression should handle this
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
const fluentFilePath = document.node.getSourceFile().getDirectory().getPath();
|
|
80
|
-
args.getDescendantsOfKind(sdk_project_1.ts.SyntaxKind.CallExpression)
|
|
81
|
-
.filter(sdk_build_core_1.isNowIncludeCall)
|
|
82
|
-
.map((callExpression) => ({
|
|
83
|
-
field: callExpression.getParentIfKind(sdk_project_1.ts.SyntaxKind.PropertyAssignment)?.getName(),
|
|
84
|
-
path: callExpression?.getArguments()[0]?.asKind(sdk_project_1.ts.SyntaxKind.StringLiteral)?.getLiteralText(),
|
|
85
|
-
}))
|
|
86
|
-
.filter((includeData) => includeData.field && includeData.path)
|
|
87
|
-
.forEach((includeData) => {
|
|
88
|
-
const script = document.changedData.data?.[includeData.field];
|
|
89
|
-
if (script) {
|
|
90
|
-
const absolutePath = sdk_project_2.path.resolve(fluentFilePath, includeData.path);
|
|
91
|
-
writeScriptToFile(context.compiler, absolutePath, script);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
const includePaths = (0, sdk_build_core_1.getIncludePaths)(context);
|
|
95
|
-
// Only create a Now.include call on an initial fetch for certain tables
|
|
96
|
-
if (!includePaths[table]) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
let propertyObjectLiteral;
|
|
100
|
-
if ((0, sdk_build_core_1.getCallExpressionName)(document.node) !== db_1.Record.name) {
|
|
101
|
-
// Treat this as a root level property
|
|
102
|
-
propertyObjectLiteral = args;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
propertyObjectLiteral = (0, sdk_build_core_1.getOrCreatePropertyAssignment)(args, 'data', '{}').getInitializer();
|
|
106
|
-
}
|
|
107
|
-
const customIncludes = (0, sdk_build_core_1.calculateCustomPathsFromDocs)(context)[table]?.find((r) => r.guid === document.guid)?.fields || [];
|
|
108
|
-
const propertyAssignments = getScriptFieldPropertyAssignments(customIncludes.map((i) => i.field), propertyObjectLiteral);
|
|
109
|
-
for (const customInclude of customIncludes) {
|
|
110
|
-
const script = document.changedData.data?.[customInclude.field];
|
|
111
|
-
if (typeof script !== 'string') {
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
if (sdk_project_2.path.parse(customInclude.path).base !== customInclude.path) {
|
|
115
|
-
context.logger.error(`Custom include name for table ${table} and field ${customInclude.field} must be for filename only. Record ${document.guid}.`);
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const pa = propertyAssignments[customInclude.field];
|
|
119
|
-
if (!pa) {
|
|
120
|
-
const scriptFilePath = sdk_project_2.path.resolve(context.app.rootDir, context.app.config.generatedDir, customInclude.path);
|
|
121
|
-
const relativeScriptDir = sdk_project_2.path.relative(fluentFilePath, scriptFilePath);
|
|
122
|
-
(0, sdk_build_core_1.addCallExpressionToProperty)(propertyObjectLiteral, customInclude.field, `Now.include('${relativeScriptDir}')`);
|
|
123
|
-
writeScriptToFile(context.compiler, scriptFilePath, script);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return false;
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
function writeScriptToFile(compiler, scriptFilePath, script) {
|
|
132
|
-
const scriptDir = sdk_project_2.path.parse(scriptFilePath).dir;
|
|
133
|
-
if (!compiler.getDirectory(scriptDir)) {
|
|
134
|
-
compiler.addDirectoryAtPath(scriptDir, { recursive: true });
|
|
135
|
-
}
|
|
136
|
-
compiler.createSourceFile(scriptFilePath, script, {
|
|
137
|
-
overwrite: true,
|
|
138
|
-
scriptKind: sdk_project_1.FluentScriptKinds.IncludeFile,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
function getScriptFieldPropertyAssignments(fields, dataObjectLiteral) {
|
|
142
|
-
return fields
|
|
143
|
-
.map((field) => ({
|
|
144
|
-
[field]: dataObjectLiteral.getProperty(field)?.asKind(sdk_project_1.ts.SyntaxKind.PropertyAssignment),
|
|
145
|
-
}))
|
|
146
|
-
.reduce((acc, field) => ({ ...acc, ...field }), {});
|
|
147
|
-
}
|
|
148
|
-
function fieldHasNowIncludeCallExpression(objectLiteralExpression, field) {
|
|
149
|
-
const callExpression = objectLiteralExpression
|
|
150
|
-
.getProperty(field)
|
|
151
|
-
?.asKind(sdk_project_1.ts.SyntaxKind.PropertyAssignment)
|
|
152
|
-
?.getInitializerIfKind(sdk_project_1.ts.SyntaxKind.CallExpression);
|
|
153
|
-
return !!callExpression && (0, sdk_build_core_1.isNowIncludeCall)(callExpression);
|
|
154
|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ringData } from '@servicenow/sdk-build-core';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
readonly name: "JSON";
|
|
5
|
-
readonly extractors: {
|
|
6
|
-
readonly raw: {
|
|
7
|
-
readonly json: {
|
|
8
|
-
readonly SourceFile: (node: ts.SourceFile, context: import("@servicenow/sdk-build-core").Context) => import("@servicenow/sdk-build-core").ExtractionResult;
|
|
9
|
-
};
|
|
10
|
-
readonly fluent: {
|
|
11
|
-
readonly CallExpression: (node: ts.CallExpression<ts.ts.CallExpression>, context: import("@servicenow/sdk-build-core").Context) => {
|
|
12
|
-
handled: false;
|
|
13
|
-
diagnostics?: never;
|
|
14
|
-
data?: never;
|
|
15
|
-
} | {
|
|
16
|
-
handled: true;
|
|
17
|
-
diagnostics: FluentDiagnostic[];
|
|
18
|
-
data?: never;
|
|
19
|
-
} | {
|
|
20
|
-
handled: true;
|
|
21
|
-
diagnostics: FluentDiagnostic[];
|
|
22
|
-
data: StringData<string>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export default _default;
|
package/dist/JsonPlugin.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const sdk_project_1 = require("@servicenow/sdk-project");
|
|
4
|
-
const sdk_build_core_1 = require("@servicenow/sdk-build-core");
|
|
5
|
-
exports.default = (0, sdk_build_core_1.Plugin)({
|
|
6
|
-
name: 'JSON',
|
|
7
|
-
extractors: {
|
|
8
|
-
raw: {
|
|
9
|
-
json: {
|
|
10
|
-
SourceFile(node, context) {
|
|
11
|
-
const objectLiteral = node
|
|
12
|
-
.getFirstChildIfKind(sdk_project_1.ts.SyntaxKind.SyntaxList)
|
|
13
|
-
?.getFirstChildIfKind(sdk_project_1.ts.SyntaxKind.ExpressionStatement)
|
|
14
|
-
?.getFirstChildIfKind(sdk_project_1.ts.SyntaxKind.ObjectLiteralExpression);
|
|
15
|
-
return objectLiteral ? context.extractAst(objectLiteral) : { handled: false };
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
fluent: {
|
|
19
|
-
CallExpression(node, context) {
|
|
20
|
-
const expression = node.getExpressionIfKind(sdk_project_1.ts.SyntaxKind.PropertyAccessExpression);
|
|
21
|
-
if (!expression || expression.getText() !== 'JSON.stringify') {
|
|
22
|
-
return {
|
|
23
|
-
handled: false,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const argument = node.getArguments()[0];
|
|
27
|
-
if (!argument || !(0, sdk_project_1.isSupportedNode)(argument)) {
|
|
28
|
-
return {
|
|
29
|
-
handled: true,
|
|
30
|
-
diagnostics: [new sdk_build_core_1.FluentDiagnostic(node, 'JSON.stringify must have an argument')],
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const secondArgument = node.getArguments()[1];
|
|
34
|
-
if (secondArgument) {
|
|
35
|
-
return {
|
|
36
|
-
handled: true,
|
|
37
|
-
diagnostics: [
|
|
38
|
-
new sdk_build_core_1.FluentDiagnostic(secondArgument, 'Additional arguments to JSON.stringify are not supported'),
|
|
39
|
-
],
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const result = context.extractRaw(argument);
|
|
43
|
-
if (!result.handled) {
|
|
44
|
-
return {
|
|
45
|
-
handled: true,
|
|
46
|
-
diagnostics: [new sdk_build_core_1.FluentDiagnostic(argument, 'Unsupported JSON.stringify argument')],
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const data = result.data;
|
|
50
|
-
if (!sdk_build_core_1.Data.isObject(data)) {
|
|
51
|
-
return {
|
|
52
|
-
handled: true,
|
|
53
|
-
diagnostics: [
|
|
54
|
-
...result.diagnostics,
|
|
55
|
-
new sdk_build_core_1.FluentDiagnostic(argument, 'Unsupported JSON.stringify argument'),
|
|
56
|
-
],
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
handled: true,
|
|
61
|
-
diagnostics: result.diagnostics,
|
|
62
|
-
data: new sdk_build_core_1.StringData(JSON.stringify(data.getValue()), node),
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
//# sourceMappingURL=JsonPlugin.js.map
|
package/dist/JsonPlugin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonPlugin.js","sourceRoot":"","sources":["../src/JsonPlugin.ts"],"names":[],"mappings":";;AAAA,yDAA6D;AAC7D,+DAAuF;AAEvF,kBAAe,IAAA,uBAAM,EAAC;IAClB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE;QACR,GAAG,EAAE;YACD,IAAI,EAAE;gBACF,UAAU,CAAC,IAAI,EAAE,OAAO;oBACpB,MAAM,aAAa,GAAG,IAAI;yBACrB,mBAAmB,CAAC,gBAAE,CAAC,UAAU,CAAC,UAAU,CAAC;wBAC9C,EAAE,mBAAmB,CAAC,gBAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC;wBACxD,EAAE,mBAAmB,CAAC,gBAAE,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAA;oBAEhE,OAAO,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;gBACjF,CAAC;aACJ;YACD,MAAM,EAAE;gBACJ,cAAc,CAAC,IAAI,EAAE,OAAO;oBACxB,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAE,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAA;oBACnF,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,OAAO,EAAE,KAAK,gBAAgB,EAAE,CAAC;wBAC3D,OAAO;4BACH,OAAO,EAAE,KAAK;yBACjB,CAAA;oBACL,CAAC;oBAED,MAAM,QAAQ,GAAG,IAAI,CAA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AAI,CAAC;qBAC9D,CAAA;gBACL,CAAC;aACJ;SACJ;KACJ;CACJ,CAAC,CAAA"}
|
package/dist/ListPlugin.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { List } from '@servicenow/sdk-core/runtime/ui';
|
|
2
|
-
import { PrimitiveData, XmlData } from '@servicenow/sdk-build-core';
|
|
3
|
-
import { RecordXmlSchema } from './db/RecordPlugin';
|
|
4
|
-
import * as z from 'zod';
|
|
5
|
-
import { Diagnostic, ts } from '@servicenow/sdk-project';
|
|
6
|
-
type View = {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
title: string;
|
|
10
|
-
};
|
|
11
|
-
declare const _default: {
|
|
12
|
-
readonly name: "List";
|
|
13
|
-
readonly ownedTables: {
|
|
14
|
-
readonly sys_ui_list: {
|
|
15
|
-
readonly diagnosticLevel: Diagnostic.Level.Warn;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
readonly extractors: {
|
|
19
|
-
readonly entity: {
|
|
20
|
-
readonly fluent: {
|
|
21
|
-
readonly CallExpression: (node: ts.CallExpression<ts.ts.CallExpression>, context: import("@servicenow/sdk-build-core").Context) => import("@servicenow/sdk-build-core").ExtractionResult<import("@servicenow/sdk-build-core").EntityData<List<keyof Now.Internal.Tables>>>;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
readonly xml: (xml: import("@servicenow/sdk-build-core").Xml) => XmlData<{
|
|
25
|
-
updateName: any;
|
|
26
|
-
sys_id: any;
|
|
27
|
-
view: {
|
|
28
|
-
title: any;
|
|
29
|
-
name: any;
|
|
30
|
-
id: any;
|
|
31
|
-
};
|
|
32
|
-
elements: {}[];
|
|
33
|
-
table: any;
|
|
34
|
-
parent: any;
|
|
35
|
-
relationship: {
|
|
36
|
-
id: any;
|
|
37
|
-
name: any;
|
|
38
|
-
};
|
|
39
|
-
}> | undefined;
|
|
40
|
-
};
|
|
41
|
-
readonly composers: {
|
|
42
|
-
readonly entity: {
|
|
43
|
-
readonly list: (entity: import("@servicenow/sdk-build-core").EntityData<Record<string, unknown>>, context: import("@servicenow/sdk-build-core").Context) => Promise<{
|
|
44
|
-
kind: string;
|
|
45
|
-
node: ts.CallExpression<ts.ts.CallExpression> | ts.StringLiteral | ts.SourceFile | ts.TypeAliasDeclaration | ts.TypeReferenceNode | ts.TypeLiteralNode | ts.PropertySignature | ts.TupleTypeNode | ts.FunctionExpression | ts.FunctionDeclaration | ts.ArrayLiteralExpression | ts.NumericLiteral | ts.TrueLiteral | ts.FalseLiteral | ts.Identifier | ts.VariableDeclaration | ts.ClassDeclaration | ts.ExportDeclaration | ts.ObjectLiteralExpression | ts.AsExpression | ts.ComputedPropertyName | ts.PropertyAssignment | ts.ShorthandPropertyAssignment | ts.PropertyAccessExpression<ts.ts.PropertyAccessExpression> | ts.NoSubstitutionTemplateLiteral | ts.ExpressionStatement | ts.TaggedTemplateExpression | ts.ExportAssignment | ts.ElementAccessExpression<ts.ts.ElementAccessExpression> | ts.TemplateExpression | ts.ImportClause | ts.ImportSpecifier | ts.ImportDeclaration | ts.NamedImports | ts.VariableStatement | ts.VariableDeclarationList | ts.Node<ts.ts.PlusToken> | ts.Node<ts.ts.EndOfFileToken> | ts.Node<ts.ts.ExportKeyword> | ts.Node<ts.ts.KeywordTypeNode<ts.ts.SyntaxKind.AnyKeyword>> | ts.ModuleDeclaration | ts.ModuleBlock | ts.Block | ts.ParameterDeclaration | ts.Node<ts.ts.EqualsGreaterThanToken> | ts.ArrowFunction | ts.TemplateHead | ts.TemplateMiddle | ts.TemplateSpan | ts.TemplateTail | ts.PrefixUnaryExpression;
|
|
46
|
-
guid: string;
|
|
47
|
-
data: {
|
|
48
|
-
id: string;
|
|
49
|
-
table: string;
|
|
50
|
-
view: View;
|
|
51
|
-
elements: unknown[];
|
|
52
|
-
parent: string | undefined;
|
|
53
|
-
relationship: string;
|
|
54
|
-
};
|
|
55
|
-
}>;
|
|
56
|
-
};
|
|
57
|
-
readonly xml: {
|
|
58
|
-
readonly list: (xml: XmlData<PrimitiveData>) => {
|
|
59
|
-
action: import("@servicenow/sdk-build-core").Action;
|
|
60
|
-
kind: string;
|
|
61
|
-
guid: string;
|
|
62
|
-
data: {
|
|
63
|
-
id: string;
|
|
64
|
-
table: string;
|
|
65
|
-
view: View;
|
|
66
|
-
elements: SysUIListElementXml;
|
|
67
|
-
parent: string | number | boolean | PrimitiveData | PrimitiveData[] | undefined;
|
|
68
|
-
relationship: string | number | boolean | PrimitiveData | PrimitiveData[] | undefined;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
readonly transformers: {
|
|
74
|
-
readonly list: {
|
|
75
|
-
readonly CallExpression: (document: import("@servicenow/sdk-build-core").Document<any, ts.CallExpression<ts.ts.CallExpression>> & {
|
|
76
|
-
entity?: import("@servicenow/sdk-build-core").EntityData;
|
|
77
|
-
node: ts.CallExpression<ts.ts.CallExpression>;
|
|
78
|
-
} & import("@servicenow/sdk-build-core").Arranged, context: import("@servicenow/sdk-build-core").Context) => boolean;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
readonly generators: {
|
|
82
|
-
readonly list: (document: import("@servicenow/sdk-build-core").UnlinkedDocument<"list"> & import("@servicenow/sdk-build-core").Arranged, context: import("@servicenow/sdk-build-core").Context) => import("@servicenow/sdk-build-core").LinkedDocument<"list", ts.CallExpression<ts.ts.CallExpression>>;
|
|
83
|
-
};
|
|
84
|
-
readonly serializers: {
|
|
85
|
-
readonly list: (document: import("@servicenow/sdk-build-core").Document<string> & import("@servicenow/sdk-build-core").Arranged, context: import("@servicenow/sdk-build-core").Context) => {
|
|
86
|
-
name: `${string}.xml`;
|
|
87
|
-
directory: import("@servicenow/sdk-build-core").Directories;
|
|
88
|
-
content: string;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
export default _default;
|
|
93
|
-
type SysUIListElementXml = z.infer<typeof RecordXmlSchema>[];
|