@elementumai/edk 0.8.2-alpha.6 → 0.9.5

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 (481) hide show
  1. package/README.md +49 -37
  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 +3 -11
  6. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
  7. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
  8. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +1 -1
  9. package/dist-sdk/fs/entity.d.ts +2 -2
  10. package/dist-sdk/fs/entity.js +1 -1
  11. package/dist-sdk/pull/missing-report.d.ts +81 -0
  12. package/dist-sdk/pull/missing-report.js +52 -0
  13. package/dist-sdk/pull/util.d.ts +1 -1
  14. package/dist-sdk/pull/util.js +3 -3
  15. package/dist-sdk/src/catalog/factories.d.ts +96 -23
  16. package/dist-sdk/src/catalog/factories.js +141 -21
  17. package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
  18. package/dist-sdk/src/catalog/from-authoring.js +20 -10
  19. package/dist-sdk/src/catalog/index.d.ts +2 -2
  20. package/dist-sdk/src/catalog/index.js +1 -1
  21. package/dist-sdk/src/catalog/org.js +63 -4
  22. package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
  23. package/dist-sdk/src/catalog/render-helpers.js +1 -1
  24. package/dist-sdk/src/catalog/render.d.ts +1 -0
  25. package/dist-sdk/src/catalog/render.js +8 -2
  26. package/dist-sdk/src/catalog/token.js +18 -4
  27. package/dist-sdk/src/catalog/types.d.ts +64 -24
  28. package/dist-sdk/src/catalog/types.js +12 -4
  29. package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
  30. package/dist-sdk/src/core/app-to-ui.js +7 -9
  31. package/dist-sdk/src/core/index.d.ts +11 -10
  32. package/dist-sdk/src/core/index.js +10 -9
  33. package/dist-sdk/src/core/platform-id.d.ts +11 -0
  34. package/dist-sdk/src/core/platform-id.js +8 -0
  35. package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +3 -3
  36. package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +7 -10
  37. package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
  38. package/dist-sdk/src/core/types/ai-provider.js +1 -1
  39. package/dist-sdk/src/core/types/app.d.ts +78 -52
  40. package/dist-sdk/src/core/types/app.js +2 -3
  41. package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
  42. package/dist-sdk/src/core/types/aspect-category.js +4 -4
  43. package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
  44. package/dist-sdk/src/core/types/cloud-link.js +3 -3
  45. package/dist-sdk/src/core/types/display-block.d.ts +2 -2
  46. package/dist-sdk/src/core/types/display-block.js +2 -2
  47. package/dist-sdk/src/core/types/group.d.ts +1 -1
  48. package/dist-sdk/src/core/types/group.js +1 -1
  49. package/dist-sdk/src/core/types/user.d.ts +1 -1
  50. package/dist-sdk/src/core/types/user.js +1 -1
  51. package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
  52. package/dist-sdk/src/engine/build/context.d.ts +23 -16
  53. package/dist-sdk/src/engine/entity.d.ts +1 -1
  54. package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
  55. package/dist-sdk/src/engine/pull/attrs.js +17 -0
  56. package/dist-sdk/src/engine/pull/context.d.ts +73 -0
  57. package/dist-sdk/src/engine/pull/context.js +14 -0
  58. package/dist-sdk/src/engine/pull/org.d.ts +10 -0
  59. package/dist-sdk/src/engine/pull/org.js +35 -0
  60. package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
  61. package/dist-sdk/src/engine/pull/ref-only.js +204 -0
  62. package/dist-sdk/src/engine/tf/expr.d.ts +7 -3
  63. package/dist-sdk/src/engine/tf/expr.js +27 -15
  64. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  65. package/dist-sdk/src/engine/tf/index.js +1 -1
  66. package/dist-sdk/src/engine/tf/model.d.ts +8 -1
  67. package/dist-sdk/src/engine/tf/model.js +4 -0
  68. package/dist-sdk/src/engine/tf/parse.js +13 -2
  69. package/dist-sdk/src/engine/tf/render.js +4 -0
  70. package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
  71. package/dist-sdk/src/entities/access-policy/build.d.ts +6 -16
  72. package/dist-sdk/src/entities/access-policy/build.js +2 -2
  73. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +14 -40
  74. package/dist-sdk/src/entities/access-policy/from-tf.js +26 -85
  75. package/dist-sdk/src/entities/access-policy/principal.d.ts +39 -0
  76. package/dist-sdk/src/entities/access-policy/principal.js +13 -0
  77. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +33 -6
  78. package/dist-sdk/src/entities/access-policy/to-tf.js +62 -60
  79. package/dist-sdk/src/entities/agent/build.d.ts +42 -11
  80. package/dist-sdk/src/entities/agent/build.js +40 -19
  81. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +11 -1
  82. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +180 -45
  83. package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
  84. package/dist-sdk/src/entities/agent/from-tf.js +17 -12
  85. package/dist-sdk/src/entities/agent/index.d.ts +5 -2
  86. package/dist-sdk/src/entities/agent/index.js +4 -2
  87. package/dist-sdk/src/entities/agent/module.js +7 -2
  88. package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
  89. package/dist-sdk/src/entities/agent/run-as.js +1 -0
  90. package/dist-sdk/src/entities/agent/to-tf.d.ts +6 -2
  91. package/dist-sdk/src/entities/agent/to-tf.js +58 -9
  92. package/dist-sdk/src/entities/agent/tools.d.ts +97 -70
  93. package/dist-sdk/src/entities/agent/tools.js +63 -43
  94. package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
  95. package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
  96. package/dist-sdk/src/entities/agent-evaluation/build.d.ts +19 -0
  97. package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
  98. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
  99. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
  100. package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
  101. package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
  102. package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
  103. package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
  104. package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
  105. package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
  106. package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
  107. package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
  108. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +25 -15
  109. package/dist-sdk/src/entities/agent-tool/from-tf.js +175 -43
  110. package/dist-sdk/src/entities/agent-tool/module.js +6 -0
  111. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +15 -7
  112. package/dist-sdk/src/entities/agent-tool/to-tf.js +169 -48
  113. package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -6
  114. package/dist-sdk/src/entities/agent-tool/types.js +30 -29
  115. package/dist-sdk/src/entities/app/build.d.ts +214 -47
  116. package/dist-sdk/src/entities/app/build.js +128 -66
  117. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +188 -8
  118. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
  119. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +70 -0
  120. package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
  121. package/dist-sdk/src/entities/app/display-blocks.js +1 -1
  122. package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
  123. package/dist-sdk/src/entities/app/from-tf.js +30 -2
  124. package/dist-sdk/src/entities/app/index.d.ts +20 -8
  125. package/dist-sdk/src/entities/app/index.js +16 -6
  126. package/dist-sdk/src/entities/app/module.js +29 -4
  127. package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
  128. package/dist-sdk/src/entities/app/to-tf.js +97 -7
  129. package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
  130. package/dist-sdk/src/entities/approval-chain/build.js +49 -49
  131. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
  132. package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
  133. package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
  134. package/dist-sdk/src/entities/approval-chain/index.js +2 -3
  135. package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
  136. package/dist-sdk/src/entities/approval-chain/module.js +51 -0
  137. package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
  138. package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
  139. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
  140. package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
  141. package/dist-sdk/src/entities/automation/build.d.ts +177 -95
  142. package/dist-sdk/src/entities/automation/build.js +164 -72
  143. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
  144. package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
  145. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +18 -9
  146. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
  147. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +214 -311
  148. package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
  149. package/dist-sdk/src/entities/automation/filter.js +1 -197
  150. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -0
  151. package/dist-sdk/src/entities/automation/from-tf.js +695 -182
  152. package/dist-sdk/src/entities/automation/index.d.ts +9 -10
  153. package/dist-sdk/src/entities/automation/index.js +11 -11
  154. package/dist-sdk/src/entities/automation/module.js +82 -8
  155. package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
  156. package/dist-sdk/src/entities/automation/operators.js +10 -37
  157. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
  158. package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
  159. package/dist-sdk/src/entities/automation/script-code.js +107 -28
  160. package/dist-sdk/src/entities/automation/serialize.js +1 -1
  161. package/dist-sdk/src/entities/automation/tasks.d.ts +167 -102
  162. package/dist-sdk/src/entities/automation/tasks.js +66 -13
  163. package/dist-sdk/src/entities/automation/to-tf.d.ts +44 -3
  164. package/dist-sdk/src/entities/automation/to-tf.js +607 -161
  165. package/dist-sdk/src/entities/automation/triggers.d.ts +33 -25
  166. package/dist-sdk/src/entities/automation/triggers.js +8 -2
  167. package/dist-sdk/src/entities/automation/types.d.ts +3 -2
  168. package/dist-sdk/src/entities/automation/types.js +3 -2
  169. package/dist-sdk/src/entities/chart/build.d.ts +95 -0
  170. package/dist-sdk/src/entities/chart/build.js +42 -0
  171. package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
  172. package/dist-sdk/src/entities/chart/from-tf.js +269 -0
  173. package/dist-sdk/src/entities/chart/index.d.ts +4 -0
  174. package/dist-sdk/src/entities/chart/index.js +3 -0
  175. package/dist-sdk/src/entities/chart/module.d.ts +3 -0
  176. package/dist-sdk/src/entities/chart/module.js +61 -0
  177. package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
  178. package/dist-sdk/src/entities/chart/printer.js +104 -0
  179. package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
  180. package/dist-sdk/src/entities/chart/to-tf.js +150 -0
  181. package/dist-sdk/src/entities/chart/types.d.ts +53 -0
  182. package/dist-sdk/src/entities/chart/types.js +22 -0
  183. package/dist-sdk/src/entities/dashboard/build.d.ts +44 -0
  184. package/dist-sdk/src/entities/dashboard/build.js +16 -0
  185. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
  186. package/dist-sdk/src/entities/dashboard/from-tf.js +113 -0
  187. package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
  188. package/dist-sdk/src/entities/dashboard/module.js +16 -0
  189. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +43 -0
  190. package/dist-sdk/src/entities/dashboard/to-tf.js +121 -0
  191. package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
  192. package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
  193. package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
  194. package/dist-sdk/src/entities/data-lookup/module.js +22 -0
  195. package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
  196. package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
  197. package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
  198. package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
  199. package/dist-sdk/src/entities/datamine/module.js +23 -0
  200. package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
  201. package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
  202. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +304 -0
  203. package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
  204. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +4 -0
  205. package/dist-sdk/src/entities/dynamic-layout/dialect.js +47 -0
  206. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
  207. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +239 -0
  208. package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
  209. package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
  210. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
  211. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
  212. package/dist-sdk/src/entities/element/build.d.ts +48 -38
  213. package/dist-sdk/src/entities/element/build.js +24 -33
  214. package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
  215. package/dist-sdk/src/entities/element/from-tf.js +31 -2
  216. package/dist-sdk/src/entities/element/index.d.ts +14 -7
  217. package/dist-sdk/src/entities/element/index.js +11 -5
  218. package/dist-sdk/src/entities/element/module.js +26 -5
  219. package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
  220. package/dist-sdk/src/entities/element/to-tf.js +64 -4
  221. package/dist-sdk/src/entities/field/build.d.ts +55 -27
  222. package/dist-sdk/src/entities/field/build.js +31 -6
  223. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
  224. package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
  225. package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
  226. package/dist-sdk/src/entities/field/calc/date.js +120 -29
  227. package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
  228. package/dist-sdk/src/entities/field/calc/index.js +82 -139
  229. package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
  230. package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
  231. package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
  232. package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
  233. package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
  234. package/dist-sdk/src/entities/field/calc/text.js +43 -31
  235. package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
  236. package/dist-sdk/src/entities/field/calc/types.js +1 -22
  237. package/dist-sdk/src/entities/field/calc.d.ts +71 -48
  238. package/dist-sdk/src/entities/field/calc.js +5 -15
  239. package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
  240. package/dist-sdk/src/entities/field/calculation-types.js +49 -0
  241. package/dist-sdk/src/entities/field/from-tf.js +238 -13
  242. package/dist-sdk/src/entities/field/locals.d.ts +11 -3
  243. package/dist-sdk/src/entities/field/locals.js +15 -2
  244. package/dist-sdk/src/entities/field/module.d.ts +1 -0
  245. package/dist-sdk/src/entities/field/module.js +27 -7
  246. package/dist-sdk/src/entities/field/record-shape.d.ts +25 -11
  247. package/dist-sdk/src/entities/field/to-tf.d.ts +41 -2
  248. package/dist-sdk/src/entities/field/to-tf.js +314 -40
  249. package/dist-sdk/src/entities/field/types.d.ts +1 -1
  250. package/dist-sdk/src/entities/field/types.js +10 -1
  251. package/dist-sdk/src/entities/file-reader/build.d.ts +71 -19
  252. package/dist-sdk/src/entities/file-reader/build.js +49 -4
  253. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
  254. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +12 -10
  255. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
  256. package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
  257. package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
  258. package/dist-sdk/src/entities/file-reader/index.js +3 -3
  259. package/dist-sdk/src/entities/file-reader/module.js +6 -5
  260. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
  261. package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
  262. package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
  263. package/dist-sdk/src/entities/file-reader/types.js +4 -5
  264. package/dist-sdk/src/entities/org/category.js +4 -5
  265. package/dist-sdk/src/entities/org/cloud-link.js +4 -5
  266. package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
  267. package/dist-sdk/src/entities/org/email-alias.js +12 -0
  268. package/dist-sdk/src/entities/org/group.js +4 -5
  269. package/dist-sdk/src/entities/org/index.d.ts +2 -0
  270. package/dist-sdk/src/entities/org/index.js +2 -0
  271. package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
  272. package/dist-sdk/src/entities/org/phone-provider.js +30 -0
  273. package/dist-sdk/src/entities/org/role.d.ts +3 -3
  274. package/dist-sdk/src/entities/org/role.js +9 -6
  275. package/dist-sdk/src/entities/organization/build.d.ts +241 -0
  276. package/dist-sdk/src/entities/organization/build.js +165 -0
  277. package/dist-sdk/src/entities/organization/index.d.ts +2 -0
  278. package/dist-sdk/src/entities/organization/index.js +2 -0
  279. package/dist-sdk/src/entities/organization/module.d.ts +2 -0
  280. package/dist-sdk/src/entities/organization/module.js +21 -0
  281. package/dist-sdk/src/entities/organization/to-tf.d.ts +7 -0
  282. package/dist-sdk/src/entities/organization/to-tf.js +154 -0
  283. package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
  284. package/dist-sdk/src/entities/phone-service/build.js +31 -0
  285. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
  286. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +56 -0
  287. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
  288. package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
  289. package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
  290. package/dist-sdk/src/entities/phone-service/index.js +2 -0
  291. package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
  292. package/dist-sdk/src/entities/phone-service/module.js +55 -0
  293. package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
  294. package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
  295. package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
  296. package/dist-sdk/src/entities/phone-service/types.js +22 -0
  297. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
  298. package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
  299. package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
  300. package/dist-sdk/src/entities/record-create-form/module.js +24 -0
  301. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
  302. package/dist-sdk/src/entities/record-create-form/to-tf.js +88 -0
  303. package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
  304. package/dist-sdk/src/entities/relationship/build.js +1 -0
  305. package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
  306. package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
  307. package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
  308. package/dist-sdk/src/entities/relationship/module.js +16 -0
  309. package/dist-sdk/src/entities/relationship/to-tf.d.ts +32 -0
  310. package/dist-sdk/src/entities/relationship/to-tf.js +145 -0
  311. package/dist-sdk/src/entities/role/build.d.ts +65 -0
  312. package/dist-sdk/src/entities/role/build.js +33 -0
  313. package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
  314. package/dist-sdk/src/entities/role/from-tf.js +138 -0
  315. package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
  316. package/dist-sdk/src/entities/role/to-tf.js +69 -0
  317. package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
  318. package/dist-sdk/src/entities/search-table/build.js +110 -56
  319. package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
  320. package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
  321. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  322. package/dist-sdk/src/entities/search-table/index.js +2 -2
  323. package/dist-sdk/src/entities/search-table/module.js +88 -10
  324. package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
  325. package/dist-sdk/src/entities/search-table/printer.js +52 -0
  326. package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
  327. package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
  328. package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
  329. package/dist-sdk/src/entities/search-table/types.js +21 -0
  330. package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
  331. package/dist-sdk/src/entities/service-account/build.js +9 -0
  332. package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
  333. package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
  334. package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
  335. package/dist-sdk/src/entities/service-account/module.js +21 -0
  336. package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
  337. package/dist-sdk/src/entities/service-account/ref.js +5 -0
  338. package/dist-sdk/src/entities/service-account/to-tf.d.ts +32 -0
  339. package/dist-sdk/src/entities/service-account/to-tf.js +103 -0
  340. package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
  341. package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
  342. package/dist-sdk/src/entities/shared/context.d.ts +25 -24
  343. package/dist-sdk/src/entities/shared/context.js +36 -35
  344. package/dist-sdk/src/entities/shared/filters/ast.d.ts +30 -81
  345. package/dist-sdk/src/entities/shared/filters/ast.js +6 -2
  346. package/dist-sdk/src/entities/shared/filters/index.d.ts +95 -206
  347. package/dist-sdk/src/entities/shared/filters/index.js +196 -341
  348. package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
  349. package/dist-sdk/src/entities/shared/filters/print.js +122 -0
  350. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
  351. package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
  352. package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
  353. package/dist-sdk/src/entities/shared/filters/types.js +2 -3
  354. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +14 -0
  355. package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
  356. package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
  357. package/dist-sdk/src/entities/shared/ref.js +8 -3
  358. package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
  359. package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
  360. package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
  361. package/dist-sdk/src/entities/skill/build.d.ts +4 -4
  362. package/dist-sdk/src/entities/skill/build.js +6 -5
  363. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +11 -1
  364. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +100 -39
  365. package/dist-sdk/src/entities/skill/index.d.ts +3 -2
  366. package/dist-sdk/src/entities/skill/index.js +3 -2
  367. package/dist-sdk/src/entities/skill/module.js +8 -2
  368. package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -2
  369. package/dist-sdk/src/entities/skill/to-tf.js +20 -2
  370. package/dist-sdk/src/entities/skill/tools.d.ts +47 -31
  371. package/dist-sdk/src/entities/skill/tools.js +37 -23
  372. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +17 -1
  373. package/dist-sdk/src/entities/skill-tool/from-tf.js +118 -8
  374. package/dist-sdk/src/entities/skill-tool/module.js +9 -0
  375. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  376. package/dist-sdk/src/entities/skill-tool/to-tf.js +100 -48
  377. package/dist-sdk/src/entities/skill-tool/types.js +18 -1
  378. package/dist-sdk/src/entities/table/build.d.ts +64 -23
  379. package/dist-sdk/src/entities/table/build.js +41 -26
  380. package/dist-sdk/src/entities/table/catalog-render.js +15 -1
  381. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
  382. package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
  383. package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
  384. package/dist-sdk/src/entities/table/fields/types.js +12 -0
  385. package/dist-sdk/src/entities/table/fields.d.ts +107 -47
  386. package/dist-sdk/src/entities/table/fields.js +76 -55
  387. package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
  388. package/dist-sdk/src/entities/table/from-tf.js +261 -0
  389. package/dist-sdk/src/entities/table/index.d.ts +7 -5
  390. package/dist-sdk/src/entities/table/index.js +7 -7
  391. package/dist-sdk/src/entities/table/joins.d.ts +22 -9
  392. package/dist-sdk/src/entities/table/joins.js +8 -16
  393. package/dist-sdk/src/entities/table/module.d.ts +2 -1
  394. package/dist-sdk/src/entities/table/module.js +13 -6
  395. package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
  396. package/dist-sdk/src/entities/table/to-tf.js +222 -0
  397. package/dist-sdk/src/entities/task/build.d.ts +43 -0
  398. package/dist-sdk/src/entities/task/build.js +17 -0
  399. package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
  400. package/dist-sdk/src/entities/task/from-tf.js +38 -0
  401. package/dist-sdk/src/entities/task/index.d.ts +1 -0
  402. package/dist-sdk/src/entities/task/index.js +1 -0
  403. package/dist-sdk/src/entities/task/module.d.ts +3 -0
  404. package/dist-sdk/src/entities/task/module.js +12 -0
  405. package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
  406. package/dist-sdk/src/entities/task/to-tf.js +49 -0
  407. package/dist-sdk/src/entities/view/build.d.ts +46 -0
  408. package/dist-sdk/src/entities/view/build.js +19 -0
  409. package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
  410. package/dist-sdk/src/entities/view/from-tf.js +264 -30
  411. package/dist-sdk/src/entities/view/module.d.ts +6 -13
  412. package/dist-sdk/src/entities/view/module.js +12 -15
  413. package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
  414. package/dist-sdk/src/entities/view/sharing.js +6 -0
  415. package/dist-sdk/src/entities/view/to-tf.d.ts +56 -12
  416. package/dist-sdk/src/entities/view/to-tf.js +192 -20
  417. package/dist-sdk/src/entities/view/types.d.ts +8 -0
  418. package/dist-sdk/src/entities/view/types.js +46 -0
  419. package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
  420. package/dist-sdk/src/entities/visual-flow/build.js +72 -0
  421. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
  422. package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
  423. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
  424. package/dist-sdk/src/entities/visual-flow/index.js +1 -0
  425. package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
  426. package/dist-sdk/src/entities/visual-flow/module.js +41 -0
  427. package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
  428. package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
  429. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +15 -0
  430. package/dist-sdk/src/entities/visual-flow/to-tf.js +97 -0
  431. package/dist-sdk/src/entities/widget/build.d.ts +55 -0
  432. package/dist-sdk/src/entities/widget/build.js +1 -0
  433. package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
  434. package/dist-sdk/src/entities/widget/from-tf.js +209 -0
  435. package/dist-sdk/src/entities/widget/module.d.ts +3 -0
  436. package/dist-sdk/src/entities/widget/module.js +16 -0
  437. package/dist-sdk/src/entities/widget/to-tf.d.ts +45 -0
  438. package/dist-sdk/src/entities/widget/to-tf.js +206 -0
  439. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
  440. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
  441. package/dist-sdk/src/graph/index.d.ts +12 -1
  442. package/dist-sdk/src/graph/index.js +8 -19
  443. package/dist-sdk/src/graph/modules.js +35 -1
  444. package/dist-sdk/src/graph/types.d.ts +106 -7
  445. package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
  446. package/dist-sdk/src/internal/safe-identifier.js +13 -0
  447. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  448. package/dist-sdk/src/internal/sdk-package.js +5 -2
  449. package/package.json +39 -15
  450. package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
  451. package/dist-sdk/src/entities/access-policy/filter.js +0 -83
  452. package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
  453. package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
  454. package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
  455. package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
  456. package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
  457. package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
  458. package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
  459. package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
  460. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
  461. package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
  462. package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
  463. package/dist-sdk/src/entities/flow/activities/form.js +0 -36
  464. package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
  465. package/dist-sdk/src/entities/flow/activities/index.js +0 -13
  466. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
  467. package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
  468. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
  469. package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
  470. package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
  471. package/dist-sdk/src/entities/flow/build.d.ts +0 -38
  472. package/dist-sdk/src/entities/flow/build.js +0 -115
  473. package/dist-sdk/src/entities/flow/index.d.ts +0 -8
  474. package/dist-sdk/src/entities/flow/index.js +0 -7
  475. package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
  476. package/dist-sdk/src/entities/flow/serialize.js +0 -94
  477. package/dist-sdk/src/entities/flow/util.d.ts +0 -27
  478. package/dist-sdk/src/entities/flow/util.js +0 -38
  479. package/dist-sdk/src/entities/table/filter.d.ts +0 -41
  480. package/dist-sdk/src/entities/table/filter.js +0 -89
  481. /package/dist-sdk/src/entities/{flow/activities/types.js → datamine/build.js} +0 -0
@@ -5,26 +5,41 @@
5
5
  * and supplies the `objectId` back-reference — this module never names the
6
6
  * app's own resource type.
7
7
  *
8
- * Unsupported authoring shapes degrade through `diagnostics` — reported,
9
- * never silent. `children`-shaped structural breakage isn't possible here
10
- * (views have no nested sub-entities of their own), so this module never
11
- * throws `EntityTfError`.
8
+ * Unsupported structural view shapes degrade through `diagnostics` —
9
+ * reported, never silent. Invalid authored filter trees fail at build time
10
+ * with the same `EntityTfError` path used by access-policy row filters.
12
11
  */
13
12
  import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
14
13
  import { fieldRefToTfValue as customFieldRefToTfValue } from "../field/to-tf.js";
14
+ import { filterToTf, principalListToTf } from "../access-policy/to-tf.js";
15
15
  import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
16
- import { GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
16
+ import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
17
+ import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
17
18
  /** Elements only have `id`/`title` as real system fields (no status/stage/audit fields) — see `element/locals.ts`. */
18
19
  const ELEMENT_SYSTEM_FIELD_KEYS = new Set(["id", "title"]);
20
+ function appendViewSharingAttrs(attrs, view, where, ctx) {
21
+ const userIds = principalListToTf(view.userIds, "elementum_user", `${where}.userIds`, ctx);
22
+ const groupIds = principalListToTf(view.groupIds, "elementum_group", `${where}.groupIds`, ctx);
23
+ if (userIds !== undefined)
24
+ attrs["user_ids"] = userIds;
25
+ if (groupIds !== undefined)
26
+ attrs["group_ids"] = groupIds;
27
+ }
19
28
  /** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
20
- export function viewToTf(layouts, listViews, viewOrder, opts) {
21
- const { ownerTfLabel, scope = "app", aspectName, objectId, diagnostics } = opts;
29
+ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder, opts) {
30
+ const { ownerRefName, ownerTfLabel, scope = "app", aspectName, objectId, diagnostics } = opts;
31
+ const principalCtx = { ...opts, scope, objectId };
22
32
  const blocks = [];
23
33
  for (const [stageKey, layout] of Object.entries(layouts ?? {})) {
24
34
  if (!isCanonicalTsLabel(stageKey)) {
25
35
  diagnostics.push(`layouts key "${stageKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
26
36
  continue;
27
37
  }
38
+ const stageTfLabel = tsLabelToTfLabel(stageKey);
39
+ if (opts.stageTfLabels !== undefined && !opts.stageTfLabels.has(stageTfLabel)) {
40
+ diagnostics.push(`layouts.${stageKey} has no matching authored stage option; dropped`);
41
+ continue;
42
+ }
28
43
  blocks.push(layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics));
29
44
  }
30
45
  const viewAddressByKey = new Map();
@@ -34,42 +49,173 @@ export function viewToTf(layouts, listViews, viewOrder, opts) {
34
49
  continue;
35
50
  }
36
51
  const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
52
+ const where = `listViews.${viewKey}`;
37
53
  const attrs = {
38
54
  aspect_id: objectId,
39
55
  name: view.name ?? "",
40
56
  allow_record_creation: view.allowRecordCreation ?? true,
41
- columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `listViews.${viewKey}.columns`, diagnostics),
57
+ columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics),
42
58
  density: view.density ?? "STANDARD",
43
59
  rows: view.rows ?? 25,
44
60
  };
45
- if (view.filter !== undefined)
46
- attrs.filter = expr.jsonencode(view.filter);
61
+ if (view.filter !== undefined) {
62
+ attrs.filter = filterToTf(view.filter, `${where}.filter`, {
63
+ ownerTfLabel,
64
+ scope,
65
+ objectId,
66
+ diagnostics,
67
+ });
68
+ }
47
69
  if (view.sort !== undefined)
48
- attrs.sort = expr.jsonencode(view.sort);
70
+ attrs.sort = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics);
71
+ appendViewSharingAttrs(attrs, view, where, principalCtx);
49
72
  blocks.push({ kind: "resource", type: LIST_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
50
- viewAddressByKey.set(viewKey, tfLabel);
73
+ viewAddressByKey.set(viewKey, { type: LIST_VIEW_RESOURCE_TYPE, label: tfLabel });
74
+ }
75
+ for (const [bagName, resourceType, views] of [
76
+ ["calendarViews", CALENDAR_VIEW_RESOURCE_TYPE, calendarViews],
77
+ ["kanbanViews", KANBAN_VIEW_RESOURCE_TYPE, kanbanViews],
78
+ ]) {
79
+ for (const [viewKey, view] of Object.entries(views ?? {})) {
80
+ if (!isCanonicalTsLabel(viewKey)) {
81
+ diagnostics.push(`${bagName} key "${viewKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
82
+ continue;
83
+ }
84
+ if (viewAddressByKey.has(viewKey)) {
85
+ diagnostics.push(`${bagName}.${viewKey} collides with another view using that key; dropped`);
86
+ continue;
87
+ }
88
+ const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
89
+ const where = `${bagName}.${viewKey}`;
90
+ const attrs = {
91
+ aspect_id: objectId,
92
+ name: view.name ?? "",
93
+ allow_record_creation: view.allowRecordCreation ?? true,
94
+ columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics),
95
+ };
96
+ if (view.displayByField !== undefined) {
97
+ const displayBy = fieldRefToTfValue(view.displayByField, ownerTfLabel, scope, `${where}.displayByField`, diagnostics);
98
+ if (displayBy !== undefined)
99
+ attrs["display_by_field"] = displayBy;
100
+ }
101
+ if (resourceType === KANBAN_VIEW_RESOURCE_TYPE) {
102
+ const allowed = view.allowedFilterFields;
103
+ if (allowed !== undefined) {
104
+ attrs["allowed_filter_fields"] = resolveFieldRefs(allowed, ownerTfLabel, scope, `${where}.allowedFilterFields`, diagnostics);
105
+ }
106
+ }
107
+ if (view.filter !== undefined)
108
+ attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
109
+ if (view.sort !== undefined)
110
+ attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics);
111
+ appendViewSharingAttrs(attrs, view, where, principalCtx);
112
+ blocks.push({ kind: "resource", type: resourceType, label: tfLabel, attrs });
113
+ viewAddressByKey.set(viewKey, { type: resourceType, label: tfLabel });
114
+ }
115
+ }
116
+ for (const [viewKey, view] of Object.entries(dashboardViews ?? {})) {
117
+ if (!isCanonicalTsLabel(viewKey)) {
118
+ diagnostics.push(`dashboardViews key "${viewKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
119
+ continue;
120
+ }
121
+ if (viewAddressByKey.has(viewKey)) {
122
+ diagnostics.push(`dashboardViews.${viewKey} collides with another view using that key; dropped`);
123
+ continue;
124
+ }
125
+ if (typeof view.dashboard === "string") {
126
+ diagnostics.push(`dashboardViews.${viewKey}.dashboard must be a typed dashboard ref; dropped`);
127
+ continue;
128
+ }
129
+ if (view.dashboard?.__kind !== "dashboard" || view.dashboard.parent !== opts.ownerRefName) {
130
+ diagnostics.push(`dashboardViews.${viewKey}.dashboard must reference a dashboard owned by ${JSON.stringify(opts.ownerRefName)}; dropped`);
131
+ continue;
132
+ }
133
+ const dashboardKey = view.dashboard.refName ?? "";
134
+ if (!isCanonicalTsLabel(dashboardKey)) {
135
+ diagnostics.push(`dashboardViews.${viewKey}.dashboard is not a declared canonical dashboard key; dropped`);
136
+ continue;
137
+ }
138
+ if (opts.dashboardKeys !== undefined && !opts.dashboardKeys.has(dashboardKey)) {
139
+ diagnostics.push(`dashboardViews.${viewKey}.dashboard references missing dashboards.${dashboardKey}; dropped`);
140
+ continue;
141
+ }
142
+ const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
143
+ const attrs = {
144
+ aspect_id: objectId,
145
+ name: view.name ?? "",
146
+ dashboard_id: expr.resourceAttr(DASHBOARD_RESOURCE_TYPE, scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(dashboardKey), scope), ["id"]),
147
+ allow_record_creation: view.allowRecordCreation ?? true,
148
+ };
149
+ if (view.filter !== undefined)
150
+ attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
151
+ if (view.sort !== undefined)
152
+ attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `dashboardViews.${viewKey}.sort`, diagnostics);
153
+ appendViewSharingAttrs(attrs, view, `dashboardViews.${viewKey}`, principalCtx);
154
+ blocks.push({ kind: "resource", type: DASHBOARD_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
155
+ viewAddressByKey.set(viewKey, { type: DASHBOARD_VIEW_RESOURCE_TYPE, label: tfLabel });
156
+ }
157
+ for (const [viewKey, view] of Object.entries(agentViews ?? {})) {
158
+ if (!isCanonicalTsLabel(viewKey)) {
159
+ diagnostics.push(`agentViews key "${viewKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
160
+ continue;
161
+ }
162
+ if (viewAddressByKey.has(viewKey)) {
163
+ diagnostics.push(`agentViews.${viewKey} collides with listViews.${viewKey}; dropped`);
164
+ continue;
165
+ }
166
+ const agentRefName = view.agent?.refName ?? "";
167
+ if (agentRefName === "") {
168
+ diagnostics.push(`agentViews.${viewKey} has no agent token; dropped`);
169
+ continue;
170
+ }
171
+ if (view.agent?.parent !== ownerRefName) {
172
+ diagnostics.push(`agentViews.${viewKey} targets an agent outside this app; dropped`);
173
+ continue;
174
+ }
175
+ const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
176
+ const attrs = {
177
+ aspect_id: objectId,
178
+ agent_id: expr.resourceAttr("elementum_agent", scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(agentRefName), scope), ["id"]),
179
+ name: view.name ?? "",
180
+ allow_record_creation: view.allowRecordCreation ?? true,
181
+ };
182
+ if (view.filter !== undefined)
183
+ attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
184
+ if (view.sort !== undefined)
185
+ attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `agentViews.${viewKey}.sort`, diagnostics);
186
+ appendViewSharingAttrs(attrs, view, `agentViews.${viewKey}`, principalCtx);
187
+ if (view.displayOrder !== undefined)
188
+ attrs["display_order"] = view.displayOrder;
189
+ blocks.push({ kind: "resource", type: AGENT_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
190
+ viewAddressByKey.set(viewKey, { type: AGENT_VIEW_RESOURCE_TYPE, label: tfLabel });
51
191
  }
52
192
  if (viewAddressByKey.size > 0) {
53
- const orderKeys = viewOrder ?? Object.keys(listViews ?? {});
193
+ const orderKeys = viewOrder ?? [
194
+ ...Object.keys(listViews ?? {}),
195
+ ...Object.keys(calendarViews ?? {}),
196
+ ...Object.keys(kanbanViews ?? {}),
197
+ ...Object.keys(dashboardViews ?? {}),
198
+ ...Object.keys(agentViews ?? {}),
199
+ ];
54
200
  const placed = new Set();
55
201
  const viewIds = [];
56
202
  for (const key of orderKeys) {
57
- const tfLabel = viewAddressByKey.get(key);
58
- if (tfLabel === undefined) {
59
- diagnostics.push(`viewOrder: "${key}" is not a declared listViews key; dropped`);
203
+ const address = viewAddressByKey.get(key);
204
+ if (address === undefined) {
205
+ diagnostics.push(`viewOrder: "${key}" is not a declared view key; dropped`);
60
206
  continue;
61
207
  }
62
208
  placed.add(key);
63
- viewIds.push(expr.resourceAttr(LIST_VIEW_RESOURCE_TYPE, tfLabel, ["id"]));
209
+ viewIds.push(expr.resourceAttr(address.type, address.label, ["id"]));
64
210
  }
65
211
  // Every declared list view must appear even if viewOrder omitted it —
66
212
  // otherwise the omitted view has no ordering entry and the platform
67
213
  // may reject or silently exclude it from the managed order.
68
- for (const [key, tfLabel] of viewAddressByKey) {
214
+ for (const [key, address] of viewAddressByKey) {
69
215
  if (placed.has(key))
70
216
  continue;
71
- diagnostics.push(`listViews.${key} is not listed in viewOrder; appended`);
72
- viewIds.push(expr.resourceAttr(LIST_VIEW_RESOURCE_TYPE, tfLabel, ["id"]));
217
+ diagnostics.push(`view "${key}" is not listed in viewOrder; appended`);
218
+ viewIds.push(expr.resourceAttr(address.type, address.label, ["id"]));
73
219
  }
74
220
  if (viewIds.length > 0) {
75
221
  blocks.push({
@@ -82,6 +228,20 @@ export function viewToTf(layouts, listViews, viewOrder, opts) {
82
228
  }
83
229
  return { blocks };
84
230
  }
231
+ function managedViewSortToTf(sort, ownerTfLabel, scope, where, diagnostics) {
232
+ const orders = [];
233
+ for (const [index, order] of sort.orders.entries()) {
234
+ const field = fieldRefToTfValue(order.field, ownerTfLabel, scope, `${where}.orders[${index}].field`, diagnostics);
235
+ if (field === undefined)
236
+ continue;
237
+ orders.push({
238
+ field,
239
+ aggregation: order.aggregation ?? null,
240
+ direction: order.direction,
241
+ });
242
+ }
243
+ return expr.jsonencode({ orders });
244
+ }
85
245
  function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics) {
86
246
  const sections = [];
87
247
  for (const section of layout.sections) {
@@ -109,6 +269,8 @@ function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics
109
269
  sec.icon = section.icon;
110
270
  if (section.color !== undefined)
111
271
  sec.color = section.color;
272
+ if (section.maxColumns !== undefined)
273
+ sec.max_columns = section.maxColumns;
112
274
  const where = `layouts.${stageKey} section "${section.name ?? ""}"`;
113
275
  const fields = (section.fields ?? []).filter((f) => {
114
276
  if (typeof f === "string" && LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS.has(f)) {
@@ -152,6 +314,12 @@ function resolveFieldRefs(refs, ownerTfLabel, scope, where, diagnostics) {
152
314
  return out;
153
315
  }
154
316
  function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics) {
317
+ if (typeof ref === "object" && ref !== null && "__unsafe" in ref) {
318
+ if (ref.__unsafe === "platformId")
319
+ return ref.value;
320
+ diagnostics.push(`${where}: unsafe field id has an unrecognized shape; dropped`);
321
+ return undefined;
322
+ }
155
323
  if (typeof ref === "string") {
156
324
  if (scope === "element" && !ELEMENT_SYSTEM_FIELD_KEYS.has(ref)) {
157
325
  diagnostics.push(`${where}: "${ref}" is not a known system field key on an element; dropped`);
@@ -164,6 +332,10 @@ function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics) {
164
332
  }
165
333
  return expr.local(`${ownerTfLabel}_${attr}`);
166
334
  }
335
+ if (ref == null) {
336
+ diagnostics.push(`${where}: field reference is unresolved (skipped during extract); dropped`);
337
+ return undefined;
338
+ }
167
339
  const refName = ref.refName ?? "";
168
340
  if (!SUB_TYPE_BY_AUTHORING_TYPE.has(ref.fieldType ?? "")) {
169
341
  diagnostics.push(`${where}: field "${refName}" (type ${ref.fieldType ?? "?"}) has no terraform field resource mapping; dropped`);
@@ -12,6 +12,10 @@
12
12
  */
13
13
  export declare const LAYOUT_RESOURCE_TYPE = "elementum_layout";
14
14
  export declare const LIST_VIEW_RESOURCE_TYPE = "elementum_list_view";
15
+ export declare const AGENT_VIEW_RESOURCE_TYPE = "elementum_agent_view";
16
+ export declare const CALENDAR_VIEW_RESOURCE_TYPE = "elementum_calendar_view";
17
+ export declare const KANBAN_VIEW_RESOURCE_TYPE = "elementum_kanban_view";
18
+ export declare const DASHBOARD_VIEW_RESOURCE_TYPE = "elementum_dashboard_view";
15
19
  export declare const MANAGED_VIEW_ORDER_RESOURCE_TYPE = "elementum_managed_view_order";
16
20
  /**
17
21
  * Layout section `type` discriminator: authoring camelCase ↔ the provider's
@@ -54,5 +58,9 @@ export declare const KNOWN_LAYOUT_ATTRS: ReadonlySet<string>;
54
58
  export declare const KNOWN_LAYOUT_SECTION_ATTRS: ReadonlySet<string>;
55
59
  /** Attributes `listViewFromTf` understands. */
56
60
  export declare const KNOWN_LIST_VIEW_ATTRS: ReadonlySet<string>;
61
+ export declare const KNOWN_AGENT_VIEW_ATTRS: ReadonlySet<string>;
62
+ export declare const KNOWN_CALENDAR_VIEW_ATTRS: ReadonlySet<string>;
63
+ export declare const KNOWN_KANBAN_VIEW_ATTRS: ReadonlySet<string>;
64
+ export declare const KNOWN_DASHBOARD_VIEW_ATTRS: ReadonlySet<string>;
57
65
  /** Attributes `managedViewOrderFromTf` understands. */
58
66
  export declare const KNOWN_MANAGED_VIEW_ORDER_ATTRS: ReadonlySet<string>;
@@ -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
@@ -71,6 +75,7 @@ export const KNOWN_LAYOUT_SECTION_ATTRS = new Set([
71
75
  "name",
72
76
  "icon",
73
77
  "color",
78
+ "max_columns",
74
79
  "field_ids",
75
80
  "modules",
76
81
  ]);
@@ -84,6 +89,47 @@ export const KNOWN_LIST_VIEW_ATTRS = new Set([
84
89
  "rows",
85
90
  "filter",
86
91
  "sort",
92
+ "user_ids",
93
+ "group_ids",
94
+ ]);
95
+ export const KNOWN_AGENT_VIEW_ATTRS = new Set([
96
+ "aspect_id",
97
+ "agent_id",
98
+ "name",
99
+ "allow_record_creation",
100
+ "filter",
101
+ "sort",
102
+ "user_ids",
103
+ "group_ids",
104
+ "display_order",
105
+ ]);
106
+ const COMMON_TYPED_VIEW_ATTRS = [
107
+ "aspect_id",
108
+ "name",
109
+ "allow_record_creation",
110
+ "columns",
111
+ "display_by_field",
112
+ "filter",
113
+ "sort",
114
+ "user_ids",
115
+ "group_ids",
116
+ "display_order",
117
+ ];
118
+ export const KNOWN_CALENDAR_VIEW_ATTRS = new Set(COMMON_TYPED_VIEW_ATTRS);
119
+ export const KNOWN_KANBAN_VIEW_ATTRS = new Set([
120
+ ...COMMON_TYPED_VIEW_ATTRS,
121
+ "allowed_filter_fields",
122
+ ]);
123
+ export const KNOWN_DASHBOARD_VIEW_ATTRS = new Set([
124
+ "aspect_id",
125
+ "name",
126
+ "dashboard_id",
127
+ "allow_record_creation",
128
+ "filter",
129
+ "sort",
130
+ "user_ids",
131
+ "group_ids",
132
+ "display_order",
87
133
  ]);
88
134
  /** Attributes `managedViewOrderFromTf` understands. */
89
135
  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 visualFlow(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 visualFlow(opts) {
34
+ const owner = opts.app;
35
+ if (owner?.__kind !== "app") {
36
+ throw new EdkValidationError("visualFlow requires an app owner because elements do not expose stages.");
37
+ }
38
+ if (Object.keys(opts.stages).length === 0)
39
+ throw new EdkValidationError("visualFlow requires at least one stage.");
40
+ for (const [stageKey, stage] of Object.entries(opts.stages)) {
41
+ if (stageKey.trim() === "")
42
+ throw new EdkValidationError("visualFlow 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(`visualFlow 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(`visualFlow 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(`visualFlow 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(`visualFlow 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;