@elementumai/edk 0.8.2-alpha.6 → 0.9.2

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 (372) hide show
  1. package/README.md +18 -14
  2. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +3 -3
  3. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +1 -1
  4. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +3 -11
  5. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +2 -10
  6. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
  7. package/dist-sdk/fs/entity.d.ts +2 -2
  8. package/dist-sdk/fs/entity.js +1 -1
  9. package/dist-sdk/pull/missing-report.d.ts +81 -0
  10. package/dist-sdk/pull/missing-report.js +52 -0
  11. package/dist-sdk/src/catalog/factories.d.ts +53 -19
  12. package/dist-sdk/src/catalog/factories.js +51 -12
  13. package/dist-sdk/src/catalog/from-authoring.js +13 -3
  14. package/dist-sdk/src/catalog/index.d.ts +2 -2
  15. package/dist-sdk/src/catalog/index.js +1 -1
  16. package/dist-sdk/src/catalog/org.js +1 -0
  17. package/dist-sdk/src/catalog/render.js +6 -0
  18. package/dist-sdk/src/catalog/token.js +7 -0
  19. package/dist-sdk/src/catalog/types.d.ts +34 -23
  20. package/dist-sdk/src/catalog/types.js +7 -4
  21. package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
  22. package/dist-sdk/src/core/app-to-ui.js +7 -9
  23. package/dist-sdk/src/core/index.d.ts +1 -0
  24. package/dist-sdk/src/core/index.js +1 -0
  25. package/dist-sdk/src/core/platform-id.d.ts +11 -0
  26. package/dist-sdk/src/core/platform-id.js +8 -0
  27. package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +2 -2
  28. package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +6 -8
  29. package/dist-sdk/src/core/types/app.d.ts +13 -23
  30. package/dist-sdk/src/core/types/app.js +0 -1
  31. package/dist-sdk/src/engine/build/context.d.ts +3 -3
  32. package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
  33. package/dist-sdk/src/engine/pull/attrs.js +17 -0
  34. package/dist-sdk/src/engine/pull/context.d.ts +39 -0
  35. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  36. package/dist-sdk/src/engine/pull/org.js +2 -0
  37. package/dist-sdk/src/engine/tf/expr.d.ts +1 -1
  38. package/dist-sdk/src/engine/tf/expr.js +10 -3
  39. package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
  40. package/dist-sdk/src/entities/access-policy/build.d.ts +4 -13
  41. package/dist-sdk/src/entities/access-policy/build.js +1 -1
  42. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +12 -38
  43. package/dist-sdk/src/entities/access-policy/from-tf.js +16 -74
  44. package/dist-sdk/src/entities/access-policy/principal.d.ts +29 -0
  45. package/dist-sdk/src/entities/access-policy/principal.js +13 -0
  46. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +20 -5
  47. package/dist-sdk/src/entities/access-policy/to-tf.js +26 -54
  48. package/dist-sdk/src/entities/agent/build.d.ts +39 -8
  49. package/dist-sdk/src/entities/agent/build.js +36 -15
  50. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +5 -0
  51. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +121 -36
  52. package/dist-sdk/src/entities/agent/from-tf.js +5 -8
  53. package/dist-sdk/src/entities/agent/index.d.ts +5 -2
  54. package/dist-sdk/src/entities/agent/index.js +4 -2
  55. package/dist-sdk/src/entities/agent/module.js +5 -2
  56. package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
  57. package/dist-sdk/src/entities/agent/run-as.js +1 -0
  58. package/dist-sdk/src/entities/agent/to-tf.d.ts +2 -1
  59. package/dist-sdk/src/entities/agent/to-tf.js +2 -1
  60. package/dist-sdk/src/entities/agent/tools.d.ts +60 -48
  61. package/dist-sdk/src/entities/agent/tools.js +44 -38
  62. package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
  63. package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
  64. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +17 -8
  65. package/dist-sdk/src/entities/agent-tool/from-tf.js +127 -37
  66. package/dist-sdk/src/entities/agent-tool/module.js +6 -0
  67. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +5 -5
  68. package/dist-sdk/src/entities/agent-tool/to-tf.js +93 -20
  69. package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -5
  70. package/dist-sdk/src/entities/agent-tool/types.js +36 -8
  71. package/dist-sdk/src/entities/app/build.d.ts +137 -25
  72. package/dist-sdk/src/entities/app/build.js +104 -53
  73. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +173 -1
  74. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
  75. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +68 -0
  76. package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
  77. package/dist-sdk/src/entities/app/display-blocks.js +1 -1
  78. package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
  79. package/dist-sdk/src/entities/app/from-tf.js +30 -2
  80. package/dist-sdk/src/entities/app/index.d.ts +13 -4
  81. package/dist-sdk/src/entities/app/index.js +8 -1
  82. package/dist-sdk/src/entities/app/module.js +27 -2
  83. package/dist-sdk/src/entities/app/to-tf.js +75 -1
  84. package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
  85. package/dist-sdk/src/entities/approval-chain/build.js +49 -49
  86. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
  87. package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
  88. package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
  89. package/dist-sdk/src/entities/approval-chain/index.js +2 -3
  90. package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
  91. package/dist-sdk/src/entities/approval-chain/module.js +51 -0
  92. package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
  93. package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
  94. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
  95. package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
  96. package/dist-sdk/src/entities/automation/build.d.ts +10 -6
  97. package/dist-sdk/src/entities/automation/build.js +5 -4
  98. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +10 -8
  99. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +51 -114
  100. package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
  101. package/dist-sdk/src/entities/automation/filter.js +1 -197
  102. package/dist-sdk/src/entities/automation/from-tf.d.ts +4 -0
  103. package/dist-sdk/src/entities/automation/from-tf.js +202 -119
  104. package/dist-sdk/src/entities/automation/index.d.ts +4 -2
  105. package/dist-sdk/src/entities/automation/index.js +3 -1
  106. package/dist-sdk/src/entities/automation/module.js +10 -4
  107. package/dist-sdk/src/entities/automation/script-code.js +94 -6
  108. package/dist-sdk/src/entities/automation/tasks.d.ts +20 -19
  109. package/dist-sdk/src/entities/automation/tasks.js +2 -2
  110. package/dist-sdk/src/entities/automation/to-tf.d.ts +34 -2
  111. package/dist-sdk/src/entities/automation/to-tf.js +273 -98
  112. package/dist-sdk/src/entities/automation/triggers.d.ts +18 -17
  113. package/dist-sdk/src/entities/automation/triggers.js +1 -1
  114. package/dist-sdk/src/entities/dashboard/build.d.ts +17 -0
  115. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
  116. package/dist-sdk/src/entities/dashboard/from-tf.js +95 -0
  117. package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
  118. package/dist-sdk/src/entities/dashboard/module.js +16 -0
  119. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +30 -0
  120. package/dist-sdk/src/entities/dashboard/to-tf.js +94 -0
  121. package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
  122. package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
  123. package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
  124. package/dist-sdk/src/entities/data-lookup/module.js +22 -0
  125. package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
  126. package/dist-sdk/src/entities/datamine/build.js +1 -0
  127. package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
  128. package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
  129. package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
  130. package/dist-sdk/src/entities/datamine/module.js +23 -0
  131. package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
  132. package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
  133. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +303 -0
  134. package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
  135. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
  136. package/dist-sdk/src/entities/dynamic-layout/dialect.js +9 -0
  137. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
  138. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +233 -0
  139. package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
  140. package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
  141. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
  142. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
  143. package/dist-sdk/src/entities/element/build.d.ts +31 -14
  144. package/dist-sdk/src/entities/element/build.js +12 -4
  145. package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
  146. package/dist-sdk/src/entities/element/from-tf.js +31 -2
  147. package/dist-sdk/src/entities/element/index.d.ts +8 -3
  148. package/dist-sdk/src/entities/element/index.js +4 -1
  149. package/dist-sdk/src/entities/element/module.js +19 -2
  150. package/dist-sdk/src/entities/element/to-tf.js +57 -1
  151. package/dist-sdk/src/entities/field/build.d.ts +4 -3
  152. package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
  153. package/dist-sdk/src/entities/field/calculation-types.js +42 -0
  154. package/dist-sdk/src/entities/field/from-tf.js +90 -11
  155. package/dist-sdk/src/entities/field/module.d.ts +1 -0
  156. package/dist-sdk/src/entities/field/module.js +5 -2
  157. package/dist-sdk/src/entities/field/record-shape.d.ts +1 -1
  158. package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
  159. package/dist-sdk/src/entities/field/to-tf.js +22 -6
  160. package/dist-sdk/src/entities/field/types.js +3 -0
  161. package/dist-sdk/src/entities/file-reader/build.d.ts +66 -19
  162. package/dist-sdk/src/entities/file-reader/build.js +49 -4
  163. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
  164. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +11 -9
  165. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
  166. package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
  167. package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
  168. package/dist-sdk/src/entities/file-reader/index.js +3 -3
  169. package/dist-sdk/src/entities/file-reader/module.js +6 -5
  170. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
  171. package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
  172. package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
  173. package/dist-sdk/src/entities/file-reader/types.js +4 -5
  174. package/dist-sdk/src/entities/org/category.js +4 -5
  175. package/dist-sdk/src/entities/org/group.js +4 -5
  176. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  177. package/dist-sdk/src/entities/org/index.js +1 -0
  178. package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
  179. package/dist-sdk/src/entities/org/phone-provider.js +33 -0
  180. package/dist-sdk/src/entities/org/role.d.ts +3 -3
  181. package/dist-sdk/src/entities/org/role.js +9 -6
  182. package/dist-sdk/src/entities/organization/build.d.ts +29 -0
  183. package/dist-sdk/src/entities/organization/build.js +24 -0
  184. package/dist-sdk/src/entities/organization/index.d.ts +2 -0
  185. package/dist-sdk/src/entities/organization/index.js +2 -0
  186. package/dist-sdk/src/entities/organization/module.d.ts +2 -0
  187. package/dist-sdk/src/entities/organization/module.js +18 -0
  188. package/dist-sdk/src/entities/organization/to-tf.d.ts +6 -0
  189. package/dist-sdk/src/entities/organization/to-tf.js +37 -0
  190. package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
  191. package/dist-sdk/src/entities/phone-service/build.js +31 -0
  192. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
  193. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +54 -0
  194. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
  195. package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
  196. package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
  197. package/dist-sdk/src/entities/phone-service/index.js +2 -0
  198. package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
  199. package/dist-sdk/src/entities/phone-service/module.js +55 -0
  200. package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
  201. package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
  202. package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
  203. package/dist-sdk/src/entities/phone-service/types.js +22 -0
  204. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
  205. package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
  206. package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
  207. package/dist-sdk/src/entities/record-create-form/module.js +24 -0
  208. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
  209. package/dist-sdk/src/entities/record-create-form/to-tf.js +80 -0
  210. package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
  211. package/dist-sdk/src/entities/relationship/build.js +1 -0
  212. package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
  213. package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
  214. package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
  215. package/dist-sdk/src/entities/relationship/module.js +16 -0
  216. package/dist-sdk/src/entities/relationship/to-tf.d.ts +31 -0
  217. package/dist-sdk/src/entities/relationship/to-tf.js +153 -0
  218. package/dist-sdk/src/entities/role/build.d.ts +65 -0
  219. package/dist-sdk/src/entities/role/build.js +33 -0
  220. package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
  221. package/dist-sdk/src/entities/role/from-tf.js +138 -0
  222. package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
  223. package/dist-sdk/src/entities/role/to-tf.js +69 -0
  224. package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
  225. package/dist-sdk/src/entities/search-table/build.js +110 -56
  226. package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
  227. package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
  228. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  229. package/dist-sdk/src/entities/search-table/index.js +2 -2
  230. package/dist-sdk/src/entities/search-table/module.js +88 -10
  231. package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
  232. package/dist-sdk/src/entities/search-table/printer.js +52 -0
  233. package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
  234. package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
  235. package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
  236. package/dist-sdk/src/entities/search-table/types.js +21 -0
  237. package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
  238. package/dist-sdk/src/entities/service-account/build.js +9 -0
  239. package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
  240. package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
  241. package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
  242. package/dist-sdk/src/entities/service-account/module.js +21 -0
  243. package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
  244. package/dist-sdk/src/entities/service-account/ref.js +5 -0
  245. package/dist-sdk/src/entities/service-account/to-tf.d.ts +11 -0
  246. package/dist-sdk/src/entities/service-account/to-tf.js +72 -0
  247. package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
  248. package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
  249. package/dist-sdk/src/entities/shared/filters/ast.d.ts +21 -79
  250. package/dist-sdk/src/entities/shared/filters/ast.js +5 -2
  251. package/dist-sdk/src/entities/shared/filters/index.d.ts +94 -206
  252. package/dist-sdk/src/entities/shared/filters/index.js +189 -341
  253. package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
  254. package/dist-sdk/src/entities/shared/filters/print.js +122 -0
  255. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
  256. package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
  257. package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
  258. package/dist-sdk/src/entities/shared/filters/types.js +2 -3
  259. package/dist-sdk/src/entities/skill/build.d.ts +2 -2
  260. package/dist-sdk/src/entities/skill/build.js +4 -3
  261. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +10 -0
  262. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +74 -32
  263. package/dist-sdk/src/entities/skill/index.d.ts +2 -1
  264. package/dist-sdk/src/entities/skill/index.js +2 -1
  265. package/dist-sdk/src/entities/skill/module.js +6 -0
  266. package/dist-sdk/src/entities/skill/to-tf.d.ts +5 -1
  267. package/dist-sdk/src/entities/skill/to-tf.js +18 -0
  268. package/dist-sdk/src/entities/skill/tools.d.ts +46 -31
  269. package/dist-sdk/src/entities/skill/tools.js +33 -20
  270. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +4 -1
  271. package/dist-sdk/src/entities/skill-tool/from-tf.js +76 -8
  272. package/dist-sdk/src/entities/skill-tool/module.js +9 -0
  273. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  274. package/dist-sdk/src/entities/skill-tool/to-tf.js +94 -42
  275. package/dist-sdk/src/entities/skill-tool/types.js +18 -1
  276. package/dist-sdk/src/entities/table/build.d.ts +64 -23
  277. package/dist-sdk/src/entities/table/build.js +33 -18
  278. package/dist-sdk/src/entities/table/catalog-render.js +6 -0
  279. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
  280. package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
  281. package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
  282. package/dist-sdk/src/entities/table/fields/types.js +12 -0
  283. package/dist-sdk/src/entities/table/fields.d.ts +107 -47
  284. package/dist-sdk/src/entities/table/fields.js +76 -55
  285. package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
  286. package/dist-sdk/src/entities/table/from-tf.js +261 -0
  287. package/dist-sdk/src/entities/table/index.d.ts +7 -5
  288. package/dist-sdk/src/entities/table/index.js +7 -7
  289. package/dist-sdk/src/entities/table/joins.d.ts +22 -9
  290. package/dist-sdk/src/entities/table/joins.js +8 -16
  291. package/dist-sdk/src/entities/table/module.d.ts +2 -1
  292. package/dist-sdk/src/entities/table/module.js +13 -6
  293. package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
  294. package/dist-sdk/src/entities/table/to-tf.js +230 -0
  295. package/dist-sdk/src/entities/task/build.d.ts +43 -0
  296. package/dist-sdk/src/entities/task/build.js +17 -0
  297. package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
  298. package/dist-sdk/src/entities/task/from-tf.js +38 -0
  299. package/dist-sdk/src/entities/task/index.d.ts +1 -0
  300. package/dist-sdk/src/entities/task/index.js +1 -0
  301. package/dist-sdk/src/entities/task/module.d.ts +3 -0
  302. package/dist-sdk/src/entities/task/module.js +12 -0
  303. package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
  304. package/dist-sdk/src/entities/task/to-tf.js +49 -0
  305. package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
  306. package/dist-sdk/src/entities/view/from-tf.js +209 -25
  307. package/dist-sdk/src/entities/view/module.js +5 -1
  308. package/dist-sdk/src/entities/view/to-tf.d.ts +49 -7
  309. package/dist-sdk/src/entities/view/to-tf.js +155 -18
  310. package/dist-sdk/src/entities/view/types.d.ts +8 -0
  311. package/dist-sdk/src/entities/view/types.js +43 -0
  312. package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
  313. package/dist-sdk/src/entities/visual-flow/build.js +72 -0
  314. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
  315. package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
  316. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
  317. package/dist-sdk/src/entities/visual-flow/index.js +1 -0
  318. package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
  319. package/dist-sdk/src/entities/visual-flow/module.js +41 -0
  320. package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
  321. package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
  322. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +14 -0
  323. package/dist-sdk/src/entities/visual-flow/to-tf.js +101 -0
  324. package/dist-sdk/src/entities/widget/build.d.ts +55 -0
  325. package/dist-sdk/src/entities/widget/build.js +1 -0
  326. package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
  327. package/dist-sdk/src/entities/widget/from-tf.js +209 -0
  328. package/dist-sdk/src/entities/widget/module.d.ts +3 -0
  329. package/dist-sdk/src/entities/widget/module.js +16 -0
  330. package/dist-sdk/src/entities/widget/to-tf.d.ts +44 -0
  331. package/dist-sdk/src/entities/widget/to-tf.js +204 -0
  332. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
  333. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
  334. package/dist-sdk/src/graph/index.d.ts +7 -0
  335. package/dist-sdk/src/graph/index.js +4 -18
  336. package/dist-sdk/src/graph/modules.js +30 -1
  337. package/dist-sdk/src/graph/types.d.ts +55 -7
  338. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  339. package/dist-sdk/src/internal/sdk-package.js +4 -2
  340. package/package.json +30 -15
  341. package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
  342. package/dist-sdk/src/entities/access-policy/filter.js +0 -83
  343. package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
  344. package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
  345. package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
  346. package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
  347. package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
  348. package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
  349. package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
  350. package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
  351. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
  352. package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
  353. package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
  354. package/dist-sdk/src/entities/flow/activities/form.js +0 -36
  355. package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
  356. package/dist-sdk/src/entities/flow/activities/index.js +0 -13
  357. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
  358. package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
  359. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
  360. package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
  361. package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
  362. package/dist-sdk/src/entities/flow/build.d.ts +0 -38
  363. package/dist-sdk/src/entities/flow/build.js +0 -115
  364. package/dist-sdk/src/entities/flow/index.d.ts +0 -8
  365. package/dist-sdk/src/entities/flow/index.js +0 -7
  366. package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
  367. package/dist-sdk/src/entities/flow/serialize.js +0 -94
  368. package/dist-sdk/src/entities/flow/util.d.ts +0 -27
  369. package/dist-sdk/src/entities/flow/util.js +0 -38
  370. package/dist-sdk/src/entities/table/filter.d.ts +0 -41
  371. package/dist-sdk/src/entities/table/filter.js +0 -89
  372. /package/dist-sdk/src/entities/{flow/activities/types.js → dashboard/build.js} +0 -0
@@ -4,6 +4,8 @@ import { USER_FIELD_KEYS } from "../../catalog/types.js";
4
4
  import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS } from "../../core/system-fields.js";
5
5
  import { bareChildResourceLabel, childPartFromScopedLabel, isTfExpr, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
6
6
  import { IMPLEMENTED_FILE_READER_RESOURCE_TYPES } from "../file-reader/types.js";
7
+ import { connectorIdentityFromTf } from "../shared/connector-from-tf.js";
8
+ import { filterFromTf as deserializeFilterFromTf } from "../shared/filters/tf-codec.js";
7
9
  import { ALL_AUTOMATION_TASK_TYPE_SET, AUTOMATION_BRANCH_TYPE_SET, AUTOMATION_RESOURCE_TYPE, AUTOMATION_TRIGGER_TYPE_SET, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
8
10
  const TRIGGER_KINDS = {
9
11
  elementum_record_created_trigger: "recordCreate",
@@ -77,6 +79,7 @@ const ATTR_TO_ARG = {
77
79
  response_type: "responseType",
78
80
  continue_on_error: "continueOnError",
79
81
  search_table_id: "table",
82
+ phone_service_id: "phoneService",
80
83
  text_to_summarize: "text",
81
84
  text_to_classify: "text",
82
85
  field_type: "fieldType",
@@ -168,6 +171,7 @@ const TASK_ATTRIBUTES = new Set([
168
171
  "synchronous", "cloudlink_id", "stored_function_id", "variable_reference",
169
172
  "relate_to_record_reference", "method", "parameters", "headers",
170
173
  "basic_auth", "bearer_auth", "oauth", "json_body", "form_body", "custom_body", "multipart_body",
174
+ "query",
171
175
  ]);
172
176
  const BRANCH_ATTRIBUTES = new Set([
173
177
  "switch_task", "fork_join_task", "label", "is_default", "filter",
@@ -385,17 +389,21 @@ function fieldKeyFromTriggerFieldIdExpr(fieldPart, ctx) {
385
389
  }
386
390
  /** Same provider/model derivation as `agentFromTf` and `renderAiProvidersBag`, read off the stream's own data blocks. */
387
391
  function resolveConnectorRef(connectorType, connectorLabel, ctx) {
388
- const connectorBlock = ctx.dataBlocks.get(`${connectorType}.${connectorLabel}`);
389
- const modelName = connectorBlock?.attrs["model_name"];
390
- const handle = typeof modelName === "string" ? tfLabelToTsLabel(sanitizeName(modelName)) : tfLabelToTsLabel(connectorLabel);
391
- const providerIdAttr = connectorBlock?.attrs["provider_id"];
392
- if (providerIdAttr === undefined || !isTfExpr(providerIdAttr) || providerIdAttr.$expr !== "data-attr")
393
- return { handle };
394
- const providerBlock = ctx.dataBlocks.get(`${providerIdAttr.type}.${providerIdAttr.label}`);
395
- const providerName = providerBlock?.attrs["name"];
396
- if (typeof providerName !== "string")
397
- return { handle };
398
- return { handle, providerKey: tfLabelToTsLabel(sanitizeName(providerName)) };
392
+ const identity = connectorIdentityFromTf(connectorType, connectorLabel, {
393
+ dataName: (type, label) => {
394
+ const block = ctx.dataBlocks.get(`${type}.${label}`);
395
+ const key = type === "elementum_ai_provider_connector" ? "model_name" : "name";
396
+ const value = block?.attrs[key];
397
+ return typeof value === "string" ? value : undefined;
398
+ },
399
+ dataRef: (type, label) => {
400
+ const value = ctx.dataBlocks.get(`${type}.${label}`)?.attrs["provider_id"];
401
+ return value !== undefined && isTfExpr(value) && value.$expr === "data-attr"
402
+ ? { resourceType: value.type, tfLabel: value.label }
403
+ : undefined;
404
+ },
405
+ });
406
+ return { handle: identity.handle, ...(identity.providerKey !== undefined && { providerKey: identity.providerKey }) };
399
407
  }
400
408
  function decodeValue(value, ctx) {
401
409
  if (isTfExpr(value)) {
@@ -405,10 +413,20 @@ function decodeValue(value, ctx) {
405
413
  if (value.$expr === "jsonencode")
406
414
  return decodePlain(value.value, ctx);
407
415
  if (value.$expr === "resource-attr") {
416
+ const optionLabel = picklistOptionLabel(value);
417
+ if (optionLabel !== undefined)
418
+ return { kind: "literal", value: optionLabel };
408
419
  if (value.type === ctx.trigger.type && value.label === ctx.trigger.label && value.path[0] === "refs") {
409
420
  return { kind: "triggerRef", path: triggerRefPath(value.path.slice(1), ctx) };
410
421
  }
411
422
  const task = ctx.taskByAddress.get(`${value.type}.${value.label}`);
423
+ if (task !== undefined && value.path[0] === "inner" && value.path[1] === "refs") {
424
+ return {
425
+ kind: "forEachItemRef",
426
+ forEachTask: task.refKey,
427
+ path: pathNames(value.path.slice(2)).flatMap((segment) => segment.split(".")),
428
+ };
429
+ }
412
430
  if (task !== undefined && value.path[0] === "refs") {
413
431
  const rawSegments = pathNames(value.path.slice(1));
414
432
  if (task.block.type === "elementum_record_search_task" && rawSegments.length === 1 && rawSegments[0] === "First found record id") {
@@ -466,6 +484,28 @@ function decodeValue(value, ctx) {
466
484
  if (value.type === "elementum_agent" && value.path[0] === "id") {
467
485
  return { kind: "agent", appHandle: ctx.appRefName, agentKey: scopedLabelToBagKey(ctx.appTfLabel, value.label), name: value.label };
468
486
  }
487
+ if (value.type === "elementum_phone_service" && value.path[0] === "id") {
488
+ return {
489
+ kind: "phoneService",
490
+ appHandle: ctx.appRefName,
491
+ phoneServiceKey: scopedLabelToBagKey(ctx.appTfLabel, value.label),
492
+ };
493
+ }
494
+ if (value.type === "elementum_datamine" && value.path[0] === "id") {
495
+ const datamineBlock = ctx.resourceBlocks.get(`elementum_datamine.${value.label}`);
496
+ const tableId = datamineBlock?.attrs["table_id"];
497
+ const tableLabel = tableId !== undefined && isTfExpr(tableId) && tableId.$expr === "resource-attr" && tableId.type === "elementum_table" && tableId.path[0] === "id"
498
+ ? tableId.label
499
+ : undefined;
500
+ if (tableLabel === undefined)
501
+ throw new EntityTfError(`elementum_datamine.${value.label}: table_id is not a managed table reference`);
502
+ const prefix = `${tableLabel}_`;
503
+ return {
504
+ kind: "datamine",
505
+ tableHandle: tfLabelToTsLabel(tableLabel),
506
+ datamineKey: tfLabelToTsLabel(value.label.startsWith(prefix) ? value.label.slice(prefix.length) : value.label),
507
+ };
508
+ }
469
509
  // IMPLEMENTED only, not ALL: a readFile task can reference an
470
510
  // unimplemented reader type (ai/xml) - fileReaderFromTf correctly
471
511
  // excludes those from extraction (no catalog entry is ever printed for
@@ -548,18 +588,29 @@ function decodeValue(value, ctx) {
548
588
  ...(typeof name === "string" ? { name } : {}),
549
589
  };
550
590
  }
591
+ if (value.$expr === "data-attr" && value.type === "elementum_user" && value.path[0] === "id") {
592
+ const lookup = ctx.dataBlocks.get(`${value.type}.${value.label}`);
593
+ const email = lookup?.attrs.email;
594
+ if (typeof email !== "string" || email === "") {
595
+ throw new EntityTfError(`data.elementum_user.${value.label}: email lookup is missing`);
596
+ }
597
+ return { kind: "user", email };
598
+ }
551
599
  if (value.$expr === "local") {
600
+ const stageName = stageFilterName(value, ctx);
601
+ if (stageName !== undefined)
602
+ return { kind: "literal", value: stageName };
552
603
  const prefix = `${ctx.appTfLabel}_`;
553
604
  if (value.name.startsWith(prefix) && value.name.endsWith("_field_id")) {
554
605
  return { kind: "field", appHandle: ctx.appRefName, fieldKey: tfLabelToTsLabel(value.name.slice(prefix.length, -9)) };
555
606
  }
556
- // Outside filter values, preserve option lookups as an explicit local
557
- // reference. Filters intentionally collapse the same expression to its
558
- // readable label in filterValue(); task field assignments must retain
559
- // the exact lookup so build reproduces the exported HCL.
560
- if (picklistOptionLabel(value) !== undefined) {
561
- return { kind: "localRef", localName: value.name, path: value.path };
562
- }
607
+ // Task field assignments have their field token alongside the value.
608
+ // Preserve public authoring as the readable option label; automation
609
+ // build validates that label against field metadata and reconstructs
610
+ // the exact options-by-label local expression.
611
+ const optionLabel = picklistOptionLabel(value);
612
+ if (optionLabel !== undefined)
613
+ return { kind: "literal", value: optionLabel };
563
614
  throw new EntityTfError(`unreconstructable local reference local.${value.name}`);
564
615
  }
565
616
  throw new EntityTfError(`unsupported expression kind "${value.$expr}" in automation`);
@@ -571,14 +622,18 @@ function decodeValue(value, ctx) {
571
622
  return { kind: "literal", value };
572
623
  }
573
624
  function decodePlain(value, ctx) {
574
- const decoded = decodeValue(value, ctx);
575
- if (isObject(decoded) && typeof decoded.kind === "string")
625
+ const unwrap = (decoded) => {
626
+ if (isObject(decoded) && decoded.kind === "literal")
627
+ return decoded.value;
628
+ if (isObject(decoded) && typeof decoded.kind === "string")
629
+ return decoded;
630
+ if (Array.isArray(decoded))
631
+ return decoded.map(unwrap);
632
+ if (isObject(decoded))
633
+ return Object.fromEntries(Object.entries(decoded).map(([key, child]) => [key, unwrap(child)]));
576
634
  return decoded;
577
- if (Array.isArray(decoded))
578
- return decoded;
579
- if (isObject(decoded))
580
- return Object.fromEntries(Object.entries(decoded).map(([key, child]) => [key, decodePlain(child, ctx)]));
581
- return decoded;
635
+ };
636
+ return unwrap(decodeValue(value, ctx));
582
637
  }
583
638
  function decodeCustomResponse(value, ctx) {
584
639
  if (!isObject(value))
@@ -612,8 +667,13 @@ function fieldRef(value, ctx) {
612
667
  const decoded = decodeValue(value, ctx);
613
668
  if (isObject(decoded) && decoded.kind === "field")
614
669
  return decoded;
615
- if (typeof value === "string")
670
+ if (typeof value === "string") {
671
+ const foreign = ctx.foreignFieldRefsById?.get(value);
672
+ if (foreign !== undefined) {
673
+ return { kind: "field", appHandle: foreign.ownerRefName, fieldKey: foreign.fieldKey };
674
+ }
616
675
  return { kind: "unresolved", uuid: value, hint: "field" };
676
+ }
617
677
  throw new EntityTfError("field reference cannot be reconstructed");
618
678
  }
619
679
  const USER_FIELD_KEY_SET = new Set(USER_FIELD_KEYS);
@@ -624,10 +684,15 @@ function userFieldRef(value, ctx) {
624
684
  return fieldRef(value, ctx);
625
685
  }
626
686
  function picklistOptionLabel(value) {
627
- if (value === undefined || !isTfExpr(value) || value.$expr !== "local" || value.path.length !== 1)
687
+ if (value === undefined || !isTfExpr(value))
628
688
  return undefined;
629
- const segment = value.path[0];
630
- const isOptionsLookup = value.name.endsWith("_options_by_label") || value.name.endsWith("_option_ids_by_label");
689
+ const lookup = value.$expr === "local"
690
+ ? value.name
691
+ : value.$expr === "resource-attr" && value.path.length === 2 && typeof value.path[0] === "string"
692
+ ? value.path[0]
693
+ : undefined;
694
+ const segment = value.$expr === "local" ? value.path[0] : value.$expr === "resource-attr" ? value.path[1] : undefined;
695
+ const isOptionsLookup = lookup?.endsWith("_options_by_label") === true || lookup?.endsWith("_option_ids_by_label") === true;
631
696
  return isOptionsLookup &&
632
697
  typeof segment === "object" &&
633
698
  segment !== null &&
@@ -650,90 +715,50 @@ function stageFilterName(value, ctx) {
650
715
  return undefined;
651
716
  return ctx.stagesByKey.get(segment.index);
652
717
  }
653
- function filterValue(value, ctx) {
654
- const directOptionLabel = picklistOptionLabel(value);
655
- if (directOptionLabel !== undefined)
656
- return { kind: "text", value: directOptionLabel };
657
- const directStageName = stageFilterName(value, ctx);
658
- if (directStageName !== undefined)
659
- return { kind: "text", value: directStageName };
660
- if (!isObject(value) || isTfExpr(value))
661
- return decodeValue(value, ctx);
662
- const type = typeof value.type === "string" ? value.type.toLowerCase() : undefined;
663
- if (type === undefined)
718
+ /**
719
+ * ei exports `elementum_calculation_task.calculations[].formula` as the calc
720
+ * engine's mustache string (`{{trigger name="record.<field-uuid>"}}`), not as
721
+ * an HCL `refs["…"]` expression. `decodeValue` would keep that UUID in
722
+ * authored source (#312). Rewrite each mustache through the same
723
+ * `trigger.record.<id>` resolver used for filters, using import-block field
724
+ * ids already in this stream.
725
+ */
726
+ function decodeCalculationFormula(value, ctx) {
727
+ if (typeof value !== "string")
664
728
  return decodeValue(value, ctx);
665
- if (type === "null")
666
- return { kind: "null" };
667
- if (type === "current_user") {
668
- const raw = typeof value.current_user_type === "string" ? value.current_user_type.toLowerCase() : "id";
669
- const currentUserType = raw === "email" || raw === "domain" ? raw : "id";
670
- return { kind: "currentUser", currentUserType };
671
- }
672
- // The provider's `filter.value` schema splits "static" from "dynamic"
673
- // across two distinct attributes — `value` vs `value_reference` (same
674
- // split `left_value` already respects, decoded via `value_reference`
675
- // just below in `decodeFilter`) — so a reference-typed value's payload
676
- // lives under `value_reference`, not `value`.
677
- if (type === "reference")
678
- return { kind: "reference", ref: decodeValue(value.value_reference, ctx) };
679
- if (["text", "number", "boolean", "uuid", "date", "datetime"].includes(type)) {
680
- const optionLabel = picklistOptionLabel(value.value);
681
- if (optionLabel !== undefined)
682
- return { kind: "text", value: optionLabel };
683
- const stageName = stageFilterName(value.value, ctx);
684
- if (stageName !== undefined)
685
- return { kind: "text", value: stageName };
686
- const raw = value.value;
687
- return { kind: type, value: raw };
729
+ const parts = [];
730
+ let cursor = 0;
731
+ for (const match of value.matchAll(/\{\{trigger name="([^"]+)"\}\}/g)) {
732
+ const index = match.index ?? 0;
733
+ if (index > cursor)
734
+ parts.push(value.slice(cursor, index));
735
+ const decoded = decodeReferenceString(`trigger.${match[1]}`, ctx);
736
+ parts.push(decoded ?? { kind: "unresolved", uuid: match[1], hint: "calculation-reference" });
737
+ cursor = index + match[0].length;
688
738
  }
689
- if (type === "field")
690
- return { kind: "reference", ref: fieldRef(value.value, ctx) };
691
- throw new EntityTfError(`unsupported filter value type "${type}"`);
739
+ if (parts.length === 0)
740
+ return { kind: "literal", value };
741
+ if (cursor < value.length)
742
+ parts.push(value.slice(cursor));
743
+ if (parts.length === 1 && typeof parts[0] !== "string")
744
+ return parts[0];
745
+ return { kind: "template", parts };
746
+ }
747
+ function filterReference(value, ctx) {
748
+ return typeof value === "string"
749
+ ? decodeReferenceString(value, ctx) ?? { kind: "unresolved", uuid: value, hint: "filter-reference" }
750
+ : decodeTemplateTriggerRecordFieldRef(value, ctx)
751
+ ?? decodeValue(value, ctx);
692
752
  }
693
753
  function decodeFilter(value, ctx, fieldScope = "app") {
694
- if (!isObject(value) || isTfExpr(value) || typeof value.type !== "string")
695
- throw new EntityTfError("invalid filter object");
696
- const type = value.type.toLowerCase();
697
- if (type === "true" || type === "false")
698
- return { kind: type };
699
- if (type === "and" || type === "or") {
700
- if (!Array.isArray(value.children))
701
- throw new EntityTfError(`${type} filter has no children`);
702
- return { kind: type, children: value.children.map((child) => decodeFilter(child, ctx, fieldScope)) };
703
- }
704
- const left = value.field_id !== undefined
705
- ? fieldScope === "user" ? userFieldRef(value.field_id, ctx) : fieldRef(value.field_id, ctx)
706
- : isObject(value.left_value) && value.left_value.value_reference !== undefined
707
- ? typeof value.left_value.value_reference === "string"
708
- ? decodeReferenceString(value.left_value.value_reference, ctx)
709
- : decodeTemplateTriggerRecordFieldRef(value.left_value.value_reference, ctx)
710
- ?? decodeValue(value.left_value.value_reference, ctx)
711
- : value.left_value !== undefined ? decodeValue(value.left_value, ctx) : undefined;
712
- if (left === undefined)
713
- throw new EntityTfError(`${type} filter has no left side`);
714
- const not = value.not === true ? { not: true } : {};
715
- if (type === "is_null")
716
- return { kind: "isNull", left, ...not };
717
- if (type === "in") {
718
- if (!Array.isArray(value.values))
719
- throw new EntityTfError("in filter has no values");
720
- return { kind: "in", left, values: value.values.map((item) => filterValue(item, ctx)), ...not };
721
- }
722
- if (type === "between") {
723
- if (!Array.isArray(value.values) || value.values.length !== 2)
724
- throw new EntityTfError("between filter requires two values");
725
- return { kind: "between", left, values: [filterValue(value.values[0], ctx), filterValue(value.values[1], ctx)], ...not };
726
- }
727
- const kindByType = {
728
- equals: "eq", greater_than: "gt", greater_than_equals: "gte", less_than: "lt", less_than_equals: "lte", like: "like",
729
- };
730
- const kind = kindByType[type];
731
- if (kind === undefined || value.value === undefined)
732
- throw new EntityTfError(`unsupported filter type "${type}"`);
733
- const right = filterValue(value.value, ctx);
734
- return kind === "like"
735
- ? { kind, left, right, ...not, ...(typeof value.case_insensitive === "boolean" ? { caseInsensitive: value.case_insensitive } : {}), ...(typeof value.mode === "string" ? { mode: value.mode.toLowerCase() } : {}) }
736
- : { kind, left, right, ...not };
754
+ return deserializeFilterFromTf(value, {
755
+ field: (fieldValue, scope) => {
756
+ const field = scope === "user" ? userFieldRef(fieldValue, ctx) : fieldRef(fieldValue, ctx);
757
+ return field ?? { kind: "unresolved", uuid: String(fieldValue), hint: "field" };
758
+ },
759
+ reference: (reference) => filterReference(reference, ctx),
760
+ literal: (literal) => picklistOptionLabel(literal) ?? stageFilterName(literal, ctx) ?? literal,
761
+ }, fieldScope);
737
762
  }
738
763
  function triggerFromBlock(block, ctx) {
739
764
  const kind = TRIGGER_KINDS[block.type];
@@ -788,9 +813,14 @@ function triggerFromBlock(block, ctx) {
788
813
  return { kind, app, approvalChain: approvalChain, status: block.attrs.status };
789
814
  }
790
815
  case "dataMine":
791
- if (typeof block.attrs.datamine_id !== "string")
792
- throw new EntityTfError("datamine trigger requires datamine_id");
793
- return { kind, datamineId: block.attrs.datamine_id, ...(typeof block.attrs.fire_on_alert === "boolean" ? { fireOnAlert: block.attrs.fire_on_alert } : {}), ...(typeof block.attrs.fire_on_recovery === "boolean" ? { fireOnRecovery: block.attrs.fire_on_recovery } : {}) };
816
+ {
817
+ const raw = block.attrs.datamine_id;
818
+ const datamine = typeof raw === "string" ? raw : decodeValue(raw, ctx);
819
+ if (typeof datamine !== "string" && (!isObject(datamine) || datamine.kind !== "datamine")) {
820
+ throw new EntityTfError("datamine trigger requires a managed datamine reference or explicit platform id");
821
+ }
822
+ return { kind, datamine: datamine, ...(typeof block.attrs.fire_on_alert === "boolean" ? { fireOnAlert: block.attrs.fire_on_alert } : {}), ...(typeof block.attrs.fire_on_recovery === "boolean" ? { fireOnRecovery: block.attrs.fire_on_recovery } : {}) };
823
+ }
794
824
  case "emailReceived":
795
825
  if (typeof block.attrs.email_alias_id !== "string")
796
826
  throw new EntityTfError("email trigger requires email_alias_id");
@@ -879,6 +909,28 @@ function taskArgs(block, factory, ctx) {
879
909
  }));
880
910
  continue;
881
911
  }
912
+ if (attr === "input_mappings" && factory === "runAutomation") {
913
+ if (!Array.isArray(value))
914
+ throw new EntityTfError(`${block.type}.${block.label}: input_mappings must be an array`);
915
+ args.inputs = value.map((item) => {
916
+ if (!isObject(item) || item.parameter_id === undefined || item.value === undefined) {
917
+ throw new EntityTfError(`${block.type}.${block.label}: invalid input mapping`);
918
+ }
919
+ const parameter = item.parameter_id;
920
+ if (!isTfExpr(parameter) ||
921
+ parameter.$expr !== "resource-attr" ||
922
+ parameter.type !== "elementum_on_demand_trigger" ||
923
+ parameter.path[0] !== "parameter_ids" ||
924
+ typeof parameter.path[1] !== "object" ||
925
+ parameter.path[1] === null ||
926
+ !("index" in parameter.path[1]) ||
927
+ typeof parameter.path[1].index !== "string") {
928
+ throw new EntityTfError(`${block.type}.${block.label}: input mapping parameter_id is not a named trigger parameter reference`);
929
+ }
930
+ return { name: parameter.path[1].index, value: decodeValue(item.value, ctx) };
931
+ });
932
+ continue;
933
+ }
882
934
  if (attr === "calculations" && factory === "calculation") {
883
935
  if (!Array.isArray(value))
884
936
  throw new EntityTfError("calculations must be an array");
@@ -886,7 +938,7 @@ function taskArgs(block, factory, ctx) {
886
938
  if (!isObject(item) || typeof item.variable_name !== "string" || item.formula === undefined) {
887
939
  throw new EntityTfError(`${block.type}.${block.label}: invalid calculation entry`);
888
940
  }
889
- return { name: item.variable_name, expression: decodeValue(item.formula, ctx) };
941
+ return { name: item.variable_name, expression: decodeCalculationFormula(item.formula, ctx) };
890
942
  });
891
943
  continue;
892
944
  }
@@ -1147,11 +1199,11 @@ export function automationOwnedAddresses(doc, automationLabel) {
1147
1199
  return [...owned];
1148
1200
  }
1149
1201
  /** Extract one app-owned automation graph from an ei app export. */
1150
- function automationFromTfDocument(doc, automationLabel, appRefName) {
1202
+ function automationFromTfDocument(doc, automationLabel, appRefName, foreignFieldRefsById) {
1151
1203
  const automation = doc.blocks.find((block) => block.kind === "resource" && block.type === AUTOMATION_RESOURCE_TYPE && block.label === automationLabel);
1152
1204
  if (automation === undefined)
1153
1205
  throw new EntityTfError(`automation resource "${automationLabel}" not found`);
1154
- assertAllowed(automation, new Set(["app_id", "name", "description", "triggers_other_automations", "depends_on"]));
1206
+ assertAllowed(automation, new Set(["app_id", "name", "description", "status", "triggers_other_automations", "service_account_id", "depends_on"]));
1155
1207
  const app = resourceRef(automation.attrs.app_id);
1156
1208
  if (app === undefined || app.type !== "elementum_app" || app.path[0] !== "id")
1157
1209
  throw new EntityTfError(`${AUTOMATION_RESOURCE_TYPE}.${automationLabel}: app_id is not an app reference`);
@@ -1266,7 +1318,37 @@ function automationFromTfDocument(doc, automationLabel, appRefName) {
1266
1318
  stagesByKey.set(item.key, item.name);
1267
1319
  }
1268
1320
  }
1269
- const ctx = { appRefName, appTfLabel: app.label, trigger, taskByAddress, resourceBlocks, dataBlocks, resourceImportIds, fieldById, stagesByKey };
1321
+ const ctx = {
1322
+ appRefName,
1323
+ appTfLabel: app.label,
1324
+ trigger,
1325
+ taskByAddress,
1326
+ resourceBlocks,
1327
+ dataBlocks,
1328
+ resourceImportIds,
1329
+ fieldById,
1330
+ stagesByKey,
1331
+ ...(foreignFieldRefsById !== undefined && { foreignFieldRefsById }),
1332
+ };
1333
+ let serviceAccountName;
1334
+ const serviceAccountValue = automation.attrs.service_account_id;
1335
+ if (serviceAccountValue !== undefined &&
1336
+ isTfExpr(serviceAccountValue) &&
1337
+ "type" in serviceAccountValue &&
1338
+ serviceAccountValue.type === "elementum_service_account" &&
1339
+ (serviceAccountValue.$expr === "resource-attr" || serviceAccountValue.$expr === "data-attr")) {
1340
+ const reference = serviceAccountValue;
1341
+ const block = reference.$expr === "resource-attr"
1342
+ ? resourceBlocks.get(`${reference.type}.${reference.label}`)
1343
+ : dataBlocks.get(`${reference.type}.${reference.label}`);
1344
+ if (block !== undefined) {
1345
+ if (typeof block.attrs.name === "string")
1346
+ serviceAccountName = block.attrs.name;
1347
+ else if (typeof block.attrs.first_name === "string" && typeof block.attrs.last_name === "string") {
1348
+ serviceAccountName = `${block.attrs.first_name} ${block.attrs.last_name}`;
1349
+ }
1350
+ }
1351
+ }
1270
1352
  const dependencyOrder = new Map();
1271
1353
  if (publish && Array.isArray(publish.attrs.depends_on))
1272
1354
  publish.attrs.depends_on.forEach((dep, index) => { const ref = resourceRef(dep); if (ref)
@@ -1344,7 +1426,8 @@ function automationFromTfDocument(doc, automationLabel, appRefName) {
1344
1426
  workflowRevision: exportedRevision ?? "1.0.0",
1345
1427
  ...(typeof automation.attrs.description === "string" ? { description: automation.attrs.description } : {}),
1346
1428
  ...(typeof automation.attrs.triggers_other_automations === "boolean" ? { triggersOtherAutomations: automation.attrs.triggers_other_automations } : {}),
1347
- status: publish ? "ACTIVE" : "DRAFT",
1429
+ ...(serviceAccountName !== undefined ? { serviceAccountName } : {}),
1430
+ status: publish ? "ACTIVE" : automation.attrs.status === "INACTIVE" ? "INACTIVE" : "DRAFT",
1348
1431
  trigger: triggerFromBlock(trigger, ctx),
1349
1432
  tasks: topTasks,
1350
1433
  ...(outputs && outputs.length > 0 ? { outputs } : {}),
@@ -1354,7 +1437,7 @@ function automationFromTfDocument(doc, automationLabel, appRefName) {
1354
1437
  tfLabel: automationLabel, ast, blocks: [automation, trigger, ...tasks, ...ownedBranches, ...(publish ? [publish] : [])]
1355
1438
  };
1356
1439
  }
1357
- export function automationFromTf(first, second, third) {
1440
+ export function automationFromTf(first, second, third, fourth) {
1358
1441
  if (Array.isArray(first)) {
1359
1442
  const ctx = second;
1360
1443
  const automationBlock = first.find((block) => block.kind === "resource" && block.type === AUTOMATION_RESOURCE_TYPE);
@@ -1370,5 +1453,5 @@ export function automationFromTf(first, second, third) {
1370
1453
  return { skippedReason: message };
1371
1454
  }
1372
1455
  }
1373
- return automationFromTfDocument(first, second, third ?? "");
1456
+ return automationFromTfDocument(first, second, third ?? "", fourth);
1374
1457
  }
@@ -2,6 +2,8 @@ export { automationFromTf, type AutomationFromTfResult } from "./from-tf.js";
2
2
  export { automationModule } from "./module.js";
3
3
  export { AUTOMATION_RESOURCE_TYPES, AUTOMATION_TRIGGER_TYPES, AUTOMATION_TASK_TYPES } from "./types.js";
4
4
  export { automationToTf, type AutomationToTfContext, type AutomationToTfResult } from "./to-tf.js";
5
+ export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
6
+ export { userRef, type RoleUserRef as AutomationUserRef } from "../role/build.js";
5
7
  /**
6
8
  * v2 automation authoring — the typed, chainable builder (validation slice).
7
9
  *
@@ -18,5 +20,5 @@ export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd
18
20
  export { aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, createRecord, executeScript, findRelatedRecords, postComment, recordSearch, relateRecords, sendEmail, setVariable, tableRecordsSearch, updateField, type AiAgentOptions, type AiAgentOutput, type AiAgentOutputField, type AiAgentOutputFieldType, type AiClassifyCategorySource, type AiClassifyOptions, type AiClassifyStaticCategory, type AiEmailAnalysisOptions, type AiFileAnalysisOptions, type AiSearchTableOptions, type AiSummarizeOptions, type AiTransformOptions, type ApiRequestHeader, type ApiRequestOptions, type CreateRecordOptions, type CreateRecordOutput, type EmailAttachment, type ExecuteScriptOptions, type FieldAssignment, type FindRelatedRecordsOptions, type PostCommentOptions, type RecordSearchOptions, type RecordSearchOutput, type RelateRecordsOptions, type SendEmailOptions, type SetVariableOptions, type TableRecordsSearchOptions, type TableRecordsSearchOutput, type UpdateFieldOptions, type VariableAssign, type VariableDecl, } from "./tasks.js";
19
21
  export { addWatcher, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, calculation, filterTask, generateReport, initiateCall, notification, postTeamsMessage, procedure, recordFieldLocking, saveAttachment, unzip, userGroupSearch, userSearch, type AddWatcherOptions, type ApprovalStatusUpdateOptions, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type CalculationEntry, type CalculationOptions, type FilterTaskOptions, type GenerateReportOptions, type InitiateCallOptions, type NotificationOptions, type PostTeamsMessageOptions, type ProcedureOptions, type RecordFieldLockingOptions, type SaveAttachmentOptions, type UnzipOptions, type UserSearchOptions, } from "./tasks.js";
20
22
  export { approvalChainTemplate, approvalChain, bulkExcel, readFile, initiateEmailConversation, runAutomation, sendSurvey, type ApprovalChainOptions, type ApprovalChainTemplateOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, type ReadFileDataSource, type ReadFileOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type RunAutomationInput, type RunAutomationOptions, type SendSurveyOptions, } from "./tasks.js";
21
- export * as filter from "./filter.js";
22
- export { type Filter } from "./filter.js";
23
+ export * as filter from "../shared/filters/index.js";
24
+ export { type Filter } from "../shared/filters/index.js";
@@ -2,6 +2,8 @@ export { automationFromTf } from "./from-tf.js";
2
2
  export { automationModule } from "./module.js";
3
3
  export { AUTOMATION_RESOURCE_TYPES, AUTOMATION_TRIGGER_TYPES, AUTOMATION_TASK_TYPES } from "./types.js";
4
4
  export { automationToTf } from "./to-tf.js";
5
+ export { serviceAccountRef } from "../service-account/ref.js";
6
+ export { userRef } from "../role/build.js";
5
7
  /**
6
8
  * v2 automation authoring — the typed, chainable builder (validation slice).
7
9
  *
@@ -18,7 +20,7 @@ export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd
18
20
  export { aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, createRecord, executeScript, findRelatedRecords, postComment, recordSearch, relateRecords, sendEmail, setVariable, tableRecordsSearch, updateField, } from "./tasks.js";
19
21
  export { addWatcher, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, calculation, filterTask, generateReport, initiateCall, notification, postTeamsMessage, procedure, recordFieldLocking, saveAttachment, unzip, userGroupSearch, userSearch, } from "./tasks.js";
20
22
  export { approvalChainTemplate, approvalChain, bulkExcel, readFile, initiateEmailConversation, runAutomation, sendSurvey, } from "./tasks.js";
21
- export * as filter from "./filter.js";
23
+ export * as filter from "../shared/filters/index.js";
22
24
  // Pull a deployed automation back as editable v2 source. `defineAutomation`
23
25
  // is a plain factory returning a builder-chain object (not an Object.assign-able
24
26
  // callable), so `fromJSON` ships as a standalone named export rather than a
@@ -1,6 +1,5 @@
1
1
  /** The automation entity's registry entry (see src/graph/). */
2
2
  import { sanitizeName, tfLabelToTsLabel } from "../../engine/tf/index.js";
3
- import { NO_DATA, } from "../../graph/types.js";
4
3
  import { renderAutomationCatalogEntry } from "./catalog-render.js";
5
4
  import { printAutomationV2 } from "./deserializer/print-automation.js";
6
5
  import { automationFromTf, automationOwnedAddresses } from "./from-tf.js";
@@ -66,7 +65,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
66
65
  for (const autoBlock of ownBlocks) {
67
66
  const autoLabel = autoBlock.label ?? "";
68
67
  try {
69
- const extracted = automationFromTf({ blocks: [...stream.allBlocks] }, autoLabel, ctx.appRefName);
68
+ const extracted = automationFromTf({ blocks: [...stream.allBlocks] }, autoLabel, ctx.appRefName, ctx.foreignFieldRefsById);
70
69
  items.push(extracted.ast);
71
70
  }
72
71
  catch (err) {
@@ -76,7 +75,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
76
75
  // never wrote this automation to source) can't reproduce them, so
77
76
  // `plan` shows them as destroy-on-apply. See automationOwnedAddresses.
78
77
  skipped.push(...automationOwnedAddresses({ blocks: [...stream.allBlocks] }, autoLabel));
79
- diagnostics.push(err instanceof Error ? err.message : String(err));
78
+ diagnostics.push(`${autoLabel}: ${err instanceof Error ? err.message : String(err)}`);
80
79
  }
81
80
  }
82
81
  return { items, skipped, diagnostics };
@@ -102,7 +101,7 @@ export const automationModule = {
102
101
  })),
103
102
  ],
104
103
  },
105
- data: NO_DATA,
104
+ data: { participates: true, resourceType: AUTOMATION_RESOURCE_TYPE, lookupAttr: "name", referencedByBuild: false },
106
105
  canvas: {
107
106
  participates: true,
108
107
  label: "Automations",
@@ -135,6 +134,13 @@ export const automationModule = {
135
134
  fieldNames: ctx.fieldNames ?? new Map(),
136
135
  fieldMetadata: ctx.fieldMetadata ?? new Map(),
137
136
  orgRefs: ctx.orgRefs,
137
+ workspaceAspects: ctx.workspaceAspects,
138
+ localsAttrs: ctx.localsAttrs,
139
+ serviceAccounts: ctx.streamRootEntity?.payload?.serviceAccounts,
140
+ activeAutomationRefNames: new Set((ctx.siblingEntities ?? [])
141
+ .filter((sibling) => sibling.kind === "automation" &&
142
+ sibling.payload?.status === "ACTIVE")
143
+ .map((sibling) => sibling.refName)),
138
144
  }),
139
145
  },
140
146
  catalog: {