@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.
Files changed (337) hide show
  1. package/dist/acl-plugin.js +54 -4
  2. package/dist/acl-plugin.js.map +1 -1
  3. package/dist/applicability-plugin.js +2 -0
  4. package/dist/applicability-plugin.js.map +1 -1
  5. package/dist/application-menu-plugin.js +2 -0
  6. package/dist/application-menu-plugin.js.map +1 -1
  7. package/dist/arrow-function-plugin.d.ts +6 -1
  8. package/dist/arrow-function-plugin.js +105 -12
  9. package/dist/arrow-function-plugin.js.map +1 -1
  10. package/dist/atf/test-plugin.js +2 -0
  11. package/dist/atf/test-plugin.js.map +1 -1
  12. package/dist/basic-syntax-plugin.js +20 -0
  13. package/dist/basic-syntax-plugin.js.map +1 -1
  14. package/dist/call-expression-plugin.js +1 -0
  15. package/dist/call-expression-plugin.js.map +1 -1
  16. package/dist/claims-plugin.js +1 -0
  17. package/dist/claims-plugin.js.map +1 -1
  18. package/dist/client-script-plugin.js +1 -0
  19. package/dist/client-script-plugin.js.map +1 -1
  20. package/dist/column-plugin.js +4 -7
  21. package/dist/column-plugin.js.map +1 -1
  22. package/dist/cross-scope-privilege-plugin.js +1 -0
  23. package/dist/cross-scope-privilege-plugin.js.map +1 -1
  24. package/dist/dashboard/dashboard-plugin.js +2 -0
  25. package/dist/dashboard/dashboard-plugin.js.map +1 -1
  26. package/dist/data-plugin.js +1 -0
  27. package/dist/data-plugin.js.map +1 -1
  28. package/dist/email-notification-plugin.js +9 -13
  29. package/dist/email-notification-plugin.js.map +1 -1
  30. package/dist/flow/constants/flow-plugin-constants.d.ts +1 -1
  31. package/dist/flow/constants/flow-plugin-constants.js +1 -1
  32. package/dist/flow/constants/flow-plugin-constants.js.map +1 -1
  33. package/dist/flow/flow-logic/flow-logic-diagnostics.js +5 -5
  34. package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -1
  35. package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +82 -2
  36. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +48 -40
  37. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
  38. package/dist/flow/flow-logic/flow-logic-plugin.js +1 -0
  39. package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
  40. package/dist/flow/plugins/approval-rules-plugin.js +1 -0
  41. package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
  42. package/dist/flow/plugins/flow-action-definition-plugin.js +1232 -55
  43. package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
  44. package/dist/flow/plugins/flow-data-pill-plugin.js +6 -2
  45. package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
  46. package/dist/flow/plugins/flow-definition-plugin.js +23 -44
  47. package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
  48. package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +2 -2
  49. package/dist/flow/plugins/flow-diagnostics-plugin.js +3 -2
  50. package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
  51. package/dist/flow/plugins/flow-instance-plugin.js +136 -34
  52. package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
  53. package/dist/flow/plugins/flow-trigger-instance-plugin.js +1 -0
  54. package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
  55. package/dist/flow/plugins/inline-script-plugin.js +1 -0
  56. package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
  57. package/dist/flow/plugins/step-definition-plugin.js +4 -2
  58. package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
  59. package/dist/flow/plugins/step-instance-plugin.d.ts +9 -1
  60. package/dist/flow/plugins/step-instance-plugin.js +649 -135
  61. package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
  62. package/dist/flow/plugins/trigger-plugin.js +2 -0
  63. package/dist/flow/plugins/trigger-plugin.js.map +1 -1
  64. package/dist/flow/plugins/wfa-datapill-plugin.js +21 -5
  65. package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
  66. package/dist/flow/post-install.d.ts +2 -0
  67. package/dist/flow/post-install.js +59 -0
  68. package/dist/flow/post-install.js.map +1 -0
  69. package/dist/flow/utils/complex-object-resolver.js +4 -1
  70. package/dist/flow/utils/complex-object-resolver.js.map +1 -1
  71. package/dist/flow/utils/complex-objects.js +5 -3
  72. package/dist/flow/utils/complex-objects.js.map +1 -1
  73. package/dist/flow/utils/flow-constants.d.ts +90 -2
  74. package/dist/flow/utils/flow-constants.js +430 -7
  75. package/dist/flow/utils/flow-constants.js.map +1 -1
  76. package/dist/flow/utils/flow-io-to-record.d.ts +1 -1
  77. package/dist/flow/utils/flow-io-to-record.js +37 -16
  78. package/dist/flow/utils/flow-io-to-record.js.map +1 -1
  79. package/dist/flow/utils/flow-shapes.js +4 -0
  80. package/dist/flow/utils/flow-shapes.js.map +1 -1
  81. package/dist/flow/utils/flow-to-xml.d.ts +3 -2
  82. package/dist/flow/utils/flow-to-xml.js +3 -4
  83. package/dist/flow/utils/flow-to-xml.js.map +1 -1
  84. package/dist/flow/utils/label-cache-parser.d.ts +9 -2
  85. package/dist/flow/utils/label-cache-parser.js +32 -4
  86. package/dist/flow/utils/label-cache-parser.js.map +1 -1
  87. package/dist/flow/utils/label-cache-processor.d.ts +5 -0
  88. package/dist/flow/utils/label-cache-processor.js +14 -2
  89. package/dist/flow/utils/label-cache-processor.js.map +1 -1
  90. package/dist/flow/utils/pill-shape-helpers.d.ts +15 -0
  91. package/dist/flow/utils/pill-shape-helpers.js +35 -0
  92. package/dist/flow/utils/pill-shape-helpers.js.map +1 -0
  93. package/dist/flow/utils/pill-string-parser.js +1 -0
  94. package/dist/flow/utils/pill-string-parser.js.map +1 -1
  95. package/dist/flow/utils/schema-to-flow-object.d.ts +6 -1
  96. package/dist/flow/utils/schema-to-flow-object.js +131 -15
  97. package/dist/flow/utils/schema-to-flow-object.js.map +1 -1
  98. package/dist/flow/utils/service-catalog.js +5 -1
  99. package/dist/flow/utils/service-catalog.js.map +1 -1
  100. package/dist/flow/utils/utils.d.ts +1 -0
  101. package/dist/flow/utils/utils.js +6 -1
  102. package/dist/flow/utils/utils.js.map +1 -1
  103. package/dist/form-plugin.d.ts +2 -0
  104. package/dist/form-plugin.js +1132 -0
  105. package/dist/form-plugin.js.map +1 -0
  106. package/dist/html-import-plugin.js +1 -0
  107. package/dist/html-import-plugin.js.map +1 -1
  108. package/dist/import-sets-plugin.js +2 -0
  109. package/dist/import-sets-plugin.js.map +1 -1
  110. package/dist/inbound-email-action-plugin.d.ts +10 -0
  111. package/dist/inbound-email-action-plugin.js +128 -0
  112. package/dist/inbound-email-action-plugin.js.map +1 -0
  113. package/dist/index.d.ts +13 -0
  114. package/dist/index.js +17 -1
  115. package/dist/index.js.map +1 -1
  116. package/dist/instance-scan-plugin.d.ts +2 -0
  117. package/dist/instance-scan-plugin.js +293 -0
  118. package/dist/instance-scan-plugin.js.map +1 -0
  119. package/dist/json-plugin.js +1 -0
  120. package/dist/json-plugin.js.map +1 -1
  121. package/dist/list-plugin.js +1 -0
  122. package/dist/list-plugin.js.map +1 -1
  123. package/dist/now-attach-plugin.js +1 -0
  124. package/dist/now-attach-plugin.js.map +1 -1
  125. package/dist/now-config-plugin.js +659 -51
  126. package/dist/now-config-plugin.js.map +1 -1
  127. package/dist/now-id-plugin.js +1 -0
  128. package/dist/now-id-plugin.js.map +1 -1
  129. package/dist/now-include-plugin.js +1 -0
  130. package/dist/now-include-plugin.js.map +1 -1
  131. package/dist/now-ref-plugin.js +1 -0
  132. package/dist/now-ref-plugin.js.map +1 -1
  133. package/dist/now-unresolved-plugin.js +1 -0
  134. package/dist/now-unresolved-plugin.js.map +1 -1
  135. package/dist/package-json-plugin.js +1 -0
  136. package/dist/package-json-plugin.js.map +1 -1
  137. package/dist/property-plugin.js +3 -1
  138. package/dist/property-plugin.js.map +1 -1
  139. package/dist/record-plugin.d.ts +37 -0
  140. package/dist/record-plugin.js +47 -3
  141. package/dist/record-plugin.js.map +1 -1
  142. package/dist/repack/lint/Rules.d.ts +11 -2
  143. package/dist/repack/lint/Rules.js +160 -16
  144. package/dist/repack/lint/Rules.js.map +1 -1
  145. package/dist/repack/lint/index.d.ts +10 -5
  146. package/dist/repack/lint/index.js +76 -50
  147. package/dist/repack/lint/index.js.map +1 -1
  148. package/dist/rest-api-plugin.js +22 -1
  149. package/dist/rest-api-plugin.js.map +1 -1
  150. package/dist/role-plugin.js +1 -0
  151. package/dist/role-plugin.js.map +1 -1
  152. package/dist/schedule-script/index.d.ts +1 -0
  153. package/dist/schedule-script/index.js +18 -0
  154. package/dist/schedule-script/index.js.map +1 -0
  155. package/dist/schedule-script/scheduled-script-plugin.d.ts +2 -0
  156. package/dist/schedule-script/scheduled-script-plugin.js +556 -0
  157. package/dist/schedule-script/scheduled-script-plugin.js.map +1 -0
  158. package/dist/schedule-script/timeZoneConverter.d.ts +61 -0
  159. package/dist/schedule-script/timeZoneConverter.js +170 -0
  160. package/dist/schedule-script/timeZoneConverter.js.map +1 -0
  161. package/dist/script-action-plugin.js +2 -0
  162. package/dist/script-action-plugin.js.map +1 -1
  163. package/dist/script-include-plugin.js +2 -0
  164. package/dist/script-include-plugin.js.map +1 -1
  165. package/dist/server-module-plugin/index.js +13 -2
  166. package/dist/server-module-plugin/index.js.map +1 -1
  167. package/dist/service-catalog/catalog-clientscript-plugin.js +2 -0
  168. package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
  169. package/dist/service-catalog/catalog-item-plugin.js +2 -0
  170. package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
  171. package/dist/service-catalog/catalog-ui-policy-plugin.js +2 -0
  172. package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
  173. package/dist/service-catalog/sc-record-producer-plugin.js +2 -0
  174. package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
  175. package/dist/service-catalog/service-catalog-base.d.ts +18 -18
  176. package/dist/service-catalog/service-catalog-base.js +22 -22
  177. package/dist/service-catalog/service-catalog-base.js.map +1 -1
  178. package/dist/service-catalog/service-catalog-diagnostics.d.ts +6 -0
  179. package/dist/service-catalog/service-catalog-diagnostics.js +20 -0
  180. package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -1
  181. package/dist/service-catalog/shape-to-record.js +7 -2
  182. package/dist/service-catalog/shape-to-record.js.map +1 -1
  183. package/dist/service-catalog/variable-set-plugin.js +2 -0
  184. package/dist/service-catalog/variable-set-plugin.js.map +1 -1
  185. package/dist/service-portal/angular-provider-plugin.js +2 -0
  186. package/dist/service-portal/angular-provider-plugin.js.map +1 -1
  187. package/dist/service-portal/dependency-plugin.js +5 -31
  188. package/dist/service-portal/dependency-plugin.js.map +1 -1
  189. package/dist/service-portal/header-footer-plugin.d.ts +2 -0
  190. package/dist/service-portal/header-footer-plugin.js +50 -0
  191. package/dist/service-portal/header-footer-plugin.js.map +1 -0
  192. package/dist/service-portal/menu-plugin.d.ts +2 -0
  193. package/dist/service-portal/menu-plugin.js +334 -0
  194. package/dist/service-portal/menu-plugin.js.map +1 -0
  195. package/dist/service-portal/page-plugin.d.ts +2 -0
  196. package/dist/service-portal/page-plugin.js +681 -0
  197. package/dist/service-portal/page-plugin.js.map +1 -0
  198. package/dist/service-portal/page-route-map-plugin.d.ts +2 -0
  199. package/dist/service-portal/page-route-map-plugin.js +114 -0
  200. package/dist/service-portal/page-route-map-plugin.js.map +1 -0
  201. package/dist/service-portal/portal-plugin.d.ts +2 -0
  202. package/dist/service-portal/portal-plugin.js +309 -0
  203. package/dist/service-portal/portal-plugin.js.map +1 -0
  204. package/dist/service-portal/theme-plugin.d.ts +2 -0
  205. package/dist/service-portal/theme-plugin.js +112 -0
  206. package/dist/service-portal/theme-plugin.js.map +1 -0
  207. package/dist/service-portal/utils.d.ts +46 -0
  208. package/dist/service-portal/utils.js +331 -0
  209. package/dist/service-portal/utils.js.map +1 -0
  210. package/dist/service-portal/widget-plugin.js +10 -182
  211. package/dist/service-portal/widget-plugin.js.map +1 -1
  212. package/dist/sla-plugin.js +2 -0
  213. package/dist/sla-plugin.js.map +1 -1
  214. package/dist/static-content-plugin.js +5 -0
  215. package/dist/static-content-plugin.js.map +1 -1
  216. package/dist/table-plugin.js +191 -26
  217. package/dist/table-plugin.js.map +1 -1
  218. package/dist/ui-action-plugin.js +3 -4
  219. package/dist/ui-action-plugin.js.map +1 -1
  220. package/dist/ui-page-plugin.js +101 -21
  221. package/dist/ui-page-plugin.js.map +1 -1
  222. package/dist/ui-policy-plugin.js +1 -0
  223. package/dist/ui-policy-plugin.js.map +1 -1
  224. package/dist/user-preference-plugin.js +2 -0
  225. package/dist/user-preference-plugin.js.map +1 -1
  226. package/dist/utils.d.ts +20 -2
  227. package/dist/utils.js +34 -3
  228. package/dist/utils.js.map +1 -1
  229. package/dist/ux-list-menu-config-plugin.js +2 -0
  230. package/dist/ux-list-menu-config-plugin.js.map +1 -1
  231. package/dist/view-plugin.js +9 -3
  232. package/dist/view-plugin.js.map +1 -1
  233. package/dist/workspace-plugin.js +41 -36
  234. package/dist/workspace-plugin.js.map +1 -1
  235. package/package.json +11 -11
  236. package/src/_types/eslint-community-eslint-utils.d.ts +15 -0
  237. package/src/acl-plugin.ts +97 -8
  238. package/src/applicability-plugin.ts +2 -0
  239. package/src/application-menu-plugin.ts +2 -0
  240. package/src/arrow-function-plugin.ts +128 -13
  241. package/src/atf/test-plugin.ts +2 -0
  242. package/src/basic-syntax-plugin.ts +21 -0
  243. package/src/call-expression-plugin.ts +1 -0
  244. package/src/claims-plugin.ts +1 -0
  245. package/src/client-script-plugin.ts +2 -1
  246. package/src/column-plugin.ts +4 -8
  247. package/src/cross-scope-privilege-plugin.ts +2 -1
  248. package/src/dashboard/dashboard-plugin.ts +2 -0
  249. package/src/data-plugin.ts +1 -0
  250. package/src/email-notification-plugin.ts +3 -23
  251. package/src/flow/constants/flow-plugin-constants.ts +1 -1
  252. package/src/flow/flow-logic/flow-logic-diagnostics.ts +5 -6
  253. package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +47 -45
  254. package/src/flow/flow-logic/flow-logic-plugin.ts +1 -0
  255. package/src/flow/plugins/approval-rules-plugin.ts +1 -0
  256. package/src/flow/plugins/flow-action-definition-plugin.ts +1584 -62
  257. package/src/flow/plugins/flow-data-pill-plugin.ts +6 -2
  258. package/src/flow/plugins/flow-definition-plugin.ts +22 -51
  259. package/src/flow/plugins/flow-diagnostics-plugin.ts +3 -2
  260. package/src/flow/plugins/flow-instance-plugin.ts +201 -36
  261. package/src/flow/plugins/flow-trigger-instance-plugin.ts +1 -0
  262. package/src/flow/plugins/inline-script-plugin.ts +1 -0
  263. package/src/flow/plugins/step-definition-plugin.ts +4 -2
  264. package/src/flow/plugins/step-instance-plugin.ts +772 -155
  265. package/src/flow/plugins/trigger-plugin.ts +2 -0
  266. package/src/flow/plugins/wfa-datapill-plugin.ts +26 -5
  267. package/src/flow/post-install.ts +93 -0
  268. package/src/flow/utils/complex-object-resolver.ts +4 -1
  269. package/src/flow/utils/complex-objects.ts +11 -3
  270. package/src/flow/utils/flow-constants.ts +451 -6
  271. package/src/flow/utils/flow-io-to-record.ts +43 -17
  272. package/src/flow/utils/flow-shapes.ts +4 -0
  273. package/src/flow/utils/flow-to-xml.ts +4 -4
  274. package/src/flow/utils/label-cache-parser.ts +33 -4
  275. package/src/flow/utils/label-cache-processor.ts +14 -2
  276. package/src/flow/utils/pill-shape-helpers.ts +42 -0
  277. package/src/flow/utils/pill-string-parser.ts +1 -0
  278. package/src/flow/utils/schema-to-flow-object.ts +183 -15
  279. package/src/flow/utils/service-catalog.ts +5 -2
  280. package/src/flow/utils/utils.ts +12 -1
  281. package/src/form-plugin.ts +1409 -0
  282. package/src/html-import-plugin.ts +1 -0
  283. package/src/import-sets-plugin.ts +2 -0
  284. package/src/inbound-email-action-plugin.ts +145 -0
  285. package/src/index.ts +13 -0
  286. package/src/instance-scan-plugin.ts +313 -0
  287. package/src/json-plugin.ts +1 -0
  288. package/src/list-plugin.ts +2 -1
  289. package/src/now-attach-plugin.ts +1 -0
  290. package/src/now-config-plugin.ts +833 -53
  291. package/src/now-id-plugin.ts +1 -0
  292. package/src/now-include-plugin.ts +1 -0
  293. package/src/now-ref-plugin.ts +1 -0
  294. package/src/now-unresolved-plugin.ts +1 -0
  295. package/src/package-json-plugin.ts +1 -0
  296. package/src/property-plugin.ts +6 -1
  297. package/src/record-plugin.ts +56 -6
  298. package/src/repack/lint/Rules.ts +171 -22
  299. package/src/repack/lint/index.ts +80 -56
  300. package/src/rest-api-plugin.ts +28 -2
  301. package/src/role-plugin.ts +2 -1
  302. package/src/schedule-script/index.ts +1 -0
  303. package/src/schedule-script/scheduled-script-plugin.ts +690 -0
  304. package/src/schedule-script/timeZoneConverter.ts +188 -0
  305. package/src/script-action-plugin.ts +2 -0
  306. package/src/script-include-plugin.ts +2 -0
  307. package/src/server-module-plugin/index.ts +14 -2
  308. package/src/service-catalog/catalog-clientscript-plugin.ts +2 -0
  309. package/src/service-catalog/catalog-item-plugin.ts +2 -0
  310. package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -0
  311. package/src/service-catalog/sc-record-producer-plugin.ts +2 -0
  312. package/src/service-catalog/service-catalog-base.ts +22 -22
  313. package/src/service-catalog/service-catalog-diagnostics.ts +30 -0
  314. package/src/service-catalog/shape-to-record.ts +8 -2
  315. package/src/service-catalog/variable-set-plugin.ts +2 -0
  316. package/src/service-portal/angular-provider-plugin.ts +2 -0
  317. package/src/service-portal/dependency-plugin.ts +6 -53
  318. package/src/service-portal/header-footer-plugin.ts +57 -0
  319. package/src/service-portal/menu-plugin.ts +413 -0
  320. package/src/service-portal/page-plugin.ts +805 -0
  321. package/src/service-portal/page-route-map-plugin.ts +124 -0
  322. package/src/service-portal/portal-plugin.ts +342 -0
  323. package/src/service-portal/theme-plugin.ts +135 -0
  324. package/src/service-portal/utils.ts +470 -0
  325. package/src/service-portal/widget-plugin.ts +18 -224
  326. package/src/sla-plugin.ts +2 -0
  327. package/src/static-content-plugin.ts +4 -0
  328. package/src/table-plugin.ts +228 -37
  329. package/src/ui-action-plugin.ts +3 -8
  330. package/src/ui-page-plugin.ts +110 -21
  331. package/src/ui-policy-plugin.ts +2 -1
  332. package/src/user-preference-plugin.ts +2 -0
  333. package/src/utils.ts +42 -2
  334. package/src/ux-list-menu-config-plugin.ts +2 -0
  335. package/src/view-plugin.ts +11 -4
  336. package/src/workspace-plugin.ts +45 -43
  337. package/src/_types/eslint-plugin-es-x.d.ts +0 -17
@@ -21,24 +21,64 @@ export const UNSUPPORTED_FLOW_DESCENDANTS = [
21
21
  ACTION_INSTANCE_TABLE,
22
22
  SUBFLOW_INSTANCE_TABLE,
23
23
  FLOW_LOGIC_INSTANCE_TABLE,
24
- SUBFLOW_INSTANCE_TABLE_V2,
25
24
  ]
26
25
 
27
26
  //Plugins callee names
28
27
  export const FLOW_API_NAME = 'Flow'
29
28
  export const SUBFLOW_API_NAME = 'Subflow'
30
- export const ACTION_DEFINITION_API_NAME = 'ActionDefinition'
29
+ export const ACTION_DEFINITION_API_NAME = 'Action'
31
30
  export const TRIGGER_DEFINITION_API_NAME = 'TriggerDefinition'
32
31
 
33
32
  export const TRIGGER_INSTANCE_API_NAME = 'wfa.trigger'
34
33
  export const ACTION_INSTANCE_API_NAME = 'wfa.action'
35
34
  export const SUBFLOW_INSTANCE_API_NAME = 'wfa.subflow'
36
- export const ACTION_STEP_INSTANCE_API_NAME = 'wfa.action_step'
35
+ export const ACTION_STEP_INSTANCE_API_NAME = 'wfa.actionStep'
37
36
  export const APPROVAL_RULES_API_NAME = 'wfa.approvalRules'
38
37
  export const APPROVAL_DUE_DATE_API_NAME = 'wfa.approvalDueDate'
39
38
 
39
+ export const FLOW_OBJECT_API_NAME = 'FlowObject'
40
+ export const FLOW_ARRAY_API_NAME = 'FlowArray'
41
+
40
42
  export const ELEMENT_MAPPING_PROVIDER = 'com.glide.flow_design.action.data.FlowDesignVariableMapper'
41
43
 
44
+ const UI_TYPE_LABEL: { [key: string]: string } = {
45
+ string: 'String',
46
+ integer: 'Integer',
47
+ boolean: 'True/False',
48
+ decimal: 'Decimal',
49
+ float: 'Float',
50
+ date: 'Date',
51
+ glide_date: 'Date',
52
+ glide_date_time: 'Date/Time',
53
+ datetime: 'Date/Time',
54
+ reference: 'Reference',
55
+ choice: 'Choice',
56
+ table_name: 'Table Name',
57
+ field_name: 'Field Name',
58
+ document_id: 'Document ID',
59
+ json: 'JSON',
60
+ script: 'Script',
61
+ url: 'URL',
62
+ html: 'HTML',
63
+ email: 'Email',
64
+ password2: 'Password',
65
+ glide_duration: 'Duration',
66
+ conditions: 'Conditions',
67
+ template_value: 'Template Value',
68
+ records: 'Records',
69
+ }
70
+
71
+ /** Returns the human-readable uiTypeLabel for a given internal_type (e.g. 'integer' → 'Integer') */
72
+ export function getUiTypeLabel(internalType: string): string {
73
+ return UI_TYPE_LABEL[internalType] ?? internalType.charAt(0).toUpperCase() + internalType.slice(1)
74
+ }
75
+
76
+ /** Builds the attributes string for sys_hub_step_ext_input/output records */
77
+ export function buildExtVarAttributes(internalType: string): string {
78
+ const uiTypeLabel = getUiTypeLabel(internalType)
79
+ return `element_mapping_provider=${ELEMENT_MAPPING_PROVIDER},uiType=${internalType},uiTypeLabel=${uiTypeLabel}`
80
+ }
81
+
42
82
  export const TRIGGER_TYPE_KEY_NAME = 'trigger_type'
43
83
  export const ACTION_TYPE_KEY_NAME = 'action_type'
44
84
 
@@ -67,8 +107,9 @@ export const CORE_ACTIONS_PREFIX = 'action.core'
67
107
  export const RUN_ON_EXTENDED = 'run_on_extended'
68
108
 
69
109
  export const APPROVAL_DUE_DATE_INPUT_FIELD_ACTIONS = [
70
- 'f8f2e9920b10030085c083eb37673abd',
71
- 'cd04ac7573011010791f94596bf6a716',
110
+ 'f8f2e9920b10030085c083eb37673abd', // askForApproval action definition sys_id (flow context)
111
+ 'cd04ac7573011010791f94596bf6a716', // originally added in DEF0789002 — sys_id identity unknown, needs investigation
112
+ 'a4eb47900b22320085c083eb37673acc', // askForApproval step definition sys_id (action definition context)
72
113
  ]
73
114
 
74
115
  export const CORE_ACTIONS_SYS_ID_NAME_MAP: { [sysId: string]: string } = {
@@ -99,7 +140,7 @@ export const CORE_ACTIONS_SYS_ID_NAME_MAP: { [sysId: string]: string } = {
99
140
  '0d8dd9f10f11101051218e8ebc767e27': 'sendNotification',
100
141
  '027499be7333001099792f163cf6a7a7': 'sendSms',
101
142
  a1a50c4573873300d70877186bf6a762: 'slaPercentageTimer',
102
- c7a04c4607312001098e194596bf6a72a: 'submitCatalogItemRequest',
143
+ c7a04c607312001098e194596bf6a72a: 'submitCatalogItemRequest',
103
144
  '9daf2a72c75100105312134c95c26073': 'updateMultipleRecords',
104
145
  f9d01dd2c31332002841b63b12d3aea1: 'updateRecord',
105
146
  '89ce8a4187120010663ca1bb36cb0be3': 'waitForCondition',
@@ -107,12 +148,387 @@ export const CORE_ACTIONS_SYS_ID_NAME_MAP: { [sysId: string]: string } = {
107
148
  '605d0ab8931012105cd18166448918db': 'waitForMessage',
108
149
  }
109
150
 
151
+ /**
152
+ * Prefix for built-in action step references in generated Fluent code.
153
+ * Produces identifiers like `actionStep.createRecord`, `actionStep.log`, etc.
154
+ */
155
+ export const BUILT_IN_STEP_PREFIX = 'actionStep'
156
+
157
+ /**
158
+ * Maps built-in step definition sys_ids to their `actionStep.xxx` property name.
159
+ * Used during XML→Fluent transform to emit typed references instead of strings.
160
+ * Follows the same pattern as CORE_ACTIONS_SYS_ID_NAME_MAP for actions.
161
+ */
162
+ export const BUILT_IN_STEP_SYS_ID_NAME_MAP: { [sysId: string]: string } = {
163
+ a03fea9bc712220061f553c6f09763b1: 'log',
164
+ '9cbaa0f267003200553fafb49585ef69': 'createRecord',
165
+ '106afb6647032200b4fad7527c9a71e7': 'script',
166
+
167
+ '07973e960b233200cbd9e240e0ea604e': 'createTask',
168
+ '05a6e480a301311029c4d1f3e31e61f1': 'collectActivityContext',
169
+ '092bb996ff30311077a95dac793bf166': 'fireEvent',
170
+ '0d9746f0931012105cd181664489188c': 'waitForMessage',
171
+ '0e07df020f13101051218e8ebc767e57': 'getLatestResponseTextFromEmail',
172
+
173
+ '48526b2dc32a32002841b63b12d3ae72': 'lookUpRecords',
174
+ '4c5f36a37f0b32005f58108c3ffa9126': 'email',
175
+ '4c9234ca0b18030085c083eb37673aaa': 'waitForCondition',
176
+ '5d31f8f37f1322004d145212bdfa9145': 'notification',
177
+ '65a40b525b12101083f30f216581c787': 'createAppFromPayload',
178
+ '81e15fbd7fcb12108e688c90ac866541': 'waitForEmailReply',
179
+ '8c6b7466c71100105312134c95c2602a': 'deleteMultipleRecords',
180
+ '8f5c107a53a3230034c6ddeeff7b129d': 'createOrUpdateRecord',
181
+ a3dfc066c7dd00105312134c95c26014: 'updateMultipleRecords',
182
+ a4eb47900b22320085c083eb37673acc: 'askForApproval',
183
+ b51f683667003200553fafb49585ef3f: 'updateRecord',
184
+ b67821c1c723220061f553c6f09763c2: 'deleteRecord',
185
+ dc9c26043b23220057a4a2e334efc447: 'lookUpRecord',
186
+ e0b9272d53112110aba6ddeeff7b1224: 'createRecordForRemoteTable',
187
+ f760b5c2737c001086592f163cf6a758: 'sms',
188
+ }
189
+
190
+ /**
191
+ * A step variable entry: either a plain element name (string)
192
+ * or an object with element name + uiType for value coercion during transform.
193
+ */
194
+ export type StepVarEntry = string | { name: string; uiType: string }
195
+
196
+ /** Extract the element name from a StepVarEntry */
197
+ export function getVarEntryName(entry: StepVarEntry): string {
198
+ return typeof entry === 'string' ? entry : entry.name
199
+ }
200
+
201
+ /** Extract the uiType from a StepVarEntry (undefined for plain strings) */
202
+ export function getVarEntryType(entry: StepVarEntry): string | undefined {
203
+ return typeof entry === 'string' ? undefined : entry.uiType
204
+ }
205
+
206
+ /**
207
+ * Maps built-in step definition sys_ids to their metadata including
208
+ * input/output variable sys_id → element name mappings.
209
+ * Used during XML→Fluent transform to resolve OOB step definitions
210
+ * and their sys_variable_value records into proper element names.
211
+ */
212
+ export const BUILT_IN_STEP_DEFINITIONS: {
213
+ [sysId: string]: {
214
+ name: string
215
+ inputs: { [varSysId: string]: StepVarEntry }
216
+ outputs: { [varSysId: string]: StepVarEntry }
217
+ }
218
+ } = {
219
+ a03fea9bc712220061f553c6f09763b1: {
220
+ name: 'Log',
221
+ inputs: {
222
+ '4fc2fadbc712220061f553c6f0976388': 'log_message',
223
+ ab123adbc712220061f553c6f0976387: 'log_level',
224
+ },
225
+ outputs: {},
226
+ },
227
+ '9cbaa0f267003200553fafb49585ef69': {
228
+ name: 'Create Record',
229
+ inputs: {
230
+ '9e5f9d85536333003bf1d9109ec587c6': { name: 'skip_insert', uiType: 'boolean' },
231
+ e78d203667003200553fafb49585ef63: { name: 'create_record_field_values', uiType: 'template_value' },
232
+ f0fb68f267003200553fafb49585efa0: 'create_record_table_name',
233
+ },
234
+ outputs: {
235
+ '795c557267003200553fafb49585efb0': 'table_name',
236
+ '966cd57267003200553fafb49585efa0': 'record',
237
+ },
238
+ },
239
+ '106afb6647032200b4fad7527c9a71e7': {
240
+ name: 'Script',
241
+ inputs: {
242
+ '0d2db9e653310110d3a8ddeeff7b1208': 'mid_cluster',
243
+ '28e4e579b3101300176b051a16a8dc0f': 'host',
244
+ '2b2ba571b3101300176b051a16a8dc8f': 'connection_alias',
245
+ '2c226939b3101300176b051a16a8dc83': 'mid_selection_type',
246
+ '71aa7f6647032200b4fad7527c9a719b': 'script',
247
+ '74315b04b3201300176b051a16a8dc2b': 'required_run_time',
248
+ '7d36ed79b3101300176b051a16a8dceb': 'capabilities',
249
+ cbd1070373531010791f94596bf6a776: 'mid_selection',
250
+ f0d58b8373531010791f94596bf6a7be: 'mid_server',
251
+ f5e56d79b3101300176b051a16a8dce4: 'application',
252
+ },
253
+ outputs: {},
254
+ },
255
+ '07973e960b233200cbd9e240e0ea604e': {
256
+ name: 'Create Task',
257
+ inputs: {
258
+ '1aeb688553af33003bf1d9109ec58710': { name: 'skip_insert', uiType: 'boolean' },
259
+ '2a7872d60b233200cbd9e240e0ea601e': { name: 'create_record_field_values', uiType: 'template_value' },
260
+ '9b6832d60b233200cbd9e240e0ea601c': 'create_record_table_name',
261
+ a498b2d60b233200cbd9e240e0ea6004: { name: 'wait', uiType: 'boolean' },
262
+ },
263
+ outputs: {
264
+ '19efa6b653333200f5bf435723dc340e': 'table',
265
+ '9f0b036353233200f5bf435723dc3475': 'task',
266
+ },
267
+ },
268
+ '092bb996ff30311077a95dac793bf166': {
269
+ name: 'Fire Event',
270
+ inputs: {
271
+ '020ebd5aff30311077a95dac793bf1ea': 'table',
272
+ '077ef59aff30311077a95dac793bf1ba': 'parm1',
273
+ '17be7d9aff30311077a95dac793bf18f': 'parm2',
274
+ '599cf11aff30311077a95dac793bf1d2': 'event_name',
275
+ a3ad395aff30311077a95dac793bf12e: 'record',
276
+ },
277
+ outputs: {},
278
+ },
279
+ b51f683667003200553fafb49585ef3f: {
280
+ name: 'Update Record',
281
+ inputs: {
282
+ '3930d57267003200553fafb49585efc5': 'table_name',
283
+ aab0ddb267003200553fafb49585ef30: 'record',
284
+ fcbf6c3667003200553fafb49585ef2e: { name: 'update_record_field_values', uiType: 'template_value' },
285
+ },
286
+ outputs: {
287
+ '2fb3d57267003200553fafb49585ef43': 'table_name',
288
+ ffd3197267003200553fafb49585ef5a: 'record',
289
+ },
290
+ },
291
+ b67821c1c723220061f553c6f09763c2: {
292
+ name: 'Delete Record',
293
+ inputs: {
294
+ '995a2105c723220061f553c6f0976301': 'record',
295
+ ab19a9c1c723220061f553c6f0976383: 'table_name',
296
+ },
297
+ outputs: {},
298
+ },
299
+ dc9c26043b23220057a4a2e334efc447: {
300
+ name: 'Look Up Record',
301
+ inputs: {
302
+ '0cfca6043b23220057a4a2e334efc43b': { name: 'conditions', uiType: 'conditions' },
303
+ '3b9387923b23220057a4a2e334efc4e4': 'multiple_records_found',
304
+ a6da115587003300663ca1bb36cb0bc0: 'sort_column',
305
+ b019356673110010d70877186bf6a780: { name: 'dont_fail_flow_on_error', uiType: 'boolean' },
306
+ c62b915587003300663ca1bb36cb0bd2: 'sort_type',
307
+ f9cc66043b23220057a4a2e334efc42f: 'lookup_table_name',
308
+ },
309
+ outputs: {
310
+ '145a3da673110010d70877186bf6a7a5': 'error_message',
311
+ '14bd89c673310010d70877186bf6a7be': 'status',
312
+ a64d6a043b23220057a4a2e334efc4e8: 'table_name',
313
+ d3e627913b23220057a4a2e334efc45e: 'record',
314
+ },
315
+ },
316
+ '48526b2dc32a32002841b63b12d3ae72': {
317
+ name: 'Look Up Records',
318
+ inputs: {
319
+ '0677f8e053200300f5bf435723dc34e3': { name: 'limit', uiType: 'integer' },
320
+ '2df79dd187003300663ca1bb36cb0b33': 'sort_column',
321
+ '4d19bb21c36a32002841b63b12d3aeef': 'table_name',
322
+ '6a88151587003300663ca1bb36cb0b14': 'sort_type',
323
+ '95f8bb21c36a32002841b63b12d3ae0c': { name: 'conditions', uiType: 'conditions' },
324
+ },
325
+ outputs: {
326
+ '5db8f721c36a32002841b63b12d3aeb7': 'records',
327
+ c576f2a2c32232002841b63b12d3ae66: 'table_name',
328
+ f6700274c32b32002841b63b12d3ae37: { name: 'count', uiType: 'integer' },
329
+ },
330
+ },
331
+ a3dfc066c7dd00105312134c95c26014: {
332
+ name: 'Update Multiple Records',
333
+ inputs: {
334
+ '0f7194a6c7dd00105312134c95c26028': { name: 'set_autosysfields', uiType: 'boolean' },
335
+ '168d8069c7ee00105312134c95c260a7': 'sort_column',
336
+ '66401866c7dd00105312134c95c2607e': { name: 'conditions', uiType: 'conditions' },
337
+ '71ad0469c7ee00105312134c95c26027': 'sort_type',
338
+ '8a6154a6c7dd00105312134c95c26019': { name: 'set_workflow', uiType: 'boolean' },
339
+ a5505866c7dd00105312134c95c26065: { name: 'field_values', uiType: 'template_value' },
340
+ c530d466c7dd00105312134c95c26066: 'table_name',
341
+ e2214bd6c72a40105312134c95c2600c: { name: 'dont_fail_flow_on_error', uiType: 'boolean' },
342
+ },
343
+ outputs: {
344
+ '10209466c7dd00105312134c95c26031': 'error_message',
345
+ '4f814fd6c72a40105312134c95c26001': 'status',
346
+ a4101466c7dd00105312134c95c260a8: { name: 'count', uiType: 'integer' },
347
+ },
348
+ },
349
+ '8c6b7466c71100105312134c95c2602a': {
350
+ name: 'Delete Multiple Records',
351
+ inputs: {
352
+ '156c34a6c71100105312134c95c26068': { name: 'set_workflow', uiType: 'boolean' },
353
+ '693c70a6c71100105312134c95c26011': 'table_name',
354
+ '76207652c72a40105312134c95c26083': { name: 'dont_fail_flow_on_error', uiType: 'boolean' },
355
+ '79fb8029c7ee00105312134c95c26042': 'sort_column',
356
+ a34cb0a6c71100105312134c95c260a3: { name: 'conditions', uiType: 'conditions' },
357
+ a85c8429c7ee00105312134c95c26033: 'sort_type',
358
+ },
359
+ outputs: {
360
+ '60fbbc66c71100105312134c95c26033': 'error_message',
361
+ ce41be52c72a40105312134c95c2606b: 'status',
362
+ e7db3c66c71100105312134c95c26031: { name: 'count', uiType: 'integer' },
363
+ },
364
+ },
365
+ '4c5f36a37f0b32005f58108c3ffa9126': {
366
+ name: 'Email',
367
+ inputs: {
368
+ '0fba76757303230082999cfd7bf6a7f2': { name: 'watermark_email', uiType: 'boolean' },
369
+ '33c003277f0b32005f58108c3ffa91e8': 'cc',
370
+ '40cf3ae37f0b32005f58108c3ffa91f3': 'to',
371
+ '4d0183277f0b32005f58108c3ffa9197': 'subject',
372
+ '8ef44f277f0b32005f58108c3ffa91f7': 'body',
373
+ '9971a338a70323008299b39f08790195': 'record',
374
+ e1312338a70323008299b39f087901f5: 'table_name',
375
+ e8f043277f0b32005f58108c3ffa91d1: 'bcc',
376
+ },
377
+ outputs: {
378
+ f4a503677f0b32005f58108c3ffa91cf: 'email',
379
+ },
380
+ },
381
+ '5d31f8f37f1322004d145212bdfa9145': {
382
+ name: 'Notification',
383
+ inputs: {
384
+ '4d1cbc717f0332004d145212bdfa91b8': 'record',
385
+ b8a793697f2a32005f58108c3ffa910b: 'table_name',
386
+ cc7fb8b17f0332004d145212bdfa91da: 'notification',
387
+ },
388
+ outputs: {},
389
+ },
390
+ a4eb47900b22320085c083eb37673acc: {
391
+ name: 'Ask for Approval',
392
+ inputs: {
393
+ '30a496c67f3012108e688c90ac8665a0': 'approval_reason',
394
+ '745c0f900b22320085c083eb37673a79': { name: 'approval_conditions', uiType: 'approval_rules' },
395
+ '982c8b900b22320085c083eb37673a7c': 'record',
396
+ a44ccb900b22320085c083eb37673ab4: 'table',
397
+ d3dac4860b333200c438ee6537673a5a: { name: 'due_date', uiType: 'schedule_date_time' },
398
+ db521c5567323200c4098c7942415a67: 'approval_field',
399
+ f7b3d09567323200c4098c7942415a65: 'journal_field',
400
+ },
401
+ outputs: {
402
+ aa7568070b23320085c083eb37673a73: 'state',
403
+ },
404
+ },
405
+ '4c9234ca0b18030085c083eb37673aaa': {
406
+ name: 'Wait For Condition',
407
+ inputs: {
408
+ '1fac6063876100102fa5a1bb36cb0bac': { name: 'timeout_duration', uiType: 'glide_duration' },
409
+ '72b2bcca0b18030085c083eb37673a0b': 'table_name',
410
+ '7de2fcca0b18030085c083eb37673aed': { name: 'conditions', uiType: 'conditions' },
411
+ ae1d6463876100102fa5a1bb36cb0b56: 'timeout_schedule',
412
+ bc93428187120010663ca1bb36cb0b83: { name: 'timeout_flag', uiType: 'boolean' },
413
+ c5d2fcca0b18030085c083eb37673a1c: 'record',
414
+ },
415
+ outputs: {
416
+ '1fbdac63876100102fa5a1bb36cb0ba2': 'state',
417
+ },
418
+ },
419
+ '81e15fbd7fcb12108e688c90ac866541': {
420
+ name: 'Wait For Email Reply',
421
+ inputs: {
422
+ '391597b17f0f12108e688c90ac866571': 'record',
423
+ '3e78d3b57f0f12108e688c90ac86653b': { name: 'timeout_duration', uiType: 'glide_duration' },
424
+ b3285f757f0f12108e688c90ac866575: { name: 'enable_timeout', uiType: 'boolean' },
425
+ b7a8d7b57f0f12108e688c90ac86659f: 'timeout_schedule',
426
+ },
427
+ outputs: {
428
+ '10991bf57f0f12108e688c90ac866577': 'email_reply',
429
+ '752ad3397f0f12108e688c90ac866579': 'state',
430
+ },
431
+ },
432
+ '0d9746f0931012105cd181664489188c': {
433
+ name: 'Wait For Message',
434
+ inputs: {
435
+ '15a942b4931012105cd18166448918bc': { name: 'timeout_duration', uiType: 'glide_duration' },
436
+ '83e74ef0931012105cd181664489182b': 'message',
437
+ d728c634931012105cd18166448918b0: { name: 'enable_timeout', uiType: 'boolean' },
438
+ },
439
+ outputs: {
440
+ '640b4ef4931012105cd181664489180b': 'payload',
441
+ },
442
+ },
443
+ '8f5c107a53a3230034c6ddeeff7b129d': {
444
+ name: 'Create or Update Record',
445
+ inputs: {
446
+ '5eac547a53a3230034c6ddeeff7b12c7': { name: 'fields', uiType: 'template_value' },
447
+ '728c907a53a3230034c6ddeeff7b12e9': 'table',
448
+ },
449
+ outputs: {
450
+ '5d0ade9c537b230034c6ddeeff7b12ac': 'record',
451
+ '9c9ad6dc537b230034c6ddeeff7b127e': 'table_name',
452
+ '9dbbda1053bb230034c6ddeeff7b12c8': 'error_message',
453
+ b32b521053bb230034c6ddeeff7b12d2: 'status',
454
+ },
455
+ },
456
+ f760b5c2737c001086592f163cf6a758: {
457
+ name: 'SMS',
458
+ inputs: {
459
+ c951b106737c001086592f163cf6a75a: 'message',
460
+ dd317dc2737c001086592f163cf6a7fe: 'recipients',
461
+ },
462
+ outputs: {
463
+ '29817506737c001086592f163cf6a72d': 'email',
464
+ },
465
+ },
466
+ '05a6e480a301311029c4d1f3e31e61f1': {
467
+ name: 'Collect Activity Context',
468
+ inputs: {},
469
+ outputs: {
470
+ '89e202b9a3013110fc7ad1f3e31e616d': 'activity_context',
471
+ },
472
+ },
473
+ '65a40b525b12101083f30f216581c787': {
474
+ name: 'Create App From Payload',
475
+ inputs: {
476
+ '03c116415b03101083f30f216581c74d': 'template_instance_id',
477
+ c74f30905b33101083f30f216581c7f0: 'scan_id',
478
+ },
479
+ outputs: {
480
+ f343f3925b12101083f30f216581c739: 'sys_app_id',
481
+ },
482
+ },
483
+ e0b9272d53112110aba6ddeeff7b1224: {
484
+ name: 'Create Record For Remote Table',
485
+ inputs: {
486
+ '8d068211a3913110aba698e6d31e61b6': 'query_id',
487
+ c442d88a53912110aba6ddeeff7b1277: 'create_record_table_name',
488
+ e5d96b2d53112110aba6ddeeff7b1236: { name: 'create_record_field_values', uiType: 'template_value' },
489
+ },
490
+ outputs: {
491
+ '2b3a236d53112110aba6ddeeff7b129d': 'table_name',
492
+ },
493
+ },
494
+ '0e07df020f13101051218e8ebc767e57': {
495
+ name: 'Get Latest Response Text From Email',
496
+ inputs: {
497
+ '44d757420f13101051218e8ebc767eee': 'email_record',
498
+ },
499
+ outputs: {
500
+ '6f88df420f13101051218e8ebc767e67': 'latest_response_text',
501
+ },
502
+ },
503
+ }
504
+
505
+ /**
506
+ * Reverse lookup: step definition name → first matching sys_id.
507
+ * Used during Fluent→XML build to resolve string step type names
508
+ * back to their platform sys_ids.
509
+ */
510
+ export const BUILT_IN_STEP_NAME_TO_SYSID: { [name: string]: string } = {}
511
+ for (const [sysId, def] of Object.entries(BUILT_IN_STEP_DEFINITIONS)) {
512
+ if (!BUILT_IN_STEP_NAME_TO_SYSID[def.name]) {
513
+ BUILT_IN_STEP_NAME_TO_SYSID[def.name] = sysId
514
+ }
515
+ }
516
+
110
517
  export const COLUMN_DEFAULTS = {
111
518
  string: '',
112
519
  boolean: false,
113
520
  integer: 0,
114
521
  }
115
522
 
523
+ /**
524
+ * Maps platform-internal sys_element_mapping field names to their Fluent API names.
525
+ * Some step inputs are stored in sys_element_mapping using platform-internal names
526
+ * (e.g. __snc_dont_fail_on_error) that differ from the Fluent API property names.
527
+ */
528
+ export const ELEMENT_MAPPING_FIELD_ALIASES: { [platformName: string]: string } = {
529
+ __snc_dont_fail_on_error: 'dont_fail_flow_on_error',
530
+ }
531
+
116
532
  export enum ChoiceDropdown {
117
533
  DROPDOWN_WITH_NONE = 1,
118
534
  DROPDOWN_WITHOUT_NONE = 3,
@@ -283,3 +699,32 @@ export function slugifyString(value: unknown, opts: SlugifyOptions = {}): string
283
699
  * Core actions that require special catalog variable handling
284
700
  */
285
701
  export const CATALOG_VARIABLE_ACTIONS = ['getCatalogVariables', 'createCatalogTask']
702
+
703
+ /**
704
+ * Input types that do not support inline scripting (wfa.inlineScript()).
705
+ * These types have special parsing/handling that is incompatible with dynamic script execution.
706
+ * - 'template_value': Uses template-based field mapping
707
+ * - 'dynamic_inputs': Inputs are dynamically generated at runtime
708
+ * - 'glide_variables': ServiceNow-specific variable structures
709
+ */
710
+ export const INLINE_SCRIPT_UNSUPPORTED_TYPES = ['template_value', 'dynamic_inputs', 'glide_variables']
711
+
712
+ /**
713
+ * Per-action field-level blocklist for inline scripts.
714
+ *
715
+ * These fields reference catalog metadata (items, variables, variable sets) that must be
716
+ * resolved at design time for the Flow Designer UI. Dynamic script execution would prevent
717
+ * proper catalog item selection and variable mapping in the UI.
718
+ *
719
+ * Used when the input type alone is insufficient to determine supportability
720
+ * (e.g., reference/slushbucket fields that are catalog-specific).
721
+ *
722
+ * Keys: action names from CORE_ACTIONS_SYS_ID_NAME_MAP
723
+ * Values: blocked input field names for that action
724
+ */
725
+ export const INLINE_SCRIPT_UNSUPPORTED_FIELDS: { [actionName: string]: string[] } = {
726
+ getCatalogVariables: ['template_catalog_item', 'catalog_variables'],
727
+ createCatalogTask: ['template_catalog_item', 'catalog_variables', 'ah_table_name'],
728
+ recordProducer: ['catalog_item'],
729
+ submitCatalogItemRequest: ['catalog_item'],
730
+ }
@@ -168,7 +168,7 @@ export async function buildVariableRecords(options: {
168
168
  internal_type = COLUMN_API_TO_TYPE[callExpr.getCallee() as keyof typeof COLUMN_API_TO_TYPE] ?? 'string'
169
169
  }
170
170
  // Handle reference columns - extract reference table
171
- if (internal_type === 'reference') {
171
+ if (internal_type === 'reference' || internal_type === 'records') {
172
172
  const referenceTable = config.get('referenceTable')?.ifString()?.getValue()
173
173
  if (referenceTable) {
174
174
  additionalProperties['reference'] = referenceTable
@@ -223,7 +223,8 @@ export async function buildVariableRecords(options: {
223
223
  export function buildVariableShapes(
224
224
  variableRecords: Record[],
225
225
  descendants: Database,
226
- logger?: Logger
226
+ logger?: Logger,
227
+ snapshotValues?: Map<string, string>
227
228
  ): globalThis.Record<string, CallExpressionShape> | undefined {
228
229
  const shapes: globalThis.Record<string, CallExpressionShape> = {}
229
230
 
@@ -271,12 +272,15 @@ export function buildVariableShapes(
271
272
 
272
273
  // Only include $id and co_type_name if NOT deterministically generated
273
274
  const schema = JSON.parse(serializedContent)
275
+ const snapshotValue =
276
+ snapshotValues?.get(name) ?? variable.get('default_value')?.ifString()?.ifNotEmpty()?.getValue()
274
277
  shapes[name] = buildComplexObjectFromSchema(
275
278
  variable,
276
279
  schema,
277
280
  attributes,
278
281
  isDeterministic ? undefined : complexObjectSysId,
279
- isDeterministic ? undefined : maybeCoTypeName
282
+ isDeterministic ? undefined : maybeCoTypeName,
283
+ snapshotValue
280
284
  )
281
285
  } else {
282
286
  const variableName = variable.get('name').ifString()?.getValue()
@@ -289,7 +293,8 @@ export function buildVariableShapes(
289
293
  variable,
290
294
  additionalProps,
291
295
  descendants,
292
- documentation
296
+ documentation,
297
+ snapshotValues?.get(name)
293
298
  )
294
299
  }
295
300
  }
@@ -297,12 +302,38 @@ export function buildVariableShapes(
297
302
  return shapes
298
303
  }
299
304
 
305
+ /**
306
+ * Coerces a raw string value to the appropriate type for the given field type.
307
+ * Datapill template strings (e.g. {{action.field}}) are returned as-is.
308
+ * Returns undefined if the value is undefined or empty.
309
+ */
310
+ function coerceValue(raw: string | undefined, fieldType: string): unknown {
311
+ if (raw === undefined || raw === '') {
312
+ return undefined
313
+ }
314
+ const strVal = String(raw)
315
+ if (strVal.includes('{{')) {
316
+ return strVal
317
+ }
318
+ if (fieldType === 'string') {
319
+ return strVal
320
+ }
321
+ if (fieldType === 'boolean') {
322
+ return strVal === 'true' || strVal === '1'
323
+ }
324
+ if (fieldType === 'integer') {
325
+ return Number(raw)
326
+ }
327
+ return raw
328
+ }
329
+
300
330
  function buildBasicVariableShape(
301
331
  callExpressionName: string,
302
332
  variable: Record,
303
333
  additionalProps: globalThis.Record<string, unknown>,
304
334
  descendants: Database,
305
- documentation: Record[]
335
+ documentation: Record[],
336
+ snapshotValue?: string
306
337
  ) {
307
338
  if (callExpressionName === ChoiceColumn.name) {
308
339
  // choice column with choices from other table
@@ -376,20 +407,15 @@ function buildBasicVariableShape(
376
407
  .def(choiceDropdown[1]),
377
408
  default: $.from('default_value')
378
409
  .map((value) => {
379
- if (!value.isDefined()) {
380
- return undefined
410
+ // Snapshot output value (datapill or static) takes priority
411
+ if (snapshotValue !== undefined && snapshotValue !== '') {
412
+ return coerceValue(snapshotValue, fieldType)
381
413
  }
382
-
383
- if (fieldType === 'string') {
384
- return value.toString().getValue()
385
- }
386
- if (fieldType === 'boolean') {
387
- return Boolean(value.getValue())
388
- }
389
- if (fieldType === 'integer') {
390
- return Number(value.getValue())
414
+ const raw = value.isDefined() ? value.getValue() : undefined
415
+ if (raw === undefined || raw === null || raw === '') {
416
+ return undefined
391
417
  }
392
- return value.getValue()
418
+ return coerceValue(String(raw), fieldType)
393
419
  })
394
420
  .def(COLUMN_DEFAULTS[fieldType as keyof typeof COLUMN_DEFAULTS] ?? ''),
395
421
  ...(hint ? { hint: $.val(hint) } : {}),
@@ -247,6 +247,10 @@ export class ApprovalDueDateShape extends ObjectShape {
247
247
  duration: 1,
248
248
  duration_type: 'days',
249
249
  schedule: '',
250
+ // schedule_label is a display-only field derived by ServiceNow from the schedule sys_id at runtime.
251
+ // It is always serialized as '' here because it is not stored in ApprovalDueDateType —
252
+ // ServiceNow ignores the stored value and recomputes it from the schedule sys_id on load.
253
+ schedule_label: '',
250
254
  }
251
255
 
252
256
  //Convert the Due Date to the format expected by Flow Designer and populate with default values
@@ -5,9 +5,9 @@ import {
5
5
  unloadBuilder,
6
6
  type Database,
7
7
  type Relationships,
8
+ type Plugin,
8
9
  } from '@servicenow/sdk-build-core'
9
10
  import type { Element } from 'xml-js'
10
- import { FlowDefinitionPlugin } from '../plugins/flow-definition-plugin'
11
11
 
12
12
  /**
13
13
  * Tables to exclude from delete_multiple generation.
@@ -40,9 +40,9 @@ type DeleteMultipleConfig = {
40
40
 
41
41
  export function generateXML(
42
42
  record: Record,
43
- { config, database }: { config: { scope: string; scopeId: string }; database: Database }
43
+ { config, database, plugin }: { config: { scope: string; scopeId: string }; database: Database; plugin: Plugin }
44
44
  ) {
45
- const relationships = FlowDefinitionPlugin.getRelationships()[record.getTable()] ?? {}
45
+ const relationships = plugin.getRelationships()[record.getTable()] ?? {}
46
46
  const updateName = `${record.getTable()}_${record.getId().getValue()}`
47
47
  const recordBuilder = unloadBuilder(config)
48
48
  const table = record.getTable()
@@ -54,7 +54,7 @@ export function generateXML(
54
54
  .forEach(([prop, shape]) => builder.field(prop, shape, {}))
55
55
 
56
56
  // Get descendants using plugin's getDescendants method and group by table
57
- const descendants = FlowDefinitionPlugin.getDescendants(record, database)
57
+ const descendants = plugin.getDescendants(record, database)
58
58
  const recordMap = descendants.reduce(
59
59
  (acc, rec) => {
60
60
  const t = rec.getTable()