@servicenow/sdk-build-plugins 4.4.0 → 4.5.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 +54 -4
- package/dist/acl-plugin.js.map +1 -1
- package/dist/applicability-plugin.js +2 -0
- package/dist/applicability-plugin.js.map +1 -1
- package/dist/application-menu-plugin.js +2 -0
- package/dist/application-menu-plugin.js.map +1 -1
- package/dist/arrow-function-plugin.d.ts +6 -1
- package/dist/arrow-function-plugin.js +105 -12
- package/dist/arrow-function-plugin.js.map +1 -1
- package/dist/atf/test-plugin.js +2 -0
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +20 -0
- package/dist/basic-syntax-plugin.js.map +1 -1
- package/dist/call-expression-plugin.js +1 -0
- package/dist/call-expression-plugin.js.map +1 -1
- package/dist/claims-plugin.js +1 -0
- package/dist/claims-plugin.js.map +1 -1
- package/dist/client-script-plugin.js +1 -0
- package/dist/client-script-plugin.js.map +1 -1
- package/dist/column-plugin.js +1 -0
- package/dist/column-plugin.js.map +1 -1
- package/dist/cross-scope-privilege-plugin.js +1 -0
- package/dist/cross-scope-privilege-plugin.js.map +1 -1
- package/dist/dashboard/dashboard-plugin.js +2 -0
- package/dist/dashboard/dashboard-plugin.js.map +1 -1
- package/dist/data-plugin.js +1 -0
- package/dist/data-plugin.js.map +1 -1
- package/dist/email-notification-plugin.js +9 -13
- package/dist/email-notification-plugin.js.map +1 -1
- package/dist/flow/constants/flow-plugin-constants.d.ts +1 -1
- package/dist/flow/constants/flow-plugin-constants.js +1 -1
- package/dist/flow/constants/flow-plugin-constants.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +82 -2
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +48 -40
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin.js +1 -0
- package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
- package/dist/flow/plugins/approval-rules-plugin.js +1 -0
- package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-action-definition-plugin.js +4 -2
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-data-pill-plugin.js +1 -0
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-definition-plugin.js +8 -3
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-diagnostics-plugin.js +1 -0
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-instance-plugin.js +68 -12
- package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-trigger-instance-plugin.js +1 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/inline-script-plugin.js +1 -0
- package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
- package/dist/flow/plugins/step-definition-plugin.js +3 -2
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/step-instance-plugin.js +1 -0
- package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/trigger-plugin.js +2 -0
- package/dist/flow/plugins/trigger-plugin.js.map +1 -1
- package/dist/flow/plugins/wfa-datapill-plugin.js +1 -0
- package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
- package/dist/flow/post-install.d.ts +2 -0
- package/dist/flow/post-install.js +58 -0
- package/dist/flow/post-install.js.map +1 -0
- package/dist/flow/utils/complex-objects.js +4 -2
- package/dist/flow/utils/complex-objects.js.map +1 -1
- package/dist/flow/utils/flow-constants.d.ts +24 -0
- package/dist/flow/utils/flow-constants.js +29 -2
- package/dist/flow/utils/flow-constants.js.map +1 -1
- package/dist/flow/utils/flow-to-xml.d.ts +3 -2
- package/dist/flow/utils/flow-to-xml.js +3 -4
- package/dist/flow/utils/flow-to-xml.js.map +1 -1
- package/dist/flow/utils/label-cache-processor.d.ts +5 -0
- package/dist/flow/utils/label-cache-processor.js +14 -2
- package/dist/flow/utils/label-cache-processor.js.map +1 -1
- package/dist/flow/utils/service-catalog.js +5 -1
- package/dist/flow/utils/service-catalog.js.map +1 -1
- package/dist/form-plugin.d.ts +2 -0
- package/dist/form-plugin.js +1134 -0
- package/dist/form-plugin.js.map +1 -0
- package/dist/html-import-plugin.js +1 -0
- package/dist/html-import-plugin.js.map +1 -1
- package/dist/import-sets-plugin.js +2 -0
- package/dist/import-sets-plugin.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-scan-plugin.d.ts +2 -0
- package/dist/instance-scan-plugin.js +298 -0
- package/dist/instance-scan-plugin.js.map +1 -0
- package/dist/json-plugin.js +1 -0
- package/dist/json-plugin.js.map +1 -1
- package/dist/list-plugin.js +1 -0
- package/dist/list-plugin.js.map +1 -1
- package/dist/now-attach-plugin.js +1 -0
- package/dist/now-attach-plugin.js.map +1 -1
- package/dist/now-config-plugin.js +659 -51
- package/dist/now-config-plugin.js.map +1 -1
- package/dist/now-id-plugin.js +1 -0
- package/dist/now-id-plugin.js.map +1 -1
- package/dist/now-include-plugin.js +1 -0
- package/dist/now-include-plugin.js.map +1 -1
- package/dist/now-ref-plugin.js +1 -0
- package/dist/now-ref-plugin.js.map +1 -1
- package/dist/now-unresolved-plugin.js +1 -0
- package/dist/now-unresolved-plugin.js.map +1 -1
- package/dist/package-json-plugin.js +1 -0
- package/dist/package-json-plugin.js.map +1 -1
- package/dist/property-plugin.js +3 -1
- package/dist/property-plugin.js.map +1 -1
- package/dist/record-plugin.d.ts +30 -0
- package/dist/record-plugin.js +37 -1
- package/dist/record-plugin.js.map +1 -1
- package/dist/repack/lint/Rules.d.ts +11 -2
- package/dist/repack/lint/Rules.js +160 -16
- package/dist/repack/lint/Rules.js.map +1 -1
- package/dist/repack/lint/index.d.ts +10 -5
- package/dist/repack/lint/index.js +76 -50
- package/dist/repack/lint/index.js.map +1 -1
- package/dist/rest-api-plugin.js +14 -0
- package/dist/rest-api-plugin.js.map +1 -1
- package/dist/role-plugin.js +1 -0
- package/dist/role-plugin.js.map +1 -1
- package/dist/schedule-script/index.d.ts +1 -0
- package/dist/schedule-script/index.js +18 -0
- package/dist/schedule-script/index.js.map +1 -0
- package/dist/schedule-script/scheduled-script-plugin.d.ts +2 -0
- package/dist/schedule-script/scheduled-script-plugin.js +551 -0
- package/dist/schedule-script/scheduled-script-plugin.js.map +1 -0
- package/dist/schedule-script/timeZoneConverter.d.ts +61 -0
- package/dist/schedule-script/timeZoneConverter.js +170 -0
- package/dist/schedule-script/timeZoneConverter.js.map +1 -0
- package/dist/script-action-plugin.js +2 -0
- package/dist/script-action-plugin.js.map +1 -1
- package/dist/script-include-plugin.js +2 -0
- package/dist/script-include-plugin.js.map +1 -1
- package/dist/server-module-plugin/index.js +13 -2
- package/dist/server-module-plugin/index.js.map +1 -1
- package/dist/service-catalog/catalog-clientscript-plugin.js +2 -0
- package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-item-plugin.js +2 -0
- package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-ui-policy-plugin.js +2 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
- package/dist/service-catalog/sc-record-producer-plugin.js +2 -0
- package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
- package/dist/service-catalog/service-catalog-diagnostics.d.ts +6 -0
- package/dist/service-catalog/service-catalog-diagnostics.js +20 -0
- package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -1
- package/dist/service-catalog/shape-to-record.js +7 -2
- package/dist/service-catalog/shape-to-record.js.map +1 -1
- package/dist/service-catalog/variable-set-plugin.js +2 -0
- package/dist/service-catalog/variable-set-plugin.js.map +1 -1
- package/dist/service-portal/angular-provider-plugin.js +2 -0
- package/dist/service-portal/angular-provider-plugin.js.map +1 -1
- package/dist/service-portal/dependency-plugin.js +5 -31
- package/dist/service-portal/dependency-plugin.js.map +1 -1
- package/dist/service-portal/menu-plugin.d.ts +2 -0
- package/dist/service-portal/menu-plugin.js +353 -0
- package/dist/service-portal/menu-plugin.js.map +1 -0
- package/dist/service-portal/page-plugin.d.ts +2 -0
- package/dist/service-portal/page-plugin.js +702 -0
- package/dist/service-portal/page-plugin.js.map +1 -0
- package/dist/service-portal/portal-plugin.d.ts +2 -0
- package/dist/service-portal/portal-plugin.js +296 -0
- package/dist/service-portal/portal-plugin.js.map +1 -0
- package/dist/service-portal/theme-plugin.d.ts +2 -0
- package/dist/service-portal/theme-plugin.js +112 -0
- package/dist/service-portal/theme-plugin.js.map +1 -0
- package/dist/service-portal/utils.d.ts +8 -0
- package/dist/service-portal/utils.js +50 -0
- package/dist/service-portal/utils.js.map +1 -0
- package/dist/service-portal/widget-plugin.js +45 -8
- package/dist/service-portal/widget-plugin.js.map +1 -1
- package/dist/sla-plugin.js +2 -0
- package/dist/sla-plugin.js.map +1 -1
- package/dist/static-content-plugin.js +1 -0
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +1 -0
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-action-plugin.js +2 -0
- package/dist/ui-action-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +33 -8
- package/dist/ui-page-plugin.js.map +1 -1
- package/dist/ui-policy-plugin.js +1 -0
- package/dist/ui-policy-plugin.js.map +1 -1
- package/dist/user-preference-plugin.js +2 -0
- package/dist/user-preference-plugin.js.map +1 -1
- package/dist/utils.d.ts +20 -2
- package/dist/utils.js +34 -3
- package/dist/utils.js.map +1 -1
- package/dist/ux-list-menu-config-plugin.js +2 -0
- package/dist/ux-list-menu-config-plugin.js.map +1 -1
- package/dist/view-plugin.js +1 -0
- package/dist/view-plugin.js.map +1 -1
- package/dist/workspace-plugin.js +2 -0
- package/dist/workspace-plugin.js.map +1 -1
- package/package.json +10 -11
- package/src/_types/eslint-community-eslint-utils.d.ts +15 -0
- package/src/acl-plugin.ts +97 -8
- package/src/applicability-plugin.ts +2 -0
- package/src/application-menu-plugin.ts +2 -0
- package/src/arrow-function-plugin.ts +128 -13
- package/src/atf/test-plugin.ts +2 -0
- package/src/basic-syntax-plugin.ts +21 -0
- package/src/call-expression-plugin.ts +1 -0
- package/src/claims-plugin.ts +1 -0
- package/src/client-script-plugin.ts +2 -1
- package/src/column-plugin.ts +1 -0
- package/src/cross-scope-privilege-plugin.ts +2 -1
- package/src/dashboard/dashboard-plugin.ts +2 -0
- package/src/data-plugin.ts +1 -0
- package/src/email-notification-plugin.ts +3 -23
- package/src/flow/constants/flow-plugin-constants.ts +1 -1
- package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +47 -45
- package/src/flow/flow-logic/flow-logic-plugin.ts +1 -0
- package/src/flow/plugins/approval-rules-plugin.ts +1 -0
- package/src/flow/plugins/flow-action-definition-plugin.ts +4 -2
- package/src/flow/plugins/flow-data-pill-plugin.ts +1 -0
- package/src/flow/plugins/flow-definition-plugin.ts +10 -4
- package/src/flow/plugins/flow-diagnostics-plugin.ts +1 -0
- package/src/flow/plugins/flow-instance-plugin.ts +103 -14
- package/src/flow/plugins/flow-trigger-instance-plugin.ts +1 -0
- package/src/flow/plugins/inline-script-plugin.ts +1 -0
- package/src/flow/plugins/step-definition-plugin.ts +3 -2
- package/src/flow/plugins/step-instance-plugin.ts +1 -0
- package/src/flow/plugins/trigger-plugin.ts +2 -0
- package/src/flow/plugins/wfa-datapill-plugin.ts +1 -0
- package/src/flow/post-install.ts +92 -0
- package/src/flow/utils/complex-objects.ts +10 -2
- package/src/flow/utils/flow-constants.ts +30 -1
- package/src/flow/utils/flow-to-xml.ts +4 -4
- package/src/flow/utils/label-cache-processor.ts +14 -2
- package/src/flow/utils/service-catalog.ts +5 -2
- package/src/form-plugin.ts +1411 -0
- package/src/html-import-plugin.ts +1 -0
- package/src/import-sets-plugin.ts +2 -0
- package/src/index.ts +9 -0
- package/src/instance-scan-plugin.ts +318 -0
- package/src/json-plugin.ts +1 -0
- package/src/list-plugin.ts +2 -1
- package/src/now-attach-plugin.ts +1 -0
- package/src/now-config-plugin.ts +833 -53
- package/src/now-id-plugin.ts +1 -0
- package/src/now-include-plugin.ts +1 -0
- package/src/now-ref-plugin.ts +1 -0
- package/src/now-unresolved-plugin.ts +1 -0
- package/src/package-json-plugin.ts +1 -0
- package/src/property-plugin.ts +3 -1
- package/src/record-plugin.ts +42 -2
- package/src/repack/lint/Rules.ts +171 -22
- package/src/repack/lint/index.ts +80 -56
- package/src/rest-api-plugin.ts +21 -1
- package/src/role-plugin.ts +2 -1
- package/src/schedule-script/index.ts +1 -0
- package/src/schedule-script/scheduled-script-plugin.ts +679 -0
- package/src/schedule-script/timeZoneConverter.ts +188 -0
- package/src/script-action-plugin.ts +2 -0
- package/src/script-include-plugin.ts +2 -0
- package/src/server-module-plugin/index.ts +14 -2
- package/src/service-catalog/catalog-clientscript-plugin.ts +2 -0
- package/src/service-catalog/catalog-item-plugin.ts +2 -0
- package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -0
- package/src/service-catalog/sc-record-producer-plugin.ts +2 -0
- package/src/service-catalog/service-catalog-diagnostics.ts +30 -0
- package/src/service-catalog/shape-to-record.ts +8 -2
- package/src/service-catalog/variable-set-plugin.ts +2 -0
- package/src/service-portal/angular-provider-plugin.ts +2 -0
- package/src/service-portal/dependency-plugin.ts +6 -53
- package/src/service-portal/menu-plugin.ts +435 -0
- package/src/service-portal/page-plugin.ts +830 -0
- package/src/service-portal/portal-plugin.ts +319 -0
- package/src/service-portal/theme-plugin.ts +135 -0
- package/src/service-portal/utils.ts +69 -0
- package/src/service-portal/widget-plugin.ts +79 -9
- package/src/sla-plugin.ts +2 -0
- package/src/static-content-plugin.ts +1 -0
- package/src/table-plugin.ts +2 -1
- package/src/ui-action-plugin.ts +2 -0
- package/src/ui-page-plugin.ts +34 -8
- package/src/ui-policy-plugin.ts +2 -1
- package/src/user-preference-plugin.ts +2 -0
- package/src/utils.ts +42 -2
- package/src/ux-list-menu-config-plugin.ts +2 -0
- package/src/view-plugin.ts +1 -0
- package/src/workspace-plugin.ts +2 -0
- package/src/_types/eslint-plugin-es-x.d.ts +0 -17
package/src/atf/test-plugin.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from '@servicenow/sdk-build-core'
|
|
20
20
|
import { NowIdShape } from '../now-id-plugin'
|
|
21
21
|
import { ArrowFunctionShape } from '../arrow-function-plugin'
|
|
22
|
+
import { createSdkDocEntry } from '../utils'
|
|
22
23
|
import { create } from 'xmlbuilder2'
|
|
23
24
|
import { Test } from '@servicenow/sdk-core/runtime/app'
|
|
24
25
|
import {
|
|
@@ -33,6 +34,7 @@ import type { Duration } from '@servicenow/sdk/core'
|
|
|
33
34
|
|
|
34
35
|
export const TestPlugin = Plugin.create({
|
|
35
36
|
name: 'TestPlugin',
|
|
37
|
+
docs: [createSdkDocEntry('Test', ['sys_atf_test'])],
|
|
36
38
|
records: {
|
|
37
39
|
sys_atf_test: {
|
|
38
40
|
relationships: {
|
|
@@ -30,9 +30,11 @@ import {
|
|
|
30
30
|
} from '@servicenow/sdk-build-core'
|
|
31
31
|
import { isDataHelper } from './data-plugin'
|
|
32
32
|
import { getCallExpressionName } from './utils'
|
|
33
|
+
import { NowIncludePlugin, NowIncludeShape } from './now-include-plugin'
|
|
33
34
|
|
|
34
35
|
export const BasicSyntaxPlugin = Plugin.create({
|
|
35
36
|
name: 'BasicSyntaxPlugin',
|
|
37
|
+
docs: [],
|
|
36
38
|
files: [
|
|
37
39
|
{
|
|
38
40
|
entryPoint: true,
|
|
@@ -309,6 +311,7 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
309
311
|
|
|
310
312
|
const propsToRetain = new Set<string>(['$meta'])
|
|
311
313
|
const propsToAdd: ts.PropertyAssignmentStructure[] = []
|
|
314
|
+
const nowIncludePropsToCommit = new Set<string>()
|
|
312
315
|
for (const [name, value] of shape.entries({ resolve: false })) {
|
|
313
316
|
const existingPropKey = [...shape.getAliases(name), name].find((aliasedKey) =>
|
|
314
317
|
existingNames.has(aliasedKey)
|
|
@@ -324,6 +327,9 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
324
327
|
|
|
325
328
|
await commit(value, existingNames.get(existingPropKey) as ts.Expression)
|
|
326
329
|
} else if (!value.equals(shape.getDefault(name))) {
|
|
330
|
+
if (value.is(NowIncludeShape)) {
|
|
331
|
+
nowIncludePropsToCommit.add(name)
|
|
332
|
+
}
|
|
327
333
|
propsToAdd.push({
|
|
328
334
|
name: ObjectShape.quotePropertyNameIfNeeded(name),
|
|
329
335
|
initializer: value.getCode(),
|
|
@@ -338,6 +344,15 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
338
344
|
target.addPropertyAssignments(propsToAdd)
|
|
339
345
|
}
|
|
340
346
|
|
|
347
|
+
// commit Now.include props to generate the include file.
|
|
348
|
+
for (const prop of nowIncludePropsToCommit) {
|
|
349
|
+
const includeInitializer = target
|
|
350
|
+
.getPropertyOrThrow(prop)
|
|
351
|
+
.asKindOrThrow(ts.SyntaxKind.PropertyAssignment)
|
|
352
|
+
.getInitializerOrThrow()
|
|
353
|
+
await commit(shape.get(prop, false), includeInitializer, NowIncludePlugin)
|
|
354
|
+
}
|
|
355
|
+
|
|
341
356
|
const propsToRemove = [...existingNames.keys()].filter((key) => !propsToRetain.has(key))
|
|
342
357
|
propsToRemove.forEach((prop) => {
|
|
343
358
|
target.getProperty(prop)?.asKindOrThrow(ts.SyntaxKind.PropertyAssignment).remove()
|
|
@@ -544,6 +559,12 @@ export const BasicSyntaxPlugin = Plugin.create({
|
|
|
544
559
|
return transform.toShape(node.getExpression())
|
|
545
560
|
},
|
|
546
561
|
},
|
|
562
|
+
{
|
|
563
|
+
node: 'ParenthesizedExpression',
|
|
564
|
+
toShape(node, { transform }) {
|
|
565
|
+
return transform.toShape(node.getExpression())
|
|
566
|
+
},
|
|
567
|
+
},
|
|
547
568
|
{
|
|
548
569
|
node: 'Identifier',
|
|
549
570
|
async toShape(node, { 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 { generateDeprecatedDiagnostics, validateClientSideScript } from './utils'
|
|
3
|
+
import { createSdkDocEntry, generateDeprecatedDiagnostics, validateClientSideScript } from './utils'
|
|
4
4
|
import { NowIncludeShape } from './now-include-plugin'
|
|
5
5
|
|
|
6
6
|
enum UITypeMapping {
|
|
@@ -44,6 +44,7 @@ const clientScriptAliases = {
|
|
|
44
44
|
*/
|
|
45
45
|
export const ClientScriptPlugin = Plugin.create({
|
|
46
46
|
name: 'ClientScriptPlugin',
|
|
47
|
+
docs: [createSdkDocEntry('ClientScript', ['sys_script_client'])],
|
|
47
48
|
records: {
|
|
48
49
|
sys_script_client: {
|
|
49
50
|
async toShape(record, { transform }) {
|
package/src/column-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 { generateDeprecatedDiagnostics } from './utils'
|
|
3
|
+
import { createSdkDocEntry, generateDeprecatedDiagnostics } from './utils'
|
|
4
4
|
|
|
5
5
|
const crossScopeAliases = {
|
|
6
6
|
targetName: ['target_name'],
|
|
@@ -23,6 +23,7 @@ const crossScopeAliases = {
|
|
|
23
23
|
*/
|
|
24
24
|
export const CrossScopePrivilegePlugin = Plugin.create({
|
|
25
25
|
name: 'CrossScopePrivilegePlugin',
|
|
26
|
+
docs: [createSdkDocEntry('CrossScopePrivilege', ['sys_scope_privilege'])],
|
|
26
27
|
records: {
|
|
27
28
|
sys_scope_privilege: {
|
|
28
29
|
relationships: {
|
|
@@ -1,6 +1,7 @@
|
|
|
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'
|
|
4
5
|
import { DEFAULT_PROPERTY_VALUES, removeRestrictedValues } from './dashboard-component-property-defaults'
|
|
5
6
|
|
|
6
7
|
const transformWidget = (widget: RecordType) =>
|
|
@@ -55,6 +56,7 @@ const createWidgetProperties = (widgetData: ObjectShape, canvas: ObjectShape) =>
|
|
|
55
56
|
*/
|
|
56
57
|
export const DashboardPlugin = Plugin.create({
|
|
57
58
|
name: 'DashboardPlugin',
|
|
59
|
+
docs: [createSdkDocEntry('Dashboard', ['par_dashboard'])],
|
|
58
60
|
records: {
|
|
59
61
|
par_dashboard: {
|
|
60
62
|
relationships: {
|
package/src/data-plugin.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CallExpressionShape,
|
|
3
|
-
Plugin,
|
|
4
|
-
isGUID,
|
|
5
|
-
Shape,
|
|
6
|
-
type ObjectShape,
|
|
7
|
-
type Diagnostics,
|
|
8
|
-
} from '@servicenow/sdk-build-core'
|
|
1
|
+
import { CallExpressionShape, Plugin, isGUID, Shape, type ObjectShape } from '@servicenow/sdk-build-core'
|
|
9
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
+
import { showGuidFieldDiagnostic, createSdkDocEntry } from './utils'
|
|
10
4
|
import type { EmailNotification } from '@servicenow/sdk-core/runtime/notification'
|
|
11
5
|
|
|
12
6
|
// Use index access types instead of exported utility types
|
|
@@ -59,23 +53,9 @@ const isValidEmail = (email: string): boolean => {
|
|
|
59
53
|
return emailRegex.test(email)
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
const showGuidFieldDiagnostic = (
|
|
63
|
-
inputReceived: Shape | undefined,
|
|
64
|
-
fieldName: string,
|
|
65
|
-
tableName: string,
|
|
66
|
-
diagnostics: Diagnostics
|
|
67
|
-
) => {
|
|
68
|
-
if (inputReceived) {
|
|
69
|
-
const receivedValue = inputReceived.getValue()
|
|
70
|
-
diagnostics.error(
|
|
71
|
-
inputReceived,
|
|
72
|
-
`'${fieldName}' must be a valid GUID or a Record<'${tableName}'>. Received: '${receivedValue}'`
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
56
|
export const EmailNotificationPlugin = Plugin.create({
|
|
78
57
|
name: 'EmailNotificationPlugin',
|
|
58
|
+
docs: [createSdkDocEntry('EmailNotification', ['sysevent_email_action'])],
|
|
79
59
|
records: {
|
|
80
60
|
sysevent_email_action: {
|
|
81
61
|
toShape(record) {
|
|
@@ -130,7 +130,7 @@ type FlowLogicParseResult =
|
|
|
130
130
|
* FlowLogicValueInput objects with name/value pairs that represent the
|
|
131
131
|
* original TypeScript configuration properties.
|
|
132
132
|
*/
|
|
133
|
-
namespace FlowLogicValueProcessor {
|
|
133
|
+
export namespace FlowLogicValueProcessor {
|
|
134
134
|
/**
|
|
135
135
|
* Generic factory function for creating flow logic entry objects.
|
|
136
136
|
* All entry types (AssignSubflowOutput, SetFlowVariablesInput, FlowLogicValueInput)
|
|
@@ -766,8 +766,6 @@ namespace FlowLogicValueProcessor {
|
|
|
766
766
|
// Constants for type handling
|
|
767
767
|
const ARRAY_TYPE_PREFIX = 'array.' as const
|
|
768
768
|
const ARRAY_TYPE_PREFIX_LENGTH = ARRAY_TYPE_PREFIX.length
|
|
769
|
-
const EXCLUDED_TYPE_ANNOTATIONS = new Set(['string', 'glide_date_time'])
|
|
770
|
-
|
|
771
769
|
/**
|
|
772
770
|
* Interface for child entry structure used in parsing
|
|
773
771
|
*/
|
|
@@ -829,50 +827,29 @@ namespace FlowLogicValueProcessor {
|
|
|
829
827
|
return value
|
|
830
828
|
}
|
|
831
829
|
|
|
832
|
-
/**
|
|
833
|
-
* Adds type annotation to a datapill if needed based on label cache
|
|
834
|
-
* @param pillName - Datapill name without braces
|
|
835
|
-
* @param labelCacheMap - Map of datapill names to types
|
|
836
|
-
* @returns Datapill with annotation if applicable
|
|
837
|
-
*/
|
|
838
|
-
function addTypeAnnotationIfNeeded(pillName: string, labelCacheMap?: Map<string, string>): string {
|
|
839
|
-
if (!labelCacheMap) {
|
|
840
|
-
return `{{${pillName}}}`
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
const cachedType = labelCacheMap.get(pillName.trim())
|
|
844
|
-
if (cachedType && !EXCLUDED_TYPE_ANNOTATIONS.has(cachedType)) {
|
|
845
|
-
return `{{${pillName}|${cachedType}}}`
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
return `{{${pillName}}}`
|
|
849
|
-
}
|
|
850
|
-
|
|
851
830
|
/**
|
|
852
831
|
* Processes a pure datapill value (starts and ends with {{}})
|
|
832
|
+
* Strips any existing |type annotation and returns a clean datapill.
|
|
833
|
+
* Type info is preserved via labelCacheMap in wrapWithWfaDataPillExpression downstream.
|
|
853
834
|
* @param value - Pure datapill string
|
|
854
|
-
* @param
|
|
855
|
-
* @returns
|
|
835
|
+
* @param _labelCacheMap - Unused (type resolution handled downstream by transformDataPill)
|
|
836
|
+
* @returns Clean datapill without type annotation
|
|
856
837
|
*/
|
|
857
|
-
function processPureDatapill(value: string,
|
|
858
|
-
|
|
859
|
-
const pillName = strippedValue.slice(2, -2) // Remove {{ and }}
|
|
860
|
-
return addTypeAnnotationIfNeeded(pillName, labelCacheMap)
|
|
838
|
+
function processPureDatapill(value: string, _labelCacheMap?: Map<string, string>): string {
|
|
839
|
+
return stripDatapillTypeAnnotation(value)
|
|
861
840
|
}
|
|
862
841
|
|
|
863
842
|
/**
|
|
864
|
-
* Processes a template expression containing datapills mixed with text
|
|
843
|
+
* Processes a template expression containing datapills mixed with text.
|
|
844
|
+
* Strips any existing |type annotations and returns clean datapills.
|
|
845
|
+
* Type info is preserved via labelCacheMap in wrapWithWfaDataPillExpression downstream.
|
|
865
846
|
* @param value - Template expression string
|
|
866
|
-
* @param
|
|
867
|
-
* @returns Processed template with type annotations
|
|
847
|
+
* @param _labelCacheMap - Unused (type resolution handled downstream by transformDataPill)
|
|
848
|
+
* @returns Processed template with type annotations stripped from datapills
|
|
868
849
|
*/
|
|
869
|
-
function processTemplateExpression(value: string,
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
const datapillRegex = /\{\{([^}|]+)(?:\|[^}]+)?\}\}/g
|
|
875
|
-
return value.replace(datapillRegex, (_match, pillName) => addTypeAnnotationIfNeeded(pillName, labelCacheMap))
|
|
850
|
+
function processTemplateExpression(value: string, _labelCacheMap?: Map<string, string>): string {
|
|
851
|
+
const datapillRegex = /\{\{([^}|]+)\|[^}]+\}\}/g
|
|
852
|
+
return value.replace(datapillRegex, '{{$1}}')
|
|
876
853
|
}
|
|
877
854
|
|
|
878
855
|
/**
|
|
@@ -972,12 +949,26 @@ namespace FlowLogicValueProcessor {
|
|
|
972
949
|
if (parsed.complexObjectSchema) {
|
|
973
950
|
// Find the $COCollectionField.$type_facets
|
|
974
951
|
for (const schemaKey in parsed.complexObjectSchema) {
|
|
952
|
+
// Skip top-level $type_facets entries (handled as fallback below)
|
|
953
|
+
if (schemaKey.endsWith('.$type_facets')) {
|
|
954
|
+
continue
|
|
955
|
+
}
|
|
975
956
|
const schema = parsed.complexObjectSchema[schemaKey]
|
|
976
|
-
if (schema && schema.$COCollectionField
|
|
977
|
-
|
|
978
|
-
if (
|
|
979
|
-
const facetData = JSON.parse(
|
|
980
|
-
|
|
957
|
+
if (schema && schema.$COCollectionField) {
|
|
958
|
+
// Array.Object format: child_type nested as $COCollectionField.$type_facets
|
|
959
|
+
if (schema['$COCollectionField.$type_facets']?.SimpleMapFacet) {
|
|
960
|
+
const facetData = JSON.parse(schema['$COCollectionField.$type_facets'].SimpleMapFacet)
|
|
961
|
+
if (facetData.child_type) {
|
|
962
|
+
return facetData.child_type
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
// DEF0798866: Array.String format: child_type stored in top-level key "schemaKey.$type_facets"
|
|
966
|
+
const topLevelTypeFacets = parsed.complexObjectSchema[`${schemaKey}.$type_facets`]
|
|
967
|
+
if (topLevelTypeFacets?.SimpleMapFacet) {
|
|
968
|
+
const facetData = JSON.parse(topLevelTypeFacets.SimpleMapFacet)
|
|
969
|
+
if (facetData.child_type) {
|
|
970
|
+
return facetData.child_type
|
|
971
|
+
}
|
|
981
972
|
}
|
|
982
973
|
}
|
|
983
974
|
}
|
|
@@ -1081,8 +1072,15 @@ namespace FlowLogicValueProcessor {
|
|
|
1081
1072
|
const firstBaseName = getBaseName(childObj.name)
|
|
1082
1073
|
|
|
1083
1074
|
// Check if all children have the same base name (indicating FlowArray with repeated childName)
|
|
1075
|
+
// When elementType is defined (i.e., the schema identifies this as a FlowArray — Array.Object,
|
|
1076
|
+
// Array.String, Array.Integer, Array.DateTime, etc.), a single child is still a valid array
|
|
1077
|
+
// element: the child is the childName wrapper whose inner value/children are the actual element.
|
|
1078
|
+
// Without this, single-element FlowArray assignments fall into the object path, generating
|
|
1079
|
+
// { childName: { fields } } or { childName: value } instead of [{ fields }] or [value].
|
|
1080
|
+
// DEF0798866: single-element Array.Object/String subflow outputs generated incorrect Fluent code.
|
|
1081
|
+
const minChildrenForArray = elementType !== undefined ? 1 : 2
|
|
1084
1082
|
const allSameName =
|
|
1085
|
-
children.length
|
|
1083
|
+
children.length >= minChildrenForArray &&
|
|
1086
1084
|
children.every((c) => {
|
|
1087
1085
|
const entry = c as ChildEntry
|
|
1088
1086
|
return getBaseName(entry.name) === firstBaseName
|
|
@@ -1525,7 +1523,11 @@ namespace FlowLogicValueProcessor {
|
|
|
1525
1523
|
// Ignore parse errors
|
|
1526
1524
|
}
|
|
1527
1525
|
}
|
|
1528
|
-
|
|
1526
|
+
// DEF0798866: Use typeMap as fallback when schema-based detection fails.
|
|
1527
|
+
// If entry.value doesn't contain complexObjectSchema (e.g., some ServiceNow XML
|
|
1528
|
+
// formats omit the schema), fall back to the typeMap which always contains the
|
|
1529
|
+
// output/variable type (e.g., 'array.string' -> 'string' element type).
|
|
1530
|
+
const elementType = getArrayElementType(entry) ?? extractArrayElementType(typeMap?.get(entry.name))
|
|
1529
1531
|
const nestedTypeMap = extractNestedTypeSchema(entry)
|
|
1530
1532
|
const parsedValue = parseChildrenArray(
|
|
1531
1533
|
entry.children,
|
|
@@ -3,6 +3,7 @@ import { buildVariableRecords, complexObjectMatchesIoRecord } from '../utils/flo
|
|
|
3
3
|
import { generateXML } from '../utils/flow-to-xml'
|
|
4
4
|
import { slugifyString } from '../utils/flow-constants'
|
|
5
5
|
import { ArrowFunctionShape } from '../../arrow-function-plugin'
|
|
6
|
+
import { createSdkDocEntry } from '../../utils'
|
|
6
7
|
import { StepInstanceShape } from './step-instance-plugin'
|
|
7
8
|
|
|
8
9
|
const actionDefRelationships = {
|
|
@@ -108,6 +109,7 @@ const actionDefRelationships = {
|
|
|
108
109
|
|
|
109
110
|
export const ActionDefinitionPlugin = Plugin.create({
|
|
110
111
|
name: 'ActionDefinitionPlugin',
|
|
112
|
+
docs: [createSdkDocEntry('ActionDefinition', ['sys_hub_action_type_definition'])],
|
|
111
113
|
records: {
|
|
112
114
|
sys_hub_action_type_definition: {
|
|
113
115
|
relationships: {
|
|
@@ -193,8 +195,8 @@ export const ActionDefinitionPlugin = Plugin.create({
|
|
|
193
195
|
async diff(existing, incoming, descendants, context) {
|
|
194
196
|
return deleteMultipleDiff(existing, incoming, descendants, context)
|
|
195
197
|
},
|
|
196
|
-
toFile(record, { config, database }) {
|
|
197
|
-
return generateXML(record, { config, database })
|
|
198
|
+
toFile(record, { config, database, self }) {
|
|
199
|
+
return generateXML(record, { config, database, plugin: self })
|
|
198
200
|
},
|
|
199
201
|
},
|
|
200
202
|
sys_hub_action_input: {
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
uuidToSysId,
|
|
39
39
|
validateFlowVariableCall,
|
|
40
40
|
} from '../utils/utils'
|
|
41
|
-
import { getCallExpressionName } from '../../utils'
|
|
41
|
+
import { createSdkDocEntry, getCallExpressionName } from '../../utils'
|
|
42
42
|
import {
|
|
43
43
|
extractLabelCache,
|
|
44
44
|
createDefinitionMap,
|
|
@@ -610,9 +610,14 @@ function extractAllPills(
|
|
|
610
610
|
const matchStart = match.index ?? 0
|
|
611
611
|
const matchEnd = matchStart + fullMatch.length
|
|
612
612
|
|
|
613
|
+
// Strip type annotation if present (e.g., "uuid.field|integer" -> "uuid.field").
|
|
614
|
+
// ServiceNow stores datapills with type annotations like {{pill.path|datatype}}.
|
|
615
|
+
const pipeIndex = content.indexOf('|')
|
|
616
|
+
const cleanContent = pipeIndex !== -1 ? content.substring(0, pipeIndex) : content
|
|
617
|
+
|
|
613
618
|
// Try UUID pattern first (more specific)
|
|
614
619
|
// UUID format: 8-4-4-4-12 hex digits followed by dot and property path
|
|
615
|
-
const uuidMatch =
|
|
620
|
+
const uuidMatch = cleanContent.match(
|
|
616
621
|
/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.([a-zA-Z_][a-zA-Z0-9_.]*[a-zA-Z0-9_])$/
|
|
617
622
|
)
|
|
618
623
|
|
|
@@ -1619,6 +1624,7 @@ function postProcessAssignSubflowOutputs(
|
|
|
1619
1624
|
|
|
1620
1625
|
export const FlowDefinitionPlugin = Plugin.create({
|
|
1621
1626
|
name: 'FlowDefinitionPlugin',
|
|
1627
|
+
docs: [createSdkDocEntry('Flow', ['sys_hub_flow'])],
|
|
1622
1628
|
records: {
|
|
1623
1629
|
sys_hub_flow: {
|
|
1624
1630
|
relationships: {
|
|
@@ -1680,8 +1686,8 @@ export const FlowDefinitionPlugin = Plugin.create({
|
|
|
1680
1686
|
getUpdateName(record) {
|
|
1681
1687
|
return { success: true, value: `${record.getTable()}_${record.getId().getValue()}` }
|
|
1682
1688
|
},
|
|
1683
|
-
toFile(record, { config, database }) {
|
|
1684
|
-
return generateXML(record, { config, database })
|
|
1689
|
+
toFile(record, { config, database, self }) {
|
|
1690
|
+
return generateXML(record, { config, database, plugin: self })
|
|
1685
1691
|
},
|
|
1686
1692
|
async diff(existing, incoming, descendants, context) {
|
|
1687
1693
|
return deleteMultipleDiff(existing, incoming, descendants, context)
|