@elementumai/edk 0.8.2-alpha.6 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/README.md +18 -14
  2. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +3 -3
  3. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +1 -1
  4. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +3 -11
  5. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +2 -10
  6. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
  7. package/dist-sdk/fs/entity.d.ts +2 -2
  8. package/dist-sdk/fs/entity.js +1 -1
  9. package/dist-sdk/pull/missing-report.d.ts +81 -0
  10. package/dist-sdk/pull/missing-report.js +52 -0
  11. package/dist-sdk/src/catalog/factories.d.ts +53 -19
  12. package/dist-sdk/src/catalog/factories.js +51 -12
  13. package/dist-sdk/src/catalog/from-authoring.js +13 -3
  14. package/dist-sdk/src/catalog/index.d.ts +2 -2
  15. package/dist-sdk/src/catalog/index.js +1 -1
  16. package/dist-sdk/src/catalog/org.js +1 -0
  17. package/dist-sdk/src/catalog/render.js +6 -0
  18. package/dist-sdk/src/catalog/token.js +7 -0
  19. package/dist-sdk/src/catalog/types.d.ts +34 -23
  20. package/dist-sdk/src/catalog/types.js +7 -4
  21. package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
  22. package/dist-sdk/src/core/app-to-ui.js +7 -9
  23. package/dist-sdk/src/core/index.d.ts +1 -0
  24. package/dist-sdk/src/core/index.js +1 -0
  25. package/dist-sdk/src/core/platform-id.d.ts +11 -0
  26. package/dist-sdk/src/core/platform-id.js +8 -0
  27. package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +2 -2
  28. package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +6 -8
  29. package/dist-sdk/src/core/types/app.d.ts +13 -23
  30. package/dist-sdk/src/core/types/app.js +0 -1
  31. package/dist-sdk/src/engine/build/context.d.ts +3 -3
  32. package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
  33. package/dist-sdk/src/engine/pull/attrs.js +17 -0
  34. package/dist-sdk/src/engine/pull/context.d.ts +39 -0
  35. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  36. package/dist-sdk/src/engine/pull/org.js +2 -0
  37. package/dist-sdk/src/engine/tf/expr.d.ts +1 -1
  38. package/dist-sdk/src/engine/tf/expr.js +10 -3
  39. package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
  40. package/dist-sdk/src/entities/access-policy/build.d.ts +4 -13
  41. package/dist-sdk/src/entities/access-policy/build.js +1 -1
  42. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +12 -38
  43. package/dist-sdk/src/entities/access-policy/from-tf.js +16 -74
  44. package/dist-sdk/src/entities/access-policy/principal.d.ts +29 -0
  45. package/dist-sdk/src/entities/access-policy/principal.js +13 -0
  46. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +20 -5
  47. package/dist-sdk/src/entities/access-policy/to-tf.js +26 -54
  48. package/dist-sdk/src/entities/agent/build.d.ts +39 -8
  49. package/dist-sdk/src/entities/agent/build.js +36 -15
  50. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +5 -0
  51. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +121 -36
  52. package/dist-sdk/src/entities/agent/from-tf.js +5 -8
  53. package/dist-sdk/src/entities/agent/index.d.ts +5 -2
  54. package/dist-sdk/src/entities/agent/index.js +4 -2
  55. package/dist-sdk/src/entities/agent/module.js +5 -2
  56. package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
  57. package/dist-sdk/src/entities/agent/run-as.js +1 -0
  58. package/dist-sdk/src/entities/agent/to-tf.d.ts +2 -1
  59. package/dist-sdk/src/entities/agent/to-tf.js +2 -1
  60. package/dist-sdk/src/entities/agent/tools.d.ts +60 -48
  61. package/dist-sdk/src/entities/agent/tools.js +44 -38
  62. package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
  63. package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
  64. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +17 -8
  65. package/dist-sdk/src/entities/agent-tool/from-tf.js +127 -37
  66. package/dist-sdk/src/entities/agent-tool/module.js +6 -0
  67. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +5 -5
  68. package/dist-sdk/src/entities/agent-tool/to-tf.js +93 -20
  69. package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -5
  70. package/dist-sdk/src/entities/agent-tool/types.js +36 -8
  71. package/dist-sdk/src/entities/app/build.d.ts +137 -25
  72. package/dist-sdk/src/entities/app/build.js +104 -53
  73. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +173 -1
  74. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
  75. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +68 -0
  76. package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
  77. package/dist-sdk/src/entities/app/display-blocks.js +1 -1
  78. package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
  79. package/dist-sdk/src/entities/app/from-tf.js +30 -2
  80. package/dist-sdk/src/entities/app/index.d.ts +13 -4
  81. package/dist-sdk/src/entities/app/index.js +8 -1
  82. package/dist-sdk/src/entities/app/module.js +27 -2
  83. package/dist-sdk/src/entities/app/to-tf.js +75 -1
  84. package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
  85. package/dist-sdk/src/entities/approval-chain/build.js +49 -49
  86. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
  87. package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
  88. package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
  89. package/dist-sdk/src/entities/approval-chain/index.js +2 -3
  90. package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
  91. package/dist-sdk/src/entities/approval-chain/module.js +51 -0
  92. package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
  93. package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
  94. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
  95. package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
  96. package/dist-sdk/src/entities/automation/build.d.ts +10 -6
  97. package/dist-sdk/src/entities/automation/build.js +5 -4
  98. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +10 -8
  99. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +51 -114
  100. package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
  101. package/dist-sdk/src/entities/automation/filter.js +1 -197
  102. package/dist-sdk/src/entities/automation/from-tf.d.ts +4 -0
  103. package/dist-sdk/src/entities/automation/from-tf.js +202 -119
  104. package/dist-sdk/src/entities/automation/index.d.ts +4 -2
  105. package/dist-sdk/src/entities/automation/index.js +3 -1
  106. package/dist-sdk/src/entities/automation/module.js +10 -4
  107. package/dist-sdk/src/entities/automation/script-code.js +94 -6
  108. package/dist-sdk/src/entities/automation/tasks.d.ts +20 -19
  109. package/dist-sdk/src/entities/automation/tasks.js +2 -2
  110. package/dist-sdk/src/entities/automation/to-tf.d.ts +34 -2
  111. package/dist-sdk/src/entities/automation/to-tf.js +273 -98
  112. package/dist-sdk/src/entities/automation/triggers.d.ts +18 -17
  113. package/dist-sdk/src/entities/automation/triggers.js +1 -1
  114. package/dist-sdk/src/entities/dashboard/build.d.ts +17 -0
  115. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
  116. package/dist-sdk/src/entities/dashboard/from-tf.js +95 -0
  117. package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
  118. package/dist-sdk/src/entities/dashboard/module.js +16 -0
  119. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +30 -0
  120. package/dist-sdk/src/entities/dashboard/to-tf.js +94 -0
  121. package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
  122. package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
  123. package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
  124. package/dist-sdk/src/entities/data-lookup/module.js +22 -0
  125. package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
  126. package/dist-sdk/src/entities/datamine/build.js +1 -0
  127. package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
  128. package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
  129. package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
  130. package/dist-sdk/src/entities/datamine/module.js +23 -0
  131. package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
  132. package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
  133. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +303 -0
  134. package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
  135. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
  136. package/dist-sdk/src/entities/dynamic-layout/dialect.js +9 -0
  137. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
  138. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +233 -0
  139. package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
  140. package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
  141. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
  142. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
  143. package/dist-sdk/src/entities/element/build.d.ts +31 -14
  144. package/dist-sdk/src/entities/element/build.js +12 -4
  145. package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
  146. package/dist-sdk/src/entities/element/from-tf.js +31 -2
  147. package/dist-sdk/src/entities/element/index.d.ts +8 -3
  148. package/dist-sdk/src/entities/element/index.js +4 -1
  149. package/dist-sdk/src/entities/element/module.js +19 -2
  150. package/dist-sdk/src/entities/element/to-tf.js +57 -1
  151. package/dist-sdk/src/entities/field/build.d.ts +4 -3
  152. package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
  153. package/dist-sdk/src/entities/field/calculation-types.js +42 -0
  154. package/dist-sdk/src/entities/field/from-tf.js +90 -11
  155. package/dist-sdk/src/entities/field/module.d.ts +1 -0
  156. package/dist-sdk/src/entities/field/module.js +5 -2
  157. package/dist-sdk/src/entities/field/record-shape.d.ts +1 -1
  158. package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
  159. package/dist-sdk/src/entities/field/to-tf.js +22 -6
  160. package/dist-sdk/src/entities/field/types.js +3 -0
  161. package/dist-sdk/src/entities/file-reader/build.d.ts +66 -19
  162. package/dist-sdk/src/entities/file-reader/build.js +49 -4
  163. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
  164. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +11 -9
  165. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
  166. package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
  167. package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
  168. package/dist-sdk/src/entities/file-reader/index.js +3 -3
  169. package/dist-sdk/src/entities/file-reader/module.js +6 -5
  170. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
  171. package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
  172. package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
  173. package/dist-sdk/src/entities/file-reader/types.js +4 -5
  174. package/dist-sdk/src/entities/org/category.js +4 -5
  175. package/dist-sdk/src/entities/org/group.js +4 -5
  176. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  177. package/dist-sdk/src/entities/org/index.js +1 -0
  178. package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
  179. package/dist-sdk/src/entities/org/phone-provider.js +33 -0
  180. package/dist-sdk/src/entities/org/role.d.ts +3 -3
  181. package/dist-sdk/src/entities/org/role.js +9 -6
  182. package/dist-sdk/src/entities/organization/build.d.ts +29 -0
  183. package/dist-sdk/src/entities/organization/build.js +24 -0
  184. package/dist-sdk/src/entities/organization/index.d.ts +2 -0
  185. package/dist-sdk/src/entities/organization/index.js +2 -0
  186. package/dist-sdk/src/entities/organization/module.d.ts +2 -0
  187. package/dist-sdk/src/entities/organization/module.js +18 -0
  188. package/dist-sdk/src/entities/organization/to-tf.d.ts +6 -0
  189. package/dist-sdk/src/entities/organization/to-tf.js +37 -0
  190. package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
  191. package/dist-sdk/src/entities/phone-service/build.js +31 -0
  192. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
  193. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +54 -0
  194. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
  195. package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
  196. package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
  197. package/dist-sdk/src/entities/phone-service/index.js +2 -0
  198. package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
  199. package/dist-sdk/src/entities/phone-service/module.js +55 -0
  200. package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
  201. package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
  202. package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
  203. package/dist-sdk/src/entities/phone-service/types.js +22 -0
  204. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
  205. package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
  206. package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
  207. package/dist-sdk/src/entities/record-create-form/module.js +24 -0
  208. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
  209. package/dist-sdk/src/entities/record-create-form/to-tf.js +80 -0
  210. package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
  211. package/dist-sdk/src/entities/relationship/build.js +1 -0
  212. package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
  213. package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
  214. package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
  215. package/dist-sdk/src/entities/relationship/module.js +16 -0
  216. package/dist-sdk/src/entities/relationship/to-tf.d.ts +31 -0
  217. package/dist-sdk/src/entities/relationship/to-tf.js +153 -0
  218. package/dist-sdk/src/entities/role/build.d.ts +65 -0
  219. package/dist-sdk/src/entities/role/build.js +33 -0
  220. package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
  221. package/dist-sdk/src/entities/role/from-tf.js +138 -0
  222. package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
  223. package/dist-sdk/src/entities/role/to-tf.js +69 -0
  224. package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
  225. package/dist-sdk/src/entities/search-table/build.js +110 -56
  226. package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
  227. package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
  228. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  229. package/dist-sdk/src/entities/search-table/index.js +2 -2
  230. package/dist-sdk/src/entities/search-table/module.js +88 -10
  231. package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
  232. package/dist-sdk/src/entities/search-table/printer.js +52 -0
  233. package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
  234. package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
  235. package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
  236. package/dist-sdk/src/entities/search-table/types.js +21 -0
  237. package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
  238. package/dist-sdk/src/entities/service-account/build.js +9 -0
  239. package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
  240. package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
  241. package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
  242. package/dist-sdk/src/entities/service-account/module.js +21 -0
  243. package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
  244. package/dist-sdk/src/entities/service-account/ref.js +5 -0
  245. package/dist-sdk/src/entities/service-account/to-tf.d.ts +11 -0
  246. package/dist-sdk/src/entities/service-account/to-tf.js +72 -0
  247. package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
  248. package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
  249. package/dist-sdk/src/entities/shared/filters/ast.d.ts +21 -79
  250. package/dist-sdk/src/entities/shared/filters/ast.js +5 -2
  251. package/dist-sdk/src/entities/shared/filters/index.d.ts +94 -206
  252. package/dist-sdk/src/entities/shared/filters/index.js +189 -341
  253. package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
  254. package/dist-sdk/src/entities/shared/filters/print.js +122 -0
  255. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
  256. package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
  257. package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
  258. package/dist-sdk/src/entities/shared/filters/types.js +2 -3
  259. package/dist-sdk/src/entities/skill/build.d.ts +2 -2
  260. package/dist-sdk/src/entities/skill/build.js +4 -3
  261. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +10 -0
  262. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +74 -32
  263. package/dist-sdk/src/entities/skill/index.d.ts +2 -1
  264. package/dist-sdk/src/entities/skill/index.js +2 -1
  265. package/dist-sdk/src/entities/skill/module.js +6 -0
  266. package/dist-sdk/src/entities/skill/to-tf.d.ts +5 -1
  267. package/dist-sdk/src/entities/skill/to-tf.js +18 -0
  268. package/dist-sdk/src/entities/skill/tools.d.ts +46 -31
  269. package/dist-sdk/src/entities/skill/tools.js +33 -20
  270. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +4 -1
  271. package/dist-sdk/src/entities/skill-tool/from-tf.js +76 -8
  272. package/dist-sdk/src/entities/skill-tool/module.js +9 -0
  273. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  274. package/dist-sdk/src/entities/skill-tool/to-tf.js +94 -42
  275. package/dist-sdk/src/entities/skill-tool/types.js +18 -1
  276. package/dist-sdk/src/entities/table/build.d.ts +64 -23
  277. package/dist-sdk/src/entities/table/build.js +33 -18
  278. package/dist-sdk/src/entities/table/catalog-render.js +6 -0
  279. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
  280. package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
  281. package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
  282. package/dist-sdk/src/entities/table/fields/types.js +12 -0
  283. package/dist-sdk/src/entities/table/fields.d.ts +107 -47
  284. package/dist-sdk/src/entities/table/fields.js +76 -55
  285. package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
  286. package/dist-sdk/src/entities/table/from-tf.js +261 -0
  287. package/dist-sdk/src/entities/table/index.d.ts +7 -5
  288. package/dist-sdk/src/entities/table/index.js +7 -7
  289. package/dist-sdk/src/entities/table/joins.d.ts +22 -9
  290. package/dist-sdk/src/entities/table/joins.js +8 -16
  291. package/dist-sdk/src/entities/table/module.d.ts +2 -1
  292. package/dist-sdk/src/entities/table/module.js +13 -6
  293. package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
  294. package/dist-sdk/src/entities/table/to-tf.js +230 -0
  295. package/dist-sdk/src/entities/task/build.d.ts +43 -0
  296. package/dist-sdk/src/entities/task/build.js +17 -0
  297. package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
  298. package/dist-sdk/src/entities/task/from-tf.js +38 -0
  299. package/dist-sdk/src/entities/task/index.d.ts +1 -0
  300. package/dist-sdk/src/entities/task/index.js +1 -0
  301. package/dist-sdk/src/entities/task/module.d.ts +3 -0
  302. package/dist-sdk/src/entities/task/module.js +12 -0
  303. package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
  304. package/dist-sdk/src/entities/task/to-tf.js +49 -0
  305. package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
  306. package/dist-sdk/src/entities/view/from-tf.js +209 -25
  307. package/dist-sdk/src/entities/view/module.js +5 -1
  308. package/dist-sdk/src/entities/view/to-tf.d.ts +49 -7
  309. package/dist-sdk/src/entities/view/to-tf.js +155 -18
  310. package/dist-sdk/src/entities/view/types.d.ts +8 -0
  311. package/dist-sdk/src/entities/view/types.js +43 -0
  312. package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
  313. package/dist-sdk/src/entities/visual-flow/build.js +72 -0
  314. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
  315. package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
  316. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
  317. package/dist-sdk/src/entities/visual-flow/index.js +1 -0
  318. package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
  319. package/dist-sdk/src/entities/visual-flow/module.js +41 -0
  320. package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
  321. package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
  322. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +14 -0
  323. package/dist-sdk/src/entities/visual-flow/to-tf.js +101 -0
  324. package/dist-sdk/src/entities/widget/build.d.ts +55 -0
  325. package/dist-sdk/src/entities/widget/build.js +1 -0
  326. package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
  327. package/dist-sdk/src/entities/widget/from-tf.js +209 -0
  328. package/dist-sdk/src/entities/widget/module.d.ts +3 -0
  329. package/dist-sdk/src/entities/widget/module.js +16 -0
  330. package/dist-sdk/src/entities/widget/to-tf.d.ts +44 -0
  331. package/dist-sdk/src/entities/widget/to-tf.js +204 -0
  332. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
  333. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
  334. package/dist-sdk/src/graph/index.d.ts +7 -0
  335. package/dist-sdk/src/graph/index.js +4 -18
  336. package/dist-sdk/src/graph/modules.js +30 -1
  337. package/dist-sdk/src/graph/types.d.ts +55 -7
  338. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  339. package/dist-sdk/src/internal/sdk-package.js +4 -2
  340. package/package.json +30 -15
  341. package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
  342. package/dist-sdk/src/entities/access-policy/filter.js +0 -83
  343. package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
  344. package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
  345. package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
  346. package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
  347. package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
  348. package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
  349. package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
  350. package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
  351. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
  352. package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
  353. package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
  354. package/dist-sdk/src/entities/flow/activities/form.js +0 -36
  355. package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
  356. package/dist-sdk/src/entities/flow/activities/index.js +0 -13
  357. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
  358. package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
  359. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
  360. package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
  361. package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
  362. package/dist-sdk/src/entities/flow/build.d.ts +0 -38
  363. package/dist-sdk/src/entities/flow/build.js +0 -115
  364. package/dist-sdk/src/entities/flow/index.d.ts +0 -8
  365. package/dist-sdk/src/entities/flow/index.js +0 -7
  366. package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
  367. package/dist-sdk/src/entities/flow/serialize.js +0 -94
  368. package/dist-sdk/src/entities/flow/util.d.ts +0 -27
  369. package/dist-sdk/src/entities/flow/util.js +0 -38
  370. package/dist-sdk/src/entities/table/filter.d.ts +0 -41
  371. package/dist-sdk/src/entities/table/filter.js +0 -89
  372. /package/dist-sdk/src/entities/{flow/activities/types.js → dashboard/build.js} +0 -0
@@ -0,0 +1,267 @@
1
+ import { workspaceAspectKey } from "../../engine/build/context.js";
2
+ import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
3
+ import { fieldRefToTfValue } from "../field/to-tf.js";
4
+ import { SYSTEM_FIELD_ID_ATTR_BY_KEY } from "../view/types.js";
5
+ import { DYNAMIC_LAYOUT_RESOURCE_TYPE } from "./module.js";
6
+ import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS } from "./dialect.js";
7
+ export function dynamicLayoutsToTf(layouts, opts) {
8
+ const blocks = [];
9
+ for (const [key, layout] of Object.entries(layouts ?? {})) {
10
+ const where = `dynamicLayouts.${key}`;
11
+ if (!isCanonicalTsLabel(key)) {
12
+ opts.diagnostics.push(`${where}: key is not a canonical tsLabel; dropped`);
13
+ continue;
14
+ }
15
+ const attrs = {
16
+ app_id: opts.objectId,
17
+ name: layout.name ?? "",
18
+ active: layout.active ?? true,
19
+ document_id: layout.documentId ?? "",
20
+ document_version: layout.documentVersion ?? "1.0.0",
21
+ root_component: layout.rootComponent ?? "",
22
+ components: componentMap(layout.components ?? {}, where, opts),
23
+ };
24
+ if (layout.description !== undefined)
25
+ attrs["description"] = layout.description;
26
+ if (layout.stage !== undefined) {
27
+ attrs["stage_id"] = expr.resourceAttr("elementum_app", opts.ownerTfLabel, [
28
+ "stage_ids_by_key", { index: tsLabelToTfLabel(layout.stage) },
29
+ ]);
30
+ }
31
+ if (layout.conditions !== undefined)
32
+ attrs["conditions"] = conditionMap(layout.conditions, where, opts);
33
+ if (layout.saveGroups !== undefined)
34
+ attrs["save_groups"] = saveGroupMap(layout.saveGroups, where, opts);
35
+ if (layout.fieldValidations !== undefined) {
36
+ attrs["field_validations"] = layout.fieldValidations.map((value, index) => fieldValidation(value, `${where}.fieldValidations[${index}]`, opts));
37
+ }
38
+ if (layout.dependencies !== undefined) {
39
+ attrs["dependencies"] = layout.dependencies.map((value, index) => dependency(value, `${where}.dependencies[${index}]`, opts));
40
+ }
41
+ if (layout.metadata !== undefined)
42
+ attrs["metadata"] = snakeObject(layout.metadata, where, opts);
43
+ blocks.push({
44
+ kind: "resource",
45
+ type: DYNAMIC_LAYOUT_RESOURCE_TYPE,
46
+ label: scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(key), "app"),
47
+ attrs,
48
+ });
49
+ }
50
+ return blocks;
51
+ }
52
+ function componentMap(components, where, opts) {
53
+ const out = {};
54
+ for (const [componentId, component] of Object.entries(components)) {
55
+ const attrs = {};
56
+ for (const [key, value] of Object.entries(component)) {
57
+ if (value === undefined)
58
+ continue;
59
+ if (DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS.has(key)) {
60
+ attrs[snakeKey(key)] = fieldComponent(value, `${where}.components[${JSON.stringify(componentId)}].${key}`, opts);
61
+ }
62
+ else if (key === "updateBlock") {
63
+ const rec = object(value);
64
+ const block = {};
65
+ for (const [childKey, child] of Object.entries(rec)) {
66
+ if (child === undefined)
67
+ continue;
68
+ block[childKey === "fields" ? "field_ids" : snakeKey(childKey)] =
69
+ childKey === "fields" && Array.isArray(child)
70
+ ? resolveFields(child, `${where}.components.${componentId}.updateBlock.fields`, opts)
71
+ : snakeValue(child, where, opts);
72
+ }
73
+ attrs["update_block"] = block;
74
+ }
75
+ else if (key === "automationButton") {
76
+ const rec = object(value);
77
+ const button = snakeObject(rec, where, opts);
78
+ delete button["automation"];
79
+ const token = rec["automation"];
80
+ const automation = resolveAutomation(token, `${where}.components.${componentId}.automationButton`, opts);
81
+ if (automation !== undefined)
82
+ button["automation_id"] = automation;
83
+ attrs["automation_button"] = button;
84
+ }
85
+ else if (key === "createButton") {
86
+ const rec = object(value);
87
+ const button = snakeObject(rec, where, opts);
88
+ delete button["target"];
89
+ const target = resolveAspect(rec["target"], `${where}.components.${componentId}.createButton`, opts);
90
+ if (target !== undefined)
91
+ button["target_aspect_id"] = target;
92
+ attrs["create_button"] = button;
93
+ }
94
+ else {
95
+ attrs[snakeKey(key)] = snakeValue(value, where, opts);
96
+ }
97
+ }
98
+ out[componentId] = attrs;
99
+ }
100
+ return out;
101
+ }
102
+ function fieldComponent(value, where, opts) {
103
+ const rec = object(value);
104
+ const out = snakeObject(rec, where, opts);
105
+ delete out["field"];
106
+ const field = resolveField(rec["field"], where, opts);
107
+ if (field !== undefined)
108
+ out["field_id"] = field;
109
+ return out;
110
+ }
111
+ function conditionMap(conditions, where, opts) {
112
+ const out = {};
113
+ for (const [conditionId, condition] of Object.entries(conditions)) {
114
+ const attrs = {};
115
+ for (const [key, value] of Object.entries(condition)) {
116
+ if (value === undefined)
117
+ continue;
118
+ if (DYNAMIC_LAYOUT_COMPARISON_KEYS.has(key)) {
119
+ const rec = object(value);
120
+ const comparison = {};
121
+ const field = resolveField(rec["field"], `${where}.conditions.${conditionId}.${key}`, opts);
122
+ if (field !== undefined)
123
+ comparison["field_id"] = field;
124
+ if (rec["value"] !== undefined)
125
+ comparison["value"] = typedValue(rec["value"], rec["field"], opts);
126
+ attrs[snakeKey(key)] = comparison;
127
+ }
128
+ else if (key === "stage") {
129
+ const stage = object(value)["stage"];
130
+ if (typeof stage === "string") {
131
+ attrs["stage"] = {
132
+ stage_id: expr.resourceAttr("elementum_app", opts.ownerTfLabel, ["stage_ids_by_key", { index: tsLabelToTfLabel(stage) }]),
133
+ };
134
+ }
135
+ }
136
+ else {
137
+ attrs[snakeKey(key)] = snakeValue(value, where, opts);
138
+ }
139
+ }
140
+ out[conditionId] = attrs;
141
+ }
142
+ return out;
143
+ }
144
+ function saveGroupMap(groups, where, opts) {
145
+ const out = {};
146
+ for (const [id, group] of Object.entries(groups)) {
147
+ const attrs = snakeObject(group, where, opts);
148
+ delete attrs["fields"];
149
+ attrs["field_ids"] = resolveFields(group["fields"] ?? [], `${where}.saveGroups.${id}.fields`, opts);
150
+ if (Array.isArray(group["validations"])) {
151
+ attrs["validations"] = group["validations"].map((v, i) => fieldValidation(object(v), `${where}.saveGroups.${id}.validations[${i}]`, opts));
152
+ }
153
+ out[id] = attrs;
154
+ }
155
+ return out;
156
+ }
157
+ function fieldValidation(value, where, opts) {
158
+ const out = snakeObject(value, where, opts);
159
+ delete out["field"];
160
+ const field = resolveField(value["field"], where, opts);
161
+ if (field !== undefined)
162
+ out["field_id"] = field;
163
+ return out;
164
+ }
165
+ function dependency(value, where, opts) {
166
+ const out = snakeObject(value, where, opts);
167
+ delete out["source_field"];
168
+ delete out["target_field"];
169
+ const source = resolveField(value["sourceField"], `${where}.sourceField`, opts);
170
+ const target = resolveField(value["targetField"], `${where}.targetField`, opts);
171
+ if (source !== undefined)
172
+ out["source_field_id"] = source;
173
+ if (target !== undefined)
174
+ out["target_field_id"] = target;
175
+ return out;
176
+ }
177
+ function resolveFields(values, where, opts) {
178
+ return values.flatMap((value) => {
179
+ const resolved = resolveField(value, where, opts);
180
+ return resolved === undefined ? [] : [resolved];
181
+ });
182
+ }
183
+ function resolveField(value, where, opts) {
184
+ if (typeof value === "string") {
185
+ const attr = SYSTEM_FIELD_ID_ATTR_BY_KEY.get(value);
186
+ if (attr === undefined)
187
+ opts.diagnostics.push(`${where}: "${value}" is not a known system field key; dropped`);
188
+ return attr === undefined ? undefined : expr.local(`${opts.ownerTfLabel}_${attr}`);
189
+ }
190
+ const token = value;
191
+ const refName = token?.refName ?? "";
192
+ if (token?.parent !== undefined && token.parent !== opts.ownerRefName) {
193
+ opts.diagnostics.push(`${where}: field "${refName}" targets a different app; dropped`);
194
+ return undefined;
195
+ }
196
+ const resolved = fieldRefToTfValue(token?.fieldType ?? "", refName, opts.ownerTfLabel, "app");
197
+ if (resolved === undefined)
198
+ opts.diagnostics.push(`${where}: field "${refName}" has no Terraform mapping; dropped`);
199
+ return resolved;
200
+ }
201
+ function typedValue(value, fieldValue, opts) {
202
+ const rec = object(value);
203
+ const token = fieldValue;
204
+ if (typeof rec["string"] === "string" && token?.options?.includes(rec["string"])) {
205
+ const localName = token.tags?.includes("STATUS")
206
+ ? `${opts.ownerTfLabel}_status_options_by_label`
207
+ : token.tags?.includes("STAGE")
208
+ ? `${opts.ownerTfLabel}_stage_options_by_label`
209
+ : `${scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(token.refName ?? ""), "app")}_options_by_label`;
210
+ return { string: expr.local(localName, [{ index: rec["string"] }]) };
211
+ }
212
+ return snakeObject(rec, "dynamic layout typed value", opts);
213
+ }
214
+ function resolveAutomation(token, where, opts) {
215
+ const refName = token?.refName ?? "";
216
+ if (token?.parent !== undefined && token.parent !== opts.ownerRefName) {
217
+ opts.diagnostics.push(`${where}: cross-app automations are not supported; dropped`);
218
+ return undefined;
219
+ }
220
+ if (!isCanonicalTsLabel(refName)) {
221
+ opts.diagnostics.push(`${where}: automation key "${refName}" is not a canonical tsLabel; dropped`);
222
+ return undefined;
223
+ }
224
+ return expr.resourceAttr("elementum_automation", scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(refName), "app"), ["id"]);
225
+ }
226
+ function resolveAspect(token, where, opts) {
227
+ const kind = token?.__kind === "element" ? "element" : "app";
228
+ const refName = token?.refName ?? "";
229
+ if (kind === "app" && refName === opts.ownerRefName)
230
+ return opts.objectId;
231
+ const sibling = opts.workspaceAspects?.get(workspaceAspectKey(kind, refName));
232
+ if (sibling !== undefined) {
233
+ return expr.resourceAttr(kind === "app" ? "elementum_app" : "elementum_element", sibling.tfLabel, ["id"]);
234
+ }
235
+ const name = token?.name ?? refName;
236
+ if (name === "") {
237
+ opts.diagnostics.push(`${where}: target aspect has no name/refName; dropped`);
238
+ return undefined;
239
+ }
240
+ const label = sanitizeName(name);
241
+ if (kind === "element")
242
+ opts.orgRefs.foreignElement(label, name);
243
+ else
244
+ opts.orgRefs.foreignApp(label, name);
245
+ return expr.dataAttr(kind === "app" ? "elementum_app" : "elementum_element", label, ["id"]);
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
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * v2 element authoring — `defineElement`.
3
3
  *
4
- * Elements are not apps — they're a dedicated aspect kind with their own
4
+ * Elements are not apps — they're a dedicated entity kind with their own
5
5
  * builder/printer — but a pulled real-world element proved they carry nearly
6
6
  * every authoring slot an app does (category icon/color, namespace,
7
7
  * description, cloud options, display blocks). The one genuinely new
@@ -17,17 +17,19 @@
17
17
  * authored inline; the cloud link is a `CatalogRef` token resolved at deploy.
18
18
  * Deployed via the same wire client compose path apps use.
19
19
  *
20
- * Field/category serialization is genuinely shared with apps (both are
21
- * "aspects" — see `src/CLAUDE.md`'s glossary), so this imports `serializeField`
20
+ * Field/category serialization is genuinely shared with apps and elements, so this imports `serializeField`
22
21
  * and its types directly from `src/aspects/build.ts` rather than duplicating
23
22
  * them.
24
23
  */
25
- import { type AspectRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
24
+ import { type AppOrElementRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
26
25
  import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
27
26
  import type { AccessPolicyOptions } from "../access-policy/build.js";
27
+ import type { AppRole } from "../role/build.js";
28
28
  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";
29
+ import { type AppCategory, type AppCloudOptions, type AppField, type AppFieldRefs, type AppLayout, type AppCalendarView, type AppDashboard, type AppDashboardView, type AppKanbanView, type AppListView, type AppRecordCreateForm, type AppSystemFieldOverride } from "../app/build.js";
30
+ export type { AppCalendarView, AppCategory, AppDashboard, AppDashboardView, AppField, AppKanbanView, AppLayout, AppListView, AppRecordCreateForm, AppRecordCreateFormSection, AppSystemFieldOverride, PicklistOption, } from "../app/build.js";
31
+ import type { AppRelationship } from "../relationship/build.js";
32
+ import type { AppWidget } from "../widget/build.js";
31
33
  /** The system fields elements actually have (per `locals.ts`) — unlike apps, no status/stage/audit fields. */
32
34
  export type ElementSystemFieldKey = "id" | "title";
33
35
  export declare const ELEMENT_SYSTEM_FIELD_KEYS: readonly ElementSystemFieldKey[];
@@ -36,13 +38,14 @@ export interface ElementSystemFields {
36
38
  readonly id?: AppSystemFieldOverride;
37
39
  readonly title?: AppSystemFieldOverride;
38
40
  }
41
+ export type { AppWidget, CreateRecordWidget, LinkRecordsWidget, RelatedRecordsWidget, RunAutomationWidget, RunAutomationWidgetParameter, WidgetButtonStyle, WidgetButtonType } from "../widget/build.js";
42
+ export type { AppRelationship, AppRelationshipColumn } from "../relationship/build.js";
39
43
  /**
40
44
  * The source table a LINKED element maps to — an existing table in the
41
45
  * customer's cloud database, vs. a STANDARD element (no `cloudConnection`),
42
46
  * 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
47
+ * path (Snowflake cloud mapping, hybrid-table selection, and title/id columns)
48
+ * — applied on create only: an element's table binding is
46
49
  * immutable once set.
47
50
  */
48
51
  export interface ElementCloudConnection {
@@ -57,7 +60,7 @@ export interface ElementCloudConnection {
57
60
  readonly idColumnName?: string;
58
61
  }
59
62
  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. */
63
+ /** The platform handle (business acronym, e.g. "PRD") — distinct from the refName. Omit to let the platform assign one. */
61
64
  readonly handle?: string;
62
65
  readonly name: string;
63
66
  readonly category: AppCategory;
@@ -68,7 +71,7 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
68
71
  /**
69
72
  * Cloud link whose data store this element's records persist in (token →
70
73
  * 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.
74
+ * Applied on create only: an element's cloud link is immutable once created.
72
75
  */
73
76
  readonly cloudLink?: CloudLinkRef;
74
77
  /** Cloud-backing options (Snowflake-only); applied on create only. */
@@ -102,6 +105,16 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
102
105
  readonly layouts?: Readonly<Record<string, AppLayout>>;
103
106
  /** Saved list views, keyed by view ref name. */
104
107
  readonly listViews?: Readonly<Record<string, AppListView>>;
108
+ /** Calendar views, keyed by stable view ref name. */
109
+ readonly calendarViews?: Readonly<Record<string, AppCalendarView>>;
110
+ /** Kanban views, keyed by stable view ref name. */
111
+ readonly kanbanViews?: Readonly<Record<string, AppKanbanView>>;
112
+ readonly dashboards?: Readonly<Record<string, AppDashboard>>;
113
+ readonly widgets?: Readonly<Record<string, AppWidget>>;
114
+ readonly dashboardViews?: Readonly<Record<string, AppDashboardView>>;
115
+ /** Typed new-record form (`elementum_record_create_form`). */
116
+ readonly recordCreateForm?: AppRecordCreateForm;
117
+ readonly relationships?: Readonly<Record<string, AppRelationship>>;
105
118
  /** Display order of `listViews` (by key). Defaults to declaration order. */
106
119
  readonly viewOrder?: readonly string[];
107
120
  /**
@@ -110,6 +123,8 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
110
123
  * (the creating user, typically `whereTrue`) that is not authored here.
111
124
  */
112
125
  readonly accessPolicies?: readonly AccessPolicyOptions[];
126
+ /** Custom roles keyed by stable authoring name. */
127
+ readonly roles?: Readonly<Record<string, AppRole>>;
113
128
  }
114
129
  /**
115
130
  * An element's reference surface: identity plus its fields (the only bag
@@ -122,8 +137,10 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
122
137
  * record`). `id`/`title` round out the bag the same way `AppRef` folds in
123
138
  * its full `SystemFieldKey` set — a finite, closed term, not a wide index.
124
139
  */
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;
140
+ 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>, {
141
+ readonly __kind: "element";
142
+ }> & {
143
+ readonly fields: AppFieldRefs<F, RefName> & Record<ElementSystemFieldKey, FieldRef<RefName>> & R;
127
144
  };
128
145
  /**
129
146
  * The configured result of `defineElement` — its reference surface (`ref()`)
@@ -132,7 +149,7 @@ export type ElementRef<F extends Record<string, AppField> = Record<string, AppFi
132
149
  * `src/aspects/build.ts` for the full rationale (identical here).
133
150
  */
134
151
  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>;
152
+ ref<const RefName extends string>(refName: RefName): ElementRef<F, R, RefName>;
136
153
  def(refName: string): DeployableEntity;
137
154
  }
138
155
  /** Build a v2 element entity: org-owned, compose-body payload. Exposes `.ref(refName)` and `.def(refName)`. */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * v2 element authoring — `defineElement`.
3
3
  *
4
- * Elements are not apps — they're a dedicated aspect kind with their own
4
+ * Elements are not apps — they're a dedicated entity kind with their own
5
5
  * builder/printer — but a pulled real-world element proved they carry nearly
6
6
  * every authoring slot an app does (category icon/color, namespace,
7
7
  * description, cloud options, display blocks). The one genuinely new
@@ -17,15 +17,14 @@
17
17
  * authored inline; the cloud link is a `CatalogRef` token resolved at deploy.
18
18
  * Deployed via the same wire client compose path apps use.
19
19
  *
20
- * Field/category serialization is genuinely shared with apps (both are
21
- * "aspects" — see `src/CLAUDE.md`'s glossary), so this imports `serializeField`
20
+ * Field/category serialization is genuinely shared with apps and elements, so this imports `serializeField`
22
21
  * and its types directly from `src/aspects/build.ts` rather than duplicating
23
22
  * them.
24
23
  */
25
24
  import { slimTokens } from "../../catalog/index.js";
26
25
  import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY } from "../../core/system-fields.js";
27
26
  import { serializeDisplayBlocks } from "../app/display-blocks.js";
28
- import { assertNoSystemKeyCollision, serializeField, } from "../app/build.js";
27
+ import { assertNoSystemKeyCollision, picklistOptionLabels, serializeField, } from "../app/build.js";
29
28
  export const ELEMENT_SYSTEM_FIELD_KEYS = ["id", "title"];
30
29
  /**
31
30
  * Client-side validation for `defineElement` — the authoring-time home for
@@ -85,6 +84,7 @@ export function defineElement(opts) {
85
84
  parentKind: "element",
86
85
  parentName: opts.name,
87
86
  fieldType: field.type,
87
+ ...(field.options !== undefined ? { options: picklistOptionLabels(field.options) } : {}),
88
88
  ...(field.tags !== undefined ? { tags: field.tags } : {}),
89
89
  };
90
90
  }
@@ -136,8 +136,16 @@ export function defineElement(opts) {
136
136
  ...(recordCreateDisplayBlocks !== undefined ? { recordCreateDisplayBlocks } : {}),
137
137
  ...(opts.layouts !== undefined ? { layouts: opts.layouts } : {}),
138
138
  ...(opts.listViews !== undefined ? { listViews: opts.listViews } : {}),
139
+ ...(opts.calendarViews !== undefined ? { calendarViews: opts.calendarViews } : {}),
140
+ ...(opts.kanbanViews !== undefined ? { kanbanViews: opts.kanbanViews } : {}),
141
+ ...(opts.dashboards !== undefined ? { dashboards: opts.dashboards } : {}),
142
+ ...(opts.widgets !== undefined ? { widgets: opts.widgets } : {}),
143
+ ...(opts.dashboardViews !== undefined ? { dashboardViews: opts.dashboardViews } : {}),
144
+ ...(opts.recordCreateForm !== undefined ? { recordCreateForm: opts.recordCreateForm } : {}),
145
+ ...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
139
146
  ...(opts.viewOrder !== undefined ? { viewOrder: opts.viewOrder } : {}),
140
147
  ...(opts.accessPolicies !== undefined ? { accessPolicies: opts.accessPolicies } : {}),
148
+ ...(opts.roles !== undefined ? { roles: opts.roles } : {}),
141
149
  };
142
150
  return {
143
151
  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
  }
@@ -6,7 +6,12 @@
6
6
  * field/print internals genuinely shared between both aspect kinds).
7
7
  */
8
8
  export { defineElement, type ElementCloudConnection, type ElementConfigured, type ElementRef, type ElementV2Options, } from "./build.js";
9
+ export { type AppRecordCreateForm, type AppRecordCreateFormSection } from "../app/build.js";
10
+ export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
11
+ export { type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize } from "../dashboard/build.js";
9
12
  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";
13
+ export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
14
+ export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef, type AppRole, type RoleAutoShare, type RoleGroupRef, type RolePermission, type RolePermissionGroup, type RolePermissionLevel, type RoleUserRef } from "../role/build.js";
15
+ export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
16
+ export * as filter from "../shared/filters/index.js";
17
+ export { type Filter } from "../shared/filters/index.js";
@@ -7,4 +7,7 @@
7
7
  */
8
8
  export { defineElement, } from "./build.js";
9
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";
10
+ export { groupId, userId } from "../access-policy/build.js";
11
+ export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef } from "../role/build.js";
12
+ export { serviceAccountRef } from "../service-account/ref.js";
13
+ 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 }),