@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
package/src/ui-page-plugin.ts
CHANGED
|
@@ -17,11 +17,13 @@ import {
|
|
|
17
17
|
type Factory,
|
|
18
18
|
type Transform,
|
|
19
19
|
} from '@servicenow/sdk-build-core'
|
|
20
|
+
import { parseDocument, DomUtils } from 'htmlparser2'
|
|
20
21
|
import { XMLParser, XMLBuilder, type X2jOptions, type XmlBuilderOptions } from 'fast-xml-parser'
|
|
21
22
|
import { create } from 'xmlbuilder2'
|
|
22
23
|
import { NowIdShape } from './now-id-plugin'
|
|
23
24
|
import { CHUNK_SIZE, chunkData, generateId } from './static-content-plugin'
|
|
24
25
|
import { sha256 } from './now-attach-plugin'
|
|
26
|
+
import { createSdkDocEntry } from './utils'
|
|
25
27
|
|
|
26
28
|
const parserOptions: X2jOptions = {
|
|
27
29
|
ignoreAttributes: false,
|
|
@@ -50,6 +52,62 @@ const builderOptions: XmlBuilderOptions = {
|
|
|
50
52
|
],
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
const LT_PLACEHOLDER = '\0__SDK_LT__\0'
|
|
56
|
+
const AMP_PLACEHOLDER = '\0__SDK_AMP__\0'
|
|
57
|
+
const RAW_CONTENT_TAGS = ['script', 'style', 'textarea'] as const
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Uses htmlparser2 to find script/style/textarea content and replaces `<` and
|
|
61
|
+
* `&` with placeholders. This prevents fast-xml-parser from misinterpreting
|
|
62
|
+
* JavaScript comparison operators (e.g. `a < b`) as XML tag openers, and
|
|
63
|
+
* prevents the XMLBuilder's entity escaping from converting `&` to `$[AMP]`
|
|
64
|
+
* inside script content.
|
|
65
|
+
*
|
|
66
|
+
* htmlparser2 is used instead of regex because it correctly handles edge cases
|
|
67
|
+
* like `>` inside attribute values and script tags inside HTML comments.
|
|
68
|
+
*/
|
|
69
|
+
function escapeRawContent(html: string): string {
|
|
70
|
+
const doc = parseDocument(html, { withStartIndices: true, withEndIndices: true })
|
|
71
|
+
|
|
72
|
+
const regions: { start: number; end: number }[] = []
|
|
73
|
+
for (const tag of RAW_CONTENT_TAGS) {
|
|
74
|
+
for (const el of DomUtils.getElementsByTagName(tag, doc, true)) {
|
|
75
|
+
for (const child of el.children) {
|
|
76
|
+
if (child.type === 'text' && child.startIndex != null && child.endIndex != null) {
|
|
77
|
+
const text = child.data
|
|
78
|
+
if (text.includes('<') || text.includes('&')) {
|
|
79
|
+
regions.push({ start: child.startIndex, end: child.endIndex + 1 })
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (regions.length === 0) {
|
|
87
|
+
return html
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Sort by position descending so replacements don't shift earlier indices
|
|
91
|
+
regions.sort((a, b) => b.start - a.start)
|
|
92
|
+
|
|
93
|
+
let result = html
|
|
94
|
+
for (const { start, end } of regions) {
|
|
95
|
+
const content = result.slice(start, end)
|
|
96
|
+
const escaped = content.replace(/&/g, AMP_PLACEHOLDER).replace(/</g, LT_PLACEHOLDER)
|
|
97
|
+
result = result.slice(0, start) + escaped + result.slice(end)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return result
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Restores `<` and `&` characters that were replaced by `escapeRawContent`
|
|
105
|
+
* after fast-xml-parser has finished processing.
|
|
106
|
+
*/
|
|
107
|
+
function restoreRawContent(html: string): string {
|
|
108
|
+
return html.replaceAll(LT_PLACEHOLDER, '<').replaceAll(AMP_PLACEHOLDER, '&')
|
|
109
|
+
}
|
|
110
|
+
|
|
53
111
|
const POLARIS_APPSHELL_THEME_ID = 'c86a62e2c7022010099a308dc7c26022'
|
|
54
112
|
const BYOUI_ARTIFACT_NAME_SUFFIX = 'BYOUI Files'
|
|
55
113
|
// Matches the prefix HtmlImportPlugin prepends when it resolves an `import x from '*.html'`
|
|
@@ -158,10 +216,19 @@ const nodeTransformer = (nodes: any[]) => {
|
|
|
158
216
|
|
|
159
217
|
export const UiPagePlugin = Plugin.create({
|
|
160
218
|
name: 'UiPagePlugin',
|
|
219
|
+
docs: [createSdkDocEntry('UiPage', ['sys_ui_page'])],
|
|
161
220
|
records: {
|
|
162
221
|
sys_ui_page: {
|
|
163
222
|
composite: true,
|
|
164
|
-
coalesce:
|
|
223
|
+
coalesce: (properties) => {
|
|
224
|
+
// Use endpoint for scoped pages (backward compatible), fall back to name for global scope
|
|
225
|
+
const endpoint = properties.get('endpoint').pipe((v) => v.ifDefined()?.toString().getValue())
|
|
226
|
+
if (endpoint) {
|
|
227
|
+
return { endpoint }
|
|
228
|
+
}
|
|
229
|
+
const name = properties.get('name').pipe((v) => v.ifDefined()?.toString().getValue()) ?? 'NULL'
|
|
230
|
+
return { name }
|
|
231
|
+
},
|
|
165
232
|
relationships: SOURCE_ARTIFACT_RELATIONSHIPS,
|
|
166
233
|
async toShape(record, { descendants, fs, project, config, logger, diagnostics }) {
|
|
167
234
|
const shapeWithSourceArtifacts = await getShapeWithSourceArtifacts(record, descendants, {
|
|
@@ -178,6 +245,11 @@ export const UiPagePlugin = Plugin.create({
|
|
|
178
245
|
}
|
|
179
246
|
}
|
|
180
247
|
|
|
248
|
+
// For global scope, endpoint is empty in the DB — synthesize from name
|
|
249
|
+
const endpointValue = record.get('endpoint').toString().getValue()
|
|
250
|
+
const nameValue = record.get('name').toString().getValue()
|
|
251
|
+
const effectiveEndpoint = endpointValue || (nameValue ? `${nameValue}.do` : '')
|
|
252
|
+
|
|
181
253
|
return {
|
|
182
254
|
success: true,
|
|
183
255
|
value: new CallExpressionShape({
|
|
@@ -187,7 +259,7 @@ export const UiPagePlugin = Plugin.create({
|
|
|
187
259
|
record.transform(({ $ }) => ({
|
|
188
260
|
$id: $.val(NowIdShape.from(record)),
|
|
189
261
|
category: $.def(''),
|
|
190
|
-
endpoint:
|
|
262
|
+
endpoint: $.val(effectiveEndpoint).def(''),
|
|
191
263
|
description: $.def(''),
|
|
192
264
|
direct: $.toBoolean().def(false),
|
|
193
265
|
html: $.def(''),
|
|
@@ -200,7 +272,7 @@ export const UiPagePlugin = Plugin.create({
|
|
|
200
272
|
},
|
|
201
273
|
|
|
202
274
|
async toFile(uiPage, { config, descendants, transform }) {
|
|
203
|
-
if (!uiPage.has('endpoint')) {
|
|
275
|
+
if (!uiPage.has('endpoint') && !uiPage.has('name')) {
|
|
204
276
|
return { success: false }
|
|
205
277
|
}
|
|
206
278
|
|
|
@@ -324,11 +396,20 @@ export const UiPagePlugin = Plugin.create({
|
|
|
324
396
|
const arg = callExpression.getArgument(0).asObject()
|
|
325
397
|
const endpoint = arg.get('endpoint').asString()
|
|
326
398
|
const scope = config.scope
|
|
327
|
-
|
|
399
|
+
const isGlobalScope = scope === 'global'
|
|
400
|
+
if (!isGlobalScope && !isSNScope(scope) && !endpoint.getValue().startsWith(`${scope}_`)) {
|
|
328
401
|
diagnostics.error(endpoint.getOriginalNode(), `endpoint must begin with '${scope}_'`)
|
|
329
402
|
return { success: false }
|
|
330
403
|
}
|
|
331
|
-
|
|
404
|
+
// For global scope, name is the endpoint without .do (e.g., 'my-page.do' → 'my-page')
|
|
405
|
+
// For scoped, strip scope prefix and .do (e.g., 'x_test_boats.do' → 'boats')
|
|
406
|
+
const name = isGlobalScope
|
|
407
|
+
? endpoint.getValue().replace(/\.do$/, '')
|
|
408
|
+
: endpoint.getValue().replace(`${scope}_`, '').replace(/\.do$/, '')
|
|
409
|
+
if (!name) {
|
|
410
|
+
diagnostics.error(endpoint.getOriginalNode(), 'endpoint must include a page name before .do')
|
|
411
|
+
return { success: false }
|
|
412
|
+
}
|
|
332
413
|
let html = arg.get('html').toString().getValue()
|
|
333
414
|
let sourceFilePaths: string[] = []
|
|
334
415
|
let assetNames: string[] = []
|
|
@@ -364,9 +445,11 @@ export const UiPagePlugin = Plugin.create({
|
|
|
364
445
|
|
|
365
446
|
if (html) {
|
|
366
447
|
try {
|
|
448
|
+
html = escapeRawContent(html)
|
|
367
449
|
const nodes = parser.parse(html)
|
|
368
450
|
const transformed = nodeTransformer(nodes)
|
|
369
451
|
html = new XMLBuilder(builderOptions).build(transformed)
|
|
452
|
+
html = restoreRawContent(html)
|
|
370
453
|
} catch (error: unknown) {
|
|
371
454
|
if (error instanceof Error) {
|
|
372
455
|
diagnostics.error(arg.get('html'), error.message)
|
|
@@ -383,7 +466,7 @@ export const UiPagePlugin = Plugin.create({
|
|
|
383
466
|
explicitId: arg.get('$id'),
|
|
384
467
|
properties: arg.transform(({ $ }) => ({
|
|
385
468
|
name: $.val(name),
|
|
386
|
-
endpoint: $.val(endpoint),
|
|
469
|
+
endpoint: $.val(isGlobalScope ? '' : endpoint),
|
|
387
470
|
description: $,
|
|
388
471
|
direct: $.def(false),
|
|
389
472
|
category: $,
|
|
@@ -461,12 +544,14 @@ const getUIPageSourceFilePaths = (
|
|
|
461
544
|
): { files: string[]; assetNames: string[] } => {
|
|
462
545
|
const empty = { files: [], assetNames: [] }
|
|
463
546
|
try {
|
|
464
|
-
// Derive manifest path from HTML path
|
|
465
|
-
//
|
|
466
|
-
// e.g., src/client/index.html
|
|
467
|
-
|
|
547
|
+
// Derive manifest path from HTML path by mirroring the directory structure
|
|
548
|
+
// from clientDir into staticContentDir and swapping the extension.
|
|
549
|
+
// e.g., src/client/index.html -> dist/static/index.ui-source-manifest.json
|
|
550
|
+
// src/client/admin/settings.html -> dist/static/admin/settings.ui-source-manifest.json
|
|
551
|
+
const clientAbsDir = path.join(rootDir, config.clientDir)
|
|
468
552
|
const staticContentAbsDir = path.join(rootDir, config.staticContentDir)
|
|
469
|
-
const
|
|
553
|
+
const htmlRelPath = path.relative(clientAbsDir, htmlFilePath)
|
|
554
|
+
const manifestPath = path.join(staticContentAbsDir, htmlRelPath).replace(/\.html$/, '.ui-source-manifest.json')
|
|
470
555
|
|
|
471
556
|
// Check if manifest file exists
|
|
472
557
|
try {
|
|
@@ -486,24 +571,26 @@ const getUIPageSourceFilePaths = (
|
|
|
486
571
|
|
|
487
572
|
// Derive the JS asset name from the manifest's entry field, matching
|
|
488
573
|
// static-content-plugin's formula: path.join(scope, relativePath_without_ext).
|
|
489
|
-
// The
|
|
490
|
-
//
|
|
491
|
-
//
|
|
574
|
+
// The entry path is relative to the client directory and preserves subdirectories.
|
|
575
|
+
// e.g., src/client/main.tsx -> scope/main
|
|
576
|
+
// src/client/admin/settings.tsx -> scope/admin/settings
|
|
492
577
|
if (!manifest.entry || typeof manifest.entry !== 'string') {
|
|
493
578
|
logger.warn(`No entry field in manifest at ${manifestPath}`)
|
|
494
579
|
return empty
|
|
495
580
|
}
|
|
496
|
-
const
|
|
497
|
-
const
|
|
581
|
+
const entryRelativePath = path.relative(config.clientDir, manifest.entry).replace(/\\/g, '/')
|
|
582
|
+
const entryRelativeWithoutExt = entryRelativePath.replace(/\.[^.]+$/, '')
|
|
583
|
+
const entryAssetName = path.join(config.scope, entryRelativeWithoutExt).replace(/\\/g, '/')
|
|
498
584
|
|
|
499
585
|
// Check if a source map bundle also exists in staticContentDir.
|
|
500
586
|
// static-content-plugin names source map assets as: path.join(scope, relativePath.replace('dbx', ''))
|
|
501
|
-
// e.g. main.jsdbx.map ->
|
|
587
|
+
// e.g. main.jsdbx.map -> scope/main.js.map
|
|
588
|
+
// admin/settings.jsdbx.map -> scope/admin/settings.js.map
|
|
502
589
|
const assetNames = [entryAssetName]
|
|
503
|
-
const sourceMapFilePath = path.join(staticContentAbsDir, `${
|
|
590
|
+
const sourceMapFilePath = path.join(staticContentAbsDir, `${entryRelativeWithoutExt}.jsdbx.map`)
|
|
504
591
|
try {
|
|
505
592
|
fs.accessSync(sourceMapFilePath)
|
|
506
|
-
const sourceMapAssetName = path.join(config.scope, `${
|
|
593
|
+
const sourceMapAssetName = path.join(config.scope, `${entryRelativeWithoutExt}.js.map`).replace(/\\/g, '/')
|
|
507
594
|
assetNames.push(sourceMapAssetName)
|
|
508
595
|
} catch {
|
|
509
596
|
// no source map in this build output — skip
|
|
@@ -574,6 +661,8 @@ async function getShapeWithSourceArtifacts(
|
|
|
574
661
|
|
|
575
662
|
if (htmlFileRelativePath && !context.project.isInFluentDir(originalFilePath)) {
|
|
576
663
|
const endpoint = uiPageRecord.get('endpoint').toString().getValue()
|
|
664
|
+
const pageName = uiPageRecord.get('name').toString().getValue()
|
|
665
|
+
const effectiveEndpoint = endpoint || (pageName ? `${pageName}.do` : '')
|
|
577
666
|
const description = uiPageRecord.get('description').toString().getValue()
|
|
578
667
|
const category = uiPageRecord.get('category').toString().getValue()
|
|
579
668
|
const direct = uiPageRecord.get('direct').toString().getValue()
|
|
@@ -587,7 +676,7 @@ async function getShapeWithSourceArtifacts(
|
|
|
587
676
|
|
|
588
677
|
UiPage({
|
|
589
678
|
$id: Now.ID['${uiPageRecord.getId().getValue()}'],
|
|
590
|
-
endpoint: ${JSON.stringify(
|
|
679
|
+
endpoint: ${JSON.stringify(effectiveEndpoint)},
|
|
591
680
|
description: ${JSON.stringify(description)},
|
|
592
681
|
category: ${JSON.stringify(category)},
|
|
593
682
|
direct: ${direct},
|
|
@@ -596,7 +685,7 @@ async function getShapeWithSourceArtifacts(
|
|
|
596
685
|
processingScript: ${JSON.stringify(processingScript)},
|
|
597
686
|
})
|
|
598
687
|
`
|
|
599
|
-
const newFileName =
|
|
688
|
+
const newFileName = effectiveEndpoint.replace('.do', '.now.ts')
|
|
600
689
|
const sourceFileShape = new SourceFileShape({
|
|
601
690
|
source: uiPageRecord,
|
|
602
691
|
path: `${path.join(fluentFileDirByTaxonomy, newFileName)}`,
|
package/src/ui-policy-plugin.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type Record,
|
|
9
9
|
type Shape,
|
|
10
10
|
} from '@servicenow/sdk-build-core'
|
|
11
|
-
import { validateClientSideScript } from './utils'
|
|
11
|
+
import { createSdkDocEntry, validateClientSideScript } from './utils'
|
|
12
12
|
import { NowIdShape } from './now-id-plugin'
|
|
13
13
|
|
|
14
14
|
// Define table names as constants since they're not exported from the core tables
|
|
@@ -93,6 +93,7 @@ const validateScriptProperty = (
|
|
|
93
93
|
|
|
94
94
|
export const UiPolicyPlugin = Plugin.create({
|
|
95
95
|
name: 'UiPolicyPlugin',
|
|
96
|
+
docs: [createSdkDocEntry('UiPolicy', ['sys_ui_policy'])],
|
|
96
97
|
records: {
|
|
97
98
|
[SYS_UI_POLICY]: {
|
|
98
99
|
coalesce: ['table', 'short_description'],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
+
import { createSdkDocEntry } from './utils'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a User Preference (sys_user_preference).
|
|
@@ -16,6 +17,7 @@ import { NowIdShape } from './now-id-plugin'
|
|
|
16
17
|
*/
|
|
17
18
|
export const UserPreferencePlugin = Plugin.create({
|
|
18
19
|
name: 'UserPreferencePlugin',
|
|
20
|
+
docs: [createSdkDocEntry('UserPreference', ['sys_user_preference'])],
|
|
19
21
|
records: {
|
|
20
22
|
sys_user_preference: {
|
|
21
23
|
toShape(record) {
|
package/src/utils.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type Diagnostics,
|
|
6
6
|
type Compiler,
|
|
7
7
|
type PluginApiDoc,
|
|
8
|
+
type Record as FluentRecord,
|
|
8
9
|
} from '@servicenow/sdk-build-core'
|
|
9
10
|
|
|
10
11
|
export function toReference(shape: Shape) {
|
|
@@ -101,9 +102,36 @@ export function validateClientSideScript(script: string, compiler: Compiler): bo
|
|
|
101
102
|
return isValid
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Shows a diagnostic error when a field expects a valid GUID but receives an invalid value.
|
|
107
|
+
*
|
|
108
|
+
* @param inputReceived - The shape containing the invalid value
|
|
109
|
+
* @param fieldName - Name of the field being validated (e.g., 'annotationId', 'formatterRef')
|
|
110
|
+
* @param tableName - ServiceNow table name for the expected reference (e.g., 'sys_ui_annotation')
|
|
111
|
+
* @param diagnostics - Diagnostics collection to add the error to
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* if (!isGUID(annotationSysId)) {
|
|
115
|
+
* showGuidFieldDiagnostic(annotationIdField, 'annotationId', 'sys_ui_annotation', diagnostics)
|
|
116
|
+
* }
|
|
117
|
+
*/
|
|
118
|
+
export const showGuidFieldDiagnostic = (
|
|
119
|
+
inputReceived: Shape | undefined,
|
|
120
|
+
fieldName: string,
|
|
121
|
+
tableName: string,
|
|
122
|
+
diagnostics: Diagnostics
|
|
123
|
+
) => {
|
|
124
|
+
if (inputReceived) {
|
|
125
|
+
const receivedValue = inputReceived.getValue()
|
|
126
|
+
diagnostics.error(
|
|
127
|
+
inputReceived,
|
|
128
|
+
`'${fieldName}' must be a valid GUID or a Record<'${tableName}'>. Received: '${receivedValue}'`
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
104
133
|
/**
|
|
105
134
|
* Creates a documentation entry for first-party SDK plugins.
|
|
106
|
-
* Using this helper ensures apiName and docPath are always in sync.
|
|
107
135
|
*
|
|
108
136
|
* @param apiName - The API name (e.g., 'BusinessRule', 'Acl')
|
|
109
137
|
* @param tags - Keywords for categorization (typically includes the ServiceNow table name)
|
|
@@ -112,7 +140,19 @@ export function validateClientSideScript(script: string, compiler: Compiler): bo
|
|
|
112
140
|
export function createSdkDocEntry(apiName: string, tags: string[]): PluginApiDoc {
|
|
113
141
|
return {
|
|
114
142
|
apiName,
|
|
115
|
-
docPath: `@servicenow/sdk/docs/${apiName}/${apiName}.md`,
|
|
116
143
|
tags,
|
|
117
144
|
}
|
|
118
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Parses a number from a shape record field with fallback to default value.
|
|
149
|
+
* Returns undefined if the field doesn't exist and no default is provided.
|
|
150
|
+
*/
|
|
151
|
+
export function getFieldAsNumber(shape: FluentRecord, fieldName: string, defaultValue?: number): number | undefined {
|
|
152
|
+
const rawValue = shape.get(fieldName)?.getValue()
|
|
153
|
+
if (rawValue === undefined || rawValue === null || rawValue === '') {
|
|
154
|
+
return defaultValue
|
|
155
|
+
}
|
|
156
|
+
const parsed = Number(rawValue)
|
|
157
|
+
return Number.isNaN(parsed) ? defaultValue : parsed
|
|
158
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Plugin, CallExpressionShape, type Record } from '@servicenow/sdk-build-core'
|
|
2
2
|
|
|
3
3
|
import { NowIdShape } from './now-id-plugin'
|
|
4
|
+
import { createSdkDocEntry } from './utils'
|
|
4
5
|
|
|
5
6
|
export const UxListMenuConfigPlugin = Plugin.create({
|
|
6
7
|
name: 'UxListMenuConfigPlugin',
|
|
8
|
+
docs: [createSdkDocEntry('UxListMenuConfig', ['sys_ux_list_menu_config'])],
|
|
7
9
|
records: {
|
|
8
10
|
sys_ux_list_menu_config: {
|
|
9
11
|
relationships: {
|
package/src/view-plugin.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Plugin, Record, RecordId, Shape } from '@servicenow/sdk-build-core'
|
|
1
|
+
import { Plugin, Record, RecordId, Shape, ts } from '@servicenow/sdk-build-core'
|
|
2
2
|
|
|
3
3
|
export const ViewPlugin = Plugin.create({
|
|
4
4
|
name: 'ViewPlugin',
|
|
5
|
+
docs: [],
|
|
5
6
|
records: {
|
|
6
7
|
sys_ui_view: {
|
|
7
8
|
coalesce: ['name'],
|
|
@@ -10,7 +11,7 @@ export const ViewPlugin = Plugin.create({
|
|
|
10
11
|
shapes: [
|
|
11
12
|
{
|
|
12
13
|
shape: Record,
|
|
13
|
-
inspect(record, { diagnostics }) {
|
|
14
|
+
inspect(record, { diagnostics, logger }) {
|
|
14
15
|
if (record.getTable() !== 'sys_ui_view') {
|
|
15
16
|
return
|
|
16
17
|
}
|
|
@@ -21,8 +22,14 @@ export const ViewPlugin = Plugin.create({
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
const viewName = record.get('name')
|
|
24
|
-
if (!viewName.isString() || !/^[a-zA-Z0-9_]+$/.test(viewName.getValue())) {
|
|
25
|
-
|
|
25
|
+
if (!viewName.isString() || !/^[a-zA-Z0-9_,]+$/.test(viewName.getValue())) {
|
|
26
|
+
if (ts.Node.isNode(viewName.getOriginalSource())) {
|
|
27
|
+
diagnostics.error(viewName, `View name can only contain alphanumeric characters`)
|
|
28
|
+
} else {
|
|
29
|
+
logger.warn(
|
|
30
|
+
`[ViewPlugin] View name '${viewName.isString() ? viewName.getValue() : ''}' in ${record.getOriginalFilePath()} can only contain alphanumeric characters`
|
|
31
|
+
)
|
|
32
|
+
}
|
|
26
33
|
}
|
|
27
34
|
},
|
|
28
35
|
},
|
package/src/workspace-plugin.ts
CHANGED
|
@@ -5,8 +5,10 @@ import {
|
|
|
5
5
|
type Record,
|
|
6
6
|
type Shape,
|
|
7
7
|
type ObjectShape,
|
|
8
|
+
Database,
|
|
8
9
|
} from '@servicenow/sdk-build-core'
|
|
9
10
|
import { NowIdShape } from './now-id-plugin'
|
|
11
|
+
import { createSdkDocEntry } from './utils'
|
|
10
12
|
import { parsePagePropChromeTabJson, createChromeTabJsonStringForPageProp } from './workspace-plugin/chrome-tab'
|
|
11
13
|
import { createPage } from './workspace-plugin/page'
|
|
12
14
|
import {
|
|
@@ -41,72 +43,41 @@ type InnerTransformFromObjectShape = Parameters<Parameters<ObjectShape['transfor
|
|
|
41
43
|
|
|
42
44
|
export const WorkspacePlugin = Plugin.create({
|
|
43
45
|
name: 'WorkspacePlugin',
|
|
46
|
+
docs: [createSdkDocEntry('Workspace', ['sys_ux_page_registry'])],
|
|
44
47
|
records: {
|
|
45
48
|
sys_ux_page_registry: {
|
|
46
49
|
relationships: {
|
|
47
50
|
sys_ux_registry_m2m_category: {
|
|
48
|
-
via:
|
|
49
|
-
child.getCreator()?.getName() === 'WorkspacePlugin' &&
|
|
50
|
-
parent.getId().getValue() ===
|
|
51
|
-
(child.get('page_registry').isRecord()
|
|
52
|
-
? child.get('page_registry').asRecord().getId().getValue()
|
|
53
|
-
: child.get('page_registry').asString().getValue()),
|
|
51
|
+
via: 'page_registry',
|
|
54
52
|
descendant: true,
|
|
55
53
|
},
|
|
56
54
|
sys_ux_page_property: {
|
|
57
|
-
via:
|
|
58
|
-
child.getCreator()?.getName() === 'WorkspacePlugin' &&
|
|
59
|
-
parent.getId().getValue() ===
|
|
60
|
-
(child.get('page').isRecord()
|
|
61
|
-
? child.get('page').asRecord().getId().getValue()
|
|
62
|
-
: child.get('page').asString().getValue()),
|
|
55
|
+
via: 'page',
|
|
63
56
|
descendant: true,
|
|
64
57
|
},
|
|
65
58
|
sys_ux_app_config: {
|
|
66
|
-
via:
|
|
67
|
-
|
|
68
|
-
child.getId().getValue() ===
|
|
69
|
-
(parent.get('admin_panel').isRecord()
|
|
70
|
-
? parent.get('admin_panel').asRecord().getId().getValue()
|
|
71
|
-
: parent.get('admin_panel').asString().getValue()),
|
|
59
|
+
via: 'admin_panel',
|
|
60
|
+
inverse: true,
|
|
72
61
|
descendant: true,
|
|
73
62
|
relationships: {
|
|
74
63
|
sys_ux_screen: {
|
|
75
|
-
via:
|
|
76
|
-
child.getCreator()?.getName() === 'WorkspacePlugin' &&
|
|
77
|
-
parent.getId().getValue() ===
|
|
78
|
-
(child.get('app_config').isRecord()
|
|
79
|
-
? child.get('app_config').asRecord().getId().getValue()
|
|
80
|
-
: child.get('app_config').asString().getValue()),
|
|
64
|
+
via: 'app_config',
|
|
81
65
|
descendant: true,
|
|
82
66
|
relationships: {
|
|
83
67
|
sys_ux_macroponent: {
|
|
84
|
-
via:
|
|
85
|
-
|
|
86
|
-
child.getId().getValue() ===
|
|
87
|
-
(parent.get('macroponent').isRecord()
|
|
88
|
-
? parent.get('macroponent').asRecord().getId().getValue()
|
|
89
|
-
: parent.get('macroponent').asString().getValue()),
|
|
68
|
+
via: 'macroponent',
|
|
69
|
+
inverse: true,
|
|
90
70
|
descendant: true,
|
|
91
71
|
},
|
|
92
72
|
},
|
|
93
73
|
},
|
|
94
74
|
sys_ux_app_route: {
|
|
95
|
-
via:
|
|
96
|
-
child.getCreator()?.getName() === 'WorkspacePlugin' &&
|
|
97
|
-
parent.getId().getValue() ===
|
|
98
|
-
(child.get('app_config').isRecord()
|
|
99
|
-
? child.get('app_config').asRecord().getId().getValue()
|
|
100
|
-
: child.get('app_config').asString().getValue()),
|
|
75
|
+
via: 'app_config',
|
|
101
76
|
descendant: true,
|
|
102
77
|
relationships: {
|
|
103
78
|
sys_ux_screen_type: {
|
|
104
|
-
via:
|
|
105
|
-
|
|
106
|
-
child.getId().getValue() ===
|
|
107
|
-
(parent.get('screen_type').isRecord()
|
|
108
|
-
? parent.get('screen_type').asRecord().getId().getValue()
|
|
109
|
-
: parent.get('screen_type').asString().getValue()),
|
|
79
|
+
via: 'screen_type',
|
|
80
|
+
inverse: true,
|
|
110
81
|
descendant: true,
|
|
111
82
|
},
|
|
112
83
|
},
|
|
@@ -114,10 +85,33 @@ export const WorkspacePlugin = Plugin.create({
|
|
|
114
85
|
},
|
|
115
86
|
},
|
|
116
87
|
},
|
|
117
|
-
async toShape(pageRegRecord, { factory, descendants }) {
|
|
88
|
+
async toShape(pageRegRecord, { factory, descendants: descendantsDB }) {
|
|
118
89
|
if (pageRegRecord.getCreator()?.getName() !== 'WorkspacePlugin') {
|
|
119
90
|
return { success: false }
|
|
120
91
|
}
|
|
92
|
+
|
|
93
|
+
const excludedRecords: Record[] = []
|
|
94
|
+
const supportedRecords: Record[] = []
|
|
95
|
+
const partiallySupportedTables = new Set<string>([
|
|
96
|
+
'sys_ux_registry_m2m_category',
|
|
97
|
+
'sys_ux_page_property',
|
|
98
|
+
'sys_ux_app_config',
|
|
99
|
+
'sys_ux_screen',
|
|
100
|
+
'sys_ux_macroponent',
|
|
101
|
+
'sys_ux_app_route',
|
|
102
|
+
'sys_ux_screen_type',
|
|
103
|
+
])
|
|
104
|
+
descendantsDB.query().forEach((descendant) => {
|
|
105
|
+
if (
|
|
106
|
+
partiallySupportedTables.has(descendant.getTable()) &&
|
|
107
|
+
descendant.getCreator()?.getName() !== 'WorkspacePlugin'
|
|
108
|
+
) {
|
|
109
|
+
excludedRecords.push(descendant)
|
|
110
|
+
} else {
|
|
111
|
+
supportedRecords.push(descendant)
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
const descendants = new Database(supportedRecords)
|
|
121
115
|
// Get 'path' and 'title'
|
|
122
116
|
// TODO 'active'
|
|
123
117
|
const path: string = pageRegRecord.get('path').asString().getValue() ?? ''
|
|
@@ -224,6 +218,14 @@ export const WorkspacePlugin = Plugin.create({
|
|
|
224
218
|
defaultRecordOverrides,
|
|
225
219
|
})
|
|
226
220
|
|
|
221
|
+
if (excludedRecords.length > 0) {
|
|
222
|
+
return {
|
|
223
|
+
success: 'partial',
|
|
224
|
+
value: callExpressionShape,
|
|
225
|
+
unhandledRecords: excludedRecords,
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
227
229
|
return {
|
|
228
230
|
success: true,
|
|
229
231
|
value: callExpressionShape,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare module 'eslint-plugin-es-x/lib/rules/no-dynamic-import.js' {
|
|
2
|
-
import type { Rule } from 'eslint'
|
|
3
|
-
const rule: Rule.RuleModule
|
|
4
|
-
export default rule
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
declare module 'eslint-plugin-es-x/lib/rules/no-regexp-lookbehind-assertions.js' {
|
|
8
|
-
import type { Rule } from 'eslint'
|
|
9
|
-
const rule: Rule.RuleModule
|
|
10
|
-
export default rule
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare module 'eslint-plugin-es-x/lib/rules/no-regexp-unicode-property-escapes.js' {
|
|
14
|
-
import type { Rule } from 'eslint'
|
|
15
|
-
const rule: Rule.RuleModule
|
|
16
|
-
export default rule
|
|
17
|
-
}
|