@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
@@ -14,6 +14,10 @@ import { SYSTEM_FIELD_KEYS } from "../../core/system-fields.js";
14
14
  import { tsLabelToTfLabel } from "../../engine/tf/index.js";
15
15
  export const LAYOUT_RESOURCE_TYPE = "elementum_layout";
16
16
  export const LIST_VIEW_RESOURCE_TYPE = "elementum_list_view";
17
+ export const AGENT_VIEW_RESOURCE_TYPE = "elementum_agent_view";
18
+ export const CALENDAR_VIEW_RESOURCE_TYPE = "elementum_calendar_view";
19
+ export const KANBAN_VIEW_RESOURCE_TYPE = "elementum_kanban_view";
20
+ export const DASHBOARD_VIEW_RESOURCE_TYPE = "elementum_dashboard_view";
17
21
  export const MANAGED_VIEW_ORDER_RESOURCE_TYPE = "elementum_managed_view_order";
18
22
  /**
19
23
  * Layout section `type` discriminator: authoring camelCase ↔ the provider's
@@ -85,5 +89,44 @@ export const KNOWN_LIST_VIEW_ATTRS = new Set([
85
89
  "filter",
86
90
  "sort",
87
91
  ]);
92
+ export const KNOWN_AGENT_VIEW_ATTRS = new Set([
93
+ "aspect_id",
94
+ "agent_id",
95
+ "name",
96
+ "allow_record_creation",
97
+ "filter",
98
+ "sort",
99
+ "user_ids",
100
+ "group_ids",
101
+ "display_order",
102
+ ]);
103
+ const COMMON_TYPED_VIEW_ATTRS = [
104
+ "aspect_id",
105
+ "name",
106
+ "allow_record_creation",
107
+ "columns",
108
+ "display_by_field",
109
+ "filter",
110
+ "sort",
111
+ "user_ids",
112
+ "group_ids",
113
+ "display_order",
114
+ ];
115
+ export const KNOWN_CALENDAR_VIEW_ATTRS = new Set(COMMON_TYPED_VIEW_ATTRS);
116
+ export const KNOWN_KANBAN_VIEW_ATTRS = new Set([
117
+ ...COMMON_TYPED_VIEW_ATTRS,
118
+ "allowed_filter_fields",
119
+ ]);
120
+ export const KNOWN_DASHBOARD_VIEW_ATTRS = new Set([
121
+ "aspect_id",
122
+ "name",
123
+ "dashboard_id",
124
+ "allow_record_creation",
125
+ "filter",
126
+ "sort",
127
+ "user_ids",
128
+ "group_ids",
129
+ "display_order",
130
+ ]);
88
131
  /** Attributes `managedViewOrderFromTf` understands. */
89
132
  export const KNOWN_MANAGED_VIEW_ORDER_ATTRS = new Set(["object_id", "view_ids"]);
@@ -0,0 +1,87 @@
1
+ import { type AgentRef, type AppCatalogRef, type AppOrElementRef, type AutomationRef } from "../../catalog/index.js";
2
+ import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
3
+ declare const positionBrand: unique symbol;
4
+ declare const symbolBrand: unique symbol;
5
+ declare const actionBrand: unique symbol;
6
+ declare const targetBrand: unique symbol;
7
+ export type VisualFlowPosition = ("TOP" | "RIGHT" | "BOTTOM" | "LEFT") & {
8
+ readonly [positionBrand]: "VisualFlowPosition";
9
+ };
10
+ export type VisualFlowSymbol = ("SQUARE" | "DIAMOND" | "CIRCLE") & {
11
+ readonly [symbolBrand]: "VisualFlowSymbol";
12
+ };
13
+ export declare const visualFlowPosition: {
14
+ readonly top: VisualFlowPosition;
15
+ readonly right: VisualFlowPosition;
16
+ readonly bottom: VisualFlowPosition;
17
+ readonly left: VisualFlowPosition;
18
+ };
19
+ export declare const visualFlowSymbol: {
20
+ readonly square: VisualFlowSymbol;
21
+ readonly diamond: VisualFlowSymbol;
22
+ readonly circle: VisualFlowSymbol;
23
+ };
24
+ type ActionPayload = {
25
+ readonly kind: "agent";
26
+ readonly agent: AgentRef;
27
+ readonly name?: string;
28
+ } | {
29
+ readonly kind: "automation";
30
+ readonly automation: AutomationRef;
31
+ readonly name?: string;
32
+ } | {
33
+ readonly kind: "user";
34
+ readonly name: string;
35
+ } | {
36
+ readonly kind: "api";
37
+ readonly name: string;
38
+ } | {
39
+ readonly kind: "object";
40
+ readonly object: AppOrElementRef;
41
+ readonly name?: string;
42
+ };
43
+ export type VisualFlowAction = ActionPayload & {
44
+ readonly [actionBrand]: "VisualFlowAction";
45
+ };
46
+ export type VisualFlowTarget = {
47
+ readonly object: AppOrElementRef;
48
+ readonly name?: string;
49
+ } & {
50
+ readonly [targetBrand]: "VisualFlowTarget";
51
+ };
52
+ export declare function flowAgentAction(agent: AgentRef, name?: string): VisualFlowAction;
53
+ export declare function flowAutomationAction(automation: AutomationRef, name?: string): VisualFlowAction;
54
+ export declare function flowUserAction(name: string): VisualFlowAction;
55
+ export declare function flowApiAction(name: string): VisualFlowAction;
56
+ export declare function flowObjectAction(object: AppOrElementRef, name?: string): VisualFlowAction;
57
+ export declare function flowObjectTarget(object: AppOrElementRef, name?: string): VisualFlowTarget;
58
+ export interface VisualFlowConnection {
59
+ readonly target: string;
60
+ readonly label?: string;
61
+ }
62
+ export interface VisualFlowNode {
63
+ readonly description?: string;
64
+ readonly symbol: VisualFlowSymbol;
65
+ readonly x: number;
66
+ readonly y: number;
67
+ readonly sourcePosition?: VisualFlowPosition;
68
+ readonly targetPosition?: VisualFlowPosition;
69
+ readonly connectsTo?: readonly (string | VisualFlowConnection)[];
70
+ readonly action?: VisualFlowAction;
71
+ readonly target?: VisualFlowTarget;
72
+ }
73
+ export interface VisualFlowStage {
74
+ readonly nodes: Readonly<Record<string, VisualFlowNode>>;
75
+ }
76
+ export type DefineVisualFlowOptions = EntityDeployOptions & {
77
+ /** The app whose stages host this flow. Elements do not expose stages. */
78
+ readonly app: AppCatalogRef;
79
+ /** Stable stage keys map directly to the owner's authored stage keys. */
80
+ readonly stages: Readonly<Record<string, VisualFlowStage>>;
81
+ };
82
+ export interface VisualFlowConfigured {
83
+ def(refName: string): DeployableEntity;
84
+ }
85
+ /** Define the immutable visual process diagram attached to an app. */
86
+ export declare function defineVisualFlow(opts: DefineVisualFlowOptions): VisualFlowConfigured;
87
+ export {};
@@ -0,0 +1,72 @@
1
+ import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
2
+ import { slimTokens, } from "../../catalog/index.js";
3
+ export const visualFlowPosition = {
4
+ top: "TOP",
5
+ right: "RIGHT",
6
+ bottom: "BOTTOM",
7
+ left: "LEFT",
8
+ };
9
+ export const visualFlowSymbol = {
10
+ square: "SQUARE",
11
+ diamond: "DIAMOND",
12
+ circle: "CIRCLE",
13
+ };
14
+ export function flowAgentAction(agent, name) {
15
+ return { kind: "agent", agent, ...(name !== undefined ? { name } : {}) };
16
+ }
17
+ export function flowAutomationAction(automation, name) {
18
+ return { kind: "automation", automation, ...(name !== undefined ? { name } : {}) };
19
+ }
20
+ export function flowUserAction(name) {
21
+ return { kind: "user", name };
22
+ }
23
+ export function flowApiAction(name) {
24
+ return { kind: "api", name };
25
+ }
26
+ export function flowObjectAction(object, name) {
27
+ return { kind: "object", object, ...(name !== undefined ? { name } : {}) };
28
+ }
29
+ export function flowObjectTarget(object, name) {
30
+ return { object, ...(name !== undefined ? { name } : {}) };
31
+ }
32
+ /** Define the immutable visual process diagram attached to an app. */
33
+ export function defineVisualFlow(opts) {
34
+ const owner = opts.app;
35
+ if (owner?.__kind !== "app") {
36
+ throw new EdkValidationError("defineVisualFlow requires an app owner because elements do not expose stages.");
37
+ }
38
+ if (Object.keys(opts.stages).length === 0)
39
+ throw new EdkValidationError("defineVisualFlow requires at least one stage.");
40
+ for (const [stageKey, stage] of Object.entries(opts.stages)) {
41
+ if (stageKey.trim() === "")
42
+ throw new EdkValidationError("defineVisualFlow stage keys must be non-empty.");
43
+ const keys = new Set(Object.keys(stage.nodes));
44
+ for (const [key, node] of Object.entries(stage.nodes)) {
45
+ if (!Number.isFinite(node.x) || !Number.isFinite(node.y)) {
46
+ throw new EdkValidationError(`defineVisualFlow node ${JSON.stringify(key)}: x and y must be finite numbers.`);
47
+ }
48
+ if (node.action?.kind === "agent" && node.action.agent.parent !== owner.refName) {
49
+ throw new EdkValidationError(`defineVisualFlow node ${JSON.stringify(key)}: agent must belong to ${owner.__kind} ${JSON.stringify(owner.refName)}.`);
50
+ }
51
+ if (node.action?.kind === "automation" && node.action.automation.parent !== owner.refName) {
52
+ throw new EdkValidationError(`defineVisualFlow node ${JSON.stringify(key)}: automation must belong to ${owner.__kind} ${JSON.stringify(owner.refName)}.`);
53
+ }
54
+ for (const connection of node.connectsTo ?? []) {
55
+ const target = typeof connection === "string" ? connection : connection.target;
56
+ if (!keys.has(target))
57
+ throw new EdkValidationError(`defineVisualFlow node ${JSON.stringify(key)} connects to unknown node ${JSON.stringify(target)} in stage ${JSON.stringify(stageKey)}.`);
58
+ }
59
+ }
60
+ }
61
+ return {
62
+ def(refName) {
63
+ return {
64
+ kind: "visual-flow",
65
+ parent: owner.refName,
66
+ refName,
67
+ payload: slimTokens({ stages: Object.entries(opts.stages).map(([stage, value]) => ({ stage, nodes: value.nodes })) }),
68
+ ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
69
+ };
70
+ },
71
+ };
72
+ }
@@ -0,0 +1,49 @@
1
+ import { type FromTfContext } from "../../engine/pull/context.js";
2
+ import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
3
+ export type NormalizedFlowObject = {
4
+ readonly kind: "app" | "element";
5
+ readonly refName: string;
6
+ readonly name: string;
7
+ };
8
+ export type NormalizedVisualFlowAction = {
9
+ readonly kind: "agent";
10
+ readonly refName: string;
11
+ readonly name?: string;
12
+ } | {
13
+ readonly kind: "automation";
14
+ readonly refName: string;
15
+ readonly name?: string;
16
+ } | {
17
+ readonly kind: "user" | "api";
18
+ readonly name: string;
19
+ } | {
20
+ readonly kind: "object";
21
+ readonly object: NormalizedFlowObject;
22
+ readonly name?: string;
23
+ };
24
+ export interface NormalizedVisualFlowNode {
25
+ readonly description?: string;
26
+ readonly symbol: "SQUARE" | "DIAMOND" | "CIRCLE";
27
+ readonly x: number;
28
+ readonly y: number;
29
+ readonly sourcePosition?: "TOP" | "RIGHT" | "BOTTOM" | "LEFT";
30
+ readonly targetPosition?: "TOP" | "RIGHT" | "BOTTOM" | "LEFT";
31
+ readonly connectsTo?: readonly {
32
+ readonly target: string;
33
+ readonly label?: string;
34
+ }[];
35
+ readonly action?: NormalizedVisualFlowAction;
36
+ readonly target?: {
37
+ readonly object: NormalizedFlowObject;
38
+ readonly name?: string;
39
+ };
40
+ }
41
+ export interface NormalizedVisualFlowStage {
42
+ readonly stage: string;
43
+ readonly nodes: Readonly<Record<string, NormalizedVisualFlowNode>>;
44
+ }
45
+ export interface NormalizedVisualFlow {
46
+ readonly refName: string;
47
+ readonly stages: readonly NormalizedVisualFlowStage[];
48
+ }
49
+ export declare function visualFlowFromTf(block: TfBlock, ownerType: "elementum_app" | "elementum_element", ownerLabel: string, scope: ChildResourceScope, ctx: FromTfContext): NormalizedVisualFlow;
@@ -0,0 +1,124 @@
1
+ import { EntityTfError } from "../../engine/entity.js";
2
+ import { plainObject, resourceRefLabel } from "../../engine/pull/context.js";
3
+ import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
4
+ import { VISUAL_FLOW_RESOURCE_TYPE } from "./module.js";
5
+ const KNOWN = new Set(["id", "object_id", "stages"]);
6
+ const symbols = new Set(["SQUARE", "DIAMOND", "CIRCLE"]);
7
+ const positions = new Set(["TOP", "RIGHT", "BOTTOM", "LEFT"]);
8
+ function requiredObject(value, where) {
9
+ const result = value === undefined ? undefined : plainObject(value);
10
+ if (result === undefined)
11
+ throw new EntityTfError(`${where}: expected an object`);
12
+ return result;
13
+ }
14
+ function optionalName(value) {
15
+ return typeof value === "string" && value !== "" ? value : undefined;
16
+ }
17
+ function ownedRef(value, type, ownerLabel, scope, where) {
18
+ if (value === undefined || !isTfExpr(value) || value.$expr !== "resource-attr" || value.type !== type || value.path.length !== 1 || value.path[0] !== "id") {
19
+ throw new EntityTfError(`${where}: expected a typed ${type} resource reference`);
20
+ }
21
+ return scopedLabelToBagKey(ownerLabel, value.label, scope);
22
+ }
23
+ function objectRef(value, ctx, where) {
24
+ if (value === undefined || !isTfExpr(value) || (value.$expr !== "resource-attr" && value.$expr !== "data-attr") || value.path.length !== 1 || value.path[0] !== "id") {
25
+ throw new EntityTfError(`${where}: expected a typed app or element reference`);
26
+ }
27
+ if (value.type !== "elementum_app" && value.type !== "elementum_element") {
28
+ throw new EntityTfError(`${where}: expected an elementum_app or elementum_element reference`);
29
+ }
30
+ const kind = value.type === "elementum_element" ? "element" : "app";
31
+ const name = value.$expr === "data-attr" ? ctx.dataName(value.type, value.label) : undefined;
32
+ return { kind, refName: tfLabelToTsLabel(value.label), name: name ?? tfLabelToTsLabel(value.label) };
33
+ }
34
+ function actionFromTf(value, ownerLabel, scope, ctx, where) {
35
+ const action = requiredObject(value, where);
36
+ const variants = ["agent", "automation", "user", "api", "object"].filter((key) => action[key] !== undefined);
37
+ if (variants.length !== 1)
38
+ throw new EntityTfError(`${where}: expected exactly one action variant`);
39
+ const kind = variants[0];
40
+ const body = requiredObject(action[kind], `${where}.${kind}`);
41
+ const name = optionalName(body["name"]);
42
+ if (kind === "agent")
43
+ return { kind, refName: ownedRef(body["agent_id"], "elementum_agent", ownerLabel, scope, where), ...(name !== undefined ? { name } : {}) };
44
+ if (kind === "automation")
45
+ return { kind, refName: ownedRef(body["automation_id"], "elementum_automation", ownerLabel, scope, where), ...(name !== undefined ? { name } : {}) };
46
+ if (kind === "user" || kind === "api") {
47
+ if (name === undefined)
48
+ throw new EntityTfError(`${where}.${kind}: name is required`);
49
+ return { kind, name };
50
+ }
51
+ return { kind: "object", object: objectRef(body["object_id"], ctx, `${where}.object`), ...(name !== undefined ? { name } : {}) };
52
+ }
53
+ function nodeFromTf(value, ownerLabel, scope, ctx, where) {
54
+ const node = requiredObject(value, where);
55
+ const key = node["key"];
56
+ const symbol = node["symbol"];
57
+ const x = node["x"];
58
+ const y = node["y"];
59
+ if (typeof key !== "string" || key === "")
60
+ throw new EntityTfError(`${where}: key is required`);
61
+ if (typeof symbol !== "string" || !symbols.has(symbol))
62
+ throw new EntityTfError(`${where}: unsupported symbol ${JSON.stringify(symbol)}`);
63
+ if (typeof x !== "number" || typeof y !== "number")
64
+ throw new EntityTfError(`${where}: x and y are required numbers`);
65
+ const sourcePosition = node["source_position"];
66
+ const targetPosition = node["target_position"];
67
+ if (sourcePosition !== undefined && (typeof sourcePosition !== "string" || !positions.has(sourcePosition)))
68
+ throw new EntityTfError(`${where}: unsupported source_position`);
69
+ if (targetPosition !== undefined && (typeof targetPosition !== "string" || !positions.has(targetPosition)))
70
+ throw new EntityTfError(`${where}: unsupported target_position`);
71
+ const rawConnections = node["connects_to"];
72
+ if (rawConnections !== undefined && !Array.isArray(rawConnections))
73
+ throw new EntityTfError(`${where}: connects_to must be a list`);
74
+ const connectsTo = (rawConnections ?? []).map((connection, index) => {
75
+ const item = requiredObject(connection, `${where}.connects_to[${index}]`);
76
+ if (typeof item["target"] !== "string" || item["target"] === "")
77
+ throw new EntityTfError(`${where}.connects_to[${index}]: target is required`);
78
+ return { target: item["target"], ...(typeof item["label"] === "string" ? { label: item["label"] } : {}) };
79
+ });
80
+ const rawTarget = node["target"];
81
+ let target;
82
+ if (rawTarget !== undefined) {
83
+ const targetBody = requiredObject(rawTarget, `${where}.target`);
84
+ const objectBody = requiredObject(targetBody["object"], `${where}.target.object`);
85
+ const name = optionalName(objectBody["name"]);
86
+ target = { object: objectRef(objectBody["object_id"], ctx, `${where}.target.object`), ...(name !== undefined ? { name } : {}) };
87
+ }
88
+ return [key, {
89
+ ...(typeof node["description"] === "string" ? { description: node["description"] } : {}),
90
+ symbol: symbol, x, y,
91
+ ...(typeof sourcePosition === "string" ? { sourcePosition: sourcePosition } : {}),
92
+ ...(typeof targetPosition === "string" ? { targetPosition: targetPosition } : {}),
93
+ ...(connectsTo.length > 0 ? { connectsTo } : {}),
94
+ ...(node["action"] !== undefined ? { action: actionFromTf(node["action"], ownerLabel, scope, ctx, `${where}.action`) } : {}),
95
+ ...(target !== undefined ? { target } : {}),
96
+ }];
97
+ }
98
+ export function visualFlowFromTf(block, ownerType, ownerLabel, scope, ctx) {
99
+ if (block.type !== VISUAL_FLOW_RESOURCE_TYPE || !block.label)
100
+ throw new EntityTfError(`expected ${VISUAL_FLOW_RESOURCE_TYPE}`);
101
+ for (const key of Object.keys(block.attrs))
102
+ if (!KNOWN.has(key))
103
+ throw new EntityTfError(`${block.type}.${block.label}: unhandled attribute ${key}`);
104
+ if (resourceRefLabel(block.attrs["object_id"], ownerType) !== ownerLabel)
105
+ throw new EntityTfError(`${block.type}.${block.label}: object_id does not reference ${ownerType}.${ownerLabel}`);
106
+ const rawStages = block.attrs["stages"];
107
+ if (!Array.isArray(rawStages))
108
+ throw new EntityTfError(`${block.type}.${block.label}: stages must be a list`);
109
+ const stages = rawStages.map((value, index) => {
110
+ const stage = requiredObject(value, `${block.type}.${block.label}.stages[${index}]`);
111
+ const stageId = stage["stage_id"];
112
+ if (!isTfExpr(stageId) || stageId.$expr !== "resource-attr" || stageId.type !== ownerType || stageId.label !== ownerLabel) {
113
+ throw new EntityTfError(`${block.type}.${block.label}.stages[${index}]: stage_id must reference the owning ${scope} stage map`);
114
+ }
115
+ const entry = stageId.path.find((part) => typeof part === "object" && "index" in part);
116
+ if (entry === undefined || typeof entry !== "object")
117
+ throw new EntityTfError(`${block.type}.${block.label}.stages[${index}]: stage_id has no stable key`);
118
+ const rawNodes = stage["nodes"];
119
+ if (!Array.isArray(rawNodes))
120
+ throw new EntityTfError(`${block.type}.${block.label}.stages[${index}]: nodes must be a list`);
121
+ return { stage: tfLabelToTsLabel(entry.index), nodes: Object.fromEntries(rawNodes.map((node, nodeIndex) => nodeFromTf(node, ownerLabel, scope, ctx, `${block.type}.${block.label}.stages[${index}].nodes[${nodeIndex}]`))) };
122
+ });
123
+ return { refName: scopedLabelToBagKey(ownerLabel, block.label, scope), stages };
124
+ }
@@ -0,0 +1 @@
1
+ export { defineVisualFlow, flowAgentAction, flowApiAction, flowAutomationAction, flowObjectAction, flowObjectTarget, flowUserAction, visualFlowPosition, visualFlowSymbol, type DefineVisualFlowOptions, type VisualFlowAction, type VisualFlowConnection, type VisualFlowNode, type VisualFlowPosition, type VisualFlowStage, type VisualFlowSymbol, type VisualFlowTarget, } from "./build.js";
@@ -0,0 +1 @@
1
+ export { defineVisualFlow, flowAgentAction, flowApiAction, flowAutomationAction, flowObjectAction, flowObjectTarget, flowUserAction, visualFlowPosition, visualFlowSymbol, } from "./build.js";
@@ -0,0 +1,3 @@
1
+ import { type EntityKindModule } from "../../graph/types.js";
2
+ export declare const VISUAL_FLOW_RESOURCE_TYPE = "elementum_flow";
3
+ export declare const visualFlowModule: EntityKindModule;
@@ -0,0 +1,41 @@
1
+ import { NO_CATALOG, NO_DATA } from "../../graph/types.js";
2
+ import { APP_RESOURCE_TYPE } from "../app/module.js";
3
+ import { ELEMENT_RESOURCE_TYPE } from "../element/module.js";
4
+ import { visualFlowFromTf } from "./from-tf.js";
5
+ import { printVisualFlow } from "./printer.js";
6
+ import { visualFlowToTf } from "./to-tf.js";
7
+ export const VISUAL_FLOW_RESOURCE_TYPE = "elementum_flow";
8
+ function extract(blocks, _stream, ctx) {
9
+ const items = [];
10
+ const skipped = [];
11
+ const diagnostics = [];
12
+ if (ctx.parentScope === "table")
13
+ return { items, skipped: blocks.map((block) => `${block.type}.${block.label ?? "?"}`), diagnostics: ["visual flows cannot belong to tables"] };
14
+ const ownerType = ctx.parentScope === "element" ? ELEMENT_RESOURCE_TYPE : APP_RESOURCE_TYPE;
15
+ for (const block of blocks)
16
+ try {
17
+ items.push(visualFlowFromTf(block, ownerType, ctx.appTfLabel, ctx.parentScope, ctx));
18
+ }
19
+ catch (error) {
20
+ skipped.push(`${block.type}.${block.label ?? "?"}`);
21
+ diagnostics.push(error instanceof Error ? error.message : String(error));
22
+ }
23
+ return { items, skipped, diagnostics };
24
+ }
25
+ export const visualFlowModule = {
26
+ kind: "visual-flow", stream: { role: "streamMember" }, authoring: { unit: "ownFile", bag: "visual-flows" },
27
+ parents: [{ parent: "app", child: "visual-flow" }, { parent: "element", child: "visual-flow" }],
28
+ resource: { shape: "single", resourceType: VISUAL_FLOW_RESOURCE_TYPE, adoptable: true }, data: NO_DATA,
29
+ lifecycle: { participates: true, extractOwnFile: extract, printOwnFile: (item, opts) => {
30
+ if (opts.parentScope === "table")
31
+ throw new Error("visual flows cannot belong to tables");
32
+ return {
33
+ refName: item.refName,
34
+ source: printVisualFlow(item, opts.appRefName, opts.parentScope, {
35
+ ...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
36
+ ...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
37
+ }),
38
+ };
39
+ }, toTf: (entity, ctx) => visualFlowToTf(entity, { appRefName: ctx.appRefName, appTfLabel: ctx.appTfLabel, parentScope: ctx.parentScope, orgRefs: ctx.orgRefs, workspaceAspects: ctx.workspaceAspects }) },
40
+ canvas: { participates: true, label: "Visual flow", glyph: "⇢", component: "generic" }, catalog: NO_CATALOG,
41
+ };
@@ -0,0 +1,8 @@
1
+ import type { ChildResourceScope } from "../../engine/tf/index.js";
2
+ import type { NormalizedVisualFlow } from "./from-tf.js";
3
+ interface VisualFlowPrintReferences {
4
+ readonly foreignAppRefNames?: ReadonlyMap<string, string>;
5
+ readonly foreignElementRefNames?: ReadonlyMap<string, string>;
6
+ }
7
+ export declare function printVisualFlow(flow: NormalizedVisualFlow, owner: string, scope: ChildResourceScope, refs?: VisualFlowPrintReferences): string;
8
+ export {};
@@ -0,0 +1,92 @@
1
+ import { quote } from "../../../pull/util.js";
2
+ function member(value) {
3
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value) ? `.${value}` : `[${quote(value)}]`;
4
+ }
5
+ function property(value) {
6
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value) ? value : quote(value);
7
+ }
8
+ function objectExpr(object, refs) {
9
+ const resolved = object.kind === "element"
10
+ ? refs.foreignElementRefNames?.get(object.name)
11
+ : refs.foreignAppRefNames?.get(object.name);
12
+ return `catalog${member(resolved ?? object.refName)}`;
13
+ }
14
+ function actionExpr(action, owner, refs) {
15
+ switch (action.kind) {
16
+ case "agent": return `flowAgentAction(catalog${member(owner)}.agents${member(action.refName)}${action.name !== undefined ? `, ${quote(action.name)}` : ""})`;
17
+ case "automation": return `flowAutomationAction(catalog${member(owner)}.automations${member(action.refName)}${action.name !== undefined ? `, ${quote(action.name)}` : ""})`;
18
+ case "user": return `flowUserAction(${quote(action.name)})`;
19
+ case "api": return `flowApiAction(${quote(action.name)})`;
20
+ case "object": return `flowObjectAction(${objectExpr(action.object, refs)}${action.name !== undefined ? `, ${quote(action.name)}` : ""})`;
21
+ }
22
+ }
23
+ function nodeLines(node, owner, refs) {
24
+ const lines = [
25
+ `symbol: visualFlowSymbol.${node.symbol.toLowerCase()},`,
26
+ `x: ${node.x},`,
27
+ `y: ${node.y},`,
28
+ ];
29
+ if (node.description !== undefined)
30
+ lines.push(`description: ${quote(node.description)},`);
31
+ if (node.sourcePosition !== undefined)
32
+ lines.push(`sourcePosition: visualFlowPosition.${node.sourcePosition.toLowerCase()},`);
33
+ if (node.targetPosition !== undefined)
34
+ lines.push(`targetPosition: visualFlowPosition.${node.targetPosition.toLowerCase()},`);
35
+ if (node.connectsTo !== undefined) {
36
+ lines.push(`connectsTo: [${node.connectsTo.map((connection) => connection.label === undefined ? quote(connection.target) : `{ target: ${quote(connection.target)}, label: ${quote(connection.label)} }`).join(", ")}],`);
37
+ }
38
+ if (node.action !== undefined)
39
+ lines.push(`action: ${actionExpr(node.action, owner, refs)},`);
40
+ if (node.target !== undefined)
41
+ lines.push(`target: flowObjectTarget(${objectExpr(node.target.object, refs)}${node.target.name !== undefined ? `, ${quote(node.target.name)}` : ""}),`);
42
+ return lines;
43
+ }
44
+ export function printVisualFlow(flow, owner, scope, refs = {}) {
45
+ const used = new Set(["defineVisualFlow", "visualFlowSymbol"]);
46
+ for (const stage of flow.stages) {
47
+ for (const node of Object.values(stage.nodes)) {
48
+ if (node.sourcePosition !== undefined || node.targetPosition !== undefined)
49
+ used.add("visualFlowPosition");
50
+ if (node.target !== undefined)
51
+ used.add("flowObjectTarget");
52
+ if (node.action !== undefined) {
53
+ used.add({
54
+ agent: "flowAgentAction",
55
+ automation: "flowAutomationAction",
56
+ user: "flowUserAction",
57
+ api: "flowApiAction",
58
+ object: "flowObjectAction",
59
+ }[node.action.kind]);
60
+ }
61
+ }
62
+ }
63
+ const importOrder = [
64
+ "defineVisualFlow",
65
+ "flowAgentAction",
66
+ "flowApiAction",
67
+ "flowAutomationAction",
68
+ "flowObjectAction",
69
+ "flowObjectTarget",
70
+ "flowUserAction",
71
+ "visualFlowPosition",
72
+ "visualFlowSymbol",
73
+ ];
74
+ const lines = [
75
+ "/** Auto-generated by EDK pull. Hand-edit freely. */",
76
+ `import { ${importOrder.filter((name) => used.has(name)).join(", ")} } from "@elementumai/edk/visualFlows";`,
77
+ 'import catalog from "@catalog";',
78
+ "",
79
+ "export default defineVisualFlow({",
80
+ ` ${scope}: catalog${member(owner)},`,
81
+ " stages: {",
82
+ ];
83
+ for (const stage of flow.stages) {
84
+ lines.push(` ${property(stage.stage)}: {`, " nodes: {");
85
+ for (const [key, node] of Object.entries(stage.nodes)) {
86
+ lines.push(` ${property(key)}: {`, ...nodeLines(node, owner, refs).map((line) => ` ${line}`), " },");
87
+ }
88
+ lines.push(" },", " },");
89
+ }
90
+ lines.push(" },", "});", "");
91
+ return lines.join("\n");
92
+ }
@@ -0,0 +1,14 @@
1
+ import type { OrgRefLookup, WorkspaceAspect } from "../../engine/build/context.js";
2
+ import { type DeployableEntity } from "../../engine/entity.js";
3
+ import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
4
+ export interface VisualFlowToTfContext {
5
+ readonly appRefName: string;
6
+ readonly appTfLabel: string;
7
+ readonly parentScope?: ChildResourceScope | "table";
8
+ readonly orgRefs: OrgRefLookup;
9
+ readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
10
+ }
11
+ export declare function visualFlowToTf(entity: DeployableEntity, ctx: VisualFlowToTfContext): {
12
+ blocks: readonly TfBlock[];
13
+ address: string;
14
+ };