@elementumai/edk 0.0.0-oidc-bootstrap → 0.8.1

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 (390) hide show
  1. package/README.md +462 -3
  2. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +188 -0
  3. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.js +20 -0
  4. package/dist-sdk/elementum-entity-client/clients/agents/models/agent.d.ts +245 -0
  5. package/dist-sdk/elementum-entity-client/clients/agents/models/agent.js +30 -0
  6. package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.d.ts +18 -0
  7. package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.js +8 -0
  8. package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.d.ts +718 -0
  9. package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.js +52 -0
  10. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.d.ts +23 -0
  11. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.js +1 -0
  12. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.d.ts +148 -0
  13. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.js +12 -0
  14. package/dist-sdk/elementum-entity-client/clients/aspects/models/format.d.ts +63 -0
  15. package/dist-sdk/elementum-entity-client/clients/aspects/models/format.js +17 -0
  16. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +39 -0
  17. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.js +35 -0
  18. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +116 -0
  19. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.js +11 -0
  20. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +178 -0
  21. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.js +18 -0
  22. package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.d.ts +200 -0
  23. package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.js +1 -0
  24. package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.d.ts +1 -0
  25. package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.js +1 -0
  26. package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.d.ts +141 -0
  27. package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.js +22 -0
  28. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +123 -0
  29. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.js +14 -0
  30. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +78 -0
  31. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +23 -0
  32. package/dist-sdk/elementum-entity-client/clients/tables/models/index.d.ts +1 -0
  33. package/dist-sdk/elementum-entity-client/clients/tables/models/index.js +1 -0
  34. package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.d.ts +265 -0
  35. package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.js +15 -0
  36. package/dist-sdk/elementum-entity-client/errors.d.ts +90 -0
  37. package/dist-sdk/elementum-entity-client/errors.js +111 -0
  38. package/dist-sdk/elementum-entity-client/models/connection.d.ts +30 -0
  39. package/dist-sdk/elementum-entity-client/models/connection.js +16 -0
  40. package/dist-sdk/elementum-entity-client/types.d.ts +71 -0
  41. package/dist-sdk/elementum-entity-client/types.js +1 -0
  42. package/dist-sdk/fs/entity.d.ts +104 -0
  43. package/dist-sdk/fs/entity.js +52 -0
  44. package/dist-sdk/pull/util.d.ts +130 -0
  45. package/dist-sdk/pull/util.js +204 -0
  46. package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
  47. package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
  48. package/dist-sdk/src/catalog/factories.d.ts +242 -0
  49. package/dist-sdk/src/catalog/factories.js +265 -0
  50. package/dist-sdk/src/catalog/from-authoring.d.ts +103 -0
  51. package/dist-sdk/src/catalog/from-authoring.js +467 -0
  52. package/dist-sdk/src/catalog/index.d.ts +12 -0
  53. package/dist-sdk/src/catalog/index.js +12 -0
  54. package/dist-sdk/src/catalog/org.d.ts +11 -0
  55. package/dist-sdk/src/catalog/org.js +288 -0
  56. package/dist-sdk/src/catalog/render-helpers.d.ts +35 -0
  57. package/dist-sdk/src/catalog/render-helpers.js +82 -0
  58. package/dist-sdk/src/catalog/render.d.ts +48 -0
  59. package/dist-sdk/src/catalog/render.js +193 -0
  60. package/dist-sdk/src/catalog/token.d.ts +10 -0
  61. package/dist-sdk/src/catalog/token.js +76 -0
  62. package/dist-sdk/src/catalog/types.d.ts +215 -0
  63. package/dist-sdk/src/catalog/types.js +86 -0
  64. package/dist-sdk/src/catalog/write.d.ts +43 -0
  65. package/dist-sdk/src/catalog/write.js +109 -0
  66. package/dist-sdk/src/core/app-to-ui.d.ts +22 -0
  67. package/dist-sdk/src/core/app-to-ui.js +75 -0
  68. package/dist-sdk/src/core/index.d.ts +10 -0
  69. package/dist-sdk/src/core/index.js +9 -0
  70. package/dist-sdk/src/core/system-fields.d.ts +95 -0
  71. package/dist-sdk/src/core/system-fields.js +153 -0
  72. package/dist-sdk/src/core/triggers/on-demand.d.ts +144 -0
  73. package/dist-sdk/src/core/triggers/on-demand.js +112 -0
  74. package/dist-sdk/src/core/types/ai-provider.d.ts +23 -0
  75. package/dist-sdk/src/core/types/ai-provider.js +8 -0
  76. package/dist-sdk/src/core/types/app.d.ts +857 -0
  77. package/dist-sdk/src/core/types/app.js +210 -0
  78. package/dist-sdk/src/core/types/aspect-category.d.ts +35 -0
  79. package/dist-sdk/src/core/types/aspect-category.js +33 -0
  80. package/dist-sdk/src/core/types/cloud-link.d.ts +34 -0
  81. package/dist-sdk/src/core/types/cloud-link.js +32 -0
  82. package/dist-sdk/src/core/types/display-block.d.ts +149 -0
  83. package/dist-sdk/src/core/types/display-block.js +61 -0
  84. package/dist-sdk/src/core/types/group.d.ts +13 -0
  85. package/dist-sdk/src/core/types/group.js +6 -0
  86. package/dist-sdk/src/core/types/platform.d.ts +2 -0
  87. package/dist-sdk/src/core/types/platform.js +1 -0
  88. package/dist-sdk/src/core/types/user.d.ts +20 -0
  89. package/dist-sdk/src/core/types/user.js +8 -0
  90. package/dist-sdk/src/core/wire/ref-serializer.d.ts +45 -0
  91. package/dist-sdk/src/core/wire/ref-serializer.js +89 -0
  92. package/dist-sdk/src/engine/build/context.d.ts +67 -0
  93. package/dist-sdk/src/engine/build/context.js +6 -0
  94. package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
  95. package/dist-sdk/src/engine/build/source-context.js +23 -0
  96. package/dist-sdk/src/engine/entity.d.ts +44 -0
  97. package/dist-sdk/src/engine/entity.js +15 -0
  98. package/dist-sdk/src/engine/pull/context.d.ts +38 -0
  99. package/dist-sdk/src/engine/pull/context.js +44 -0
  100. package/dist-sdk/src/engine/pull/org.d.ts +54 -0
  101. package/dist-sdk/src/engine/pull/org.js +134 -0
  102. package/dist-sdk/src/engine/tf/escape.d.ts +22 -0
  103. package/dist-sdk/src/engine/tf/escape.js +28 -0
  104. package/dist-sdk/src/engine/tf/expr.d.ts +25 -0
  105. package/dist-sdk/src/engine/tf/expr.js +405 -0
  106. package/dist-sdk/src/engine/tf/index.d.ts +12 -0
  107. package/dist-sdk/src/engine/tf/index.js +11 -0
  108. package/dist-sdk/src/engine/tf/labels.d.ts +76 -0
  109. package/dist-sdk/src/engine/tf/labels.js +196 -0
  110. package/dist-sdk/src/engine/tf/model.d.ts +84 -0
  111. package/dist-sdk/src/engine/tf/model.js +49 -0
  112. package/dist-sdk/src/engine/tf/parse.d.ts +41 -0
  113. package/dist-sdk/src/engine/tf/parse.js +189 -0
  114. package/dist-sdk/src/engine/tf/render.d.ts +13 -0
  115. package/dist-sdk/src/engine/tf/render.js +102 -0
  116. package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +43 -0
  117. package/dist-sdk/src/engine/workspace/authoring-layout.js +201 -0
  118. package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
  119. package/dist-sdk/src/entities/access-policy/build.js +7 -0
  120. package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
  121. package/dist-sdk/src/entities/access-policy/filter.js +83 -0
  122. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +48 -0
  123. package/dist-sdk/src/entities/access-policy/from-tf.js +189 -0
  124. package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
  125. package/dist-sdk/src/entities/access-policy/module.js +17 -0
  126. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +36 -0
  127. package/dist-sdk/src/entities/access-policy/to-tf.js +149 -0
  128. package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
  129. package/dist-sdk/src/entities/access-policy/types.js +10 -0
  130. package/dist-sdk/src/entities/agent/build.d.ts +108 -0
  131. package/dist-sdk/src/entities/agent/build.js +148 -0
  132. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +53 -0
  133. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +344 -0
  134. package/dist-sdk/src/entities/agent/from-tf.d.ts +65 -0
  135. package/dist-sdk/src/entities/agent/from-tf.js +289 -0
  136. package/dist-sdk/src/entities/agent/index.d.ts +7 -0
  137. package/dist-sdk/src/entities/agent/index.js +7 -0
  138. package/dist-sdk/src/entities/agent/module.d.ts +4 -0
  139. package/dist-sdk/src/entities/agent/module.js +122 -0
  140. package/dist-sdk/src/entities/agent/to-tf.d.ts +33 -0
  141. package/dist-sdk/src/entities/agent/to-tf.js +188 -0
  142. package/dist-sdk/src/entities/agent/tools.d.ts +284 -0
  143. package/dist-sdk/src/entities/agent/tools.js +238 -0
  144. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +110 -0
  145. package/dist-sdk/src/entities/agent-tool/from-tf.js +265 -0
  146. package/dist-sdk/src/entities/agent-tool/module.d.ts +3 -0
  147. package/dist-sdk/src/entities/agent-tool/module.js +32 -0
  148. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +40 -0
  149. package/dist-sdk/src/entities/agent-tool/to-tf.js +250 -0
  150. package/dist-sdk/src/entities/agent-tool/types.d.ts +43 -0
  151. package/dist-sdk/src/entities/agent-tool/types.js +102 -0
  152. package/dist-sdk/src/entities/app/build.d.ts +368 -0
  153. package/dist-sdk/src/entities/app/build.js +372 -0
  154. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +168 -0
  155. package/dist-sdk/src/entities/app/deserializer/normalize.js +12 -0
  156. package/dist-sdk/src/entities/app/display-blocks.d.ts +26 -0
  157. package/dist-sdk/src/entities/app/display-blocks.js +34 -0
  158. package/dist-sdk/src/entities/app/from-tf.d.ts +23 -0
  159. package/dist-sdk/src/entities/app/from-tf.js +197 -0
  160. package/dist-sdk/src/entities/app/index.d.ts +14 -0
  161. package/dist-sdk/src/entities/app/index.js +11 -0
  162. package/dist-sdk/src/entities/app/locals.d.ts +11 -0
  163. package/dist-sdk/src/entities/app/locals.js +31 -0
  164. package/dist-sdk/src/entities/app/module.d.ts +4 -0
  165. package/dist-sdk/src/entities/app/module.js +66 -0
  166. package/dist-sdk/src/entities/app/to-tf.d.ts +33 -0
  167. package/dist-sdk/src/entities/app/to-tf.js +212 -0
  168. package/dist-sdk/src/entities/approval-chain/build.d.ts +24 -0
  169. package/dist-sdk/src/entities/approval-chain/build.js +56 -0
  170. package/dist-sdk/src/entities/approval-chain/index.d.ts +6 -0
  171. package/dist-sdk/src/entities/approval-chain/index.js +6 -0
  172. package/dist-sdk/src/entities/approval-chain/steps.d.ts +24 -0
  173. package/dist-sdk/src/entities/approval-chain/steps.js +20 -0
  174. package/dist-sdk/src/entities/automation/build.d.ts +259 -0
  175. package/dist-sdk/src/entities/automation/build.js +436 -0
  176. package/dist-sdk/src/entities/automation/catalog-render.d.ts +5 -0
  177. package/dist-sdk/src/entities/automation/catalog-render.js +35 -0
  178. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +152 -0
  179. package/dist-sdk/src/entities/automation/deserializer/ast.js +13 -0
  180. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +55 -0
  181. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1176 -0
  182. package/dist-sdk/src/entities/automation/filter.d.ts +93 -0
  183. package/dist-sdk/src/entities/automation/filter.js +156 -0
  184. package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -0
  185. package/dist-sdk/src/entities/automation/from-tf.js +1258 -0
  186. package/dist-sdk/src/entities/automation/index.d.ts +22 -0
  187. package/dist-sdk/src/entities/automation/index.js +25 -0
  188. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  189. package/dist-sdk/src/entities/automation/module.js +150 -0
  190. package/dist-sdk/src/entities/automation/operators.d.ts +93 -0
  191. package/dist-sdk/src/entities/automation/operators.js +69 -0
  192. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
  193. package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
  194. package/dist-sdk/src/entities/automation/script-code.d.ts +51 -0
  195. package/dist-sdk/src/entities/automation/script-code.js +633 -0
  196. package/dist-sdk/src/entities/automation/serialize.d.ts +6 -0
  197. package/dist-sdk/src/entities/automation/serialize.js +41 -0
  198. package/dist-sdk/src/entities/automation/tasks.d.ts +641 -0
  199. package/dist-sdk/src/entities/automation/tasks.js +765 -0
  200. package/dist-sdk/src/entities/automation/to-tf.d.ts +19 -0
  201. package/dist-sdk/src/entities/automation/to-tf.js +1169 -0
  202. package/dist-sdk/src/entities/automation/triggers.d.ts +205 -0
  203. package/dist-sdk/src/entities/automation/triggers.js +202 -0
  204. package/dist-sdk/src/entities/automation/types.d.ts +78 -0
  205. package/dist-sdk/src/entities/automation/types.js +131 -0
  206. package/dist-sdk/src/entities/element/build.d.ts +121 -0
  207. package/dist-sdk/src/entities/element/build.js +110 -0
  208. package/dist-sdk/src/entities/element/from-tf.d.ts +19 -0
  209. package/dist-sdk/src/entities/element/from-tf.js +170 -0
  210. package/dist-sdk/src/entities/element/index.d.ts +12 -0
  211. package/dist-sdk/src/entities/element/index.js +10 -0
  212. package/dist-sdk/src/entities/element/locals.d.ts +7 -0
  213. package/dist-sdk/src/entities/element/locals.js +12 -0
  214. package/dist-sdk/src/entities/element/module.d.ts +8 -0
  215. package/dist-sdk/src/entities/element/module.js +65 -0
  216. package/dist-sdk/src/entities/element/to-tf.d.ts +14 -0
  217. package/dist-sdk/src/entities/element/to-tf.js +169 -0
  218. package/dist-sdk/src/entities/field/build.d.ts +112 -0
  219. package/dist-sdk/src/entities/field/build.js +84 -0
  220. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +60 -0
  221. package/dist-sdk/src/entities/field/calc/aggregate.js +71 -0
  222. package/dist-sdk/src/entities/field/calc/date.d.ts +73 -0
  223. package/dist-sdk/src/entities/field/calc/date.js +109 -0
  224. package/dist-sdk/src/entities/field/calc/index.d.ts +229 -0
  225. package/dist-sdk/src/entities/field/calc/index.js +433 -0
  226. package/dist-sdk/src/entities/field/calc/numeric.d.ts +22 -0
  227. package/dist-sdk/src/entities/field/calc/numeric.js +67 -0
  228. package/dist-sdk/src/entities/field/calc/runtime.d.ts +61 -0
  229. package/dist-sdk/src/entities/field/calc/runtime.js +174 -0
  230. package/dist-sdk/src/entities/field/calc/text.d.ts +100 -0
  231. package/dist-sdk/src/entities/field/calc/text.js +208 -0
  232. package/dist-sdk/src/entities/field/calc/types.d.ts +86 -0
  233. package/dist-sdk/src/entities/field/calc/types.js +23 -0
  234. package/dist-sdk/src/entities/field/calc.d.ts +108 -0
  235. package/dist-sdk/src/entities/field/calc.js +54 -0
  236. package/dist-sdk/src/entities/field/from-tf.d.ts +31 -0
  237. package/dist-sdk/src/entities/field/from-tf.js +184 -0
  238. package/dist-sdk/src/entities/field/locals.d.ts +8 -0
  239. package/dist-sdk/src/entities/field/locals.js +24 -0
  240. package/dist-sdk/src/entities/field/module.d.ts +3 -0
  241. package/dist-sdk/src/entities/field/module.js +50 -0
  242. package/dist-sdk/src/entities/field/options.d.ts +27 -0
  243. package/dist-sdk/src/entities/field/options.js +76 -0
  244. package/dist-sdk/src/entities/field/record-shape.d.ts +57 -0
  245. package/dist-sdk/src/entities/field/record-shape.js +1 -0
  246. package/dist-sdk/src/entities/field/to-tf.d.ts +73 -0
  247. package/dist-sdk/src/entities/field/to-tf.js +142 -0
  248. package/dist-sdk/src/entities/field/types.d.ts +53 -0
  249. package/dist-sdk/src/entities/field/types.js +68 -0
  250. package/dist-sdk/src/entities/file-reader/build.d.ts +182 -0
  251. package/dist-sdk/src/entities/file-reader/build.js +105 -0
  252. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
  253. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
  254. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
  255. package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
  256. package/dist-sdk/src/entities/file-reader/index.d.ts +10 -0
  257. package/dist-sdk/src/entities/file-reader/index.js +10 -0
  258. package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
  259. package/dist-sdk/src/entities/file-reader/module.js +115 -0
  260. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
  261. package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
  262. package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
  263. package/dist-sdk/src/entities/file-reader/types.js +30 -0
  264. package/dist-sdk/src/entities/flow/activities/agent.d.ts +15 -0
  265. package/dist-sdk/src/entities/flow/activities/agent.js +29 -0
  266. package/dist-sdk/src/entities/flow/activities/approval.d.ts +9 -0
  267. package/dist-sdk/src/entities/flow/activities/approval.js +18 -0
  268. package/dist-sdk/src/entities/flow/activities/automation.d.ts +12 -0
  269. package/dist-sdk/src/entities/flow/activities/automation.js +22 -0
  270. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +34 -0
  271. package/dist-sdk/src/entities/flow/activities/ctx.js +38 -0
  272. package/dist-sdk/src/entities/flow/activities/form.d.ts +22 -0
  273. package/dist-sdk/src/entities/flow/activities/form.js +36 -0
  274. package/dist-sdk/src/entities/flow/activities/index.d.ts +14 -0
  275. package/dist-sdk/src/entities/flow/activities/index.js +13 -0
  276. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +39 -0
  277. package/dist-sdk/src/entities/flow/activities/input-refs.js +19 -0
  278. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +13 -0
  279. package/dist-sdk/src/entities/flow/activities/prompt-template.js +34 -0
  280. package/dist-sdk/src/entities/flow/activities/render-catalog.d.ts +140 -0
  281. package/dist-sdk/src/entities/flow/activities/render-catalog.js +174 -0
  282. package/dist-sdk/src/entities/flow/activities/types.d.ts +33 -0
  283. package/dist-sdk/src/entities/flow/activities/types.js +1 -0
  284. package/dist-sdk/src/entities/flow/build.d.ts +38 -0
  285. package/dist-sdk/src/entities/flow/build.js +115 -0
  286. package/dist-sdk/src/entities/flow/index.d.ts +8 -0
  287. package/dist-sdk/src/entities/flow/index.js +7 -0
  288. package/dist-sdk/src/entities/flow/serialize.d.ts +51 -0
  289. package/dist-sdk/src/entities/flow/serialize.js +94 -0
  290. package/dist-sdk/src/entities/flow/util.d.ts +27 -0
  291. package/dist-sdk/src/entities/flow/util.js +38 -0
  292. package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
  293. package/dist-sdk/src/entities/org/ai-provider.js +46 -0
  294. package/dist-sdk/src/entities/org/category.d.ts +5 -0
  295. package/dist-sdk/src/entities/org/category.js +33 -0
  296. package/dist-sdk/src/entities/org/cloud-link.d.ts +5 -0
  297. package/dist-sdk/src/entities/org/cloud-link.js +33 -0
  298. package/dist-sdk/src/entities/org/connector.d.ts +12 -0
  299. package/dist-sdk/src/entities/org/connector.js +35 -0
  300. package/dist-sdk/src/entities/org/group.d.ts +5 -0
  301. package/dist-sdk/src/entities/org/group.js +40 -0
  302. package/dist-sdk/src/entities/org/index.d.ts +11 -0
  303. package/dist-sdk/src/entities/org/index.js +11 -0
  304. package/dist-sdk/src/entities/org/role.d.ts +7 -0
  305. package/dist-sdk/src/entities/org/role.js +21 -0
  306. package/dist-sdk/src/entities/org/user.d.ts +7 -0
  307. package/dist-sdk/src/entities/org/user.js +30 -0
  308. package/dist-sdk/src/entities/search-table/build.d.ts +41 -0
  309. package/dist-sdk/src/entities/search-table/build.js +79 -0
  310. package/dist-sdk/src/entities/search-table/index.d.ts +5 -0
  311. package/dist-sdk/src/entities/search-table/index.js +5 -0
  312. package/dist-sdk/src/entities/search-table/module.d.ts +6 -0
  313. package/dist-sdk/src/entities/search-table/module.js +64 -0
  314. package/dist-sdk/src/entities/shared/context.d.ts +93 -0
  315. package/dist-sdk/src/entities/shared/context.js +156 -0
  316. package/dist-sdk/src/entities/shared/filters/ast.d.ts +277 -0
  317. package/dist-sdk/src/entities/shared/filters/ast.js +65 -0
  318. package/dist-sdk/src/entities/shared/filters/index.d.ts +211 -0
  319. package/dist-sdk/src/entities/shared/filters/index.js +372 -0
  320. package/dist-sdk/src/entities/shared/filters/types.d.ts +170 -0
  321. package/dist-sdk/src/entities/shared/filters/types.js +7 -0
  322. package/dist-sdk/src/entities/shared/ref.d.ts +160 -0
  323. package/dist-sdk/src/entities/shared/ref.js +119 -0
  324. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
  325. package/dist-sdk/src/entities/shared/tool-field-ref.js +31 -0
  326. package/dist-sdk/src/entities/shared/types/common.d.ts +106 -0
  327. package/dist-sdk/src/entities/shared/types/common.js +64 -0
  328. package/dist-sdk/src/entities/shared/types/field-types.d.ts +58 -0
  329. package/dist-sdk/src/entities/shared/types/field-types.js +57 -0
  330. package/dist-sdk/src/entities/shared/types/platform.d.ts +46 -0
  331. package/dist-sdk/src/entities/shared/types/platform.js +10 -0
  332. package/dist-sdk/src/entities/skill/build.d.ts +25 -0
  333. package/dist-sdk/src/entities/skill/build.js +50 -0
  334. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +39 -0
  335. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +124 -0
  336. package/dist-sdk/src/entities/skill/from-tf.d.ts +33 -0
  337. package/dist-sdk/src/entities/skill/from-tf.js +96 -0
  338. package/dist-sdk/src/entities/skill/index.d.ts +7 -0
  339. package/dist-sdk/src/entities/skill/index.js +7 -0
  340. package/dist-sdk/src/entities/skill/module.d.ts +4 -0
  341. package/dist-sdk/src/entities/skill/module.js +111 -0
  342. package/dist-sdk/src/entities/skill/to-tf.d.ts +33 -0
  343. package/dist-sdk/src/entities/skill/to-tf.js +59 -0
  344. package/dist-sdk/src/entities/skill/tools.d.ts +93 -0
  345. package/dist-sdk/src/entities/skill/tools.js +105 -0
  346. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +60 -0
  347. package/dist-sdk/src/entities/skill-tool/from-tf.js +142 -0
  348. package/dist-sdk/src/entities/skill-tool/module.d.ts +3 -0
  349. package/dist-sdk/src/entities/skill-tool/module.js +21 -0
  350. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +34 -0
  351. package/dist-sdk/src/entities/skill-tool/to-tf.js +130 -0
  352. package/dist-sdk/src/entities/skill-tool/types.d.ts +40 -0
  353. package/dist-sdk/src/entities/skill-tool/types.js +67 -0
  354. package/dist-sdk/src/entities/table/build.d.ts +74 -0
  355. package/dist-sdk/src/entities/table/build.js +339 -0
  356. package/dist-sdk/src/entities/table/catalog-render.d.ts +5 -0
  357. package/dist-sdk/src/entities/table/catalog-render.js +39 -0
  358. package/dist-sdk/src/entities/table/fields.d.ts +81 -0
  359. package/dist-sdk/src/entities/table/fields.js +70 -0
  360. package/dist-sdk/src/entities/table/filter.d.ts +41 -0
  361. package/dist-sdk/src/entities/table/filter.js +89 -0
  362. package/dist-sdk/src/entities/table/index.d.ts +8 -0
  363. package/dist-sdk/src/entities/table/index.js +12 -0
  364. package/dist-sdk/src/entities/table/joins.d.ts +26 -0
  365. package/dist-sdk/src/entities/table/joins.js +31 -0
  366. package/dist-sdk/src/entities/table/keys.d.ts +11 -0
  367. package/dist-sdk/src/entities/table/keys.js +25 -0
  368. package/dist-sdk/src/entities/table/module.d.ts +5 -0
  369. package/dist-sdk/src/entities/table/module.js +25 -0
  370. package/dist-sdk/src/entities/table/state.d.ts +39 -0
  371. package/dist-sdk/src/entities/table/state.js +43 -0
  372. package/dist-sdk/src/entities/view/from-tf.d.ts +29 -0
  373. package/dist-sdk/src/entities/view/from-tf.js +235 -0
  374. package/dist-sdk/src/entities/view/module.d.ts +24 -0
  375. package/dist-sdk/src/entities/view/module.js +61 -0
  376. package/dist-sdk/src/entities/view/to-tf.d.ts +65 -0
  377. package/dist-sdk/src/entities/view/to-tf.js +171 -0
  378. package/dist-sdk/src/entities/view/types.d.ts +58 -0
  379. package/dist-sdk/src/entities/view/types.js +89 -0
  380. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +9 -0
  381. package/dist-sdk/src/graph/deferred-catalog-render.js +18 -0
  382. package/dist-sdk/src/graph/index.d.ts +91 -0
  383. package/dist-sdk/src/graph/index.js +211 -0
  384. package/dist-sdk/src/graph/modules.d.ts +7 -0
  385. package/dist-sdk/src/graph/modules.js +42 -0
  386. package/dist-sdk/src/graph/types.d.ts +375 -0
  387. package/dist-sdk/src/graph/types.js +102 -0
  388. package/dist-sdk/src/internal/sdk-package.d.ts +7 -0
  389. package/dist-sdk/src/internal/sdk-package.js +23 -0
  390. package/package.json +201 -8
@@ -0,0 +1,765 @@
1
+ import { serializeValueOrRef } from "../../core/wire/ref-serializer.js";
2
+ import { extractScriptBody } from "./script-code.js";
3
+ function workflowFields(fields) {
4
+ return fields.map((f) => {
5
+ return {
6
+ aspectFieldId: f.field, // token → field id at deploy
7
+ valueReference: serializeValueOrRef(f.value),
8
+ };
9
+ });
10
+ }
11
+ export function recordSearch(opts) {
12
+ return {
13
+ key: "recordSearch",
14
+ config: {
15
+ aspectId: opts.app,
16
+ filter: opts.filter,
17
+ ...(opts.sort !== undefined ? { sort: opts.sort } : {}),
18
+ ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
19
+ },
20
+ __recordApp: opts.app.refName,
21
+ };
22
+ }
23
+ export function tableRecordsSearch(opts) {
24
+ return {
25
+ key: "tableRecordsSearch",
26
+ config: {
27
+ tableId: opts.table,
28
+ ...(opts.filter !== undefined ? { filter: opts.filter } : {}),
29
+ ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
30
+ },
31
+ };
32
+ }
33
+ export function createRecord(opts) {
34
+ if (opts.fields.length === 0)
35
+ throw new Error("createRecord requires at least one field.");
36
+ if (opts.relateToRecord && opts.record === undefined) {
37
+ throw new Error("createRecord with relateToRecord requires `record`.");
38
+ }
39
+ return {
40
+ key: "createRecord",
41
+ config: {
42
+ aspectId: opts.app,
43
+ workflowFields: workflowFields(opts.fields),
44
+ relateToRecord: opts.relateToRecord ?? false,
45
+ ...(opts.record !== undefined ? { recordReference: serializeValueOrRef(opts.record) } : {}),
46
+ },
47
+ __recordApp: opts.app.refName,
48
+ };
49
+ }
50
+ export function updateField(opts) {
51
+ if (opts.fields.length === 0)
52
+ throw new Error("updateField requires at least one field.");
53
+ return {
54
+ key: "updateField",
55
+ config: {
56
+ aspectId: opts.app,
57
+ recordReference: serializeValueOrRef(opts.record),
58
+ workflowFields: workflowFields(opts.fields),
59
+ },
60
+ __recordApp: opts.app.refName,
61
+ };
62
+ }
63
+ export function findRelatedRecords(opts) {
64
+ return {
65
+ key: "findRelatedRecords",
66
+ config: {
67
+ relatedAspectId: opts.relatedApp,
68
+ recordId: serializeValueOrRef(opts.record),
69
+ ...(opts.filter !== undefined ? { filter: opts.filter } : {}),
70
+ ...(opts.sort !== undefined ? { sort: opts.sort } : {}),
71
+ ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
72
+ },
73
+ __recordApp: opts.relatedApp.refName,
74
+ };
75
+ }
76
+ export function relateRecords(opts) {
77
+ if (opts.sources.length === 0)
78
+ throw new Error("relateRecords requires at least one source record.");
79
+ return {
80
+ key: "relateRecords",
81
+ config: {
82
+ // Always an array in wire — matches DSL `sources: [...]` and round-trips
83
+ // single-source HCL (scalar source_record_ids) via from-tf normalization.
84
+ sourceRecordIds: opts.sources.map((s) => serializeValueOrRef(s)),
85
+ targetRecordId: serializeValueOrRef(opts.target),
86
+ },
87
+ };
88
+ }
89
+ function refList(values) {
90
+ return values === undefined ? undefined : values.map((v) => serializeValueOrRef(v));
91
+ }
92
+ function serializeEmailAttachment(a) {
93
+ return "file" in a ? { file: serializeValueOrRef(a.file) } : { record: serializeValueOrRef(a.fromRecord) };
94
+ }
95
+ export function sendEmail(opts) {
96
+ if (!opts.toUsers?.length && !opts.toGroups?.length && !opts.toAddresses?.length) {
97
+ throw new Error("sendEmail requires at least one recipient (toUsers, toGroups, or toAddresses).");
98
+ }
99
+ return {
100
+ key: "sendEmail",
101
+ config: {
102
+ ...(opts.fromUsername !== undefined ? { fromUsername: opts.fromUsername } : {}),
103
+ ...(opts.fromDisplayName !== undefined ? { fromPersonal: opts.fromDisplayName } : {}),
104
+ subject: serializeValueOrRef(opts.subject),
105
+ messageBody: serializeValueOrRef(opts.body),
106
+ ...(opts.toUsers !== undefined ? { users: refList(opts.toUsers) } : {}),
107
+ ...(opts.toGroups !== undefined ? { groups: refList(opts.toGroups) } : {}),
108
+ ...(opts.toAddresses !== undefined ? { externalEmails: refList(opts.toAddresses) } : {}),
109
+ ...(opts.attachments !== undefined
110
+ ? { emailAttachments: opts.attachments.map(serializeEmailAttachment) }
111
+ : {}),
112
+ },
113
+ };
114
+ }
115
+ export function postComment(opts) {
116
+ if (opts.tags !== undefined && opts.tags.length === 0)
117
+ throw new Error("postComment's tags, when given, must be non-empty.");
118
+ return {
119
+ key: "message",
120
+ config: {
121
+ ...(opts.tags !== undefined ? { tags: opts.tags } : {}),
122
+ contentsReference: serializeValueOrRef(opts.contents),
123
+ recordReference: serializeValueOrRef(opts.record),
124
+ },
125
+ };
126
+ }
127
+ export function aiAgent(opts) {
128
+ if (opts.outputType === "json" && (opts.schema === undefined || Object.keys(opts.schema).length === 0)) {
129
+ throw new Error('aiAgent with outputType "json" requires at least one field in schema.');
130
+ }
131
+ return {
132
+ key: "aiAgent",
133
+ config: {
134
+ agentId: opts.agent,
135
+ agentPrompt: serializeValueOrRef(opts.prompt),
136
+ outputType: opts.outputType.toUpperCase(),
137
+ ...(opts.schema !== undefined
138
+ ? {
139
+ jsonFields: Object.entries(opts.schema).map(([name, def]) => ({
140
+ name,
141
+ type: def.type.toUpperCase(),
142
+ ...(def.description !== undefined ? { description: def.description } : {}),
143
+ })),
144
+ }
145
+ : {}),
146
+ ...(opts.connector !== undefined ? { aiProviderConnectorId: opts.connector } : {}),
147
+ },
148
+ };
149
+ }
150
+ export function setVariable(opts) {
151
+ if (!opts.create?.length && !opts.update?.length) {
152
+ throw new Error("setVariable requires a non-empty create and/or update list.");
153
+ }
154
+ const create = (opts.create ?? []).map((c) => ({
155
+ id: c.id,
156
+ name: c.name,
157
+ type: c.type,
158
+ ...(c.value !== undefined ? { value: serializeValueOrRef(c.value) } : {}),
159
+ }));
160
+ const update = (opts.update ?? []).map((u) => ({
161
+ variable: serializeValueOrRef(u.variable),
162
+ value: serializeValueOrRef(u.value),
163
+ }));
164
+ return {
165
+ key: "variable",
166
+ config: {
167
+ ...(create.length > 0 ? { create } : {}),
168
+ ...(update.length > 0 ? { update } : {}),
169
+ },
170
+ };
171
+ }
172
+ // --- executeScript ----------------------------------------------------------
173
+ /** Map an output schema (name → type) to the platform's tagged object shape. */
174
+ function outputSchema(outputs) {
175
+ const properties = Object.entries(outputs).map(([name, type]) => {
176
+ switch (type) {
177
+ case "integer":
178
+ return { integer: { name } };
179
+ case "number":
180
+ case "decimal":
181
+ return { number: { name } };
182
+ case "boolean":
183
+ return { bool: { name } };
184
+ default:
185
+ return { string: { name } };
186
+ }
187
+ });
188
+ // No root name: the canonical provider form omits it, ei's exporter and the
189
+ // import read-back both DROP empty names — emitting name:"" would diff
190
+ // against both (adoption zero-change gate + build-vs-export).
191
+ return { object: { properties } };
192
+ }
193
+ /**
194
+ * Build the executeScript `TaskDef` from an ALREADY-RESOLVED body string.
195
+ * Shared by the public `executeScript()` factory below (which resolves the
196
+ * body via `extractScriptBody`'s `toString()` path) and the fluent
197
+ * `WorkflowBuilder.executeScript()` in `build.ts` (which resolves it via
198
+ * `tryExtractFromCurrentSource` first, for byte-exact pulled-source fidelity,
199
+ * falling back to `extractScriptBody` only when there's no tracked source) —
200
+ * so the body is computed exactly once, not re-derived by each layer.
201
+ */
202
+ export function executeScriptTaskDefWithBody(body, opts) {
203
+ const inputs = Object.entries(opts.inputs ?? {}).map(([name, value]) => ({
204
+ name,
205
+ value: serializeValueOrRef(value),
206
+ }));
207
+ return {
208
+ key: "executeScript",
209
+ config: {
210
+ inputs,
211
+ code: body,
212
+ ...(opts.outputs !== undefined ? { outputSchema: outputSchema(opts.outputs) } : {}),
213
+ },
214
+ };
215
+ }
216
+ export function executeScript(opts) {
217
+ return executeScriptTaskDefWithBody(extractScriptBody(opts.code), opts);
218
+ }
219
+ function apiRequestHeaders(headers) {
220
+ return (headers ?? []).map((h) => ({ name: h.name, value: serializeValueOrRef(h.value) }));
221
+ }
222
+ const API_AUTH_KEYS = ["basicAuth", "bearerAuth", "oauth"];
223
+ const API_BODY_KEYS = ["jsonBody", "formBody", "customBody", "multipartBody"];
224
+ export function apiRequest(opts) {
225
+ const setAuthKeys = API_AUTH_KEYS.filter((k) => opts[k] !== undefined);
226
+ if (setAuthKeys.length > 1) {
227
+ throw new Error(`apiRequest: at most one of basicAuth/bearerAuth/oauth may be set (got ${setAuthKeys.join(", ")}).`);
228
+ }
229
+ const setBodyKeys = API_BODY_KEYS.filter((k) => opts[k] !== undefined);
230
+ if (setBodyKeys.length > 1) {
231
+ throw new Error(`apiRequest: at most one of jsonBody/formBody/customBody/multipartBody may be set (got ${setBodyKeys.join(", ")}).`);
232
+ }
233
+ return {
234
+ key: "api",
235
+ config: {
236
+ urlReference: serializeValueOrRef(opts.url),
237
+ method: opts.method,
238
+ // elementum_api_task's real attribute is `headers[].name` (confirmed
239
+ // against api_task_resource.go's schema) - not "header". Omit when
240
+ // unset rather than defaulting to `[]` - the platform leaves `headers`
241
+ // absent (not an empty list) on a task with none configured, so an
242
+ // unconditional `[]` here permanently diffed against state.
243
+ ...(opts.headers !== undefined ? { headers: apiRequestHeaders(opts.headers) } : {}),
244
+ ...(opts.basicAuth !== undefined ? {
245
+ basicAuth: {
246
+ username: serializeValueOrRef(opts.basicAuth.username),
247
+ ...(opts.basicAuth.referencePassword !== undefined
248
+ ? { referencePassword: serializeValueOrRef(opts.basicAuth.referencePassword) }
249
+ : {}),
250
+ },
251
+ } : {}),
252
+ ...(opts.bearerAuth !== undefined ? {
253
+ bearerAuth: {
254
+ ...(opts.bearerAuth.token !== undefined ? { token: opts.bearerAuth.token } : {}),
255
+ ...(opts.bearerAuth.referenceToken !== undefined
256
+ ? { referenceToken: serializeValueOrRef(opts.bearerAuth.referenceToken) }
257
+ : {}),
258
+ },
259
+ } : {}),
260
+ ...(opts.oauth !== undefined ? {
261
+ oauth: {
262
+ requestType: opts.oauth.requestType,
263
+ ...(opts.oauth.url !== undefined ? { url: serializeValueOrRef(opts.oauth.url) } : {}),
264
+ ...(opts.oauth.clientId !== undefined ? { clientId: opts.oauth.clientId } : {}),
265
+ ...(opts.oauth.clientSecret !== undefined ? { clientSecret: opts.oauth.clientSecret } : {}),
266
+ ...(opts.oauth.headers !== undefined ? { headers: apiRequestHeaders(opts.oauth.headers) } : {}),
267
+ },
268
+ } : {}),
269
+ ...(opts.jsonBody !== undefined ? { jsonBody: serializeValueOrRef(opts.jsonBody) } : {}),
270
+ ...(opts.formBody !== undefined ? {
271
+ formBody: opts.formBody.map((v) => ({ key: v.key, value: serializeValueOrRef(v.value) })),
272
+ } : {}),
273
+ ...(opts.customBody !== undefined ? {
274
+ customBody: { contentType: opts.customBody.contentType, content: serializeValueOrRef(opts.customBody.content) },
275
+ } : {}),
276
+ ...(opts.multipartBody !== undefined ? {
277
+ multipartBody: {
278
+ parts: opts.multipartBody.parts.map((part) => ({
279
+ name: part.name,
280
+ ...(part.value !== undefined ? { value: serializeValueOrRef(part.value) } : {}),
281
+ ...(part.attachment !== undefined ? { attachment: serializeValueOrRef(part.attachment) } : {}),
282
+ ...(part.attachmentId !== undefined ? { attachmentId: serializeValueOrRef(part.attachmentId) } : {}),
283
+ ...(part.file !== undefined ? { file: serializeValueOrRef(part.file) } : {}),
284
+ })),
285
+ },
286
+ } : {}),
287
+ responseType: opts.responseType ?? "JSON",
288
+ continueOnError: opts.continueOnError ?? false,
289
+ },
290
+ };
291
+ }
292
+ export function aiSearchTable(opts) {
293
+ return {
294
+ key: "aiSearchTable",
295
+ config: {
296
+ searchTableId: opts.table,
297
+ query: serializeValueOrRef(opts.query),
298
+ ...(opts.filter !== undefined ? { filter: opts.filter } : {}),
299
+ ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
300
+ },
301
+ };
302
+ }
303
+ // --- AI text tasks ----------------------------------------------------------
304
+ /** Common optional AI connector slot (`ConnectorRef` token). */
305
+ function connectorSlot(connector) {
306
+ return connector !== undefined ? { aiProviderConnectorId: connector } : {};
307
+ }
308
+ export function aiSummarize(opts) {
309
+ if (opts.length == null || opts.length < 1) {
310
+ throw new Error("aiSummarize requires length ≥ 1 (the summary length in sentences).");
311
+ }
312
+ return {
313
+ key: "aiSummarize",
314
+ config: {
315
+ textToSummarize: serializeValueOrRef(opts.text),
316
+ ...(opts.context !== undefined ? { context: serializeValueOrRef(opts.context) } : {}),
317
+ length: opts.length,
318
+ ...connectorSlot(opts.connector),
319
+ },
320
+ };
321
+ }
322
+ export function aiTransform(opts) {
323
+ return {
324
+ key: "aiTransform",
325
+ config: {
326
+ prompt: serializeValueOrRef(opts.prompt),
327
+ fieldType: opts.fieldType,
328
+ ...connectorSlot(opts.connector),
329
+ },
330
+ };
331
+ }
332
+ export function aiEmailAnalysis(opts) {
333
+ return {
334
+ key: "aiEmailAnalysis",
335
+ config: {
336
+ emailBody: serializeValueOrRef(opts.emailBody),
337
+ emailSubject: serializeValueOrRef(opts.emailSubject),
338
+ ...connectorSlot(opts.connector),
339
+ },
340
+ };
341
+ }
342
+ export function aiFileAnalysis(opts) {
343
+ return {
344
+ key: "aiFileAnalysis",
345
+ config: {
346
+ attachmentId: serializeValueOrRef(opts.attachmentId),
347
+ documentModelId: opts.documentModel,
348
+ aiProviderConnectorId: opts.connector,
349
+ },
350
+ };
351
+ }
352
+ function aiClassifyCategorySource(src) {
353
+ if (src.type === "static") {
354
+ return {
355
+ static: {
356
+ categories: src.categories.map((c) => ({
357
+ name: serializeValueOrRef(c.name),
358
+ ...(c.description !== undefined ? { description: serializeValueOrRef(c.description) } : {}),
359
+ })),
360
+ },
361
+ };
362
+ }
363
+ return {
364
+ dynamic: {
365
+ aspectId: src.app,
366
+ labelFieldId: src.labelField,
367
+ ...(src.descriptionField !== undefined ? { descriptionFieldId: src.descriptionField } : {}),
368
+ ...(src.filter !== undefined ? { filter: src.filter } : {}),
369
+ ...(src.limit !== undefined ? { limit: src.limit } : {}),
370
+ },
371
+ };
372
+ }
373
+ export function aiClassify(opts) {
374
+ if (opts.categorySource.type === "static" && opts.categorySource.categories.length === 0) {
375
+ throw new Error("aiClassify static categorySource requires at least one category.");
376
+ }
377
+ return {
378
+ key: "aiClassify",
379
+ config: {
380
+ textToClassify: serializeValueOrRef(opts.text),
381
+ categorySource: aiClassifyCategorySource(opts.categorySource),
382
+ ...(opts.context !== undefined ? { context: serializeValueOrRef(opts.context) } : {}),
383
+ ...connectorSlot(opts.connector),
384
+ },
385
+ };
386
+ }
387
+ export function notification(opts) {
388
+ if (!opts.userIds?.length &&
389
+ !opts.groupIds?.length &&
390
+ !opts.userRefs?.length &&
391
+ !opts.groupRefs?.length &&
392
+ !opts.notifyWatchers) {
393
+ throw new Error("notification requires at least one recipient (userIds, groupIds, userRefs, groupRefs, or notifyWatchers).");
394
+ }
395
+ return {
396
+ key: "notification",
397
+ config: {
398
+ titleReference: serializeValueOrRef(opts.title),
399
+ messageReference: serializeValueOrRef(opts.message),
400
+ ...(opts.description !== undefined ? { description: opts.description } : {}),
401
+ ...(opts.userIds?.length ? { userIds: opts.userIds } : {}),
402
+ ...(opts.groupIds?.length ? { groupIds: opts.groupIds } : {}),
403
+ ...(opts.userRefs !== undefined ? { userValueReferences: refList(opts.userRefs) } : {}),
404
+ ...(opts.groupRefs !== undefined ? { groupValueReferences: refList(opts.groupRefs) } : {}),
405
+ ...(opts.notifyWatchers !== undefined ? { notifyWatchers: opts.notifyWatchers } : {}),
406
+ },
407
+ };
408
+ }
409
+ export function filterTask(opts) {
410
+ return { key: "filter", config: { filter: opts.condition } };
411
+ }
412
+ export function assignUser(opts) {
413
+ return { key: "assignUser", config: { fieldId: opts.field, userId: opts.userId } };
414
+ }
415
+ export function assignGroup(opts) {
416
+ return { key: "assignGroup", config: { fieldId: opts.field, groupId: opts.groupId } };
417
+ }
418
+ export function addWatcher(opts) {
419
+ if (!opts.userIds?.length && !opts.groupIds?.length && !opts.userRefs?.length && !opts.groupRefs?.length) {
420
+ throw new Error("addWatcher requires at least one of: userIds, groupIds, userRefs, groupRefs.");
421
+ }
422
+ return {
423
+ key: "addWatcher",
424
+ config: {
425
+ ...(opts.userIds?.length ? { userIds: opts.userIds } : {}),
426
+ ...(opts.groupIds?.length ? { groupIds: opts.groupIds } : {}),
427
+ ...(opts.userRefs !== undefined ? { userValueReferences: refList(opts.userRefs) } : {}),
428
+ ...(opts.groupRefs !== undefined ? { groupValueReferences: refList(opts.groupRefs) } : {}),
429
+ ...(opts.record !== undefined ? { recordReference: serializeValueOrRef(opts.record) } : {}),
430
+ },
431
+ };
432
+ }
433
+ export function recordFieldLocking(opts) {
434
+ if (!opts.fieldsToLock?.length && !opts.fieldsToUnlock?.length) {
435
+ throw new Error("recordFieldLocking requires at least one of: fieldsToLock, fieldsToUnlock.");
436
+ }
437
+ return {
438
+ key: "aspectRecordFieldLocking",
439
+ config: {
440
+ aspectId: opts.app,
441
+ recordId: serializeValueOrRef(opts.record),
442
+ ...(opts.fieldsToLock !== undefined ? { fieldsToLock: opts.fieldsToLock } : {}),
443
+ ...(opts.fieldsToUnlock !== undefined ? { fieldsToUnlock: opts.fieldsToUnlock } : {}),
444
+ },
445
+ };
446
+ }
447
+ export function userSearch(opts) {
448
+ return { key: "userSearch", config: { filter: opts.filter } };
449
+ }
450
+ export function userGroupSearch(opts) {
451
+ return { key: "userGroupSearch", config: { filter: opts.filter } };
452
+ }
453
+ export function saveAttachment(opts) {
454
+ return {
455
+ key: "saveAttachment",
456
+ config: {
457
+ recordId: serializeValueOrRef(opts.record),
458
+ fileInput: { file: serializeValueOrRef(opts.file) },
459
+ ...(opts.tag !== undefined ? { tag: serializeValueOrRef(opts.tag) } : {}),
460
+ ...(opts.viewState !== undefined ? { viewState: opts.viewState } : {}),
461
+ },
462
+ };
463
+ }
464
+ export function unzip(opts) {
465
+ return { key: "unzip", config: { file: serializeValueOrRef(opts.file) } };
466
+ }
467
+ export function generateReport(opts) {
468
+ return {
469
+ key: "aspectAppReportGeneration",
470
+ config: {
471
+ recordReference: serializeValueOrRef(opts.record),
472
+ reportId: opts.reportId,
473
+ reportType: opts.reportType,
474
+ },
475
+ };
476
+ }
477
+ export function postTeamsMessage(opts) {
478
+ return {
479
+ key: "postTeamsMessage",
480
+ config: {
481
+ webhookUrl: opts.webhookUrl,
482
+ contents: serializeValueOrRef(opts.contents),
483
+ title: serializeValueOrRef(opts.title),
484
+ subtitle: serializeValueOrRef(opts.subtitle),
485
+ ...(opts.recordUrl !== undefined ? { recordUrl: serializeValueOrRef(opts.recordUrl) } : {}),
486
+ ...(opts.recordButtonText !== undefined
487
+ ? { recordButtonText: serializeValueOrRef(opts.recordButtonText) }
488
+ : {}),
489
+ },
490
+ };
491
+ }
492
+ export function assignmentEngine(opts) {
493
+ return {
494
+ key: "assignmentEngine",
495
+ config: {
496
+ assignmentEngineId: opts.assignmentEngineId,
497
+ recordReference: serializeValueOrRef(opts.record),
498
+ },
499
+ };
500
+ }
501
+ export function procedure(opts) {
502
+ return {
503
+ key: "procedure",
504
+ config: {
505
+ procedureId: opts.procedureId,
506
+ cloudLinkId: opts.cloudLinkId,
507
+ parameters: (opts.parameters ?? []).map((v, index) => ({ index, value: serializeValueOrRef(v) })),
508
+ },
509
+ };
510
+ }
511
+ export function initiateCall(opts) {
512
+ return {
513
+ key: "initiateCall",
514
+ config: {
515
+ agentId: opts.agent,
516
+ phoneServiceId: opts.phoneServiceId,
517
+ phoneNumber: serializeValueOrRef(opts.phoneNumber),
518
+ recordId: serializeValueOrRef(opts.record),
519
+ defaultLanguage: serializeValueOrRef(opts.language),
520
+ firstMessage: serializeValueOrRef(opts.firstMessage),
521
+ ...(opts.context !== undefined ? { context: serializeValueOrRef(opts.context) } : {}),
522
+ },
523
+ };
524
+ }
525
+ /**
526
+ * `calculation`'s write-side template parameters use the normal nested
527
+ * parameter envelope, but the parameter type is carried inside that nested
528
+ * value. Re-shape just for this task rather than changing the shared
529
+ * serializer, since other tasks apply with the generic `{ value: { name,
530
+ * value } }` form.
531
+ */
532
+ function calculationTemplateParameters(parameters) {
533
+ return parameters.map((p) => p.value
534
+ ? { value: { name: p.value.name, value: p.value.value, type: "VALUE_PARAMETER" } }
535
+ : p.list
536
+ ? {
537
+ value: {
538
+ name: p.list.name,
539
+ value: p.list.value,
540
+ type: "LIST_PARAMETER",
541
+ parameters: calculationTemplateParameters(p.list.parameters),
542
+ },
543
+ }
544
+ : p);
545
+ }
546
+ export function calculation(opts) {
547
+ if (opts.calculations.length === 0)
548
+ throw new Error("calculation requires at least one calculation entry.");
549
+ const names = new Set();
550
+ for (const c of opts.calculations) {
551
+ if (names.has(c.name))
552
+ throw new Error(`calculation entry names must be unique — duplicate "${c.name}".`);
553
+ names.add(c.name);
554
+ }
555
+ // The write-side input type is `WorkflowCalculationInput` (backend record:
556
+ // `id`, `name`, `recordId`, `calculationReference`, `includeTypes`) sent as
557
+ // a flat `calculation: { calculations: [...] }` array — not the
558
+ // GET-response-shaped `calculationInputMap` dictionary (keyed by entry id,
559
+ // nested under `calculationInput`, carrying `textWithIds`/`parameters`/
560
+ // `outputType`/`multiple`/`referencedFields`) this used to mirror. Sending
561
+ // the GET shape back on create/update 500s server-side with no
562
+ // field-level error, because it isn't what the write mutation's input type
563
+ // actually accepts. `id` is server-assigned and simply omitted from the
564
+ // entry when authoring new (mirrors {@link VariableDecl.id}).
565
+ const calculations = [];
566
+ for (const c of opts.calculations) {
567
+ const rawCalculationReference = serializeValueOrRef(c.expression);
568
+ // The calc engine always expects `calculationReference` to be a
569
+ // `templateReference`, even for one trivial reference — confirmed via a
570
+ // live GET dump and the CALCULATION test fixture, both of which show a
571
+ // bare single-field expression stored as `template: "{{{p1}}}"` with one
572
+ // parameter. `expression: ctx.trigger.record["..."]` (no `template(...)`
573
+ // wrapping) serializes to a bare `{ triggerReference: {...} }` with no
574
+ // `templateReference` at all — the calc engine 500s on that (no
575
+ // field-level detail). Normalize any non-template expression into that
576
+ // trivial single-placeholder form.
577
+ const calculationReference = rawCalculationReference.templateReference
578
+ ? rawCalculationReference
579
+ : {
580
+ templateReference: {
581
+ template: "{{{p1}}}",
582
+ parameters: [{ value: { name: "p1", value: rawCalculationReference } }],
583
+ },
584
+ };
585
+ // `calculationReference.templateReference.parameters` needs `type` inside
586
+ // the nested parameter value — re-shape a copy rather than mutating the
587
+ // generic serializer's output.
588
+ const templateReference = calculationReference.templateReference;
589
+ const wireCalculationReference = {
590
+ ...calculationReference,
591
+ templateReference: {
592
+ ...templateReference,
593
+ parameters: calculationTemplateParameters(templateReference.parameters),
594
+ },
595
+ };
596
+ calculations.push({
597
+ ...(c.id !== undefined ? { id: c.id } : {}),
598
+ name: c.name,
599
+ recordId: c.record !== undefined ? serializeValueOrRef(c.record) : null,
600
+ calculationReference: wireCalculationReference,
601
+ includeTypes: [],
602
+ });
603
+ }
604
+ return {
605
+ key: "calculation",
606
+ config: { calculations },
607
+ };
608
+ }
609
+ export function approvalStatusUpdate(opts) {
610
+ return {
611
+ key: "approvalStatusUpdate",
612
+ config: {
613
+ approvalChainTemplateId: opts.approvalChainTemplateId,
614
+ recordId: serializeValueOrRef(opts.record),
615
+ status: opts.status,
616
+ ...(opts.reason !== undefined ? { reason: serializeValueOrRef(opts.reason) } : {}),
617
+ ...(opts.tags !== undefined ? { tags: serializeValueOrRef(opts.tags) } : {}),
618
+ },
619
+ };
620
+ }
621
+ export function runAutomation(opts) {
622
+ const hasInputs = (opts.inputs?.length ?? 0) > 0;
623
+ const common = {
624
+ synchronous: opts.synchronous ?? false,
625
+ inputMappings: [],
626
+ dynamicInputMappings: hasInputs
627
+ ? opts.inputs.map((i) => ({ name: i.name, value: serializeValueOrRef(i.value) }))
628
+ : [],
629
+ outputMappings: (opts.outputs ?? []).map((name) => ({ name })),
630
+ };
631
+ return {
632
+ key: "runAutomation",
633
+ config: hasInputs
634
+ ? { targetAutomationRef: { type: "STATIC", value: opts.automation }, ...common }
635
+ : { targetAutomationId: opts.automation, ...common },
636
+ };
637
+ }
638
+ export function readFile(opts) {
639
+ return {
640
+ key: "documentModel",
641
+ config: {
642
+ documentModelId: opts.fileReader,
643
+ ...(opts.record !== undefined ? { recordId: serializeValueOrRef(opts.record) } : {}),
644
+ documentModelDataSource: { [opts.dataSource.type]: serializeValueOrRef(opts.dataSource.value) },
645
+ },
646
+ };
647
+ }
648
+ export function bulkExcel(opts) {
649
+ if (opts.fieldMappings.length === 0)
650
+ throw new Error("bulkExcel requires at least one fieldMapping.");
651
+ return {
652
+ key: "bulkExcel",
653
+ config: {
654
+ attachmentId: serializeValueOrRef(opts.attachmentId),
655
+ documentModelId: opts.documentModel,
656
+ aspectId: opts.app,
657
+ aspectType: opts.aspectType,
658
+ ...(opts.strict !== undefined ? { strict: opts.strict } : {}),
659
+ fieldMappings: opts.fieldMappings.map((m) => ({
660
+ aspectFieldId: m.field,
661
+ fieldMappingInput: m.source.type === "documentModelField"
662
+ ? { documentModelFieldId: m.source.field }
663
+ : { valueReference: serializeValueOrRef(m.source.value) },
664
+ })),
665
+ },
666
+ };
667
+ }
668
+ export function approvalChain(opts) {
669
+ if (!opts.approverIds?.length && !opts.approvers?.length) {
670
+ throw new Error("approvalChain requires at least one approverId or approver.");
671
+ }
672
+ return {
673
+ key: "approvalChain",
674
+ config: {
675
+ ...(opts.approverIds !== undefined ? { approverIds: opts.approverIds } : {}),
676
+ ...(opts.approvers !== undefined ? { approvers: opts.approvers.map((a) => serializeValueOrRef(a)) } : {}),
677
+ ...(opts.reason !== undefined ? { reason: serializeValueOrRef(opts.reason) } : {}),
678
+ ...(opts.summary !== undefined ? { summary: serializeValueOrRef(opts.summary) } : {}),
679
+ },
680
+ };
681
+ }
682
+ export function approvalChainTemplate(opts) {
683
+ return {
684
+ key: "approvalChainTemplate",
685
+ config: {
686
+ approvalChainTemplateId: opts.approvalChainTemplateId,
687
+ requesterId: serializeValueOrRef(opts.requester),
688
+ recordId: serializeValueOrRef(opts.record),
689
+ ...(opts.summary !== undefined ? { summary: serializeValueOrRef(opts.summary) } : {}),
690
+ ...(opts.reason !== undefined ? { reason: serializeValueOrRef(opts.reason) } : {}),
691
+ ...(opts.relatedRecord !== undefined ? { relatedRecordId: serializeValueOrRef(opts.relatedRecord) } : {}),
692
+ ...(opts.tags !== undefined ? { tags: serializeValueOrRef(opts.tags) } : {}),
693
+ ...(opts.dynamicApprovers !== undefined ? { dynamicApprovers: opts.dynamicApprovers } : {}),
694
+ },
695
+ };
696
+ }
697
+ export function sendSurvey(opts) {
698
+ if (!opts.userIds?.length && !opts.groupIds?.length) {
699
+ throw new Error("sendSurvey requires at least one recipient (userIds or groupIds).");
700
+ }
701
+ return {
702
+ key: "sendSurvey",
703
+ config: {
704
+ recordId: serializeValueOrRef(opts.record),
705
+ surveyTemplateId: serializeValueOrRef(opts.surveyTemplateId),
706
+ expirationDate: serializeValueOrRef(opts.expirationDate),
707
+ dueDate: serializeValueOrRef(opts.dueDate),
708
+ reminderDate: serializeValueOrRef(opts.reminderDate),
709
+ emailSubject: serializeValueOrRef(opts.emailSubject),
710
+ instructions: serializeValueOrRef(opts.instructions),
711
+ ...(opts.attachmentIds !== undefined ? { attachmentIds: refList(opts.attachmentIds) } : {}),
712
+ ...(opts.userIds !== undefined ? { userIds: refList(opts.userIds) } : {}),
713
+ ...(opts.groupIds !== undefined ? { groupIds: refList(opts.groupIds) } : {}),
714
+ },
715
+ };
716
+ }
717
+ function serializeFirstEmail(fe) {
718
+ return {
719
+ ...(fe.context !== undefined ? { context: serializeValueOrRef(fe.context) } : {}),
720
+ ...(fe.contextEvaluationInstructions !== undefined
721
+ ? { contextEvaluationInstructions: serializeValueOrRef(fe.contextEvaluationInstructions) }
722
+ : {}),
723
+ firstMessage: {
724
+ ...(fe.firstMessage.firstEmailMessage !== undefined
725
+ ? { firstEmailMessage: serializeValueOrRef(fe.firstMessage.firstEmailMessage) }
726
+ : {}),
727
+ ...(fe.firstMessage.firstEmailMessageGenerationInstructions !== undefined
728
+ ? {
729
+ firstEmailMessageGenerationInstructions: serializeValueOrRef(fe.firstMessage.firstEmailMessageGenerationInstructions),
730
+ }
731
+ : {}),
732
+ },
733
+ };
734
+ }
735
+ export function initiateEmailConversation(opts) {
736
+ return {
737
+ key: "initiateEmailConversation",
738
+ config: {
739
+ agentId: opts.agent,
740
+ emailAliasId: opts.emailAliasId,
741
+ emailAddress: serializeValueOrRef(opts.emailAddress),
742
+ ...(opts.emailName !== undefined ? { emailName: serializeValueOrRef(opts.emailName) } : {}),
743
+ recordId: serializeValueOrRef(opts.record),
744
+ ...(opts.subjectGenerationInstructions !== undefined
745
+ ? { subjectGenerationInstructions: serializeValueOrRef(opts.subjectGenerationInstructions) }
746
+ : {}),
747
+ ...(opts.inactivityDeadline !== undefined ? { inactivityDeadline: opts.inactivityDeadline } : {}),
748
+ ...(opts.firstEmail !== undefined ? { firstEmail: serializeFirstEmail(opts.firstEmail) } : {}),
749
+ ...(opts.emailAddressFieldId !== undefined
750
+ ? { emailAddressFieldId: serializeValueOrRef(opts.emailAddressFieldId) }
751
+ : {}),
752
+ ...(opts.emailNameFieldId !== undefined
753
+ ? { emailNameFieldId: serializeValueOrRef(opts.emailNameFieldId) }
754
+ : {}),
755
+ ...(opts.summaryFieldId !== undefined ? { summaryFieldId: serializeValueOrRef(opts.summaryFieldId) } : {}),
756
+ ...(opts.summaryPrompt !== undefined ? { summaryPrompt: serializeValueOrRef(opts.summaryPrompt) } : {}),
757
+ ...(opts.evaluationFieldId !== undefined
758
+ ? { evaluationFieldId: serializeValueOrRef(opts.evaluationFieldId) }
759
+ : {}),
760
+ ...(opts.evaluationPrompt !== undefined
761
+ ? { evaluationPrompt: serializeValueOrRef(opts.evaluationPrompt) }
762
+ : {}),
763
+ },
764
+ };
765
+ }