@elementumai/edk 0.9.19 → 0.10.1

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 (240) hide show
  1. package/README.md +159 -7
  2. package/dist-sdk/src/catalog/factories.d.ts +33 -2
  3. package/dist-sdk/src/catalog/factories.js +40 -1
  4. package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
  5. package/dist-sdk/src/catalog/from-authoring.js +34 -9
  6. package/dist-sdk/src/catalog/index.d.ts +2 -2
  7. package/dist-sdk/src/catalog/index.js +2 -2
  8. package/dist-sdk/src/catalog/render.js +6 -6
  9. package/dist-sdk/src/catalog/token.js +11 -0
  10. package/dist-sdk/src/catalog/types.d.ts +40 -1
  11. package/dist-sdk/src/catalog/types.js +12 -0
  12. package/dist-sdk/src/core/triggers/on-demand.d.ts +40 -4
  13. package/dist-sdk/src/core/triggers/on-demand.js +17 -2
  14. package/dist-sdk/src/core/types/app.d.ts +2 -2
  15. package/dist-sdk/src/engine/build/context.d.ts +1 -1
  16. package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
  17. package/dist-sdk/src/engine/coverage-gaps.js +156 -0
  18. package/dist-sdk/src/engine/ei/run.d.ts +169 -0
  19. package/dist-sdk/src/engine/ei/run.js +1219 -0
  20. package/dist-sdk/src/engine/logging.d.ts +17 -0
  21. package/dist-sdk/src/engine/logging.js +18 -0
  22. package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
  23. package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
  24. package/dist-sdk/src/engine/pull/context.d.ts +68 -6
  25. package/dist-sdk/src/engine/pull/context.js +40 -1
  26. package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
  27. package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
  28. package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
  29. package/dist-sdk/src/engine/pull/ref-only.js +10 -7
  30. package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
  31. package/dist-sdk/src/engine/pull/result-output.js +113 -3
  32. package/dist-sdk/src/engine/tf/expr.js +1 -1
  33. package/dist-sdk/src/engine/tf/index.d.ts +2 -2
  34. package/dist-sdk/src/engine/tf/index.js +1 -1
  35. package/dist-sdk/src/engine/tf/labels.d.ts +28 -5
  36. package/dist-sdk/src/engine/tf/labels.js +54 -3
  37. package/dist-sdk/src/engine/tf/model.d.ts +22 -1
  38. package/dist-sdk/src/engine/tf/parse.js +93 -4
  39. package/dist-sdk/src/engine/tf/render.d.ts +4 -2
  40. package/dist-sdk/src/engine/tf/render.js +41 -7
  41. package/dist-sdk/src/engine/validation.d.ts +44 -0
  42. package/dist-sdk/src/engine/validation.js +95 -0
  43. package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
  44. package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
  45. package/dist-sdk/src/entities/access-policy/to-tf.js +5 -2
  46. package/dist-sdk/src/entities/agent/build.d.ts +4 -16
  47. package/dist-sdk/src/entities/agent/build.js +40 -5
  48. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
  49. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +46 -21
  50. package/dist-sdk/src/entities/agent/from-tf.js +11 -3
  51. package/dist-sdk/src/entities/agent/module.js +2 -0
  52. package/dist-sdk/src/entities/agent/to-tf.js +20 -6
  53. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +10 -1
  54. package/dist-sdk/src/entities/agent-tool/from-tf.js +18 -6
  55. package/dist-sdk/src/entities/agent-tool/module.js +3 -0
  56. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  57. package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
  58. package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
  59. package/dist-sdk/src/entities/app/auto-share.js +49 -0
  60. package/dist-sdk/src/entities/app/build.d.ts +105 -22
  61. package/dist-sdk/src/entities/app/build.js +107 -10
  62. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
  63. package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
  64. package/dist-sdk/src/entities/app/from-tf.js +11 -2
  65. package/dist-sdk/src/entities/app/index.d.ts +7 -6
  66. package/dist-sdk/src/entities/app/index.js +2 -8
  67. package/dist-sdk/src/entities/app/module.js +5 -2
  68. package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
  69. package/dist-sdk/src/entities/app/to-tf.js +40 -13
  70. package/dist-sdk/src/entities/automation/build.d.ts +56 -6
  71. package/dist-sdk/src/entities/automation/build.js +230 -26
  72. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
  73. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +41 -5
  74. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +470 -58
  75. package/dist-sdk/src/entities/automation/from-tf.d.ts +37 -8
  76. package/dist-sdk/src/entities/automation/from-tf.js +791 -131
  77. package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
  78. package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
  79. package/dist-sdk/src/entities/automation/index.d.ts +2 -2
  80. package/dist-sdk/src/entities/automation/index.js +1 -1
  81. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  82. package/dist-sdk/src/entities/automation/module.js +107 -15
  83. package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
  84. package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
  85. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
  86. package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
  87. package/dist-sdk/src/entities/automation/script-code.d.ts +20 -0
  88. package/dist-sdk/src/entities/automation/script-code.js +109 -5
  89. package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
  90. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +39 -0
  91. package/dist-sdk/src/entities/automation/task-output-labels.js +85 -0
  92. package/dist-sdk/src/entities/automation/tasks.d.ts +116 -22
  93. package/dist-sdk/src/entities/automation/tasks.js +86 -24
  94. package/dist-sdk/src/entities/automation/to-tf.d.ts +24 -3
  95. package/dist-sdk/src/entities/automation/to-tf.js +1082 -132
  96. package/dist-sdk/src/entities/automation/triggers.d.ts +12 -6
  97. package/dist-sdk/src/entities/automation/triggers.js +4 -0
  98. package/dist-sdk/src/entities/automation/types.d.ts +9 -0
  99. package/dist-sdk/src/entities/automation/types.js +19 -0
  100. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
  101. package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
  102. package/dist-sdk/src/entities/chart/from-tf.js +9 -1
  103. package/dist-sdk/src/entities/chart/to-tf.js +10 -3
  104. package/dist-sdk/src/entities/data-lookup/module.js +2 -0
  105. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
  106. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
  107. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
  108. package/dist-sdk/src/entities/element/build.d.ts +28 -13
  109. package/dist-sdk/src/entities/element/build.js +5 -1
  110. package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
  111. package/dist-sdk/src/entities/element/from-tf.js +62 -1
  112. package/dist-sdk/src/entities/element/index.d.ts +5 -3
  113. package/dist-sdk/src/entities/element/index.js +1 -0
  114. package/dist-sdk/src/entities/element/module.js +9 -3
  115. package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
  116. package/dist-sdk/src/entities/element/to-tf.js +16 -16
  117. package/dist-sdk/src/entities/field/build.d.ts +17 -3
  118. package/dist-sdk/src/entities/field/build.js +3 -0
  119. package/dist-sdk/src/entities/field/calc.d.ts +7 -7
  120. package/dist-sdk/src/entities/field/from-tf.d.ts +5 -4
  121. package/dist-sdk/src/entities/field/from-tf.js +244 -49
  122. package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
  123. package/dist-sdk/src/entities/field/media-types.js +30 -0
  124. package/dist-sdk/src/entities/field/module.js +2 -0
  125. package/dist-sdk/src/entities/field/options.js +6 -1
  126. package/dist-sdk/src/entities/field/to-tf.d.ts +26 -5
  127. package/dist-sdk/src/entities/field/to-tf.js +137 -15
  128. package/dist-sdk/src/entities/field/types.d.ts +2 -0
  129. package/dist-sdk/src/entities/field/types.js +27 -0
  130. package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
  131. package/dist-sdk/src/entities/file-reader/module.js +1 -0
  132. package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
  133. package/dist-sdk/src/entities/file-reader/types.js +1 -1
  134. package/dist-sdk/src/entities/portal/build.d.ts +26 -0
  135. package/dist-sdk/src/entities/portal/build.js +37 -0
  136. package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
  137. package/dist-sdk/src/entities/portal/from-tf.js +75 -0
  138. package/dist-sdk/src/entities/portal/index.d.ts +1 -0
  139. package/dist-sdk/src/entities/portal/index.js +1 -0
  140. package/dist-sdk/src/entities/portal/module.d.ts +3 -0
  141. package/dist-sdk/src/entities/portal/module.js +28 -0
  142. package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
  143. package/dist-sdk/src/entities/portal/to-tf.js +73 -0
  144. package/dist-sdk/src/entities/portal/types.d.ts +1 -0
  145. package/dist-sdk/src/entities/portal/types.js +1 -0
  146. package/dist-sdk/src/entities/relationship/module.js +2 -0
  147. package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
  148. package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
  149. package/dist-sdk/src/entities/relationship/to-tf.d.ts +2 -0
  150. package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
  151. package/dist-sdk/src/entities/role/from-tf.js +3 -3
  152. package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
  153. package/dist-sdk/src/entities/role/to-tf.js +12 -4
  154. package/dist-sdk/src/entities/search-table/module.js +1 -0
  155. package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
  156. package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
  157. package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
  158. package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
  159. package/dist-sdk/src/entities/service-account/from-tf.js +20 -8
  160. package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
  161. package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
  162. package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
  163. package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
  164. package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
  165. package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
  166. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
  167. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
  168. package/dist-sdk/src/entities/shared/filters/ast.d.ts +23 -1
  169. package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
  170. package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
  171. package/dist-sdk/src/entities/shared/filters/index.js +19 -4
  172. package/dist-sdk/src/entities/shared/filters/print.js +24 -3
  173. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -0
  174. package/dist-sdk/src/entities/shared/filters/tf-codec.js +46 -7
  175. package/dist-sdk/src/entities/shared/filters/types.d.ts +15 -2
  176. package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
  177. package/dist-sdk/src/entities/shared/ref.js +5 -7
  178. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
  179. package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
  180. package/dist-sdk/src/entities/shared/types/field-types.d.ts +20 -5
  181. package/dist-sdk/src/entities/shared/types/field-types.js +8 -0
  182. package/dist-sdk/src/entities/skill/access-policy.js +3 -3
  183. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
  184. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +14 -6
  185. package/dist-sdk/src/entities/skill/from-tf.js +70 -15
  186. package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
  187. package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
  188. package/dist-sdk/src/entities/skill/module.js +2 -0
  189. package/dist-sdk/src/entities/skill/to-tf.js +14 -4
  190. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
  191. package/dist-sdk/src/entities/skill-tool/from-tf.js +49 -10
  192. package/dist-sdk/src/entities/skill-tool/module.js +3 -0
  193. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -8
  194. package/dist-sdk/src/entities/skill-tool/to-tf.js +49 -14
  195. package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
  196. package/dist-sdk/src/entities/table/catalog.js +66 -0
  197. package/dist-sdk/src/entities/table/module.js +2 -1
  198. package/dist-sdk/src/entities/table/to-tf.js +2 -2
  199. package/dist-sdk/src/entities/task/build.d.ts +8 -0
  200. package/dist-sdk/src/entities/task/build.js +10 -1
  201. package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
  202. package/dist-sdk/src/entities/task/from-tf.js +7 -2
  203. package/dist-sdk/src/entities/task/module.js +2 -2
  204. package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
  205. package/dist-sdk/src/entities/task/to-tf.js +28 -1
  206. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
  207. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
  208. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
  209. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
  210. package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
  211. package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
  212. package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
  213. package/dist-sdk/src/entities/view/from-tf.js +133 -13
  214. package/dist-sdk/src/entities/view/module.js +30 -3
  215. package/dist-sdk/src/entities/view/to-tf.d.ts +20 -8
  216. package/dist-sdk/src/entities/view/to-tf.js +86 -18
  217. package/dist-sdk/src/entities/view/types.d.ts +4 -15
  218. package/dist-sdk/src/entities/view/types.js +15 -15
  219. package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
  220. package/dist-sdk/src/entities/visual-flow/build.js +9 -0
  221. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
  222. package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
  223. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
  224. package/dist-sdk/src/entities/visual-flow/index.js +1 -1
  225. package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
  226. package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
  227. package/dist-sdk/src/entities/widget/build.d.ts +16 -1
  228. package/dist-sdk/src/entities/widget/build.js +11 -1
  229. package/dist-sdk/src/entities/widget/from-tf.js +3 -3
  230. package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
  231. package/dist-sdk/src/entities/widget/to-tf.js +41 -14
  232. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +148 -13
  233. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  234. package/dist-sdk/src/graph/index.d.ts +12 -0
  235. package/dist-sdk/src/graph/index.js +21 -0
  236. package/dist-sdk/src/graph/modules.js +2 -0
  237. package/dist-sdk/src/graph/types.d.ts +83 -4
  238. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  239. package/dist-sdk/src/internal/sdk-package.js +1 -0
  240. package/package.json +16 -3
@@ -0,0 +1,49 @@
1
+ const AUTO_SHARE_KEYS = [
2
+ ["approvals", "approvals"],
3
+ ["groupAssignees", "group_assignees"],
4
+ ["individualAssignees", "individual_assignees"],
5
+ ["mentions", "mentions"],
6
+ ["watchers", "watchers"],
7
+ ];
8
+ /** SDK `autoShare` → provider `auto_share` object (only authored flags). */
9
+ export function autoShareToTf(opts) {
10
+ const out = {};
11
+ for (const [ts, tf] of AUTO_SHARE_KEYS) {
12
+ const v = opts[ts];
13
+ if (v !== undefined)
14
+ out[tf] = v;
15
+ }
16
+ return out;
17
+ }
18
+ /**
19
+ * Provider `auto_share` → SDK `autoShare`. Only enabled flags are kept, and an
20
+ * all-false object yields `undefined` so re-pulls of default aspects print nothing.
21
+ */
22
+ export function autoShareFromTf(value, where, diagnostics) {
23
+ if (value === undefined || value === null)
24
+ return undefined;
25
+ if (typeof value !== "object" || Array.isArray(value) || "$expr" in value) {
26
+ diagnostics.push(`${where}: expected object "auto_share", got ${JSON.stringify(value)}; dropped`);
27
+ return undefined;
28
+ }
29
+ const obj = value;
30
+ const out = {};
31
+ for (const [ts, tf] of AUTO_SHARE_KEYS) {
32
+ const v = obj[tf];
33
+ if (v === true)
34
+ out[ts] = true;
35
+ else if (v !== undefined && v !== false && v !== null) {
36
+ diagnostics.push(`${where}: expected boolean "auto_share.${tf}", got ${JSON.stringify(v)}; dropped`);
37
+ }
38
+ }
39
+ return Object.keys(out).length > 0 ? out : undefined;
40
+ }
41
+ /** Printer line for `autoShare`, e.g. ` autoShare: { watchers: true },`. */
42
+ export function printAutoShare(opts, indent = " ") {
43
+ if (opts === undefined)
44
+ return undefined;
45
+ const parts = AUTO_SHARE_KEYS.filter(([ts]) => opts[ts] !== undefined).map(([ts]) => `${ts}: ${String(opts[ts])}`);
46
+ if (parts.length === 0)
47
+ return undefined;
48
+ return `${indent}autoShare: { ${parts.join(", ")} },`;
49
+ }
@@ -11,8 +11,9 @@
11
11
  * Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
12
12
  * record-experience configuration with build/pull round-trip support.
13
13
  */
14
- import type { AppAgentViewLayout } from "../view/agent-view-layout.js";
15
- import { type AgentRef, type AppOrElementOrTaskRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef, type WidgetRef } from "../../catalog/index.js";
14
+ import type { AppAgentViewLayout, ViewBlocksLayout } from "../view/agent-view-layout.js";
15
+ import type { AutoShareOptions } from "./auto-share.js";
16
+ import { type AgentRef, type AppOrElementOrTaskRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef, type ViewRef, type WidgetRef } from "../../catalog/index.js";
16
17
  import type { WorkflowFieldType } from "../shared/types/field-types.js";
17
18
  import { type SystemFieldKey } from "../../core/system-fields.js";
18
19
  import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
@@ -132,6 +133,17 @@ export interface AppField {
132
133
  readonly numericFormat?: AspectNumericFieldFormat;
133
134
  /** `DECIMAL` only — display/storage precision (`elementum_decimal_field.decimal_places`). */
134
135
  readonly decimalPlaces?: number;
136
+ /**
137
+ * `ATTACHMENT` only — MIME types this field accepts (`application/pdf`,
138
+ * `image/*`, `image/png`). `*` is allowed only as the subtype. Always set
139
+ * this on a new attachment field.
140
+ *
141
+ * Omitting it on a newly created field leaves the live value null, and the
142
+ * platform rejects every upload. An existing field keeps its live value
143
+ * when this is omitted (provider UseStateForNullSet; EDK neither sets nor
144
+ * clears it).
145
+ */
146
+ readonly mediaTypes?: readonly string[];
135
147
  /** QR format (`TEXT` / `HANDLE`) — pure config, no refs. */
136
148
  readonly qrFormat?: AspectFieldQrFormat;
137
149
  /**
@@ -243,6 +255,12 @@ export interface AppSystemFields {
243
255
  export type AppViewFieldRef = FieldRef | SystemFieldKey;
244
256
  /** A typed reference to an app-owned widget for placement in a classic layout group. */
245
257
  export type AppLayoutWidgetRef<Parent extends string = string, RefName extends string = string> = WidgetRef<Parent, RefName>;
258
+ /** Where a classic layout section renders: the main area or the record side panel. */
259
+ export declare const layoutSectionDisplayLocation: {
260
+ readonly center: "CENTER";
261
+ readonly right: "RIGHT";
262
+ };
263
+ export type LayoutSectionDisplayLocation = (typeof layoutSectionDisplayLocation)[keyof typeof layoutSectionDisplayLocation];
246
264
  /**
247
265
  * One section of a per-stage record layout (`elementum_layout`). The
248
266
  * provider's own 9-value `type` enum (default `"group"`): only `"group"`
@@ -253,7 +271,7 @@ export type AppLayoutWidgetRef<Parent extends string = string, RefName extends s
253
271
  */
254
272
  export interface AppLayoutSection {
255
273
  readonly type?: "group" | "activityLog" | "approvals" | "attachments" | "status" | "surveys" | "relatedTasks" | "relationships" | "update";
256
- readonly displayLocation?: "CENTER";
274
+ readonly displayLocation?: LayoutSectionDisplayLocation;
257
275
  readonly displayOrder?: number;
258
276
  readonly sideNavItem?: boolean;
259
277
  /** `"group"` only (required by the provider). */
@@ -315,6 +333,29 @@ export interface AppAgentView extends ManagedViewSharing {
315
333
  */
316
334
  readonly layout?: AppAgentViewLayout;
317
335
  }
336
+ /**
337
+ * A Custom view: a page composed of Elementum Blocks (lists, tables, charts,
338
+ * metrics, text and actions) — the views the admin UI's view builder creates.
339
+ */
340
+ export interface AppCustomView extends ManagedViewSharing {
341
+ readonly name: string;
342
+ /** An agent of this app attached to the view. */
343
+ readonly agent?: AgentRef;
344
+ readonly allowRecordCreation?: boolean;
345
+ /** Provider-native filter object; pulled values round-trip verbatim. */
346
+ readonly filter?: Filter;
347
+ /** Ordered, typed field sorts using the platform's managed-view Sort contract. */
348
+ readonly sort?: ManagedViewSort;
349
+ readonly displayOrder?: number;
350
+ /**
351
+ * The view's blocks: a root element key and the elements it composes.
352
+ * Apps, elements and fields are typed references. The code owns the
353
+ * layout: omitting it leaves the view with no layout, and an apply then
354
+ * removes a live one. Run `elementum pull app` to bring a layout built in
355
+ * the admin UI into code before applying.
356
+ */
357
+ readonly layout?: ViewBlocksLayout;
358
+ }
318
359
  /** A calendar view positioned by a date/datetime field (`elementum_calendar_view`). */
319
360
  export interface AppCalendarView extends ManagedViewSharing {
320
361
  readonly name: string;
@@ -368,7 +409,42 @@ export interface AppRecordCreateFormSection {
368
409
  export interface AppRecordCreateForm {
369
410
  readonly sections: readonly AppRecordCreateFormSection[];
370
411
  }
371
- export interface AppV2Options<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> extends EntityDeployOptions {
412
+ /** An app's managed views, one bag per view type, keyed by view ref name. */
413
+ export interface AppViewBags {
414
+ /** Saved list views, keyed by view ref name. */
415
+ readonly listViews?: Readonly<Record<string, AppListView>>;
416
+ /** Calendar views, keyed by stable view ref name. */
417
+ readonly calendarViews?: Readonly<Record<string, AppCalendarView>>;
418
+ /** Kanban views, keyed by stable view ref name. */
419
+ readonly kanbanViews?: Readonly<Record<string, AppKanbanView>>;
420
+ /** Dashboard-backed views, keyed by stable view ref name. */
421
+ readonly dashboardViews?: Readonly<Record<string, AppDashboardView>>;
422
+ /** Agent-powered views, keyed by view ref name. */
423
+ readonly agentViews?: Readonly<Record<string, AppAgentView>>;
424
+ /** Custom views (pages of Elementum Blocks), keyed by view ref name. */
425
+ readonly customViews?: Readonly<Record<string, AppCustomView>>;
426
+ }
427
+ /** The view bag each authoring property holds (see {@link ViewRef.viewType}). */
428
+ export declare const APP_VIEW_BAGS: {
429
+ readonly listViews: "list";
430
+ readonly calendarViews: "calendar";
431
+ readonly kanbanViews: "kanban";
432
+ readonly dashboardViews: "dashboard";
433
+ readonly agentViews: "agent";
434
+ readonly customViews: "custom";
435
+ };
436
+ type BagKeys<B> = B extends Readonly<Record<infer K, unknown>> ? Extract<K, string> : never;
437
+ /** Every view key an app's view bags declare. */
438
+ export type AppViewKeys<V extends AppViewBags> = {
439
+ [P in keyof AppViewBags]-?: BagKeys<NonNullable<V[P]>>;
440
+ }[keyof AppViewBags];
441
+ /** The `views` bag of an app's ref, keyed exactly like its view bags. */
442
+ export type AppViewRefs<V extends AppViewBags, RefName extends string> = {
443
+ readonly [K in AppViewKeys<V>]: ViewRef<RefName, K>;
444
+ };
445
+ /** App options; `V` carries the view bags so `ref().views` keeps their keys. */
446
+ export type AppV2Options<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, V extends AppViewBags = AppViewBags> = AppV2OptionsBase<F, R> & V;
447
+ interface AppV2OptionsBase<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> extends EntityDeployOptions {
372
448
  readonly name: string;
373
449
  readonly category: AppCategory;
374
450
  readonly namespace?: string;
@@ -396,6 +472,8 @@ export interface AppV2Options<F extends Record<string, AppField> = Record<string
396
472
  readonly commentsEnabled?: boolean;
397
473
  /** Locks the stage selector during record creation so lifecycle automations own initial progression. */
398
474
  readonly lockStages?: boolean;
475
+ /** Automatic record sharing toggles. Omit to leave the platform setting untouched. */
476
+ readonly autoShare?: AutoShareOptions;
399
477
  /** Fields keyed by ref name. At least one required by the compose API. */
400
478
  readonly fields: F;
401
479
  /**
@@ -423,20 +501,10 @@ export interface AppV2Options<F extends Record<string, AppField> = Record<string
423
501
  * `ei export` doesn't surface at all).
424
502
  */
425
503
  readonly layouts?: Readonly<Record<string, AppLayout>>;
426
- /** Saved list views, keyed by view ref name. */
427
- readonly listViews?: Readonly<Record<string, AppListView>>;
428
- /** Calendar views, keyed by stable view ref name. */
429
- readonly calendarViews?: Readonly<Record<string, AppCalendarView>>;
430
- /** Kanban views, keyed by stable view ref name. */
431
- readonly kanbanViews?: Readonly<Record<string, AppKanbanView>>;
432
504
  /** Dashboards owned by this app. */
433
505
  readonly dashboards?: Readonly<Record<string, AppDashboard>>;
434
506
  /** Record-layout widgets keyed by a stable authoring name. */
435
507
  readonly widgets?: Readonly<Record<string, AppWidget>>;
436
- /** Dashboard-backed views, keyed by stable view ref name. */
437
- readonly dashboardViews?: Readonly<Record<string, AppDashboardView>>;
438
- /** Agent-powered views, keyed by view ref name. */
439
- readonly agentViews?: Readonly<Record<string, AppAgentView>>;
440
508
  /** Typed new-record form, distinct from legacy compose-only `recordCreateDisplayBlocks`. */
441
509
  readonly recordCreateForm?: AppRecordCreateForm;
442
510
  /** Typed V2 DASHBOARD layouts, keyed by stable EDK ref name. */
@@ -558,17 +626,18 @@ export type SystemFieldRefs<Parent extends string = string> = {
558
626
  * the same reason — `Record<string, never>` would reintroduce it even when
559
627
  * no `readonlyFields` are declared.
560
628
  */
561
- export type AppRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string> = Extract<AppOrElementRef<RefName>, {
629
+ export type AppRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string, V extends AppViewBags = AppViewBags> = Extract<AppOrElementRef<RefName>, {
562
630
  readonly __kind: "app";
563
631
  }> & {
564
632
  readonly fields: AppFieldRefs<F, RefName> & SystemFieldRefs<RefName> & R;
633
+ readonly views: AppViewRefs<V, RefName>;
565
634
  };
566
635
  /**
567
636
  * The app reference available while configuring options that point back into
568
637
  * the app itself. Child helpers preserve both the literal child key and owner,
569
638
  * without forcing the app file to import its generated catalog (a cycle).
570
639
  */
571
- export type AppSelfRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string> = AppRef<F, R, RefName> & {
640
+ export type AppSelfRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string, V extends AppViewBags = AppViewBags> = AppRef<F, R, RefName, V> & {
572
641
  agent<const Name extends string>(refName: Name, name?: string): CatalogRef<"agent", Name, RefName>;
573
642
  automation<const Name extends string>(refName: Name, name?: string): AutomationCatalogRef & CatalogRef<"automation", Name, RefName>;
574
643
  chart<const Name extends string>(refName: Name, name?: string): ChartRef<RefName, Name>;
@@ -576,7 +645,9 @@ export type AppSelfRef<F extends Record<string, AppField> = Record<string, AppFi
576
645
  widget<const Name extends string>(refName: Name, name?: string): AppLayoutWidgetRef<RefName, Name>;
577
646
  };
578
647
  /** Reference-bearing app options that can safely be authored from `withRefs`. */
579
- export type AppReferenceConfiguration = Pick<AppV2Options, "layouts" | "listViews" | "calendarViews" | "kanbanViews" | "dashboards" | "widgets" | "dashboardViews" | "agentViews" | "recordCreateForm" | "dynamicLayouts" | "relationships" | "viewOrder" | "accessPolicies">;
648
+ export type AppReferenceConfiguration = Pick<AppV2Options, "layouts" | "listViews" | "calendarViews" | "kanbanViews" | "dashboards" | "widgets" | "dashboardViews" | "agentViews" | "customViews" | "recordCreateForm" | "dynamicLayouts" | "relationships" | "viewOrder" | "accessPolicies">;
649
+ /** The view bags a `withRefs` configuration declares, so `ref().views` keeps their keys. */
650
+ type AppReferencedViewBags<W extends AppReferenceConfiguration> = Pick<W, Extract<keyof W, keyof AppViewBags>>;
580
651
  /**
581
652
  * The configured result of `app` — its reference surface (`ref()`) and
582
653
  * its deployable entity (`def()`). Both take `refName` as a **call-time
@@ -587,11 +658,14 @@ export type AppReferenceConfiguration = Pick<AppV2Options, "layouts" | "listView
587
658
  * inside `app({...})` would be the same redundant property the rest of
588
659
  * the system avoids, just one level up.
589
660
  */
590
- export interface AppConfigured<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> {
591
- ref<const RefName extends string>(refName: RefName): AppRef<F, R, RefName>;
661
+ export interface AppConfigured<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, V extends AppViewBags = AppViewBags> {
662
+ ref<const RefName extends string>(refName: RefName): AppRef<F, R, RefName, V>;
592
663
  def(refName: string): DeployableEntity;
593
- /** Configure self-referential record experiences without hand-building ref tokens. */
594
- withRefs(configure: (app: AppSelfRef<F, R>) => AppReferenceConfiguration): AppConfigured<F, R>;
664
+ /**
665
+ * Configure self-referential record experiences without hand-building ref
666
+ * tokens. Bags returned here add to the same bags in `app({...})`.
667
+ */
668
+ withRefs<const W extends AppReferenceConfiguration>(configure: (app: AppSelfRef<F, R, string, V>) => W): AppConfigured<F, R, V & AppReferencedViewBags<W>>;
595
669
  }
596
670
  /**
597
671
  * Build a v2 app entity: org-owned, compose-body payload. Exposes
@@ -610,4 +684,13 @@ export interface AppConfigured<F extends Record<string, AppField> = Record<strin
610
684
  */
611
685
  export declare const APP_HANDLE_RE: RegExp;
612
686
  export declare function picklistOptionLabels(options: readonly (string | PicklistOption)[]): readonly string[];
613
- export declare function app<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>>(opts: AppV2Options<F, R>): AppConfigured<F, R>;
687
+ /**
688
+ * One `ViewRef` per authored view, keyed by its bag key and stamped with the
689
+ * owner's identity, so other stream roots (a portal's menu) can reference it.
690
+ */
691
+ export declare function appViewRefs(bags: AppViewBags, owner: {
692
+ readonly refName: string;
693
+ readonly name: string;
694
+ readonly namespace?: string;
695
+ }, parentKind: "app" | "element"): Record<string, ViewRef>;
696
+ export declare function app<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, const V extends AppViewBags = AppViewBags>(opts: AppV2Options<F, R, V>): AppConfigured<F, R, V>;
@@ -1,8 +1,23 @@
1
- import { slimTokens } from "../../catalog/index.js";
1
+ import { slimTokens, viewType } from "../../catalog/index.js";
2
2
  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";
3
3
  import { serializeDisplayBlocks } from "./display-blocks.js";
4
4
  import { assertCalculatedFieldRoot } from "../field/calc/runtime.js";
5
+ import { assertAttachmentMediaTypes } from "../field/media-types.js";
6
+ /** Where a classic layout section renders: the main area or the record side panel. */
7
+ export const layoutSectionDisplayLocation = {
8
+ center: "CENTER",
9
+ right: "RIGHT",
10
+ };
5
11
  export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
12
+ /** The view bag each authoring property holds (see {@link ViewRef.viewType}). */
13
+ export const APP_VIEW_BAGS = {
14
+ listViews: viewType.list,
15
+ calendarViews: viewType.calendar,
16
+ kanbanViews: viewType.kanban,
17
+ dashboardViews: viewType.dashboard,
18
+ agentViews: viewType.agent,
19
+ customViews: viewType.custom,
20
+ };
6
21
  /**
7
22
  * Map a platform field type to the `AspectFieldInput` variant key. "relation"
8
23
  * is a terraform-only synthetic key (no `elementum-entity-client` REST
@@ -172,6 +187,11 @@ export function serializeField(field, refName) {
172
187
  if (key === "decimal" && field.decimalPlaces !== undefined) {
173
188
  base.decimalPlaces = field.decimalPlaces;
174
189
  }
190
+ if ((field.type === "ATTACHMENT" || field.type === "ATTACHMENT_ID") && field.mediaTypes !== undefined) {
191
+ assertAttachmentMediaTypes(field.name, field.mediaTypes);
192
+ if (field.mediaTypes.length > 0)
193
+ base.mediaTypes = [...field.mediaTypes];
194
+ }
175
195
  if ((key === "text" || key === "html") && field.qrFormat !== undefined) {
176
196
  base.format = field.qrFormat;
177
197
  }
@@ -214,11 +234,17 @@ export function serializeSystemFields(overrides) {
214
234
  const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
215
235
  const override = overrides[key];
216
236
  const name = override.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key];
217
- const flags = {
218
- required: override.required ?? SYSTEM_FIELD_REQUIRED[key],
219
- requiredOnClose: override.requiredOnClose ?? false,
220
- showOnCreate: override.showOnCreate ?? false,
221
- };
237
+ // Validation flags travel only when authored: a system field named or
238
+ // given options alone leaves its flags to the platform. Unset flags of an
239
+ // authored set take the platform's own defaults.
240
+ const authoredFlags = override.required !== undefined || override.requiredOnClose !== undefined || override.showOnCreate !== undefined;
241
+ const flags = authoredFlags
242
+ ? {
243
+ required: override.required ?? SYSTEM_FIELD_REQUIRED[key],
244
+ requiredOnClose: override.requiredOnClose ?? false,
245
+ showOnCreate: override.showOnCreate ?? false,
246
+ }
247
+ : {};
222
248
  if (key === "stage") {
223
249
  // Constructed directly, not via serializeField: the REST compose API
224
250
  // rejects stage picklistValues (stage mutations have dedicated
@@ -246,6 +272,46 @@ export function serializeSystemFields(overrides) {
246
272
  return serializeField(field, key);
247
273
  });
248
274
  }
275
+ /**
276
+ * The keyed bags `withRefs` can add to. Each merges with the same bag in
277
+ * `app({...})` rather than replacing it; a key declared in both places fails.
278
+ */
279
+ const KEYED_REFERENCE_BAGS = [
280
+ "layouts",
281
+ "listViews",
282
+ "calendarViews",
283
+ "kanbanViews",
284
+ "dashboards",
285
+ "widgets",
286
+ "dashboardViews",
287
+ "agentViews",
288
+ "customViews",
289
+ "dynamicLayouts",
290
+ "relationships",
291
+ ];
292
+ function mergeReferenceConfiguration(appName, base, referenced) {
293
+ const merged = { ...base, ...referenced };
294
+ // These are a single value or an array, not a key bag. A second declaration
295
+ // would replace the first; arrays cannot merge by key without becoming objects.
296
+ for (const key of ["recordCreateForm", "viewOrder", "accessPolicies"]) {
297
+ if (base[key] !== undefined && referenced[key] !== undefined) {
298
+ throw new Error(`app "${appName}": ${key} is declared both in app({...}) and in withRefs(...) (or in two withRefs calls). Declare it once.`);
299
+ }
300
+ }
301
+ for (const bag of KEYED_REFERENCE_BAGS) {
302
+ const declared = base[bag];
303
+ const added = referenced[bag];
304
+ if (declared === undefined || added === undefined)
305
+ continue;
306
+ for (const key of Object.keys(added)) {
307
+ if (Object.hasOwn(declared, key)) {
308
+ throw new Error(`app "${appName}": ${bag}.${key} is declared both in app({...}) and in withRefs(...) (or in two withRefs calls). Declare it once.`);
309
+ }
310
+ }
311
+ merged[bag] = { ...declared, ...added };
312
+ }
313
+ return merged;
314
+ }
249
315
  /**
250
316
  * Build a v2 app entity: org-owned, compose-body payload. Exposes
251
317
  * `.ref(refName)` and `.def(refName)`.
@@ -285,6 +351,28 @@ function validateAppOptions(opts) {
285
351
  export function picklistOptionLabels(options) {
286
352
  return options.map((option) => typeof option === "string" ? option : option.label);
287
353
  }
354
+ /**
355
+ * One `ViewRef` per authored view, keyed by its bag key and stamped with the
356
+ * owner's identity, so other stream roots (a portal's menu) can reference it.
357
+ */
358
+ export function appViewRefs(bags, owner, parentKind) {
359
+ const out = {};
360
+ for (const [bag, type] of Object.entries(APP_VIEW_BAGS)) {
361
+ for (const [key, view] of Object.entries(bags[bag] ?? {})) {
362
+ out[key] = {
363
+ __kind: "view",
364
+ refName: key,
365
+ name: view.name,
366
+ parent: owner.refName,
367
+ viewType: type,
368
+ parentKind,
369
+ parentName: owner.name,
370
+ ...(owner.namespace !== undefined ? { parentNamespace: owner.namespace } : {}),
371
+ };
372
+ }
373
+ }
374
+ return out;
375
+ }
288
376
  export function app(opts) {
289
377
  validateAppOptions(opts);
290
378
  const fieldEntries = Object.values(opts.fields);
@@ -347,6 +435,7 @@ export function app(opts) {
347
435
  name: opts.name,
348
436
  ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),
349
437
  fields,
438
+ views: appViewRefs(opts, { refName, name: opts.name, ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}) }, kind),
350
439
  agent(childRefName, name = childRefName) {
351
440
  return { __kind: "agent", refName: childRefName, name, parent: refName };
352
441
  },
@@ -366,14 +455,20 @@ export function app(opts) {
366
455
  return self;
367
456
  }
368
457
  function withReferenceConfiguration(configure) {
458
+ const resolve = (refName) => app(mergeReferenceConfiguration(opts.name, opts, configure(makeRef(refName))));
369
459
  return {
370
- ref: configured.ref,
460
+ ref(refName) {
461
+ return resolve(refName).ref(refName);
462
+ },
371
463
  def(refName) {
372
- const referenced = configure(makeRef(refName));
373
- return app({ ...opts, ...referenced }).def(refName);
464
+ return resolve(refName).def(refName);
374
465
  },
375
466
  withRefs(next) {
376
- return withReferenceConfiguration((app) => ({ ...configure(app), ...next(app) }));
467
+ return withReferenceConfiguration((self) => {
468
+ const earlier = configure(self);
469
+ const layered = app(mergeReferenceConfiguration(opts.name, opts, earlier)).ref(self.refName);
470
+ return mergeReferenceConfiguration(opts.name, earlier, next(layered));
471
+ });
377
472
  },
378
473
  };
379
474
  }
@@ -410,6 +505,7 @@ export function app(opts) {
410
505
  ...(opts.cloudOptions !== undefined ? { cloudOptions: opts.cloudOptions } : {}),
411
506
  ...(opts.commentsEnabled !== undefined ? { commentsEnabled: opts.commentsEnabled } : {}),
412
507
  ...(opts.lockStages !== undefined ? { lockStages: opts.lockStages } : {}),
508
+ ...(opts.autoShare !== undefined ? { autoShare: opts.autoShare } : {}),
413
509
  fields: [
414
510
  ...serializeSystemFields(opts.systemFields),
415
511
  ...Object.entries(opts.fields).map(([bagKey, field]) => serializeField(field, bagKey)),
@@ -424,6 +520,7 @@ export function app(opts) {
424
520
  ...(opts.widgets !== undefined ? { widgets: opts.widgets } : {}),
425
521
  ...(opts.dashboardViews !== undefined ? { dashboardViews: opts.dashboardViews } : {}),
426
522
  ...(opts.agentViews !== undefined ? { agentViews: opts.agentViews } : {}),
523
+ ...(opts.customViews !== undefined ? { customViews: opts.customViews } : {}),
427
524
  ...(opts.recordCreateForm !== undefined ? { recordCreateForm: opts.recordCreateForm } : {}),
428
525
  ...(opts.dynamicLayouts !== undefined ? { dynamicLayouts: opts.dynamicLayouts } : {}),
429
526
  ...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
@@ -10,6 +10,7 @@
10
10
  * HCL streams instead (see `appFromTf`).
11
11
  */
12
12
  import type { NormalizedAgentViewLayout } from "../../view/agent-view-layout-from-tf.js";
13
+ import type { AutoShareOptions } from "../auto-share.js";
13
14
  import type { AppCategory, AppField, AppStage, AspectType } from "../../../core/types/app.js";
14
15
  import type { DisplayBlock } from "../../../core/types/display-block.js";
15
16
  import type { NormalizedAccessPolicy } from "../../access-policy/from-tf.js";
@@ -122,6 +123,8 @@ export interface NormalizedLayoutSection {
122
123
  readonly maxColumns?: number;
123
124
  readonly fields?: readonly string[];
124
125
  readonly widgets?: readonly string[];
126
+ /** Widget bag key → index in the section's field list. Omitted when the widget is appended. */
127
+ readonly widgetAts?: Readonly<Record<string, number>>;
125
128
  /** `group` only — the app-owned agent embedded in the section, by bag key. */
126
129
  readonly agentKey?: string;
127
130
  }
@@ -153,6 +156,19 @@ export interface NormalizedAgentView extends ManagedViewSharing {
153
156
  readonly displayOrder?: number;
154
157
  readonly layout?: NormalizedAgentViewLayout;
155
158
  }
159
+ /** A Custom view (`elementum_custom_view`): a page of Elementum Blocks. */
160
+ export interface NormalizedCustomView extends ManagedViewSharing {
161
+ readonly key: string;
162
+ readonly name: string;
163
+ /** Own agent bag key, when the view has an agent. */
164
+ readonly agentKey?: string;
165
+ readonly allowRecordCreation?: boolean;
166
+ readonly filter?: Filter<RefExpr, RefExpr>;
167
+ readonly sort?: NormalizedManagedViewSort;
168
+ readonly displayOrder?: number;
169
+ /** Plain JSON with `AgentViewSpecMarker` objects at reference positions. */
170
+ readonly layout?: unknown;
171
+ }
156
172
  /** A calendar view (`elementum_calendar_view`). */
157
173
  export interface NormalizedCalendarView extends ManagedViewSharing {
158
174
  readonly key: string;
@@ -238,7 +254,7 @@ export type NormalizedWidget = {
238
254
  readonly type: "runAutomation";
239
255
  readonly name: string;
240
256
  readonly automation: NormalizedWidgetRef | string;
241
- readonly parameters?: readonly {
257
+ readonly parameters: readonly {
242
258
  readonly name: string;
243
259
  readonly fieldType: string;
244
260
  readonly multiple: boolean;
@@ -340,7 +356,11 @@ export interface NormalizedApp {
340
356
  readonly cloudLinkId?: string;
341
357
  readonly cloudLinkClientHandle?: string;
342
358
  readonly commentsEnabled?: boolean;
359
+ /** Element only: the platform gave it audit fields (created/updated at/by). */
360
+ readonly auditFields?: boolean;
343
361
  readonly lockStages?: boolean;
362
+ /** Automatic record sharing (#1596); only enabled flags. */
363
+ readonly autoShare?: AutoShareOptions;
344
364
  readonly cloudOptions?: {
345
365
  readonly snowflake?: {
346
366
  readonly hybridTable?: boolean;
@@ -364,6 +384,7 @@ export interface NormalizedApp {
364
384
  readonly widgets?: readonly NormalizedWidget[];
365
385
  /** Agent-powered record views (`elementum_agent_view`). */
366
386
  readonly agentViews?: readonly NormalizedAgentView[];
387
+ readonly customViews?: readonly NormalizedCustomView[];
367
388
  /** New-record form (`elementum_record_create_form`). */
368
389
  readonly recordCreateForm?: NormalizedRecordCreateForm;
369
390
  readonly dynamicLayouts?: readonly NormalizedDynamicLayout[];
@@ -22,6 +22,7 @@ export interface AppFromTfViewBlocks {
22
22
  readonly kanbanViewBlocks: readonly TfBlock[];
23
23
  readonly dashboardViewBlocks: readonly TfBlock[];
24
24
  readonly agentViewBlocks: readonly TfBlock[];
25
+ readonly customViewBlocks?: readonly TfBlock[];
25
26
  readonly managedViewOrderBlocks: readonly TfBlock[];
26
27
  readonly recordCreateFormBlocks: readonly TfBlock[];
27
28
  readonly dynamicLayoutBlocks: readonly TfBlock[];
@@ -7,6 +7,7 @@
7
7
  * identically for both pull paths. Platform ids come only from the stream's
8
8
  * import blocks and stay data-side — they never reach printed source.
9
9
  */
10
+ import { autoShareFromTf } from "./auto-share.js";
10
11
  import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS, SYSTEM_FIELD_KEY_BY_HCL_KEY, SYSTEM_FIELD_TAG_BY_KEY, } from "../../core/system-fields.js";
11
12
  import { EntityTfError } from "../../engine/entity.js";
12
13
  import { dataRefLabel, optionalString, plainObject } from "../../engine/pull/context.js";
@@ -43,6 +44,7 @@ const KNOWN_APP_ATTRS = new Set([
43
44
  "status_field_description",
44
45
  "comments_enabled",
45
46
  "lock_stages",
47
+ "auto_share",
46
48
  "system_field_config",
47
49
  ]);
48
50
  const SYSTEM_FIELD_TYPE_BY_KEY = {
@@ -110,6 +112,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
110
112
  const statusFieldDescription = optionalString(attrs, "status_field_description", `app "${label}"`, ctx);
111
113
  const commentsEnabled = typeof attrs["comments_enabled"] === "boolean" ? attrs["comments_enabled"] : undefined;
112
114
  const lockStages = typeof attrs["lock_stages"] === "boolean" ? attrs["lock_stages"] : undefined;
115
+ const autoShare = autoShareFromTf(attrs["auto_share"], `app "${label}"`, ctx.diagnostics);
113
116
  // --- Org data references (category / cloud link).
114
117
  let category;
115
118
  if (attrs["category_id"] !== undefined) {
@@ -213,7 +216,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
213
216
  }
214
217
  // --- View pass: layouts / list views / view order (entities/view), owner passed in.
215
218
  const dashboards = dashboardsFromTf(viewBlocks.dashboardBlocks, viewBlocks.dashboardWidgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerTfLabel: refName, ownerRefName: refName, scope: "app", ownerType: "APP_ASPECT" }, ctx);
216
- const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, viewBlocks.agentViewBlocks, viewBlocks.managedViewOrderBlocks, { type: APP_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "app", stageKeys: new Set(stages.map((stage) => stage.key)) }, ctx);
219
+ const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, customViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, viewBlocks.agentViewBlocks, viewBlocks.managedViewOrderBlocks, { type: APP_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "app", stageKeys: new Set(stages.map((stage) => stage.key)) }, ctx, viewBlocks.customViewBlocks);
217
220
  if (viewBlocks.recordCreateFormBlocks.length > 1) {
218
221
  ctx.diagnostics.push(`app "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
219
222
  }
@@ -237,7 +240,11 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
237
240
  accessPolicies.push(entry);
238
241
  }
239
242
  const roles = rolesFromTf(roleBlocks, accessPolicyOwner, ctx);
240
- const serviceAccounts = serviceAccountsFromTf([...serviceAccountBlocks, ...roleBlocks], { label, ownerTfLabel: label }, ctx);
243
+ const serviceAccounts = serviceAccountsFromTf([...serviceAccountBlocks, ...roleBlocks], {
244
+ label,
245
+ ownerTfLabel: label,
246
+ sourceFile: `apps/${refName}/${refName}.ts`,
247
+ }, ctx);
241
248
  const app = {
242
249
  id: appId ?? "",
243
250
  name,
@@ -254,6 +261,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
254
261
  ...(cloudLinkId !== undefined && { cloudLinkId }),
255
262
  ...(commentsEnabled !== undefined && { commentsEnabled }),
256
263
  ...(lockStages !== undefined && { lockStages }),
264
+ ...(autoShare !== undefined && { autoShare }),
257
265
  ...(layouts.length > 0 && { layouts }),
258
266
  ...(listViews.length > 0 && { listViews }),
259
267
  ...(calendarViews.length > 0 && { calendarViews }),
@@ -262,6 +270,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
262
270
  ...(dashboards.length > 0 && { dashboards }),
263
271
  ...(widgets.length > 0 && { widgets }),
264
272
  ...(agentViews.length > 0 && { agentViews }),
273
+ ...(customViews.length > 0 && { customViews }),
265
274
  ...(recordCreateForm !== undefined && { recordCreateForm }),
266
275
  ...(dynamicLayouts.length > 0 && { dynamicLayouts }),
267
276
  ...(relationships.length > 0 && { relationships }),
@@ -5,14 +5,15 @@
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 { 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, } from "./build.js";
8
+ export type { AutoShareOptions } from "./auto-share.js";
9
+ export { app, type AppAgentView, type AppCustomView, 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, layoutSectionDisplayLocation, type LayoutSectionDisplayLocation, } from "./build.js";
9
10
  export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, type ListViewDensity, type ManagedViewSort, type ManagedViewSortAggregation, type ManagedViewSortDirection, type ManagedViewSortField, type ManagedViewSortOrder, } from "../view/build.js";
10
- export { type AppWidget, type CreateRecordWidget, type LinkRecordsWidget, type RelatedRecordsWidget, type RunAutomationWidget, type RunAutomationWidgetParameter, type WidgetButtonStyle, type WidgetButtonType, } from "../widget/build.js";
11
+ export { runAutomationParameterValue, type AppWidget, type CreateRecordWidget, type LinkRecordsWidget, type RelatedRecordsWidget, type RunAutomationParameterValue, type RunAutomationWidget, type RunAutomationWidgetParameter, type WidgetButtonStyle, type WidgetButtonType, } from "../widget/build.js";
11
12
  export { type DisplayBlock } from "./display-blocks.js";
12
13
  export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
13
14
  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, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type DropdownConfig, type DropdownDisplay, type DropdownFieldOptions, type DropdownOption, type DropdownParentValueRef, type DynamicDropdownConfig, type DynamicDropdownParent, type DynamicDropdownParentMapping, type MultiSelectFieldOptions, type NumericFieldOptions, type NumericFieldFormat, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, type QrFieldFormat, } from "../field/build.js";
15
+ export { type AppDynamicLayout, type DynamicLayoutBlockCommon, 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";
16
+ export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, type AttachmentFieldOptions, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type DropdownConfig, type DropdownDisplay, type DropdownFieldOptions, type DropdownOption, type DropdownParentValueRef, type DynamicDropdownConfig, type DynamicDropdownParent, type DynamicDropdownParentMapping, type MultiSelectFieldOptions, type NumericFieldOptions, type NumericFieldFormat, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, type QrFieldFormat, } from "../field/build.js";
16
17
  export { asc, desc, sortBy, type SortDirection, type SortOrder } from "../shared/types/common.js";
17
18
  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";
18
19
  export { agentEvaluation, type AgentEvaluationConfigured, type AgentEvaluationOptions, } from "../agent-evaluation/index.js";
@@ -21,9 +22,9 @@ export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
21
22
  export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
22
23
  export { type ManagedViewSharing } from "../view/sharing.js";
23
24
  export { type ElementumBlocksElement, type ElementumBlocksSpec } from "../view/ragnarok.js";
24
- export { agentViewFontFamily, type AgentViewBlock, type AgentViewBranding, type AgentViewCustomView, type AgentViewFontFamily, type AgentViewHexColor, type AgentViewImage, type AgentViewSpecApp, type AgentViewSpecField, type AgentViewSpecFilterRef, type AppAgentViewLayout, } from "../view/agent-view-layout.js";
25
+ export { agentViewFontFamily, type AgentViewBlock, type AgentViewBranding, type AgentViewCustomView, type AgentViewFontFamily, type AgentViewHexColor, type AgentViewImage, type AgentViewSpecApp, type AgentViewSpecField, type AgentViewSpecFilterRef, type AppAgentViewLayout, type ViewBlock, type ViewBlocksField, type ViewBlocksFilterRef, type ViewBlocksLayout, type ViewBlocksSource, } from "../view/agent-view-layout.js";
25
26
  export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef, type AppRole, type RoleAutoShare, type RoleGroupRef, type RolePermission, type RolePermissionGroup, type RolePermissionLevel, type RoleUserRef } from "../role/build.js";
26
- export { serviceAccountRoleRef, serviceAccountStatus, type AppServiceAccount, type ServiceAccountAccessPolicy, type ServiceAccountRoleRef, type ServiceAccountStatus } from "../service-account/build.js";
27
+ export { serviceAccountRoleRef, serviceAccountStatus, type AppServiceAccount, type ServiceAccountAccessPolicy, type ServiceAccountRole, type ServiceAccountRoleRef, type ServiceAccountStatus } from "../service-account/build.js";
27
28
  export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
28
29
  export * as filter from "../shared/filters/index.js";
29
30
  export { type Filter } from "../shared/filters/index.js";
@@ -1,12 +1,6 @@
1
- /**
2
- * v2 app authoring — `app`. Org-owned; deploys via the wire client's
3
- * compose path. Standalone from v1's `src/aspects`. Elements author through
4
- * the sibling `@elementumai/edk/elements` module (`element`) — see
5
- * `src/elements/build.ts`'s header for why apps and elements split into
6
- * dedicated builders despite sharing this module's field/print internals.
7
- */
8
- export { app, } from "./build.js";
1
+ export { app, layoutSectionDisplayLocation, } from "./build.js";
9
2
  export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, } from "../view/build.js";
3
+ export { runAutomationParameterValue, } from "../widget/build.js";
10
4
  export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
11
5
  export { dynamicLayout, } from "../dynamic-layout/build.js";
12
6
  export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, } from "../field/build.js";