@elementumai/edk 0.9.2 → 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 (296) hide show
  1. package/README.md +34 -26
  2. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +1 -1
  3. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
  4. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +1 -1
  5. package/dist-sdk/pull/util.d.ts +1 -1
  6. package/dist-sdk/pull/util.js +3 -3
  7. package/dist-sdk/src/catalog/factories.d.ts +49 -10
  8. package/dist-sdk/src/catalog/factories.js +94 -13
  9. package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
  10. package/dist-sdk/src/catalog/from-authoring.js +7 -7
  11. package/dist-sdk/src/catalog/index.d.ts +2 -2
  12. package/dist-sdk/src/catalog/index.js +1 -1
  13. package/dist-sdk/src/catalog/org.js +62 -4
  14. package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
  15. package/dist-sdk/src/catalog/render-helpers.js +1 -1
  16. package/dist-sdk/src/catalog/render.d.ts +1 -0
  17. package/dist-sdk/src/catalog/render.js +2 -2
  18. package/dist-sdk/src/catalog/token.js +11 -4
  19. package/dist-sdk/src/catalog/types.d.ts +33 -4
  20. package/dist-sdk/src/catalog/types.js +5 -0
  21. package/dist-sdk/src/core/index.d.ts +10 -10
  22. package/dist-sdk/src/core/index.js +9 -9
  23. package/dist-sdk/src/core/render-tree.d.ts +1 -1
  24. package/dist-sdk/src/core/render-tree.js +1 -2
  25. package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
  26. package/dist-sdk/src/core/types/ai-provider.js +1 -1
  27. package/dist-sdk/src/core/types/app.d.ts +66 -30
  28. package/dist-sdk/src/core/types/app.js +2 -2
  29. package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
  30. package/dist-sdk/src/core/types/aspect-category.js +4 -4
  31. package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
  32. package/dist-sdk/src/core/types/cloud-link.js +3 -3
  33. package/dist-sdk/src/core/types/display-block.d.ts +2 -2
  34. package/dist-sdk/src/core/types/display-block.js +2 -2
  35. package/dist-sdk/src/core/types/group.d.ts +1 -1
  36. package/dist-sdk/src/core/types/group.js +1 -1
  37. package/dist-sdk/src/core/types/user.d.ts +1 -1
  38. package/dist-sdk/src/core/types/user.js +1 -1
  39. package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
  40. package/dist-sdk/src/engine/build/context.d.ts +20 -13
  41. package/dist-sdk/src/engine/entity.d.ts +1 -1
  42. package/dist-sdk/src/engine/pull/context.d.ts +34 -0
  43. package/dist-sdk/src/engine/pull/context.js +14 -0
  44. package/dist-sdk/src/engine/pull/org.d.ts +9 -0
  45. package/dist-sdk/src/engine/pull/org.js +33 -0
  46. package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
  47. package/dist-sdk/src/engine/pull/ref-only.js +204 -0
  48. package/dist-sdk/src/engine/tf/expr.d.ts +6 -2
  49. package/dist-sdk/src/engine/tf/expr.js +18 -13
  50. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  51. package/dist-sdk/src/engine/tf/index.js +1 -1
  52. package/dist-sdk/src/engine/tf/model.d.ts +8 -1
  53. package/dist-sdk/src/engine/tf/model.js +4 -0
  54. package/dist-sdk/src/engine/tf/parse.js +13 -2
  55. package/dist-sdk/src/engine/tf/render.js +4 -0
  56. package/dist-sdk/src/entities/access-policy/build.d.ts +4 -5
  57. package/dist-sdk/src/entities/access-policy/build.js +1 -1
  58. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -4
  59. package/dist-sdk/src/entities/access-policy/from-tf.js +12 -13
  60. package/dist-sdk/src/entities/access-policy/principal.d.ts +14 -4
  61. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +14 -2
  62. package/dist-sdk/src/entities/access-policy/to-tf.js +36 -6
  63. package/dist-sdk/src/entities/agent/build.d.ts +3 -3
  64. package/dist-sdk/src/entities/agent/build.js +5 -5
  65. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +6 -1
  66. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -18
  67. package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
  68. package/dist-sdk/src/entities/agent/from-tf.js +12 -4
  69. package/dist-sdk/src/entities/agent/index.d.ts +2 -2
  70. package/dist-sdk/src/entities/agent/index.js +1 -1
  71. package/dist-sdk/src/entities/agent/module.js +2 -0
  72. package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -2
  73. package/dist-sdk/src/entities/agent/to-tf.js +56 -8
  74. package/dist-sdk/src/entities/agent/tools.d.ts +38 -23
  75. package/dist-sdk/src/entities/agent/tools.js +21 -7
  76. package/dist-sdk/src/entities/agent-evaluation/build.d.ts +19 -0
  77. package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
  78. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
  79. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
  80. package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
  81. package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
  82. package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
  83. package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
  84. package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
  85. package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
  86. package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
  87. package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
  88. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -7
  89. package/dist-sdk/src/entities/agent-tool/from-tf.js +48 -6
  90. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +10 -2
  91. package/dist-sdk/src/entities/agent-tool/to-tf.js +76 -28
  92. package/dist-sdk/src/entities/agent-tool/types.d.ts +0 -1
  93. package/dist-sdk/src/entities/agent-tool/types.js +10 -37
  94. package/dist-sdk/src/entities/app/build.d.ts +97 -42
  95. package/dist-sdk/src/entities/app/build.js +25 -14
  96. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +32 -24
  97. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +1 -1
  98. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +2 -0
  99. package/dist-sdk/src/entities/app/index.d.ts +11 -8
  100. package/dist-sdk/src/entities/app/index.js +10 -7
  101. package/dist-sdk/src/entities/app/module.js +2 -2
  102. package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
  103. package/dist-sdk/src/entities/app/to-tf.js +22 -6
  104. package/dist-sdk/src/entities/approval-chain/build.d.ts +1 -1
  105. package/dist-sdk/src/entities/approval-chain/build.js +5 -5
  106. package/dist-sdk/src/entities/approval-chain/index.d.ts +1 -1
  107. package/dist-sdk/src/entities/approval-chain/index.js +1 -1
  108. package/dist-sdk/src/entities/approval-chain/printer.js +2 -2
  109. package/dist-sdk/src/entities/automation/build.d.ts +172 -94
  110. package/dist-sdk/src/entities/automation/build.js +159 -68
  111. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
  112. package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
  113. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +11 -4
  114. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
  115. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +164 -198
  116. package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -2
  117. package/dist-sdk/src/entities/automation/from-tf.js +510 -80
  118. package/dist-sdk/src/entities/automation/index.d.ts +9 -12
  119. package/dist-sdk/src/entities/automation/index.js +11 -13
  120. package/dist-sdk/src/entities/automation/module.js +74 -6
  121. package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
  122. package/dist-sdk/src/entities/automation/operators.js +10 -37
  123. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
  124. package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
  125. package/dist-sdk/src/entities/automation/script-code.js +13 -22
  126. package/dist-sdk/src/entities/automation/serialize.js +1 -1
  127. package/dist-sdk/src/entities/automation/tasks.d.ts +153 -89
  128. package/dist-sdk/src/entities/automation/tasks.js +64 -11
  129. package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -1
  130. package/dist-sdk/src/entities/automation/to-tf.js +342 -71
  131. package/dist-sdk/src/entities/automation/triggers.d.ts +17 -10
  132. package/dist-sdk/src/entities/automation/triggers.js +7 -1
  133. package/dist-sdk/src/entities/automation/types.d.ts +3 -2
  134. package/dist-sdk/src/entities/automation/types.js +3 -2
  135. package/dist-sdk/src/entities/chart/build.d.ts +95 -0
  136. package/dist-sdk/src/entities/chart/build.js +42 -0
  137. package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
  138. package/dist-sdk/src/entities/chart/from-tf.js +269 -0
  139. package/dist-sdk/src/entities/chart/index.d.ts +4 -0
  140. package/dist-sdk/src/entities/chart/index.js +3 -0
  141. package/dist-sdk/src/entities/chart/module.d.ts +3 -0
  142. package/dist-sdk/src/entities/chart/module.js +61 -0
  143. package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
  144. package/dist-sdk/src/entities/chart/printer.js +104 -0
  145. package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
  146. package/dist-sdk/src/entities/chart/to-tf.js +150 -0
  147. package/dist-sdk/src/entities/chart/types.d.ts +53 -0
  148. package/dist-sdk/src/entities/chart/types.js +22 -0
  149. package/dist-sdk/src/entities/dashboard/build.d.ts +34 -7
  150. package/dist-sdk/src/entities/dashboard/build.js +16 -1
  151. package/dist-sdk/src/entities/dashboard/from-tf.js +22 -4
  152. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +16 -3
  153. package/dist-sdk/src/entities/dashboard/to-tf.js +37 -10
  154. package/dist-sdk/src/entities/datamine/module.js +1 -1
  155. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +4 -3
  156. package/dist-sdk/src/entities/dynamic-layout/build.js +1 -1
  157. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
  158. package/dist-sdk/src/entities/dynamic-layout/dialect.js +43 -5
  159. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +12 -6
  160. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +10 -10
  161. package/dist-sdk/src/entities/element/build.d.ts +25 -32
  162. package/dist-sdk/src/entities/element/build.js +15 -32
  163. package/dist-sdk/src/entities/element/index.d.ts +7 -5
  164. package/dist-sdk/src/entities/element/index.js +7 -4
  165. package/dist-sdk/src/entities/element/module.js +7 -3
  166. package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
  167. package/dist-sdk/src/entities/element/to-tf.js +7 -3
  168. package/dist-sdk/src/entities/field/build.d.ts +51 -24
  169. package/dist-sdk/src/entities/field/build.js +31 -6
  170. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
  171. package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
  172. package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
  173. package/dist-sdk/src/entities/field/calc/date.js +120 -29
  174. package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
  175. package/dist-sdk/src/entities/field/calc/index.js +82 -139
  176. package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
  177. package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
  178. package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
  179. package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
  180. package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
  181. package/dist-sdk/src/entities/field/calc/text.js +43 -31
  182. package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
  183. package/dist-sdk/src/entities/field/calc/types.js +1 -22
  184. package/dist-sdk/src/entities/field/calc.d.ts +71 -48
  185. package/dist-sdk/src/entities/field/calc.js +5 -15
  186. package/dist-sdk/src/entities/field/calculation-types.js +10 -3
  187. package/dist-sdk/src/entities/field/from-tf.js +156 -10
  188. package/dist-sdk/src/entities/field/locals.d.ts +11 -3
  189. package/dist-sdk/src/entities/field/locals.js +15 -2
  190. package/dist-sdk/src/entities/field/module.js +23 -6
  191. package/dist-sdk/src/entities/field/record-shape.d.ts +24 -10
  192. package/dist-sdk/src/entities/field/to-tf.d.ts +40 -1
  193. package/dist-sdk/src/entities/field/to-tf.js +293 -35
  194. package/dist-sdk/src/entities/field/types.d.ts +1 -1
  195. package/dist-sdk/src/entities/field/types.js +7 -1
  196. package/dist-sdk/src/entities/file-reader/build.d.ts +5 -0
  197. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +1 -1
  198. package/dist-sdk/src/entities/org/cloud-link.js +4 -5
  199. package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
  200. package/dist-sdk/src/entities/org/email-alias.js +12 -0
  201. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  202. package/dist-sdk/src/entities/org/index.js +1 -0
  203. package/dist-sdk/src/entities/org/phone-provider.js +4 -7
  204. package/dist-sdk/src/entities/organization/build.d.ts +214 -2
  205. package/dist-sdk/src/entities/organization/build.js +145 -4
  206. package/dist-sdk/src/entities/organization/index.d.ts +1 -1
  207. package/dist-sdk/src/entities/organization/index.js +1 -1
  208. package/dist-sdk/src/entities/organization/module.js +4 -1
  209. package/dist-sdk/src/entities/organization/to-tf.d.ts +1 -0
  210. package/dist-sdk/src/entities/organization/to-tf.js +118 -1
  211. package/dist-sdk/src/entities/phone-service/build.d.ts +1 -1
  212. package/dist-sdk/src/entities/phone-service/build.js +2 -2
  213. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +5 -3
  214. package/dist-sdk/src/entities/phone-service/index.d.ts +1 -1
  215. package/dist-sdk/src/entities/phone-service/index.js +1 -1
  216. package/dist-sdk/src/entities/phone-service/types.js +1 -1
  217. package/dist-sdk/src/entities/record-create-form/to-tf.js +9 -1
  218. package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
  219. package/dist-sdk/src/entities/relationship/to-tf.js +5 -13
  220. package/dist-sdk/src/entities/search-table/build.d.ts +4 -4
  221. package/dist-sdk/src/entities/search-table/build.js +13 -13
  222. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  223. package/dist-sdk/src/entities/search-table/index.js +2 -2
  224. package/dist-sdk/src/entities/search-table/printer.js +5 -5
  225. package/dist-sdk/src/entities/service-account/to-tf.d.ts +21 -0
  226. package/dist-sdk/src/entities/service-account/to-tf.js +32 -1
  227. package/dist-sdk/src/entities/shared/context.d.ts +25 -24
  228. package/dist-sdk/src/entities/shared/context.js +36 -35
  229. package/dist-sdk/src/entities/shared/filters/ast.d.ts +10 -3
  230. package/dist-sdk/src/entities/shared/filters/ast.js +1 -0
  231. package/dist-sdk/src/entities/shared/filters/index.d.ts +2 -1
  232. package/dist-sdk/src/entities/shared/filters/index.js +11 -4
  233. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +14 -0
  234. package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
  235. package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
  236. package/dist-sdk/src/entities/shared/ref.js +8 -3
  237. package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
  238. package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
  239. package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
  240. package/dist-sdk/src/entities/skill/build.d.ts +2 -2
  241. package/dist-sdk/src/entities/skill/build.js +3 -3
  242. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
  243. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +26 -7
  244. package/dist-sdk/src/entities/skill/index.d.ts +1 -1
  245. package/dist-sdk/src/entities/skill/index.js +1 -1
  246. package/dist-sdk/src/entities/skill/module.js +2 -2
  247. package/dist-sdk/src/entities/skill/to-tf.d.ts +1 -1
  248. package/dist-sdk/src/entities/skill/to-tf.js +2 -2
  249. package/dist-sdk/src/entities/skill/tools.d.ts +4 -3
  250. package/dist-sdk/src/entities/skill/tools.js +4 -3
  251. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +13 -0
  252. package/dist-sdk/src/entities/skill-tool/from-tf.js +42 -0
  253. package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -6
  254. package/dist-sdk/src/entities/table/build.d.ts +1 -1
  255. package/dist-sdk/src/entities/table/build.js +9 -9
  256. package/dist-sdk/src/entities/table/catalog-render.js +9 -1
  257. package/dist-sdk/src/entities/table/deserializer/normalize.js +4 -4
  258. package/dist-sdk/src/entities/table/fields/types.d.ts +1 -1
  259. package/dist-sdk/src/entities/table/fields/types.js +1 -1
  260. package/dist-sdk/src/entities/table/index.d.ts +2 -2
  261. package/dist-sdk/src/entities/table/index.js +3 -3
  262. package/dist-sdk/src/entities/table/module.js +1 -1
  263. package/dist-sdk/src/entities/table/to-tf.js +22 -30
  264. package/dist-sdk/src/entities/task/build.d.ts +1 -1
  265. package/dist-sdk/src/entities/task/build.js +5 -5
  266. package/dist-sdk/src/entities/task/index.d.ts +1 -1
  267. package/dist-sdk/src/entities/task/index.js +1 -1
  268. package/dist-sdk/src/entities/view/build.d.ts +46 -0
  269. package/dist-sdk/src/entities/view/build.js +19 -0
  270. package/dist-sdk/src/entities/view/from-tf.js +68 -18
  271. package/dist-sdk/src/entities/view/module.d.ts +6 -13
  272. package/dist-sdk/src/entities/view/module.js +7 -14
  273. package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
  274. package/dist-sdk/src/entities/view/sharing.js +6 -0
  275. package/dist-sdk/src/entities/view/to-tf.d.ts +21 -19
  276. package/dist-sdk/src/entities/view/to-tf.js +61 -26
  277. package/dist-sdk/src/entities/view/types.js +3 -0
  278. package/dist-sdk/src/entities/visual-flow/build.d.ts +1 -1
  279. package/dist-sdk/src/entities/visual-flow/build.js +8 -8
  280. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
  281. package/dist-sdk/src/entities/visual-flow/index.js +1 -1
  282. package/dist-sdk/src/entities/visual-flow/module.js +1 -1
  283. package/dist-sdk/src/entities/visual-flow/printer.js +3 -3
  284. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +1 -0
  285. package/dist-sdk/src/entities/visual-flow/to-tf.js +3 -7
  286. package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
  287. package/dist-sdk/src/entities/widget/to-tf.js +9 -7
  288. package/dist-sdk/src/graph/index.d.ts +5 -1
  289. package/dist-sdk/src/graph/index.js +4 -1
  290. package/dist-sdk/src/graph/modules.js +6 -1
  291. package/dist-sdk/src/graph/types.d.ts +52 -1
  292. package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
  293. package/dist-sdk/src/internal/safe-identifier.js +13 -0
  294. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  295. package/dist-sdk/src/internal/sdk-package.js +1 -0
  296. package/package.json +12 -3
@@ -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",
@@ -121,7 +121,7 @@ function unwrapUnsafePlatformIds(value) {
121
121
  }
122
122
  /**
123
123
  * Serialize an authored field to its `AspectFieldInput` wire shape — shared
124
- * 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
125
125
  * `fields: {}` (e.g. `severity`) — carried as the internal `__refName` marker,
126
126
  * a client-side-only bookkeeping value `applyV2`'s field reconciliation
127
127
  * (`src/deploy/apply/apply.ts`, `reconcileFields`) reads to match this field
@@ -153,7 +153,11 @@ export function serializeField(field, refName) {
153
153
  // Calculated field: the calc expression serializes to a text grammar string
154
154
  // (field refs emitted by name; the platform resolves them on compose).
155
155
  if (field.expression !== undefined) {
156
- 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 } } };
157
161
  }
158
162
  if (key === "picklist" || key === "multiPicklist") {
159
163
  if (shouldSerializePicklistOptions(field)) {
@@ -251,11 +255,11 @@ export function serializeSystemFields(overrides) {
251
255
  * Build a v2 app entity: org-owned, compose-body payload. Exposes
252
256
  * `.ref(refName)` and `.def(refName)`.
253
257
  *
254
- * Elements author through `defineElement` (`@elementumai/edk/elements`,
258
+ * Elements author through `element` (`@elementumai/edk/elements`,
255
259
  * `src/elements/build.ts`) instead — a dedicated builder/printer, since a
256
260
  * *linked* element's cloud mapping (Cloud Link + Database + Schema + Table,
257
261
  * vs. a *standard* element's Elementum-managed table) has no equivalent on an
258
- * app. `defineApp`'s `type` no longer accepts `"ELEMENT"`.
262
+ * app. `app`'s `type` no longer accepts `"ELEMENT"`.
259
263
  */
260
264
  /**
261
265
  * The GraphQL API constrains an aspect handle to letters only, either case, no
@@ -264,7 +268,7 @@ export function serializeSystemFields(overrides) {
264
268
  */
265
269
  export const APP_HANDLE_RE = /^[a-zA-Z]+$/;
266
270
  /**
267
- * Client-side validation for `defineApp` — the authoring-time home for app
271
+ * Client-side validation for `app` — the authoring-time home for app
268
272
  * validation rules, so a malformed definition fails at define time rather than
269
273
  * as an opaque platform error during apply. App-specific on purpose: elements
270
274
  * carry their own equivalent in `src/elements/build.ts`.
@@ -274,22 +278,22 @@ export const APP_HANDLE_RE = /^[a-zA-Z]+$/;
274
278
  */
275
279
  function validateAppOptions(opts) {
276
280
  if (opts.handle !== undefined && !APP_HANDLE_RE.test(opts.handle)) {
277
- 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).`);
278
282
  }
279
283
  if (opts.namespace !== undefined && !/^[a-z]+$/.test(opts.namespace)) {
280
- 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).`);
281
285
  }
282
286
  }
283
287
  export function picklistOptionLabels(options) {
284
288
  return options.map((option) => typeof option === "string" ? option : option.label);
285
289
  }
286
- export function defineApp(opts) {
290
+ export function app(opts) {
287
291
  validateAppOptions(opts);
288
292
  const fieldEntries = Object.values(opts.fields);
289
293
  // systemFields overrides synthesize real field entries too (a pulled app can
290
294
  // legitimately have zero custom fields — see the voicetest fixture).
291
295
  if (fieldEntries.length === 0 && serializeSystemFields(opts.systemFields).length === 0) {
292
- 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.`);
293
297
  }
294
298
  const kind = "app";
295
299
  function makeRef(refName) {
@@ -342,6 +346,7 @@ export function defineApp(opts) {
342
346
  __kind: kind,
343
347
  refName,
344
348
  name: opts.name,
349
+ ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),
345
350
  fields,
346
351
  agent(childRefName, name = childRefName) {
347
352
  return { __kind: "agent", refName: childRefName, name, parent: refName };
@@ -349,6 +354,12 @@ export function defineApp(opts) {
349
354
  automation(childRefName, name = childRefName) {
350
355
  return { __kind: "automation", refName: childRefName, name, parent: refName };
351
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
+ },
352
363
  };
353
364
  return self;
354
365
  }
@@ -357,7 +368,7 @@ export function defineApp(opts) {
357
368
  ref: configured.ref,
358
369
  def(refName) {
359
370
  const referenced = configure(makeRef(refName));
360
- return defineApp({ ...opts, ...referenced }).def(refName);
371
+ return app({ ...opts, ...referenced }).def(refName);
361
372
  },
362
373
  withRefs(next) {
363
374
  return withReferenceConfiguration((app) => ({ ...configure(app), ...next(app) }));
@@ -381,7 +392,7 @@ export function defineApp(opts) {
381
392
  return makeRef(refName);
382
393
  },
383
394
  def(refName) {
384
- assertNoSystemKeyCollision("defineApp", opts.name, opts.fields, opts.systemFields);
395
+ assertNoSystemKeyCollision("app", opts.name, opts.fields, opts.systemFields);
385
396
  const displayBlocks = serializeDisplayBlocks(opts.displayBlocks, "LAYOUT");
386
397
  const recordCreateDisplayBlocks = serializeDisplayBlocks(opts.recordCreateDisplayBlocks, "CREATE");
387
398
  const payload = {
@@ -14,7 +14,8 @@ import type { DisplayBlock } from "../../../core/types/display-block.js";
14
14
  import type { NormalizedAccessPolicy } from "../../access-policy/from-tf.js";
15
15
  import type { RefExpr } from "../../shared/filters/ast.js";
16
16
  import type { Filter } from "../../shared/filters/types.js";
17
- import type { AccessPolicyGroupRef, AccessPolicyUserRef } from "../../access-policy/principal.js";
17
+ import type { ManagedViewSharing } from "../../view/sharing.js";
18
+ import type { ListViewDensity, NormalizedManagedViewSort } from "../../view/build.js";
18
19
  import type { NormalizedRole } from "../../role/from-tf.js";
19
20
  import type { NormalizedServiceAccount } from "../../service-account/from-tf.js";
20
21
  import type { CalculationResultType } from "../../field/calculation-types.js";
@@ -32,13 +33,17 @@ export interface NormalizedField {
32
33
  readonly field: AppField;
33
34
  /** Server-validated output type for a pulled calculated field. */
34
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
+ };
35
40
  /**
36
41
  * Side-channel pull annotation for dependent-picklist linkage.
37
42
  * Typed-ref `parentField` / `parentValues` on the runtime AppField
38
43
  * need real picklist-object references, which aren't available until
39
44
  * every sibling field has been projected — and emitting those refs
40
45
  * from the printer requires hoisting parent / child fields to
41
- * top-level `const`s before the `defineApp({...})` literal. We carry
46
+ * top-level `const`s before the `app({...})` literal. We carry
42
47
  * just the raw ids here; the printer resolves them against the
43
48
  * other entries in the same `NormalizedApp.fields` list at emit
44
49
  * time.
@@ -109,6 +114,7 @@ export interface NormalizedLayoutSection {
109
114
  readonly name?: string;
110
115
  readonly icon?: string;
111
116
  readonly color?: string;
117
+ readonly maxColumns?: number;
112
118
  readonly fields?: readonly string[];
113
119
  }
114
120
  /** A stage's record-detail layout, keyed by stage key on `NormalizedApp.layouts`. */
@@ -117,41 +123,36 @@ export interface NormalizedLayout {
117
123
  readonly sections: readonly NormalizedLayoutSection[];
118
124
  }
119
125
  /** A saved list view (`elementum_list_view`). `key` is its authoring bag key. */
120
- export interface NormalizedListView {
126
+ export interface NormalizedListView extends ManagedViewSharing {
121
127
  readonly key: string;
122
128
  readonly name: string;
123
129
  readonly columns: readonly string[];
124
130
  readonly allowRecordCreation?: boolean;
125
- readonly density?: string;
131
+ readonly density?: ListViewDensity;
126
132
  readonly rows?: number;
127
133
  /** Opaque JSON pass-through (see `entities/view/from-tf.ts` for why). */
128
134
  readonly filter?: Filter<RefExpr, RefExpr>;
129
- /** Opaque JSON pass-through (see `entities/view/from-tf.ts` for why). */
130
- readonly sort?: unknown;
135
+ readonly sort?: NormalizedManagedViewSort;
131
136
  }
132
137
  /** An agent-powered view (`elementum_agent_view`). */
133
- export interface NormalizedAgentView {
138
+ export interface NormalizedAgentView extends ManagedViewSharing {
134
139
  readonly key: string;
135
140
  readonly name: string;
136
141
  readonly agentKey: string;
137
142
  readonly allowRecordCreation?: boolean;
138
143
  readonly filter?: Filter<RefExpr, RefExpr>;
139
- readonly sort?: unknown;
140
- readonly userIds?: readonly AccessPolicyUserRef[];
141
- readonly groupIds?: readonly AccessPolicyGroupRef[];
144
+ readonly sort?: NormalizedManagedViewSort;
142
145
  readonly displayOrder?: number;
143
146
  }
144
147
  /** A calendar view (`elementum_calendar_view`). */
145
- export interface NormalizedCalendarView {
148
+ export interface NormalizedCalendarView extends ManagedViewSharing {
146
149
  readonly key: string;
147
150
  readonly name: string;
148
151
  readonly columns: readonly string[];
149
152
  readonly displayByField?: string;
150
153
  readonly allowRecordCreation?: boolean;
151
154
  readonly filter?: Filter<RefExpr, RefExpr>;
152
- readonly sort?: unknown;
153
- readonly userIds?: readonly AccessPolicyUserRef[];
154
- readonly groupIds?: readonly AccessPolicyGroupRef[];
155
+ readonly sort?: NormalizedManagedViewSort;
155
156
  }
156
157
  /** A kanban view (`elementum_kanban_view`). */
157
158
  export interface NormalizedKanbanView extends NormalizedCalendarView {
@@ -164,17 +165,26 @@ export interface NormalizedDashboard {
164
165
  readonly tags?: readonly string[];
165
166
  readonly widgets?: readonly NormalizedDashboardWidget[];
166
167
  }
167
- export interface NormalizedDashboardWidget {
168
+ export type NormalizedDashboardWidget = {
168
169
  readonly key: string;
169
170
  readonly name: string;
170
171
  readonly size: string;
171
172
  readonly color?: string;
172
173
  readonly icon?: string;
173
174
  readonly type: "records";
174
- readonly target: NormalizedWidgetRef | string;
175
+ readonly target: NormalizedWidgetRef & {
176
+ readonly kind: "app" | "element";
177
+ };
175
178
  readonly filter?: Filter<RefExpr, RefExpr>;
176
- readonly sort?: unknown;
177
- }
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
+ };
178
188
  export interface NormalizedWidgetRef {
179
189
  readonly kind: "app" | "element" | "automation" | "field";
180
190
  readonly key: string;
@@ -223,15 +233,13 @@ export type NormalizedWidget = {
223
233
  }[];
224
234
  } & NormalizedWidgetButtonStyle);
225
235
  /** A view that embeds one of the owning aspect's dashboards. */
226
- export interface NormalizedDashboardView {
236
+ export interface NormalizedDashboardView extends ManagedViewSharing {
227
237
  readonly key: string;
228
238
  readonly name: string;
229
239
  readonly dashboardKey: string;
230
240
  readonly allowRecordCreation?: boolean;
231
241
  readonly filter?: Filter<RefExpr, RefExpr>;
232
- readonly sort?: unknown;
233
- readonly userIds?: readonly AccessPolicyUserRef[];
234
- readonly groupIds?: readonly AccessPolicyGroupRef[];
242
+ readonly sort?: NormalizedManagedViewSort;
235
243
  }
236
244
  export interface NormalizedRecordCreateFormSection {
237
245
  readonly name: string;
@@ -287,7 +295,7 @@ export interface NormalizedRelationship {
287
295
  * `cloudLinkId`, `commentsEnabled`, and `cloudConnection` round-trip
288
296
  * the metadata the discovery endpoints don't surface. They live on
289
297
  * the normalized shape today; the printer wires them into the
290
- * emitted `defineApp({...})` / `defineElement({...})` source as the
298
+ * emitted `app({...})` / `element({...})` source as the
291
299
  * matching authoring slots land.
292
300
  */
293
301
  export interface NormalizedApp {
@@ -301,7 +309,7 @@ export interface NormalizedApp {
301
309
  readonly category?: AppCategory;
302
310
  /** camelCased identifier for the export binding and EDK refName. */
303
311
  readonly refName: string;
304
- /** Backend app/element handle authored into defineApp({ handle }). */
312
+ /** Backend app/element handle authored into app({ handle }). */
305
313
  readonly backendHandle: string;
306
314
  readonly fields: readonly NormalizedField[];
307
315
  readonly stages: readonly NormalizedStage[];
@@ -56,4 +56,4 @@ export declare function __pulledExpression(serverText: string): CalculationExpre
56
56
  * Pull-only fidelity bridge for server-normalized calculation grammar.
57
57
  * Hand-authored calculations should use the typed `calc.*` DSL instead.
58
58
  */
59
- export declare function preservePulledCalculation<T extends ExprType>(serverText: string, resultType: T): Expr<T>;
59
+ export declare function preservePulledCalculation<T extends ExprType>(serverText: string, resultType: T): Expr<T, "single", "record">;
@@ -63,6 +63,8 @@ export function preservePulledCalculation(serverText, resultType) {
63
63
  return {
64
64
  __calc: true,
65
65
  __exprType: resultType,
66
+ __exprCardinality: "single",
67
+ __exprContext: "record",
66
68
  toCalcString: () => serverText,
67
69
  };
68
70
  }
@@ -1,21 +1,24 @@
1
1
  /**
2
- * v2 app authoring — `defineApp`. Org-owned; deploys via the wire client's
2
+ * v2 app authoring — `app`. Org-owned; deploys via the wire client's
3
3
  * compose path. Standalone from v1's `src/aspects`. Elements author through
4
- * the sibling `@elementumai/edk/elements` module (`defineElement`) — see
4
+ * the sibling `@elementumai/edk/elements` module (`element`) — see
5
5
  * `src/elements/build.ts`'s header for why apps and elements split into
6
6
  * dedicated builders despite sharing this module's field/print internals.
7
7
  */
8
- export { defineApp, type AppCategory, type AppCloudOptions, type AppField, type AppPicklistConfig, type AppPicklistDynamicConfig, type AppRecordCreateForm, type AppRecordCreateFormSection, type AppConfigured, type AppFieldRefs, type AppRef, type AppSelfRef, type AppReferenceConfiguration, type AppV2Options, type PicklistOption, } from "./build.js";
8
+ export { app, type AppAgentView, type AppCalendarView, type AppDashboardView, type AppKanbanView, type AppListView, type AppCategory, type AppCloudOptions, type AppField, type AppPicklistConfig, type AppPicklistDynamicConfig, type AppPicklistDynamicSortOrder, type AppRecordCreateForm, type AppRecordCreateFormSection, type AppConfigured, type AppFieldRefs, type AppRef, type AppSelfRef, type AppReferenceConfiguration, type AppV2Options, type PicklistOption, } from "./build.js";
9
+ export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, type ListViewDensity, type ManagedViewSort, type ManagedViewSortAggregation, type ManagedViewSortDirection, type ManagedViewSortField, type ManagedViewSortOrder, } from "../view/build.js";
9
10
  export { type AppWidget, type CreateRecordWidget, type LinkRecordsWidget, type RelatedRecordsWidget, type RunAutomationWidget, type RunAutomationWidgetParameter, type WidgetButtonStyle, type WidgetButtonType, } from "../widget/build.js";
10
11
  export { type DisplayBlock } from "./display-blocks.js";
11
12
  export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
12
- export { type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize } from "../dashboard/build.js";
13
- export { type AppDynamicLayout, type DynamicLayoutComponent, type DynamicLayoutCondition, type DynamicLayoutCssLength, type DynamicLayoutDependency, type DynamicLayoutFieldComponent, type DynamicLayoutFieldValidation, type DynamicLayoutSaveGroup, type DynamicLayoutStyle, type DynamicLayoutTypedValue, type DynamicLayoutValidationRule, defineDynamicLayout, } from "../dynamic-layout/build.js";
14
- export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField, htmlField, jsonField, multiPicklistField, numberField, picklistField, relationField, textField, userField, type BaseFieldOptions, type NumericFieldOptions, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, } from "../field/build.js";
15
- export { calc, field, type Expr, type ExprType } from "../field/calc.js";
16
- export { definePhoneService, callerAccessMode, type CallerAccessMode, type E164PhoneNumber, type PhoneServiceConfigured, type PhoneServiceNumber, type PhoneServiceOptions, type PhoneServiceRegistration, } from "../phone-service/index.js";
13
+ export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, type DashboardChartWidget, type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize, } from "../dashboard/build.js";
14
+ export { type AppDynamicLayout, type DynamicLayoutComponent, type DynamicLayoutCondition, type DynamicLayoutCssLength, type DynamicLayoutDependency, type DynamicLayoutFieldComponent, type DynamicLayoutFieldValidation, type DynamicLayoutSaveGroup, type DynamicLayoutStyle, type DynamicLayoutTypedValue, type DynamicLayoutValidationRule, dynamicLayout, } from "../dynamic-layout/build.js";
15
+ export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, groupField, jsonField, multiPicklistField, numberField, picklistField, relationField, richTextField, textField, userField, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type NumericFieldOptions, type NumericFieldFormat, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, type QrFieldFormat, } from "../field/build.js";
16
+ export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, type ConcatExprType, type DateDifUnit, type DateTimeTruncPrecision, type Expr, type ExprType, type FieldRefExprType, type OrderByDirection, type Predicate, type PredicateOp, type StringAggOptions, type StringAggOrderBy, type WeekdayMode, } from "../field/calc.js";
17
+ export { agentEvaluation, type AgentEvaluationConfigured, type AgentEvaluationOptions, } from "../agent-evaluation/index.js";
18
+ export { phoneService, callerAccessMode, type CallerAccessMode, type E164PhoneNumber, type PhoneServiceConfigured, type PhoneServiceNumber, type PhoneServiceOptions, type PhoneServiceRegistration, } from "../phone-service/index.js";
17
19
  export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
18
20
  export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
21
+ export { type ManagedViewSharing } from "../view/sharing.js";
19
22
  export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef, type AppRole, type RoleAutoShare, type RoleGroupRef, type RolePermission, type RolePermissionGroup, type RolePermissionLevel, type RoleUserRef } from "../role/build.js";
20
23
  export { serviceAccountRoleRef, serviceAccountStatus, type AppServiceAccount, type ServiceAccountAccessPolicy, type ServiceAccountRoleRef, type ServiceAccountStatus } from "../service-account/build.js";
21
24
  export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
@@ -1,15 +1,18 @@
1
1
  /**
2
- * v2 app authoring — `defineApp`. Org-owned; deploys via the wire client's
2
+ * v2 app authoring — `app`. Org-owned; deploys via the wire client's
3
3
  * compose path. Standalone from v1's `src/aspects`. Elements author through
4
- * the sibling `@elementumai/edk/elements` module (`defineElement`) — see
4
+ * the sibling `@elementumai/edk/elements` module (`element`) — see
5
5
  * `src/elements/build.ts`'s header for why apps and elements split into
6
6
  * dedicated builders despite sharing this module's field/print internals.
7
7
  */
8
- export { defineApp, } from "./build.js";
9
- export { defineDynamicLayout, } from "../dynamic-layout/build.js";
10
- export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField, htmlField, jsonField, multiPicklistField, numberField, picklistField, relationField, textField, userField, } from "../field/build.js";
11
- export { calc, field } from "../field/calc.js";
12
- export { definePhoneService, callerAccessMode, } from "../phone-service/index.js";
8
+ export { app, } from "./build.js";
9
+ export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, } from "../view/build.js";
10
+ export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
11
+ export { dynamicLayout, } from "../dynamic-layout/build.js";
12
+ export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, groupField, jsonField, multiPicklistField, numberField, picklistField, relationField, richTextField, textField, userField, } from "../field/build.js";
13
+ export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, } from "../field/calc.js";
14
+ export { agentEvaluation, } from "../agent-evaluation/index.js";
15
+ export { phoneService, callerAccessMode, } from "../phone-service/index.js";
13
16
  export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
14
17
  export { groupId, userId } from "../access-policy/build.js";
15
18
  export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef } from "../role/build.js";
@@ -61,7 +61,7 @@ export const appModule = {
61
61
  resource: { shape: "single", resourceType: APP_RESOURCE_TYPE, adoptable: true },
62
62
  // Foreign/referenced apps: same KindId + bag; data facet emits
63
63
  // `data.elementum_app` (ref-only stubs on disk are later).
64
- data: { participates: true, lookupAttr: "name", referencedByBuild: true },
64
+ data: { participates: true, lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootNamespace", compatibilityFallback: "name" }] },
65
65
  canvas: { participates: true, label: "Apps", glyph: "▣", component: "appDetail" },
66
66
  lifecycle: {
67
67
  participates: true,
@@ -84,7 +84,7 @@ export const appModule = {
84
84
  appendLocals: (localsAttrs, ctx) => {
85
85
  appendAppLocals(localsAttrs, ctx.appTfLabel);
86
86
  if (ctx.fieldAddresses !== undefined) {
87
- appendFieldLocals(localsAttrs, ctx.fieldAddresses);
87
+ appendFieldLocals(localsAttrs, ctx.fieldAddresses, ctx.blocks);
88
88
  }
89
89
  },
90
90
  },
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * App emission (M2, plan §4.3): `appToTf` consumes the discovered
3
- * `DeployableEntity` (the handle-form `defineApp` compose body) and emits
3
+ * `DeployableEntity` (the handle-form `app` compose body) and emits
4
4
  * `elementum_app` + one field resource per custom field (the field pass
5
5
  * delegates to `entities/field/to-tf.ts`).
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * App emission (M2, plan §4.3): `appToTf` consumes the discovered
3
- * `DeployableEntity` (the handle-form `defineApp` compose body) and emits
3
+ * `DeployableEntity` (the handle-form `app` compose body) and emits
4
4
  * `elementum_app` + one field resource per custom field (the field pass
5
5
  * delegates to `entities/field/to-tf.ts`).
6
6
  *
@@ -113,6 +113,7 @@ export function appToTf(entity, ctx) {
113
113
  const fieldNames = new Map();
114
114
  let statusOptions;
115
115
  let stages;
116
+ const stageTfLabels = new Set();
116
117
  const objectId = expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]);
117
118
  for (const fieldEntry of payload.fields ?? []) {
118
119
  const typeKey = Object.keys(fieldEntry)[0];
@@ -171,7 +172,9 @@ export function appToTf(entity, ctx) {
171
172
  if (inner.picklistValues !== undefined) {
172
173
  stages = inner.picklistValues.map((pv) => {
173
174
  const label = picklistLabel(pv);
174
- return { key: snakeSlug(label), name: label };
175
+ const key = snakeSlug(label);
176
+ stageTfLabels.add(key);
177
+ return { key, name: label };
175
178
  });
176
179
  }
177
180
  break;
@@ -199,11 +202,21 @@ export function appToTf(entity, ctx) {
199
202
  blocks.push(field.block);
200
203
  fieldAddresses.set(field.bagKey, field.address);
201
204
  }
202
- // Required provider attributes — emitted even when empty (an empty
203
- // status_options list gets the provider's defaults; empty stages = no
204
- // stage workflow). Matches ei's export, which always writes both.
205
+ // For an empty authored create, render the two platform-required defaults
206
+ // directly into HCL. plan/apply rejects the same empty authoring when the
207
+ // app is already present in state; after create, apply regenerates source.
205
208
  appAttrs["status_options"] = statusOptions ?? [];
206
- appAttrs["stages"] = stages ?? [];
209
+ if (stages === undefined || stages.length === 0) {
210
+ appAttrs["stages"] = [
211
+ { key: "stage_1", name: "Stage 1" },
212
+ { key: "stage_2", name: "Stage 2" },
213
+ ];
214
+ stageTfLabels.add("stage_1");
215
+ stageTfLabels.add("stage_2");
216
+ }
217
+ else {
218
+ appAttrs["stages"] = stages;
219
+ }
207
220
  // --- View pass: layouts / list views / view order (entities/view), owner passed in.
208
221
  blocks.push(...dashboardsToTf(payload.dashboards, {
209
222
  ownerTfLabel: ctx.appTfLabel,
@@ -231,6 +244,7 @@ export function appToTf(entity, ctx) {
231
244
  ownerTfLabel: ctx.appTfLabel,
232
245
  aspectName: payload.name ?? "",
233
246
  objectId,
247
+ stageTfLabels,
234
248
  dashboardKeys: new Set(Object.keys(payload.dashboards ?? {})),
235
249
  orgRefs: ctx.orgRefs,
236
250
  diagnostics: ctx.diagnostics,
@@ -274,6 +288,8 @@ export function appToTf(entity, ctx) {
274
288
  objectId,
275
289
  orgRefs: ctx.orgRefs,
276
290
  diagnostics: ctx.diagnostics,
291
+ appRefName: ctx.appRefName,
292
+ serviceAccounts: payload.serviceAccounts,
277
293
  });
278
294
  blocks.push(block);
279
295
  }
@@ -35,5 +35,5 @@ export interface ApprovalProcessConfigured<App extends AppOwner = AppOwner> {
35
35
  def(refName: string): DeployableEntity;
36
36
  }
37
37
  /** Define an app-owned approval process using the provider's dynamic-approver contract. */
38
- export declare function defineApprovalProcess<App extends AppOwner>(opts: DefineApprovalProcessOptions<App>): ApprovalProcessConfigured<App>;
38
+ export declare function approvalProcess<App extends AppOwner>(opts: DefineApprovalProcessOptions<App>): ApprovalProcessConfigured<App>;
39
39
  export {};
@@ -7,18 +7,18 @@ export function unsafeApprovalStageId(value) {
7
7
  return { __unsafe: "approvalStageId", value };
8
8
  }
9
9
  /** Define an app-owned approval process using the provider's dynamic-approver contract. */
10
- export function defineApprovalProcess(opts) {
10
+ export function approvalProcess(opts) {
11
11
  if ("steps" in opts) {
12
- throw new EdkValidationError("defineApprovalProcess static steps are not supported; use the dynamic approver contract.");
12
+ throw new EdkValidationError("approvalProcess static steps are not supported; use the dynamic approver contract.");
13
13
  }
14
14
  if (opts.name.trim() === "")
15
- throw new EdkValidationError("defineApprovalProcess requires a non-empty name.");
15
+ throw new EdkValidationError("approvalProcess requires a non-empty name.");
16
16
  if (!Number.isInteger(opts.numberOfDynamicApprovers) || opts.numberOfDynamicApprovers < 0) {
17
- throw new EdkValidationError("defineApprovalProcess numberOfDynamicApprovers must be an integer >= 0.");
17
+ throw new EdkValidationError("approvalProcess numberOfDynamicApprovers must be an integer >= 0.");
18
18
  }
19
19
  for (const field of opts.lockedFields ?? []) {
20
20
  if (field.parent !== opts.app.refName) {
21
- throw new EdkValidationError(`defineApprovalProcess locked field ${JSON.stringify(field.refName)} belongs to ${JSON.stringify(field.parent)}, not app ${JSON.stringify(opts.app.refName)}.`);
21
+ throw new EdkValidationError(`approvalProcess locked field ${JSON.stringify(field.refName)} belongs to ${JSON.stringify(field.parent)}, not app ${JSON.stringify(opts.app.refName)}.`);
22
22
  }
23
23
  }
24
24
  const payload = slimTokens({
@@ -2,4 +2,4 @@
2
2
  * Approval-process authoring. App-owned; PUT-updatable.
3
3
  * Standalone from v1's `src/approvalChains`.
4
4
  */
5
- export { defineApprovalProcess, unsafeApprovalStageId, type ApprovalProcessConfigured, type DefineApprovalProcessOptions, type UnsafeApprovalStageId, } from "./build.js";
5
+ export { approvalProcess, unsafeApprovalStageId, type ApprovalProcessConfigured, type DefineApprovalProcessOptions, type UnsafeApprovalStageId, } from "./build.js";
@@ -2,4 +2,4 @@
2
2
  * Approval-process authoring. App-owned; PUT-updatable.
3
3
  * Standalone from v1's `src/approvalChains`.
4
4
  */
5
- export { defineApprovalProcess, unsafeApprovalStageId, } from "./build.js";
5
+ export { approvalProcess, unsafeApprovalStageId, } from "./build.js";
@@ -1,6 +1,6 @@
1
1
  const safe = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value) ? value : JSON.stringify(value);
2
2
  export function printApprovalChain(chain, appRefName) {
3
- const imports = ["defineApprovalProcess", ...(chain.stageId !== undefined ? ["unsafeApprovalStageId"] : [])];
3
+ const imports = ["approvalProcess", ...(chain.stageId !== undefined ? ["unsafeApprovalStageId"] : [])];
4
4
  const lines = [`import { ${imports.join(", ")} } from "@elementumai/edk/approvalProcesses";`, `import catalog from "@catalog";`];
5
5
  const props = [
6
6
  `app: catalog.${safe(appRefName)}`,
@@ -16,6 +16,6 @@ export function printApprovalChain(chain, appRefName) {
16
16
  ...(chain.summary !== undefined ? [`summary: ${JSON.stringify(chain.summary)}`] : []),
17
17
  ...(chain.lockedFields.length > 0 ? [`lockedFields: [${[...chain.lockedFields].sort().map((key) => `catalog.${safe(appRefName)}.fields.${safe(key)}`).join(", ")}]`] : []),
18
18
  ];
19
- lines.push(``, `export default defineApprovalProcess({`, ...props.map((prop) => ` ${prop},`), `});`, ``);
19
+ lines.push(``, `export default approvalProcess({`, ...props.map((prop) => ` ${prop},`), `});`, ``);
20
20
  return lines.join("\n");
21
21
  }