@servicenow/sdk-build-plugins 4.2.0 → 4.4.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 (349) hide show
  1. package/dist/acl-plugin.js +11 -0
  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/atf/test-plugin.js +5 -2
  7. package/dist/atf/test-plugin.js.map +1 -1
  8. package/dist/basic-syntax-plugin.js +7 -1
  9. package/dist/basic-syntax-plugin.js.map +1 -1
  10. package/dist/business-rule-plugin.js +1 -0
  11. package/dist/business-rule-plugin.js.map +1 -1
  12. package/dist/call-expression-plugin.js +1 -107
  13. package/dist/call-expression-plugin.js.map +1 -1
  14. package/dist/column/column-to-record.d.ts +10 -3
  15. package/dist/column/column-to-record.js +44 -7
  16. package/dist/column/column-to-record.js.map +1 -1
  17. package/dist/column-plugin.d.ts +3 -1
  18. package/dist/column-plugin.js +12 -12
  19. package/dist/column-plugin.js.map +1 -1
  20. package/dist/dashboard/dashboard-component-property-defaults.d.ts +152 -0
  21. package/dist/dashboard/dashboard-component-property-defaults.js +264 -0
  22. package/dist/dashboard/dashboard-component-property-defaults.js.map +1 -0
  23. package/dist/dashboard/dashboard-component-resolver.d.ts +13 -0
  24. package/dist/dashboard/dashboard-component-resolver.js +69 -0
  25. package/dist/dashboard/dashboard-component-resolver.js.map +1 -0
  26. package/dist/dashboard/dashboard-plugin.d.ts +12 -0
  27. package/dist/dashboard/dashboard-plugin.js +397 -0
  28. package/dist/dashboard/dashboard-plugin.js.map +1 -0
  29. package/dist/data-plugin.d.ts +3 -0
  30. package/dist/data-plugin.js +61 -113
  31. package/dist/data-plugin.js.map +1 -1
  32. package/dist/email-notification-plugin.d.ts +2 -0
  33. package/dist/email-notification-plugin.js +541 -0
  34. package/dist/email-notification-plugin.js.map +1 -0
  35. package/dist/flow/constants/flow-plugin-constants.d.ts +58 -0
  36. package/dist/flow/constants/flow-plugin-constants.js +70 -0
  37. package/dist/flow/constants/flow-plugin-constants.js.map +1 -0
  38. package/dist/flow/flow-logic/flow-logic-constants.d.ts +38 -0
  39. package/dist/flow/flow-logic/flow-logic-constants.js +118 -0
  40. package/dist/flow/flow-logic/flow-logic-constants.js.map +1 -0
  41. package/dist/flow/flow-logic/flow-logic-diagnostics.d.ts +19 -0
  42. package/dist/flow/flow-logic/flow-logic-diagnostics.js +503 -0
  43. package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -0
  44. package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +62 -0
  45. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +2092 -0
  46. package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -0
  47. package/dist/flow/flow-logic/flow-logic-plugin.d.ts +52 -0
  48. package/dist/flow/flow-logic/flow-logic-plugin.js +283 -0
  49. package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -0
  50. package/dist/flow/flow-logic/flow-logic-shapes.d.ts +104 -0
  51. package/dist/flow/flow-logic/flow-logic-shapes.js +201 -0
  52. package/dist/flow/flow-logic/flow-logic-shapes.js.map +1 -0
  53. package/dist/flow/plugins/approval-rules-plugin.d.ts +2 -0
  54. package/dist/flow/plugins/approval-rules-plugin.js +49 -0
  55. package/dist/flow/plugins/approval-rules-plugin.js.map +1 -0
  56. package/dist/flow/plugins/flow-action-definition-plugin.d.ts +2 -0
  57. package/dist/flow/plugins/flow-action-definition-plugin.js +286 -0
  58. package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -0
  59. package/dist/flow/plugins/flow-data-pill-plugin.d.ts +9 -0
  60. package/dist/flow/plugins/flow-data-pill-plugin.js +212 -0
  61. package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -0
  62. package/dist/flow/plugins/flow-definition-plugin.d.ts +2 -0
  63. package/dist/flow/plugins/flow-definition-plugin.js +1668 -0
  64. package/dist/flow/plugins/flow-definition-plugin.js.map +1 -0
  65. package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +26 -0
  66. package/dist/flow/plugins/flow-diagnostics-plugin.js +217 -0
  67. package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -0
  68. package/dist/flow/plugins/flow-instance-plugin.d.ts +12 -0
  69. package/dist/flow/plugins/flow-instance-plugin.js +1205 -0
  70. package/dist/flow/plugins/flow-instance-plugin.js.map +1 -0
  71. package/dist/flow/plugins/flow-trigger-instance-plugin.d.ts +2 -0
  72. package/dist/flow/plugins/flow-trigger-instance-plugin.js +338 -0
  73. package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -0
  74. package/dist/flow/plugins/inline-script-plugin.d.ts +39 -0
  75. package/dist/flow/plugins/inline-script-plugin.js +80 -0
  76. package/dist/flow/plugins/inline-script-plugin.js.map +1 -0
  77. package/dist/flow/plugins/step-definition-plugin.d.ts +5 -0
  78. package/dist/flow/plugins/step-definition-plugin.js +71 -0
  79. package/dist/flow/plugins/step-definition-plugin.js.map +1 -0
  80. package/dist/flow/plugins/step-instance-plugin.d.ts +31 -0
  81. package/dist/flow/plugins/step-instance-plugin.js +339 -0
  82. package/dist/flow/plugins/step-instance-plugin.js.map +1 -0
  83. package/dist/flow/plugins/trigger-plugin.d.ts +2 -0
  84. package/dist/flow/plugins/trigger-plugin.js +96 -0
  85. package/dist/flow/plugins/trigger-plugin.js.map +1 -0
  86. package/dist/flow/plugins/wfa-datapill-plugin.d.ts +15 -0
  87. package/dist/flow/plugins/wfa-datapill-plugin.js +178 -0
  88. package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -0
  89. package/dist/flow/utils/approval-rules-processor.d.ts +13 -0
  90. package/dist/flow/utils/approval-rules-processor.js +267 -0
  91. package/dist/flow/utils/approval-rules-processor.js.map +1 -0
  92. package/dist/flow/utils/built-in-complex-objects.d.ts +19 -0
  93. package/dist/flow/utils/built-in-complex-objects.js +62 -0
  94. package/dist/flow/utils/built-in-complex-objects.js.map +1 -0
  95. package/dist/flow/utils/complex-object-resolver.d.ts +8 -0
  96. package/dist/flow/utils/complex-object-resolver.js +614 -0
  97. package/dist/flow/utils/complex-object-resolver.js.map +1 -0
  98. package/dist/flow/utils/complex-objects.d.ts +36 -0
  99. package/dist/flow/utils/complex-objects.js +481 -0
  100. package/dist/flow/utils/complex-objects.js.map +1 -0
  101. package/dist/flow/utils/data-pill-shapes.d.ts +58 -0
  102. package/dist/flow/utils/data-pill-shapes.js +135 -0
  103. package/dist/flow/utils/data-pill-shapes.js.map +1 -0
  104. package/dist/flow/utils/datapill-transformer.d.ts +110 -0
  105. package/dist/flow/utils/datapill-transformer.js +503 -0
  106. package/dist/flow/utils/datapill-transformer.js.map +1 -0
  107. package/dist/flow/utils/flow-constants.d.ts +72 -0
  108. package/dist/flow/utils/flow-constants.js +230 -0
  109. package/dist/flow/utils/flow-constants.js.map +1 -0
  110. package/dist/flow/utils/flow-io-to-record.d.ts +44 -0
  111. package/dist/flow/utils/flow-io-to-record.js +409 -0
  112. package/dist/flow/utils/flow-io-to-record.js.map +1 -0
  113. package/dist/flow/utils/flow-shapes.d.ts +161 -0
  114. package/dist/flow/utils/flow-shapes.js +255 -0
  115. package/dist/flow/utils/flow-shapes.js.map +1 -0
  116. package/dist/flow/utils/flow-to-xml.d.ts +16 -0
  117. package/dist/flow/utils/flow-to-xml.js +237 -0
  118. package/dist/flow/utils/flow-to-xml.js.map +1 -0
  119. package/dist/flow/utils/flow-variable-processor.d.ts +51 -0
  120. package/dist/flow/utils/flow-variable-processor.js +69 -0
  121. package/dist/flow/utils/flow-variable-processor.js.map +1 -0
  122. package/dist/flow/utils/label-cache-parser.d.ts +7 -0
  123. package/dist/flow/utils/label-cache-parser.js +24 -0
  124. package/dist/flow/utils/label-cache-parser.js.map +1 -0
  125. package/dist/flow/utils/label-cache-processor.d.ts +119 -0
  126. package/dist/flow/utils/label-cache-processor.js +719 -0
  127. package/dist/flow/utils/label-cache-processor.js.map +1 -0
  128. package/dist/flow/utils/pill-string-parser.d.ts +88 -0
  129. package/dist/flow/utils/pill-string-parser.js +306 -0
  130. package/dist/flow/utils/pill-string-parser.js.map +1 -0
  131. package/dist/flow/utils/schema-to-flow-object.d.ts +22 -0
  132. package/dist/flow/utils/schema-to-flow-object.js +318 -0
  133. package/dist/flow/utils/schema-to-flow-object.js.map +1 -0
  134. package/dist/flow/utils/service-catalog.d.ts +47 -0
  135. package/dist/flow/utils/service-catalog.js +137 -0
  136. package/dist/flow/utils/service-catalog.js.map +1 -0
  137. package/dist/flow/utils/utils.d.ts +117 -0
  138. package/dist/flow/utils/utils.js +345 -0
  139. package/dist/flow/utils/utils.js.map +1 -0
  140. package/dist/index.d.ts +20 -1
  141. package/dist/index.js +21 -1
  142. package/dist/index.js.map +1 -1
  143. package/dist/list-plugin.js +1 -1
  144. package/dist/list-plugin.js.map +1 -1
  145. package/dist/now-attach-plugin.d.ts +1 -0
  146. package/dist/now-attach-plugin.js +10 -10
  147. package/dist/now-attach-plugin.js.map +1 -1
  148. package/dist/now-ref-plugin.js +1 -1
  149. package/dist/now-ref-plugin.js.map +1 -1
  150. package/dist/record-plugin.d.ts +29 -0
  151. package/dist/record-plugin.js +66 -7
  152. package/dist/record-plugin.js.map +1 -1
  153. package/dist/repack/index.d.ts +2 -0
  154. package/dist/repack/index.js +8 -0
  155. package/dist/repack/index.js.map +1 -1
  156. package/dist/rest-api-plugin.js +54 -44
  157. package/dist/rest-api-plugin.js.map +1 -1
  158. package/dist/server-module-plugin/index.d.ts +10 -0
  159. package/dist/server-module-plugin/index.js +83 -59
  160. package/dist/server-module-plugin/index.js.map +1 -1
  161. package/dist/service-catalog/catalog-clientscript-plugin.d.ts +2 -0
  162. package/dist/service-catalog/catalog-clientscript-plugin.js +117 -0
  163. package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -0
  164. package/dist/service-catalog/catalog-item-plugin.d.ts +2 -0
  165. package/dist/service-catalog/catalog-item-plugin.js +115 -0
  166. package/dist/service-catalog/catalog-item-plugin.js.map +1 -0
  167. package/dist/service-catalog/catalog-ui-policy-plugin.d.ts +2 -0
  168. package/dist/service-catalog/catalog-ui-policy-plugin.js +266 -0
  169. package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -0
  170. package/dist/service-catalog/index.d.ts +5 -0
  171. package/dist/service-catalog/index.js +22 -0
  172. package/dist/service-catalog/index.js.map +1 -0
  173. package/dist/service-catalog/record-to-shape.d.ts +6 -0
  174. package/dist/service-catalog/record-to-shape.js +93 -0
  175. package/dist/service-catalog/record-to-shape.js.map +1 -0
  176. package/dist/service-catalog/sc-record-producer-plugin.d.ts +2 -0
  177. package/dist/service-catalog/sc-record-producer-plugin.js +140 -0
  178. package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -0
  179. package/dist/service-catalog/service-catalog-base.d.ts +311 -0
  180. package/dist/service-catalog/service-catalog-base.js +542 -0
  181. package/dist/service-catalog/service-catalog-base.js.map +1 -0
  182. package/dist/service-catalog/service-catalog-diagnostics.d.ts +45 -0
  183. package/dist/service-catalog/service-catalog-diagnostics.js +172 -0
  184. package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -0
  185. package/dist/service-catalog/shape-to-record.d.ts +8 -0
  186. package/dist/service-catalog/shape-to-record.js +235 -0
  187. package/dist/service-catalog/shape-to-record.js.map +1 -0
  188. package/dist/service-catalog/utils.d.ts +323 -0
  189. package/dist/service-catalog/utils.js +1216 -0
  190. package/dist/service-catalog/utils.js.map +1 -0
  191. package/dist/service-catalog/variable-helper.d.ts +43 -0
  192. package/dist/service-catalog/variable-helper.js +92 -0
  193. package/dist/service-catalog/variable-helper.js.map +1 -0
  194. package/dist/service-catalog/variable-set-plugin.d.ts +2 -0
  195. package/dist/service-catalog/variable-set-plugin.js +175 -0
  196. package/dist/service-catalog/variable-set-plugin.js.map +1 -0
  197. package/dist/service-catalog/variables-transform.d.ts +139 -0
  198. package/dist/service-catalog/variables-transform.js +403 -0
  199. package/dist/service-catalog/variables-transform.js.map +1 -0
  200. package/dist/sla/sla-validators.d.ts +61 -0
  201. package/dist/sla/sla-validators.js +224 -0
  202. package/dist/sla/sla-validators.js.map +1 -0
  203. package/dist/sla-plugin.d.ts +5 -0
  204. package/dist/sla-plugin.js +280 -0
  205. package/dist/sla-plugin.js.map +1 -0
  206. package/dist/static-content-plugin.js +25 -2
  207. package/dist/static-content-plugin.js.map +1 -1
  208. package/dist/table-plugin.js +32 -15
  209. package/dist/table-plugin.js.map +1 -1
  210. package/dist/ui-page-plugin.js +832 -19
  211. package/dist/ui-page-plugin.js.map +1 -1
  212. package/dist/ui-policy-plugin.js +5 -7
  213. package/dist/ui-policy-plugin.js.map +1 -1
  214. package/dist/utils.d.ts +10 -1
  215. package/dist/utils.js +16 -0
  216. package/dist/utils.js.map +1 -1
  217. package/dist/ux-list-menu-config-plugin.d.ts +2 -0
  218. package/dist/ux-list-menu-config-plugin.js +292 -0
  219. package/dist/ux-list-menu-config-plugin.js.map +1 -0
  220. package/dist/workspace-plugin/chrome-tab.d.ts +2 -0
  221. package/dist/workspace-plugin/chrome-tab.js +46 -0
  222. package/dist/workspace-plugin/chrome-tab.js.map +1 -0
  223. package/dist/workspace-plugin/constants.d.ts +52 -0
  224. package/dist/workspace-plugin/constants.js +56 -0
  225. package/dist/workspace-plugin/constants.js.map +1 -0
  226. package/dist/workspace-plugin/fluent-utils.d.ts +9 -0
  227. package/dist/workspace-plugin/fluent-utils.js +60 -0
  228. package/dist/workspace-plugin/fluent-utils.js.map +1 -0
  229. package/dist/workspace-plugin/page.d.ts +8 -0
  230. package/dist/workspace-plugin/page.js +108 -0
  231. package/dist/workspace-plugin/page.js.map +1 -0
  232. package/dist/workspace-plugin/screen.d.ts +1 -0
  233. package/dist/workspace-plugin/screen.js +38 -0
  234. package/dist/workspace-plugin/screen.js.map +1 -0
  235. package/dist/workspace-plugin/templates/index.d.ts +10 -0
  236. package/dist/workspace-plugin/templates/index.js +20 -0
  237. package/dist/workspace-plugin/templates/index.js.map +1 -0
  238. package/dist/workspace-plugin/templates/record-page-composition.d.ts +1 -0
  239. package/dist/workspace-plugin/templates/record-page-composition.js +4043 -0
  240. package/dist/workspace-plugin/templates/record-page-composition.js.map +1 -0
  241. package/dist/workspace-plugin/templates/record-page-data.d.ts +1 -0
  242. package/dist/workspace-plugin/templates/record-page-data.js +527 -0
  243. package/dist/workspace-plugin/templates/record-page-data.js.map +1 -0
  244. package/dist/workspace-plugin/templates/record-page-interalEventMappings.d.ts +1 -0
  245. package/dist/workspace-plugin/templates/record-page-interalEventMappings.js +39 -0
  246. package/dist/workspace-plugin/templates/record-page-interalEventMappings.js.map +1 -0
  247. package/dist/workspace-plugin/templates/record-page-layoutModel.d.ts +1 -0
  248. package/dist/workspace-plugin/templates/record-page-layoutModel.js +55 -0
  249. package/dist/workspace-plugin/templates/record-page-layoutModel.js.map +1 -0
  250. package/dist/workspace-plugin/templates/record-page-properties.d.ts +1 -0
  251. package/dist/workspace-plugin/templates/record-page-properties.js +135 -0
  252. package/dist/workspace-plugin/templates/record-page-properties.js.map +1 -0
  253. package/dist/workspace-plugin/templates/record-page.d.ts +3 -0
  254. package/dist/workspace-plugin/templates/record-page.js +8 -0
  255. package/dist/workspace-plugin/templates/record-page.js.map +1 -0
  256. package/dist/workspace-plugin.d.ts +2 -0
  257. package/dist/workspace-plugin.js +453 -0
  258. package/dist/workspace-plugin.js.map +1 -0
  259. package/package.json +10 -12
  260. package/src/acl-plugin.ts +16 -1
  261. package/src/applicability-plugin.ts +82 -0
  262. package/src/atf/test-plugin.ts +6 -3
  263. package/src/basic-syntax-plugin.ts +10 -1
  264. package/src/business-rule-plugin.ts +2 -1
  265. package/src/call-expression-plugin.ts +2 -130
  266. package/src/column/column-to-record.ts +54 -8
  267. package/src/column-plugin.ts +29 -13
  268. package/src/dashboard/dashboard-component-property-defaults.ts +277 -0
  269. package/src/dashboard/dashboard-component-resolver.ts +69 -0
  270. package/src/dashboard/dashboard-plugin.ts +450 -0
  271. package/src/data-plugin.ts +67 -139
  272. package/src/email-notification-plugin.ts +850 -0
  273. package/src/flow/constants/flow-plugin-constants.ts +79 -0
  274. package/src/flow/flow-logic/flow-logic-constants.ts +120 -0
  275. package/src/flow/flow-logic/flow-logic-diagnostics.ts +591 -0
  276. package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +2550 -0
  277. package/src/flow/flow-logic/flow-logic-plugin.ts +337 -0
  278. package/src/flow/flow-logic/flow-logic-shapes.ts +215 -0
  279. package/src/flow/plugins/approval-rules-plugin.ts +48 -0
  280. package/src/flow/plugins/flow-action-definition-plugin.ts +295 -0
  281. package/src/flow/plugins/flow-data-pill-plugin.ts +258 -0
  282. package/src/flow/plugins/flow-definition-plugin.ts +2173 -0
  283. package/src/flow/plugins/flow-diagnostics-plugin.ts +280 -0
  284. package/src/flow/plugins/flow-instance-plugin.ts +1499 -0
  285. package/src/flow/plugins/flow-trigger-instance-plugin.ts +444 -0
  286. package/src/flow/plugins/inline-script-plugin.ts +83 -0
  287. package/src/flow/plugins/step-definition-plugin.ts +67 -0
  288. package/src/flow/plugins/step-instance-plugin.ts +431 -0
  289. package/src/flow/plugins/trigger-plugin.ts +95 -0
  290. package/src/flow/plugins/wfa-datapill-plugin.ts +213 -0
  291. package/src/flow/utils/approval-rules-processor.ts +298 -0
  292. package/src/flow/utils/built-in-complex-objects.ts +81 -0
  293. package/src/flow/utils/complex-object-resolver.ts +875 -0
  294. package/src/flow/utils/complex-objects.ts +656 -0
  295. package/src/flow/utils/data-pill-shapes.ts +165 -0
  296. package/src/flow/utils/datapill-transformer.ts +632 -0
  297. package/src/flow/utils/flow-constants.ts +285 -0
  298. package/src/flow/utils/flow-io-to-record.ts +533 -0
  299. package/src/flow/utils/flow-shapes.ts +296 -0
  300. package/src/flow/utils/flow-to-xml.ts +318 -0
  301. package/src/flow/utils/flow-variable-processor.ts +100 -0
  302. package/src/flow/utils/label-cache-parser.ts +37 -0
  303. package/src/flow/utils/label-cache-processor.ts +870 -0
  304. package/src/flow/utils/pill-string-parser.ts +375 -0
  305. package/src/flow/utils/schema-to-flow-object.ts +385 -0
  306. package/src/flow/utils/service-catalog.ts +174 -0
  307. package/src/flow/utils/utils.ts +395 -0
  308. package/src/index.ts +20 -1
  309. package/src/list-plugin.ts +1 -1
  310. package/src/now-attach-plugin.ts +14 -11
  311. package/src/now-ref-plugin.ts +1 -1
  312. package/src/record-plugin.ts +76 -11
  313. package/src/repack/index.ts +14 -0
  314. package/src/rest-api-plugin.ts +62 -50
  315. package/src/server-module-plugin/index.ts +112 -86
  316. package/src/service-catalog/catalog-clientscript-plugin.ts +140 -0
  317. package/src/service-catalog/catalog-item-plugin.ts +162 -0
  318. package/src/service-catalog/catalog-ui-policy-plugin.ts +324 -0
  319. package/src/service-catalog/index.ts +5 -0
  320. package/src/service-catalog/record-to-shape.ts +109 -0
  321. package/src/service-catalog/sc-record-producer-plugin.ts +201 -0
  322. package/src/service-catalog/service-catalog-base.ts +600 -0
  323. package/src/service-catalog/service-catalog-diagnostics.ts +254 -0
  324. package/src/service-catalog/shape-to-record.ts +279 -0
  325. package/src/service-catalog/utils.ts +1455 -0
  326. package/src/service-catalog/variable-helper.ts +135 -0
  327. package/src/service-catalog/variable-set-plugin.ts +197 -0
  328. package/src/service-catalog/variables-transform.ts +438 -0
  329. package/src/sla/sla-validators.ts +331 -0
  330. package/src/sla-plugin.ts +358 -0
  331. package/src/static-content-plugin.ts +25 -2
  332. package/src/table-plugin.ts +49 -16
  333. package/src/ui-page-plugin.ts +1063 -20
  334. package/src/ui-policy-plugin.ts +5 -9
  335. package/src/utils.ts +24 -1
  336. package/src/ux-list-menu-config-plugin.ts +312 -0
  337. package/src/workspace-plugin/chrome-tab.ts +44 -0
  338. package/src/workspace-plugin/constants.ts +53 -0
  339. package/src/workspace-plugin/fluent-utils.ts +60 -0
  340. package/src/workspace-plugin/page.ts +139 -0
  341. package/src/workspace-plugin/screen.ts +34 -0
  342. package/src/workspace-plugin/templates/index.ts +17 -0
  343. package/src/workspace-plugin/templates/record-page-composition.ts +4051 -0
  344. package/src/workspace-plugin/templates/record-page-data.ts +523 -0
  345. package/src/workspace-plugin/templates/record-page-interalEventMappings.ts +35 -0
  346. package/src/workspace-plugin/templates/record-page-layoutModel.ts +51 -0
  347. package/src/workspace-plugin/templates/record-page-properties.ts +131 -0
  348. package/src/workspace-plugin/templates/record-page.ts +6 -0
  349. package/src/workspace-plugin.ts +574 -0
@@ -0,0 +1,431 @@
1
+ import {
2
+ Plugin,
3
+ CallExpressionShape,
4
+ ObjectShape,
5
+ type Record as BuildRecord,
6
+ type Factory,
7
+ type Shape,
8
+ type Source,
9
+ } from '@servicenow/sdk-build-core'
10
+ import type { NowIdShape } from '../../now-id-plugin'
11
+ import { sysIdToUuid } from '../utils/utils'
12
+ import { COLUMN_API_TO_TYPE } from '../../column/column-helper'
13
+ import { ACTION_STEP_INSTANCE_API_NAME } from '../utils/flow-constants'
14
+
15
+ // Error handling type mapping: string to number
16
+ const ERROR_HANDLING_TYPE_MAP: Record<string, number> = {
17
+ stop_the_action: 1,
18
+ dont_stop_the_action: 2,
19
+ }
20
+
21
+ /**
22
+ * StepInstanceShape represents a step instance within a custom action's body
23
+ * This class handles the shape transformation for step instances
24
+ */
25
+ export class StepInstanceShape extends CallExpressionShape {
26
+ private config: ObjectShape
27
+ private sysId: NowIdShape | Shape
28
+ private stepDefinitionSysId: string
29
+ private stepLabel: string
30
+ private inputs: ObjectShape | undefined
31
+ private inputDefinitions: ObjectShape | undefined
32
+
33
+ constructor(args: {
34
+ source: Source
35
+ config: ObjectShape
36
+ sysId: NowIdShape | Shape
37
+ stepDefinitionSysId: string
38
+ stepLabel: string
39
+ inputs: ObjectShape | undefined
40
+ extendedConfig?: ObjectShape
41
+ inputDefinitions?: ObjectShape
42
+ }) {
43
+ const { source, sysId, config, stepDefinitionSysId, stepLabel, inputs, inputDefinitions } = args
44
+ super({ source, callee: 'StepInstance', args: [sysId, config, stepDefinitionSysId] })
45
+ this.config = config
46
+ this.sysId = sysId
47
+ this.stepDefinitionSysId = stepDefinitionSysId
48
+ this.stepLabel = stepLabel
49
+ this.inputs = inputs
50
+ this.inputDefinitions = inputDefinitions
51
+ }
52
+
53
+ getConfig(): ObjectShape {
54
+ return this.config
55
+ }
56
+
57
+ getSysId(): NowIdShape | Shape {
58
+ return this.sysId
59
+ }
60
+
61
+ getStepDefinitionSysId(): string {
62
+ return this.stepDefinitionSysId
63
+ }
64
+
65
+ getStepLabel(): string {
66
+ return (this.config.get('label')?.getValue() as string) ?? this.stepLabel
67
+ }
68
+
69
+ getInputs(): ObjectShape | undefined {
70
+ return this.inputs
71
+ }
72
+
73
+ getInputDefinitions(): ObjectShape | undefined {
74
+ return this.inputDefinitions
75
+ }
76
+ }
77
+
78
+ export const StepInstancePlugin = Plugin.create({
79
+ name: 'StepInstancePlugin',
80
+ shapes: [
81
+ {
82
+ shape: CallExpressionShape,
83
+ fileTypes: ['fluent'],
84
+ toSubclass(callExpression, { diagnostics }) {
85
+ if (callExpression.getCallee() !== ACTION_STEP_INSTANCE_API_NAME) {
86
+ return { success: false }
87
+ }
88
+
89
+ const args = callExpression.getArguments()
90
+ // Accept 3 arguments
91
+ if (args.length !== 3) {
92
+ diagnostics.error(
93
+ callExpression,
94
+ `Expected 3 arguments for StepInstance, but received ${args.length}`
95
+ )
96
+ return { success: false }
97
+ }
98
+
99
+ const [stepDefinition, stepInstanceConfig, inputs] = args
100
+
101
+ // Validate first argument is a StepDefinition
102
+ if (
103
+ !(stepDefinition instanceof CallExpressionShape) ||
104
+ stepDefinition.getCallee() !== 'ActionStepDefinition'
105
+ ) {
106
+ diagnostics.error(callExpression, 'Expected first argument to be a ActionStepDefinition')
107
+ return { success: false }
108
+ }
109
+
110
+ // Validate second argument is a valid ID
111
+ if (!(stepInstanceConfig instanceof ObjectShape)) {
112
+ diagnostics.error(callExpression, 'Expected second argument to be a valid ID')
113
+ return { success: false }
114
+ }
115
+
116
+ // Validate third argument is an object
117
+ if (!(inputs instanceof ObjectShape)) {
118
+ diagnostics.error(callExpression, 'Expected third argument to be an object')
119
+ return { success: false }
120
+ }
121
+
122
+ const stepConfig = stepDefinition.getArgument(0).asObject()
123
+ const shapeArgs: {
124
+ source: Source
125
+ config: ObjectShape
126
+ sysId: NowIdShape | Shape
127
+ stepDefinitionSysId: string
128
+ stepLabel: string
129
+ inputs: ObjectShape | undefined
130
+ inputDefinitions?: ObjectShape
131
+ } = {
132
+ source: callExpression,
133
+ sysId: stepInstanceConfig.get('$id')?.getValue() as NowIdShape | Shape,
134
+ config: stepInstanceConfig,
135
+ stepDefinitionSysId: stepConfig.get('$id')?.getValue() as string,
136
+ stepLabel: stepConfig.get('name')?.getValue() as string,
137
+ inputDefinitions: stepConfig.get('inputs')?.asObject(),
138
+ inputs: inputs,
139
+ }
140
+
141
+ return {
142
+ success: true,
143
+ value: new StepInstanceShape(shapeArgs),
144
+ }
145
+ },
146
+ },
147
+ {
148
+ shape: StepInstanceShape,
149
+ fileTypes: ['fluent'],
150
+ async toRecord(callExpression, { factory }) {
151
+ const stepInstanceRecord = await buildStepInstanceRecord({
152
+ callExpression,
153
+ factory,
154
+ values: callExpression.getInputs() as ObjectShape,
155
+ sysId: callExpression.getSysId(),
156
+ stepDefinitionSysId: callExpression.getStepDefinitionSysId(),
157
+ stepLabel: callExpression.getStepLabel(),
158
+ inputs: callExpression.getInputDefinitions(),
159
+ })
160
+ return { success: true, value: stepInstanceRecord }
161
+ },
162
+ },
163
+ ],
164
+ records: {
165
+ sys_hub_step_ext_input: {
166
+ coalesce: ['model', 'element'],
167
+ },
168
+ sys_hub_step_ext_output: {
169
+ coalesce: ['model', 'element'],
170
+ },
171
+ sys_hub_step_instance: {
172
+ relationships: {
173
+ sys_variable_value: {
174
+ via: 'document_key',
175
+ descendant: true,
176
+ },
177
+ sys_flow_step_definition: {
178
+ via: 'step_type',
179
+ descendant: false,
180
+ },
181
+ sys_hub_step_ext_input: {
182
+ via: 'model',
183
+ descendant: true,
184
+ },
185
+ sys_hub_step_ext_output: {
186
+ via: 'model',
187
+ descendant: true,
188
+ },
189
+ sys_translated_text: {
190
+ via: 'documentkey',
191
+ descendant: true,
192
+ },
193
+ },
194
+ // toShape(record, { descendants, diagnostics }) {
195
+ // // Get the step definition reference
196
+ // const stepDefinitionRecords = descendants.query('sys_flow_step_definition')
197
+ // if (stepDefinitionRecords.length === 0) {
198
+ // diagnostics.error(record, 'Could not find step definition for step instance')
199
+ // return { success: false }
200
+ // }
201
+
202
+ // const stepDefinition = stepDefinitionRecords[0]
203
+ // if (!stepDefinition) {
204
+ // diagnostics.error(record, 'Step definition is undefined')
205
+ // return { success: false }
206
+ // }
207
+
208
+ // // Build the config object from sys_variable_value records
209
+ // const variableValues = descendants.query('sys_variable_value')
210
+ // const configObj: globalThis.Record<string, any> = {}
211
+
212
+ // for (const varValue of variableValues) {
213
+ // const variableSysId = varValue.get('variable')?.asString()?.getValue()
214
+ // const value = varValue.get('value')?.asString()?.getValue()
215
+
216
+ // // Find the matching input definition to get the element name
217
+ // const inputRecords = descendants.query('sys_flow_step_definition_input', { sysId: variableSysId })
218
+ // if (inputRecords.length > 0) {
219
+ // const elementName = inputRecords[0]?.get('element')?.asString()?.getValue()
220
+ // if (elementName) {
221
+ // // Try to parse JSON values, otherwise use as string
222
+ // try {
223
+ // configObj[elementName] = JSON.parse(value || '')
224
+ // } catch {
225
+ // configObj[elementName] = value
226
+ // }
227
+ // }
228
+ // }
229
+ // }
230
+
231
+ // // Add error_handling_type and label from the step instance record itself
232
+ // const errorHandlingType = record.get('error_handling_type')?.asNumber()?.getValue()
233
+ // if (errorHandlingType !== undefined && errorHandlingType !== 1) {
234
+ // configObj['error_handling_type'] = errorHandlingType
235
+ // }
236
+
237
+ // const label = record.get('label')?.asString()?.getValue()
238
+ // const stepName = stepDefinition.get('name')?.asString()?.getValue()
239
+ // if (label && label !== stepName) {
240
+ // configObj['label'] = label
241
+ // }
242
+
243
+ // // Create the StepDefinition CallExpressionShape reference
244
+ // const stepDefinitionShape = new CallExpressionShape({
245
+ // source: stepDefinition,
246
+ // callee: 'StepDefinition',
247
+ // args: [
248
+ // stepDefinition.transform(({ $ }) => ({
249
+ // $id: $.val(NowIdShape.from(stepDefinition)),
250
+ // name: $,
251
+ // })),
252
+ // ],
253
+ // })
254
+
255
+ // // Create the config ObjectShape
256
+ // const configProperties: globalThis.Record<string, any> = {}
257
+ // for (const [key, value] of Object.entries(configObj)) {
258
+ // configProperties[key] = value
259
+ // }
260
+
261
+ // const configShape = new ObjectShape({
262
+ // source: record,
263
+ // properties: configProperties,
264
+ // })
265
+
266
+ // return {
267
+ // success: true,
268
+ // value: new CallExpressionShape({
269
+ // source: record,
270
+ // callee: 'StepInstance',
271
+ // args: [stepDefinitionShape, NowIdShape.from(record), configShape],
272
+ // }),
273
+ // }
274
+ // },
275
+ },
276
+ },
277
+ })
278
+
279
+ async function buildStepInstanceRecord({
280
+ callExpression,
281
+ factory,
282
+ values,
283
+ sysId,
284
+ stepDefinitionSysId,
285
+ stepLabel,
286
+ inputs,
287
+ }: {
288
+ callExpression: StepInstanceShape
289
+ factory: Factory
290
+ values: ObjectShape
291
+ sysId: NowIdShape | Shape
292
+ stepDefinitionSysId: string
293
+ stepLabel: string
294
+ inputs: ObjectShape | undefined
295
+ }): Promise<BuildRecord> {
296
+ // Create step instance record
297
+ const stepInstanceRecord = await factory.createRecord({
298
+ source: callExpression,
299
+ explicitId: sysId,
300
+ table: 'sys_hub_step_instance',
301
+ properties: {
302
+ step_type: stepDefinitionSysId,
303
+ order: 1,
304
+ active: true,
305
+ error_handling_type: ERROR_HANDLING_TYPE_MAP[values.get('errorHandlingType')?.getValue() as string] ?? 1,
306
+ label: stepLabel,
307
+ },
308
+ })
309
+ const updatedStepInstanceRecord = stepInstanceRecord.merge({
310
+ cid: sysIdToUuid(stepInstanceRecord.getId().getValue()),
311
+ })
312
+ const stepInstanceSysId = updatedStepInstanceRecord.getId().getValue()
313
+ // Create sys_variable_value records for each input value
314
+ const variableValueRecords = await createVariableRecords(values, inputs, factory, callExpression, stepInstanceSysId)
315
+ const extendedInputRecords: BuildRecord[] = []
316
+ const extendedOutputRecords: BuildRecord[] = []
317
+ const extendedVariableValueRecords: BuildRecord[] = []
318
+
319
+ const valuesArray = values.properties()
320
+ // biome-ignore lint/suspicious/noExplicitAny: Dynamic input variable config
321
+ const inputVariables = valuesArray['inputVariables']?.getValue() as Record<string, any>
322
+ if (inputVariables) {
323
+ for (const [name, config] of Object.entries(inputVariables)) {
324
+ const label = config.label
325
+ const mandatory = config.mandatory
326
+ const defaultValue = config.defaultValue ?? ''
327
+ const value = config.value
328
+ const extInputRecord = await factory.createRecord({
329
+ source: callExpression,
330
+ table: 'sys_hub_step_ext_input',
331
+ properties: {
332
+ active: true,
333
+ model: stepInstanceSysId,
334
+ model_id: stepInstanceSysId,
335
+ model_table: 'sys_hub_step_instance',
336
+ name: `var__m_sys_hub_step_ext_input_${stepInstanceSysId}`,
337
+ element: name,
338
+ label: label,
339
+ mandatory: mandatory,
340
+ default_value: defaultValue,
341
+ },
342
+ })
343
+ extendedInputRecords.push(extInputRecord)
344
+ extendedVariableValueRecords.push(
345
+ await factory.createRecord({
346
+ source: callExpression,
347
+ table: 'sys_variable_value',
348
+ properties: {
349
+ document: 'sys_hub_step_instance',
350
+ document_key: stepInstanceSysId,
351
+ order: 100,
352
+ value: value,
353
+ variable: extInputRecord.getId().getValue(),
354
+ },
355
+ })
356
+ )
357
+ }
358
+ }
359
+
360
+ const outputVariables = valuesArray['outputVariables']
361
+ if (outputVariables) {
362
+ const outputItemShape = outputVariables.asObject()
363
+ const outputProperties = outputItemShape.properties()
364
+
365
+ for (const [columnName, columnCallExpr] of Object.entries(outputProperties)) {
366
+ const callExpr = columnCallExpr.as(CallExpressionShape)
367
+ const columnType = callExpr.getCallee() // e.g., 'StringColumn', 'IntegerColumn'
368
+ const columnConfig = callExpr.getArgument(0)?.asObject()
369
+ const columnLabel = columnConfig?.get('label')?.getValue() as string
370
+ const mandatory = columnConfig?.get('mandatory')?.getValue() as boolean
371
+ const internalType = COLUMN_API_TO_TYPE[columnType] || 'string'
372
+ const extOutputRecord = await factory.createRecord({
373
+ source: callExpression,
374
+ table: 'sys_hub_step_ext_output',
375
+ properties: {
376
+ active: true,
377
+ model: stepInstanceSysId,
378
+ model_id: stepInstanceSysId,
379
+ model_table: 'sys_hub_step_instance',
380
+ name: `var__m_sys_hub_step_ext_output_${stepInstanceSysId}`,
381
+ element: columnName,
382
+ label: columnLabel || columnName,
383
+ internal_type: internalType,
384
+ mandatory: mandatory,
385
+ },
386
+ })
387
+ extendedOutputRecords.push(extOutputRecord)
388
+ }
389
+ }
390
+
391
+ return updatedStepInstanceRecord.with(
392
+ ...variableValueRecords,
393
+ ...extendedInputRecords,
394
+ ...extendedVariableValueRecords,
395
+ ...extendedOutputRecords
396
+ )
397
+ }
398
+ async function createVariableRecords(
399
+ values: ObjectShape,
400
+ inputs: ObjectShape | undefined,
401
+ factory: Factory,
402
+ callExpression: StepInstanceShape,
403
+ stepInstanceSysId: string
404
+ ) {
405
+ const properties = values.properties()
406
+ // Filter out inputVariables, outputVariables and errorHandlingType as they are handled separately
407
+ const filteredEntries = Object.entries(properties).filter(
408
+ ([key]) => key !== 'inputVariables' && key !== 'outputVariables' && key !== 'errorHandlingType'
409
+ )
410
+ return await Promise.all(
411
+ filteredEntries.map(([key, valueShape]) => {
412
+ const input = inputs?.get(key)
413
+ const variableSysId =
414
+ input instanceof CallExpressionShape
415
+ ? (input.getArgument(0).asObject().get('sysId')?.getValue() as string)
416
+ : ''
417
+ const actualValue = valueShape.getValue?.() ?? valueShape.toString()
418
+ return factory.createRecord({
419
+ source: callExpression,
420
+ table: 'sys_variable_value',
421
+ properties: {
422
+ document: 'sys_hub_step_instance',
423
+ document_key: stepInstanceSysId,
424
+ order: 100,
425
+ value: actualValue,
426
+ variable: variableSysId,
427
+ },
428
+ })
429
+ })
430
+ )
431
+ }
@@ -0,0 +1,95 @@
1
+ import { CallExpressionShape, Plugin } from '@servicenow/sdk-build-core'
2
+ import { buildVariableShapes, complexObjectMatchesIoRecord } from '../utils/flow-io-to-record'
3
+ import { NowIdShape } from '../../now-id-plugin'
4
+
5
+ export const TriggerPlugin = Plugin.create({
6
+ name: 'TriggerPlugin',
7
+ records: {
8
+ sys_hub_trigger_definition: {
9
+ relationships: {
10
+ sys_hub_trigger_input: {
11
+ via: 'model_id',
12
+ descendant: true,
13
+ relationships: {
14
+ sys_documentation: {
15
+ via: { name: 'name', element: 'element' },
16
+ descendant: true,
17
+ },
18
+ sys_choice: {
19
+ via: { name: 'name', element: 'element' },
20
+ descendant: true,
21
+ },
22
+ sys_variable_value: {
23
+ via: 'variable',
24
+ descendant: true,
25
+ },
26
+ sys_complex_object: {
27
+ via: [complexObjectMatchesIoRecord],
28
+ descendant: true,
29
+ inverse: true,
30
+ },
31
+ },
32
+ },
33
+ sys_hub_trigger_output: {
34
+ via: 'model',
35
+ descendant: true,
36
+ relationships: {
37
+ sys_documentation: {
38
+ via: { name: 'name', element: 'element' },
39
+ descendant: true,
40
+ },
41
+ sys_choice: {
42
+ via: { name: 'name', element: 'element' },
43
+ descendant: true,
44
+ },
45
+ sys_variable_value: {
46
+ via: 'variable',
47
+ descendant: true,
48
+ },
49
+ sys_complex_object: {
50
+ via: [complexObjectMatchesIoRecord],
51
+ descendant: true,
52
+ inverse: true,
53
+ },
54
+ },
55
+ },
56
+ },
57
+ toShape(record, { descendants }) {
58
+ const inputRecords = descendants.query('sys_hub_trigger_input')
59
+ const outputRecords = descendants.query('sys_hub_trigger_output')
60
+
61
+ const inputs = inputRecords.length > 0 ? buildVariableShapes(inputRecords, descendants) : {}
62
+ const outputs = outputRecords.length > 0 ? buildVariableShapes(outputRecords, descendants) : {}
63
+
64
+ return {
65
+ success: true,
66
+ value: new CallExpressionShape({
67
+ source: record,
68
+ callee: 'TriggerDefinition',
69
+ args: [
70
+ record.transform(({ $ }) => ({
71
+ $id: $.val(NowIdShape.from(record)),
72
+ name: $,
73
+ type: $,
74
+ ...(Object.keys(inputs ?? {}).length > 0 ? { inputs: $.val(inputs) } : {}),
75
+ ...(Object.keys(outputs ?? {}).length > 0 ? { outputs: $.val(outputs) } : {}),
76
+ })),
77
+ ],
78
+ }),
79
+ }
80
+ },
81
+ },
82
+ sys_hub_trigger_input: {
83
+ coalesce: ['model', 'element'],
84
+ },
85
+ sys_hub_trigger_output: {
86
+ coalesce: ['model', 'element'],
87
+ },
88
+ sys_variable_value: {
89
+ coalesce: ['document_key', 'variable'],
90
+ },
91
+ sys_complex_object: {
92
+ coalesce: ['name'],
93
+ },
94
+ },
95
+ })