@servicenow/sdk-build-plugins 4.1.1 → 4.3.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 (388) hide show
  1. package/dist/acl-plugin.js +22 -4
  2. package/dist/acl-plugin.js.map +1 -1
  3. package/dist/applicability-plugin.d.ts +2 -0
  4. package/dist/applicability-plugin.js +72 -0
  5. package/dist/applicability-plugin.js.map +1 -0
  6. package/dist/application-menu-plugin.js +1 -0
  7. package/dist/application-menu-plugin.js.map +1 -1
  8. package/dist/atf/step-configs.d.ts +13 -12
  9. package/dist/atf/step-configs.js.map +1 -1
  10. package/dist/atf/test-plugin.d.ts +1 -1
  11. package/dist/atf/test-plugin.js +13 -7
  12. package/dist/atf/test-plugin.js.map +1 -1
  13. package/dist/basic-syntax-plugin.js +58 -14
  14. package/dist/basic-syntax-plugin.js.map +1 -1
  15. package/dist/business-rule-plugin.js +1 -0
  16. package/dist/business-rule-plugin.js.map +1 -1
  17. package/dist/call-expression-plugin.js +1 -107
  18. package/dist/call-expression-plugin.js.map +1 -1
  19. package/dist/claims-plugin.js +1 -1
  20. package/dist/claims-plugin.js.map +1 -1
  21. package/dist/client-script-plugin.js +5 -17
  22. package/dist/client-script-plugin.js.map +1 -1
  23. package/dist/column/column-helper.d.ts +1 -1
  24. package/dist/column/column-helper.js +46 -2
  25. package/dist/column/column-helper.js.map +1 -1
  26. package/dist/column/column-to-record.js +6 -4
  27. package/dist/column/column-to-record.js.map +1 -1
  28. package/dist/column-plugin.js +107 -28
  29. package/dist/column-plugin.js.map +1 -1
  30. package/dist/dashboard/dashboard-component-property-defaults.d.ts +152 -0
  31. package/dist/dashboard/dashboard-component-property-defaults.js +264 -0
  32. package/dist/dashboard/dashboard-component-property-defaults.js.map +1 -0
  33. package/dist/dashboard/dashboard-component-resolver.d.ts +13 -0
  34. package/dist/dashboard/dashboard-component-resolver.js +69 -0
  35. package/dist/dashboard/dashboard-component-resolver.js.map +1 -0
  36. package/dist/dashboard/dashboard-plugin.d.ts +12 -0
  37. package/dist/dashboard/dashboard-plugin.js +397 -0
  38. package/dist/dashboard/dashboard-plugin.js.map +1 -0
  39. package/dist/data-plugin.d.ts +6 -0
  40. package/dist/data-plugin.js +156 -0
  41. package/dist/data-plugin.js.map +1 -0
  42. package/dist/email-notification-plugin.d.ts +2 -0
  43. package/dist/email-notification-plugin.js +541 -0
  44. package/dist/email-notification-plugin.js.map +1 -0
  45. package/dist/flow/constants/flow-plugin-constants.d.ts +58 -0
  46. package/dist/flow/constants/flow-plugin-constants.js +70 -0
  47. package/dist/flow/constants/flow-plugin-constants.js.map +1 -0
  48. package/dist/flow/flow-logic/flow-logic-constants.d.ts +38 -0
  49. package/dist/flow/flow-logic/flow-logic-constants.js +118 -0
  50. package/dist/flow/flow-logic/flow-logic-constants.js.map +1 -0
  51. package/dist/flow/flow-logic/flow-logic-diagnostics.d.ts +19 -0
  52. package/dist/flow/flow-logic/flow-logic-diagnostics.js +503 -0
  53. package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -0
  54. package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +62 -0
  55. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +2092 -0
  56. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -0
  57. package/dist/flow/flow-logic/flow-logic-plugin.d.ts +52 -0
  58. package/dist/flow/flow-logic/flow-logic-plugin.js +283 -0
  59. package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -0
  60. package/dist/flow/flow-logic/flow-logic-shapes.d.ts +104 -0
  61. package/dist/flow/flow-logic/flow-logic-shapes.js +201 -0
  62. package/dist/flow/flow-logic/flow-logic-shapes.js.map +1 -0
  63. package/dist/flow/plugins/approval-rules-plugin.d.ts +2 -0
  64. package/dist/flow/plugins/approval-rules-plugin.js +49 -0
  65. package/dist/flow/plugins/approval-rules-plugin.js.map +1 -0
  66. package/dist/flow/plugins/flow-action-definition-plugin.d.ts +2 -0
  67. package/dist/flow/plugins/flow-action-definition-plugin.js +286 -0
  68. package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -0
  69. package/dist/flow/plugins/flow-data-pill-plugin.d.ts +9 -0
  70. package/dist/flow/plugins/flow-data-pill-plugin.js +212 -0
  71. package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -0
  72. package/dist/flow/plugins/flow-definition-plugin.d.ts +2 -0
  73. package/dist/flow/plugins/flow-definition-plugin.js +1668 -0
  74. package/dist/flow/plugins/flow-definition-plugin.js.map +1 -0
  75. package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +26 -0
  76. package/dist/flow/plugins/flow-diagnostics-plugin.js +217 -0
  77. package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -0
  78. package/dist/flow/plugins/flow-instance-plugin.d.ts +12 -0
  79. package/dist/flow/plugins/flow-instance-plugin.js +930 -0
  80. package/dist/flow/plugins/flow-instance-plugin.js.map +1 -0
  81. package/dist/flow/plugins/flow-trigger-instance-plugin.d.ts +2 -0
  82. package/dist/flow/plugins/flow-trigger-instance-plugin.js +324 -0
  83. package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -0
  84. package/dist/flow/plugins/inline-script-plugin.d.ts +39 -0
  85. package/dist/flow/plugins/inline-script-plugin.js +80 -0
  86. package/dist/flow/plugins/inline-script-plugin.js.map +1 -0
  87. package/dist/flow/plugins/step-definition-plugin.d.ts +5 -0
  88. package/dist/flow/plugins/step-definition-plugin.js +71 -0
  89. package/dist/flow/plugins/step-definition-plugin.js.map +1 -0
  90. package/dist/flow/plugins/step-instance-plugin.d.ts +31 -0
  91. package/dist/flow/plugins/step-instance-plugin.js +339 -0
  92. package/dist/flow/plugins/step-instance-plugin.js.map +1 -0
  93. package/dist/flow/plugins/trigger-plugin.d.ts +2 -0
  94. package/dist/flow/plugins/trigger-plugin.js +96 -0
  95. package/dist/flow/plugins/trigger-plugin.js.map +1 -0
  96. package/dist/flow/plugins/wfa-datapill-plugin.d.ts +15 -0
  97. package/dist/flow/plugins/wfa-datapill-plugin.js +178 -0
  98. package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -0
  99. package/dist/flow/utils/approval-rules-processor.d.ts +13 -0
  100. package/dist/flow/utils/approval-rules-processor.js +267 -0
  101. package/dist/flow/utils/approval-rules-processor.js.map +1 -0
  102. package/dist/flow/utils/built-in-complex-objects.d.ts +19 -0
  103. package/dist/flow/utils/built-in-complex-objects.js +62 -0
  104. package/dist/flow/utils/built-in-complex-objects.js.map +1 -0
  105. package/dist/flow/utils/complex-object-resolver.d.ts +8 -0
  106. package/dist/flow/utils/complex-object-resolver.js +614 -0
  107. package/dist/flow/utils/complex-object-resolver.js.map +1 -0
  108. package/dist/flow/utils/complex-objects.d.ts +36 -0
  109. package/dist/flow/utils/complex-objects.js +481 -0
  110. package/dist/flow/utils/complex-objects.js.map +1 -0
  111. package/dist/flow/utils/data-pill-shapes.d.ts +58 -0
  112. package/dist/flow/utils/data-pill-shapes.js +135 -0
  113. package/dist/flow/utils/data-pill-shapes.js.map +1 -0
  114. package/dist/flow/utils/datapill-transformer.d.ts +110 -0
  115. package/dist/flow/utils/datapill-transformer.js +503 -0
  116. package/dist/flow/utils/datapill-transformer.js.map +1 -0
  117. package/dist/flow/utils/flow-constants.d.ts +65 -0
  118. package/dist/flow/utils/flow-constants.js +223 -0
  119. package/dist/flow/utils/flow-constants.js.map +1 -0
  120. package/dist/flow/utils/flow-io-to-record.d.ts +44 -0
  121. package/dist/flow/utils/flow-io-to-record.js +409 -0
  122. package/dist/flow/utils/flow-io-to-record.js.map +1 -0
  123. package/dist/flow/utils/flow-shapes.d.ts +161 -0
  124. package/dist/flow/utils/flow-shapes.js +255 -0
  125. package/dist/flow/utils/flow-shapes.js.map +1 -0
  126. package/dist/flow/utils/flow-to-xml.d.ts +16 -0
  127. package/dist/flow/utils/flow-to-xml.js +237 -0
  128. package/dist/flow/utils/flow-to-xml.js.map +1 -0
  129. package/dist/flow/utils/flow-variable-processor.d.ts +51 -0
  130. package/dist/flow/utils/flow-variable-processor.js +69 -0
  131. package/dist/flow/utils/flow-variable-processor.js.map +1 -0
  132. package/dist/flow/utils/label-cache-parser.d.ts +7 -0
  133. package/dist/flow/utils/label-cache-parser.js +24 -0
  134. package/dist/flow/utils/label-cache-parser.js.map +1 -0
  135. package/dist/flow/utils/label-cache-processor.d.ts +119 -0
  136. package/dist/flow/utils/label-cache-processor.js +719 -0
  137. package/dist/flow/utils/label-cache-processor.js.map +1 -0
  138. package/dist/flow/utils/pill-string-parser.d.ts +88 -0
  139. package/dist/flow/utils/pill-string-parser.js +306 -0
  140. package/dist/flow/utils/pill-string-parser.js.map +1 -0
  141. package/dist/flow/utils/schema-to-flow-object.d.ts +22 -0
  142. package/dist/flow/utils/schema-to-flow-object.js +318 -0
  143. package/dist/flow/utils/schema-to-flow-object.js.map +1 -0
  144. package/dist/flow/utils/utils.d.ts +117 -0
  145. package/dist/flow/utils/utils.js +345 -0
  146. package/dist/flow/utils/utils.js.map +1 -0
  147. package/dist/import-sets-plugin.d.ts +2 -0
  148. package/dist/import-sets-plugin.js +412 -0
  149. package/dist/import-sets-plugin.js.map +1 -0
  150. package/dist/index.d.ts +24 -1
  151. package/dist/index.js +25 -1
  152. package/dist/index.js.map +1 -1
  153. package/dist/json-plugin.d.ts +4 -4
  154. package/dist/json-plugin.js +21 -7
  155. package/dist/json-plugin.js.map +1 -1
  156. package/dist/list-plugin.js +83 -1
  157. package/dist/list-plugin.js.map +1 -1
  158. package/dist/now-attach-plugin.d.ts +36 -0
  159. package/dist/now-attach-plugin.js +320 -0
  160. package/dist/now-attach-plugin.js.map +1 -0
  161. package/dist/now-config-plugin.js +3 -0
  162. package/dist/now-config-plugin.js.map +1 -1
  163. package/dist/now-include-plugin.js +7 -1
  164. package/dist/now-include-plugin.js.map +1 -1
  165. package/dist/package-json-plugin.js +2 -2
  166. package/dist/package-json-plugin.js.map +1 -1
  167. package/dist/record-plugin.d.ts +35 -0
  168. package/dist/record-plugin.js +109 -23
  169. package/dist/record-plugin.js.map +1 -1
  170. package/dist/repack/index.d.ts +2 -0
  171. package/dist/repack/index.js +8 -0
  172. package/dist/repack/index.js.map +1 -1
  173. package/dist/repack/lint/Rules.js.map +1 -1
  174. package/dist/rest-api-plugin.js +81 -74
  175. package/dist/rest-api-plugin.js.map +1 -1
  176. package/dist/role-plugin.js +1 -0
  177. package/dist/role-plugin.js.map +1 -1
  178. package/dist/server-module-plugin/index.js +53 -6
  179. package/dist/server-module-plugin/index.js.map +1 -1
  180. package/dist/service-catalog/catalog-clientscript-plugin.d.ts +2 -0
  181. package/dist/service-catalog/catalog-clientscript-plugin.js +117 -0
  182. package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -0
  183. package/dist/service-catalog/catalog-item-plugin.d.ts +2 -0
  184. package/dist/service-catalog/catalog-item-plugin.js +115 -0
  185. package/dist/service-catalog/catalog-item-plugin.js.map +1 -0
  186. package/dist/service-catalog/catalog-ui-policy-plugin.d.ts +2 -0
  187. package/dist/service-catalog/catalog-ui-policy-plugin.js +266 -0
  188. package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -0
  189. package/dist/service-catalog/index.d.ts +5 -0
  190. package/dist/service-catalog/index.js +22 -0
  191. package/dist/service-catalog/index.js.map +1 -0
  192. package/dist/service-catalog/record-to-shape.d.ts +6 -0
  193. package/dist/service-catalog/record-to-shape.js +93 -0
  194. package/dist/service-catalog/record-to-shape.js.map +1 -0
  195. package/dist/service-catalog/sc-record-producer-plugin.d.ts +2 -0
  196. package/dist/service-catalog/sc-record-producer-plugin.js +139 -0
  197. package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -0
  198. package/dist/service-catalog/service-catalog-base.d.ts +311 -0
  199. package/dist/service-catalog/service-catalog-base.js +542 -0
  200. package/dist/service-catalog/service-catalog-base.js.map +1 -0
  201. package/dist/service-catalog/service-catalog-diagnostics.d.ts +45 -0
  202. package/dist/service-catalog/service-catalog-diagnostics.js +169 -0
  203. package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -0
  204. package/dist/service-catalog/shape-to-record.d.ts +7 -0
  205. package/dist/service-catalog/shape-to-record.js +232 -0
  206. package/dist/service-catalog/shape-to-record.js.map +1 -0
  207. package/dist/service-catalog/utils.d.ts +313 -0
  208. package/dist/service-catalog/utils.js +1144 -0
  209. package/dist/service-catalog/utils.js.map +1 -0
  210. package/dist/service-catalog/variable-helper.d.ts +43 -0
  211. package/dist/service-catalog/variable-helper.js +92 -0
  212. package/dist/service-catalog/variable-helper.js.map +1 -0
  213. package/dist/service-catalog/variable-set-plugin.d.ts +2 -0
  214. package/dist/service-catalog/variable-set-plugin.js +175 -0
  215. package/dist/service-catalog/variable-set-plugin.js.map +1 -0
  216. package/dist/service-catalog/variables-transform.d.ts +139 -0
  217. package/dist/service-catalog/variables-transform.js +403 -0
  218. package/dist/service-catalog/variables-transform.js.map +1 -0
  219. package/dist/service-portal/widget-plugin.js +4 -1
  220. package/dist/service-portal/widget-plugin.js.map +1 -1
  221. package/dist/sla/sla-validators.d.ts +61 -0
  222. package/dist/sla/sla-validators.js +224 -0
  223. package/dist/sla/sla-validators.js.map +1 -0
  224. package/dist/sla-plugin.d.ts +5 -0
  225. package/dist/sla-plugin.js +280 -0
  226. package/dist/sla-plugin.js.map +1 -0
  227. package/dist/static-content-plugin.d.ts +1 -0
  228. package/dist/static-content-plugin.js +4 -3
  229. package/dist/static-content-plugin.js.map +1 -1
  230. package/dist/table-plugin.js +49 -4
  231. package/dist/table-plugin.js.map +1 -1
  232. package/dist/ui-page-plugin.js +2 -1
  233. package/dist/ui-page-plugin.js.map +1 -1
  234. package/dist/ui-policy-plugin.d.ts +2 -0
  235. package/dist/ui-policy-plugin.js +405 -0
  236. package/dist/ui-policy-plugin.js.map +1 -0
  237. package/dist/utils.d.ts +19 -1
  238. package/dist/utils.js +40 -0
  239. package/dist/utils.js.map +1 -1
  240. package/dist/ux-list-menu-config-plugin.d.ts +2 -0
  241. package/dist/ux-list-menu-config-plugin.js +292 -0
  242. package/dist/ux-list-menu-config-plugin.js.map +1 -0
  243. package/dist/view-plugin.js +1 -1
  244. package/dist/view-plugin.js.map +1 -1
  245. package/dist/workspace-plugin/chrome-tab.d.ts +2 -0
  246. package/dist/workspace-plugin/chrome-tab.js +46 -0
  247. package/dist/workspace-plugin/chrome-tab.js.map +1 -0
  248. package/dist/workspace-plugin/constants.d.ts +52 -0
  249. package/dist/workspace-plugin/constants.js +56 -0
  250. package/dist/workspace-plugin/constants.js.map +1 -0
  251. package/dist/workspace-plugin/fluent-utils.d.ts +9 -0
  252. package/dist/workspace-plugin/fluent-utils.js +60 -0
  253. package/dist/workspace-plugin/fluent-utils.js.map +1 -0
  254. package/dist/workspace-plugin/page.d.ts +8 -0
  255. package/dist/workspace-plugin/page.js +108 -0
  256. package/dist/workspace-plugin/page.js.map +1 -0
  257. package/dist/workspace-plugin/screen.d.ts +1 -0
  258. package/dist/workspace-plugin/screen.js +38 -0
  259. package/dist/workspace-plugin/screen.js.map +1 -0
  260. package/dist/workspace-plugin/templates/index.d.ts +10 -0
  261. package/dist/workspace-plugin/templates/index.js +20 -0
  262. package/dist/workspace-plugin/templates/index.js.map +1 -0
  263. package/dist/workspace-plugin/templates/record-page-composition.d.ts +1 -0
  264. package/dist/workspace-plugin/templates/record-page-composition.js +4043 -0
  265. package/dist/workspace-plugin/templates/record-page-composition.js.map +1 -0
  266. package/dist/workspace-plugin/templates/record-page-data.d.ts +1 -0
  267. package/dist/workspace-plugin/templates/record-page-data.js +527 -0
  268. package/dist/workspace-plugin/templates/record-page-data.js.map +1 -0
  269. package/dist/workspace-plugin/templates/record-page-interalEventMappings.d.ts +1 -0
  270. package/dist/workspace-plugin/templates/record-page-interalEventMappings.js +39 -0
  271. package/dist/workspace-plugin/templates/record-page-interalEventMappings.js.map +1 -0
  272. package/dist/workspace-plugin/templates/record-page-layoutModel.d.ts +1 -0
  273. package/dist/workspace-plugin/templates/record-page-layoutModel.js +55 -0
  274. package/dist/workspace-plugin/templates/record-page-layoutModel.js.map +1 -0
  275. package/dist/workspace-plugin/templates/record-page-properties.d.ts +1 -0
  276. package/dist/workspace-plugin/templates/record-page-properties.js +135 -0
  277. package/dist/workspace-plugin/templates/record-page-properties.js.map +1 -0
  278. package/dist/workspace-plugin/templates/record-page.d.ts +3 -0
  279. package/dist/workspace-plugin/templates/record-page.js +8 -0
  280. package/dist/workspace-plugin/templates/record-page.js.map +1 -0
  281. package/dist/workspace-plugin.d.ts +2 -0
  282. package/dist/workspace-plugin.js +453 -0
  283. package/dist/workspace-plugin.js.map +1 -0
  284. package/package.json +10 -12
  285. package/src/_types/eslint-plugin-es-x.d.ts +17 -0
  286. package/src/_types/md5.js.d.ts +8 -0
  287. package/src/acl-plugin.ts +33 -10
  288. package/src/applicability-plugin.ts +82 -0
  289. package/src/application-menu-plugin.ts +1 -0
  290. package/src/atf/step-configs.ts +14 -12
  291. package/src/atf/test-plugin.ts +46 -24
  292. package/src/basic-syntax-plugin.ts +71 -14
  293. package/src/business-rule-plugin.ts +9 -5
  294. package/src/call-expression-plugin.ts +2 -130
  295. package/src/claims-plugin.ts +1 -1
  296. package/src/client-script-plugin.ts +8 -22
  297. package/src/column/column-helper.ts +65 -3
  298. package/src/column/column-to-record.ts +6 -4
  299. package/src/column-plugin.ts +142 -40
  300. package/src/dashboard/dashboard-component-property-defaults.ts +277 -0
  301. package/src/dashboard/dashboard-component-resolver.ts +69 -0
  302. package/src/dashboard/dashboard-plugin.ts +450 -0
  303. package/src/data-plugin.ts +194 -0
  304. package/src/email-notification-plugin.ts +850 -0
  305. package/src/flow/constants/flow-plugin-constants.ts +79 -0
  306. package/src/flow/flow-logic/flow-logic-constants.ts +120 -0
  307. package/src/flow/flow-logic/flow-logic-diagnostics.ts +591 -0
  308. package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +2550 -0
  309. package/src/flow/flow-logic/flow-logic-plugin.ts +337 -0
  310. package/src/flow/flow-logic/flow-logic-shapes.ts +215 -0
  311. package/src/flow/plugins/approval-rules-plugin.ts +48 -0
  312. package/src/flow/plugins/flow-action-definition-plugin.ts +295 -0
  313. package/src/flow/plugins/flow-data-pill-plugin.ts +258 -0
  314. package/src/flow/plugins/flow-definition-plugin.ts +2173 -0
  315. package/src/flow/plugins/flow-diagnostics-plugin.ts +280 -0
  316. package/src/flow/plugins/flow-instance-plugin.ts +1148 -0
  317. package/src/flow/plugins/flow-trigger-instance-plugin.ts +426 -0
  318. package/src/flow/plugins/inline-script-plugin.ts +83 -0
  319. package/src/flow/plugins/step-definition-plugin.ts +67 -0
  320. package/src/flow/plugins/step-instance-plugin.ts +431 -0
  321. package/src/flow/plugins/trigger-plugin.ts +95 -0
  322. package/src/flow/plugins/wfa-datapill-plugin.ts +213 -0
  323. package/src/flow/utils/approval-rules-processor.ts +298 -0
  324. package/src/flow/utils/built-in-complex-objects.ts +81 -0
  325. package/src/flow/utils/complex-object-resolver.ts +875 -0
  326. package/src/flow/utils/complex-objects.ts +656 -0
  327. package/src/flow/utils/data-pill-shapes.ts +165 -0
  328. package/src/flow/utils/datapill-transformer.ts +632 -0
  329. package/src/flow/utils/flow-constants.ts +276 -0
  330. package/src/flow/utils/flow-io-to-record.ts +533 -0
  331. package/src/flow/utils/flow-shapes.ts +296 -0
  332. package/src/flow/utils/flow-to-xml.ts +318 -0
  333. package/src/flow/utils/flow-variable-processor.ts +100 -0
  334. package/src/flow/utils/label-cache-parser.ts +37 -0
  335. package/src/flow/utils/label-cache-processor.ts +870 -0
  336. package/src/flow/utils/pill-string-parser.ts +375 -0
  337. package/src/flow/utils/schema-to-flow-object.ts +385 -0
  338. package/src/flow/utils/utils.ts +395 -0
  339. package/src/import-sets-plugin.ts +542 -0
  340. package/src/index.ts +25 -1
  341. package/src/json-plugin.ts +31 -12
  342. package/src/list-plugin.ts +91 -1
  343. package/src/now-attach-plugin.ts +403 -0
  344. package/src/now-config-plugin.ts +6 -2
  345. package/src/now-include-plugin.ts +8 -1
  346. package/src/package-json-plugin.ts +3 -3
  347. package/src/record-plugin.ts +126 -30
  348. package/src/repack/index.ts +14 -0
  349. package/src/repack/lint/Rules.ts +1 -10
  350. package/src/rest-api-plugin.ts +106 -100
  351. package/src/role-plugin.ts +1 -0
  352. package/src/server-module-plugin/index.ts +74 -22
  353. package/src/service-catalog/catalog-clientscript-plugin.ts +140 -0
  354. package/src/service-catalog/catalog-item-plugin.ts +162 -0
  355. package/src/service-catalog/catalog-ui-policy-plugin.ts +324 -0
  356. package/src/service-catalog/index.ts +5 -0
  357. package/src/service-catalog/record-to-shape.ts +109 -0
  358. package/src/service-catalog/sc-record-producer-plugin.ts +201 -0
  359. package/src/service-catalog/service-catalog-base.ts +600 -0
  360. package/src/service-catalog/service-catalog-diagnostics.ts +251 -0
  361. package/src/service-catalog/shape-to-record.ts +275 -0
  362. package/src/service-catalog/utils.ts +1362 -0
  363. package/src/service-catalog/variable-helper.ts +135 -0
  364. package/src/service-catalog/variable-set-plugin.ts +197 -0
  365. package/src/service-catalog/variables-transform.ts +438 -0
  366. package/src/service-portal/widget-plugin.ts +4 -1
  367. package/src/sla/sla-validators.ts +331 -0
  368. package/src/sla-plugin.ts +358 -0
  369. package/src/static-content-plugin.ts +2 -2
  370. package/src/table-plugin.ts +66 -9
  371. package/src/ui-page-plugin.ts +2 -1
  372. package/src/ui-policy-plugin.ts +505 -0
  373. package/src/utils.ts +50 -1
  374. package/src/ux-list-menu-config-plugin.ts +312 -0
  375. package/src/view-plugin.ts +1 -1
  376. package/src/workspace-plugin/chrome-tab.ts +44 -0
  377. package/src/workspace-plugin/constants.ts +53 -0
  378. package/src/workspace-plugin/fluent-utils.ts +60 -0
  379. package/src/workspace-plugin/page.ts +139 -0
  380. package/src/workspace-plugin/screen.ts +34 -0
  381. package/src/workspace-plugin/templates/index.ts +17 -0
  382. package/src/workspace-plugin/templates/record-page-composition.ts +4051 -0
  383. package/src/workspace-plugin/templates/record-page-data.ts +523 -0
  384. package/src/workspace-plugin/templates/record-page-interalEventMappings.ts +35 -0
  385. package/src/workspace-plugin/templates/record-page-layoutModel.ts +51 -0
  386. package/src/workspace-plugin/templates/record-page-properties.ts +131 -0
  387. package/src/workspace-plugin/templates/record-page.ts +6 -0
  388. package/src/workspace-plugin.ts +574 -0
@@ -0,0 +1,395 @@
1
+ import {
2
+ CallExpressionShape,
3
+ type Database,
4
+ type Diagnostics,
5
+ type IdentifierShape,
6
+ type Logger,
7
+ type ObjectShape,
8
+ type PropertyAccessShape,
9
+ type Record,
10
+ type Shape,
11
+ type TemplateExpressionShape,
12
+ type Transform,
13
+ ts,
14
+ VariableStatementShape,
15
+ } from '@servicenow/sdk-build-core'
16
+ import { PillShape, PillTemplateShape } from '../utils/data-pill-shapes'
17
+ import { DataPillPlugin } from '../plugins/flow-data-pill-plugin'
18
+ import { TriggerInstancePlugin } from '../plugins/flow-trigger-instance-plugin'
19
+ import { CallExpressionPlugin } from '../../call-expression-plugin'
20
+ import { FlowLogicPlugin } from '../flow-logic/flow-logic-plugin'
21
+ import { FlowInstancePlugin } from '../plugins/flow-instance-plugin'
22
+ import { FDInstanceShape } from './flow-shapes'
23
+ import { CORE_ACTIONS_PREFIX, CORE_ACTIONS_SYS_ID_NAME_MAP, UNSUPPORTED_FLOW_DESCENDANTS } from './flow-constants'
24
+
25
+ export function sysIdToUuid(id: string): string {
26
+ return id.length === 32
27
+ ? `${id.slice(0, 8)}-${id.slice(8, 12)}-${id.slice(12, 16)}-${id.slice(16, 20)}-${id.slice(20)}`
28
+ : id // already UUID or unexpected
29
+ }
30
+
31
+ export function uuidToSysId(id: string): string {
32
+ return id.includes('-') ? id.replace(/-/g, '') : id // already sys_id or unexpected
33
+ }
34
+
35
+ /**
36
+ * Get the identifier name from an original source (TypeScript node)
37
+ * Searches for a VariableDeclaration ancestor and extracts the identifier name
38
+ *
39
+ * @param originalSource - The original TypeScript source node
40
+ * @returns The identifier name if found, undefined otherwise
41
+ */
42
+ export function getIdentifierFromSource(originalSource: unknown): string | undefined {
43
+ if (ts.Node.isNode(originalSource)) {
44
+ const node = originalSource as ts.Node
45
+ const varDecl = node.getFirstAncestorByKind(ts.SyntaxKind.VariableDeclaration)
46
+ const idNode = varDecl?.getNameNode()
47
+ if (idNode) {
48
+ return idNode.getText()
49
+ }
50
+ }
51
+ return undefined
52
+ }
53
+
54
+ /**
55
+ * Get the identifier name for an action/subflow instance from its original source
56
+ * Only checks if this node is DIRECTLY wrapped in a VariableDeclaration (not any ancestor)
57
+ * This prevents scope collisions where inner actions inherit parent Subflow/Flow variable names
58
+ *
59
+ * Use this specifically for preserving action/subflow variable names during transform
60
+ *
61
+ * @param originalSource - The original source to extract the identifier from
62
+ * @returns The identifier name if found, undefined otherwise
63
+ */
64
+ export function getDirectVariableIdentifier(originalSource: unknown): string | undefined {
65
+ if (!ts.Node.isNode(originalSource)) {
66
+ return undefined
67
+ }
68
+
69
+ const node = originalSource as ts.Node
70
+
71
+ // Only check immediate parent, not any ancestor
72
+ // This prevents actions inside Subflow/Flow bodies from inheriting the Subflow/Flow's variable name
73
+ const varDecl = node.getParentIfKind(ts.SyntaxKind.VariableDeclaration)
74
+ if (!varDecl) {
75
+ return undefined
76
+ }
77
+
78
+ const idNode = varDecl.getNameNode()
79
+ return idNode?.getText()
80
+ }
81
+
82
+ /**
83
+ * Get the identifier name from a record's original source
84
+ * Convenience wrapper around getIdentifierFromSource for Record types
85
+ *
86
+ * @param record - The record to extract the identifier from
87
+ * @returns The identifier name if found, undefined otherwise
88
+ */
89
+ export function getIdentifierFromRecord(record: Record): string | undefined {
90
+ return getIdentifierFromSource(record.getOriginalSource())
91
+ }
92
+
93
+ /**
94
+ * Get the identifier name from a shape's original source
95
+ * Convenience wrapper around getIdentifierFromSource for Shape types
96
+ *
97
+ * @param shape - The shape to extract the identifier from
98
+ * @returns The identifier name if found, undefined otherwise
99
+ */
100
+ export function getIdentifierFromShape(shape: Shape): string | undefined {
101
+ return getIdentifierFromSource(shape.getOriginalSource())
102
+ }
103
+
104
+ /**
105
+ * Set of allowed FlowValueType helper function names for flow variable validation
106
+ *
107
+ * @constant {Set<string>}
108
+ * @example
109
+ * ```typescript
110
+ * // Supported types: StringColumn, IntegerColumn, DecimalColumn, ReferenceColumn,
111
+ * // DateTimeColumn, BooleanColumn, GenericColumn, FlowObject, FlowArray
112
+ * if (ALLOWED_VARIABLE_CALLEES.has('StringColumn')) {
113
+ * // StringColumn is supported
114
+ * }
115
+ * ```
116
+ */
117
+ export const ALLOWED_VARIABLE_CALLEES = new Set([
118
+ 'StringColumn',
119
+ 'IntegerColumn',
120
+ 'DecimalColumn',
121
+ 'ReferenceColumn',
122
+ 'DateTimeColumn',
123
+ 'BooleanColumn',
124
+ 'FloatColumn',
125
+ 'JsonColumn',
126
+ 'GenericColumn',
127
+ 'FlowObject',
128
+ 'FlowArray',
129
+ ])
130
+
131
+ export const ALLOWED_VARIABLE_CALLEES_IN_FLOW_OBJECT = new Set([
132
+ 'StringColumn',
133
+ 'IntegerColumn',
134
+ 'DecimalColumn',
135
+ 'DateTimeColumn',
136
+ 'BooleanColumn',
137
+ 'FlowObject',
138
+ 'FlowArray',
139
+ ])
140
+
141
+ /**
142
+ * Validates a single flow variable call expression for type safety and correctness
143
+ *
144
+ * @param variableCall - The CallExpressionShape representing the variable definition
145
+ * @param path - The path/name of the variable for error reporting
146
+ * @param diagnostics - Diagnostics object for reporting validation errors
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * // Validates allowed types, GenericColumn columnType (json/float only),
151
+ * // and recursively validates FlowArray/FlowObject structures
152
+ * validateFlowVariableCall(StringColumn({ label: 'Name' }), 'flow_variables.userName', diagnostics)
153
+ * ```
154
+ */
155
+ export function validateFlowVariableCall(variableCall: CallExpressionShape, path: string, diagnostics: Diagnostics) {
156
+ const callee = variableCall.getCallee()
157
+
158
+ if (!ALLOWED_VARIABLE_CALLEES.has(callee)) {
159
+ diagnostics.error(
160
+ variableCall.getOriginalNode(),
161
+ `${path} uses unsupported type '${callee}'. Only FlowValueType helpers are allowed.`
162
+ )
163
+ } else if (callee === 'GenericColumn') {
164
+ const arg0 = variableCall.getArgument(0)
165
+ const colTypeNode = arg0.ifObject()?.get('columnType')
166
+ const colType = colTypeNode?.ifString()?.asString().getValue()
167
+ if (colType && colType !== 'json' && colType !== 'float') {
168
+ diagnostics.error(
169
+ colTypeNode!.getOriginalNode(),
170
+ `${path} GenericColumn supports only columnType 'json' or 'float'. Found '${colType}'.`
171
+ )
172
+ }
173
+ } else if (callee === 'FlowArray') {
174
+ // Validate FlowArray structure recursively
175
+ // Primitive types (StringColumn, IntegerColumn, etc.) are now supported as elementType
176
+ const arg0 = variableCall.getArgument(0)
177
+ const elementTypeNode = arg0.ifObject()?.get('elementType')
178
+ if (elementTypeNode?.if(CallExpressionShape)) {
179
+ const elementTypeCall = elementTypeNode.as(CallExpressionShape)
180
+ const elementTypeCallee = elementTypeCall.getCallee()
181
+
182
+ // Recursively validate if elementType is FlowObject or FlowArray
183
+ if (elementTypeCallee === 'FlowObject') {
184
+ validateFlowObjectFields(elementTypeCall, `${path}.elementType`, diagnostics)
185
+ } else if (elementTypeCallee === 'FlowArray') {
186
+ validateFlowVariableCall(elementTypeCall, `${path}.elementType`, diagnostics)
187
+ }
188
+ // Primitive column types (StringColumn, IntegerColumn, etc.) are allowed - no validation needed
189
+ }
190
+ } else if (callee === 'FlowObject') {
191
+ validateFlowObjectFields(variableCall, path, diagnostics)
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Recursively validates FlowObject fields for nested FlowArray violations and other type validations
197
+ *
198
+ * @param flowObjectCall - The CallExpressionShape representing the FlowObject definition
199
+ * @param path - The path/name of the variable for error reporting
200
+ * @param diagnostics - Diagnostics object for reporting validation errors
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * // Validates all field types are allowed, recursively validates nested
205
+ * // FlowArray/FlowObject structures, and checks GenericColumn columnType
206
+ * FlowObject({ fields: { name: StringColumn({...}), data: FlowArray({...}) } })
207
+ * ```
208
+ */
209
+ export function validateFlowObjectFields(flowObjectCall: CallExpressionShape, path: string, diagnostics: Diagnostics) {
210
+ const arg0 = flowObjectCall.getArgument(0)
211
+ if (arg0.ifObject()) {
212
+ const fieldsNode = arg0.asObject().get('fields')
213
+ fieldsNode
214
+ ?.ifObject()
215
+ ?.entries()
216
+ .forEach(([fieldName, fieldValue]) => {
217
+ if (fieldValue.if(CallExpressionShape)) {
218
+ const fieldCall = fieldValue.as(CallExpressionShape)
219
+ const fieldPath = `${path}.${fieldName}`
220
+ const fieldCallee = fieldCall.getCallee()
221
+
222
+ if (!ALLOWED_VARIABLE_CALLEES.has(fieldCallee)) {
223
+ diagnostics.error(
224
+ fieldValue.getOriginalNode(),
225
+ `${fieldPath} uses unsupported type '${fieldCallee}'. Only FlowValueType helpers are allowed.`
226
+ )
227
+ return
228
+ }
229
+
230
+ // work around until DEF0797916 is fixed : Check if ReferenceColumn, JSONColumn, FloatColumn is used inside a FlowObject in flow variables
231
+ if (!ALLOWED_VARIABLE_CALLEES_IN_FLOW_OBJECT.has(fieldCallee)) {
232
+ diagnostics.error(
233
+ fieldValue.getOriginalNode(),
234
+ `Unsupported type '${fieldCallee}' inside flow object in the flow variable is not allowed for flow variables at ${fieldPath}.`
235
+ )
236
+ return
237
+ }
238
+
239
+ validateFlowVariableCall(fieldCall, fieldPath, diagnostics)
240
+ } else {
241
+ diagnostics.error(
242
+ fieldValue.getOriginalNode(),
243
+ `${path}.${fieldName} is not a valid variable expression.`
244
+ )
245
+ }
246
+ })
247
+ }
248
+ }
249
+
250
+ /**
251
+ * Recursively searches ancestors of a node to find a CallExpression
252
+ * with any of the given callee names.
253
+ *
254
+ * @param node - The starting node
255
+ * @param calleeNames - One or more function names to match against
256
+ * @returns The CallExpression if found, otherwise undefined
257
+ */
258
+ export function findAncestorByCalleeName(
259
+ node: ts.Node | undefined,
260
+ ...calleeNames: string[]
261
+ ): ts.CallExpression | undefined {
262
+ if (!node) {
263
+ return undefined
264
+ }
265
+ if (ts.Node.isCallExpression(node)) {
266
+ const expr = node.getExpression()
267
+ // Handle simple identifiers: Flow, Subflow, etc.
268
+ if (ts.Node.isIdentifier(expr) && calleeNames.includes(expr.getText())) {
269
+ return node
270
+ }
271
+ // Handle property access expressions: wfa.flowLogic.if, wfa.flowLogic.forEach, etc.
272
+ if (ts.Node.isPropertyAccessExpression(expr) && calleeNames.includes(expr.getText())) {
273
+ return node
274
+ }
275
+ }
276
+ // recurse upwards
277
+ return findAncestorByCalleeName(node.getFirstAncestorByKind(ts.SyntaxKind.CallExpression), ...calleeNames)
278
+ }
279
+
280
+ /**
281
+ * Resolves a data pill shape by transforming it and handling trigger pills
282
+ * @param shape - The shape to resolve (PropertyAccessShape, TemplateExpressionShape, or IdentifierShape)
283
+ * @param transform - The transform instance
284
+ * @returns The resolved value or the original shape value if not a data pill
285
+ */
286
+ export async function resolveDataPillShape(
287
+ shape: PillShape | PropertyAccessShape | TemplateExpressionShape | IdentifierShape,
288
+ transform: Transform
289
+ ): Promise<unknown> {
290
+ const mayBePills = await transform.toSubclass(shape, DataPillPlugin)
291
+ if (mayBePills.success) {
292
+ let processedShape = mayBePills.value
293
+
294
+ // Magical code to handle trigger pills :) as they do not follow the same pattern as other pills
295
+ // subflow inputs will be {{subflow.<pill-name>}}, flow variable {{flow_variable.<pill-name>}} but for triggers {{Created_1.<pill-name>}}
296
+ if (processedShape instanceof PillShape && processedShape.getRootIdentifier() === 'trigger') {
297
+ processedShape = await resolveTriggerPills(processedShape, transform)
298
+ }
299
+ // Magical code to handle PillTemplateShape with trigger pills
300
+ else if (processedShape.is(PillTemplateShape)) {
301
+ // Process each pill shape in the template
302
+ const pillShapes = processedShape.getParts()
303
+ const elements = pillShapes.getElements(false)
304
+
305
+ for (const shapePart of elements) {
306
+ if (shapePart instanceof PillShape && shapePart.getRootIdentifier() === 'trigger') {
307
+ await resolveTriggerPills(shapePart, transform) // mutates shapePart
308
+ }
309
+ }
310
+ }
311
+
312
+ return processedShape.getValue()
313
+ }
314
+
315
+ return shape.getValue()
316
+ }
317
+
318
+ async function resolveTriggerPills(shape: PillShape, transform: Transform) {
319
+ const flowCallExpression = findAncestorByCalleeName(shape.getOriginalNode(), 'Flow')
320
+ if (flowCallExpression instanceof ts.CallExpression) {
321
+ if (flowCallExpression?.getArguments()?.length > 2) {
322
+ const triggerExpression = flowCallExpression?.getArguments()[1]
323
+ const triggerRecord = triggerExpression
324
+ ? await transform.toRecord(triggerExpression, CallExpressionPlugin, TriggerInstancePlugin)
325
+ : { success: false, value: undefined }
326
+
327
+ if (triggerRecord.success && triggerRecord.value?.isRecord()) {
328
+ const triggerName = triggerRecord.value.asRecord().get('name')?.getValue() as string
329
+ shape.setRootIdentifier(triggerName.concat('_1')) // <-- TODO: Temp code to match what UI does now, but raised a defect against FD team to fix it in the app itself.
330
+ return shape
331
+ }
332
+ }
333
+ }
334
+ return shape
335
+ }
336
+
337
+ /**
338
+ * Function to get the record by transforming the FDInstanceShape
339
+ * @param shape - The shape to transform (VariableStatementShape, CallExpressionShape)
340
+ * @param transform - The transform instance
341
+ * @returns The instance record of the FDInstanceShape
342
+ */
343
+ export async function getRecordFromFlowInstaceShape(shape: Shape, transform: Transform) {
344
+ let instanceRecord: Record | undefined
345
+ const callExpressionShape = shape.is(VariableStatementShape) ? shape.getInitializer() : shape
346
+ if (callExpressionShape.is(CallExpressionShape)) {
347
+ //Get the Flow Instance Shape using toSubclass() utility
348
+ const flowInstanceShape = await transform.toSubclass(callExpressionShape, FlowLogicPlugin, FlowInstancePlugin)
349
+ if (flowInstanceShape.success && flowInstanceShape.value.is(FDInstanceShape)) {
350
+ //Get the Flow Instance Record using toRecord() utility
351
+ const flowInstanceRecord = await transform.toRecord(
352
+ flowInstanceShape.value,
353
+ FlowLogicPlugin,
354
+ FlowInstancePlugin
355
+ )
356
+ if (flowInstanceRecord.success) {
357
+ instanceRecord = flowInstanceRecord.value
358
+ }
359
+ }
360
+ }
361
+ return instanceRecord
362
+ }
363
+
364
+ export function checkForUnsupportedFlowDescendants(descendants: Database, record: Record, logger: Logger): boolean {
365
+ if (descendants) {
366
+ for (const tableName of UNSUPPORTED_FLOW_DESCENDANTS) {
367
+ const descendantRecords = descendants.query(tableName)
368
+
369
+ if (descendantRecords?.length > 0) {
370
+ logger.warn(
371
+ `Unsupported flow descendant tables found, falling back to Record() api. Flow = ${record.getId().getValue()}, table = ${tableName}`
372
+ )
373
+
374
+ return true
375
+ }
376
+ }
377
+ }
378
+ return false
379
+ }
380
+
381
+ export const getCoreActionIdentifier = (sysId: string) => {
382
+ const actionName = CORE_ACTIONS_SYS_ID_NAME_MAP[sysId]
383
+ return actionName ? `${CORE_ACTIONS_PREFIX}.${actionName}` : undefined
384
+ }
385
+
386
+ /**
387
+ * Extracts the order value from a record for sorting purposes.
388
+ * Converts the 'order' field to a number, defaulting to 0 if not present or invalid.
389
+ *
390
+ * @param record - The record containing the order field
391
+ * @returns The numeric order value
392
+ */
393
+ export function getOrder(x: ObjectShape) {
394
+ return Number(x.get('order').asString()?.getValue() ?? 0)
395
+ }