@servicenow/sdk-build-plugins 4.6.0 → 4.7.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 +3 -4
- package/dist/acl-plugin.js.map +1 -1
- package/dist/applicability-plugin.js +0 -2
- package/dist/applicability-plugin.js.map +1 -1
- package/dist/application-menu-plugin.js +0 -2
- package/dist/application-menu-plugin.js.map +1 -1
- package/dist/arrow-function-plugin.js +0 -1
- package/dist/arrow-function-plugin.js.map +1 -1
- package/dist/atf/test-plugin.js +6 -10
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +10 -4
- package/dist/basic-syntax-plugin.js.map +1 -1
- package/dist/business-rule-plugin.js +0 -1
- package/dist/business-rule-plugin.js.map +1 -1
- package/dist/call-expression-plugin.js +0 -1
- package/dist/call-expression-plugin.js.map +1 -1
- package/dist/claims-plugin.js +0 -1
- package/dist/claims-plugin.js.map +1 -1
- package/dist/client-script-plugin.js +0 -1
- package/dist/client-script-plugin.js.map +1 -1
- package/dist/column-plugin.js +120 -49
- package/dist/column-plugin.js.map +1 -1
- package/dist/cross-scope-privilege-plugin.js +0 -1
- package/dist/cross-scope-privilege-plugin.js.map +1 -1
- package/dist/dashboard/dashboard-plugin.js +0 -2
- package/dist/dashboard/dashboard-plugin.js.map +1 -1
- package/dist/data-plugin.js +0 -1
- package/dist/data-plugin.js.map +1 -1
- package/dist/data-policy-plugin.d.ts +2 -0
- package/dist/data-policy-plugin.js +276 -0
- package/dist/data-policy-plugin.js.map +1 -0
- package/dist/email-notification-plugin.js +2 -3
- package/dist/email-notification-plugin.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-constants.d.ts +2 -0
- package/dist/flow/flow-logic/flow-logic-constants.js +6 -1
- package/dist/flow/flow-logic/flow-logic-constants.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-diagnostics.js +192 -56
- package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +2 -1
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +44 -5
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin.js +279 -29
- package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-shapes.d.ts +15 -0
- package/dist/flow/flow-logic/flow-logic-shapes.js +25 -1
- package/dist/flow/flow-logic/flow-logic-shapes.js.map +1 -1
- package/dist/flow/plugins/approval-rules-plugin.js +0 -1
- package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-action-definition-plugin.js +804 -205
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-data-pill-plugin.js +3 -5
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-definition-plugin.js +84 -17
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-diagnostics-plugin.js +65 -3
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-instance-plugin.js +13 -5
- package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-trigger-instance-plugin.js +0 -1
- package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/inline-script-plugin.js +0 -1
- package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
- package/dist/flow/plugins/step-definition-plugin.js +0 -2
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/step-instance-plugin.js +216 -77
- package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/trigger-plugin.js +0 -2
- package/dist/flow/plugins/trigger-plugin.js.map +1 -1
- package/dist/flow/plugins/wfa-datapill-plugin.js +0 -1
- package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
- package/dist/flow/utils/datapill-transformer.js +9 -5
- package/dist/flow/utils/datapill-transformer.js.map +1 -1
- package/dist/flow/utils/flow-constants.d.ts +12 -0
- package/dist/flow/utils/flow-constants.js +17 -3
- package/dist/flow/utils/flow-constants.js.map +1 -1
- package/dist/flow/utils/flow-io-to-record.d.ts +1 -1
- package/dist/flow/utils/flow-io-to-record.js +21 -13
- package/dist/flow/utils/flow-io-to-record.js.map +1 -1
- package/dist/flow/utils/flow-pill-utils.d.ts +26 -0
- package/dist/flow/utils/flow-pill-utils.js +50 -0
- package/dist/flow/utils/flow-pill-utils.js.map +1 -0
- package/dist/flow/utils/flow-stage-processor.d.ts +138 -0
- package/dist/flow/utils/flow-stage-processor.js +665 -0
- package/dist/flow/utils/flow-stage-processor.js.map +1 -0
- package/dist/flow/utils/pill-string-parser.js +28 -43
- package/dist/flow/utils/pill-string-parser.js.map +1 -1
- package/dist/flow/utils/utils.d.ts +11 -6
- package/dist/flow/utils/utils.js +37 -28
- package/dist/flow/utils/utils.js.map +1 -1
- package/dist/form-plugin.js +4 -14
- package/dist/form-plugin.js.map +1 -1
- package/dist/html-import-plugin.js +0 -1
- package/dist/html-import-plugin.js.map +1 -1
- package/dist/import-sets-plugin.js +0 -2
- package/dist/import-sets-plugin.js.map +1 -1
- package/dist/inbound-email-action-plugin.js +0 -1
- package/dist/inbound-email-action-plugin.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-scan-plugin.js +0 -7
- package/dist/instance-scan-plugin.js.map +1 -1
- package/dist/json-plugin.js +0 -1
- package/dist/json-plugin.js.map +1 -1
- package/dist/list-plugin.js +4 -1
- package/dist/list-plugin.js.map +1 -1
- package/dist/now-attach-plugin.js +0 -1
- package/dist/now-attach-plugin.js.map +1 -1
- package/dist/now-config-plugin.js +1 -1
- package/dist/now-config-plugin.js.map +1 -1
- package/dist/now-id-plugin.js +0 -1
- package/dist/now-id-plugin.js.map +1 -1
- package/dist/now-include-plugin.js +0 -1
- package/dist/now-include-plugin.js.map +1 -1
- package/dist/now-ref-plugin.js +0 -1
- package/dist/now-ref-plugin.js.map +1 -1
- package/dist/now-unresolved-plugin.js +0 -1
- package/dist/now-unresolved-plugin.js.map +1 -1
- package/dist/package-json-plugin.js +3 -2
- package/dist/package-json-plugin.js.map +1 -1
- package/dist/property-plugin.js +0 -2
- package/dist/property-plugin.js.map +1 -1
- package/dist/record-plugin.d.ts +2 -0
- package/dist/record-plugin.js +5 -4
- package/dist/record-plugin.js.map +1 -1
- package/dist/repack/lint/Rules.d.ts +1 -2
- package/dist/rest-api-plugin.js +6 -5
- package/dist/rest-api-plugin.js.map +1 -1
- package/dist/role-plugin.js +0 -1
- package/dist/role-plugin.js.map +1 -1
- package/dist/schedule-script/scheduled-script-plugin.js +5 -4
- package/dist/schedule-script/scheduled-script-plugin.js.map +1 -1
- package/dist/script-action-plugin.js +0 -2
- package/dist/script-action-plugin.js.map +1 -1
- package/dist/script-include-plugin.js +4 -4
- package/dist/script-include-plugin.js.map +1 -1
- package/dist/server-module-plugin/index.js +2 -3
- package/dist/server-module-plugin/index.js.map +1 -1
- package/dist/service-catalog/catalog-clientscript-plugin.js +2 -4
- package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-item-plugin.js +0 -2
- package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-ui-policy-plugin.js +2 -4
- package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
- package/dist/service-catalog/sc-record-producer-plugin.js +0 -2
- package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
- package/dist/service-catalog/service-catalog-base.d.ts +2 -2
- package/dist/service-catalog/service-catalog-base.js +2 -2
- package/dist/service-catalog/service-catalog-base.js.map +1 -1
- package/dist/service-catalog/utils.js +1 -1
- package/dist/service-catalog/utils.js.map +1 -1
- package/dist/service-catalog/variable-set-plugin.js +0 -2
- package/dist/service-catalog/variable-set-plugin.js.map +1 -1
- package/dist/service-portal/angular-provider-plugin.js +0 -2
- package/dist/service-portal/angular-provider-plugin.js.map +1 -1
- package/dist/service-portal/dependency-plugin.js +3 -5
- package/dist/service-portal/dependency-plugin.js.map +1 -1
- package/dist/service-portal/header-footer-plugin.js +3 -5
- package/dist/service-portal/header-footer-plugin.js.map +1 -1
- package/dist/service-portal/menu-plugin.js +0 -1
- package/dist/service-portal/menu-plugin.js.map +1 -1
- package/dist/service-portal/page-plugin.js +0 -1
- package/dist/service-portal/page-plugin.js.map +1 -1
- package/dist/service-portal/page-route-map-plugin.js +0 -1
- package/dist/service-portal/page-route-map-plugin.js.map +1 -1
- package/dist/service-portal/portal-plugin.js +0 -2
- package/dist/service-portal/portal-plugin.js.map +1 -1
- package/dist/service-portal/theme-plugin.js +0 -2
- package/dist/service-portal/theme-plugin.js.map +1 -1
- package/dist/service-portal/widget-plugin.js +3 -5
- package/dist/service-portal/widget-plugin.js.map +1 -1
- package/dist/sla-plugin.js +0 -2
- package/dist/sla-plugin.js.map +1 -1
- package/dist/static-content-plugin.js +32 -3
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +303 -66
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-action-plugin.js +26 -17
- package/dist/ui-action-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +159 -17
- package/dist/ui-page-plugin.js.map +1 -1
- package/dist/ui-policy-plugin.js +28 -97
- package/dist/ui-policy-plugin.js.map +1 -1
- package/dist/user-preference-plugin.js +0 -2
- package/dist/user-preference-plugin.js.map +1 -1
- package/dist/utils.d.ts +5 -9
- package/dist/utils.js +38 -11
- package/dist/utils.js.map +1 -1
- package/dist/ux-list-menu-config-plugin.js +0 -2
- package/dist/ux-list-menu-config-plugin.js.map +1 -1
- package/dist/view-plugin.js +0 -1
- package/dist/view-plugin.js.map +1 -1
- package/dist/workspace-plugin.js +0 -2
- package/dist/workspace-plugin.js.map +1 -1
- package/package.json +6 -6
- package/src/acl-plugin.ts +4 -5
- package/src/applicability-plugin.ts +0 -2
- package/src/application-menu-plugin.ts +0 -2
- package/src/arrow-function-plugin.ts +0 -1
- package/src/atf/test-plugin.ts +6 -11
- package/src/basic-syntax-plugin.ts +11 -4
- package/src/business-rule-plugin.ts +1 -2
- package/src/call-expression-plugin.ts +0 -1
- package/src/claims-plugin.ts +0 -1
- package/src/client-script-plugin.ts +1 -2
- package/src/column-plugin.ts +163 -76
- package/src/cross-scope-privilege-plugin.ts +1 -2
- package/src/dashboard/dashboard-plugin.ts +0 -2
- package/src/data-plugin.ts +0 -1
- package/src/data-policy-plugin.ts +333 -0
- package/src/email-notification-plugin.ts +8 -4
- package/src/flow/flow-logic/flow-logic-constants.ts +6 -0
- package/src/flow/flow-logic/flow-logic-diagnostics.ts +236 -58
- package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +59 -6
- package/src/flow/flow-logic/flow-logic-plugin.ts +368 -38
- package/src/flow/flow-logic/flow-logic-shapes.ts +25 -0
- package/src/flow/plugins/approval-rules-plugin.ts +0 -1
- package/src/flow/plugins/flow-action-definition-plugin.ts +940 -208
- package/src/flow/plugins/flow-data-pill-plugin.ts +3 -5
- package/src/flow/plugins/flow-definition-plugin.ts +159 -26
- package/src/flow/plugins/flow-diagnostics-plugin.ts +89 -3
- package/src/flow/plugins/flow-instance-plugin.ts +26 -12
- package/src/flow/plugins/flow-trigger-instance-plugin.ts +0 -1
- package/src/flow/plugins/inline-script-plugin.ts +0 -1
- package/src/flow/plugins/step-definition-plugin.ts +0 -2
- package/src/flow/plugins/step-instance-plugin.ts +259 -65
- package/src/flow/plugins/trigger-plugin.ts +0 -2
- package/src/flow/plugins/wfa-datapill-plugin.ts +0 -1
- package/src/flow/utils/datapill-transformer.ts +13 -5
- package/src/flow/utils/flow-constants.ts +19 -1
- package/src/flow/utils/flow-io-to-record.ts +29 -19
- package/src/flow/utils/flow-pill-utils.ts +48 -0
- package/src/flow/utils/flow-stage-processor.ts +831 -0
- package/src/flow/utils/pill-string-parser.ts +29 -47
- package/src/flow/utils/utils.ts +39 -35
- package/src/form-plugin.ts +5 -15
- package/src/html-import-plugin.ts +0 -1
- package/src/import-sets-plugin.ts +0 -2
- package/src/inbound-email-action-plugin.ts +1 -2
- package/src/index.ts +7 -1
- package/src/instance-scan-plugin.ts +0 -7
- package/src/json-plugin.ts +0 -1
- package/src/list-plugin.ts +6 -2
- package/src/now-attach-plugin.ts +0 -1
- package/src/now-config-plugin.ts +1 -1
- package/src/now-id-plugin.ts +0 -1
- package/src/now-include-plugin.ts +0 -1
- package/src/now-ref-plugin.ts +0 -1
- package/src/now-unresolved-plugin.ts +0 -1
- package/src/package-json-plugin.ts +8 -3
- package/src/property-plugin.ts +0 -2
- package/src/record-plugin.ts +14 -6
- package/src/repack/lint/Rules.ts +1 -1
- package/src/rest-api-plugin.ts +7 -6
- package/src/role-plugin.ts +1 -2
- package/src/schedule-script/scheduled-script-plugin.ts +11 -5
- package/src/script-action-plugin.ts +0 -2
- package/src/script-include-plugin.ts +8 -4
- package/src/server-module-plugin/index.ts +2 -3
- package/src/service-catalog/catalog-clientscript-plugin.ts +2 -4
- package/src/service-catalog/catalog-item-plugin.ts +0 -2
- package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -4
- package/src/service-catalog/sc-record-producer-plugin.ts +0 -2
- package/src/service-catalog/service-catalog-base.ts +2 -2
- package/src/service-catalog/utils.ts +1 -1
- package/src/service-catalog/variable-set-plugin.ts +0 -2
- package/src/service-portal/angular-provider-plugin.ts +0 -2
- package/src/service-portal/dependency-plugin.ts +0 -2
- package/src/service-portal/header-footer-plugin.ts +0 -2
- package/src/service-portal/menu-plugin.ts +1 -2
- package/src/service-portal/page-plugin.ts +1 -2
- package/src/service-portal/page-route-map-plugin.ts +1 -2
- package/src/service-portal/portal-plugin.ts +0 -2
- package/src/service-portal/theme-plugin.ts +0 -2
- package/src/service-portal/widget-plugin.ts +0 -2
- package/src/sla-plugin.ts +0 -2
- package/src/static-content-plugin.ts +37 -4
- package/src/table-plugin.ts +371 -92
- package/src/ui-action-plugin.ts +30 -17
- package/src/ui-page-plugin.ts +188 -20
- package/src/ui-policy-plugin.ts +33 -130
- package/src/user-preference-plugin.ts +0 -2
- package/src/utils.ts +48 -11
- package/src/ux-list-menu-config-plugin.ts +0 -2
- package/src/view-plugin.ts +0 -1
- package/src/workspace-plugin.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CallExpressionShape, type ObjectShape, Plugin, type ArrayShape, type Shape } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { ModuleFunctionShape } from './server-module-plugin'
|
|
3
3
|
import { NowIdShape } from './now-id-plugin'
|
|
4
|
-
import {
|
|
4
|
+
import { generateDeprecatedDiagnostics } from './utils'
|
|
5
5
|
import { NowIncludeShape } from './now-include-plugin'
|
|
6
6
|
|
|
7
7
|
// Similar to lodash's groupBy, but simply stores the last element of each group
|
|
@@ -45,7 +45,6 @@ const brAliases = {
|
|
|
45
45
|
|
|
46
46
|
export const BusinessRulePlugin = Plugin.create({
|
|
47
47
|
name: 'BusinessRulePlugin',
|
|
48
|
-
docs: [createSdkDocEntry('BusinessRule', ['sys_script'])],
|
|
49
48
|
records: {
|
|
50
49
|
sys_script: {
|
|
51
50
|
async toShape(record, { transform }) {
|
package/src/claims-plugin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
-
import {
|
|
3
|
+
import { generateDeprecatedDiagnostics, validateClientSideScript } from './utils'
|
|
4
4
|
import { NowIncludeShape } from './now-include-plugin'
|
|
5
5
|
|
|
6
6
|
enum UITypeMapping {
|
|
@@ -44,7 +44,6 @@ const clientScriptAliases = {
|
|
|
44
44
|
*/
|
|
45
45
|
export const ClientScriptPlugin = Plugin.create({
|
|
46
46
|
name: 'ClientScriptPlugin',
|
|
47
|
-
docs: [createSdkDocEntry('ClientScript', ['sys_script_client'])],
|
|
48
47
|
records: {
|
|
49
48
|
sys_script_client: {
|
|
50
49
|
async toShape(record, { transform }) {
|
package/src/column-plugin.ts
CHANGED
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
getDefaultMaxLength,
|
|
10
10
|
} from './column/column-helper'
|
|
11
11
|
import { ModuleFunctionShape } from './server-module-plugin'
|
|
12
|
-
import { generateDeprecatedDiagnostics } from './utils'
|
|
13
|
-
import { create } from 'xmlbuilder2'
|
|
12
|
+
import { generateDeprecatedDiagnostics, generateChoiceSetFile } from './utils'
|
|
14
13
|
|
|
15
14
|
// BCP 47 language tag pattern: 2-3 letter base language with optional subtags (e.g., 'en', 'zh-Hans', 'en-US')
|
|
16
15
|
export const BCP47_LANGUAGE_TAG_PATTERN = /^[a-z]{2,3}(-[a-zA-Z0-9]{2,8})*$/
|
|
@@ -48,6 +47,9 @@ const columnAliases = {
|
|
|
48
47
|
referenceKey: ['reference_key'],
|
|
49
48
|
referenceQual: ['reference_qual'],
|
|
50
49
|
columnType: ['column_type'],
|
|
50
|
+
virtualType: ['virtual_type'],
|
|
51
|
+
useReferenceQualifier: ['use_reference_qualifier'],
|
|
52
|
+
dynamicRefQual: ['dynamic_ref_qual'],
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
const calculationAliases = {
|
|
@@ -66,7 +68,6 @@ const documentationAliases = {
|
|
|
66
68
|
|
|
67
69
|
export const ColumnPlugin = Plugin.create({
|
|
68
70
|
name: 'ColumnPlugin',
|
|
69
|
-
docs: [],
|
|
70
71
|
records: {
|
|
71
72
|
sys_choice: {
|
|
72
73
|
coalesce: ['name', 'element', 'value'],
|
|
@@ -92,48 +93,9 @@ export const ColumnPlugin = Plugin.create({
|
|
|
92
93
|
value: `sys_choice_${record.get('name').getValue()}_${record.get('element').getValue()}`,
|
|
93
94
|
}),
|
|
94
95
|
async toFile(choiceSet, { config, descendants, transform }) {
|
|
95
|
-
const tableName = choiceSet.get('name').asString().getValue()
|
|
96
|
-
const elementName = choiceSet.get('element').asString().getValue()
|
|
97
|
-
const xml = create().ele('record_update')
|
|
98
|
-
const root = xml.ele('sys_choice_set', { table: tableName, field: elementName })
|
|
99
|
-
descendants.query('sys_choice').forEach((choice) => {
|
|
100
|
-
const child = root.ele('sys_choice', { action: choice.getAction() })
|
|
101
|
-
child.ele('sys_id').txt(choice.getId().getValue())
|
|
102
|
-
child.ele('name').txt(tableName)
|
|
103
|
-
child.ele('element').txt(elementName)
|
|
104
|
-
|
|
105
|
-
for (const prop of [
|
|
106
|
-
'label',
|
|
107
|
-
'value',
|
|
108
|
-
'sequence',
|
|
109
|
-
'dependent_value',
|
|
110
|
-
'hint',
|
|
111
|
-
'inactive',
|
|
112
|
-
'inactive_on_update',
|
|
113
|
-
'language',
|
|
114
|
-
]) {
|
|
115
|
-
choice
|
|
116
|
-
.get(prop)
|
|
117
|
-
.ifDefined()
|
|
118
|
-
?.toString()
|
|
119
|
-
.pipe((p) => child.ele(prop).txt(p.getValue()))
|
|
120
|
-
}
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
const child = root.ele('sys_choice_set', { action: choiceSet.getAction() })
|
|
124
|
-
child.ele('sys_id').txt(choiceSet.getId().getValue())
|
|
125
|
-
child.ele('sys_scope', { display_value: config.scope }).txt(config.scopeId)
|
|
126
|
-
child.ele('name').txt(tableName)
|
|
127
|
-
child.ele('element').txt(elementName)
|
|
128
|
-
|
|
129
96
|
return {
|
|
130
97
|
success: true,
|
|
131
|
-
value:
|
|
132
|
-
source: choiceSet,
|
|
133
|
-
name: `${await transform.getUpdateName(choiceSet)}.xml`,
|
|
134
|
-
category: choiceSet.getInstallCategory(),
|
|
135
|
-
content: xml.end({ prettyPrint: true }),
|
|
136
|
-
},
|
|
98
|
+
value: await generateChoiceSetFile(choiceSet, descendants.query('sys_choice'), config, transform),
|
|
137
99
|
}
|
|
138
100
|
},
|
|
139
101
|
},
|
|
@@ -183,6 +145,17 @@ export const ColumnPlugin = Plugin.create({
|
|
|
183
145
|
)
|
|
184
146
|
}
|
|
185
147
|
const columnType = COLUMN_API_TO_TYPE[callee] ?? column.get('columnType').asString().getValue()
|
|
148
|
+
|
|
149
|
+
const dynamicRefQualShape = column.get('dynamicRefQual')
|
|
150
|
+
const dynamicRefQualRef =
|
|
151
|
+
dynamicRefQualShape.isString() && dynamicRefQualShape.getValue() !== ''
|
|
152
|
+
? await factory.createReference({
|
|
153
|
+
source: dynamicRefQualShape,
|
|
154
|
+
table: 'sys_filter_option_dynamic',
|
|
155
|
+
guid: dynamicRefQualShape,
|
|
156
|
+
})
|
|
157
|
+
: dynamicRefQualShape.ifDefined()
|
|
158
|
+
|
|
186
159
|
return {
|
|
187
160
|
success: true,
|
|
188
161
|
value: (
|
|
@@ -257,21 +230,27 @@ export const ColumnPlugin = Plugin.create({
|
|
|
257
230
|
)
|
|
258
231
|
})
|
|
259
232
|
.toCdata(),
|
|
260
|
-
choice: $.from('dropdown')
|
|
261
|
-
.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
)
|
|
266
|
-
.
|
|
233
|
+
choice: $.from('dropdown').map((d) => {
|
|
234
|
+
if (!d.isString()) {
|
|
235
|
+
return undefined
|
|
236
|
+
}
|
|
237
|
+
const idx = choiceDropdown.indexOf(d.getValue() as choiceDropdownType)
|
|
238
|
+
// Index 0 ('none') is the platform default — leave undefined so
|
|
239
|
+
// the install XML emits empty <choice/>, matching stock records.
|
|
240
|
+
return idx > 0 ? idx : undefined
|
|
241
|
+
}),
|
|
267
242
|
choice_table: $.from('dynamicValueDefinitions').map((dynamicValueDefinitions) =>
|
|
268
243
|
dynamicValueDefinitions.ifObject()?.get('type').ifString()?.getValue() ===
|
|
269
244
|
'choices_from_other_table'
|
|
270
245
|
? dynamicValueDefinitions.asObject().get('table').ifString()
|
|
271
246
|
: undefined
|
|
272
247
|
),
|
|
273
|
-
virtual: $.from('dynamicValueDefinitions')
|
|
274
|
-
.map((dynamicValueDefinitions) => {
|
|
248
|
+
virtual: $.from('dynamicValueDefinitions', 'formula')
|
|
249
|
+
.map((dynamicValueDefinitions, formula) => {
|
|
250
|
+
const hasFormula = formula.isString() && formula.getValue() !== ''
|
|
251
|
+
if (hasFormula) {
|
|
252
|
+
return true
|
|
253
|
+
}
|
|
275
254
|
const calculationType = dynamicValueDefinitions
|
|
276
255
|
.ifObject()
|
|
277
256
|
?.get('type')
|
|
@@ -371,10 +350,29 @@ export const ColumnPlugin = Plugin.create({
|
|
|
371
350
|
`readOnly cannot be false with readOnlyOption ${readOnlyOptionValue}.`
|
|
372
351
|
)
|
|
373
352
|
}
|
|
353
|
+
if (readOnlyValue === true && readOnlyOptionValue) {
|
|
354
|
+
diagnostics.hint(
|
|
355
|
+
readOnly,
|
|
356
|
+
`readOnly is unnecessary when readOnlyOption '${readOnlyOptionValue}' is declared.`
|
|
357
|
+
)
|
|
358
|
+
}
|
|
374
359
|
return readOnlyValue ?? !!readOnlyOptionValue
|
|
375
360
|
})
|
|
376
361
|
.def(false),
|
|
377
|
-
read_only_option
|
|
362
|
+
// Pair read_only_option with read_only so the platform's
|
|
363
|
+
// DictionaryReadOnlyOptionListener doesn't clear read_only on subsequent
|
|
364
|
+
// installs when it sees a previously-set option go to null.
|
|
365
|
+
read_only_option: $.from('readOnly', 'readOnlyOption').map(
|
|
366
|
+
(readOnly, readOnlyOption) => {
|
|
367
|
+
const opt = readOnlyOption.ifString()?.getValue()
|
|
368
|
+
if (opt) {
|
|
369
|
+
return opt
|
|
370
|
+
}
|
|
371
|
+
return readOnly.ifBoolean()?.getValue() === true
|
|
372
|
+
? 'instance_configured'
|
|
373
|
+
: undefined
|
|
374
|
+
}
|
|
375
|
+
),
|
|
378
376
|
reference: $.from('referenceTable'),
|
|
379
377
|
spell_check: $.from('spellCheck').toBoolean().def(false),
|
|
380
378
|
table_reference: $.from('tableReference').toBoolean().def(false),
|
|
@@ -382,6 +380,50 @@ export const ColumnPlugin = Plugin.create({
|
|
|
382
380
|
unique: $.toBoolean().def(false),
|
|
383
381
|
widget: $,
|
|
384
382
|
xml_view: $.from('xmlView').toBoolean().def(false),
|
|
383
|
+
formula: $.from('formula').toCdata(),
|
|
384
|
+
virtual_type: $.from('virtualType', 'formula')
|
|
385
|
+
.map((virtualType, formula) => {
|
|
386
|
+
const explicit = virtualType.ifString()?.getValue()
|
|
387
|
+
const hasFormula = formula.isString() && formula.getValue() !== ''
|
|
388
|
+
const derived = hasFormula ? 'formula' : 'script'
|
|
389
|
+
if (explicit && explicit !== derived) {
|
|
390
|
+
const reason = hasFormula
|
|
391
|
+
? `formula is set, implying 'formula'`
|
|
392
|
+
: `formula is not set, implying 'script'`
|
|
393
|
+
diagnostics.warn(
|
|
394
|
+
virtualType,
|
|
395
|
+
`virtualType is set to '${explicit}' but ${reason}. The explicit value '${explicit}' will be used.`
|
|
396
|
+
)
|
|
397
|
+
return explicit
|
|
398
|
+
}
|
|
399
|
+
return derived
|
|
400
|
+
})
|
|
401
|
+
.def('script'),
|
|
402
|
+
use_reference_qualifier: $.from('useReferenceQualifier', 'referenceQual')
|
|
403
|
+
.map((useReferenceQualifier, referenceQual) => {
|
|
404
|
+
const explicit = useReferenceQualifier.ifString()?.getValue()
|
|
405
|
+
const hasDynamic = !!dynamicRefQualRef
|
|
406
|
+
const hasRef = referenceQual.isString() && referenceQual.getValue() !== ''
|
|
407
|
+
const derived = hasDynamic ? 'dynamic' : hasRef ? 'advanced' : 'simple'
|
|
408
|
+
if (explicit && explicit !== derived) {
|
|
409
|
+
const reason =
|
|
410
|
+
hasDynamic && hasRef
|
|
411
|
+
? `both dynamicRefQual and referenceQual are set`
|
|
412
|
+
: hasDynamic
|
|
413
|
+
? `dynamicRefQual is set, implying 'dynamic'`
|
|
414
|
+
: hasRef
|
|
415
|
+
? `referenceQual is set, implying 'advanced'`
|
|
416
|
+
: `neither dynamicRefQual nor referenceQual is set, implying 'simple'`
|
|
417
|
+
diagnostics.warn(
|
|
418
|
+
useReferenceQualifier,
|
|
419
|
+
`useReferenceQualifier is set to '${explicit}' but ${reason}. The explicit value '${explicit}' will be used.`
|
|
420
|
+
)
|
|
421
|
+
return explicit
|
|
422
|
+
}
|
|
423
|
+
return derived
|
|
424
|
+
})
|
|
425
|
+
.def('simple'),
|
|
426
|
+
dynamic_ref_qual: $.val(dynamicRefQualRef),
|
|
385
427
|
})),
|
|
386
428
|
})
|
|
387
429
|
).with(...documentationRecords, ...choiceRecords, ...choiceSetRecords),
|
|
@@ -559,31 +601,40 @@ export function columnToCallExpression(
|
|
|
559
601
|
return dropdownIndex !== -1 ? choiceDropdown[dropdownIndex] : undefined
|
|
560
602
|
})
|
|
561
603
|
.def('none'),
|
|
562
|
-
dynamicValueDefinitions: $.from(
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
604
|
+
dynamicValueDefinitions: $.from(
|
|
605
|
+
'calculation',
|
|
606
|
+
'choice_table',
|
|
607
|
+
'choice_field',
|
|
608
|
+
'virtual_type',
|
|
609
|
+
'virtual'
|
|
610
|
+
).map((calculation, choiceTable, choiceField, virtualType, virtual) => {
|
|
611
|
+
// Server only reads calculation when virtual_type='script' and virtual=true
|
|
612
|
+
const vType = virtualType.ifString()?.getValue()
|
|
613
|
+
const isVirtual = virtual.ifBoolean()?.getValue() ?? virtual.ifString()?.getValue() === 'true'
|
|
614
|
+
if (
|
|
615
|
+
isVirtual &&
|
|
616
|
+
vType !== 'formula' &&
|
|
617
|
+
calculation.ifString()?.getValue() &&
|
|
618
|
+
calculation.asString().getValue() !== DEFAULT_COLUMN_CALCULATION
|
|
619
|
+
) {
|
|
620
|
+
return new ObjectShape({
|
|
621
|
+
source: calculation,
|
|
622
|
+
properties: {
|
|
623
|
+
type: 'calculated_value',
|
|
624
|
+
calculatedValue: calculation,
|
|
625
|
+
},
|
|
626
|
+
}).withAliasedKeys(calculationAliases)
|
|
627
|
+
}
|
|
628
|
+
if (choiceTable.ifString()?.getValue() && choiceField.ifString()?.getValue()) {
|
|
629
|
+
return {
|
|
630
|
+
type: 'choices_from_other_table',
|
|
631
|
+
table: choiceTable.asString().getValue(),
|
|
632
|
+
field: choiceField.asString().getValue(),
|
|
582
633
|
}
|
|
583
|
-
|
|
584
|
-
return undefined
|
|
585
634
|
}
|
|
586
|
-
|
|
635
|
+
|
|
636
|
+
return undefined
|
|
637
|
+
}),
|
|
587
638
|
// Direct dependent parameter for DocumentIdColumn, TemplateValueColumn, and FieldListColumn
|
|
588
639
|
dependent: $.from('dependent').map((dependent) => {
|
|
589
640
|
if (dependent?.isString()) {
|
|
@@ -645,6 +696,42 @@ export function columnToCallExpression(
|
|
|
645
696
|
unique: $.toBoolean().def(false),
|
|
646
697
|
widget: $.def(''),
|
|
647
698
|
xmlView: $.from('xml_view').toBoolean().def(false),
|
|
699
|
+
formula: $.from('virtual_type', 'formula').map((virtualType, formula) => {
|
|
700
|
+
// Server only reads formula when virtual_type='formula'
|
|
701
|
+
if (virtualType.ifString()?.getValue() !== 'formula') {
|
|
702
|
+
return undefined
|
|
703
|
+
}
|
|
704
|
+
return formula.ifString()?.ifNotEmpty()
|
|
705
|
+
}),
|
|
706
|
+
virtualType: $.from('virtual_type', 'formula').map((virtualType, formula) => {
|
|
707
|
+
const qualifier = virtualType.ifString()?.getValue()
|
|
708
|
+
const hasFormula = formula.isString() && formula.getValue() !== ''
|
|
709
|
+
if (hasFormula && qualifier === 'formula') {
|
|
710
|
+
return undefined
|
|
711
|
+
}
|
|
712
|
+
if (!hasFormula && (!qualifier || qualifier === 'script')) {
|
|
713
|
+
return undefined
|
|
714
|
+
}
|
|
715
|
+
return qualifier
|
|
716
|
+
}),
|
|
717
|
+
useReferenceQualifier: $.from('use_reference_qualifier', 'dynamic_ref_qual', 'reference_qual').map(
|
|
718
|
+
(useReferenceQualifier, dynamicRefQual, referenceQual) => {
|
|
719
|
+
const qualifier = useReferenceQualifier.ifString()?.getValue()
|
|
720
|
+
const hasDynamicRefQual = dynamicRefQual.isString() && dynamicRefQual.getValue() !== ''
|
|
721
|
+
const hasReferenceQual = referenceQual.isString() && referenceQual.getValue() !== ''
|
|
722
|
+
if (hasDynamicRefQual && qualifier === 'dynamic') {
|
|
723
|
+
return undefined
|
|
724
|
+
}
|
|
725
|
+
if (hasReferenceQual && qualifier === 'advanced') {
|
|
726
|
+
return undefined
|
|
727
|
+
}
|
|
728
|
+
if (!hasDynamicRefQual && !hasReferenceQual && (!qualifier || qualifier === 'simple')) {
|
|
729
|
+
return undefined
|
|
730
|
+
}
|
|
731
|
+
return qualifier
|
|
732
|
+
}
|
|
733
|
+
),
|
|
734
|
+
dynamicRefQual: $.from('dynamic_ref_qual').def(''),
|
|
648
735
|
}))
|
|
649
736
|
.withAliasedKeys(columnAliases),
|
|
650
737
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
-
import {
|
|
3
|
+
import { generateDeprecatedDiagnostics } from './utils'
|
|
4
4
|
|
|
5
5
|
const crossScopeAliases = {
|
|
6
6
|
targetName: ['target_name'],
|
|
@@ -23,7 +23,6 @@ const crossScopeAliases = {
|
|
|
23
23
|
*/
|
|
24
24
|
export const CrossScopePrivilegePlugin = Plugin.create({
|
|
25
25
|
name: 'CrossScopePrivilegePlugin',
|
|
26
|
-
docs: [createSdkDocEntry('CrossScopePrivilege', ['sys_scope_privilege'])],
|
|
27
26
|
records: {
|
|
28
27
|
sys_scope_privilege: {
|
|
29
28
|
relationships: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, type ObjectShape, Plugin, type Record as RecordType } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from '../now-id-plugin'
|
|
3
3
|
import { resolveComponentToSysId, resolveComponentToName } from './dashboard-component-resolver'
|
|
4
|
-
import { createSdkDocEntry } from '../utils'
|
|
5
4
|
import { DEFAULT_PROPERTY_VALUES, removeRestrictedValues } from './dashboard-component-property-defaults'
|
|
6
5
|
|
|
7
6
|
const transformWidget = (widget: RecordType) =>
|
|
@@ -56,7 +55,6 @@ const createWidgetProperties = (widgetData: ObjectShape, canvas: ObjectShape) =>
|
|
|
56
55
|
*/
|
|
57
56
|
export const DashboardPlugin = Plugin.create({
|
|
58
57
|
name: 'DashboardPlugin',
|
|
59
|
-
docs: [createSdkDocEntry('Dashboard', ['par_dashboard'])],
|
|
60
58
|
records: {
|
|
61
59
|
par_dashboard: {
|
|
62
60
|
relationships: {
|