@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
@@ -1,33 +1,14 @@
1
- /**
2
- * v2 element authoring — `defineElement`.
3
- *
4
- * Elements are not apps — they're a dedicated aspect kind with their own
5
- * builder/printer — but a pulled real-world element proved they carry nearly
6
- * every authoring slot an app does (category icon/color, namespace,
7
- * description, cloud options, display blocks). The one genuinely new
8
- * concept is a **linked** element's cloud mapping: a Cloud Link + Database +
9
- * Schema + Table pointing at an existing table in the customer's cloud
10
- * database, vs. a **standard** element (no `cloudConnection`), whose table
11
- * Elementum manages — a shape `defineApp` has no slot for. Reusing `defineApp`
12
- * for elements is why that data was silently dropped on pull.
13
- *
14
- * Produces a `DeployableEntity` of kind `element` with `parent: "org"` (elements are
15
- * org-owned, like apps). The payload is the same compose-body shape
16
- * `defineApp({ type: "ELEMENT" })` produced before this split — fields are
17
- * authored inline; the cloud link is a `CatalogRef` token resolved at deploy.
18
- * Deployed via the same wire client compose path apps use.
19
- *
20
- * Field/category serialization is genuinely shared with apps (both are
21
- * "aspects" — see `src/CLAUDE.md`'s glossary), so this imports `serializeField`
22
- * and its types directly from `src/aspects/build.ts` rather than duplicating
23
- * them.
24
- */
25
- import { type AspectRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
1
+ import { type AppOrElementRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
26
2
  import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
27
3
  import type { AccessPolicyOptions } from "../access-policy/build.js";
4
+ import { type AppCalendarView, type AppCategory, type AppCloudOptions, type AppDashboard, type AppDashboardView, type AppField, type AppFieldRefs, type AppKanbanView, type AppLayout, type AppListView, type AppRecordCreateForm, type AppSystemFieldOverride } from "../app/build.js";
28
5
  import { type DisplayBlock } from "../app/display-blocks.js";
29
- import { type AppCategory, type AppCloudOptions, type AppField, type AppFieldRefs, type AppLayout, type AppListView, type AppSystemFieldOverride } from "../app/build.js";
30
- export type { AppCategory, AppField, AppLayout, AppListView, AppSystemFieldOverride, PicklistOption } from "../app/build.js";
6
+ import type { AppRelationship } from "../relationship/build.js";
7
+ import type { AppRole } from "../role/build.js";
8
+ import type { AppWidget } from "../widget/build.js";
9
+ export type { AppCalendarView, AppCategory, AppDashboard, AppDashboardView, AppField, AppKanbanView, AppLayout, AppListView, AppRecordCreateForm, AppRecordCreateFormSection, AppSystemFieldOverride, PicklistOption } from "../app/build.js";
10
+ export type { AppRelationship, AppRelationshipColumn } from "../relationship/build.js";
11
+ export type { AppWidget, CreateRecordWidget, LinkRecordsWidget, RelatedRecordsWidget, RunAutomationWidget, RunAutomationWidgetParameter, WidgetButtonStyle, WidgetButtonType } from "../widget/build.js";
31
12
  /** The system fields elements actually have (per `locals.ts`) — unlike apps, no status/stage/audit fields. */
32
13
  export type ElementSystemFieldKey = "id" | "title";
33
14
  export declare const ELEMENT_SYSTEM_FIELD_KEYS: readonly ElementSystemFieldKey[];
@@ -40,9 +21,8 @@ export interface ElementSystemFields {
40
21
  * The source table a LINKED element maps to — an existing table in the
41
22
  * customer's cloud database, vs. a STANDARD element (no `cloudConnection`),
42
23
  * whose table Elementum manages. Real and sent on deploy via the terraform
43
- * path (`elementum_element`'s `cloud_mapping_snowflake_*` /
44
- * `snowflake_hybrid_table` / `title_column_name` / `id_column_name`
45
- * attributes) — applied on create only: an element's table binding is
24
+ * path (Snowflake cloud mapping, hybrid-table selection, and title/id columns)
25
+ * — applied on create only: an element's table binding is
46
26
  * immutable once set.
47
27
  */
48
28
  export interface ElementCloudConnection {
@@ -57,7 +37,7 @@ export interface ElementCloudConnection {
57
37
  readonly idColumnName?: string;
58
38
  }
59
39
  export interface ElementV2Options<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> extends EntityDeployOptions {
60
- /** The platform's aspect handle (business acronym, e.g. "PRD") — distinct from the refName. Omit to let the platform assign one. */
40
+ /** The platform handle (business acronym, e.g. "PRD") — distinct from the refName. Omit to let the platform assign one. */
61
41
  readonly handle?: string;
62
42
  readonly name: string;
63
43
  readonly category: AppCategory;
@@ -68,7 +48,7 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
68
48
  /**
69
49
  * Cloud link whose data store this element's records persist in (token →
70
50
  * id at deploy). Optional — omit it to use the org's default cloud link.
71
- * Applied on create only: an aspect's cloud link is immutable once created.
51
+ * Applied on create only: an element's cloud link is immutable once created.
72
52
  */
73
53
  readonly cloudLink?: CloudLinkRef;
74
54
  /** Cloud-backing options (Snowflake-only); applied on create only. */
@@ -102,6 +82,16 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
102
82
  readonly layouts?: Readonly<Record<string, AppLayout>>;
103
83
  /** Saved list views, keyed by view ref name. */
104
84
  readonly listViews?: Readonly<Record<string, AppListView>>;
85
+ /** Calendar views, keyed by stable view ref name. */
86
+ readonly calendarViews?: Readonly<Record<string, AppCalendarView>>;
87
+ /** Kanban views, keyed by stable view ref name. */
88
+ readonly kanbanViews?: Readonly<Record<string, AppKanbanView>>;
89
+ readonly dashboards?: Readonly<Record<string, AppDashboard>>;
90
+ readonly widgets?: Readonly<Record<string, AppWidget>>;
91
+ readonly dashboardViews?: Readonly<Record<string, AppDashboardView>>;
92
+ /** Typed new-record form (`elementum_record_create_form`). */
93
+ readonly recordCreateForm?: AppRecordCreateForm;
94
+ readonly relationships?: Readonly<Record<string, AppRelationship>>;
105
95
  /** Display order of `listViews` (by key). Defaults to declaration order. */
106
96
  readonly viewOrder?: readonly string[];
107
97
  /**
@@ -110,7 +100,25 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
110
100
  * (the creating user, typically `whereTrue`) that is not authored here.
111
101
  */
112
102
  readonly accessPolicies?: readonly AccessPolicyOptions[];
103
+ /** Custom roles keyed by stable authoring name. */
104
+ readonly roles?: Readonly<Record<string, AppRole>>;
113
105
  }
106
+ /** `id`/`title`'s platform field type — `id` is `HANDLE`, `title` is `TEXT`, same as an app's (`SYSTEM_FIELD_TAG_TO_TYPE`). */
107
+ type ElementSystemFieldTypeByKey = {
108
+ readonly id: "HANDLE";
109
+ readonly title: "TEXT";
110
+ };
111
+ /**
112
+ * Per-element-system-field `FieldRef`s, each carrying its own literal
113
+ * `fieldType` — a plain `Record<ElementSystemFieldKey, FieldRef<RefName>>`
114
+ * would leave `FieldType` on its `string` default (only `Parent` gets filled
115
+ * positionally), collapsing `RecordShape`'s `id`/`title` values to the
116
+ * generic `"text"` case (see `SystemFieldRefs` in `entities/app/build.ts`,
117
+ * the identical fix for an app's fuller system-field set).
118
+ */
119
+ type ElementSystemFieldRefs<Parent extends string = string> = {
120
+ readonly [K in ElementSystemFieldKey]: FieldRef<Parent, K, ElementSystemFieldTypeByKey[K]>;
121
+ };
114
122
  /**
115
123
  * An element's reference surface: identity plus its fields (the only bag
116
124
  * other entities may point at). Generic over the authored `fields:` bag
@@ -118,22 +126,24 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
118
126
  * `entities/app/build.ts` for the full rationale, including why `R`'s
119
127
  * default is `Record<never, never>` rather than a wide `Record<string,
120
128
  * FieldRef>` (a `string`-keyed index signature anywhere here poisons
121
- * `DeepRef`'s downstream re-mapping for `ctx.trigger.record`/`ctx.tasks.<t>.
129
+ * `DeepRef`'s downstream re-mapping for `ctx.trigger.record`/`ctx.actions.<t>.
122
130
  * record`). `id`/`title` round out the bag the same way `AppRef` folds in
123
131
  * its full `SystemFieldKey` set — a finite, closed term, not a wide index.
124
132
  */
125
- export type ElementRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> = AspectRef & {
126
- readonly fields: AppFieldRefs<F> & Record<ElementSystemFieldKey, FieldRef> & R;
133
+ export type ElementRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string> = Extract<AppOrElementRef<RefName>, {
134
+ readonly __kind: "element";
135
+ }> & {
136
+ readonly fields: AppFieldRefs<F, RefName> & ElementSystemFieldRefs<RefName> & R;
127
137
  };
128
138
  /**
129
- * The configured result of `defineElement` — its reference surface (`ref()`)
139
+ * The configured result of `element` — its reference surface (`ref()`)
130
140
  * and its deployable entity (`def()`). Both take `refName` as a **call-time
131
141
  * argument**, not a constructor option — see `AppConfigured` in
132
142
  * `src/aspects/build.ts` for the full rationale (identical here).
133
143
  */
134
144
  export interface ElementConfigured<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> {
135
- ref(refName: string): ElementRef<F, R>;
145
+ ref<const RefName extends string>(refName: RefName): ElementRef<F, R, RefName>;
136
146
  def(refName: string): DeployableEntity;
137
147
  }
138
148
  /** Build a v2 element entity: org-owned, compose-body payload. Exposes `.ref(refName)` and `.def(refName)`. */
139
- export declare function defineElement<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>>(opts: ElementV2Options<F, R>): ElementConfigured<F, R>;
149
+ export declare function element<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>>(opts: ElementV2Options<F, R>): ElementConfigured<F, R>;
@@ -1,34 +1,10 @@
1
- /**
2
- * v2 element authoring — `defineElement`.
3
- *
4
- * Elements are not apps — they're a dedicated aspect kind with their own
5
- * builder/printer — but a pulled real-world element proved they carry nearly
6
- * every authoring slot an app does (category icon/color, namespace,
7
- * description, cloud options, display blocks). The one genuinely new
8
- * concept is a **linked** element's cloud mapping: a Cloud Link + Database +
9
- * Schema + Table pointing at an existing table in the customer's cloud
10
- * database, vs. a **standard** element (no `cloudConnection`), whose table
11
- * Elementum manages — a shape `defineApp` has no slot for. Reusing `defineApp`
12
- * for elements is why that data was silently dropped on pull.
13
- *
14
- * Produces a `DeployableEntity` of kind `element` with `parent: "org"` (elements are
15
- * org-owned, like apps). The payload is the same compose-body shape
16
- * `defineApp({ type: "ELEMENT" })` produced before this split — fields are
17
- * authored inline; the cloud link is a `CatalogRef` token resolved at deploy.
18
- * Deployed via the same wire client compose path apps use.
19
- *
20
- * Field/category serialization is genuinely shared with apps (both are
21
- * "aspects" — see `src/CLAUDE.md`'s glossary), so this imports `serializeField`
22
- * and its types directly from `src/aspects/build.ts` rather than duplicating
23
- * them.
24
- */
25
1
  import { slimTokens } from "../../catalog/index.js";
26
2
  import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY } from "../../core/system-fields.js";
3
+ import { assertNoSystemKeyCollision, picklistOptionLabels, serializeField, } from "../app/build.js";
27
4
  import { serializeDisplayBlocks } from "../app/display-blocks.js";
28
- import { assertNoSystemKeyCollision, serializeField, } from "../app/build.js";
29
5
  export const ELEMENT_SYSTEM_FIELD_KEYS = ["id", "title"];
30
6
  /**
31
- * Client-side validation for `defineElement` — the authoring-time home for
7
+ * Client-side validation for `element` — the authoring-time home for
32
8
  * element validation rules, so a malformed definition fails at define time
33
9
  * rather than as an opaque platform error during apply.
34
10
  *
@@ -39,10 +15,10 @@ export const ELEMENT_SYSTEM_FIELD_KEYS = ["id", "title"];
39
15
  */
40
16
  function validateElementOptions(opts) {
41
17
  if (opts.handle !== undefined && !/^[A-Za-z]+$/.test(opts.handle)) {
42
- throw new Error(`defineElement "${opts.name}": handle "${opts.handle}" must be letters only (A–Z or a–z).`);
18
+ throw new Error(`element "${opts.name}": handle "${opts.handle}" must be letters only (A–Z or a–z).`);
43
19
  }
44
20
  if (opts.namespace !== undefined && !/^[a-z]+$/.test(opts.namespace)) {
45
- throw new Error(`defineElement "${opts.name}": namespace "${opts.namespace}" must be lowercase letters only (a–z).`);
21
+ throw new Error(`element "${opts.name}": namespace "${opts.namespace}" must be lowercase letters only (a–z).`);
46
22
  }
47
23
  }
48
24
  /** Serialize authored `systemFields` overrides into compose entries — mirrors `serializeSystemFields` in `app/build.ts`, scoped to id/title (no picklist branch needed). */
@@ -63,15 +39,15 @@ function serializeElementSystemFields(overrides) {
63
39
  });
64
40
  }
65
41
  /** Build a v2 element entity: org-owned, compose-body payload. Exposes `.ref(refName)` and `.def(refName)`. */
66
- export function defineElement(opts) {
42
+ export function element(opts) {
67
43
  validateElementOptions(opts);
68
44
  const fieldEntries = Object.values(opts.fields);
69
45
  if (fieldEntries.length === 0) {
70
- throw new Error(`defineElement "${opts.name}" requires at least one field.`);
46
+ throw new Error(`element "${opts.name}" requires at least one field.`);
71
47
  }
72
48
  return {
73
49
  ref(refName) {
74
- // See `defineApp`'s `ref()` for why `handle` here is the bag key —
50
+ // See `app`'s `ref()` for why `handle` here is the bag key —
75
51
  // `def()` carries it as `serializeField`'s internal `__refName` marker so
76
52
  // `applyV2`'s field reconciliation can match this field by bag key
77
53
  // instead of `name`, which would otherwise break on a rename.
@@ -85,6 +61,7 @@ export function defineElement(opts) {
85
61
  parentKind: "element",
86
62
  parentName: opts.name,
87
63
  fieldType: field.type,
64
+ ...(field.options !== undefined ? { options: picklistOptionLabels(field.options) } : {}),
88
65
  ...(field.tags !== undefined ? { tags: field.tags } : {}),
89
66
  };
90
67
  }
@@ -109,10 +86,16 @@ export function defineElement(opts) {
109
86
  tags: [tag],
110
87
  };
111
88
  }
112
- return { __kind: "element", refName: refName, name: opts.name, fields };
89
+ return {
90
+ __kind: "element",
91
+ refName: refName,
92
+ name: opts.name,
93
+ ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),
94
+ fields,
95
+ };
113
96
  },
114
97
  def(refName) {
115
- assertNoSystemKeyCollision("defineElement", opts.name, opts.fields, opts.systemFields);
98
+ assertNoSystemKeyCollision("element", opts.name, opts.fields, opts.systemFields);
116
99
  const displayBlocks = serializeDisplayBlocks(opts.displayBlocks, "LAYOUT");
117
100
  const recordCreateDisplayBlocks = serializeDisplayBlocks(opts.recordCreateDisplayBlocks, "CREATE");
118
101
  const payload = {
@@ -136,8 +119,16 @@ export function defineElement(opts) {
136
119
  ...(recordCreateDisplayBlocks !== undefined ? { recordCreateDisplayBlocks } : {}),
137
120
  ...(opts.layouts !== undefined ? { layouts: opts.layouts } : {}),
138
121
  ...(opts.listViews !== undefined ? { listViews: opts.listViews } : {}),
122
+ ...(opts.calendarViews !== undefined ? { calendarViews: opts.calendarViews } : {}),
123
+ ...(opts.kanbanViews !== undefined ? { kanbanViews: opts.kanbanViews } : {}),
124
+ ...(opts.dashboards !== undefined ? { dashboards: opts.dashboards } : {}),
125
+ ...(opts.widgets !== undefined ? { widgets: opts.widgets } : {}),
126
+ ...(opts.dashboardViews !== undefined ? { dashboardViews: opts.dashboardViews } : {}),
127
+ ...(opts.recordCreateForm !== undefined ? { recordCreateForm: opts.recordCreateForm } : {}),
128
+ ...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
139
129
  ...(opts.viewOrder !== undefined ? { viewOrder: opts.viewOrder } : {}),
140
130
  ...(opts.accessPolicies !== undefined ? { accessPolicies: opts.accessPolicies } : {}),
131
+ ...(opts.roles !== undefined ? { roles: opts.roles } : {}),
141
132
  };
142
133
  return {
143
134
  kind: "element",
@@ -14,6 +14,14 @@ export interface ElementFromTfResult {
14
14
  export interface ElementFromTfViewBlocks {
15
15
  readonly layoutBlocks: readonly TfBlock[];
16
16
  readonly listViewBlocks: readonly TfBlock[];
17
+ readonly calendarViewBlocks: readonly TfBlock[];
18
+ readonly kanbanViewBlocks: readonly TfBlock[];
19
+ readonly dashboardViewBlocks: readonly TfBlock[];
17
20
  readonly managedViewOrderBlocks: readonly TfBlock[];
21
+ readonly recordCreateFormBlocks: readonly TfBlock[];
22
+ readonly relationshipBlocks: readonly TfBlock[];
23
+ readonly dashboardBlocks: readonly TfBlock[];
24
+ readonly dashboardWidgetBlocks: readonly TfBlock[];
25
+ readonly widgetBlocks: readonly TfBlock[];
18
26
  }
19
- export declare function elementFromTf(elementBlock: TfBlock, fieldBlocks: readonly TfBlock[], ctx: FromTfContext, viewBlocks?: ElementFromTfViewBlocks, accessPolicyBlocks?: readonly TfBlock[]): ElementFromTfResult;
27
+ export declare function elementFromTf(elementBlock: TfBlock, fieldBlocks: readonly TfBlock[], ctx: FromTfContext, viewBlocks?: ElementFromTfViewBlocks, accessPolicyBlocks?: readonly TfBlock[], roleBlocks?: readonly TfBlock[]): ElementFromTfResult;
@@ -7,8 +7,13 @@ import { EntityTfError } from "../../engine/entity.js";
7
7
  import { dataRefLabel, optionalBoolean, optionalString } from "../../engine/pull/context.js";
8
8
  import { tfLabelToTsLabel } from "../../engine/tf/index.js";
9
9
  import { accessPolicyFromTf } from "../access-policy/from-tf.js";
10
+ import { dashboardsFromTf } from "../dashboard/from-tf.js";
10
11
  import { fieldFromTf } from "../field/from-tf.js";
12
+ import { recordCreateFormFromTf } from "../record-create-form/from-tf.js";
13
+ import { relationshipsFromTf } from "../relationship/from-tf.js";
14
+ import { rolesFromTf } from "../role/from-tf.js";
11
15
  import { viewsFromTf } from "../view/from-tf.js";
16
+ import { widgetsFromTf } from "../widget/from-tf.js";
12
17
  import { ELEMENT_RESOURCE_TYPE } from "./module.js";
13
18
  /** Attributes `elementFromTf` understands — anything else is dialect growth. */
14
19
  const KNOWN_ELEMENT_ATTRS = new Set([
@@ -35,8 +40,16 @@ const KNOWN_ELEMENT_ATTRS = new Set([
35
40
  export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
36
41
  layoutBlocks: [],
37
42
  listViewBlocks: [],
43
+ calendarViewBlocks: [],
44
+ kanbanViewBlocks: [],
45
+ dashboardViewBlocks: [],
38
46
  managedViewOrderBlocks: [],
39
- }, accessPolicyBlocks = []) {
47
+ recordCreateFormBlocks: [],
48
+ relationshipBlocks: [],
49
+ dashboardBlocks: [],
50
+ dashboardWidgetBlocks: [],
51
+ widgetBlocks: [],
52
+ }, accessPolicyBlocks = [], roleBlocks = []) {
40
53
  const label = elementBlock.label;
41
54
  if (label === undefined || label === "") {
42
55
  throw new EntityTfError("elementum_element block is missing its label");
@@ -127,7 +140,14 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
127
140
  if (elementId === undefined) {
128
141
  ctx.diagnostics.push(`element "${label}": no import block in the stream — adoption has no identity to bind`);
129
142
  }
130
- const { layouts, listViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.managedViewOrderBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: refName, scope: "element" }, ctx);
143
+ const dashboards = dashboardsFromTf(viewBlocks.dashboardBlocks, viewBlocks.dashboardWidgetBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: refName, ownerRefName: refName, scope: "element", ownerType: "ELEMENT_ASPECT" }, ctx);
144
+ const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, [], viewBlocks.managedViewOrderBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: refName, scope: "element" }, ctx);
145
+ if (viewBlocks.recordCreateFormBlocks.length > 1) {
146
+ ctx.diagnostics.push(`element "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
147
+ }
148
+ const recordCreateForm = recordCreateFormFromTf(viewBlocks.recordCreateFormBlocks[0], { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: refName, scope: "element" }, ctx);
149
+ const relationships = relationshipsFromTf(viewBlocks.relationshipBlocks, { kind: "element", label, ownerRefName: refName, ownerTfLabel: refName, scope: "element" }, ctx);
150
+ const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "element" }, ctx);
131
151
  const accessPolicyOwner = {
132
152
  type: ELEMENT_RESOURCE_TYPE,
133
153
  label,
@@ -141,6 +161,7 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
141
161
  if (entry !== undefined)
142
162
  accessPolicies.push(entry);
143
163
  }
164
+ const roles = rolesFromTf(roleBlocks, accessPolicyOwner, ctx);
144
165
  const element = {
145
166
  id: elementId ?? "",
146
167
  name,
@@ -159,8 +180,16 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
159
180
  ...(commentsEnabled !== undefined && { commentsEnabled }),
160
181
  ...(layouts.length > 0 && { layouts }),
161
182
  ...(listViews.length > 0 && { listViews }),
183
+ ...(calendarViews.length > 0 && { calendarViews }),
184
+ ...(kanbanViews.length > 0 && { kanbanViews }),
185
+ ...(dashboardViews.length > 0 && { dashboardViews }),
186
+ ...(dashboards.length > 0 && { dashboards }),
187
+ ...(widgets.length > 0 && { widgets }),
188
+ ...(recordCreateForm !== undefined && { recordCreateForm }),
189
+ ...(relationships.length > 0 && { relationships }),
162
190
  ...(viewOrder !== undefined && { viewOrder }),
163
191
  ...(accessPolicies.length > 0 && { accessPolicies }),
192
+ ...(roles.length > 0 && { roles }),
164
193
  };
165
194
  return { element, ...(cloudLinkHandle !== undefined && { cloudLinkHandle }) };
166
195
  }
@@ -1,12 +1,19 @@
1
1
  /**
2
- * v2 element authoring — `defineElement`. Org-owned; deploys via the same
2
+ * v2 element authoring — `element`. Org-owned; deploys via the same
3
3
  * wire client compose path apps use. Elements are not apps — see
4
4
  * `src/elements/build.ts`'s header for why this is a dedicated module rather
5
- * than folding into `src/aspects/` (which still owns `defineApp` and the
5
+ * than folding into `src/aspects/` (which still owns `app` and the
6
6
  * field/print internals genuinely shared between both aspect kinds).
7
7
  */
8
- export { defineElement, type ElementCloudConnection, type ElementConfigured, type ElementRef, type ElementV2Options, } from "./build.js";
9
- export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField, htmlField, jsonField, multiPicklistField, numberField, picklistField, relationField, textField, userField, type BaseFieldOptions, type NumericFieldOptions, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, } from "../field/build.js";
10
- export { type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyUserRef } from "../access-policy/build.js";
11
- export * as accessPolicyFilter from "../access-policy/filter.js";
12
- export { type AccessPolicyFilter, type AccessPolicyFilterValue, type CurrentUserFilterValue } from "../access-policy/filter.js";
8
+ export { element, type ElementCloudConnection, type ElementConfigured, type ElementRef, type ElementV2Options, } from "./build.js";
9
+ export { type AppRecordCreateForm, type AppRecordCreateFormSection } from "../app/build.js";
10
+ export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, type ListViewDensity, type ManagedViewSort, type ManagedViewSortAggregation, type ManagedViewSortDirection, type ManagedViewSortField, type ManagedViewSortOrder, } from "../view/build.js";
11
+ export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
12
+ export { dashboardRecordsWidget, dashboardWidgetSize, type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize, } from "../dashboard/build.js";
13
+ export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, groupField, jsonField, multiPicklistField, numberField, picklistField, relationField, richTextField, textField, userField, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type NumericFieldFormat, type NumericFieldOptions, type PicklistFieldOptions, type RelationFieldOptions, type QrFieldFormat, type TextFieldOptions, } from "../field/build.js";
14
+ export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, type ConcatExprType, type DateDifUnit, type DateTimeTruncPrecision, type Expr, type ExprType, type FieldRefExprType, type OrderByDirection, type Predicate, type PredicateOp, type StringAggOptions, type StringAggOrderBy, type WeekdayMode, } from "../field/calc.js";
15
+ export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
16
+ export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef, type AppRole, type RoleAutoShare, type RoleGroupRef, type RolePermission, type RolePermissionGroup, type RolePermissionLevel, type RoleUserRef } from "../role/build.js";
17
+ export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
18
+ export * as filter from "../shared/filters/index.js";
19
+ export { type Filter } from "../shared/filters/index.js";
@@ -1,10 +1,16 @@
1
1
  /**
2
- * v2 element authoring — `defineElement`. Org-owned; deploys via the same
2
+ * v2 element authoring — `element`. Org-owned; deploys via the same
3
3
  * wire client compose path apps use. Elements are not apps — see
4
4
  * `src/elements/build.ts`'s header for why this is a dedicated module rather
5
- * than folding into `src/aspects/` (which still owns `defineApp` and the
5
+ * than folding into `src/aspects/` (which still owns `app` and the
6
6
  * field/print internals genuinely shared between both aspect kinds).
7
7
  */
8
- export { defineElement, } from "./build.js";
9
- export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField, htmlField, jsonField, multiPicklistField, numberField, picklistField, relationField, textField, userField, } from "../field/build.js";
10
- export * as accessPolicyFilter from "../access-policy/filter.js";
8
+ export { element, } from "./build.js";
9
+ export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, } from "../view/build.js";
10
+ export { dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
11
+ export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, groupField, jsonField, multiPicklistField, numberField, picklistField, relationField, richTextField, textField, userField, } from "../field/build.js";
12
+ export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, } from "../field/calc.js";
13
+ export { groupId, userId } from "../access-policy/build.js";
14
+ export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef } from "../role/build.js";
15
+ export { serviceAccountRef } from "../service-account/ref.js";
16
+ export * as filter from "../shared/filters/index.js";
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { NO_CATALOG, } from "../../graph/types.js";
7
7
  import { appendFieldLocals } from "../field/locals.js";
8
- import { LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE } from "../view/types.js";
8
+ import { CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE } from "../view/types.js";
9
9
  import { elementFromTf } from "./from-tf.js";
10
10
  import { appendElementLocals } from "./locals.js";
11
11
  import { elementToTf } from "./to-tf.js";
@@ -20,13 +20,30 @@ function extractElementStreamRoot(stream, ctx) {
20
20
  const viewBlocks = stream.byKind.get("view") ?? [];
21
21
  const layoutBlocks = viewBlocks.filter((b) => b.type === LAYOUT_RESOURCE_TYPE);
22
22
  const listViewBlocks = viewBlocks.filter((b) => b.type === LIST_VIEW_RESOURCE_TYPE);
23
+ const calendarViewBlocks = viewBlocks.filter((b) => b.type === CALENDAR_VIEW_RESOURCE_TYPE);
24
+ const kanbanViewBlocks = viewBlocks.filter((b) => b.type === KANBAN_VIEW_RESOURCE_TYPE);
25
+ const dashboardViewBlocks = viewBlocks.filter((b) => b.type === DASHBOARD_VIEW_RESOURCE_TYPE);
23
26
  const managedViewOrderBlocks = stream.byKind.get("managed-view-order") ?? [];
27
+ const recordCreateFormBlocks = stream.byKind.get("record-create-form") ?? [];
28
+ const relationshipBlocks = stream.byKind.get("relationship") ?? [];
29
+ const dashboardBlocks = stream.byKind.get("dashboard") ?? [];
30
+ const dashboardWidgetBlocks = stream.byKind.get("dashboard-widget") ?? [];
31
+ const widgetBlocks = stream.byKind.get("widget") ?? [];
24
32
  const accessPolicyBlocks = stream.byKind.get("access-policy") ?? [];
33
+ const roleBlocks = stream.byKind.get("role") ?? [];
25
34
  const { element, cloudLinkHandle } = elementFromTf(elementBlocks[0], fieldBlocks, ctx, {
26
35
  layoutBlocks,
27
36
  listViewBlocks,
37
+ calendarViewBlocks,
38
+ kanbanViewBlocks,
39
+ dashboardViewBlocks,
28
40
  managedViewOrderBlocks,
29
- }, accessPolicyBlocks);
41
+ recordCreateFormBlocks,
42
+ relationshipBlocks,
43
+ dashboardBlocks,
44
+ dashboardWidgetBlocks,
45
+ widgetBlocks,
46
+ }, accessPolicyBlocks, roleBlocks);
30
47
  return {
31
48
  instance: element,
32
49
  ...(cloudLinkHandle !== undefined && { cloudLinkHandle }),
@@ -40,7 +57,7 @@ export const elementModule = {
40
57
  resource: { shape: "single", resourceType: ELEMENT_RESOURCE_TYPE, adoptable: true },
41
58
  // Foreign/referenced elements: `data.elementum_element` stubs (apps export
42
59
  // --recursive=false) and build-time lookups share this facet.
43
- data: { participates: true, lookupAttr: "name", referencedByBuild: true },
60
+ data: { participates: true, lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootNamespace", compatibilityFallback: "name" }] },
44
61
  canvas: { participates: true, label: "Elements", glyph: "▦", component: "appDetail" },
45
62
  lifecycle: {
46
63
  participates: true,
@@ -53,12 +70,16 @@ export const elementModule = {
53
70
  diagnostics: ctx.diagnostics,
54
71
  workspaceAspects: ctx.workspaceAspects,
55
72
  });
56
- return { blocks: result.blocks, fieldAddresses: result.fieldAddresses };
73
+ return {
74
+ blocks: result.blocks,
75
+ fieldAddresses: result.fieldAddresses,
76
+ fieldNames: result.fieldNames,
77
+ };
57
78
  },
58
79
  appendLocals: (localsAttrs, ctx) => {
59
80
  appendElementLocals(localsAttrs, ctx.appTfLabel);
60
81
  if (ctx.fieldAddresses !== undefined) {
61
- appendFieldLocals(localsAttrs, ctx.fieldAddresses);
82
+ appendFieldLocals(localsAttrs, ctx.fieldAddresses, ctx.blocks);
62
83
  }
63
84
  },
64
85
  },
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Element emission: `defineElement` DeployableEntity → `elementum_element` +
2
+ * Element emission: `element` DeployableEntity → `elementum_element` +
3
3
  * field resources in ei's dialect. No status_options/stages (apps always
4
4
  * emit those; element captures do not).
5
5
  */
@@ -9,6 +9,7 @@ import { type TfBlock } from "../../engine/tf/index.js";
9
9
  export interface ElementToTfResult {
10
10
  readonly blocks: readonly TfBlock[];
11
11
  readonly fieldAddresses: ReadonlyMap<string, string>;
12
+ readonly fieldNames: ReadonlyMap<string, string>;
12
13
  }
13
14
  /** `elementum_element` + one field resource per custom field. */
14
15
  export declare function elementToTf(entity: DeployableEntity, ctx: ToTfContext): ElementToTfResult;
@@ -1,14 +1,19 @@
1
1
  /**
2
- * Element emission: `defineElement` DeployableEntity → `elementum_element` +
2
+ * Element emission: `element` DeployableEntity → `elementum_element` +
3
3
  * field resources in ei's dialect. No status_options/stages (apps always
4
4
  * emit those; element captures do not).
5
5
  */
6
6
  import { EntityTfError } from "../../engine/entity.js";
7
- import { expr } from "../../engine/tf/index.js";
7
+ import { expr, snakeSlug } from "../../engine/tf/index.js";
8
8
  import { accessPolicyToTf } from "../access-policy/to-tf.js";
9
+ import { dashboardsToTf } from "../dashboard/to-tf.js";
9
10
  import { fieldToTf } from "../field/to-tf.js";
10
11
  import { CATEGORY_ORG_BAG } from "../org/category.js";
11
12
  import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
13
+ import { recordCreateFormToTf } from "../record-create-form/to-tf.js";
14
+ import { relationshipsToTf } from "../relationship/to-tf.js";
15
+ import { rolesToTf } from "../role/to-tf.js";
16
+ import { widgetsToTf } from "../widget/to-tf.js";
12
17
  import { viewToTf } from "../view/to-tf.js";
13
18
  import { ELEMENT_RESOURCE_TYPE } from "./module.js";
14
19
  /** System-field tags that fold into the element resource (no field resource). */
@@ -97,6 +102,7 @@ export function elementToTf(entity, ctx) {
97
102
  }
98
103
  const blocks = [];
99
104
  const fieldAddresses = new Map();
105
+ const fieldNames = new Map();
100
106
  const objectId = expr.resourceAttr(ELEMENT_RESOURCE_TYPE, ctx.appTfLabel, ["id"]);
101
107
  for (const fieldEntry of payload.fields ?? []) {
102
108
  const typeKey = Object.keys(fieldEntry)[0];
@@ -104,6 +110,9 @@ export function elementToTf(entity, ctx) {
104
110
  continue;
105
111
  const inner = fieldEntry[typeKey];
106
112
  const name = inner.name ?? "";
113
+ const fieldKey = inner.__refName ?? snakeSlug(name);
114
+ if (fieldKey !== "" && name !== "")
115
+ fieldNames.set(fieldKey, name);
107
116
  const systemTag = inner.tags?.find((tag) => SYSTEM_FIELD_TAGS.has(tag));
108
117
  if (systemTag !== undefined) {
109
118
  switch (systemTag) {
@@ -143,14 +152,57 @@ export function elementToTf(entity, ctx) {
143
152
  blocks.push(field.block);
144
153
  fieldAddresses.set(field.bagKey, field.address);
145
154
  }
146
- const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.viewOrder, {
155
+ blocks.push(...dashboardsToTf(payload.dashboards, {
156
+ ownerTfLabel: ctx.appTfLabel,
157
+ scope: "element",
158
+ ownerType: "ELEMENT_ASPECT",
159
+ ownerId: objectId,
160
+ ownerRefName: ctx.appRefName,
161
+ ownerResourceType: ELEMENT_RESOURCE_TYPE,
162
+ orgRefs: ctx.orgRefs,
163
+ workspaceAspects: ctx.workspaceAspects,
164
+ diagnostics: ctx.diagnostics,
165
+ }));
166
+ blocks.push(...widgetsToTf(payload.widgets, {
167
+ ownerRefName: ctx.appRefName,
168
+ ownerTfLabel: ctx.appTfLabel,
169
+ ownerType: ELEMENT_RESOURCE_TYPE,
170
+ scope: "element",
171
+ objectId,
172
+ orgRefs: ctx.orgRefs,
173
+ workspaceAspects: ctx.workspaceAspects,
174
+ diagnostics: ctx.diagnostics,
175
+ }));
176
+ const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.calendarViews, payload.kanbanViews, payload.dashboardViews, undefined, payload.viewOrder, {
177
+ ownerRefName: ctx.appRefName,
147
178
  ownerTfLabel: ctx.appTfLabel,
148
179
  scope: "element",
149
180
  aspectName: payload.name ?? "",
150
181
  objectId,
182
+ dashboardKeys: new Set(Object.keys(payload.dashboards ?? {})),
183
+ orgRefs: ctx.orgRefs,
151
184
  diagnostics: ctx.diagnostics,
152
185
  });
153
186
  blocks.push(...viewBlocks);
187
+ const recordCreateForm = recordCreateFormToTf(payload.recordCreateForm, {
188
+ ownerRefName: ctx.appRefName,
189
+ ownerTfLabel: ctx.appTfLabel,
190
+ scope: "element",
191
+ objectId,
192
+ diagnostics: ctx.diagnostics,
193
+ });
194
+ if (recordCreateForm !== undefined)
195
+ blocks.push(recordCreateForm);
196
+ blocks.push(...relationshipsToTf(payload.relationships, {
197
+ ownerRefName: ctx.appRefName,
198
+ ownerTfLabel: ctx.appTfLabel,
199
+ ownerType: "elementum_element",
200
+ scope: "element",
201
+ objectId,
202
+ orgRefs: ctx.orgRefs,
203
+ workspaceAspects: ctx.workspaceAspects,
204
+ diagnostics: ctx.diagnostics,
205
+ }));
154
206
  // Authored entries only. Creating an element also has the platform mint a
155
207
  // creator policy (userIds = [you]) that is NOT in this payload — pull
156
208
  // will see it; we never emit it here.
@@ -164,11 +216,19 @@ export function elementToTf(entity, ctx) {
164
216
  });
165
217
  blocks.push(block);
166
218
  }
219
+ blocks.push(...rolesToTf(payload.roles, {
220
+ ownerRefName: ctx.appRefName,
221
+ ownerTfLabel: ctx.appTfLabel,
222
+ scope: "element",
223
+ objectId,
224
+ orgRefs: ctx.orgRefs,
225
+ diagnostics: ctx.diagnostics,
226
+ }));
167
227
  blocks.unshift({
168
228
  kind: "resource",
169
229
  type: ELEMENT_RESOURCE_TYPE,
170
230
  label: ctx.appTfLabel,
171
231
  attrs: elementAttrs,
172
232
  });
173
- return { blocks, fieldAddresses };
233
+ return { blocks, fieldAddresses, fieldNames };
174
234
  }