@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
@@ -0,0 +1,239 @@
1
+ import { dataRefLabel, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
2
+ import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
3
+ import { fieldKeyFromTfRef } from "../field/from-tf.js";
4
+ import { DYNAMIC_LAYOUT_RESOURCE_TYPE } from "./module.js";
5
+ import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY, } from "./dialect.js";
6
+ const KNOWN_ATTRS = new Set([
7
+ "app_id", "stage_id", "name", "description", "active", "document_id", "document_version",
8
+ "root_component", "components", "conditions", "save_groups", "field_validations", "dependencies",
9
+ "metadata", "version", "created_at", "updated_at",
10
+ ]);
11
+ export function dynamicLayoutsFromTf(blocks, owner, ctx) {
12
+ const out = [];
13
+ for (const block of blocks) {
14
+ const entry = dynamicLayoutFromTf(block, owner, ctx);
15
+ if (entry !== undefined)
16
+ out.push(entry);
17
+ }
18
+ return out;
19
+ }
20
+ function dynamicLayoutFromTf(block, owner, ctx) {
21
+ const where = `${DYNAMIC_LAYOUT_RESOURCE_TYPE}.${block.label ?? "?"}`;
22
+ for (const key of Object.keys(block.attrs)) {
23
+ if (!KNOWN_ATTRS.has(key))
24
+ ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — extend dynamic-layout extraction`);
25
+ }
26
+ if (resourceRefLabel(block.attrs["app_id"], owner.type) !== owner.label) {
27
+ ctx.diagnostics.push(`${where}: app_id does not reference ${owner.type}.${owner.label}; skipped`);
28
+ return undefined;
29
+ }
30
+ const componentsRaw = plainObject(block.attrs["components"]);
31
+ if (componentsRaw === undefined) {
32
+ ctx.diagnostics.push(`${where}: components is not an object; skipped`);
33
+ return undefined;
34
+ }
35
+ const resolvedStageKey = stageKey(block.attrs["stage_id"], owner);
36
+ if (block.attrs["stage_id"] !== undefined && resolvedStageKey === undefined) {
37
+ ctx.diagnostics.push(`${where}: stage_id has an unrecognized shape; layout kept unscoped instead of guessing`);
38
+ }
39
+ const layout = {
40
+ name: optionalString(block.attrs, "name", where, ctx) ?? "",
41
+ ...(typeof block.attrs["description"] === "string" && { description: block.attrs["description"] }),
42
+ ...(typeof block.attrs["active"] === "boolean" && { active: block.attrs["active"] }),
43
+ ...(resolvedStageKey !== undefined && { stage: resolvedStageKey }),
44
+ documentId: optionalString(block.attrs, "document_id", where, ctx) ?? "",
45
+ ...(typeof block.attrs["document_version"] === "string" && { documentVersion: block.attrs["document_version"] }),
46
+ rootComponent: optionalString(block.attrs, "root_component", where, ctx) ?? "",
47
+ components: componentMap(componentsRaw, owner, ctx, where),
48
+ };
49
+ const conditions = plainObject(block.attrs["conditions"]);
50
+ if (conditions !== undefined)
51
+ layout["conditions"] = conditionMap(conditions, owner, ctx, where);
52
+ const saveGroups = plainObject(block.attrs["save_groups"]);
53
+ if (saveGroups !== undefined)
54
+ layout["saveGroups"] = saveGroupMap(saveGroups, owner, ctx, where);
55
+ if (Array.isArray(block.attrs["field_validations"])) {
56
+ layout["fieldValidations"] = block.attrs["field_validations"].map((v, i) => fieldValidation(plainObject(v) ?? {}, owner, ctx, `${where}.field_validations[${i}]`));
57
+ }
58
+ if (Array.isArray(block.attrs["dependencies"])) {
59
+ layout["dependencies"] = block.attrs["dependencies"].map((v, i) => dependency(plainObject(v) ?? {}, owner, ctx, `${where}.dependencies[${i}]`));
60
+ }
61
+ const metadata = plainObject(block.attrs["metadata"]);
62
+ if (metadata !== undefined)
63
+ layout["metadata"] = camelObject(metadata);
64
+ return {
65
+ key: scopedLabelToBagKey(owner.ownerTfLabel, block.label ?? "", "app"),
66
+ layout,
67
+ };
68
+ }
69
+ function componentMap(values, owner, ctx, where) {
70
+ const out = {};
71
+ for (const [id, raw] of Object.entries(values)) {
72
+ const component = camelObject(plainObject(raw) ?? {});
73
+ for (const [publicKey, wireKey] of DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY) {
74
+ const field = plainUnknownObject(component[wireKey]);
75
+ if (field === undefined)
76
+ continue;
77
+ if (field["fieldId"] !== undefined) {
78
+ field["field"] = fieldKey(field["fieldId"], owner, ctx, `${where}.components.${id}.${publicKey}`);
79
+ delete field["fieldId"];
80
+ }
81
+ if (publicKey !== wireKey) {
82
+ component[publicKey] = field;
83
+ delete component[wireKey];
84
+ }
85
+ }
86
+ const update = plainUnknownObject(component["updateBlock"]);
87
+ if (update !== undefined && Array.isArray(update["fieldIds"])) {
88
+ update["fields"] = update["fieldIds"].flatMap((v) => {
89
+ const key = fieldKey(v, owner, ctx, `${where}.components.${id}.updateBlock`);
90
+ return key === undefined ? [] : [key];
91
+ });
92
+ delete update["fieldIds"];
93
+ }
94
+ const automation = plainUnknownObject(component["automationButton"]);
95
+ if (automation !== undefined && automation["automationId"] !== undefined) {
96
+ const label = resourceRefLabel(automation["automationId"], "elementum_automation");
97
+ if (label !== undefined) {
98
+ automation["automation"] = pulledRef("automation", scopedLabelToBagKey(owner.ownerTfLabel, label, "app"), owner.ownerRefName);
99
+ }
100
+ else
101
+ ctx.diagnostics.push(`${where}.components.${id}.automationButton: automation_id is not a managed automation ref; dropped`);
102
+ delete automation["automationId"];
103
+ }
104
+ const create = plainUnknownObject(component["createButton"]);
105
+ if (create !== undefined && create["targetAspectId"] !== undefined) {
106
+ const ref = aspectRef(create["targetAspectId"], owner, ctx);
107
+ if (ref !== undefined)
108
+ create["target"] = ref;
109
+ else
110
+ ctx.diagnostics.push(`${where}.components.${id}.createButton: target_aspect_id is not resolvable; dropped`);
111
+ delete create["targetAspectId"];
112
+ }
113
+ out[id] = component;
114
+ }
115
+ return out;
116
+ }
117
+ function conditionMap(values, owner, ctx, where) {
118
+ const out = {};
119
+ for (const [id, raw] of Object.entries(values)) {
120
+ const condition = camelObject(plainObject(raw) ?? {});
121
+ for (const key of DYNAMIC_LAYOUT_COMPARISON_KEYS) {
122
+ const comparison = plainUnknownObject(condition[key]);
123
+ if (comparison === undefined || comparison["fieldId"] === undefined)
124
+ continue;
125
+ comparison["field"] = fieldKey(comparison["fieldId"], owner, ctx, `${where}.conditions.${id}.${key}`);
126
+ delete comparison["fieldId"];
127
+ const value = plainUnknownObject(comparison["value"]);
128
+ const stringValue = value?.["string"];
129
+ if (value !== undefined && stringValue !== undefined && isTfExpr(stringValue) && stringValue.$expr === "local") {
130
+ const segment = stringValue.path[0];
131
+ if (stringValue.path.length === 1 && typeof segment === "object" && segment !== null && "index" in segment) {
132
+ value["string"] = segment.index;
133
+ }
134
+ }
135
+ }
136
+ const stage = plainUnknownObject(condition["stage"]);
137
+ if (stage !== undefined && stage["stageId"] !== undefined) {
138
+ const key = stageKey(stage["stageId"], owner);
139
+ if (key !== undefined)
140
+ stage["stage"] = key;
141
+ delete stage["stageId"];
142
+ }
143
+ out[id] = condition;
144
+ }
145
+ return out;
146
+ }
147
+ function saveGroupMap(values, owner, ctx, where) {
148
+ const out = {};
149
+ for (const [id, raw] of Object.entries(values)) {
150
+ const group = camelObject(plainObject(raw) ?? {});
151
+ if (Array.isArray(group["fieldIds"])) {
152
+ group["fields"] = group["fieldIds"].flatMap((v) => {
153
+ const key = fieldKey(v, owner, ctx, `${where}.saveGroups.${id}`);
154
+ return key === undefined ? [] : [key];
155
+ });
156
+ delete group["fieldIds"];
157
+ }
158
+ if (Array.isArray(group["validations"])) {
159
+ group["validations"] = group["validations"].map((v, i) => fieldValidation(plainUnknownObject(v) ?? {}, owner, ctx, `${where}.saveGroups.${id}.validations[${i}]`));
160
+ }
161
+ out[id] = group;
162
+ }
163
+ return out;
164
+ }
165
+ function fieldValidation(value, owner, ctx, where) {
166
+ const out = camelObject(value);
167
+ if (out["fieldId"] !== undefined)
168
+ out["field"] = fieldKey(out["fieldId"], owner, ctx, where);
169
+ delete out["fieldId"];
170
+ return out;
171
+ }
172
+ function dependency(value, owner, ctx, where) {
173
+ const out = camelObject(value);
174
+ if (out["sourceFieldId"] !== undefined)
175
+ out["sourceField"] = fieldKey(out["sourceFieldId"], owner, ctx, where);
176
+ if (out["targetFieldId"] !== undefined)
177
+ out["targetField"] = fieldKey(out["targetFieldId"], owner, ctx, where);
178
+ delete out["sourceFieldId"];
179
+ delete out["targetFieldId"];
180
+ return out;
181
+ }
182
+ function fieldKey(value, owner, ctx, where) {
183
+ const key = fieldKeyFromTfRef(value, owner.ownerTfLabel, "app");
184
+ if (key === undefined)
185
+ ctx.diagnostics.push(`${where}: field reference is not resolvable; dropped`);
186
+ return key;
187
+ }
188
+ function stageKey(value, owner) {
189
+ if (value === undefined || !isTfExpr(value))
190
+ return undefined;
191
+ if (value.$expr === "resource-attr" && value.type === owner.type && value.label === owner.label && value.path[0] === "stage_ids_by_key") {
192
+ const segment = value.path[1];
193
+ if (value.path.length === 2 && typeof segment === "object" && segment !== null && "index" in segment)
194
+ return tfLabelToTsLabel(segment.index);
195
+ }
196
+ if (value.$expr === "local" && value.name === `${owner.ownerTfLabel}_stage_ids_by_key`) {
197
+ const segment = value.path[0];
198
+ if (value.path.length === 1 && typeof segment === "object" && segment !== null && "index" in segment)
199
+ return tfLabelToTsLabel(segment.index);
200
+ }
201
+ return undefined;
202
+ }
203
+ function aspectRef(value, owner, ctx) {
204
+ if (resourceRefLabel(value, owner.type) === owner.label)
205
+ return pulledRef("app", owner.ownerRefName);
206
+ for (const [type, kind] of [["elementum_app", "app"], ["elementum_element", "element"]]) {
207
+ const resourceLabel = resourceRefLabel(value, type);
208
+ if (resourceLabel !== undefined)
209
+ return pulledRef(kind, tfLabelToTsLabel(resourceLabel));
210
+ const dataLabel = dataRefLabel(value, type);
211
+ if (dataLabel !== undefined)
212
+ return pulledRef(kind, tfLabelToTsLabel(dataLabel), undefined, ctx.dataName(type, dataLabel));
213
+ }
214
+ return undefined;
215
+ }
216
+ function pulledRef(kind, key, parent, name) {
217
+ return { __pulledRef: kind, key, ...(parent !== undefined && { parent }), ...(name !== undefined && { name }) };
218
+ }
219
+ function camelObject(value) {
220
+ const out = {};
221
+ for (const [key, child] of Object.entries(value))
222
+ out[camelKey(key)] = camelValue(child);
223
+ return out;
224
+ }
225
+ function camelValue(value) {
226
+ if (Array.isArray(value))
227
+ return value.map(camelValue);
228
+ if (isTfExpr(value) || value === null || typeof value !== "object")
229
+ return value;
230
+ return camelObject(value);
231
+ }
232
+ function camelKey(value) {
233
+ return value.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
234
+ }
235
+ function plainUnknownObject(value) {
236
+ return typeof value === "object" && value !== null && !Array.isArray(value) && !isTfExpr(value)
237
+ ? value
238
+ : undefined;
239
+ }
@@ -0,0 +1,3 @@
1
+ import { type EntityKindModule } from "../../graph/types.js";
2
+ export declare const DYNAMIC_LAYOUT_RESOURCE_TYPE = "elementum_dynamic_layout";
3
+ export declare const dynamicLayoutModule: EntityKindModule;
@@ -0,0 +1,13 @@
1
+ import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE } from "../../graph/types.js";
2
+ export const DYNAMIC_LAYOUT_RESOURCE_TYPE = "elementum_dynamic_layout";
3
+ export const dynamicLayoutModule = {
4
+ kind: "dynamic-layout",
5
+ stream: { role: "streamMember" },
6
+ authoring: { unit: "inline", bag: "dynamicLayouts" },
7
+ parents: [{ parent: "app", child: "dynamic-layout" }],
8
+ resource: { shape: "single", resourceType: DYNAMIC_LAYOUT_RESOURCE_TYPE, adoptable: true },
9
+ data: NO_DATA,
10
+ lifecycle: NO_LIFECYCLE,
11
+ canvas: NO_CANVAS,
12
+ catalog: NO_CATALOG,
13
+ };
@@ -0,0 +1,26 @@
1
+ import type { OrgRefLookup, WorkspaceAspect } from "../../engine/build/context.js";
2
+ import { type TfBlock, type TfValue } from "../../engine/tf/index.js";
3
+ export interface DynamicLayoutWire {
4
+ readonly name?: string;
5
+ readonly description?: string;
6
+ readonly active?: boolean;
7
+ readonly stage?: string;
8
+ readonly documentId?: string;
9
+ readonly documentVersion?: string;
10
+ readonly rootComponent?: string;
11
+ readonly components?: Readonly<Record<string, Record<string, unknown>>>;
12
+ readonly conditions?: Readonly<Record<string, Record<string, unknown>>>;
13
+ readonly saveGroups?: Readonly<Record<string, Record<string, unknown>>>;
14
+ readonly fieldValidations?: readonly Record<string, unknown>[];
15
+ readonly dependencies?: readonly Record<string, unknown>[];
16
+ readonly metadata?: Readonly<Record<string, unknown>>;
17
+ }
18
+ export interface DynamicLayoutToTfOptions {
19
+ readonly ownerRefName: string;
20
+ readonly ownerTfLabel: string;
21
+ readonly objectId: TfValue;
22
+ readonly diagnostics: string[];
23
+ readonly orgRefs: OrgRefLookup;
24
+ readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
25
+ }
26
+ export declare function dynamicLayoutsToTf(layouts: Readonly<Record<string, DynamicLayoutWire>> | undefined, opts: DynamicLayoutToTfOptions): TfBlock[];
@@ -0,0 +1,267 @@
1
+ import { workspaceAspectKey } from "../../engine/build/context.js";
2
+ import { resolveForeignRef } from "../shared/foreign-ref.js";
3
+ import { expr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
4
+ import { fieldRefToTfValue } from "../field/to-tf.js";
5
+ import { SYSTEM_FIELD_ID_ATTR_BY_KEY } from "../view/types.js";
6
+ import { DYNAMIC_LAYOUT_RESOURCE_TYPE } from "./module.js";
7
+ import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS, dynamicLayoutFieldComponentWireKey, } from "./dialect.js";
8
+ export function dynamicLayoutsToTf(layouts, opts) {
9
+ const blocks = [];
10
+ for (const [key, layout] of Object.entries(layouts ?? {})) {
11
+ const where = `dynamicLayouts.${key}`;
12
+ if (!isCanonicalTsLabel(key)) {
13
+ opts.diagnostics.push(`${where}: key is not a canonical tsLabel; dropped`);
14
+ continue;
15
+ }
16
+ const attrs = {
17
+ app_id: opts.objectId,
18
+ name: layout.name ?? "",
19
+ active: layout.active ?? true,
20
+ document_id: layout.documentId ?? "",
21
+ document_version: layout.documentVersion ?? "1.0.0",
22
+ root_component: layout.rootComponent ?? "",
23
+ components: componentMap(layout.components ?? {}, where, opts),
24
+ };
25
+ if (layout.description !== undefined)
26
+ attrs["description"] = layout.description;
27
+ if (layout.stage !== undefined) {
28
+ attrs["stage_id"] = expr.resourceAttr("elementum_app", opts.ownerTfLabel, [
29
+ "stage_ids_by_key", { index: tsLabelToTfLabel(layout.stage) },
30
+ ]);
31
+ }
32
+ if (layout.conditions !== undefined)
33
+ attrs["conditions"] = conditionMap(layout.conditions, where, opts);
34
+ if (layout.saveGroups !== undefined)
35
+ attrs["save_groups"] = saveGroupMap(layout.saveGroups, where, opts);
36
+ if (layout.fieldValidations !== undefined) {
37
+ attrs["field_validations"] = layout.fieldValidations.map((value, index) => fieldValidation(value, `${where}.fieldValidations[${index}]`, opts));
38
+ }
39
+ if (layout.dependencies !== undefined) {
40
+ attrs["dependencies"] = layout.dependencies.map((value, index) => dependency(value, `${where}.dependencies[${index}]`, opts));
41
+ }
42
+ if (layout.metadata !== undefined)
43
+ attrs["metadata"] = snakeObject(layout.metadata, where, opts);
44
+ blocks.push({
45
+ kind: "resource",
46
+ type: DYNAMIC_LAYOUT_RESOURCE_TYPE,
47
+ label: scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(key), "app"),
48
+ attrs,
49
+ });
50
+ }
51
+ return blocks;
52
+ }
53
+ function componentMap(components, where, opts) {
54
+ const out = {};
55
+ for (const [componentId, component] of Object.entries(components)) {
56
+ const attrs = {};
57
+ for (const [key, value] of Object.entries(component)) {
58
+ if (value === undefined)
59
+ continue;
60
+ if (key === "htmlField") {
61
+ opts.diagnostics.push(`${where}.components[${JSON.stringify(componentId)}].htmlField: legacy component key is not supported; use richTextField; dropped`);
62
+ }
63
+ else if (DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS.has(key)) {
64
+ const wireKey = dynamicLayoutFieldComponentWireKey(key);
65
+ attrs[snakeKey(wireKey)] = fieldComponent(value, `${where}.components[${JSON.stringify(componentId)}].${key}`, opts);
66
+ }
67
+ else if (key === "updateBlock") {
68
+ const rec = object(value);
69
+ const block = {};
70
+ for (const [childKey, child] of Object.entries(rec)) {
71
+ if (child === undefined)
72
+ continue;
73
+ block[childKey === "fields" ? "field_ids" : snakeKey(childKey)] =
74
+ childKey === "fields" && Array.isArray(child)
75
+ ? resolveFields(child, `${where}.components.${componentId}.updateBlock.fields`, opts)
76
+ : snakeValue(child, where, opts);
77
+ }
78
+ attrs["update_block"] = block;
79
+ }
80
+ else if (key === "automationButton") {
81
+ const rec = object(value);
82
+ const button = snakeObject(rec, where, opts);
83
+ delete button["automation"];
84
+ const token = rec["automation"];
85
+ const automation = resolveAutomation(token, `${where}.components.${componentId}.automationButton`, opts);
86
+ if (automation !== undefined)
87
+ button["automation_id"] = automation;
88
+ attrs["automation_button"] = button;
89
+ }
90
+ else if (key === "createButton") {
91
+ const rec = object(value);
92
+ const button = snakeObject(rec, where, opts);
93
+ delete button["target"];
94
+ const target = resolveAspect(rec["target"], `${where}.components.${componentId}.createButton`, opts);
95
+ if (target !== undefined)
96
+ button["target_aspect_id"] = target;
97
+ attrs["create_button"] = button;
98
+ }
99
+ else {
100
+ attrs[snakeKey(key)] = snakeValue(value, where, opts);
101
+ }
102
+ }
103
+ out[componentId] = attrs;
104
+ }
105
+ return out;
106
+ }
107
+ function fieldComponent(value, where, opts) {
108
+ const rec = object(value);
109
+ const out = snakeObject(rec, where, opts);
110
+ delete out["field"];
111
+ const field = resolveField(rec["field"], where, opts);
112
+ if (field !== undefined)
113
+ out["field_id"] = field;
114
+ return out;
115
+ }
116
+ function conditionMap(conditions, where, opts) {
117
+ const out = {};
118
+ for (const [conditionId, condition] of Object.entries(conditions)) {
119
+ const attrs = {};
120
+ for (const [key, value] of Object.entries(condition)) {
121
+ if (value === undefined)
122
+ continue;
123
+ if (DYNAMIC_LAYOUT_COMPARISON_KEYS.has(key)) {
124
+ const rec = object(value);
125
+ const comparison = {};
126
+ const field = resolveField(rec["field"], `${where}.conditions.${conditionId}.${key}`, opts);
127
+ if (field !== undefined)
128
+ comparison["field_id"] = field;
129
+ if (rec["value"] !== undefined)
130
+ comparison["value"] = typedValue(rec["value"], rec["field"], opts);
131
+ attrs[snakeKey(key)] = comparison;
132
+ }
133
+ else if (key === "stage") {
134
+ const stage = object(value)["stage"];
135
+ if (typeof stage === "string") {
136
+ attrs["stage"] = {
137
+ stage_id: expr.resourceAttr("elementum_app", opts.ownerTfLabel, ["stage_ids_by_key", { index: tsLabelToTfLabel(stage) }]),
138
+ };
139
+ }
140
+ }
141
+ else {
142
+ attrs[snakeKey(key)] = snakeValue(value, where, opts);
143
+ }
144
+ }
145
+ out[conditionId] = attrs;
146
+ }
147
+ return out;
148
+ }
149
+ function saveGroupMap(groups, where, opts) {
150
+ const out = {};
151
+ for (const [id, group] of Object.entries(groups)) {
152
+ const attrs = snakeObject(group, where, opts);
153
+ delete attrs["fields"];
154
+ attrs["field_ids"] = resolveFields(group["fields"] ?? [], `${where}.saveGroups.${id}.fields`, opts);
155
+ if (Array.isArray(group["validations"])) {
156
+ attrs["validations"] = group["validations"].map((v, i) => fieldValidation(object(v), `${where}.saveGroups.${id}.validations[${i}]`, opts));
157
+ }
158
+ out[id] = attrs;
159
+ }
160
+ return out;
161
+ }
162
+ function fieldValidation(value, where, opts) {
163
+ const out = snakeObject(value, where, opts);
164
+ delete out["field"];
165
+ const field = resolveField(value["field"], where, opts);
166
+ if (field !== undefined)
167
+ out["field_id"] = field;
168
+ return out;
169
+ }
170
+ function dependency(value, where, opts) {
171
+ const out = snakeObject(value, where, opts);
172
+ delete out["source_field"];
173
+ delete out["target_field"];
174
+ const source = resolveField(value["sourceField"], `${where}.sourceField`, opts);
175
+ const target = resolveField(value["targetField"], `${where}.targetField`, opts);
176
+ if (source !== undefined)
177
+ out["source_field_id"] = source;
178
+ if (target !== undefined)
179
+ out["target_field_id"] = target;
180
+ return out;
181
+ }
182
+ function resolveFields(values, where, opts) {
183
+ return values.flatMap((value) => {
184
+ const resolved = resolveField(value, where, opts);
185
+ return resolved === undefined ? [] : [resolved];
186
+ });
187
+ }
188
+ function resolveField(value, where, opts) {
189
+ if (typeof value === "string") {
190
+ const attr = SYSTEM_FIELD_ID_ATTR_BY_KEY.get(value);
191
+ if (attr === undefined)
192
+ opts.diagnostics.push(`${where}: "${value}" is not a known system field key; dropped`);
193
+ return attr === undefined ? undefined : expr.local(`${opts.ownerTfLabel}_${attr}`);
194
+ }
195
+ const token = value;
196
+ const refName = token?.refName ?? "";
197
+ if (token?.parent !== undefined && token.parent !== opts.ownerRefName) {
198
+ opts.diagnostics.push(`${where}: field "${refName}" targets a different app; dropped`);
199
+ return undefined;
200
+ }
201
+ const resolved = fieldRefToTfValue(token?.fieldType ?? "", refName, opts.ownerTfLabel, "app");
202
+ if (resolved === undefined)
203
+ opts.diagnostics.push(`${where}: field "${refName}" has no Terraform mapping; dropped`);
204
+ return resolved;
205
+ }
206
+ function typedValue(value, fieldValue, opts) {
207
+ const rec = object(value);
208
+ const token = fieldValue;
209
+ if (typeof rec["string"] === "string" && token?.options?.includes(rec["string"])) {
210
+ const localName = token.tags?.includes("STATUS")
211
+ ? `${opts.ownerTfLabel}_status_options_by_label`
212
+ : token.tags?.includes("STAGE")
213
+ ? `${opts.ownerTfLabel}_stage_options_by_label`
214
+ : `${scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(token.refName ?? ""), "app")}_options_by_label`;
215
+ return { string: expr.local(localName, [{ index: rec["string"] }]) };
216
+ }
217
+ return snakeObject(rec, "dynamic layout typed value", opts);
218
+ }
219
+ function resolveAutomation(token, where, opts) {
220
+ const refName = token?.refName ?? "";
221
+ if (token?.parent !== undefined && token.parent !== opts.ownerRefName) {
222
+ opts.diagnostics.push(`${where}: cross-app automations are not supported; dropped`);
223
+ return undefined;
224
+ }
225
+ if (!isCanonicalTsLabel(refName)) {
226
+ opts.diagnostics.push(`${where}: automation key "${refName}" is not a canonical tsLabel; dropped`);
227
+ return undefined;
228
+ }
229
+ return expr.resourceAttr("elementum_automation", scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(refName), "app"), ["id"]);
230
+ }
231
+ function resolveAspect(token, where, opts) {
232
+ const kind = token?.__kind === "element" ? "element" : "app";
233
+ const refName = token?.refName ?? "";
234
+ if (kind === "app" && refName === opts.ownerRefName)
235
+ return opts.objectId;
236
+ const sibling = opts.workspaceAspects?.get(workspaceAspectKey(kind, refName));
237
+ if (sibling !== undefined) {
238
+ return expr.resourceAttr(kind === "app" ? "elementum_app" : "elementum_element", sibling.tfLabel, ["id"]);
239
+ }
240
+ const name = token?.name ?? refName;
241
+ if (name === "") {
242
+ opts.diagnostics.push(`${where}: target aspect has no name/refName; dropped`);
243
+ return undefined;
244
+ }
245
+ return resolveForeignRef(kind, { name, namespace: token?.namespace }, opts.orgRefs, opts.diagnostics, where).value;
246
+ }
247
+ function snakeObject(value, where, opts) {
248
+ const out = {};
249
+ for (const [key, child] of Object.entries(value)) {
250
+ if (child !== undefined)
251
+ out[snakeKey(key)] = snakeValue(child, where, opts);
252
+ }
253
+ return out;
254
+ }
255
+ function snakeValue(value, where, opts) {
256
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean")
257
+ return value;
258
+ if (Array.isArray(value))
259
+ return value.map((child) => snakeValue(child, where, opts));
260
+ return snakeObject(object(value), where, opts);
261
+ }
262
+ function snakeKey(value) {
263
+ return value.replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`);
264
+ }
265
+ function object(value) {
266
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
267
+ }