@servicenow/sdk-build-plugins 4.7.2 → 4.8.1
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/alias/alias-plugin.d.ts +2 -0
- package/dist/alias/alias-plugin.js +183 -0
- package/dist/alias/alias-plugin.js.map +1 -0
- package/dist/alias/alias-template-plugin.d.ts +2 -0
- package/dist/alias/alias-template-plugin.js +232 -0
- package/dist/alias/alias-template-plugin.js.map +1 -0
- package/dist/alias/index.d.ts +3 -0
- package/dist/alias/index.js +20 -0
- package/dist/alias/index.js.map +1 -0
- package/dist/alias/retry-policy-plugin.d.ts +2 -0
- package/dist/alias/retry-policy-plugin.js +119 -0
- package/dist/alias/retry-policy-plugin.js.map +1 -0
- package/dist/arrow-function-plugin.d.ts +1 -0
- package/dist/arrow-function-plugin.js +60 -21
- package/dist/arrow-function-plugin.js.map +1 -1
- package/dist/atf/test-plugin.js +1 -1
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +7 -7
- package/dist/basic-syntax-plugin.js.map +1 -1
- package/dist/column/index.d.ts +2 -0
- package/dist/column/index.js +13 -0
- package/dist/column/index.js.map +1 -0
- package/dist/dashboard/dashboard-plugin.js +4 -0
- package/dist/dashboard/dashboard-plugin.js.map +1 -1
- package/dist/data-lookup-plugin.d.ts +2 -0
- package/dist/data-lookup-plugin.js +159 -0
- package/dist/data-lookup-plugin.js.map +1 -0
- package/dist/flow/flow-logic/flow-logic-diagnostics.js +2 -1
- package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-action-definition-plugin.js +81 -16
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-definition-plugin.js +70 -7
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-instance-plugin.d.ts +35 -1
- package/dist/flow/plugins/flow-instance-plugin.js +241 -7
- package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/step-instance-plugin.js +61 -1
- package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
- package/dist/flow/post-install.d.ts +2 -1
- package/dist/flow/post-install.js +31 -4
- package/dist/flow/post-install.js.map +1 -1
- package/dist/flow/utils/complex-object-resolver.js +4 -2
- package/dist/flow/utils/complex-object-resolver.js.map +1 -1
- package/dist/flow/utils/datapill-transformer.d.ts +5 -72
- package/dist/flow/utils/datapill-transformer.js +199 -28
- package/dist/flow/utils/datapill-transformer.js.map +1 -1
- package/dist/flow/utils/flow-constants.d.ts +7 -0
- package/dist/flow/utils/flow-constants.js +6 -1
- package/dist/flow/utils/flow-constants.js.map +1 -1
- package/dist/flow/utils/flow-io-to-record.js +24 -15
- package/dist/flow/utils/flow-io-to-record.js.map +1 -1
- package/dist/flow/utils/flow-shapes.d.ts +8 -2
- package/dist/flow/utils/flow-shapes.js +19 -0
- package/dist/flow/utils/flow-shapes.js.map +1 -1
- package/dist/flow/utils/flow-variable-processor.d.ts +6 -6
- package/dist/flow/utils/flow-variable-processor.js +8 -8
- package/dist/flow/utils/flow-variable-processor.js.map +1 -1
- package/dist/form-plugin.js +35 -24
- package/dist/form-plugin.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/now-attach-plugin.d.ts +1 -1
- package/dist/now-config-plugin.js +2 -1
- package/dist/now-config-plugin.js.map +1 -1
- package/dist/now-delete-plugin.d.ts +2 -0
- package/dist/now-delete-plugin.js +64 -0
- package/dist/now-delete-plugin.js.map +1 -0
- package/dist/record-plugin.d.ts +10 -0
- package/dist/record-plugin.js +15 -1
- package/dist/record-plugin.js.map +1 -1
- package/dist/repack/lint/Rules.js +17 -7
- package/dist/repack/lint/Rules.js.map +1 -1
- package/dist/rest-message-plugin.d.ts +2 -0
- package/dist/rest-message-plugin.js +331 -0
- package/dist/rest-message-plugin.js.map +1 -0
- package/dist/script-include-plugin.js +1 -1
- package/dist/script-include-plugin.js.map +1 -1
- package/dist/server-module-plugin/sbom-builder.js +17 -7
- package/dist/server-module-plugin/sbom-builder.js.map +1 -1
- package/dist/static-content-plugin.js +17 -7
- package/dist/static-content-plugin.js.map +1 -1
- package/package.json +7 -6
- package/src/alias/alias-plugin.ts +221 -0
- package/src/alias/alias-template-plugin.ts +271 -0
- package/src/alias/index.ts +3 -0
- package/src/alias/retry-policy-plugin.ts +138 -0
- package/src/arrow-function-plugin.ts +67 -23
- package/src/atf/test-plugin.ts +1 -1
- package/src/basic-syntax-plugin.ts +7 -7
- package/src/column/index.ts +7 -0
- package/src/dashboard/dashboard-plugin.ts +4 -0
- package/src/data-lookup-plugin.ts +191 -0
- package/src/flow/flow-logic/flow-logic-diagnostics.ts +2 -1
- package/src/flow/flow-logic/flow-logic-plugin.ts +0 -1
- package/src/flow/plugins/flow-action-definition-plugin.ts +92 -25
- package/src/flow/plugins/flow-definition-plugin.ts +114 -8
- package/src/flow/plugins/flow-instance-plugin.ts +264 -7
- package/src/flow/plugins/step-instance-plugin.ts +74 -2
- package/src/flow/post-install.ts +36 -5
- package/src/flow/utils/complex-object-resolver.ts +4 -2
- package/src/flow/utils/datapill-transformer.ts +248 -36
- package/src/flow/utils/flow-constants.ts +8 -0
- package/src/flow/utils/flow-io-to-record.ts +28 -14
- package/src/flow/utils/flow-shapes.ts +19 -0
- package/src/flow/utils/flow-variable-processor.ts +21 -10
- package/src/form-plugin.ts +47 -26
- package/src/index.ts +5 -1
- package/src/now-config-plugin.ts +2 -1
- package/src/now-delete-plugin.ts +82 -0
- package/src/record-plugin.ts +17 -2
- package/src/rest-message-plugin.ts +391 -0
- package/src/script-include-plugin.ts +4 -1
package/src/form-plugin.ts
CHANGED
|
@@ -268,50 +268,51 @@ function getOptionalString(record: Record, field: string, defaultValue = ''): st
|
|
|
268
268
|
* The name is needed as an attribute on the <view> XML element so the parser
|
|
269
269
|
* can create a RecordId with proper coalesce keys when re-reading the XML.
|
|
270
270
|
*/
|
|
271
|
-
function resolveView(
|
|
271
|
+
function resolveView(
|
|
272
|
+
view: ReturnType<Record['get']>,
|
|
273
|
+
database: Database
|
|
274
|
+
): { sysId: string; name: string; displayValue: string } {
|
|
272
275
|
if (view.isRecordId() || view.isRecord()) {
|
|
273
276
|
const viewId = view.isRecordId() ? view : view.getId()
|
|
274
277
|
const sysId = viewId.getValue()
|
|
275
|
-
// Try to resolve the view record to get its name
|
|
278
|
+
// Try to resolve the view record to get its name and title
|
|
276
279
|
const viewRecord = database.resolve(viewId)
|
|
277
280
|
if (viewRecord) {
|
|
278
281
|
const name = viewRecord.get('name').ifString()?.getValue() ?? ''
|
|
279
|
-
|
|
282
|
+
const displayValue = viewRecord.get('title').ifString()?.getValue() ?? name
|
|
283
|
+
return { sysId, name, displayValue }
|
|
280
284
|
}
|
|
281
285
|
// Fall back to primary key (view name) if available
|
|
282
286
|
if (view.isRecordId() && view.asRecordId().hasPrimaryKey()) {
|
|
283
287
|
const pk = view.asRecordId().getPrimaryKey()
|
|
284
288
|
if (pk && !isGUID(pk)) {
|
|
285
|
-
return { sysId, name: pk }
|
|
289
|
+
return { sysId, name: pk, displayValue: pk }
|
|
286
290
|
}
|
|
287
291
|
}
|
|
288
|
-
return { sysId, name: '' }
|
|
292
|
+
return { sysId, name: '', displayValue: '' }
|
|
289
293
|
}
|
|
290
294
|
|
|
291
295
|
const viewValue = view.getValue()
|
|
292
296
|
if (viewValue === 'NULL' || viewValue === DEFAULT_VIEW) {
|
|
293
|
-
return { sysId: DEFAULT_VIEW, name: DEFAULT_VIEW }
|
|
297
|
+
return { sysId: DEFAULT_VIEW, name: DEFAULT_VIEW, displayValue: DEFAULT_VIEW }
|
|
294
298
|
}
|
|
295
299
|
|
|
296
300
|
// View is a string - try to resolve to record ID if it exists in database
|
|
297
301
|
const viewNameStr = view.ifString()?.getValue() ?? ''
|
|
298
302
|
if (!viewNameStr) {
|
|
299
|
-
return { sysId: '', name: '' }
|
|
303
|
+
return { sysId: '', name: '', displayValue: '' }
|
|
300
304
|
}
|
|
301
305
|
|
|
302
306
|
const viewRecord = database.query('sys_ui_view').find((v) => v.get('name').ifString()?.getValue() === viewNameStr)
|
|
303
307
|
if (viewRecord) {
|
|
304
|
-
|
|
308
|
+
const displayValue = viewRecord.get('title').ifString()?.getValue() ?? viewNameStr
|
|
309
|
+
return { sysId: viewRecord.getId().getValue(), name: viewNameStr, displayValue }
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
sysId: viewNameStr,
|
|
313
|
+
name: isGUID(viewNameStr) ? '' : viewNameStr,
|
|
314
|
+
displayValue: isGUID(viewNameStr) ? '' : viewNameStr,
|
|
305
315
|
}
|
|
306
|
-
return { sysId: viewNameStr, name: isGUID(viewNameStr) ? '' : viewNameStr }
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Resolves a view value to its string representation (sys_id or name)
|
|
311
|
-
* Handles RecordId, Record, string values, and database lookups
|
|
312
|
-
*/
|
|
313
|
-
function resolveViewName(view: ReturnType<Record['get']>, database: Database): string {
|
|
314
|
-
return resolveView(view, database).sysId
|
|
315
316
|
}
|
|
316
317
|
|
|
317
318
|
type FormElement =
|
|
@@ -377,7 +378,11 @@ export const FormPlugin = Plugin.create({
|
|
|
377
378
|
const sectionName = section.get('name').asString().getValue()
|
|
378
379
|
const caption = getOptionalString(section, 'caption')
|
|
379
380
|
const sysDomain = getOptionalString(section, 'sys_domain', 'global')
|
|
380
|
-
const {
|
|
381
|
+
const {
|
|
382
|
+
sysId: viewSysId,
|
|
383
|
+
name: viewName,
|
|
384
|
+
displayValue: viewDisplayValue,
|
|
385
|
+
} = resolveView(section.get('view'), database)
|
|
381
386
|
|
|
382
387
|
const xml = create().ele('record_update')
|
|
383
388
|
const root = xml.ele('sys_ui_section', {
|
|
@@ -385,7 +390,7 @@ export const FormPlugin = Plugin.create({
|
|
|
385
390
|
section_id: section.getId().getValue(),
|
|
386
391
|
sys_domain: sysDomain,
|
|
387
392
|
table: sectionName,
|
|
388
|
-
view: viewName,
|
|
393
|
+
view: viewSysId === DEFAULT_VIEW ? '' : viewName,
|
|
389
394
|
})
|
|
390
395
|
|
|
391
396
|
// Add all sys_ui_annotation records for this section (excluding deleted ones)
|
|
@@ -427,7 +432,7 @@ export const FormPlugin = Plugin.create({
|
|
|
427
432
|
display_value: caption,
|
|
428
433
|
name: sectionName,
|
|
429
434
|
sys_domain: sysDomain,
|
|
430
|
-
view:
|
|
435
|
+
view: viewSysId,
|
|
431
436
|
})
|
|
432
437
|
.txt(section.getId().getValue())
|
|
433
438
|
child.ele('sys_user')
|
|
@@ -446,7 +451,13 @@ export const FormPlugin = Plugin.create({
|
|
|
446
451
|
sectionChild.ele('sys_user')
|
|
447
452
|
sectionChild.ele('title').txt(String(section.get('title').ifBoolean()?.getValue() ?? false))
|
|
448
453
|
sectionChild.ele('view_name')
|
|
449
|
-
|
|
454
|
+
const isDefaultView = viewSysId === DEFAULT_VIEW
|
|
455
|
+
const sectionViewAttrs = isDefaultView
|
|
456
|
+
? { name: 'NULL', display_value: DEFAULT_VIEW }
|
|
457
|
+
: viewName
|
|
458
|
+
? { name: viewName, display_value: viewDisplayValue || viewName }
|
|
459
|
+
: {}
|
|
460
|
+
sectionChild.ele('view', sectionViewAttrs).txt(viewSysId)
|
|
450
461
|
|
|
451
462
|
return {
|
|
452
463
|
success: true,
|
|
@@ -702,7 +713,11 @@ export const FormPlugin = Plugin.create({
|
|
|
702
713
|
|
|
703
714
|
const formName = form.get('name').asString().getValue()
|
|
704
715
|
const formSysDomain = getOptionalString(form, 'sys_domain', 'global')
|
|
705
|
-
const {
|
|
716
|
+
const {
|
|
717
|
+
sysId: formViewSysId,
|
|
718
|
+
name: formViewName,
|
|
719
|
+
displayValue: formViewDisplayValue,
|
|
720
|
+
} = resolveView(form.get('view'), database)
|
|
706
721
|
|
|
707
722
|
const xml = create().ele('record_update')
|
|
708
723
|
const root = xml.ele('sys_ui_form_sections', {
|
|
@@ -727,7 +742,7 @@ export const FormPlugin = Plugin.create({
|
|
|
727
742
|
display_value: formName,
|
|
728
743
|
name: formName,
|
|
729
744
|
sys_domain: formSysDomain,
|
|
730
|
-
view:
|
|
745
|
+
view: formViewSysId,
|
|
731
746
|
})
|
|
732
747
|
.txt(form.getId().getValue())
|
|
733
748
|
|
|
@@ -737,14 +752,14 @@ export const FormPlugin = Plugin.create({
|
|
|
737
752
|
|
|
738
753
|
if (section) {
|
|
739
754
|
const sectionCaption = getOptionalString(section, 'caption')
|
|
740
|
-
const
|
|
755
|
+
const { sysId: sectionViewSysId } = resolveView(section.get('view'), database)
|
|
741
756
|
child
|
|
742
757
|
.ele('sys_ui_section', {
|
|
743
758
|
caption: sectionCaption,
|
|
744
759
|
display_value: sectionCaption,
|
|
745
760
|
name: formName,
|
|
746
761
|
sys_domain: getOptionalString(section, 'sys_domain', 'global'),
|
|
747
|
-
view:
|
|
762
|
+
view: sectionViewSysId,
|
|
748
763
|
})
|
|
749
764
|
.txt(section.getId().getValue())
|
|
750
765
|
}
|
|
@@ -757,7 +772,13 @@ export const FormPlugin = Plugin.create({
|
|
|
757
772
|
formChild.ele('sys_id').txt(form.getId().getValue())
|
|
758
773
|
formChild.ele('sys_scope', { display_value: config.scope }).txt(config.scopeId)
|
|
759
774
|
formChild.ele('sys_user').txt(getOptionalString(form, 'sys_user'))
|
|
760
|
-
|
|
775
|
+
const isDefaultFormView = formViewSysId === DEFAULT_VIEW
|
|
776
|
+
const formViewAttrs = isDefaultFormView
|
|
777
|
+
? { name: 'NULL', display_value: DEFAULT_VIEW }
|
|
778
|
+
: formViewName
|
|
779
|
+
? { name: formViewName, display_value: formViewDisplayValue || formViewName }
|
|
780
|
+
: {}
|
|
781
|
+
formChild.ele('view', formViewAttrs).txt(formViewSysId)
|
|
761
782
|
formChild.ele('view_name')
|
|
762
783
|
|
|
763
784
|
return {
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './cross-scope-privilege-plugin'
|
|
|
6
6
|
export * from './record-plugin'
|
|
7
7
|
export * from './now-id-plugin'
|
|
8
8
|
export * from './now-ref-plugin'
|
|
9
|
+
export * from './now-delete-plugin'
|
|
9
10
|
export * from './now-unresolved-plugin'
|
|
10
11
|
export * from './property-plugin'
|
|
11
12
|
export * from './role-plugin'
|
|
@@ -21,6 +22,7 @@ export * from './now-include-plugin'
|
|
|
21
22
|
export * from './table-plugin'
|
|
22
23
|
export * from './column-plugin'
|
|
23
24
|
export * from './data-plugin'
|
|
25
|
+
export * from './data-lookup-plugin'
|
|
24
26
|
export * from './ui-page-plugin'
|
|
25
27
|
export * from './list-plugin'
|
|
26
28
|
export * from './ui-action-plugin'
|
|
@@ -62,6 +64,7 @@ export * from './now-attach-plugin'
|
|
|
62
64
|
export * from './sla-plugin'
|
|
63
65
|
export * from './email-notification-plugin'
|
|
64
66
|
export * from './inbound-email-action-plugin'
|
|
67
|
+
export * from './rest-message-plugin'
|
|
65
68
|
|
|
66
69
|
export * from './service-catalog'
|
|
67
70
|
export * from './ux-list-menu-config-plugin'
|
|
@@ -69,6 +72,7 @@ export * from './workspace-plugin'
|
|
|
69
72
|
export * from './dashboard/dashboard-plugin'
|
|
70
73
|
export * from './applicability-plugin'
|
|
71
74
|
export * from './instance-scan-plugin'
|
|
75
|
+
export * from './alias'
|
|
72
76
|
// non-plugins
|
|
73
77
|
export * from './atf/step-configs'
|
|
74
78
|
export { REPACK_OUTPUT_DIR, checkModuleExists, resolveModule } from './repack'
|
|
@@ -79,4 +83,4 @@ export {
|
|
|
79
83
|
DO_IN_PARALLEL_BLOCK_SYS_ID,
|
|
80
84
|
TRY_CATCH_CATCH_SYS_ID,
|
|
81
85
|
} from './flow/flow-logic/flow-logic-constants'
|
|
82
|
-
export { FlowActivationTask } from './flow/post-install'
|
|
86
|
+
export { FlowActivationTask, getRecordIdsByTable } from './flow/post-install'
|
package/src/now-config-plugin.ts
CHANGED
|
@@ -787,6 +787,7 @@ export const NowConfigPlugin = Plugin.create({
|
|
|
787
787
|
packageResolverVersion: $.from('package_resolver_version').def(
|
|
788
788
|
config.scope === 'global' ? MODULE_RESOLUTION.V2 : MODULE_RESOLUTION.V1
|
|
789
789
|
),
|
|
790
|
+
sysCode: $.from('sys_code').def(''),
|
|
790
791
|
})),
|
|
791
792
|
}),
|
|
792
793
|
}
|
|
@@ -936,7 +937,7 @@ export const NowConfigPlugin = Plugin.create({
|
|
|
936
937
|
package_resolver_version: $.from('packageResolverVersion').def(
|
|
937
938
|
scope === 'global' ? MODULE_RESOLUTION.V2 : MODULE_RESOLUTION.V1
|
|
938
939
|
),
|
|
939
|
-
sys_code: $.from('
|
|
940
|
+
sys_code: $.from('sysCode'),
|
|
940
941
|
})),
|
|
941
942
|
})
|
|
942
943
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Plugin,
|
|
3
|
+
CallExpressionShape,
|
|
4
|
+
StringShape,
|
|
5
|
+
ObjectShape,
|
|
6
|
+
Record,
|
|
7
|
+
RecordId,
|
|
8
|
+
GUID,
|
|
9
|
+
} from '@servicenow/sdk-build-core'
|
|
10
|
+
import { CallExpressionPlugin } from './call-expression-plugin'
|
|
11
|
+
|
|
12
|
+
export const NowDeletePlugin = Plugin.create({
|
|
13
|
+
name: 'NowDeletePlugin',
|
|
14
|
+
nodes: [
|
|
15
|
+
{
|
|
16
|
+
node: 'CallExpression',
|
|
17
|
+
async toShape(node, { transform }) {
|
|
18
|
+
const result = await transform.toShape(node, CallExpressionPlugin)
|
|
19
|
+
if (
|
|
20
|
+
!result.success ||
|
|
21
|
+
!result.value.is(CallExpressionShape) ||
|
|
22
|
+
result.value.getCallee() !== 'Now.del'
|
|
23
|
+
) {
|
|
24
|
+
return { success: false }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const callExpression = result.value
|
|
28
|
+
const table = callExpression
|
|
29
|
+
.getArgument(0)
|
|
30
|
+
.asString('The first argument to Now.del() must be a table name')
|
|
31
|
+
.getValue()
|
|
32
|
+
|
|
33
|
+
const guidOrKeys = callExpression
|
|
34
|
+
.getArgument(1)
|
|
35
|
+
.as(
|
|
36
|
+
[StringShape, ObjectShape],
|
|
37
|
+
'The second argument to Now.del() must be a sys_id GUID or a coalesce keys object'
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const [guid, keysShape] = guidOrKeys.isString()
|
|
41
|
+
? [guidOrKeys.asString().getValue(), undefined] // Now.del(table, guid)
|
|
42
|
+
: [undefined, guidOrKeys.asObject()] // Now.del(table, keys)
|
|
43
|
+
|
|
44
|
+
// Convert keysShape to plain object
|
|
45
|
+
const keys = keysShape
|
|
46
|
+
? Object.fromEntries(
|
|
47
|
+
keysShape
|
|
48
|
+
.entries()
|
|
49
|
+
.map(([k, v]) => [
|
|
50
|
+
k,
|
|
51
|
+
typeof v === 'string'
|
|
52
|
+
? v
|
|
53
|
+
: (v.ifRecord()?.getId() ??
|
|
54
|
+
v.ifRecordId() ??
|
|
55
|
+
v.ifDefined()?.toString().getValue()) ||
|
|
56
|
+
'NULL',
|
|
57
|
+
])
|
|
58
|
+
)
|
|
59
|
+
: undefined
|
|
60
|
+
|
|
61
|
+
// Create DELETE record directly (no factory needed)
|
|
62
|
+
const record = new Record({
|
|
63
|
+
source: node,
|
|
64
|
+
action: 'DELETE',
|
|
65
|
+
installCategory: 'author_elective_update',
|
|
66
|
+
properties: keys ?? {},
|
|
67
|
+
id: new RecordId({
|
|
68
|
+
source: node,
|
|
69
|
+
table,
|
|
70
|
+
guid: guid ?? GUID(),
|
|
71
|
+
keys,
|
|
72
|
+
}),
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
success: true,
|
|
77
|
+
value: record,
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
})
|
package/src/record-plugin.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
ApplicationMenu,
|
|
13
13
|
BusinessRule,
|
|
14
14
|
CrossScopePrivilege,
|
|
15
|
+
DataLookup,
|
|
15
16
|
Property,
|
|
16
17
|
Role,
|
|
17
18
|
Test,
|
|
@@ -19,6 +20,7 @@ import {
|
|
|
19
20
|
ImportSet,
|
|
20
21
|
Sla,
|
|
21
22
|
} from '@servicenow/sdk-core/runtime/app'
|
|
23
|
+
import { RetryPolicy, AliasTemplate, Alias } from '@servicenow/sdk-core/runtime/alias'
|
|
22
24
|
import {
|
|
23
25
|
ServicePortal,
|
|
24
26
|
SPWidget,
|
|
@@ -43,7 +45,7 @@ import { ClientScript } from '@servicenow/sdk-core/runtime/clientscript'
|
|
|
43
45
|
import { ScriptAction, ScriptInclude, ScheduledScript } from '@servicenow/sdk-core/runtime/sys'
|
|
44
46
|
import { List, Form } from '@servicenow/sdk-core/runtime/ui'
|
|
45
47
|
import { Table } from '@servicenow/sdk-core/runtime/db'
|
|
46
|
-
import { RestApi } from '@servicenow/sdk-core/runtime/rest'
|
|
48
|
+
import { RestApi, RestMessage } from '@servicenow/sdk-core/runtime/rest'
|
|
47
49
|
import { EmailNotification, InboundEmailAction } from '@servicenow/sdk-core/runtime/notification'
|
|
48
50
|
import { UiAction, UiPage, UiPolicy, DataPolicy } from '@servicenow/sdk-core/runtime/ui'
|
|
49
51
|
import { ActionStepDefinition } from '@servicenow/sdk-core/runtime/flow'
|
|
@@ -71,6 +73,7 @@ export const RecordPlugin = Plugin.create({
|
|
|
71
73
|
async toShape(record, { compiler }) {
|
|
72
74
|
const tableName = record.getTable()
|
|
73
75
|
const columnTypes = compiler.getTableColumnTypes(tableName)
|
|
76
|
+
const mandatoryColumns = compiler.getMandatoryColumns(tableName)
|
|
74
77
|
|
|
75
78
|
const dataProperties = record.transform(({ $ }) =>
|
|
76
79
|
Object.fromEntries(
|
|
@@ -97,7 +100,9 @@ export const RecordPlugin = Plugin.create({
|
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
|
|
103
|
+
// Mandatory string fields must always be written to avoid build errors
|
|
104
|
+
// from missing required properties in Data<T>.
|
|
105
|
+
return [key, shape?.isString() ? (mandatoryColumns?.has(key) ? $ : $.def('')) : $]
|
|
101
106
|
})
|
|
102
107
|
)
|
|
103
108
|
)
|
|
@@ -225,7 +230,10 @@ export const RecordPlugin = Plugin.create({
|
|
|
225
230
|
})
|
|
226
231
|
|
|
227
232
|
export const TableOwnership = {
|
|
233
|
+
sys_alias: Alias.name,
|
|
234
|
+
sys_alias_templates: AliasTemplate.name,
|
|
228
235
|
contract_sla: Sla.name,
|
|
236
|
+
sys_retry_policy: RetryPolicy.name,
|
|
229
237
|
sys_security_acl: Acl.name,
|
|
230
238
|
sys_security_acl_role: Acl.name,
|
|
231
239
|
sys_app_application: ApplicationMenu.name,
|
|
@@ -271,6 +279,12 @@ export const TableOwnership = {
|
|
|
271
279
|
sys_ws_version: RestApi.name,
|
|
272
280
|
sys_ws_header: RestApi.name,
|
|
273
281
|
sys_ws_query_parameter: RestApi.name,
|
|
282
|
+
sys_rest_message: RestMessage.name,
|
|
283
|
+
sys_rest_message_headers: RestMessage.name,
|
|
284
|
+
sys_rest_message_fn: RestMessage.name,
|
|
285
|
+
sys_rest_message_fn_headers: RestMessage.name,
|
|
286
|
+
sys_rest_message_fn_parameters: RestMessage.name,
|
|
287
|
+
sys_rest_message_fn_param_defs: RestMessage.name,
|
|
274
288
|
sys_user_preference: UserPreference.name,
|
|
275
289
|
sys_ui_page: UiPage.name,
|
|
276
290
|
sys_ui_action: UiAction.name,
|
|
@@ -338,4 +352,5 @@ export const TableOwnership = {
|
|
|
338
352
|
sn_aia_team_member: 'AiAgenticWorkflowPlugin',
|
|
339
353
|
sn_nowassist_skill_config: 'NowAssistSkillPlugin',
|
|
340
354
|
sys_one_extend_capability: 'NowAssistSkillPlugin',
|
|
355
|
+
dl_definition: DataLookup.name,
|
|
341
356
|
}
|