@servicenow/sdk-build-plugins 4.4.1 → 4.6.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 +4 -7
- 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-diagnostics.js +5 -5
- package/dist/flow/flow-logic/flow-logic-diagnostics.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 +1232 -55
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-data-pill-plugin.js +6 -2
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-definition-plugin.js +23 -44
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +2 -2
- package/dist/flow/plugins/flow-diagnostics-plugin.js +3 -2
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-instance-plugin.js +136 -34
- 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 +4 -2
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/step-instance-plugin.d.ts +9 -1
- package/dist/flow/plugins/step-instance-plugin.js +649 -135
- 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 +21 -5
- 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 +59 -0
- package/dist/flow/post-install.js.map +1 -0
- package/dist/flow/utils/complex-object-resolver.js +4 -1
- package/dist/flow/utils/complex-object-resolver.js.map +1 -1
- package/dist/flow/utils/complex-objects.js +5 -3
- package/dist/flow/utils/complex-objects.js.map +1 -1
- package/dist/flow/utils/flow-constants.d.ts +90 -2
- package/dist/flow/utils/flow-constants.js +430 -7
- 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 +37 -16
- package/dist/flow/utils/flow-io-to-record.js.map +1 -1
- package/dist/flow/utils/flow-shapes.js +4 -0
- package/dist/flow/utils/flow-shapes.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-parser.d.ts +9 -2
- package/dist/flow/utils/label-cache-parser.js +32 -4
- package/dist/flow/utils/label-cache-parser.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/pill-shape-helpers.d.ts +15 -0
- package/dist/flow/utils/pill-shape-helpers.js +35 -0
- package/dist/flow/utils/pill-shape-helpers.js.map +1 -0
- package/dist/flow/utils/pill-string-parser.js +1 -0
- package/dist/flow/utils/pill-string-parser.js.map +1 -1
- package/dist/flow/utils/schema-to-flow-object.d.ts +6 -1
- package/dist/flow/utils/schema-to-flow-object.js +131 -15
- package/dist/flow/utils/schema-to-flow-object.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/flow/utils/utils.d.ts +1 -0
- package/dist/flow/utils/utils.js +6 -1
- package/dist/flow/utils/utils.js.map +1 -1
- package/dist/form-plugin.d.ts +2 -0
- package/dist/form-plugin.js +1132 -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/inbound-email-action-plugin.d.ts +10 -0
- package/dist/inbound-email-action-plugin.js +128 -0
- package/dist/inbound-email-action-plugin.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-scan-plugin.d.ts +2 -0
- package/dist/instance-scan-plugin.js +293 -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 +37 -0
- package/dist/record-plugin.js +47 -3
- 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 +22 -1
- 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 +556 -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-base.d.ts +18 -18
- package/dist/service-catalog/service-catalog-base.js +22 -22
- package/dist/service-catalog/service-catalog-base.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/header-footer-plugin.d.ts +2 -0
- package/dist/service-portal/header-footer-plugin.js +50 -0
- package/dist/service-portal/header-footer-plugin.js.map +1 -0
- package/dist/service-portal/menu-plugin.d.ts +2 -0
- package/dist/service-portal/menu-plugin.js +334 -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 +681 -0
- package/dist/service-portal/page-plugin.js.map +1 -0
- package/dist/service-portal/page-route-map-plugin.d.ts +2 -0
- package/dist/service-portal/page-route-map-plugin.js +114 -0
- package/dist/service-portal/page-route-map-plugin.js.map +1 -0
- package/dist/service-portal/portal-plugin.d.ts +2 -0
- package/dist/service-portal/portal-plugin.js +309 -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 +46 -0
- package/dist/service-portal/utils.js +331 -0
- package/dist/service-portal/utils.js.map +1 -0
- package/dist/service-portal/widget-plugin.js +10 -182
- 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 +5 -0
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +191 -26
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-action-plugin.js +3 -4
- package/dist/ui-action-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +101 -21
- 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 +9 -3
- package/dist/view-plugin.js.map +1 -1
- package/dist/workspace-plugin.js +41 -36
- package/dist/workspace-plugin.js.map +1 -1
- package/package.json +11 -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 +4 -8
- 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-diagnostics.ts +5 -6
- 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 +1584 -62
- package/src/flow/plugins/flow-data-pill-plugin.ts +6 -2
- package/src/flow/plugins/flow-definition-plugin.ts +22 -51
- package/src/flow/plugins/flow-diagnostics-plugin.ts +3 -2
- package/src/flow/plugins/flow-instance-plugin.ts +201 -36
- 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 +4 -2
- package/src/flow/plugins/step-instance-plugin.ts +772 -155
- package/src/flow/plugins/trigger-plugin.ts +2 -0
- package/src/flow/plugins/wfa-datapill-plugin.ts +26 -5
- package/src/flow/post-install.ts +93 -0
- package/src/flow/utils/complex-object-resolver.ts +4 -1
- package/src/flow/utils/complex-objects.ts +11 -3
- package/src/flow/utils/flow-constants.ts +451 -6
- package/src/flow/utils/flow-io-to-record.ts +43 -17
- package/src/flow/utils/flow-shapes.ts +4 -0
- package/src/flow/utils/flow-to-xml.ts +4 -4
- package/src/flow/utils/label-cache-parser.ts +33 -4
- package/src/flow/utils/label-cache-processor.ts +14 -2
- package/src/flow/utils/pill-shape-helpers.ts +42 -0
- package/src/flow/utils/pill-string-parser.ts +1 -0
- package/src/flow/utils/schema-to-flow-object.ts +183 -15
- package/src/flow/utils/service-catalog.ts +5 -2
- package/src/flow/utils/utils.ts +12 -1
- package/src/form-plugin.ts +1409 -0
- package/src/html-import-plugin.ts +1 -0
- package/src/import-sets-plugin.ts +2 -0
- package/src/inbound-email-action-plugin.ts +145 -0
- package/src/index.ts +13 -0
- package/src/instance-scan-plugin.ts +313 -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 +6 -1
- package/src/record-plugin.ts +56 -6
- package/src/repack/lint/Rules.ts +171 -22
- package/src/repack/lint/index.ts +80 -56
- package/src/rest-api-plugin.ts +28 -2
- package/src/role-plugin.ts +2 -1
- package/src/schedule-script/index.ts +1 -0
- package/src/schedule-script/scheduled-script-plugin.ts +690 -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-base.ts +22 -22
- 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/header-footer-plugin.ts +57 -0
- package/src/service-portal/menu-plugin.ts +413 -0
- package/src/service-portal/page-plugin.ts +805 -0
- package/src/service-portal/page-route-map-plugin.ts +124 -0
- package/src/service-portal/portal-plugin.ts +342 -0
- package/src/service-portal/theme-plugin.ts +135 -0
- package/src/service-portal/utils.ts +470 -0
- package/src/service-portal/widget-plugin.ts +18 -224
- package/src/sla-plugin.ts +2 -0
- package/src/static-content-plugin.ts +4 -0
- package/src/table-plugin.ts +228 -37
- package/src/ui-action-plugin.ts +3 -8
- package/src/ui-page-plugin.ts +110 -21
- 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 +11 -4
- package/src/workspace-plugin.ts +45 -43
- package/src/_types/eslint-plugin-es-x.d.ts +0 -17
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { CallExpressionShape,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { NowIdShape } from '../now-id-plugin'
|
|
5
|
-
import { NowIncludeShape } from '../now-include-plugin'
|
|
1
|
+
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
|
+
import { createSdkDocEntry } from '../utils'
|
|
3
|
+
import { createWidgetToRecord, createWidgetToShape } from './utils'
|
|
6
4
|
|
|
7
5
|
export const SPWidgetPlugin = Plugin.create({
|
|
8
6
|
name: 'SPWidgetPlugin',
|
|
7
|
+
docs: [createSdkDocEntry('SPWidget', ['sp_widget'])],
|
|
9
8
|
records: {
|
|
10
9
|
sp_widget: {
|
|
11
10
|
relationships: {
|
|
@@ -13,83 +12,8 @@ export const SPWidgetPlugin = Plugin.create({
|
|
|
13
12
|
m2m_sp_ng_pro_sp_widget: { via: 'sp_widget', descendant: true },
|
|
14
13
|
sp_ng_template: { via: 'sp_widget', descendant: true },
|
|
15
14
|
},
|
|
16
|
-
toShape(record, { descendants }) {
|
|
17
|
-
|
|
18
|
-
const angularProviders = descendants.query('m2m_sp_ng_pro_sp_widget')
|
|
19
|
-
const templates = descendants.query('sp_ng_template').map((template) => {
|
|
20
|
-
return {
|
|
21
|
-
$id: template.getId(),
|
|
22
|
-
id: template.get('id'),
|
|
23
|
-
htmlTemplate: template.get('template'),
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const category = reverseObject(WidgetCategories)[record.get('category').ifString()?.getValue() || '']
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
success: true,
|
|
31
|
-
value: new CallExpressionShape({
|
|
32
|
-
source: record,
|
|
33
|
-
callee: 'SPWidget',
|
|
34
|
-
args: [
|
|
35
|
-
record.transform(({ $ }) => ({
|
|
36
|
-
$id: $.val(NowIdShape.from(record)),
|
|
37
|
-
name: $,
|
|
38
|
-
category: $.val(category).def('custom'),
|
|
39
|
-
clientScript: $.from('client_script').def(''),
|
|
40
|
-
serverScript: $.from('script').def(''),
|
|
41
|
-
controllerAs: $.from('controller_as').def('c'),
|
|
42
|
-
htmlTemplate: $.from('template').def(''),
|
|
43
|
-
customCss: $.from('css').def(''),
|
|
44
|
-
dataTable: $.from('data_table').def('sp_instance'),
|
|
45
|
-
demoData: $.from('demo_data')
|
|
46
|
-
.map((d) => {
|
|
47
|
-
const json = d.ifString()?.getValue()
|
|
48
|
-
|
|
49
|
-
const parsed = noThrow(() => json && JSON.parse(json))
|
|
50
|
-
return parsed instanceof Error ? json : parsed
|
|
51
|
-
})
|
|
52
|
-
.def(''),
|
|
53
|
-
description: $.def(''),
|
|
54
|
-
docs: $.def(''),
|
|
55
|
-
fields: $.from('field_list')
|
|
56
|
-
.map((fields) => {
|
|
57
|
-
const fieldStr = fields.ifString()?.getValue()
|
|
58
|
-
return fieldStr && fieldStr.split(',')
|
|
59
|
-
})
|
|
60
|
-
.def(''),
|
|
61
|
-
hasPreview: $.from('has_preview').toBoolean().def(false),
|
|
62
|
-
id: $.def(''),
|
|
63
|
-
internal: $.toBoolean().def(false),
|
|
64
|
-
linkScript: $.from('link').def(''),
|
|
65
|
-
roles: $.map((role) => {
|
|
66
|
-
const roleStr = role.ifString()?.getValue()
|
|
67
|
-
return roleStr && roleStr.split(',')
|
|
68
|
-
}).def(''),
|
|
69
|
-
servicenow: $.toBoolean().def(false),
|
|
70
|
-
optionSchema: $.from('option_schema')
|
|
71
|
-
.map((v) => {
|
|
72
|
-
const json = v.ifString()?.getValue()
|
|
73
|
-
const parsed = noThrow(() => json && JSON.parse(json))
|
|
74
|
-
return parsed instanceof Error ? json : parsed
|
|
75
|
-
})
|
|
76
|
-
.def(''),
|
|
77
|
-
public: $.toBoolean().def(false),
|
|
78
|
-
dependencies: $.val(
|
|
79
|
-
dependencies.length > 0
|
|
80
|
-
? dependencies.map((dep) => dep.get('sp_dependency'))
|
|
81
|
-
: undefined
|
|
82
|
-
),
|
|
83
|
-
angularProviders: $.val(
|
|
84
|
-
angularProviders.length > 0
|
|
85
|
-
? angularProviders.map((ap) => ap.get('sp_angular_provider'))
|
|
86
|
-
: undefined
|
|
87
|
-
),
|
|
88
|
-
templates: $.val(templates.length > 0 ? templates : undefined),
|
|
89
|
-
})),
|
|
90
|
-
],
|
|
91
|
-
}),
|
|
92
|
-
}
|
|
15
|
+
async toShape(record, { descendants }) {
|
|
16
|
+
return createWidgetToShape(record, descendants, 'SPWidget')
|
|
93
17
|
},
|
|
94
18
|
},
|
|
95
19
|
m2m_sp_widget_dependency: {
|
|
@@ -108,148 +32,18 @@ export const SPWidgetPlugin = Plugin.create({
|
|
|
108
32
|
return { success: false }
|
|
109
33
|
}
|
|
110
34
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const templates =
|
|
124
|
-
widget
|
|
125
|
-
.get('templates')
|
|
126
|
-
.ifArray()
|
|
127
|
-
?.map((shp) => shp.getValue() as SPTemplate) || []
|
|
128
|
-
const widgetId = widget.get('id').ifString()
|
|
129
|
-
if (widgetId && !/^[a-zA-Z0-9_-]+$/g.test(widgetId.getValue())) {
|
|
130
|
-
diagnostics.error(
|
|
131
|
-
widgetId.getOriginalNode(),
|
|
132
|
-
`Invalid value: must contain only alphanumeric, -, or _ characters`
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const roles = widget
|
|
137
|
-
.get('roles')
|
|
138
|
-
.ifArray()
|
|
139
|
-
?.map((role) => {
|
|
140
|
-
if (role.isString()) {
|
|
141
|
-
return role
|
|
142
|
-
}
|
|
143
|
-
if (role.isRecord()) {
|
|
144
|
-
return role.get('name')
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return undefined
|
|
148
|
-
})
|
|
149
|
-
.filter((role) => role) as Shape[] | undefined
|
|
150
|
-
|
|
151
|
-
if (roles) {
|
|
152
|
-
roles
|
|
153
|
-
.filter((role) => isGUID(role.getValue() as string))
|
|
154
|
-
.forEach((role) =>
|
|
155
|
-
diagnostics.error(
|
|
156
|
-
role!.getOriginalNode(),
|
|
157
|
-
`expecting role names or role records created by the Role or Record plugins, not sys_ids`
|
|
158
|
-
)
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const controller = widget.get('controllerAs').ifString()?.getValue() || 'c'
|
|
163
|
-
const servicenow =
|
|
164
|
-
(widget.get('servicenow').ifBoolean()?.getValue() &&
|
|
165
|
-
(config.scope.startsWith('sn_') || config.scope.startsWith('snc_'))) ||
|
|
166
|
-
false
|
|
167
|
-
|
|
168
|
-
const widgetRecord = await factory.createRecord({
|
|
169
|
-
source: callExpression,
|
|
170
|
-
table: 'sp_widget',
|
|
171
|
-
explicitId: widget.get('$id'),
|
|
172
|
-
properties: widget.transform(({ $ }) => ({
|
|
173
|
-
name: $,
|
|
174
|
-
category: $.map((v) => {
|
|
175
|
-
const catKey = v.ifString()?.getValue() || ''
|
|
176
|
-
return WidgetCategories[catKey as keyof typeof WidgetCategories]
|
|
177
|
-
}).def('custom'),
|
|
178
|
-
client_script: $.from('clientScript').def(getDefaultClientScript(controller)),
|
|
179
|
-
script: $.from('serverScript').def(SP_WIDGET_DEFAULT_SERVER_SCRIPT),
|
|
180
|
-
controller_as: $.from('controllerAs').def('c'),
|
|
181
|
-
template: $.from('htmlTemplate').def(SP_WIDGET_DEFAULT_HTML_TEMPLATE),
|
|
182
|
-
css: $.from('customCss').def(''),
|
|
183
|
-
data_table: $.from('dataTable').def('sp_instance'),
|
|
184
|
-
demo_data: $.from('demoData')
|
|
185
|
-
.map((v) =>
|
|
186
|
-
v.ifString() || v instanceof NowIncludeShape ? v : JSON.stringify(v.getValue())
|
|
187
|
-
)
|
|
188
|
-
.def(''),
|
|
189
|
-
description: $.def(''),
|
|
190
|
-
docs: $.map((v) => (v.isString() ? v : v.ifRecord()?.getId())),
|
|
191
|
-
field_list: $.from('fields')
|
|
192
|
-
.map((v) => v.getValue()?.toString())
|
|
193
|
-
.def(''),
|
|
194
|
-
has_preview: $.from('hasPreview').toBoolean().def(false),
|
|
195
|
-
id: $.def(''),
|
|
196
|
-
internal: $.def(false),
|
|
197
|
-
servicenow: $.val(servicenow),
|
|
198
|
-
link: $.from('linkScript').def(SP_WIDGET_DEFAULT_LINK_SCRIPT),
|
|
199
|
-
roles: $.val(roles?.map((r) => r.getValue()).toString()).def(''),
|
|
200
|
-
option_schema: $.from('optionSchema')
|
|
201
|
-
.map((v) => {
|
|
202
|
-
const json = v.getValue()
|
|
203
|
-
return json && JSON.stringify(json)
|
|
204
|
-
})
|
|
205
|
-
.def(''),
|
|
206
|
-
public: $.def(false),
|
|
207
|
-
})),
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
return {
|
|
211
|
-
success: true,
|
|
212
|
-
value: widgetRecord.with(
|
|
213
|
-
...(await Promise.all(
|
|
214
|
-
templates.map(async (template: SPTemplate) => {
|
|
215
|
-
return await factory.createRecord({
|
|
216
|
-
source: callExpression,
|
|
217
|
-
table: 'sp_ng_template',
|
|
218
|
-
explicitId: template.$id as string,
|
|
219
|
-
properties: {
|
|
220
|
-
id: template.id,
|
|
221
|
-
sp_widget: widgetRecord.getId(),
|
|
222
|
-
template: template.htmlTemplate,
|
|
223
|
-
},
|
|
224
|
-
})
|
|
225
|
-
})
|
|
226
|
-
)),
|
|
227
|
-
...(await Promise.all(
|
|
228
|
-
dependencies.map(async (dep) => {
|
|
229
|
-
return await factory.createRecord({
|
|
230
|
-
source: callExpression,
|
|
231
|
-
table: 'm2m_sp_widget_dependency',
|
|
232
|
-
properties: {
|
|
233
|
-
sp_dependency: dep!,
|
|
234
|
-
sp_widget: widgetRecord.getId(),
|
|
235
|
-
},
|
|
236
|
-
})
|
|
237
|
-
})
|
|
238
|
-
)),
|
|
239
|
-
...(await Promise.all(
|
|
240
|
-
angularProviders.map(async (ap) => {
|
|
241
|
-
return await factory.createRecord({
|
|
242
|
-
source: callExpression,
|
|
243
|
-
table: 'm2m_sp_ng_pro_sp_widget',
|
|
244
|
-
properties: {
|
|
245
|
-
sp_angular_provider: ap!,
|
|
246
|
-
sp_widget: widgetRecord.getId(),
|
|
247
|
-
},
|
|
248
|
-
})
|
|
249
|
-
})
|
|
250
|
-
))
|
|
251
|
-
),
|
|
252
|
-
}
|
|
35
|
+
return createWidgetToRecord(
|
|
36
|
+
callExpression,
|
|
37
|
+
{ diagnostics, factory, config },
|
|
38
|
+
{
|
|
39
|
+
callee: 'SPWidget',
|
|
40
|
+
table: 'sp_widget',
|
|
41
|
+
getDefaultClientScript,
|
|
42
|
+
defaultServerScript: SP_WIDGET_DEFAULT_SERVER_SCRIPT,
|
|
43
|
+
defaultLinkScript: SP_WIDGET_DEFAULT_LINK_SCRIPT,
|
|
44
|
+
defaultHtmlTemplate: SP_WIDGET_DEFAULT_HTML_TEMPLATE,
|
|
45
|
+
}
|
|
46
|
+
)
|
|
253
47
|
},
|
|
254
48
|
},
|
|
255
49
|
],
|
package/src/sla-plugin.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin, DurationShape } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
+
import { createSdkDocEntry } from './utils'
|
|
3
4
|
import {
|
|
4
5
|
validateUserSpecifiedDuration,
|
|
5
6
|
validateRelativeDuration,
|
|
@@ -36,6 +37,7 @@ const DEFAULT_DURATION_ON_PLATFORM = '1970-01-01 00:00:00'
|
|
|
36
37
|
*/
|
|
37
38
|
export const SLAPlugin = Plugin.create({
|
|
38
39
|
name: 'SLAPlugin',
|
|
40
|
+
docs: [createSdkDocEntry('Sla', ['contract_sla'])],
|
|
39
41
|
|
|
40
42
|
records: {
|
|
41
43
|
contract_sla: {
|
|
@@ -3,6 +3,7 @@ import * as mime from 'mime-types'
|
|
|
3
3
|
import { Shape, Plugin, type Record, unloadBuilder, gzipSync, type RecordContext } from '@servicenow/sdk-build-core'
|
|
4
4
|
import { path as pathModule } from '@servicenow/sdk-build-core'
|
|
5
5
|
import { INVALID_XML_CHARACTERS } from './utils'
|
|
6
|
+
import { TRANSLATIONS_ASSET_NAME } from '@servicenow/isomorphic-rollup'
|
|
6
7
|
|
|
7
8
|
// based on tectonic code for attachments
|
|
8
9
|
// https://code.devsnc.com/dev/sn-tectonic/blob/b3ab42ce742158cb5a0d00efd540b97eeafcbdd7/core/metadata-transform-san-diego/utils/index.js#L66
|
|
@@ -91,6 +92,7 @@ const toNoOpShape = (record: Record) => {
|
|
|
91
92
|
|
|
92
93
|
export const StaticContentPlugin = Plugin.create({
|
|
93
94
|
name: 'StaticContentPlugin',
|
|
95
|
+
docs: [],
|
|
94
96
|
records: {
|
|
95
97
|
// TODO: remove when we have generic attachment support
|
|
96
98
|
sys_attachment: {
|
|
@@ -165,6 +167,8 @@ export const StaticContentPlugin = Plugin.create({
|
|
|
165
167
|
// Build-time manifest produced by the uiPageSourceManifest rollup plugin.
|
|
166
168
|
// Consumed by UiPage during build to determine which source files to include
|
|
167
169
|
// in the source artifact record. Not a deployable asset.
|
|
170
|
+
} else if (relativePath === TRANSLATIONS_ASSET_NAME) {
|
|
171
|
+
logger.debug('translations not supported yet')
|
|
168
172
|
} else if (mimeType === 'application/javascript') {
|
|
169
173
|
tableName = 'sys_ux_lib_asset'
|
|
170
174
|
assetName = pathModule.join(
|