@servicenow/sdk-build-plugins 4.2.0 → 4.4.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.js +11 -0
- package/dist/acl-plugin.js.map +1 -1
- package/dist/applicability-plugin.d.ts +2 -0
- package/dist/applicability-plugin.js +72 -0
- package/dist/applicability-plugin.js.map +1 -0
- package/dist/atf/test-plugin.js +5 -2
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +7 -1
- package/dist/basic-syntax-plugin.js.map +1 -1
- package/dist/business-rule-plugin.js +1 -0
- package/dist/business-rule-plugin.js.map +1 -1
- package/dist/call-expression-plugin.js +1 -107
- package/dist/call-expression-plugin.js.map +1 -1
- package/dist/column/column-to-record.d.ts +10 -3
- package/dist/column/column-to-record.js +44 -7
- package/dist/column/column-to-record.js.map +1 -1
- package/dist/column-plugin.d.ts +3 -1
- package/dist/column-plugin.js +12 -12
- package/dist/column-plugin.js.map +1 -1
- package/dist/dashboard/dashboard-component-property-defaults.d.ts +152 -0
- package/dist/dashboard/dashboard-component-property-defaults.js +264 -0
- package/dist/dashboard/dashboard-component-property-defaults.js.map +1 -0
- package/dist/dashboard/dashboard-component-resolver.d.ts +13 -0
- package/dist/dashboard/dashboard-component-resolver.js +69 -0
- package/dist/dashboard/dashboard-component-resolver.js.map +1 -0
- package/dist/dashboard/dashboard-plugin.d.ts +12 -0
- package/dist/dashboard/dashboard-plugin.js +397 -0
- package/dist/dashboard/dashboard-plugin.js.map +1 -0
- package/dist/data-plugin.d.ts +3 -0
- package/dist/data-plugin.js +61 -113
- package/dist/data-plugin.js.map +1 -1
- package/dist/email-notification-plugin.d.ts +2 -0
- package/dist/email-notification-plugin.js +541 -0
- package/dist/email-notification-plugin.js.map +1 -0
- package/dist/flow/constants/flow-plugin-constants.d.ts +58 -0
- package/dist/flow/constants/flow-plugin-constants.js +70 -0
- package/dist/flow/constants/flow-plugin-constants.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-constants.d.ts +38 -0
- package/dist/flow/flow-logic/flow-logic-constants.js +118 -0
- package/dist/flow/flow-logic/flow-logic-constants.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-diagnostics.d.ts +19 -0
- package/dist/flow/flow-logic/flow-logic-diagnostics.js +503 -0
- package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +62 -0
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +2092 -0
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-plugin.d.ts +52 -0
- package/dist/flow/flow-logic/flow-logic-plugin.js +283 -0
- package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-shapes.d.ts +104 -0
- package/dist/flow/flow-logic/flow-logic-shapes.js +201 -0
- package/dist/flow/flow-logic/flow-logic-shapes.js.map +1 -0
- package/dist/flow/plugins/approval-rules-plugin.d.ts +2 -0
- package/dist/flow/plugins/approval-rules-plugin.js +49 -0
- package/dist/flow/plugins/approval-rules-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-action-definition-plugin.d.ts +2 -0
- package/dist/flow/plugins/flow-action-definition-plugin.js +286 -0
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-data-pill-plugin.d.ts +9 -0
- package/dist/flow/plugins/flow-data-pill-plugin.js +212 -0
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-definition-plugin.d.ts +2 -0
- package/dist/flow/plugins/flow-definition-plugin.js +1668 -0
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +26 -0
- package/dist/flow/plugins/flow-diagnostics-plugin.js +217 -0
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-instance-plugin.d.ts +12 -0
- package/dist/flow/plugins/flow-instance-plugin.js +1205 -0
- package/dist/flow/plugins/flow-instance-plugin.js.map +1 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.d.ts +2 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.js +338 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -0
- package/dist/flow/plugins/inline-script-plugin.d.ts +39 -0
- package/dist/flow/plugins/inline-script-plugin.js +80 -0
- package/dist/flow/plugins/inline-script-plugin.js.map +1 -0
- package/dist/flow/plugins/step-definition-plugin.d.ts +5 -0
- package/dist/flow/plugins/step-definition-plugin.js +71 -0
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -0
- package/dist/flow/plugins/step-instance-plugin.d.ts +31 -0
- package/dist/flow/plugins/step-instance-plugin.js +339 -0
- package/dist/flow/plugins/step-instance-plugin.js.map +1 -0
- package/dist/flow/plugins/trigger-plugin.d.ts +2 -0
- package/dist/flow/plugins/trigger-plugin.js +96 -0
- package/dist/flow/plugins/trigger-plugin.js.map +1 -0
- package/dist/flow/plugins/wfa-datapill-plugin.d.ts +15 -0
- package/dist/flow/plugins/wfa-datapill-plugin.js +178 -0
- package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -0
- package/dist/flow/utils/approval-rules-processor.d.ts +13 -0
- package/dist/flow/utils/approval-rules-processor.js +267 -0
- package/dist/flow/utils/approval-rules-processor.js.map +1 -0
- package/dist/flow/utils/built-in-complex-objects.d.ts +19 -0
- package/dist/flow/utils/built-in-complex-objects.js +62 -0
- package/dist/flow/utils/built-in-complex-objects.js.map +1 -0
- package/dist/flow/utils/complex-object-resolver.d.ts +8 -0
- package/dist/flow/utils/complex-object-resolver.js +614 -0
- package/dist/flow/utils/complex-object-resolver.js.map +1 -0
- package/dist/flow/utils/complex-objects.d.ts +36 -0
- package/dist/flow/utils/complex-objects.js +481 -0
- package/dist/flow/utils/complex-objects.js.map +1 -0
- package/dist/flow/utils/data-pill-shapes.d.ts +58 -0
- package/dist/flow/utils/data-pill-shapes.js +135 -0
- package/dist/flow/utils/data-pill-shapes.js.map +1 -0
- package/dist/flow/utils/datapill-transformer.d.ts +110 -0
- package/dist/flow/utils/datapill-transformer.js +503 -0
- package/dist/flow/utils/datapill-transformer.js.map +1 -0
- package/dist/flow/utils/flow-constants.d.ts +72 -0
- package/dist/flow/utils/flow-constants.js +230 -0
- package/dist/flow/utils/flow-constants.js.map +1 -0
- package/dist/flow/utils/flow-io-to-record.d.ts +44 -0
- package/dist/flow/utils/flow-io-to-record.js +409 -0
- package/dist/flow/utils/flow-io-to-record.js.map +1 -0
- package/dist/flow/utils/flow-shapes.d.ts +161 -0
- package/dist/flow/utils/flow-shapes.js +255 -0
- package/dist/flow/utils/flow-shapes.js.map +1 -0
- package/dist/flow/utils/flow-to-xml.d.ts +16 -0
- package/dist/flow/utils/flow-to-xml.js +237 -0
- package/dist/flow/utils/flow-to-xml.js.map +1 -0
- package/dist/flow/utils/flow-variable-processor.d.ts +51 -0
- package/dist/flow/utils/flow-variable-processor.js +69 -0
- package/dist/flow/utils/flow-variable-processor.js.map +1 -0
- package/dist/flow/utils/label-cache-parser.d.ts +7 -0
- package/dist/flow/utils/label-cache-parser.js +24 -0
- package/dist/flow/utils/label-cache-parser.js.map +1 -0
- package/dist/flow/utils/label-cache-processor.d.ts +119 -0
- package/dist/flow/utils/label-cache-processor.js +719 -0
- package/dist/flow/utils/label-cache-processor.js.map +1 -0
- package/dist/flow/utils/pill-string-parser.d.ts +88 -0
- package/dist/flow/utils/pill-string-parser.js +306 -0
- package/dist/flow/utils/pill-string-parser.js.map +1 -0
- package/dist/flow/utils/schema-to-flow-object.d.ts +22 -0
- package/dist/flow/utils/schema-to-flow-object.js +318 -0
- package/dist/flow/utils/schema-to-flow-object.js.map +1 -0
- package/dist/flow/utils/service-catalog.d.ts +47 -0
- package/dist/flow/utils/service-catalog.js +137 -0
- package/dist/flow/utils/service-catalog.js.map +1 -0
- package/dist/flow/utils/utils.d.ts +117 -0
- package/dist/flow/utils/utils.js +345 -0
- package/dist/flow/utils/utils.js.map +1 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/list-plugin.js +1 -1
- package/dist/list-plugin.js.map +1 -1
- package/dist/now-attach-plugin.d.ts +1 -0
- package/dist/now-attach-plugin.js +10 -10
- package/dist/now-attach-plugin.js.map +1 -1
- package/dist/now-ref-plugin.js +1 -1
- package/dist/now-ref-plugin.js.map +1 -1
- package/dist/record-plugin.d.ts +29 -0
- package/dist/record-plugin.js +66 -7
- package/dist/record-plugin.js.map +1 -1
- package/dist/repack/index.d.ts +2 -0
- package/dist/repack/index.js +8 -0
- package/dist/repack/index.js.map +1 -1
- package/dist/rest-api-plugin.js +54 -44
- package/dist/rest-api-plugin.js.map +1 -1
- package/dist/server-module-plugin/index.d.ts +10 -0
- package/dist/server-module-plugin/index.js +83 -59
- package/dist/server-module-plugin/index.js.map +1 -1
- package/dist/service-catalog/catalog-clientscript-plugin.d.ts +2 -0
- package/dist/service-catalog/catalog-clientscript-plugin.js +117 -0
- package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -0
- package/dist/service-catalog/catalog-item-plugin.d.ts +2 -0
- package/dist/service-catalog/catalog-item-plugin.js +115 -0
- package/dist/service-catalog/catalog-item-plugin.js.map +1 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.d.ts +2 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.js +266 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -0
- package/dist/service-catalog/index.d.ts +5 -0
- package/dist/service-catalog/index.js +22 -0
- package/dist/service-catalog/index.js.map +1 -0
- package/dist/service-catalog/record-to-shape.d.ts +6 -0
- package/dist/service-catalog/record-to-shape.js +93 -0
- package/dist/service-catalog/record-to-shape.js.map +1 -0
- package/dist/service-catalog/sc-record-producer-plugin.d.ts +2 -0
- package/dist/service-catalog/sc-record-producer-plugin.js +140 -0
- package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -0
- package/dist/service-catalog/service-catalog-base.d.ts +311 -0
- package/dist/service-catalog/service-catalog-base.js +542 -0
- package/dist/service-catalog/service-catalog-base.js.map +1 -0
- package/dist/service-catalog/service-catalog-diagnostics.d.ts +45 -0
- package/dist/service-catalog/service-catalog-diagnostics.js +172 -0
- package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -0
- package/dist/service-catalog/shape-to-record.d.ts +8 -0
- package/dist/service-catalog/shape-to-record.js +235 -0
- package/dist/service-catalog/shape-to-record.js.map +1 -0
- package/dist/service-catalog/utils.d.ts +323 -0
- package/dist/service-catalog/utils.js +1216 -0
- package/dist/service-catalog/utils.js.map +1 -0
- package/dist/service-catalog/variable-helper.d.ts +43 -0
- package/dist/service-catalog/variable-helper.js +92 -0
- package/dist/service-catalog/variable-helper.js.map +1 -0
- package/dist/service-catalog/variable-set-plugin.d.ts +2 -0
- package/dist/service-catalog/variable-set-plugin.js +175 -0
- package/dist/service-catalog/variable-set-plugin.js.map +1 -0
- package/dist/service-catalog/variables-transform.d.ts +139 -0
- package/dist/service-catalog/variables-transform.js +403 -0
- package/dist/service-catalog/variables-transform.js.map +1 -0
- package/dist/sla/sla-validators.d.ts +61 -0
- package/dist/sla/sla-validators.js +224 -0
- package/dist/sla/sla-validators.js.map +1 -0
- package/dist/sla-plugin.d.ts +5 -0
- package/dist/sla-plugin.js +280 -0
- package/dist/sla-plugin.js.map +1 -0
- package/dist/static-content-plugin.js +25 -2
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +32 -15
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +832 -19
- package/dist/ui-page-plugin.js.map +1 -1
- package/dist/ui-policy-plugin.js +5 -7
- package/dist/ui-policy-plugin.js.map +1 -1
- package/dist/utils.d.ts +10 -1
- package/dist/utils.js +16 -0
- package/dist/utils.js.map +1 -1
- package/dist/ux-list-menu-config-plugin.d.ts +2 -0
- package/dist/ux-list-menu-config-plugin.js +292 -0
- package/dist/ux-list-menu-config-plugin.js.map +1 -0
- package/dist/workspace-plugin/chrome-tab.d.ts +2 -0
- package/dist/workspace-plugin/chrome-tab.js +46 -0
- package/dist/workspace-plugin/chrome-tab.js.map +1 -0
- package/dist/workspace-plugin/constants.d.ts +52 -0
- package/dist/workspace-plugin/constants.js +56 -0
- package/dist/workspace-plugin/constants.js.map +1 -0
- package/dist/workspace-plugin/fluent-utils.d.ts +9 -0
- package/dist/workspace-plugin/fluent-utils.js +60 -0
- package/dist/workspace-plugin/fluent-utils.js.map +1 -0
- package/dist/workspace-plugin/page.d.ts +8 -0
- package/dist/workspace-plugin/page.js +108 -0
- package/dist/workspace-plugin/page.js.map +1 -0
- package/dist/workspace-plugin/screen.d.ts +1 -0
- package/dist/workspace-plugin/screen.js +38 -0
- package/dist/workspace-plugin/screen.js.map +1 -0
- package/dist/workspace-plugin/templates/index.d.ts +10 -0
- package/dist/workspace-plugin/templates/index.js +20 -0
- package/dist/workspace-plugin/templates/index.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-composition.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-composition.js +4043 -0
- package/dist/workspace-plugin/templates/record-page-composition.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-data.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-data.js +527 -0
- package/dist/workspace-plugin/templates/record-page-data.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-interalEventMappings.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-interalEventMappings.js +39 -0
- package/dist/workspace-plugin/templates/record-page-interalEventMappings.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-layoutModel.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-layoutModel.js +55 -0
- package/dist/workspace-plugin/templates/record-page-layoutModel.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page-properties.d.ts +1 -0
- package/dist/workspace-plugin/templates/record-page-properties.js +135 -0
- package/dist/workspace-plugin/templates/record-page-properties.js.map +1 -0
- package/dist/workspace-plugin/templates/record-page.d.ts +3 -0
- package/dist/workspace-plugin/templates/record-page.js +8 -0
- package/dist/workspace-plugin/templates/record-page.js.map +1 -0
- package/dist/workspace-plugin.d.ts +2 -0
- package/dist/workspace-plugin.js +453 -0
- package/dist/workspace-plugin.js.map +1 -0
- package/package.json +10 -12
- package/src/acl-plugin.ts +16 -1
- package/src/applicability-plugin.ts +82 -0
- package/src/atf/test-plugin.ts +6 -3
- package/src/basic-syntax-plugin.ts +10 -1
- package/src/business-rule-plugin.ts +2 -1
- package/src/call-expression-plugin.ts +2 -130
- package/src/column/column-to-record.ts +54 -8
- package/src/column-plugin.ts +29 -13
- package/src/dashboard/dashboard-component-property-defaults.ts +277 -0
- package/src/dashboard/dashboard-component-resolver.ts +69 -0
- package/src/dashboard/dashboard-plugin.ts +450 -0
- package/src/data-plugin.ts +67 -139
- package/src/email-notification-plugin.ts +850 -0
- package/src/flow/constants/flow-plugin-constants.ts +79 -0
- package/src/flow/flow-logic/flow-logic-constants.ts +120 -0
- package/src/flow/flow-logic/flow-logic-diagnostics.ts +591 -0
- package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +2550 -0
- package/src/flow/flow-logic/flow-logic-plugin.ts +337 -0
- package/src/flow/flow-logic/flow-logic-shapes.ts +215 -0
- package/src/flow/plugins/approval-rules-plugin.ts +48 -0
- package/src/flow/plugins/flow-action-definition-plugin.ts +295 -0
- package/src/flow/plugins/flow-data-pill-plugin.ts +258 -0
- package/src/flow/plugins/flow-definition-plugin.ts +2173 -0
- package/src/flow/plugins/flow-diagnostics-plugin.ts +280 -0
- package/src/flow/plugins/flow-instance-plugin.ts +1499 -0
- package/src/flow/plugins/flow-trigger-instance-plugin.ts +444 -0
- package/src/flow/plugins/inline-script-plugin.ts +83 -0
- package/src/flow/plugins/step-definition-plugin.ts +67 -0
- package/src/flow/plugins/step-instance-plugin.ts +431 -0
- package/src/flow/plugins/trigger-plugin.ts +95 -0
- package/src/flow/plugins/wfa-datapill-plugin.ts +213 -0
- package/src/flow/utils/approval-rules-processor.ts +298 -0
- package/src/flow/utils/built-in-complex-objects.ts +81 -0
- package/src/flow/utils/complex-object-resolver.ts +875 -0
- package/src/flow/utils/complex-objects.ts +656 -0
- package/src/flow/utils/data-pill-shapes.ts +165 -0
- package/src/flow/utils/datapill-transformer.ts +632 -0
- package/src/flow/utils/flow-constants.ts +285 -0
- package/src/flow/utils/flow-io-to-record.ts +533 -0
- package/src/flow/utils/flow-shapes.ts +296 -0
- package/src/flow/utils/flow-to-xml.ts +318 -0
- package/src/flow/utils/flow-variable-processor.ts +100 -0
- package/src/flow/utils/label-cache-parser.ts +37 -0
- package/src/flow/utils/label-cache-processor.ts +870 -0
- package/src/flow/utils/pill-string-parser.ts +375 -0
- package/src/flow/utils/schema-to-flow-object.ts +385 -0
- package/src/flow/utils/service-catalog.ts +174 -0
- package/src/flow/utils/utils.ts +395 -0
- package/src/index.ts +20 -1
- package/src/list-plugin.ts +1 -1
- package/src/now-attach-plugin.ts +14 -11
- package/src/now-ref-plugin.ts +1 -1
- package/src/record-plugin.ts +76 -11
- package/src/repack/index.ts +14 -0
- package/src/rest-api-plugin.ts +62 -50
- package/src/server-module-plugin/index.ts +112 -86
- package/src/service-catalog/catalog-clientscript-plugin.ts +140 -0
- package/src/service-catalog/catalog-item-plugin.ts +162 -0
- package/src/service-catalog/catalog-ui-policy-plugin.ts +324 -0
- package/src/service-catalog/index.ts +5 -0
- package/src/service-catalog/record-to-shape.ts +109 -0
- package/src/service-catalog/sc-record-producer-plugin.ts +201 -0
- package/src/service-catalog/service-catalog-base.ts +600 -0
- package/src/service-catalog/service-catalog-diagnostics.ts +254 -0
- package/src/service-catalog/shape-to-record.ts +279 -0
- package/src/service-catalog/utils.ts +1455 -0
- package/src/service-catalog/variable-helper.ts +135 -0
- package/src/service-catalog/variable-set-plugin.ts +197 -0
- package/src/service-catalog/variables-transform.ts +438 -0
- package/src/sla/sla-validators.ts +331 -0
- package/src/sla-plugin.ts +358 -0
- package/src/static-content-plugin.ts +25 -2
- package/src/table-plugin.ts +49 -16
- package/src/ui-page-plugin.ts +1063 -20
- package/src/ui-policy-plugin.ts +5 -9
- package/src/utils.ts +24 -1
- package/src/ux-list-menu-config-plugin.ts +312 -0
- package/src/workspace-plugin/chrome-tab.ts +44 -0
- package/src/workspace-plugin/constants.ts +53 -0
- package/src/workspace-plugin/fluent-utils.ts +60 -0
- package/src/workspace-plugin/page.ts +139 -0
- package/src/workspace-plugin/screen.ts +34 -0
- package/src/workspace-plugin/templates/index.ts +17 -0
- package/src/workspace-plugin/templates/record-page-composition.ts +4051 -0
- package/src/workspace-plugin/templates/record-page-data.ts +523 -0
- package/src/workspace-plugin/templates/record-page-interalEventMappings.ts +35 -0
- package/src/workspace-plugin/templates/record-page-layoutModel.ts +51 -0
- package/src/workspace-plugin/templates/record-page-properties.ts +131 -0
- package/src/workspace-plugin/templates/record-page.ts +6 -0
- package/src/workspace-plugin.ts +574 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WfaDataPillPlugin = void 0;
|
|
4
|
+
const sdk_build_core_1 = require("@servicenow/sdk-build-core");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const utils_2 = require("../utils/utils");
|
|
7
|
+
const flow_data_pill_plugin_1 = require("./flow-data-pill-plugin");
|
|
8
|
+
const basic_syntax_plugin_1 = require("../../basic-syntax-plugin");
|
|
9
|
+
const data_pill_shapes_1 = require("../utils/data-pill-shapes");
|
|
10
|
+
const flow_logic_constants_1 = require("../flow-logic/flow-logic-constants");
|
|
11
|
+
const DATAPILL_CALLEE = 'wfa.dataPill';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// HELPER FUNCTIONS
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Checks if a node is the items argument (first argument) of wfa.flowLogic.forEach()
|
|
17
|
+
*
|
|
18
|
+
* Verifies the following conditions:
|
|
19
|
+
* 1. The immediate parent is a CallExpression
|
|
20
|
+
* 2. The parent's callee is 'wfa.flowLogic.forEach'
|
|
21
|
+
* 3. The node is the first argument of that forEach call
|
|
22
|
+
*
|
|
23
|
+
* @param node - The node to check
|
|
24
|
+
* @returns true if the node is the items argument of forEach, false otherwise
|
|
25
|
+
*/
|
|
26
|
+
function isForEachItemsArgument(node) {
|
|
27
|
+
const parentCall = node.getParentIfKind(sdk_build_core_1.ts.SyntaxKind.CallExpression);
|
|
28
|
+
return (parentCall !== undefined &&
|
|
29
|
+
(0, utils_1.getCallExpressionName)(parentCall) === flow_logic_constants_1.FLOW_LOGIC.FOR_EACH &&
|
|
30
|
+
parentCall.getArguments()[0] === node);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Extracts metadata from the TypeScript type of a data pill expression.
|
|
34
|
+
* This includes parent table name, column name, and reference table.
|
|
35
|
+
*
|
|
36
|
+
* For example, for params.trigger.current.company:
|
|
37
|
+
* - parentTableName: "user_criteria" (from the record type)
|
|
38
|
+
* - columnName: "company" (the property being accessed)
|
|
39
|
+
* - reference: "core_company" (from the column's referenceTable property)
|
|
40
|
+
*/
|
|
41
|
+
function extractMetadataFromType(node) {
|
|
42
|
+
let parentTableName = null;
|
|
43
|
+
let columnName = null;
|
|
44
|
+
let reference = null;
|
|
45
|
+
// For property access like params.trigger.current.company or outOfStockAssets.Records
|
|
46
|
+
if (sdk_build_core_1.ts.Node.isPropertyAccessExpression(node)) {
|
|
47
|
+
// Get the property name (e.g., "company" or "Records")
|
|
48
|
+
columnName = node.getName();
|
|
49
|
+
// Get the parent expression (e.g., params.trigger.current or outOfStockAssets)
|
|
50
|
+
const parentExpr = node.getExpression();
|
|
51
|
+
const parentType = parentExpr.getType();
|
|
52
|
+
const parentTypeText = parentType.getText();
|
|
53
|
+
// Pattern A: Check for OutputsWithDependentTable<..., "table_name"> from action outputs
|
|
54
|
+
// e.g., OutputsWithDependentTable<{...}, "alm_hardware"> & {...}
|
|
55
|
+
// The type text contains nested brackets, so we look for the pattern: }, "table_name"> &
|
|
56
|
+
if (parentTypeText.includes('OutputsWithDependentTable')) {
|
|
57
|
+
const outputsDependentMatch = parentTypeText.match(/},\s*["']([^"']+)["']\s*>\s*&/);
|
|
58
|
+
if (outputsDependentMatch?.[1]) {
|
|
59
|
+
reference = outputsDependentMatch[1];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Try to extract the table name from TableAwareRecordRecursive or similar types
|
|
63
|
+
if (!reference) {
|
|
64
|
+
const tableMatch = parentTypeText.match(/TableAwareRecord(?:Recursive|WithFallback)?<["']([^"']+)["']/);
|
|
65
|
+
if (tableMatch?.[1]) {
|
|
66
|
+
parentTableName = tableMatch[1];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Get the type of the property being accessed
|
|
70
|
+
const propertyType = node.getType();
|
|
71
|
+
const propertyTypeText = propertyType.getText();
|
|
72
|
+
// Try to extract referenceTable from the property type
|
|
73
|
+
// Pattern 1: Check if the property type is itself a TableAwareRecordRecursive type
|
|
74
|
+
// e.g., TableAwareRecordRecursive<"core_company", 2>
|
|
75
|
+
if (!reference) {
|
|
76
|
+
const tableTypeMatch = propertyTypeText.match(/TableAwareRecord(?:Recursive|WithFallback)?<["']([^"']+)["']/);
|
|
77
|
+
if (tableTypeMatch?.[1]) {
|
|
78
|
+
reference = tableTypeMatch[1];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { parentTableName, columnName, reference };
|
|
83
|
+
}
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// PLUGIN DEFINITION
|
|
86
|
+
// ============================================================================
|
|
87
|
+
/**
|
|
88
|
+
* WfaDataPillPlugin - Handles wfa.dataPill() CallExpressions
|
|
89
|
+
*
|
|
90
|
+
* This plugin processes datapill wrapper calls and converts them to PillShape.
|
|
91
|
+
*
|
|
92
|
+
* Usage:
|
|
93
|
+
* wfa.dataPill(params.trigger.current.active, 'boolean')
|
|
94
|
+
* wfa.dataPill(params.flowVariables.userName, 'string')
|
|
95
|
+
* wfa.dataPill(actionInstance.output, 'reference')
|
|
96
|
+
*
|
|
97
|
+
* The first argument is the PropertyAccessExpression to the data source.
|
|
98
|
+
* The second argument is the data type string.
|
|
99
|
+
*/
|
|
100
|
+
exports.WfaDataPillPlugin = sdk_build_core_1.Plugin.create({
|
|
101
|
+
name: 'WfaDataPillPlugin',
|
|
102
|
+
nodes: [
|
|
103
|
+
{
|
|
104
|
+
node: 'CallExpression',
|
|
105
|
+
fileTypes: ['fluent'],
|
|
106
|
+
async toShape(node, { diagnostics, transform }) {
|
|
107
|
+
const callee = (0, utils_1.getCallExpressionName)(node);
|
|
108
|
+
// Only handle wfa.dataPill() calls
|
|
109
|
+
if (callee !== DATAPILL_CALLEE) {
|
|
110
|
+
return { success: false };
|
|
111
|
+
}
|
|
112
|
+
// Validate wfa.dataPill is inside a Flow or Subflow call expression
|
|
113
|
+
const ancestorFlowOrSubflow = (0, utils_2.findAncestorByCalleeName)(node, 'Flow', 'Subflow');
|
|
114
|
+
if (!ancestorFlowOrSubflow) {
|
|
115
|
+
diagnostics.error(node, 'wfa.dataPill() cannot be used outside of a Flow or Subflow context.');
|
|
116
|
+
return { success: false };
|
|
117
|
+
}
|
|
118
|
+
// TODO: This is not working, Even though the debug point is hitting this but not printing the error for some reason, need to fix from core team.
|
|
119
|
+
// This will be gone once the toSubclass node -> toShape is refactored to toSubclass() with story ref. STRY62776143
|
|
120
|
+
const ancestorDuration = (0, utils_2.findAncestorByCalleeName)(node, 'Duration');
|
|
121
|
+
if (ancestorDuration) {
|
|
122
|
+
diagnostics.error(node, 'wfa.dataPill() cannot be used inside a Duration().');
|
|
123
|
+
return { success: false };
|
|
124
|
+
}
|
|
125
|
+
const args = node.getArguments();
|
|
126
|
+
let expressionArg = args[0];
|
|
127
|
+
const typeArg = args[1];
|
|
128
|
+
if (!expressionArg) {
|
|
129
|
+
diagnostics.error(node, 'wfa.dataPill: missing required expression argument');
|
|
130
|
+
return { success: false };
|
|
131
|
+
}
|
|
132
|
+
// Check if this pill is used in forEach items argument (computed once, reused throughout)
|
|
133
|
+
const isForEachItems = isForEachItemsArgument(node);
|
|
134
|
+
// Check for type assertions (as any, as string, etc.) in forEach items argument ONLY
|
|
135
|
+
if (sdk_build_core_1.ts.Node.isAsExpression(expressionArg)) {
|
|
136
|
+
if (isForEachItems) {
|
|
137
|
+
diagnostics.error(expressionArg, 'wfa.dataPill: Type assertions (e.g., "as any") are not allowed in forEach items argument.');
|
|
138
|
+
return { success: false };
|
|
139
|
+
}
|
|
140
|
+
// For non-forEach uses, unwrap the type assertion to get the underlying expression
|
|
141
|
+
expressionArg = expressionArg.getExpression();
|
|
142
|
+
}
|
|
143
|
+
// Validate first argument is a property access expression or identifier
|
|
144
|
+
if (!sdk_build_core_1.ts.Node.isPropertyAccessExpression(expressionArg) &&
|
|
145
|
+
!sdk_build_core_1.ts.Node.isIdentifier(expressionArg) // In ForEach scneario we get identifier like "item"
|
|
146
|
+
) {
|
|
147
|
+
diagnostics.error(expressionArg, 'wfa.dataPill: first argument must be a property access expression (e.g., params.trigger.current.active)');
|
|
148
|
+
return { success: false };
|
|
149
|
+
}
|
|
150
|
+
// Convert the expression argument to a shape first
|
|
151
|
+
const shapeResult = await transform.toShape(expressionArg, basic_syntax_plugin_1.BasicSyntaxPlugin, flow_data_pill_plugin_1.DataPillPlugin);
|
|
152
|
+
if (shapeResult.success) {
|
|
153
|
+
if (shapeResult.value instanceof data_pill_shapes_1.PillShape || shapeResult.value instanceof data_pill_shapes_1.ForEachItemShape) {
|
|
154
|
+
shapeResult.value.setType(typeArg.getLiteralValue());
|
|
155
|
+
// Only extract and set metadata if this pill is the items argument of forEach
|
|
156
|
+
if (isForEachItems) {
|
|
157
|
+
const metadata = extractMetadataFromType(expressionArg);
|
|
158
|
+
if (metadata.parentTableName) {
|
|
159
|
+
shapeResult.value.setParentTableName(metadata.parentTableName);
|
|
160
|
+
}
|
|
161
|
+
if (metadata.columnName) {
|
|
162
|
+
shapeResult.value.setColumnName(metadata.columnName);
|
|
163
|
+
}
|
|
164
|
+
if (metadata.reference) {
|
|
165
|
+
shapeResult.value.setReference(metadata.reference);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return { success: true, value: shapeResult.value };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
diagnostics.error(expressionArg, 'wfa.dataPill: failed to resolve expression or type');
|
|
172
|
+
return { success: false };
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
shapes: [],
|
|
177
|
+
});
|
|
178
|
+
//# sourceMappingURL=wfa-datapill-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wfa-datapill-plugin.js","sourceRoot":"","sources":["../../../src/flow/plugins/wfa-datapill-plugin.ts"],"names":[],"mappings":";;;AAAA,+DAAgF;AAChF,uCAAmD;AACnD,0CAAyD;AACzD,mEAAwD;AACxD,mEAA6D;AAC7D,gEAAuE;AACvE,6EAA+D;AAE/D,MAAM,eAAe,GAAG,cAAc,CAAA;AAEtC,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;;;;;GAUG;AACH,SAAS,sBAAsB,CAAC,IAAa;IACzC,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;IACrE,OAAO,CACH,UAAU,KAAK,SAAS;QACxB,IAAA,6BAAqB,EAAC,UAAU,CAAC,KAAK,iCAAU,CAAC,QAAQ;QACzD,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CACxC,CAAA;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,uBAAuB,CAAC,IAAa;IAK1C,IAAI,eAAe,GAAkB,IAAI,CAAA;IACzC,IAAI,UAAU,G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AY,4BAAS,IAAI,WAAW,CAAC,KAAK,YAAY,mCAAgB,EAAE,CAAC;wBAC1F,WAAW,CAAC,KAAK,CAAC,OAAO,CAAE,OAA4B,CAAC,eAAe,EAAE,CAAC,CAAA;wBAE1E,8EAA8E;wBAC9E,IAAI,cAAc,EAAE,CAAC;4BACjB,MAAM,QAAQ,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAA;4BACvD,IAAI,QAAQ,CAAC,eAAe,EAAE,CAAC;gCAC3B,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;4BAClE,CAAC;4BACD,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;gCACtB,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;4BACxD,CAAC;4BACD,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;gCACrB,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;4BACtD,CAAC;wBACL,CAAC;wBACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAA;oBACtD,CAAC;gBACL,CAAC;gBACD,WAAW,CAAC,KAAK,CAAC,aAAa,EAAE,oDAAoD,CAAC,CAAA;gBACtF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;YAC7B,CAAC;SACJ;KACJ;IACD,MAAM,EAAE,EAAE;CACb,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ApprovalRulesType } from '@servicenow/sdk-core/runtime/flow';
|
|
2
|
+
/**
|
|
3
|
+
* Converts Approval Rules JSON to string representation
|
|
4
|
+
* @param {Object} approvalRules - Approval rules JSON containing ruleSets and conditionType attributes
|
|
5
|
+
* @returns {string} String representation of the Approval Rules
|
|
6
|
+
*/
|
|
7
|
+
export declare function approvalRulesJsonToString(approvalRules: ApprovalRulesType): string;
|
|
8
|
+
/**
|
|
9
|
+
* Converts Approval Rules string to JSON representation
|
|
10
|
+
* @param {string} ruleSetsString - String representation of the Approval Rules
|
|
11
|
+
* @returns {Object} Approval rules JSON containing ruleSets and conditionType attributes
|
|
12
|
+
*/
|
|
13
|
+
export declare function approvalRulesStringToJson(ruleSetsString: string): ApprovalRulesType;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.approvalRulesJsonToString = approvalRulesJsonToString;
|
|
4
|
+
exports.approvalRulesStringToJson = approvalRulesStringToJson;
|
|
5
|
+
/**
|
|
6
|
+
* Utility functions to convert between JSON and string formats for Approval Rules
|
|
7
|
+
*/
|
|
8
|
+
const flow_constants_1 = require("./flow-constants");
|
|
9
|
+
/**
|
|
10
|
+
* Converts Approval Rules JSON to string representation
|
|
11
|
+
* @param {Object} approvalRules - Approval rules JSON containing ruleSets and conditionType attributes
|
|
12
|
+
* @returns {string} String representation of the Approval Rules
|
|
13
|
+
*/
|
|
14
|
+
function approvalRulesJsonToString(approvalRules) {
|
|
15
|
+
const { ruleSets = [] } = approvalRules;
|
|
16
|
+
return ruleSetsJsonToString(ruleSets);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Converts a Rule Sets JSON to its string representation
|
|
20
|
+
* @param {Array} ruleSets - Array of Rule Set objects
|
|
21
|
+
* @returns {string} String representation of the Rule Sets
|
|
22
|
+
*/
|
|
23
|
+
function ruleSetsJsonToString(ruleSets) {
|
|
24
|
+
if (!ruleSets || !Array.isArray(ruleSets) || ruleSets.length === 0) {
|
|
25
|
+
return flow_constants_1.APPROVAL_ACTION_TYPE_APPROVE_VALUE;
|
|
26
|
+
}
|
|
27
|
+
//Iterate through the RuleSets and convert each RuleSet JSON to string
|
|
28
|
+
return ruleSets
|
|
29
|
+
.map((ruleSet) => ruleSetJsonToString(ruleSet))
|
|
30
|
+
.filter(Boolean)
|
|
31
|
+
.join('Or'); //Rule Sets are connected with 'Or' condition
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Converts a Rule Set JSON to its string representation
|
|
35
|
+
* @param {Object} ruleSet - Rule Set object containg action and rules
|
|
36
|
+
* @returns {string} String representation of the Rule Set
|
|
37
|
+
*/
|
|
38
|
+
function ruleSetJsonToString(ruleSet) {
|
|
39
|
+
const { action, rules = [] } = ruleSet;
|
|
40
|
+
//Check if action type is valid
|
|
41
|
+
if (!action || !flow_constants_1.APPROVAL_ACTION_TYPES.includes(action)) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
//Check if rules are valid
|
|
45
|
+
if (!rules || !Array.isArray(rules) || rules.length === 0) {
|
|
46
|
+
return action;
|
|
47
|
+
}
|
|
48
|
+
//Iterate over the rules and convert each rule json (contains list of conditions) to string
|
|
49
|
+
const rulesString = rules
|
|
50
|
+
.map((rule) => ruleJSONToString(rule))
|
|
51
|
+
.filter(Boolean)
|
|
52
|
+
.join('&'); //Rules are connected with & (AND)
|
|
53
|
+
return `${action}${rulesString}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Converts a Rule (contains list of conditions) JSON to its string representation
|
|
57
|
+
* @param {Array} rule - Array of Rule condition objects
|
|
58
|
+
* @returns {string} String representation of the Rule conditions
|
|
59
|
+
*/
|
|
60
|
+
function ruleJSONToString(rule) {
|
|
61
|
+
if (!rule || !Array.isArray(rule) || rule.length === 0) {
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
//Iterate through the rule conditions and convert each rule condition to string
|
|
65
|
+
const ruleString = rule
|
|
66
|
+
.map((ruleCondition) => ruleConditionJSONToString(ruleCondition))
|
|
67
|
+
.filter(Boolean)
|
|
68
|
+
.join('|'); //Rule conditions are connected with | (OR)
|
|
69
|
+
return ruleString;
|
|
70
|
+
}
|
|
71
|
+
function ruleConditionJSONToString(ruleCondition) {
|
|
72
|
+
if (!ruleCondition || Object.keys(ruleCondition).length === 0) {
|
|
73
|
+
return '';
|
|
74
|
+
}
|
|
75
|
+
let result = '';
|
|
76
|
+
// Handle Count and Percent
|
|
77
|
+
if (ruleCondition.ruleType === 'Count' && ruleCondition.count !== undefined) {
|
|
78
|
+
result = `${ruleCondition.count}#`;
|
|
79
|
+
}
|
|
80
|
+
else if (ruleCondition.ruleType === 'Percent' && ruleCondition.percent !== undefined) {
|
|
81
|
+
result = `${ruleCondition.percent}%`;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Add rule type
|
|
85
|
+
result = ruleCondition.ruleType;
|
|
86
|
+
}
|
|
87
|
+
// Handle manual flag
|
|
88
|
+
if (ruleCondition.manual) {
|
|
89
|
+
result += 'M';
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
// Add users if present
|
|
93
|
+
if (ruleCondition.users && ruleCondition.users.length > 0) {
|
|
94
|
+
result += `U[${ruleCondition.users
|
|
95
|
+
.map((user) => {
|
|
96
|
+
const trimmed = String(user).trim();
|
|
97
|
+
// Check if user is already a data pill format (e.g., {{trigger.current.manager.city|string}})
|
|
98
|
+
const match = trimmed.match(/^\{\{(.*)\}\}$/);
|
|
99
|
+
if (match) {
|
|
100
|
+
return trimmed;
|
|
101
|
+
}
|
|
102
|
+
return `{{static.${user}}}`;
|
|
103
|
+
})
|
|
104
|
+
.join(',')}]`;
|
|
105
|
+
}
|
|
106
|
+
// Add groups if present
|
|
107
|
+
if (ruleCondition.groups && ruleCondition.groups.length > 0) {
|
|
108
|
+
result += `G[${ruleCondition.groups
|
|
109
|
+
.map((group) => {
|
|
110
|
+
const trimmed = String(group).trim();
|
|
111
|
+
// Check if group is already a data pill format (e.g., {{trigger.current.group_ref|string}})
|
|
112
|
+
const match = trimmed.match(/^\{\{(.*)\}\}$/);
|
|
113
|
+
if (match) {
|
|
114
|
+
return trimmed;
|
|
115
|
+
}
|
|
116
|
+
return `{{static.${group}}}`;
|
|
117
|
+
})
|
|
118
|
+
.join(',')}]`;
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Converts Approval Rules string to JSON representation
|
|
124
|
+
* @param {string} ruleSetsString - String representation of the Approval Rules
|
|
125
|
+
* @returns {Object} Approval rules JSON containing ruleSets and conditionType attributes
|
|
126
|
+
*/
|
|
127
|
+
function approvalRulesStringToJson(ruleSetsString) {
|
|
128
|
+
const EMPTY_RULE_SETS_JSON = {
|
|
129
|
+
conditionType: 'OR',
|
|
130
|
+
ruleSets: [],
|
|
131
|
+
};
|
|
132
|
+
if (!ruleSetsString || ruleSetsString.length === 0) {
|
|
133
|
+
return EMPTY_RULE_SETS_JSON;
|
|
134
|
+
}
|
|
135
|
+
// 1. Split by 'Or' to get individual Rule Sets
|
|
136
|
+
// 2. Iterate through the Rule Sets and convert each Rule Set string to JSON
|
|
137
|
+
const ruleSetsJson = ruleSetsString.split('Or').map((ruleSetString) => ruleSetStringToJson(ruleSetString));
|
|
138
|
+
return {
|
|
139
|
+
...EMPTY_RULE_SETS_JSON,
|
|
140
|
+
ruleSets: ruleSetsJson,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Converts a Rule Set string to its JSON representation
|
|
145
|
+
* @param {string} ruleSetString - Rule Set string
|
|
146
|
+
* @returns {Array} JSON representation of the Rule Set
|
|
147
|
+
*/
|
|
148
|
+
function ruleSetStringToJson(ruleSetString) {
|
|
149
|
+
const EMPTY_RULE_SET_JSON = {
|
|
150
|
+
action: 'Approves',
|
|
151
|
+
conditionType: 'AND',
|
|
152
|
+
rules: [],
|
|
153
|
+
};
|
|
154
|
+
if (!ruleSetString || ruleSetString.length === 0) {
|
|
155
|
+
return EMPTY_RULE_SET_JSON;
|
|
156
|
+
}
|
|
157
|
+
// Extract action (Approves, Rejects, ApprovesRejects)
|
|
158
|
+
const actionRegex = /^(ApprovesRejects|Approves|Rejects)/;
|
|
159
|
+
const actionMatch = ruleSetString.match(actionRegex);
|
|
160
|
+
if (!actionMatch) {
|
|
161
|
+
return EMPTY_RULE_SET_JSON;
|
|
162
|
+
}
|
|
163
|
+
const action = actionMatch[0];
|
|
164
|
+
// If the string is just the action name, return an empty rule set
|
|
165
|
+
if (ruleSetString === action) {
|
|
166
|
+
return { ...EMPTY_RULE_SET_JSON, action };
|
|
167
|
+
}
|
|
168
|
+
// Remove action from the Rule Set string and extract the rules string
|
|
169
|
+
const rulesString = ruleSetString.substring(action.length);
|
|
170
|
+
// Split rules by & to get individual rules within the Rule Set
|
|
171
|
+
const rulesRegex = /[&]/g;
|
|
172
|
+
//Iterate through the rules and convert each rule string to JSON
|
|
173
|
+
const rulesJson = rulesString
|
|
174
|
+
.split(rulesRegex)
|
|
175
|
+
.map((ruleString) => ruleStringToJson(ruleString))
|
|
176
|
+
.filter(Boolean);
|
|
177
|
+
return { ...EMPTY_RULE_SET_JSON, action, rules: rulesJson };
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Converts a Rule string to its JSON representation
|
|
181
|
+
* @param {string} ruleString - Rule string
|
|
182
|
+
* @returns {Array} JSON representation of the Rule
|
|
183
|
+
*/
|
|
184
|
+
function ruleStringToJson(ruleString) {
|
|
185
|
+
if (!ruleString || ruleString.length === 0) {
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
const ruleConditionsRegex = /[|]/g;
|
|
189
|
+
const ruleConditionStrings = [];
|
|
190
|
+
ruleString.split(ruleConditionsRegex).forEach((ruleConditionString) => {
|
|
191
|
+
ruleConditionStrings.push(ruleConditionString);
|
|
192
|
+
});
|
|
193
|
+
return ruleConditionStrings
|
|
194
|
+
.map((ruleConditionString) => ruleConditionStringToJson(ruleConditionString))
|
|
195
|
+
.filter((ruleConditionJson) => ruleConditionJson !== undefined);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Converts a Rule Condition string to its JSON representation
|
|
199
|
+
* @param {string} ruleConditionString - Rule Condition string
|
|
200
|
+
* @returns {Object} JSON representation of the Rule Condition
|
|
201
|
+
*/
|
|
202
|
+
function ruleConditionStringToJson(ruleConditionString) {
|
|
203
|
+
if (!ruleConditionString || ruleConditionString.length === 0) {
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
const ruleConditionJson = {
|
|
207
|
+
ruleType: 'Any',
|
|
208
|
+
users: [],
|
|
209
|
+
groups: [],
|
|
210
|
+
manual: false,
|
|
211
|
+
};
|
|
212
|
+
// Check if manual
|
|
213
|
+
const hasManual = ruleConditionString.includes('M');
|
|
214
|
+
if (hasManual) {
|
|
215
|
+
ruleConditionJson.manual = true;
|
|
216
|
+
}
|
|
217
|
+
// Check for Count or Percent
|
|
218
|
+
const countMatch = ruleConditionString.match(/(\d+)#/);
|
|
219
|
+
const percentMatch = ruleConditionString.match(/(\d+)%/);
|
|
220
|
+
if (countMatch?.[1]) {
|
|
221
|
+
ruleConditionJson.ruleType = 'Count';
|
|
222
|
+
ruleConditionJson['count'] = parseInt(countMatch[1], 10);
|
|
223
|
+
}
|
|
224
|
+
else if (percentMatch?.[1]) {
|
|
225
|
+
ruleConditionJson.ruleType = 'Percent';
|
|
226
|
+
ruleConditionJson['percent'] = parseInt(percentMatch[1], 10);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
// Extract rule type (Any, All, Res)
|
|
230
|
+
const ruleTypeMatch = ruleConditionString.match(/(Any|All|Res)/);
|
|
231
|
+
if (ruleTypeMatch) {
|
|
232
|
+
ruleConditionJson.ruleType = ruleTypeMatch[0];
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
ruleConditionJson.users = getUsersJson(ruleConditionString);
|
|
236
|
+
ruleConditionJson.groups = getGroupsJson(ruleConditionString);
|
|
237
|
+
return ruleConditionJson;
|
|
238
|
+
}
|
|
239
|
+
function getUsersJson(ruleConditionString) {
|
|
240
|
+
if (ruleConditionString && ruleConditionString.length > 0) {
|
|
241
|
+
// Extract users
|
|
242
|
+
const usersMatch = ruleConditionString.match(/U\[(.*?)\]/);
|
|
243
|
+
if (usersMatch?.[1]) {
|
|
244
|
+
const usersString = usersMatch[1];
|
|
245
|
+
return usersString
|
|
246
|
+
.split(',')
|
|
247
|
+
.map((user) => user.replace(/{{static\.(.*?)}}/, '$1').trim())
|
|
248
|
+
.filter(Boolean);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return [];
|
|
252
|
+
}
|
|
253
|
+
function getGroupsJson(ruleConditionString) {
|
|
254
|
+
if (ruleConditionString && ruleConditionString.length > 0) {
|
|
255
|
+
// Extract groups
|
|
256
|
+
const groupsMatch = ruleConditionString.match(/G\[(.*?)\]/);
|
|
257
|
+
if (groupsMatch?.[1]) {
|
|
258
|
+
const groupsString = groupsMatch[1];
|
|
259
|
+
return groupsString
|
|
260
|
+
.split(',')
|
|
261
|
+
.map((group) => group.replace(/{{static\.(.*?)}}/, '$1').trim())
|
|
262
|
+
.filter(Boolean);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return [];
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=approval-rules-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-rules-processor.js","sourceRoot":"","sources":["../../../src/flow/utils/approval-rules-processor.ts"],"names":[],"mappings":";;AAiBA,8DAGC;AAyHD,8DAiBC;AA9JD;;GAEG;AACH,qDAA4F;AAS5F;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,aAAgC;IACtE,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,aAAa,CAAA;IACvC,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,QAAoC;IAC9D,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjE,OAAO,mDAAkC,CAAA;IAC7C,CAA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AAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxD,iBAAiB;QACjB,MAAM,WAAW,GAAG,mBAAmB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;QAC3D,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnB,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;YACnC,OAAO,YAAY;iBACd,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;iBAC/D,MAAM,CAAC,OAAO,CAAC,CAAA;QACxB,CAAC;IACL,CAAC;IACD,OAAO,EAAE,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in complex objects that are available globally in Flow Designer.
|
|
3
|
+
* These are referenced by flows but may not be present in the user's project metadata.
|
|
4
|
+
*/
|
|
5
|
+
interface BuiltInComplexObject {
|
|
6
|
+
$id: string;
|
|
7
|
+
table: 'sys_complex_object';
|
|
8
|
+
data: {
|
|
9
|
+
name: string;
|
|
10
|
+
namespace: string;
|
|
11
|
+
scope_name?: string;
|
|
12
|
+
serialized_content: string;
|
|
13
|
+
sys_domain: string;
|
|
14
|
+
sys_policy?: string;
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const builtInComplexObjects: Record<string, BuiltInComplexObject>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Built-in complex objects that are available globally in Flow Designer.
|
|
4
|
+
* These are referenced by flows but may not be present in the user's project metadata.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.builtInComplexObjects = void 0;
|
|
8
|
+
const FDChangeDetails = {
|
|
9
|
+
$id: '239e04950f023300ecf0cc52ff767e0c',
|
|
10
|
+
table: 'sys_complex_object',
|
|
11
|
+
data: {
|
|
12
|
+
name: 'FDChangeDetails',
|
|
13
|
+
namespace: 'FlowDesigner',
|
|
14
|
+
scope_name: 'global',
|
|
15
|
+
serialized_content: '{"FlowDesigner:FDChangeDetails":{"previous_display_value":"String","previous_display_value.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Previous Display Value\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"4\\",\\"max_length\\":\\"0\\"}"},"previous_value":"String","previous_value.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Previous Value\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"2\\",\\"max_length\\":\\"0\\"}"},"current_display_value":"String","current_display_value.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Current Display Value\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"5\\",\\"max_length\\":\\"0\\"}"},"current_value":"String","current_value.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Current Value\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"3\\",\\"max_length\\":\\"0\\"}"},"field_name":"String","field_name.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Field Name\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"1\\",\\"max_length\\":\\"0\\"}"}},"FlowDesigner:FDChangeDetails.$type_facets":{"SimpleMapFacet":"{\\"read_only_complex_object\\":\\"true\\",\\"pwd2droppable\\":\\"true\\",\\"default_value\\":\\"\\",\\"label\\":\\"Changed Fields\\",\\"mandatory\\":\\"false\\",\\"child_name\\":\\"FDChangeDetails\\",\\"uiTypeLabel\\":\\"Array.Object\\",\\"co_type_name\\":\\"FDCollection\\",\\"child_label\\":\\"FDChangeDetails\\",\\"child_type_label\\":\\"Object\\",\\"element_mapping_provider\\":\\"com.glide.flow_design.action.data.FlowDesignVariableMapper\\",\\"read_only\\":\\"false\\",\\"hint\\":null,\\"uiType\\":\\"array.object\\",\\"child_type\\":\\"object\\",\\"order\\":\\"1\\",\\"max_length\\":\\"8000\\"}"}}',
|
|
16
|
+
sys_domain: 'global',
|
|
17
|
+
type: 'complex_object_schema',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const FDSTEPSTATUS = {
|
|
21
|
+
$id: '73720df26f312010bf408271145b3600',
|
|
22
|
+
table: 'sys_complex_object',
|
|
23
|
+
data: {
|
|
24
|
+
name: 'FDSTEPSTATUS',
|
|
25
|
+
namespace: 'FlowDesigner',
|
|
26
|
+
scope_name: 'global',
|
|
27
|
+
serialized_content: '{"FlowDesigner:FDSTEPSTATUS":{"code":"Integer","code.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"Integer\\",\\"read_only\\":\\"false\\",\\"hint\\":null,\\"uiType\\":\\"integer\\",\\"default_value\\":\\"\\",\\"label\\":\\"Code\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"1\\",\\"max_length\\":\\"40\\"}"},"message":"String","message.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":null,\\"uiType\\":\\"string\\",\\"default_value\\":null,\\"label\\":\\"Message\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"2\\",\\"max_length\\":\\"4000\\"}"}},"FlowDesigner:FDSTEPSTATUS.$type_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"Object\\",\\"co_type_name\\":\\"FDSTEPSTATUS\\",\\"read_only\\":\\"false\\",\\"hint\\":null,\\"uiType\\":\\"object\\",\\"default_value\\":\\"\\",\\"label\\":\\"Step Status\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"1\\",\\"max_length\\":\\"0\\"}"}}',
|
|
28
|
+
sys_domain: 'global',
|
|
29
|
+
type: 'complex_object_schema',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const FDACTIONSTATUS = {
|
|
33
|
+
$id: 'b91cc65087022010226ca1bb36cb0be4',
|
|
34
|
+
table: 'sys_complex_object',
|
|
35
|
+
data: {
|
|
36
|
+
name: 'FDACTIONSTATUS',
|
|
37
|
+
namespace: 'FlowDesigner',
|
|
38
|
+
serialized_content: '{"FlowDesigner:FDACTIONSTATUS":{"code":"Integer","code.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"Integer\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"integer\\",\\"default_value\\":\\"\\",\\"label\\":\\"Code\\",\\"action_error_output\\":\\"true\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"1\\",\\"max_length\\":\\"40\\"}"},"message":"String","message.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Message\\",\\"action_error_output\\":\\"true\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"2\\",\\"max_length\\":\\"4000\\"}"}},"FlowDesigner:FDACTIONSTATUS.$type_facets":{"SimpleMapFacet":"{\\"default_value\\":\\"\\",\\"label\\":\\"Action Status\\",\\"action_error_output\\":\\"true\\",\\"mandatory\\":\\"false\\",\\"uiUniqueId\\":\\"4adfb7bc-9d67-498d-88d0-8d6c3d584fed\\",\\"uiTypeLabel\\":\\"Object\\",\\"co_type_name\\":\\"FDACTIONSTATUS\\",\\"element_mapping_provider\\":\\"com.glide.flow_design.action.data.FlowDesignVariableMapper\\",\\"read_only\\":\\"false\\",\\"hint\\":null,\\"uiType\\":\\"object\\",\\"order\\":\\"1\\",\\"max_length\\":\\"65000\\"}"}}',
|
|
39
|
+
sys_domain: 'global',
|
|
40
|
+
sys_policy: 'read',
|
|
41
|
+
type: 'complex_object_schema',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const FDCollection = {
|
|
45
|
+
$id: 'f4f014150f023300ecf0cc52ff767eed',
|
|
46
|
+
table: 'sys_complex_object',
|
|
47
|
+
data: {
|
|
48
|
+
name: 'FDCollection',
|
|
49
|
+
namespace: 'FlowDesigner',
|
|
50
|
+
scope_name: 'global',
|
|
51
|
+
serialized_content: '{"FlowDesigner:FDCollection":{"$COCollectionField":[{"FDChangeDetails":{"previous_display_value":"String","previous_display_value.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Previous Display Value\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"4\\",\\"max_length\\":\\"0\\"}"},"previous_value":"String","previous_value.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Previous Value\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"2\\",\\"max_length\\":\\"0\\"}"},"current_display_value":"String","current_display_value.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Current Display Value\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"5\\",\\"max_length\\":\\"0\\"}"},"current_value":"String","current_value.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Current Value\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"3\\",\\"max_length\\":\\"0\\"}"},"field_name":"String","field_name.$field_facets":{"SimpleMapFacet":"{\\"uiTypeLabel\\":\\"String\\",\\"read_only\\":\\"false\\",\\"hint\\":\\"\\",\\"uiType\\":\\"string\\",\\"default_value\\":\\"\\",\\"label\\":\\"Field Name\\",\\"mandatory\\":\\"false\\",\\"order\\":\\"1\\",\\"max_length\\":\\"0\\"}"}}}],"$COCollectionField.$type_facets":{"SimpleMapFacet":"{\\"pwd2droppable\\":\\"true\\",\\"default_value\\":\\"\\",\\"label\\":\\"Changed Fields\\",\\"mandatory\\":\\"false\\",\\"child_name\\":\\"FDChangeDetails\\",\\"uiTypeLabel\\":\\"Array.Object\\",\\"co_type_name\\":\\"FDCollection\\",\\"child_label\\":\\"FDChangeDetails\\",\\"child_type_label\\":\\"Object\\",\\"element_mapping_provider\\":\\"com.glide.flow_design.action.data.FlowDesignVariableMapper\\",\\"read_only\\":\\"false\\",\\"hint\\":null,\\"uiType\\":\\"array.object\\",\\"child_type\\":\\"object\\",\\"order\\":\\"1\\",\\"max_length\\":\\"8000\\"}"},"$COCollectionField.$field_facets":{"SimpleMapFacet":"{\\"up-shift-collection-level\\":\\"true\\"}"}},"FlowDesigner:FDCollection.$type_facets":{"SimpleMapFacet":"{\\"pwd2droppable\\":\\"true\\",\\"default_value\\":\\"\\",\\"label\\":\\"Changed Fields\\",\\"mandatory\\":\\"false\\",\\"child_name\\":\\"FDChangeDetails\\",\\"uiTypeLabel\\":\\"Array.Object\\",\\"co_type_name\\":\\"FDCollection\\",\\"child_label\\":\\"FDChangeDetails\\",\\"child_type_label\\":\\"Object\\",\\"element_mapping_provider\\":\\"com.glide.flow_design.action.data.FlowDesignVariableMapper\\",\\"read_only\\":\\"false\\",\\"hint\\":null,\\"uiType\\":\\"array.object\\",\\"child_type\\":\\"object\\",\\"order\\":\\"1\\",\\"max_length\\":\\"8000\\"}"}}',
|
|
52
|
+
sys_domain: 'global',
|
|
53
|
+
type: 'complex_object_collection',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
exports.builtInComplexObjects = {
|
|
57
|
+
FDChangeDetails,
|
|
58
|
+
FDSTEPSTATUS,
|
|
59
|
+
FDACTIONSTATUS,
|
|
60
|
+
FDCollection,
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=built-in-complex-objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"built-in-complex-objects.js","sourceRoot":"","sources":["../../../src/flow/utils/built-in-complex-objects.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgBH,MAAM,eAAe,GAAyB;IAC1C,GAAG,EAAE,kCAAkC;IACvC,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE;QACF,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,cAAc;QACzB,UAAU,EAAE,QAAQ;QACpB,kBAAkB,EACd,0wEAA0wE;QAC9wE,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,uBAAuB;KAChC;CACJ,CAAA;AAED,MAAM,YAAY,GAAyB;IACvC,GAAG,EAAE,kCAAkC;IACvC,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE;QACF,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,cAAc;QACzB,UAAU,EAAE,QAAQ;QACpB,kBAAkB,EACd,o7BAAo7B;QACx7B,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,uBAAuB;KAChC;CACJ,CAAA;AAED,MAAM,cAAc,GAAyB;IACzC,GAAG,EAAE,kCAAkC;IACvC,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE;QACF,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,cAAc;QACzB,kBAAkB,EACd,itCAAitC;QACrtC,UAAU,EAAE,QAAQ;QACpB,UAAU,EAAE,MAAM;QAClB,IAAI,EAAE,uBAAuB;KAChC;CACJ,CAAA;AAED,MAAM,YAAY,GAAyB;IACvC,GAAG,EAAE,kCAAkC;IACvC,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE;QACF,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,cAAc;QACzB,UAAU,EAAE,QAAQ;QACpB,kBAAkB,EACd,o9FAAo9F;QACx9F,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,2BAA2B;KACpC;CACJ,CAAA;AAEY,QAAA,qBAAqB,GAAyC;IACvE,eAAe;IACf,YAAY;IACZ,cAAc;IACd,YAAY;CACf,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Record, type Diagnostics, type Logger } from '@servicenow/sdk-build-core';
|
|
2
|
+
export declare function resolveComplexInput(name: string, value: unknown, parentDef: Record, inputTableName: string, diagnostics?: Diagnostics, logger?: Logger): {
|
|
3
|
+
value: unknown;
|
|
4
|
+
internalType: unknown;
|
|
5
|
+
children?: unknown[];
|
|
6
|
+
};
|
|
7
|
+
/** Detects if value is a datapill ({{path}} or {{path|type}}) */
|
|
8
|
+
export declare function isDataPill(value: unknown): boolean;
|