@elementumai/edk 0.8.2-alpha.6 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (481) hide show
  1. package/README.md +49 -37
  2. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +3 -3
  3. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +1 -1
  4. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +3 -11
  5. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +3 -11
  6. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
  7. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
  8. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +1 -1
  9. package/dist-sdk/fs/entity.d.ts +2 -2
  10. package/dist-sdk/fs/entity.js +1 -1
  11. package/dist-sdk/pull/missing-report.d.ts +81 -0
  12. package/dist-sdk/pull/missing-report.js +52 -0
  13. package/dist-sdk/pull/util.d.ts +1 -1
  14. package/dist-sdk/pull/util.js +3 -3
  15. package/dist-sdk/src/catalog/factories.d.ts +96 -23
  16. package/dist-sdk/src/catalog/factories.js +141 -21
  17. package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
  18. package/dist-sdk/src/catalog/from-authoring.js +20 -10
  19. package/dist-sdk/src/catalog/index.d.ts +2 -2
  20. package/dist-sdk/src/catalog/index.js +1 -1
  21. package/dist-sdk/src/catalog/org.js +63 -4
  22. package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
  23. package/dist-sdk/src/catalog/render-helpers.js +1 -1
  24. package/dist-sdk/src/catalog/render.d.ts +1 -0
  25. package/dist-sdk/src/catalog/render.js +8 -2
  26. package/dist-sdk/src/catalog/token.js +18 -4
  27. package/dist-sdk/src/catalog/types.d.ts +64 -24
  28. package/dist-sdk/src/catalog/types.js +12 -4
  29. package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
  30. package/dist-sdk/src/core/app-to-ui.js +7 -9
  31. package/dist-sdk/src/core/index.d.ts +11 -10
  32. package/dist-sdk/src/core/index.js +10 -9
  33. package/dist-sdk/src/core/platform-id.d.ts +11 -0
  34. package/dist-sdk/src/core/platform-id.js +8 -0
  35. package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +3 -3
  36. package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +7 -10
  37. package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
  38. package/dist-sdk/src/core/types/ai-provider.js +1 -1
  39. package/dist-sdk/src/core/types/app.d.ts +78 -52
  40. package/dist-sdk/src/core/types/app.js +2 -3
  41. package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
  42. package/dist-sdk/src/core/types/aspect-category.js +4 -4
  43. package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
  44. package/dist-sdk/src/core/types/cloud-link.js +3 -3
  45. package/dist-sdk/src/core/types/display-block.d.ts +2 -2
  46. package/dist-sdk/src/core/types/display-block.js +2 -2
  47. package/dist-sdk/src/core/types/group.d.ts +1 -1
  48. package/dist-sdk/src/core/types/group.js +1 -1
  49. package/dist-sdk/src/core/types/user.d.ts +1 -1
  50. package/dist-sdk/src/core/types/user.js +1 -1
  51. package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
  52. package/dist-sdk/src/engine/build/context.d.ts +23 -16
  53. package/dist-sdk/src/engine/entity.d.ts +1 -1
  54. package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
  55. package/dist-sdk/src/engine/pull/attrs.js +17 -0
  56. package/dist-sdk/src/engine/pull/context.d.ts +73 -0
  57. package/dist-sdk/src/engine/pull/context.js +14 -0
  58. package/dist-sdk/src/engine/pull/org.d.ts +10 -0
  59. package/dist-sdk/src/engine/pull/org.js +35 -0
  60. package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
  61. package/dist-sdk/src/engine/pull/ref-only.js +204 -0
  62. package/dist-sdk/src/engine/tf/expr.d.ts +7 -3
  63. package/dist-sdk/src/engine/tf/expr.js +27 -15
  64. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  65. package/dist-sdk/src/engine/tf/index.js +1 -1
  66. package/dist-sdk/src/engine/tf/model.d.ts +8 -1
  67. package/dist-sdk/src/engine/tf/model.js +4 -0
  68. package/dist-sdk/src/engine/tf/parse.js +13 -2
  69. package/dist-sdk/src/engine/tf/render.js +4 -0
  70. package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
  71. package/dist-sdk/src/entities/access-policy/build.d.ts +6 -16
  72. package/dist-sdk/src/entities/access-policy/build.js +2 -2
  73. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +14 -40
  74. package/dist-sdk/src/entities/access-policy/from-tf.js +26 -85
  75. package/dist-sdk/src/entities/access-policy/principal.d.ts +39 -0
  76. package/dist-sdk/src/entities/access-policy/principal.js +13 -0
  77. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +33 -6
  78. package/dist-sdk/src/entities/access-policy/to-tf.js +62 -60
  79. package/dist-sdk/src/entities/agent/build.d.ts +42 -11
  80. package/dist-sdk/src/entities/agent/build.js +40 -19
  81. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +11 -1
  82. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +180 -45
  83. package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
  84. package/dist-sdk/src/entities/agent/from-tf.js +17 -12
  85. package/dist-sdk/src/entities/agent/index.d.ts +5 -2
  86. package/dist-sdk/src/entities/agent/index.js +4 -2
  87. package/dist-sdk/src/entities/agent/module.js +7 -2
  88. package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
  89. package/dist-sdk/src/entities/agent/run-as.js +1 -0
  90. package/dist-sdk/src/entities/agent/to-tf.d.ts +6 -2
  91. package/dist-sdk/src/entities/agent/to-tf.js +58 -9
  92. package/dist-sdk/src/entities/agent/tools.d.ts +97 -70
  93. package/dist-sdk/src/entities/agent/tools.js +63 -43
  94. package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
  95. package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
  96. package/dist-sdk/src/entities/agent-evaluation/build.d.ts +19 -0
  97. package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
  98. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
  99. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
  100. package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
  101. package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
  102. package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
  103. package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
  104. package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
  105. package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
  106. package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
  107. package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
  108. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +25 -15
  109. package/dist-sdk/src/entities/agent-tool/from-tf.js +175 -43
  110. package/dist-sdk/src/entities/agent-tool/module.js +6 -0
  111. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +15 -7
  112. package/dist-sdk/src/entities/agent-tool/to-tf.js +169 -48
  113. package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -6
  114. package/dist-sdk/src/entities/agent-tool/types.js +30 -29
  115. package/dist-sdk/src/entities/app/build.d.ts +214 -47
  116. package/dist-sdk/src/entities/app/build.js +128 -66
  117. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +188 -8
  118. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
  119. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +70 -0
  120. package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
  121. package/dist-sdk/src/entities/app/display-blocks.js +1 -1
  122. package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
  123. package/dist-sdk/src/entities/app/from-tf.js +30 -2
  124. package/dist-sdk/src/entities/app/index.d.ts +20 -8
  125. package/dist-sdk/src/entities/app/index.js +16 -6
  126. package/dist-sdk/src/entities/app/module.js +29 -4
  127. package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
  128. package/dist-sdk/src/entities/app/to-tf.js +97 -7
  129. package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
  130. package/dist-sdk/src/entities/approval-chain/build.js +49 -49
  131. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
  132. package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
  133. package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
  134. package/dist-sdk/src/entities/approval-chain/index.js +2 -3
  135. package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
  136. package/dist-sdk/src/entities/approval-chain/module.js +51 -0
  137. package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
  138. package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
  139. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
  140. package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
  141. package/dist-sdk/src/entities/automation/build.d.ts +177 -95
  142. package/dist-sdk/src/entities/automation/build.js +164 -72
  143. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
  144. package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
  145. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +18 -9
  146. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
  147. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +214 -311
  148. package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
  149. package/dist-sdk/src/entities/automation/filter.js +1 -197
  150. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -0
  151. package/dist-sdk/src/entities/automation/from-tf.js +695 -182
  152. package/dist-sdk/src/entities/automation/index.d.ts +9 -10
  153. package/dist-sdk/src/entities/automation/index.js +11 -11
  154. package/dist-sdk/src/entities/automation/module.js +82 -8
  155. package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
  156. package/dist-sdk/src/entities/automation/operators.js +10 -37
  157. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
  158. package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
  159. package/dist-sdk/src/entities/automation/script-code.js +107 -28
  160. package/dist-sdk/src/entities/automation/serialize.js +1 -1
  161. package/dist-sdk/src/entities/automation/tasks.d.ts +167 -102
  162. package/dist-sdk/src/entities/automation/tasks.js +66 -13
  163. package/dist-sdk/src/entities/automation/to-tf.d.ts +44 -3
  164. package/dist-sdk/src/entities/automation/to-tf.js +607 -161
  165. package/dist-sdk/src/entities/automation/triggers.d.ts +33 -25
  166. package/dist-sdk/src/entities/automation/triggers.js +8 -2
  167. package/dist-sdk/src/entities/automation/types.d.ts +3 -2
  168. package/dist-sdk/src/entities/automation/types.js +3 -2
  169. package/dist-sdk/src/entities/chart/build.d.ts +95 -0
  170. package/dist-sdk/src/entities/chart/build.js +42 -0
  171. package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
  172. package/dist-sdk/src/entities/chart/from-tf.js +269 -0
  173. package/dist-sdk/src/entities/chart/index.d.ts +4 -0
  174. package/dist-sdk/src/entities/chart/index.js +3 -0
  175. package/dist-sdk/src/entities/chart/module.d.ts +3 -0
  176. package/dist-sdk/src/entities/chart/module.js +61 -0
  177. package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
  178. package/dist-sdk/src/entities/chart/printer.js +104 -0
  179. package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
  180. package/dist-sdk/src/entities/chart/to-tf.js +150 -0
  181. package/dist-sdk/src/entities/chart/types.d.ts +53 -0
  182. package/dist-sdk/src/entities/chart/types.js +22 -0
  183. package/dist-sdk/src/entities/dashboard/build.d.ts +44 -0
  184. package/dist-sdk/src/entities/dashboard/build.js +16 -0
  185. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
  186. package/dist-sdk/src/entities/dashboard/from-tf.js +113 -0
  187. package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
  188. package/dist-sdk/src/entities/dashboard/module.js +16 -0
  189. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +43 -0
  190. package/dist-sdk/src/entities/dashboard/to-tf.js +121 -0
  191. package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
  192. package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
  193. package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
  194. package/dist-sdk/src/entities/data-lookup/module.js +22 -0
  195. package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
  196. package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
  197. package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
  198. package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
  199. package/dist-sdk/src/entities/datamine/module.js +23 -0
  200. package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
  201. package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
  202. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +304 -0
  203. package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
  204. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +4 -0
  205. package/dist-sdk/src/entities/dynamic-layout/dialect.js +47 -0
  206. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
  207. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +239 -0
  208. package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
  209. package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
  210. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
  211. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
  212. package/dist-sdk/src/entities/element/build.d.ts +48 -38
  213. package/dist-sdk/src/entities/element/build.js +24 -33
  214. package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
  215. package/dist-sdk/src/entities/element/from-tf.js +31 -2
  216. package/dist-sdk/src/entities/element/index.d.ts +14 -7
  217. package/dist-sdk/src/entities/element/index.js +11 -5
  218. package/dist-sdk/src/entities/element/module.js +26 -5
  219. package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
  220. package/dist-sdk/src/entities/element/to-tf.js +64 -4
  221. package/dist-sdk/src/entities/field/build.d.ts +55 -27
  222. package/dist-sdk/src/entities/field/build.js +31 -6
  223. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
  224. package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
  225. package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
  226. package/dist-sdk/src/entities/field/calc/date.js +120 -29
  227. package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
  228. package/dist-sdk/src/entities/field/calc/index.js +82 -139
  229. package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
  230. package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
  231. package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
  232. package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
  233. package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
  234. package/dist-sdk/src/entities/field/calc/text.js +43 -31
  235. package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
  236. package/dist-sdk/src/entities/field/calc/types.js +1 -22
  237. package/dist-sdk/src/entities/field/calc.d.ts +71 -48
  238. package/dist-sdk/src/entities/field/calc.js +5 -15
  239. package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
  240. package/dist-sdk/src/entities/field/calculation-types.js +49 -0
  241. package/dist-sdk/src/entities/field/from-tf.js +238 -13
  242. package/dist-sdk/src/entities/field/locals.d.ts +11 -3
  243. package/dist-sdk/src/entities/field/locals.js +15 -2
  244. package/dist-sdk/src/entities/field/module.d.ts +1 -0
  245. package/dist-sdk/src/entities/field/module.js +27 -7
  246. package/dist-sdk/src/entities/field/record-shape.d.ts +25 -11
  247. package/dist-sdk/src/entities/field/to-tf.d.ts +41 -2
  248. package/dist-sdk/src/entities/field/to-tf.js +314 -40
  249. package/dist-sdk/src/entities/field/types.d.ts +1 -1
  250. package/dist-sdk/src/entities/field/types.js +10 -1
  251. package/dist-sdk/src/entities/file-reader/build.d.ts +71 -19
  252. package/dist-sdk/src/entities/file-reader/build.js +49 -4
  253. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
  254. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +12 -10
  255. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
  256. package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
  257. package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
  258. package/dist-sdk/src/entities/file-reader/index.js +3 -3
  259. package/dist-sdk/src/entities/file-reader/module.js +6 -5
  260. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
  261. package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
  262. package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
  263. package/dist-sdk/src/entities/file-reader/types.js +4 -5
  264. package/dist-sdk/src/entities/org/category.js +4 -5
  265. package/dist-sdk/src/entities/org/cloud-link.js +4 -5
  266. package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
  267. package/dist-sdk/src/entities/org/email-alias.js +12 -0
  268. package/dist-sdk/src/entities/org/group.js +4 -5
  269. package/dist-sdk/src/entities/org/index.d.ts +2 -0
  270. package/dist-sdk/src/entities/org/index.js +2 -0
  271. package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
  272. package/dist-sdk/src/entities/org/phone-provider.js +30 -0
  273. package/dist-sdk/src/entities/org/role.d.ts +3 -3
  274. package/dist-sdk/src/entities/org/role.js +9 -6
  275. package/dist-sdk/src/entities/organization/build.d.ts +241 -0
  276. package/dist-sdk/src/entities/organization/build.js +165 -0
  277. package/dist-sdk/src/entities/organization/index.d.ts +2 -0
  278. package/dist-sdk/src/entities/organization/index.js +2 -0
  279. package/dist-sdk/src/entities/organization/module.d.ts +2 -0
  280. package/dist-sdk/src/entities/organization/module.js +21 -0
  281. package/dist-sdk/src/entities/organization/to-tf.d.ts +7 -0
  282. package/dist-sdk/src/entities/organization/to-tf.js +154 -0
  283. package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
  284. package/dist-sdk/src/entities/phone-service/build.js +31 -0
  285. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
  286. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +56 -0
  287. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
  288. package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
  289. package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
  290. package/dist-sdk/src/entities/phone-service/index.js +2 -0
  291. package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
  292. package/dist-sdk/src/entities/phone-service/module.js +55 -0
  293. package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
  294. package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
  295. package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
  296. package/dist-sdk/src/entities/phone-service/types.js +22 -0
  297. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
  298. package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
  299. package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
  300. package/dist-sdk/src/entities/record-create-form/module.js +24 -0
  301. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
  302. package/dist-sdk/src/entities/record-create-form/to-tf.js +88 -0
  303. package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
  304. package/dist-sdk/src/entities/relationship/build.js +1 -0
  305. package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
  306. package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
  307. package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
  308. package/dist-sdk/src/entities/relationship/module.js +16 -0
  309. package/dist-sdk/src/entities/relationship/to-tf.d.ts +32 -0
  310. package/dist-sdk/src/entities/relationship/to-tf.js +145 -0
  311. package/dist-sdk/src/entities/role/build.d.ts +65 -0
  312. package/dist-sdk/src/entities/role/build.js +33 -0
  313. package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
  314. package/dist-sdk/src/entities/role/from-tf.js +138 -0
  315. package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
  316. package/dist-sdk/src/entities/role/to-tf.js +69 -0
  317. package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
  318. package/dist-sdk/src/entities/search-table/build.js +110 -56
  319. package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
  320. package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
  321. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  322. package/dist-sdk/src/entities/search-table/index.js +2 -2
  323. package/dist-sdk/src/entities/search-table/module.js +88 -10
  324. package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
  325. package/dist-sdk/src/entities/search-table/printer.js +52 -0
  326. package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
  327. package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
  328. package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
  329. package/dist-sdk/src/entities/search-table/types.js +21 -0
  330. package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
  331. package/dist-sdk/src/entities/service-account/build.js +9 -0
  332. package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
  333. package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
  334. package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
  335. package/dist-sdk/src/entities/service-account/module.js +21 -0
  336. package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
  337. package/dist-sdk/src/entities/service-account/ref.js +5 -0
  338. package/dist-sdk/src/entities/service-account/to-tf.d.ts +32 -0
  339. package/dist-sdk/src/entities/service-account/to-tf.js +103 -0
  340. package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
  341. package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
  342. package/dist-sdk/src/entities/shared/context.d.ts +25 -24
  343. package/dist-sdk/src/entities/shared/context.js +36 -35
  344. package/dist-sdk/src/entities/shared/filters/ast.d.ts +30 -81
  345. package/dist-sdk/src/entities/shared/filters/ast.js +6 -2
  346. package/dist-sdk/src/entities/shared/filters/index.d.ts +95 -206
  347. package/dist-sdk/src/entities/shared/filters/index.js +196 -341
  348. package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
  349. package/dist-sdk/src/entities/shared/filters/print.js +122 -0
  350. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
  351. package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
  352. package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
  353. package/dist-sdk/src/entities/shared/filters/types.js +2 -3
  354. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +14 -0
  355. package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
  356. package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
  357. package/dist-sdk/src/entities/shared/ref.js +8 -3
  358. package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
  359. package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
  360. package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
  361. package/dist-sdk/src/entities/skill/build.d.ts +4 -4
  362. package/dist-sdk/src/entities/skill/build.js +6 -5
  363. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +11 -1
  364. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +100 -39
  365. package/dist-sdk/src/entities/skill/index.d.ts +3 -2
  366. package/dist-sdk/src/entities/skill/index.js +3 -2
  367. package/dist-sdk/src/entities/skill/module.js +8 -2
  368. package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -2
  369. package/dist-sdk/src/entities/skill/to-tf.js +20 -2
  370. package/dist-sdk/src/entities/skill/tools.d.ts +47 -31
  371. package/dist-sdk/src/entities/skill/tools.js +37 -23
  372. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +17 -1
  373. package/dist-sdk/src/entities/skill-tool/from-tf.js +118 -8
  374. package/dist-sdk/src/entities/skill-tool/module.js +9 -0
  375. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  376. package/dist-sdk/src/entities/skill-tool/to-tf.js +100 -48
  377. package/dist-sdk/src/entities/skill-tool/types.js +18 -1
  378. package/dist-sdk/src/entities/table/build.d.ts +64 -23
  379. package/dist-sdk/src/entities/table/build.js +41 -26
  380. package/dist-sdk/src/entities/table/catalog-render.js +15 -1
  381. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
  382. package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
  383. package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
  384. package/dist-sdk/src/entities/table/fields/types.js +12 -0
  385. package/dist-sdk/src/entities/table/fields.d.ts +107 -47
  386. package/dist-sdk/src/entities/table/fields.js +76 -55
  387. package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
  388. package/dist-sdk/src/entities/table/from-tf.js +261 -0
  389. package/dist-sdk/src/entities/table/index.d.ts +7 -5
  390. package/dist-sdk/src/entities/table/index.js +7 -7
  391. package/dist-sdk/src/entities/table/joins.d.ts +22 -9
  392. package/dist-sdk/src/entities/table/joins.js +8 -16
  393. package/dist-sdk/src/entities/table/module.d.ts +2 -1
  394. package/dist-sdk/src/entities/table/module.js +13 -6
  395. package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
  396. package/dist-sdk/src/entities/table/to-tf.js +222 -0
  397. package/dist-sdk/src/entities/task/build.d.ts +43 -0
  398. package/dist-sdk/src/entities/task/build.js +17 -0
  399. package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
  400. package/dist-sdk/src/entities/task/from-tf.js +38 -0
  401. package/dist-sdk/src/entities/task/index.d.ts +1 -0
  402. package/dist-sdk/src/entities/task/index.js +1 -0
  403. package/dist-sdk/src/entities/task/module.d.ts +3 -0
  404. package/dist-sdk/src/entities/task/module.js +12 -0
  405. package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
  406. package/dist-sdk/src/entities/task/to-tf.js +49 -0
  407. package/dist-sdk/src/entities/view/build.d.ts +46 -0
  408. package/dist-sdk/src/entities/view/build.js +19 -0
  409. package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
  410. package/dist-sdk/src/entities/view/from-tf.js +264 -30
  411. package/dist-sdk/src/entities/view/module.d.ts +6 -13
  412. package/dist-sdk/src/entities/view/module.js +12 -15
  413. package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
  414. package/dist-sdk/src/entities/view/sharing.js +6 -0
  415. package/dist-sdk/src/entities/view/to-tf.d.ts +56 -12
  416. package/dist-sdk/src/entities/view/to-tf.js +192 -20
  417. package/dist-sdk/src/entities/view/types.d.ts +8 -0
  418. package/dist-sdk/src/entities/view/types.js +46 -0
  419. package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
  420. package/dist-sdk/src/entities/visual-flow/build.js +72 -0
  421. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
  422. package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
  423. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
  424. package/dist-sdk/src/entities/visual-flow/index.js +1 -0
  425. package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
  426. package/dist-sdk/src/entities/visual-flow/module.js +41 -0
  427. package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
  428. package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
  429. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +15 -0
  430. package/dist-sdk/src/entities/visual-flow/to-tf.js +97 -0
  431. package/dist-sdk/src/entities/widget/build.d.ts +55 -0
  432. package/dist-sdk/src/entities/widget/build.js +1 -0
  433. package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
  434. package/dist-sdk/src/entities/widget/from-tf.js +209 -0
  435. package/dist-sdk/src/entities/widget/module.d.ts +3 -0
  436. package/dist-sdk/src/entities/widget/module.js +16 -0
  437. package/dist-sdk/src/entities/widget/to-tf.d.ts +45 -0
  438. package/dist-sdk/src/entities/widget/to-tf.js +206 -0
  439. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
  440. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
  441. package/dist-sdk/src/graph/index.d.ts +12 -1
  442. package/dist-sdk/src/graph/index.js +8 -19
  443. package/dist-sdk/src/graph/modules.js +35 -1
  444. package/dist-sdk/src/graph/types.d.ts +106 -7
  445. package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
  446. package/dist-sdk/src/internal/safe-identifier.js +13 -0
  447. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  448. package/dist-sdk/src/internal/sdk-package.js +5 -2
  449. package/package.json +39 -15
  450. package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
  451. package/dist-sdk/src/entities/access-policy/filter.js +0 -83
  452. package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
  453. package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
  454. package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
  455. package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
  456. package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
  457. package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
  458. package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
  459. package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
  460. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
  461. package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
  462. package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
  463. package/dist-sdk/src/entities/flow/activities/form.js +0 -36
  464. package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
  465. package/dist-sdk/src/entities/flow/activities/index.js +0 -13
  466. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
  467. package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
  468. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
  469. package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
  470. package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
  471. package/dist-sdk/src/entities/flow/build.d.ts +0 -38
  472. package/dist-sdk/src/entities/flow/build.js +0 -115
  473. package/dist-sdk/src/entities/flow/index.d.ts +0 -8
  474. package/dist-sdk/src/entities/flow/index.js +0 -7
  475. package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
  476. package/dist-sdk/src/entities/flow/serialize.js +0 -94
  477. package/dist-sdk/src/entities/flow/util.d.ts +0 -27
  478. package/dist-sdk/src/entities/flow/util.js +0 -38
  479. package/dist-sdk/src/entities/table/filter.d.ts +0 -41
  480. package/dist-sdk/src/entities/table/filter.js +0 -89
  481. /package/dist-sdk/src/entities/{flow/activities/types.js → datamine/build.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * v2 app/element authoring — `defineApp`. Parallel to v1 `src/aspects`,
2
+ * v2 app/element authoring — `app`. Parallel to v1 `src/aspects`,
3
3
  * standalone from it.
4
4
  *
5
5
  * Produces a `DeployableEntity` of kind `app`/`element` with `parent: "org"` (apps are
@@ -15,6 +15,7 @@
15
15
  import { slimTokens } from "../../catalog/index.js";
16
16
  import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY, WRITABLE_SYSTEM_TAG_NAMES, } from "../../core/system-fields.js";
17
17
  import { serializeDisplayBlocks } from "./display-blocks.js";
18
+ export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
18
19
  /**
19
20
  * Map a platform field type to the `AspectFieldInput` variant key. "relation"
20
21
  * is a terraform-only synthetic key (no `elementum-entity-client` REST
@@ -23,9 +24,8 @@ import { serializeDisplayBlocks } from "./display-blocks.js";
23
24
  */
24
25
  const TYPE_TO_KEY = {
25
26
  TEXT: "text",
26
- RICH_TEXT: "text",
27
+ RICH_TEXT: "html",
27
28
  HANDLE: "handle",
28
- HTML: "html",
29
29
  NUMBER: "number",
30
30
  DECIMAL: "decimal",
31
31
  BOOLEAN: "bool",
@@ -108,9 +108,20 @@ 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
- * with `defineElement`. `refName` is the field's bag key in `defineApp`'s
124
+ * with `element`. `refName` is the field's bag key in `app`'s
114
125
  * `fields: {}` (e.g. `severity`) — carried as the internal `__refName` marker,
115
126
  * a client-side-only bookkeeping value `applyV2`'s field reconciliation
116
127
  * (`src/deploy/apply/apply.ts`, `reconcileFields`) reads to match this field
@@ -142,7 +153,11 @@ export function serializeField(field, refName) {
142
153
  // Calculated field: the calc expression serializes to a text grammar string
143
154
  // (field refs emitted by name; the platform resolves them on compose).
144
155
  if (field.expression !== undefined) {
145
- return { calculated: { ...base, calculation: { text: field.expression.toCalcString() } } };
156
+ const includeTypes = field.include === undefined || field.include === "auto" ? []
157
+ : field.include === "manual" ? [{ manual: { type: "MANUAL" } }]
158
+ : field.include === "both" ? [{ auto: { type: "AUTO" } }, { manual: { type: "MANUAL" } }]
159
+ : [{ picklist: { type: "PICKLIST", picklistFieldId: field.include.picklist } }];
160
+ return { calculated: { ...base, calculation: { text: field.expression.toCalcString(), includeTypes } } };
146
161
  }
147
162
  if (key === "picklist" || key === "multiPicklist") {
148
163
  if (shouldSerializePicklistOptions(field)) {
@@ -152,7 +167,7 @@ export function serializeField(field, refName) {
152
167
  base.picklistValues = field.options.map(picklistValue);
153
168
  }
154
169
  if (field.config !== undefined) {
155
- base.config = field.config;
170
+ base.config = unwrapUnsafePlatformIds(field.config);
156
171
  }
157
172
  else if (field.parentField !== undefined) {
158
173
  // Dependent dropdown: parent field token → config.static.parentFieldId.
@@ -172,9 +187,9 @@ export function serializeField(field, refName) {
172
187
  }
173
188
  if (key === "relation") {
174
189
  if (field.relatedObject !== undefined)
175
- base.relatedObject = field.relatedObject;
190
+ base.relatedObject = unwrapUnsafePlatformIds(field.relatedObject);
176
191
  if (field.relatedLabelField !== undefined)
177
- base.relatedLabelField = field.relatedLabelField;
192
+ base.relatedLabelField = unwrapUnsafePlatformIds(field.relatedLabelField);
178
193
  if (field.autoRelate !== undefined)
179
194
  base.autoRelate = field.autoRelate;
180
195
  }
@@ -240,11 +255,11 @@ export function serializeSystemFields(overrides) {
240
255
  * Build a v2 app entity: org-owned, compose-body payload. Exposes
241
256
  * `.ref(refName)` and `.def(refName)`.
242
257
  *
243
- * Elements author through `defineElement` (`@elementumai/edk/elements`,
258
+ * Elements author through `element` (`@elementumai/edk/elements`,
244
259
  * `src/elements/build.ts`) instead — a dedicated builder/printer, since a
245
260
  * *linked* element's cloud mapping (Cloud Link + Database + Schema + Table,
246
261
  * vs. a *standard* element's Elementum-managed table) has no equivalent on an
247
- * app. `defineApp`'s `type` no longer accepts `"ELEMENT"`.
262
+ * app. `app`'s `type` no longer accepts `"ELEMENT"`.
248
263
  */
249
264
  /**
250
265
  * The GraphQL API constrains an aspect handle to letters only, either case, no
@@ -253,7 +268,7 @@ export function serializeSystemFields(overrides) {
253
268
  */
254
269
  export const APP_HANDLE_RE = /^[a-zA-Z]+$/;
255
270
  /**
256
- * Client-side validation for `defineApp` — the authoring-time home for app
271
+ * Client-side validation for `app` — the authoring-time home for app
257
272
  * validation rules, so a malformed definition fails at define time rather than
258
273
  * as an opaque platform error during apply. App-specific on purpose: elements
259
274
  * carry their own equivalent in `src/elements/build.ts`.
@@ -263,25 +278,104 @@ export const APP_HANDLE_RE = /^[a-zA-Z]+$/;
263
278
  */
264
279
  function validateAppOptions(opts) {
265
280
  if (opts.handle !== undefined && !APP_HANDLE_RE.test(opts.handle)) {
266
- throw new Error(`defineApp "${opts.name}": handle "${opts.handle}" must contain only letters (a–z, A–Z).`);
281
+ throw new Error(`app "${opts.name}": handle "${opts.handle}" must contain only letters (a–z, A–Z).`);
267
282
  }
268
283
  if (opts.namespace !== undefined && !/^[a-z]+$/.test(opts.namespace)) {
269
- throw new Error(`defineApp "${opts.name}": namespace "${opts.namespace}" must be lowercase letters only (a–z).`);
284
+ throw new Error(`app "${opts.name}": namespace "${opts.namespace}" must be lowercase letters only (a–z).`);
270
285
  }
271
286
  }
272
- function picklistOptionLabels(options) {
287
+ export function picklistOptionLabels(options) {
273
288
  return options.map((option) => typeof option === "string" ? option : option.label);
274
289
  }
275
- export function defineApp(opts) {
290
+ export function app(opts) {
276
291
  validateAppOptions(opts);
277
292
  const fieldEntries = Object.values(opts.fields);
278
293
  // systemFields overrides synthesize real field entries too (a pulled app can
279
294
  // legitimately have zero custom fields — see the voicetest fixture).
280
295
  if (fieldEntries.length === 0 && serializeSystemFields(opts.systemFields).length === 0) {
281
- throw new Error(`defineApp "${opts.name}" requires at least one field — a fields: {} entry or a systemFields override.`);
296
+ throw new Error(`app "${opts.name}" requires at least one field — a fields: {} entry or a systemFields override.`);
282
297
  }
283
298
  const kind = "app";
284
- return {
299
+ function makeRef(refName) {
300
+ // `handle` here is the disambiguated bag key (the Record key, e.g.
301
+ // "severity") — kept so `renderCatalog` can derive the catalog's bag
302
+ // key from it. It's also the join key deploy resolves fields by.
303
+ const fields = {};
304
+ for (const [bagKey, field] of Object.entries(opts.fields)) {
305
+ fields[bagKey] = {
306
+ __kind: "field",
307
+ refName: bagKey,
308
+ name: field.name,
309
+ parent: refName,
310
+ parentKind: kind,
311
+ parentName: opts.name,
312
+ fieldType: field.type,
313
+ ...(field.options !== undefined ? { options: picklistOptionLabels(field.options) } : {}),
314
+ ...(field.tags !== undefined ? { tags: field.tags } : {}),
315
+ };
316
+ }
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
+ if (opts.readonlyFields !== undefined) {
335
+ for (const [bagKey, ref] of Object.entries(opts.readonlyFields)) {
336
+ fields[bagKey] = {
337
+ ...ref,
338
+ refName: bagKey,
339
+ parent: refName,
340
+ parentKind: kind,
341
+ parentName: opts.name,
342
+ };
343
+ }
344
+ }
345
+ const self = {
346
+ __kind: kind,
347
+ refName,
348
+ name: opts.name,
349
+ ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),
350
+ fields,
351
+ agent(childRefName, name = childRefName) {
352
+ return { __kind: "agent", refName: childRefName, name, parent: refName };
353
+ },
354
+ automation(childRefName, name = childRefName) {
355
+ return { __kind: "automation", refName: childRefName, name, parent: refName };
356
+ },
357
+ chart(childRefName, name = childRefName) {
358
+ return { __kind: "chart", refName: childRefName, name, parent: refName };
359
+ },
360
+ dashboard(childRefName, name = childRefName) {
361
+ return { __kind: "dashboard", refName: childRefName, name, parent: refName };
362
+ },
363
+ };
364
+ return self;
365
+ }
366
+ function withReferenceConfiguration(configure) {
367
+ return {
368
+ ref: configured.ref,
369
+ def(refName) {
370
+ const referenced = configure(makeRef(refName));
371
+ return app({ ...opts, ...referenced }).def(refName);
372
+ },
373
+ withRefs(next) {
374
+ return withReferenceConfiguration((app) => ({ ...configure(app), ...next(app) }));
375
+ },
376
+ };
377
+ }
378
+ const configured = {
285
379
  ref(refName) {
286
380
  // `handle` here is the disambiguated bag key (the Record key, e.g.
287
381
  // "severity") — kept so `renderCatalog` can derive the catalog's bag
@@ -295,57 +389,10 @@ export function defineApp(opts) {
295
389
  // with no bag-key context available) defaults it to `name` instead —
296
390
  // both harmless, since printed refs re-resolve by name/bag key at their
297
391
  // 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 };
392
+ return makeRef(refName);
346
393
  },
347
394
  def(refName) {
348
- assertNoSystemKeyCollision("defineApp", opts.name, opts.fields, opts.systemFields);
395
+ assertNoSystemKeyCollision("app", opts.name, opts.fields, opts.systemFields);
349
396
  const displayBlocks = serializeDisplayBlocks(opts.displayBlocks, "LAYOUT");
350
397
  const recordCreateDisplayBlocks = serializeDisplayBlocks(opts.recordCreateDisplayBlocks, "CREATE");
351
398
  const payload = {
@@ -368,8 +415,19 @@ export function defineApp(opts) {
368
415
  ...(recordCreateDisplayBlocks !== undefined ? { recordCreateDisplayBlocks } : {}),
369
416
  ...(opts.layouts !== undefined ? { layouts: opts.layouts } : {}),
370
417
  ...(opts.listViews !== undefined ? { listViews: opts.listViews } : {}),
418
+ ...(opts.calendarViews !== undefined ? { calendarViews: opts.calendarViews } : {}),
419
+ ...(opts.kanbanViews !== undefined ? { kanbanViews: opts.kanbanViews } : {}),
420
+ ...(opts.dashboards !== undefined ? { dashboards: opts.dashboards } : {}),
421
+ ...(opts.widgets !== undefined ? { widgets: opts.widgets } : {}),
422
+ ...(opts.dashboardViews !== undefined ? { dashboardViews: opts.dashboardViews } : {}),
423
+ ...(opts.agentViews !== undefined ? { agentViews: opts.agentViews } : {}),
424
+ ...(opts.recordCreateForm !== undefined ? { recordCreateForm: opts.recordCreateForm } : {}),
425
+ ...(opts.dynamicLayouts !== undefined ? { dynamicLayouts: opts.dynamicLayouts } : {}),
426
+ ...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
371
427
  ...(opts.viewOrder !== undefined ? { viewOrder: opts.viewOrder } : {}),
372
428
  ...(opts.accessPolicies !== undefined ? { accessPolicies: opts.accessPolicies } : {}),
429
+ ...(opts.roles !== undefined ? { roles: opts.roles } : {}),
430
+ ...(opts.serviceAccounts !== undefined ? { serviceAccounts: opts.serviceAccounts } : {}),
373
431
  };
374
432
  return {
375
433
  kind,
@@ -379,5 +437,9 @@ export function defineApp(opts) {
379
437
  ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
380
438
  };
381
439
  },
440
+ withRefs(configure) {
441
+ return withReferenceConfiguration(configure);
442
+ },
382
443
  };
444
+ return configured;
383
445
  }
@@ -12,6 +12,13 @@
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 { ManagedViewSharing } from "../../view/sharing.js";
18
+ import type { ListViewDensity, NormalizedManagedViewSort } from "../../view/build.js";
19
+ import type { NormalizedRole } from "../../role/from-tf.js";
20
+ import type { NormalizedServiceAccount } from "../../service-account/from-tf.js";
21
+ import type { CalculationResultType } from "../../field/calculation-types.js";
15
22
  /**
16
23
  * Keyed via `withUniqueKeys`, so two stages named "Review" become
17
24
  * `review` / `review2` deterministically. The printer emits each
@@ -24,13 +31,19 @@ export interface NormalizedStage {
24
31
  export interface NormalizedField {
25
32
  readonly key: string;
26
33
  readonly field: AppField;
34
+ /** Server-validated output type for a pulled calculated field. */
35
+ readonly calculationType?: CalculationResultType;
36
+ /** Inclusion mode captured from a pulled calculated field. AUTO is omitted. */
37
+ readonly calculationInclude?: "manual" | "both" | {
38
+ readonly picklistFieldId: string;
39
+ };
27
40
  /**
28
41
  * Side-channel pull annotation for dependent-picklist linkage.
29
42
  * Typed-ref `parentField` / `parentValues` on the runtime AppField
30
43
  * need real picklist-object references, which aren't available until
31
44
  * every sibling field has been projected — and emitting those refs
32
45
  * from the printer requires hoisting parent / child fields to
33
- * top-level `const`s before the `defineApp({...})` literal. We carry
46
+ * top-level `const`s before the `app({...})` literal. We carry
34
47
  * just the raw ids here; the printer resolves them against the
35
48
  * other entries in the same `NormalizedApp.fields` list at emit
36
49
  * time.
@@ -101,6 +114,7 @@ export interface NormalizedLayoutSection {
101
114
  readonly name?: string;
102
115
  readonly icon?: string;
103
116
  readonly color?: string;
117
+ readonly maxColumns?: number;
104
118
  readonly fields?: readonly string[];
105
119
  }
106
120
  /** A stage's record-detail layout, keyed by stage key on `NormalizedApp.layouts`. */
@@ -109,17 +123,167 @@ export interface NormalizedLayout {
109
123
  readonly sections: readonly NormalizedLayoutSection[];
110
124
  }
111
125
  /** A saved list view (`elementum_list_view`). `key` is its authoring bag key. */
112
- export interface NormalizedListView {
126
+ export interface NormalizedListView extends ManagedViewSharing {
113
127
  readonly key: string;
114
128
  readonly name: string;
115
129
  readonly columns: readonly string[];
116
130
  readonly allowRecordCreation?: boolean;
117
- readonly density?: string;
131
+ readonly density?: ListViewDensity;
118
132
  readonly rows?: number;
119
133
  /** Opaque JSON pass-through (see `entities/view/from-tf.ts` for why). */
120
- readonly filter?: unknown;
121
- /** Opaque JSON pass-through (see `entities/view/from-tf.ts` for why). */
122
- readonly sort?: unknown;
134
+ readonly filter?: Filter<RefExpr, RefExpr>;
135
+ readonly sort?: NormalizedManagedViewSort;
136
+ }
137
+ /** An agent-powered view (`elementum_agent_view`). */
138
+ export interface NormalizedAgentView extends ManagedViewSharing {
139
+ readonly key: string;
140
+ readonly name: string;
141
+ readonly agentKey: string;
142
+ readonly allowRecordCreation?: boolean;
143
+ readonly filter?: Filter<RefExpr, RefExpr>;
144
+ readonly sort?: NormalizedManagedViewSort;
145
+ readonly displayOrder?: number;
146
+ }
147
+ /** A calendar view (`elementum_calendar_view`). */
148
+ export interface NormalizedCalendarView extends ManagedViewSharing {
149
+ readonly key: string;
150
+ readonly name: string;
151
+ readonly columns: readonly string[];
152
+ readonly displayByField?: string;
153
+ readonly allowRecordCreation?: boolean;
154
+ readonly filter?: Filter<RefExpr, RefExpr>;
155
+ readonly sort?: NormalizedManagedViewSort;
156
+ }
157
+ /** A kanban view (`elementum_kanban_view`). */
158
+ export interface NormalizedKanbanView extends NormalizedCalendarView {
159
+ readonly allowedFilterFields?: readonly string[];
160
+ }
161
+ export interface NormalizedDashboard {
162
+ readonly key: string;
163
+ readonly name: string;
164
+ readonly favorite?: boolean;
165
+ readonly tags?: readonly string[];
166
+ readonly widgets?: readonly NormalizedDashboardWidget[];
167
+ }
168
+ export type NormalizedDashboardWidget = {
169
+ readonly key: string;
170
+ readonly name: string;
171
+ readonly size: string;
172
+ readonly color?: string;
173
+ readonly icon?: string;
174
+ readonly type: "records";
175
+ readonly target: NormalizedWidgetRef & {
176
+ readonly kind: "app" | "element";
177
+ };
178
+ readonly filter?: Filter<RefExpr, RefExpr>;
179
+ } | {
180
+ readonly key: string;
181
+ readonly name: string;
182
+ readonly size: string;
183
+ readonly color?: string;
184
+ readonly icon?: string;
185
+ readonly type: "chart";
186
+ readonly chartKey: string;
187
+ };
188
+ export interface NormalizedWidgetRef {
189
+ readonly kind: "app" | "element" | "automation" | "field";
190
+ readonly key: string;
191
+ readonly name: string;
192
+ readonly parent?: string;
193
+ readonly fieldType?: string;
194
+ }
195
+ export interface NormalizedWidgetButtonStyle {
196
+ readonly buttonType: "INLINE" | "PRIMARY" | "SECONDARY";
197
+ readonly color?: string;
198
+ readonly icon?: string;
199
+ readonly fullWidth?: boolean;
200
+ }
201
+ export type NormalizedWidget = {
202
+ readonly key: string;
203
+ readonly type: "relatedRecords";
204
+ readonly name: string;
205
+ readonly target: NormalizedWidgetRef | string;
206
+ readonly columns?: readonly (NormalizedWidgetRef | string)[];
207
+ readonly rows?: number;
208
+ } | ({
209
+ readonly key: string;
210
+ readonly type: "linkRecords";
211
+ readonly name: string;
212
+ readonly target: NormalizedWidgetRef | string;
213
+ readonly columns?: readonly (NormalizedWidgetRef | string)[];
214
+ readonly rows?: number;
215
+ readonly filter?: Filter<RefExpr, RefExpr>;
216
+ } & NormalizedWidgetButtonStyle) | ({
217
+ readonly key: string;
218
+ readonly type: "createRecord";
219
+ readonly name: string;
220
+ readonly target: NormalizedWidgetRef | string;
221
+ } & NormalizedWidgetButtonStyle) | ({
222
+ readonly key: string;
223
+ readonly type: "runAutomation";
224
+ readonly name: string;
225
+ readonly automation: NormalizedWidgetRef | string;
226
+ readonly parameters?: readonly {
227
+ readonly name: string;
228
+ readonly fieldType: string;
229
+ readonly multiple: boolean;
230
+ readonly required: boolean;
231
+ readonly field?: NormalizedWidgetRef | string;
232
+ readonly value?: string;
233
+ }[];
234
+ } & NormalizedWidgetButtonStyle);
235
+ /** A view that embeds one of the owning aspect's dashboards. */
236
+ export interface NormalizedDashboardView extends ManagedViewSharing {
237
+ readonly key: string;
238
+ readonly name: string;
239
+ readonly dashboardKey: string;
240
+ readonly allowRecordCreation?: boolean;
241
+ readonly filter?: Filter<RefExpr, RefExpr>;
242
+ readonly sort?: NormalizedManagedViewSort;
243
+ }
244
+ export interface NormalizedRecordCreateFormSection {
245
+ readonly name: string;
246
+ readonly fields: readonly string[];
247
+ readonly agentKey?: string;
248
+ readonly icon?: string;
249
+ readonly color?: string;
250
+ readonly displayOrder?: number;
251
+ readonly displayLocation?: string;
252
+ readonly sideNavItem?: boolean;
253
+ readonly hidden?: boolean;
254
+ readonly maxColumns?: number;
255
+ }
256
+ export interface NormalizedRecordCreateForm {
257
+ readonly sections: readonly NormalizedRecordCreateFormSection[];
258
+ }
259
+ export interface PulledDynamicLayoutRef {
260
+ readonly __pulledRef: "field" | "automation" | "app" | "element";
261
+ readonly key: string;
262
+ readonly parent?: string;
263
+ readonly name?: string;
264
+ }
265
+ export interface NormalizedDynamicLayout {
266
+ readonly key: string;
267
+ /** Camel-case authoring value with pulled-reference markers in token positions. */
268
+ readonly layout: Readonly<Record<string, unknown>>;
269
+ }
270
+ export interface PulledRelationshipRef {
271
+ readonly kind: "app" | "element" | "table" | "field" | "tableColumn";
272
+ readonly key: string;
273
+ readonly name: string;
274
+ readonly parent?: string;
275
+ readonly fieldType?: string;
276
+ readonly tfLabel?: string;
277
+ readonly managed?: boolean;
278
+ }
279
+ export interface NormalizedRelationship {
280
+ readonly key: string;
281
+ readonly target: PulledRelationshipRef;
282
+ readonly columns: readonly {
283
+ readonly field: string;
284
+ readonly relatedField: PulledRelationshipRef;
285
+ }[];
286
+ readonly filter?: NormalizedAccessPolicy["filter"];
123
287
  }
124
288
  /**
125
289
  * Normalized aspect ready for `print-app.ts`. Carries the round-
@@ -131,7 +295,7 @@ export interface NormalizedListView {
131
295
  * `cloudLinkId`, `commentsEnabled`, and `cloudConnection` round-trip
132
296
  * the metadata the discovery endpoints don't surface. They live on
133
297
  * the normalized shape today; the printer wires them into the
134
- * emitted `defineApp({...})` / `defineElement({...})` source as the
298
+ * emitted `app({...})` / `element({...})` source as the
135
299
  * matching authoring slots land.
136
300
  */
137
301
  export interface NormalizedApp {
@@ -145,7 +309,7 @@ export interface NormalizedApp {
145
309
  readonly category?: AppCategory;
146
310
  /** camelCased identifier for the export binding and EDK refName. */
147
311
  readonly refName: string;
148
- /** Backend app/element handle authored into defineApp({ handle }). */
312
+ /** Backend app/element handle authored into app({ handle }). */
149
313
  readonly backendHandle: string;
150
314
  readonly fields: readonly NormalizedField[];
151
315
  readonly stages: readonly NormalizedStage[];
@@ -161,8 +325,24 @@ export interface NormalizedApp {
161
325
  readonly layouts?: readonly NormalizedLayout[];
162
326
  /** Saved list views (`elementum_list_view`). */
163
327
  readonly listViews?: readonly NormalizedListView[];
328
+ /** Calendar views (`elementum_calendar_view`). */
329
+ readonly calendarViews?: readonly NormalizedCalendarView[];
330
+ /** Kanban views (`elementum_kanban_view`). */
331
+ readonly kanbanViews?: readonly NormalizedKanbanView[];
332
+ readonly dashboardViews?: readonly NormalizedDashboardView[];
333
+ readonly dashboards?: readonly NormalizedDashboard[];
334
+ readonly widgets?: readonly NormalizedWidget[];
335
+ /** Agent-powered record views (`elementum_agent_view`). */
336
+ readonly agentViews?: readonly NormalizedAgentView[];
337
+ /** New-record form (`elementum_record_create_form`). */
338
+ readonly recordCreateForm?: NormalizedRecordCreateForm;
339
+ readonly dynamicLayouts?: readonly NormalizedDynamicLayout[];
340
+ readonly relationships?: readonly NormalizedRelationship[];
164
341
  /** Display order of `listViews`, by key (`elementum_managed_view_order`). */
165
342
  readonly viewOrder?: readonly string[];
166
343
  /** App/element-level sharing & row-level-security policies (`elementum_access_policy`), in export order. */
167
344
  readonly accessPolicies?: readonly NormalizedAccessPolicy[];
345
+ /** Custom roles only; managed roles are represented by data lookups. */
346
+ readonly roles?: readonly NormalizedRole[];
347
+ readonly serviceAccounts?: readonly NormalizedServiceAccount[];
168
348
  }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Opaque marker for a calculated-field expression pulled from the
3
+ * server. Wraps the server's stored expression string in a
4
+ * `CalculationExpression` brand so it round-trips byte-stable through
5
+ * `.deploy()` without any TS-side parsing.
6
+ *
7
+ * Why this exists (and why it isn't on the public `calc` namespace):
8
+ *
9
+ * Calculated expressions are stored on the server as a single string
10
+ * (the raw text the ANTLR parser accepts). The platform's parser also
11
+ * NORMALIZES expressions on conversion — `"Quantity" / "Threshold"`
12
+ * becomes something like `division(..., nullIf(cast(..., DECIMAL), 0))`
13
+ * server-side, so the stored text after a deploy may not match what
14
+ * the author wrote in the EDK DSL. Parsing it back into typed AST
15
+ * form would require both a TS port of the grammar AND an
16
+ * un-normalization pass — neither of which the EDK ships today.
17
+ *
18
+ * The marker sidesteps the problem: on pull, the deserializer wraps
19
+ * the server's stored string in `__pulledExpression(...)`. On
20
+ * re-deploy, the serializer reads `toCalcString()` and emits the
21
+ * exact same string. The server gets back what it stored.
22
+ *
23
+ * **Edit contract.** When an agent edits a pulled file:
24
+ * - **Unchanged expression** — leave the `__pulledExpression(...)`
25
+ * call alone. Re-deploy emits the same string, no semantic change.
26
+ * - **Changed expression** — REPLACE THE ENTIRE CALL with a typed
27
+ * `calc.*` expression (e.g. `calc.if(calc.gt(f.x, 10), 'hi', 'lo')`).
28
+ * The typed DSL gives the agent compile-time validation of field
29
+ * refs, function names, and argument types. Tweaking the inner
30
+ * string directly bypasses TypeScript and reintroduces the
31
+ * hallucination surface the typed DSL exists to eliminate.
32
+ *
33
+ * **Why this module isn't in `src/aspects/index.ts`.** Public-API
34
+ * autocomplete is the path an authoring agent discovers the EDK
35
+ * through. Surfacing `__pulledExpression` there would invite agents to
36
+ * use it as a generic "raw string expression" escape hatch, which
37
+ * defeats the typed DSL. Pulled files import this symbol via the
38
+ * deep path `../../aspects/deserializer/pulled-expression.js` — the
39
+ * unusual import signals "pull-printer-emitted; not for hand-authoring."
40
+ */
41
+ import type { CalculationExpression } from "../../../core/types/app.js";
42
+ import type { Expr, ExprType } from "../../field/calc/types.js";
43
+ /**
44
+ * Wrap the server-stored expression string as an opaque
45
+ * `CalculationExpression`. The only call site is the pull printer
46
+ * (`print-aspect.ts`); agents authoring new fields use the typed
47
+ * `calc.*` builder instead.
48
+ *
49
+ * Naming uses the `__` prefix that other pull-printer-emitted runtime
50
+ * guards on this codebase use (`__pulledType`, `__pulledValueIds`) —
51
+ * signals "this came from the pull printer; the runtime treats it
52
+ * specially."
53
+ */
54
+ export declare function __pulledExpression(serverText: string): CalculationExpression;
55
+ /**
56
+ * Pull-only fidelity bridge for server-normalized calculation grammar.
57
+ * Hand-authored calculations should use the typed `calc.*` DSL instead.
58
+ */
59
+ export declare function preservePulledCalculation<T extends ExprType>(serverText: string, resultType: T): Expr<T, "single", "record">;