@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
@@ -12,14 +12,22 @@
12
12
  * dependent picklists, display blocks, and field-id reconciliation for updates
13
13
  * follow the same pattern and land as expansion.
14
14
  */
15
- import { type AspectRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
15
+ import { type AgentRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
16
16
  import type { WorkflowFieldType } from "../shared/types/field-types.js";
17
17
  import { type SystemFieldKey } from "../../core/system-fields.js";
18
18
  import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
19
19
  import type { AspectFieldInput } from "../../../elementum-entity-client/clients/aspects/models/field-types.js";
20
- import type { AccessPolicyOptions } from "../access-policy/build.js";
20
+ import type { AccessPolicyGroupRef, AccessPolicyOptions, AccessPolicyUserRef } from "../access-policy/build.js";
21
+ import type { AppDynamicLayout } from "../dynamic-layout/build.js";
22
+ import type { AppRelationship } from "../relationship/build.js";
23
+ import type { AppWidget } from "../widget/build.js";
24
+ import type { DashboardWidget } from "../dashboard/build.js";
25
+ import type { AppRole } from "../role/build.js";
26
+ import type { AppServiceAccount } from "../service-account/build.js";
27
+ import type { Filter } from "../shared/filters/types.js";
21
28
  import { type DisplayBlock } from "./display-blocks.js";
22
29
  import type { Expr, ExprType } from "../field/calc.js";
30
+ import type { UnsafePlatformId } from "../../core/platform-id.js";
23
31
  /**
24
32
  * Authoring-time picklist config. Wire `PicklistConfigInput` uses bare id
25
33
  * strings; here `relatedAspectId` / `relatedLabelFieldId` / `parentFieldId`
@@ -31,18 +39,18 @@ import type { Expr, ExprType } from "../field/calc.js";
31
39
  * resolve against the current app's state only).
32
40
  */
33
41
  export interface AppPicklistDynamicConfig {
34
- readonly relatedAspectId: AspectRef | string;
35
- readonly relatedLabelFieldId: FieldRef | string;
36
- readonly parentFieldId?: FieldRef | string;
42
+ readonly relatedAspectId: AppOrElementRef | UnsafePlatformId;
43
+ readonly relatedLabelFieldId: FieldRef | UnsafePlatformId;
44
+ readonly parentFieldId?: FieldRef | UnsafePlatformId;
37
45
  readonly autoRelate?: boolean;
38
46
  readonly valuesRenderType?: string;
39
- readonly filter?: Readonly<Record<string, unknown>>;
47
+ readonly filter?: Filter;
40
48
  readonly sort?: Readonly<Record<string, unknown>>;
41
49
  }
42
50
  export interface AppPicklistConfig {
43
51
  readonly static?: {
44
- readonly parentFieldId?: FieldRef | string;
45
- readonly filter?: Readonly<Record<string, unknown>>;
52
+ readonly parentFieldId?: FieldRef | UnsafePlatformId;
53
+ readonly filter?: Filter;
46
54
  readonly sort?: Readonly<Record<string, unknown>>;
47
55
  };
48
56
  readonly dynamic?: AppPicklistDynamicConfig;
@@ -100,7 +108,7 @@ export interface AppField {
100
108
  /**
101
109
  * `RELATION` only — the related object/field
102
110
  * (`elementum_relation_field.related_object_id`/`related_label_field_id`).
103
- * Accepts a catalog token (`AspectRef`/`FieldRef`) or a raw platform id. A
111
+ * Accepts a catalog token (`AppOrElementRef`/`FieldRef`) or a raw platform id. A
104
112
  * token naming a SIBLING app/element authored in the same build resolves
105
113
  * to a direct resource reference and does NOT need to already exist on
106
114
  * the platform; only a token naming something genuinely outside this
@@ -109,8 +117,8 @@ export interface AppField {
109
117
  * identity, so there's nothing to resolve a token against on the extract
110
118
  * side.
111
119
  */
112
- readonly relatedObject?: AspectRef | string;
113
- readonly relatedLabelField?: FieldRef | string;
120
+ readonly relatedObject?: AppOrElementRef | UnsafePlatformId;
121
+ readonly relatedLabelField?: FieldRef | UnsafePlatformId;
114
122
  /** `RELATION` only. Defaults to `true` on the platform. */
115
123
  readonly autoRelate?: boolean;
116
124
  }
@@ -225,16 +233,84 @@ export interface AppListView {
225
233
  readonly density?: string;
226
234
  readonly rows?: number;
227
235
  /**
228
- * Opaque JSON pass-through — not a typed DSL. `elementum build` is stateless, so
229
- * a list view with a live filter/sort MUST re-author it verbatim (as
230
- * pulled) or every rebuild plans to null it out, which trips a real
231
- * provider bug ("inconsistent result after apply"). Round-trip only;
232
- * hand-author at your own risk (the shape isn't validated).
236
+ * Provider filter tree. The shared `filter` helpers produce compatible
237
+ * row filters, and field tokens are resolved to deployed field IDs during
238
+ * Terraform generation. Pulled provider-native filters also round-trip.
233
239
  */
234
- readonly filter?: unknown;
240
+ readonly filter?: Filter;
235
241
  /** Opaque JSON pass-through — see `filter`. */
236
242
  readonly sort?: unknown;
237
243
  }
244
+ /** An agent-powered record view (`elementum_agent_view`). */
245
+ export interface AppAgentView {
246
+ readonly name: string;
247
+ readonly agent: AgentRef;
248
+ readonly allowRecordCreation?: boolean;
249
+ /** Provider-native filter object; pulled values round-trip verbatim. */
250
+ readonly filter?: Filter;
251
+ /** JSON sort payload; pulled values round-trip verbatim. */
252
+ readonly sort?: unknown;
253
+ readonly userIds?: readonly AccessPolicyUserRef[];
254
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
255
+ readonly displayOrder?: number;
256
+ }
257
+ /** A calendar view positioned by a date/datetime field (`elementum_calendar_view`). */
258
+ export interface AppCalendarView {
259
+ readonly name: string;
260
+ readonly columns?: readonly AppViewFieldRef[];
261
+ readonly displayByField?: AppViewFieldRef;
262
+ readonly allowRecordCreation?: boolean;
263
+ /** Provider-native filter object; pulled values round-trip verbatim. */
264
+ readonly filter?: Filter;
265
+ /** JSON sort payload; pulled values round-trip verbatim. */
266
+ readonly sort?: unknown;
267
+ readonly userIds?: readonly AccessPolicyUserRef[];
268
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
269
+ }
270
+ /** A kanban view grouped by a field (`elementum_kanban_view`). */
271
+ export interface AppKanbanView extends AppCalendarView {
272
+ /** Fields users may select in the view's interactive filter UI. */
273
+ readonly allowedFilterFields?: readonly AppViewFieldRef[];
274
+ }
275
+ /** A dashboard owned by this app or element (`elementum_dashboard`). */
276
+ export interface AppDashboard {
277
+ readonly name: string;
278
+ readonly favorite?: boolean;
279
+ readonly tags?: readonly string[];
280
+ readonly widgets?: Readonly<Record<string, DashboardWidget>>;
281
+ }
282
+ export type { DashboardRecordsWidget, DashboardWidget, DashboardWidgetSize } from "../dashboard/build.js";
283
+ /** A managed view that embeds a dashboard from this definition's `dashboards` bag. */
284
+ export interface AppDashboardView {
285
+ readonly name: string;
286
+ /** Stable key from the sibling `dashboards` bag. */
287
+ readonly dashboard: string;
288
+ readonly allowRecordCreation?: boolean;
289
+ readonly filter?: Filter;
290
+ readonly sort?: unknown;
291
+ readonly userIds?: readonly AccessPolicyUserRef[];
292
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
293
+ }
294
+ /** One group in the immutable new-record form (`elementum_record_create_form`). */
295
+ export interface AppRecordCreateFormSection {
296
+ readonly name: string;
297
+ /** Typed custom-field tokens or canonical system-field keys. */
298
+ readonly fields: readonly AppViewFieldRef[];
299
+ /** Optional app-owned agent that assists this section. */
300
+ readonly agent?: AgentRef;
301
+ readonly icon?: string;
302
+ readonly color?: string;
303
+ /** Defaults to this section's array index. */
304
+ readonly displayOrder?: number;
305
+ readonly displayLocation?: "CENTER";
306
+ readonly sideNavItem?: boolean;
307
+ readonly hidden?: boolean;
308
+ readonly maxColumns?: number;
309
+ }
310
+ /** The owning aspect's new-record form. Any edit replaces the provider resource. */
311
+ export interface AppRecordCreateForm {
312
+ readonly sections: readonly AppRecordCreateFormSection[];
313
+ }
238
314
  export interface AppV2Options<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> extends EntityDeployOptions {
239
315
  readonly name: string;
240
316
  readonly category: AppCategory;
@@ -290,7 +366,25 @@ export interface AppV2Options<F extends Record<string, AppField> = Record<string
290
366
  readonly layouts?: Readonly<Record<string, AppLayout>>;
291
367
  /** Saved list views, keyed by view ref name. */
292
368
  readonly listViews?: Readonly<Record<string, AppListView>>;
293
- /** Display order of `listViews` (by key). Defaults to declaration order. */
369
+ /** Calendar views, keyed by stable view ref name. */
370
+ readonly calendarViews?: Readonly<Record<string, AppCalendarView>>;
371
+ /** Kanban views, keyed by stable view ref name. */
372
+ readonly kanbanViews?: Readonly<Record<string, AppKanbanView>>;
373
+ /** Dashboards owned by this app. */
374
+ readonly dashboards?: Readonly<Record<string, AppDashboard>>;
375
+ /** Record-layout widgets keyed by a stable authoring name. */
376
+ readonly widgets?: Readonly<Record<string, AppWidget>>;
377
+ /** Dashboard-backed views, keyed by stable view ref name. */
378
+ readonly dashboardViews?: Readonly<Record<string, AppDashboardView>>;
379
+ /** Agent-powered views, keyed by view ref name. */
380
+ readonly agentViews?: Readonly<Record<string, AppAgentView>>;
381
+ /** Typed new-record form, distinct from legacy compose-only `recordCreateDisplayBlocks`. */
382
+ readonly recordCreateForm?: AppRecordCreateForm;
383
+ /** Typed V2 DASHBOARD layouts, keyed by stable EDK ref name. */
384
+ readonly dynamicLayouts?: Readonly<Record<string, AppDynamicLayout>>;
385
+ /** AutoRelations keyed by stable ref name. */
386
+ readonly relationships?: Readonly<Record<string, AppRelationship>>;
387
+ /** Display order of all authored views (by key). Defaults to declaration order by view bag. */
294
388
  readonly viewOrder?: readonly string[];
295
389
  /**
296
390
  * App-level sharing & row-level-security policies (`elementum_access_policy`), in declaration order.
@@ -298,6 +392,10 @@ export interface AppV2Options<F extends Record<string, AppField> = Record<string
298
392
  * (the creating user, typically `whereTrue`) that is not authored here.
299
393
  */
300
394
  readonly accessPolicies?: readonly AccessPolicyOptions[];
395
+ /** Custom roles keyed by stable authoring name. Managed roles remain platform-owned lookups. */
396
+ readonly roles?: Readonly<Record<string, AppRole>>;
397
+ /** Dedicated non-human identities, including who may run as each account. */
398
+ readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
301
399
  }
302
400
  /**
303
401
  * Serialize an authored field to its `AspectFieldInput` wire shape — shared
@@ -336,10 +434,8 @@ export declare function serializeSystemFields(overrides: AppSystemFields | undef
336
434
  * `ownFile`) without losing the per-field type precision `RecordShape`
337
435
  * (`entities/field/record-shape.ts`) needs to discriminate value types.
338
436
  */
339
- export type AppFieldRefs<F extends Record<string, AppField>> = {
340
- readonly [K in keyof F]: FieldRef & {
341
- readonly fieldType: F[K]["type"];
342
- };
437
+ export type AppFieldRefs<F extends Record<string, AppField>, Parent extends string = string> = {
438
+ readonly [K in keyof F]: FieldRef<Parent, Extract<K, string>, F[K]["type"]>;
343
439
  };
344
440
  /**
345
441
  * An app's reference surface: identity plus its fields (the only bag other
@@ -360,9 +456,22 @@ export type AppFieldRefs<F extends Record<string, AppField>> = {
360
456
  * the same reason — `Record<string, never>` would reintroduce it even when
361
457
  * no `readonlyFields` are declared.
362
458
  */
363
- export type AppRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> = AspectRef & {
364
- readonly fields: AppFieldRefs<F> & Record<SystemFieldKey, FieldRef> & R;
459
+ export type AppRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string> = Extract<AppOrElementRef<RefName>, {
460
+ readonly __kind: "app";
461
+ }> & {
462
+ readonly fields: AppFieldRefs<F, RefName> & Record<SystemFieldKey, FieldRef<RefName>> & R;
463
+ };
464
+ /**
465
+ * The app reference available while configuring options that point back into
466
+ * the app itself. Child helpers preserve both the literal child key and owner,
467
+ * without forcing the app file to import its generated catalog (a cycle).
468
+ */
469
+ export type AppSelfRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string> = AppRef<F, R, RefName> & {
470
+ agent<const Name extends string>(refName: Name, name?: string): CatalogRef<"agent", Name, RefName>;
471
+ automation<const Name extends string>(refName: Name, name?: string): AutomationCatalogRef & CatalogRef<"automation", Name, RefName>;
365
472
  };
473
+ /** Reference-bearing app options that can safely be authored from `withRefs`. */
474
+ export type AppReferenceConfiguration = Pick<AppV2Options, "layouts" | "listViews" | "calendarViews" | "kanbanViews" | "dashboards" | "widgets" | "dashboardViews" | "agentViews" | "recordCreateForm" | "dynamicLayouts" | "relationships" | "viewOrder" | "accessPolicies">;
366
475
  /**
367
476
  * The configured result of `defineApp` — its reference surface (`ref()`) and
368
477
  * its deployable entity (`def()`). Both take `refName` as a **call-time
@@ -374,8 +483,10 @@ export type AppRef<F extends Record<string, AppField> = Record<string, AppField>
374
483
  * the system avoids, just one level up.
375
484
  */
376
485
  export interface AppConfigured<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> {
377
- ref(refName: string): AppRef<F, R>;
486
+ ref<const RefName extends string>(refName: RefName): AppRef<F, R, RefName>;
378
487
  def(refName: string): DeployableEntity;
488
+ /** Configure self-referential record experiences without hand-building ref tokens. */
489
+ withRefs(configure: (app: AppSelfRef<F, R>) => AppReferenceConfiguration): AppConfigured<F, R>;
379
490
  }
380
491
  /**
381
492
  * Build a v2 app entity: org-owned, compose-body payload. Exposes
@@ -393,4 +504,5 @@ export interface AppConfigured<F extends Record<string, AppField> = Record<strin
393
504
  * "[a-zA-Z]*")`). Mirror that rule here rather than inventing a stricter one.
394
505
  */
395
506
  export declare const APP_HANDLE_RE: RegExp;
507
+ export declare function picklistOptionLabels(options: readonly (string | PicklistOption)[]): readonly string[];
396
508
  export declare function defineApp<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>>(opts: AppV2Options<F, R>): AppConfigured<F, R>;
@@ -108,6 +108,17 @@ function picklistValue(opt) {
108
108
  ...(opt.color !== undefined ? { color: opt.color } : {}),
109
109
  };
110
110
  }
111
+ function unwrapUnsafePlatformIds(value) {
112
+ if (value !== null && typeof value === "object") {
113
+ if (value.__unsafe === "platformId") {
114
+ return value.value;
115
+ }
116
+ if (Array.isArray(value))
117
+ return value.map(unwrapUnsafePlatformIds);
118
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, unwrapUnsafePlatformIds(child)]));
119
+ }
120
+ return value;
121
+ }
111
122
  /**
112
123
  * Serialize an authored field to its `AspectFieldInput` wire shape — shared
113
124
  * with `defineElement`. `refName` is the field's bag key in `defineApp`'s
@@ -152,7 +163,7 @@ export function serializeField(field, refName) {
152
163
  base.picklistValues = field.options.map(picklistValue);
153
164
  }
154
165
  if (field.config !== undefined) {
155
- base.config = field.config;
166
+ base.config = unwrapUnsafePlatformIds(field.config);
156
167
  }
157
168
  else if (field.parentField !== undefined) {
158
169
  // Dependent dropdown: parent field token → config.static.parentFieldId.
@@ -172,9 +183,9 @@ export function serializeField(field, refName) {
172
183
  }
173
184
  if (key === "relation") {
174
185
  if (field.relatedObject !== undefined)
175
- base.relatedObject = field.relatedObject;
186
+ base.relatedObject = unwrapUnsafePlatformIds(field.relatedObject);
176
187
  if (field.relatedLabelField !== undefined)
177
- base.relatedLabelField = field.relatedLabelField;
188
+ base.relatedLabelField = unwrapUnsafePlatformIds(field.relatedLabelField);
178
189
  if (field.autoRelate !== undefined)
179
190
  base.autoRelate = field.autoRelate;
180
191
  }
@@ -269,7 +280,7 @@ function validateAppOptions(opts) {
269
280
  throw new Error(`defineApp "${opts.name}": namespace "${opts.namespace}" must be lowercase letters only (a–z).`);
270
281
  }
271
282
  }
272
- function picklistOptionLabels(options) {
283
+ export function picklistOptionLabels(options) {
273
284
  return options.map((option) => typeof option === "string" ? option : option.label);
274
285
  }
275
286
  export function defineApp(opts) {
@@ -281,7 +292,79 @@ export function defineApp(opts) {
281
292
  throw new Error(`defineApp "${opts.name}" requires at least one field — a fields: {} entry or a systemFields override.`);
282
293
  }
283
294
  const kind = "app";
284
- return {
295
+ function makeRef(refName) {
296
+ // `handle` here is the disambiguated bag key (the Record key, e.g.
297
+ // "severity") — kept so `renderCatalog` can derive the catalog's bag
298
+ // key from it. It's also the join key deploy resolves fields by.
299
+ const fields = {};
300
+ for (const [bagKey, field] of Object.entries(opts.fields)) {
301
+ fields[bagKey] = {
302
+ __kind: "field",
303
+ refName: bagKey,
304
+ name: field.name,
305
+ parent: refName,
306
+ parentKind: kind,
307
+ parentName: opts.name,
308
+ fieldType: field.type,
309
+ ...(field.options !== undefined ? { options: picklistOptionLabels(field.options) } : {}),
310
+ ...(field.tags !== undefined ? { tags: field.tags } : {}),
311
+ };
312
+ }
313
+ for (const key of SYSTEM_FIELD_KEYS) {
314
+ if (fields[key] !== undefined)
315
+ continue;
316
+ const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
317
+ const override = opts.systemFields?.[key];
318
+ fields[key] = {
319
+ __kind: "field",
320
+ refName: key,
321
+ name: override?.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key],
322
+ parent: refName,
323
+ parentKind: kind,
324
+ parentName: opts.name,
325
+ fieldType: SYSTEM_FIELD_TAG_TO_TYPE[tag],
326
+ tags: [tag],
327
+ ...(override !== undefined && "options" in override ? { options: picklistOptionLabels(override.options) } : {}),
328
+ };
329
+ }
330
+ if (opts.readonlyFields !== undefined) {
331
+ for (const [bagKey, ref] of Object.entries(opts.readonlyFields)) {
332
+ fields[bagKey] = {
333
+ ...ref,
334
+ refName: bagKey,
335
+ parent: refName,
336
+ parentKind: kind,
337
+ parentName: opts.name,
338
+ };
339
+ }
340
+ }
341
+ const self = {
342
+ __kind: kind,
343
+ refName,
344
+ name: opts.name,
345
+ fields,
346
+ agent(childRefName, name = childRefName) {
347
+ return { __kind: "agent", refName: childRefName, name, parent: refName };
348
+ },
349
+ automation(childRefName, name = childRefName) {
350
+ return { __kind: "automation", refName: childRefName, name, parent: refName };
351
+ },
352
+ };
353
+ return self;
354
+ }
355
+ function withReferenceConfiguration(configure) {
356
+ return {
357
+ ref: configured.ref,
358
+ def(refName) {
359
+ const referenced = configure(makeRef(refName));
360
+ return defineApp({ ...opts, ...referenced }).def(refName);
361
+ },
362
+ withRefs(next) {
363
+ return withReferenceConfiguration((app) => ({ ...configure(app), ...next(app) }));
364
+ },
365
+ };
366
+ }
367
+ const configured = {
285
368
  ref(refName) {
286
369
  // `handle` here is the disambiguated bag key (the Record key, e.g.
287
370
  // "severity") — kept so `renderCatalog` can derive the catalog's bag
@@ -295,54 +378,7 @@ export function defineApp(opts) {
295
378
  // with no bag-key context available) defaults it to `name` instead —
296
379
  // both harmless, since printed refs re-resolve by name/bag key at their
297
380
  // own deploy, not by this in-memory bag key.
298
- const fields = {};
299
- for (const [bagKey, field] of Object.entries(opts.fields)) {
300
- fields[bagKey] = {
301
- __kind: "field",
302
- refName: bagKey,
303
- name: field.name,
304
- parent: refName,
305
- parentKind: kind,
306
- parentName: opts.name,
307
- fieldType: field.type,
308
- ...(field.options !== undefined ? { options: picklistOptionLabels(field.options) } : {}),
309
- ...(field.tags !== undefined ? { tags: field.tags } : {}),
310
- };
311
- }
312
- // Every app has these platform-owned fields even when the authoring file
313
- // omits systemFields (omission means "use the platform default", not
314
- // "the field does not exist"). Keep them on the reference surface so
315
- // automation authoring can always use app.fields.title/id/createdBy/etc.
316
- // They remain absent from def().payload unless explicitly overridden.
317
- for (const key of SYSTEM_FIELD_KEYS) {
318
- if (fields[key] !== undefined)
319
- continue;
320
- const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
321
- const override = opts.systemFields?.[key];
322
- fields[key] = {
323
- __kind: "field",
324
- refName: key,
325
- name: override?.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key],
326
- parent: refName,
327
- parentKind: kind,
328
- parentName: opts.name,
329
- fieldType: SYSTEM_FIELD_TAG_TO_TYPE[tag],
330
- tags: [tag],
331
- ...(override !== undefined && "options" in override ? { options: picklistOptionLabels(override.options) } : {}),
332
- };
333
- }
334
- // readonlyFields are platform-managed (system) fields — merged into the ref's `fields` bag
335
- // so other entities can reference them by typed handle, but excluded from `def()` payload.
336
- if (opts.readonlyFields !== undefined) {
337
- for (const [bagKey, ref] of Object.entries(opts.readonlyFields)) {
338
- fields[bagKey] = { ...ref, refName: bagKey, parent: refName, parentKind: kind, parentName: opts.name };
339
- }
340
- }
341
- // `fields` is built loosely (`Record<string, FieldRef>`) since the loop
342
- // above can't statically prove per-key literal `fieldType`s to the
343
- // compiler — the runtime values are exactly right (each field's own
344
- // `field.type` literal), so this cast just states what's already true.
345
- return { __kind: kind, refName: refName, name: opts.name, fields };
381
+ return makeRef(refName);
346
382
  },
347
383
  def(refName) {
348
384
  assertNoSystemKeyCollision("defineApp", opts.name, opts.fields, opts.systemFields);
@@ -368,8 +404,19 @@ export function defineApp(opts) {
368
404
  ...(recordCreateDisplayBlocks !== undefined ? { recordCreateDisplayBlocks } : {}),
369
405
  ...(opts.layouts !== undefined ? { layouts: opts.layouts } : {}),
370
406
  ...(opts.listViews !== undefined ? { listViews: opts.listViews } : {}),
407
+ ...(opts.calendarViews !== undefined ? { calendarViews: opts.calendarViews } : {}),
408
+ ...(opts.kanbanViews !== undefined ? { kanbanViews: opts.kanbanViews } : {}),
409
+ ...(opts.dashboards !== undefined ? { dashboards: opts.dashboards } : {}),
410
+ ...(opts.widgets !== undefined ? { widgets: opts.widgets } : {}),
411
+ ...(opts.dashboardViews !== undefined ? { dashboardViews: opts.dashboardViews } : {}),
412
+ ...(opts.agentViews !== undefined ? { agentViews: opts.agentViews } : {}),
413
+ ...(opts.recordCreateForm !== undefined ? { recordCreateForm: opts.recordCreateForm } : {}),
414
+ ...(opts.dynamicLayouts !== undefined ? { dynamicLayouts: opts.dynamicLayouts } : {}),
415
+ ...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
371
416
  ...(opts.viewOrder !== undefined ? { viewOrder: opts.viewOrder } : {}),
372
417
  ...(opts.accessPolicies !== undefined ? { accessPolicies: opts.accessPolicies } : {}),
418
+ ...(opts.roles !== undefined ? { roles: opts.roles } : {}),
419
+ ...(opts.serviceAccounts !== undefined ? { serviceAccounts: opts.serviceAccounts } : {}),
373
420
  };
374
421
  return {
375
422
  kind,
@@ -379,5 +426,9 @@ export function defineApp(opts) {
379
426
  ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
380
427
  };
381
428
  },
429
+ withRefs(configure) {
430
+ return withReferenceConfiguration(configure);
431
+ },
382
432
  };
433
+ return configured;
383
434
  }
@@ -12,6 +12,12 @@
12
12
  import type { AppCategory, AppField, AppStage, AspectType } from "../../../core/types/app.js";
13
13
  import type { DisplayBlock } from "../../../core/types/display-block.js";
14
14
  import type { NormalizedAccessPolicy } from "../../access-policy/from-tf.js";
15
+ import type { RefExpr } from "../../shared/filters/ast.js";
16
+ import type { Filter } from "../../shared/filters/types.js";
17
+ import type { AccessPolicyGroupRef, AccessPolicyUserRef } from "../../access-policy/principal.js";
18
+ import type { NormalizedRole } from "../../role/from-tf.js";
19
+ import type { NormalizedServiceAccount } from "../../service-account/from-tf.js";
20
+ import type { CalculationResultType } from "../../field/calculation-types.js";
15
21
  /**
16
22
  * Keyed via `withUniqueKeys`, so two stages named "Review" become
17
23
  * `review` / `review2` deterministically. The printer emits each
@@ -24,6 +30,8 @@ export interface NormalizedStage {
24
30
  export interface NormalizedField {
25
31
  readonly key: string;
26
32
  readonly field: AppField;
33
+ /** Server-validated output type for a pulled calculated field. */
34
+ readonly calculationType?: CalculationResultType;
27
35
  /**
28
36
  * Side-channel pull annotation for dependent-picklist linkage.
29
37
  * Typed-ref `parentField` / `parentValues` on the runtime AppField
@@ -117,10 +125,158 @@ export interface NormalizedListView {
117
125
  readonly density?: string;
118
126
  readonly rows?: number;
119
127
  /** Opaque JSON pass-through (see `entities/view/from-tf.ts` for why). */
120
- readonly filter?: unknown;
128
+ readonly filter?: Filter<RefExpr, RefExpr>;
121
129
  /** Opaque JSON pass-through (see `entities/view/from-tf.ts` for why). */
122
130
  readonly sort?: unknown;
123
131
  }
132
+ /** An agent-powered view (`elementum_agent_view`). */
133
+ export interface NormalizedAgentView {
134
+ readonly key: string;
135
+ readonly name: string;
136
+ readonly agentKey: string;
137
+ readonly allowRecordCreation?: boolean;
138
+ readonly filter?: Filter<RefExpr, RefExpr>;
139
+ readonly sort?: unknown;
140
+ readonly userIds?: readonly AccessPolicyUserRef[];
141
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
142
+ readonly displayOrder?: number;
143
+ }
144
+ /** A calendar view (`elementum_calendar_view`). */
145
+ export interface NormalizedCalendarView {
146
+ readonly key: string;
147
+ readonly name: string;
148
+ readonly columns: readonly string[];
149
+ readonly displayByField?: string;
150
+ readonly allowRecordCreation?: boolean;
151
+ readonly filter?: Filter<RefExpr, RefExpr>;
152
+ readonly sort?: unknown;
153
+ readonly userIds?: readonly AccessPolicyUserRef[];
154
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
155
+ }
156
+ /** A kanban view (`elementum_kanban_view`). */
157
+ export interface NormalizedKanbanView extends NormalizedCalendarView {
158
+ readonly allowedFilterFields?: readonly string[];
159
+ }
160
+ export interface NormalizedDashboard {
161
+ readonly key: string;
162
+ readonly name: string;
163
+ readonly favorite?: boolean;
164
+ readonly tags?: readonly string[];
165
+ readonly widgets?: readonly NormalizedDashboardWidget[];
166
+ }
167
+ export interface NormalizedDashboardWidget {
168
+ readonly key: string;
169
+ readonly name: string;
170
+ readonly size: string;
171
+ readonly color?: string;
172
+ readonly icon?: string;
173
+ readonly type: "records";
174
+ readonly target: NormalizedWidgetRef | string;
175
+ readonly filter?: Filter<RefExpr, RefExpr>;
176
+ readonly sort?: unknown;
177
+ }
178
+ export interface NormalizedWidgetRef {
179
+ readonly kind: "app" | "element" | "automation" | "field";
180
+ readonly key: string;
181
+ readonly name: string;
182
+ readonly parent?: string;
183
+ readonly fieldType?: string;
184
+ }
185
+ export interface NormalizedWidgetButtonStyle {
186
+ readonly buttonType: "INLINE" | "PRIMARY" | "SECONDARY";
187
+ readonly color?: string;
188
+ readonly icon?: string;
189
+ readonly fullWidth?: boolean;
190
+ }
191
+ export type NormalizedWidget = {
192
+ readonly key: string;
193
+ readonly type: "relatedRecords";
194
+ readonly name: string;
195
+ readonly target: NormalizedWidgetRef | string;
196
+ readonly columns?: readonly (NormalizedWidgetRef | string)[];
197
+ readonly rows?: number;
198
+ } | ({
199
+ readonly key: string;
200
+ readonly type: "linkRecords";
201
+ readonly name: string;
202
+ readonly target: NormalizedWidgetRef | string;
203
+ readonly columns?: readonly (NormalizedWidgetRef | string)[];
204
+ readonly rows?: number;
205
+ readonly filter?: Filter<RefExpr, RefExpr>;
206
+ } & NormalizedWidgetButtonStyle) | ({
207
+ readonly key: string;
208
+ readonly type: "createRecord";
209
+ readonly name: string;
210
+ readonly target: NormalizedWidgetRef | string;
211
+ } & NormalizedWidgetButtonStyle) | ({
212
+ readonly key: string;
213
+ readonly type: "runAutomation";
214
+ readonly name: string;
215
+ readonly automation: NormalizedWidgetRef | string;
216
+ readonly parameters?: readonly {
217
+ readonly name: string;
218
+ readonly fieldType: string;
219
+ readonly multiple: boolean;
220
+ readonly required: boolean;
221
+ readonly field?: NormalizedWidgetRef | string;
222
+ readonly value?: string;
223
+ }[];
224
+ } & NormalizedWidgetButtonStyle);
225
+ /** A view that embeds one of the owning aspect's dashboards. */
226
+ export interface NormalizedDashboardView {
227
+ readonly key: string;
228
+ readonly name: string;
229
+ readonly dashboardKey: string;
230
+ readonly allowRecordCreation?: boolean;
231
+ readonly filter?: Filter<RefExpr, RefExpr>;
232
+ readonly sort?: unknown;
233
+ readonly userIds?: readonly AccessPolicyUserRef[];
234
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
235
+ }
236
+ export interface NormalizedRecordCreateFormSection {
237
+ readonly name: string;
238
+ readonly fields: readonly string[];
239
+ readonly agentKey?: string;
240
+ readonly icon?: string;
241
+ readonly color?: string;
242
+ readonly displayOrder?: number;
243
+ readonly displayLocation?: string;
244
+ readonly sideNavItem?: boolean;
245
+ readonly hidden?: boolean;
246
+ readonly maxColumns?: number;
247
+ }
248
+ export interface NormalizedRecordCreateForm {
249
+ readonly sections: readonly NormalizedRecordCreateFormSection[];
250
+ }
251
+ export interface PulledDynamicLayoutRef {
252
+ readonly __pulledRef: "field" | "automation" | "app" | "element";
253
+ readonly key: string;
254
+ readonly parent?: string;
255
+ readonly name?: string;
256
+ }
257
+ export interface NormalizedDynamicLayout {
258
+ readonly key: string;
259
+ /** Camel-case authoring value with pulled-reference markers in token positions. */
260
+ readonly layout: Readonly<Record<string, unknown>>;
261
+ }
262
+ export interface PulledRelationshipRef {
263
+ readonly kind: "app" | "element" | "table" | "field" | "tableColumn";
264
+ readonly key: string;
265
+ readonly name: string;
266
+ readonly parent?: string;
267
+ readonly fieldType?: string;
268
+ readonly tfLabel?: string;
269
+ readonly managed?: boolean;
270
+ }
271
+ export interface NormalizedRelationship {
272
+ readonly key: string;
273
+ readonly target: PulledRelationshipRef;
274
+ readonly columns: readonly {
275
+ readonly field: string;
276
+ readonly relatedField: PulledRelationshipRef;
277
+ }[];
278
+ readonly filter?: NormalizedAccessPolicy["filter"];
279
+ }
124
280
  /**
125
281
  * Normalized aspect ready for `print-app.ts`. Carries the round-
126
282
  * trip surface plus any cataloged metadata (handle for export
@@ -161,8 +317,24 @@ export interface NormalizedApp {
161
317
  readonly layouts?: readonly NormalizedLayout[];
162
318
  /** Saved list views (`elementum_list_view`). */
163
319
  readonly listViews?: readonly NormalizedListView[];
320
+ /** Calendar views (`elementum_calendar_view`). */
321
+ readonly calendarViews?: readonly NormalizedCalendarView[];
322
+ /** Kanban views (`elementum_kanban_view`). */
323
+ readonly kanbanViews?: readonly NormalizedKanbanView[];
324
+ readonly dashboardViews?: readonly NormalizedDashboardView[];
325
+ readonly dashboards?: readonly NormalizedDashboard[];
326
+ readonly widgets?: readonly NormalizedWidget[];
327
+ /** Agent-powered record views (`elementum_agent_view`). */
328
+ readonly agentViews?: readonly NormalizedAgentView[];
329
+ /** New-record form (`elementum_record_create_form`). */
330
+ readonly recordCreateForm?: NormalizedRecordCreateForm;
331
+ readonly dynamicLayouts?: readonly NormalizedDynamicLayout[];
332
+ readonly relationships?: readonly NormalizedRelationship[];
164
333
  /** Display order of `listViews`, by key (`elementum_managed_view_order`). */
165
334
  readonly viewOrder?: readonly string[];
166
335
  /** App/element-level sharing & row-level-security policies (`elementum_access_policy`), in export order. */
167
336
  readonly accessPolicies?: readonly NormalizedAccessPolicy[];
337
+ /** Custom roles only; managed roles are represented by data lookups. */
338
+ readonly roles?: readonly NormalizedRole[];
339
+ readonly serviceAccounts?: readonly NormalizedServiceAccount[];
168
340
  }