@elementumai/edk 0.9.19 → 0.9.20

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 (176) hide show
  1. package/README.md +146 -6
  2. package/dist-sdk/src/catalog/factories.d.ts +24 -1
  3. package/dist-sdk/src/catalog/factories.js +30 -0
  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 +7 -0
  10. package/dist-sdk/src/catalog/types.d.ts +34 -1
  11. package/dist-sdk/src/catalog/types.js +11 -0
  12. package/dist-sdk/src/core/triggers/on-demand.d.ts +39 -3
  13. package/dist-sdk/src/core/triggers/on-demand.js +10 -2
  14. package/dist-sdk/src/engine/build/context.d.ts +1 -1
  15. package/dist-sdk/src/engine/ei/run.d.ts +149 -0
  16. package/dist-sdk/src/engine/ei/run.js +1132 -0
  17. package/dist-sdk/src/engine/logging.d.ts +17 -0
  18. package/dist-sdk/src/engine/logging.js +18 -0
  19. package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
  20. package/dist-sdk/src/engine/pull/ref-only.js +10 -7
  21. package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
  22. package/dist-sdk/src/engine/pull/result-output.js +87 -3
  23. package/dist-sdk/src/engine/tf/expr.js +1 -1
  24. package/dist-sdk/src/engine/tf/index.d.ts +2 -2
  25. package/dist-sdk/src/engine/tf/index.js +1 -1
  26. package/dist-sdk/src/engine/tf/labels.d.ts +6 -0
  27. package/dist-sdk/src/engine/tf/labels.js +9 -0
  28. package/dist-sdk/src/engine/tf/model.d.ts +22 -1
  29. package/dist-sdk/src/engine/tf/parse.js +92 -4
  30. package/dist-sdk/src/engine/tf/render.d.ts +4 -2
  31. package/dist-sdk/src/engine/tf/render.js +41 -7
  32. package/dist-sdk/src/engine/validation.d.ts +39 -0
  33. package/dist-sdk/src/engine/validation.js +85 -0
  34. package/dist-sdk/src/entities/access-policy/to-tf.js +5 -2
  35. package/dist-sdk/src/entities/agent/build.d.ts +4 -16
  36. package/dist-sdk/src/entities/agent/build.js +40 -5
  37. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +4 -2
  38. package/dist-sdk/src/entities/agent/to-tf.js +6 -3
  39. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
  40. package/dist-sdk/src/entities/agent-tool/from-tf.js +7 -1
  41. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  42. package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
  43. package/dist-sdk/src/entities/app/build.d.ts +89 -20
  44. package/dist-sdk/src/entities/app/build.js +51 -6
  45. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +16 -0
  46. package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
  47. package/dist-sdk/src/entities/app/from-tf.js +7 -2
  48. package/dist-sdk/src/entities/app/index.d.ts +6 -6
  49. package/dist-sdk/src/entities/app/index.js +1 -0
  50. package/dist-sdk/src/entities/app/module.js +5 -2
  51. package/dist-sdk/src/entities/app/to-tf.js +19 -11
  52. package/dist-sdk/src/entities/automation/build.d.ts +47 -5
  53. package/dist-sdk/src/entities/automation/build.js +137 -20
  54. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
  55. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +314 -39
  56. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
  57. package/dist-sdk/src/entities/automation/from-tf.js +428 -48
  58. package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
  59. package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
  60. package/dist-sdk/src/entities/automation/index.d.ts +2 -2
  61. package/dist-sdk/src/entities/automation/index.js +1 -1
  62. package/dist-sdk/src/entities/automation/module.js +37 -8
  63. package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
  64. package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
  65. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
  66. package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
  67. package/dist-sdk/src/entities/automation/script-code.d.ts +17 -0
  68. package/dist-sdk/src/entities/automation/script-code.js +91 -5
  69. package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
  70. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +2 -0
  71. package/dist-sdk/src/entities/automation/task-output-labels.js +9 -0
  72. package/dist-sdk/src/entities/automation/tasks.d.ts +24 -2
  73. package/dist-sdk/src/entities/automation/tasks.js +38 -9
  74. package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
  75. package/dist-sdk/src/entities/automation/to-tf.js +489 -83
  76. package/dist-sdk/src/entities/automation/triggers.d.ts +4 -2
  77. package/dist-sdk/src/entities/automation/triggers.js +4 -0
  78. package/dist-sdk/src/entities/chart/to-tf.js +10 -3
  79. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
  80. package/dist-sdk/src/entities/element/build.d.ts +25 -13
  81. package/dist-sdk/src/entities/element/build.js +4 -1
  82. package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
  83. package/dist-sdk/src/entities/element/from-tf.js +58 -1
  84. package/dist-sdk/src/entities/element/index.d.ts +5 -3
  85. package/dist-sdk/src/entities/element/index.js +1 -0
  86. package/dist-sdk/src/entities/element/module.js +9 -3
  87. package/dist-sdk/src/entities/element/to-tf.js +8 -2
  88. package/dist-sdk/src/entities/field/build.d.ts +14 -1
  89. package/dist-sdk/src/entities/field/build.js +3 -0
  90. package/dist-sdk/src/entities/field/from-tf.d.ts +1 -0
  91. package/dist-sdk/src/entities/field/from-tf.js +39 -1
  92. package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
  93. package/dist-sdk/src/entities/field/media-types.js +30 -0
  94. package/dist-sdk/src/entities/field/module.js +1 -0
  95. package/dist-sdk/src/entities/field/to-tf.d.ts +23 -2
  96. package/dist-sdk/src/entities/field/to-tf.js +130 -14
  97. package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
  98. package/dist-sdk/src/entities/file-reader/module.js +1 -0
  99. package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
  100. package/dist-sdk/src/entities/file-reader/types.js +1 -1
  101. package/dist-sdk/src/entities/portal/build.d.ts +26 -0
  102. package/dist-sdk/src/entities/portal/build.js +37 -0
  103. package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
  104. package/dist-sdk/src/entities/portal/from-tf.js +75 -0
  105. package/dist-sdk/src/entities/portal/index.d.ts +1 -0
  106. package/dist-sdk/src/entities/portal/index.js +1 -0
  107. package/dist-sdk/src/entities/portal/module.d.ts +3 -0
  108. package/dist-sdk/src/entities/portal/module.js +28 -0
  109. package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
  110. package/dist-sdk/src/entities/portal/to-tf.js +73 -0
  111. package/dist-sdk/src/entities/portal/types.d.ts +1 -0
  112. package/dist-sdk/src/entities/portal/types.js +1 -0
  113. package/dist-sdk/src/entities/relationship/module.js +2 -0
  114. package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
  115. package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
  116. package/dist-sdk/src/entities/relationship/to-tf.d.ts +2 -0
  117. package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
  118. package/dist-sdk/src/entities/search-table/module.js +1 -0
  119. package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
  120. package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
  121. package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
  122. package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
  123. package/dist-sdk/src/entities/service-account/from-tf.js +17 -5
  124. package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
  125. package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
  126. package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
  127. package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
  128. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
  129. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
  130. package/dist-sdk/src/entities/shared/filters/ast.d.ts +8 -0
  131. package/dist-sdk/src/entities/shared/filters/index.d.ts +2 -0
  132. package/dist-sdk/src/entities/shared/filters/index.js +14 -4
  133. package/dist-sdk/src/entities/shared/filters/print.js +17 -1
  134. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +2 -0
  135. package/dist-sdk/src/entities/shared/filters/tf-codec.js +5 -1
  136. package/dist-sdk/src/entities/shared/filters/types.d.ts +9 -1
  137. package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -5
  138. package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
  139. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +2 -1
  140. package/dist-sdk/src/entities/skill/from-tf.js +66 -13
  141. package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
  142. package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
  143. package/dist-sdk/src/entities/skill/to-tf.js +14 -4
  144. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
  145. package/dist-sdk/src/entities/skill-tool/from-tf.js +8 -2
  146. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -2
  147. package/dist-sdk/src/entities/skill-tool/to-tf.js +27 -5
  148. package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
  149. package/dist-sdk/src/entities/table/catalog.js +66 -0
  150. package/dist-sdk/src/entities/table/module.js +2 -1
  151. package/dist-sdk/src/entities/table/to-tf.js +2 -2
  152. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
  153. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
  154. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
  155. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
  156. package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
  157. package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
  158. package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
  159. package/dist-sdk/src/entities/view/from-tf.js +124 -12
  160. package/dist-sdk/src/entities/view/module.js +30 -3
  161. package/dist-sdk/src/entities/view/to-tf.d.ts +14 -1
  162. package/dist-sdk/src/entities/view/to-tf.js +67 -10
  163. package/dist-sdk/src/entities/view/types.d.ts +4 -15
  164. package/dist-sdk/src/entities/view/types.js +15 -15
  165. package/dist-sdk/src/entities/widget/build.d.ts +16 -1
  166. package/dist-sdk/src/entities/widget/build.js +11 -1
  167. package/dist-sdk/src/entities/widget/to-tf.js +34 -8
  168. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +16 -5
  169. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  170. package/dist-sdk/src/graph/index.d.ts +11 -0
  171. package/dist-sdk/src/graph/index.js +21 -0
  172. package/dist-sdk/src/graph/modules.js +2 -0
  173. package/dist-sdk/src/graph/types.d.ts +55 -2
  174. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  175. package/dist-sdk/src/internal/sdk-package.js +1 -0
  176. package/package.json +10 -1
@@ -1,8 +1,18 @@
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";
5
6
  export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
7
+ /** The view bag each authoring property holds (see {@link ViewRef.viewType}). */
8
+ export const APP_VIEW_BAGS = {
9
+ listViews: viewType.list,
10
+ calendarViews: viewType.calendar,
11
+ kanbanViews: viewType.kanban,
12
+ dashboardViews: viewType.dashboard,
13
+ agentViews: viewType.agent,
14
+ customViews: viewType.custom,
15
+ };
6
16
  /**
7
17
  * Map a platform field type to the `AspectFieldInput` variant key. "relation"
8
18
  * is a terraform-only synthetic key (no `elementum-entity-client` REST
@@ -172,6 +182,11 @@ export function serializeField(field, refName) {
172
182
  if (key === "decimal" && field.decimalPlaces !== undefined) {
173
183
  base.decimalPlaces = field.decimalPlaces;
174
184
  }
185
+ if ((field.type === "ATTACHMENT" || field.type === "ATTACHMENT_ID") && field.mediaTypes !== undefined) {
186
+ assertAttachmentMediaTypes(field.name, field.mediaTypes);
187
+ if (field.mediaTypes.length > 0)
188
+ base.mediaTypes = [...field.mediaTypes];
189
+ }
175
190
  if ((key === "text" || key === "html") && field.qrFormat !== undefined) {
176
191
  base.format = field.qrFormat;
177
192
  }
@@ -214,11 +229,17 @@ export function serializeSystemFields(overrides) {
214
229
  const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
215
230
  const override = overrides[key];
216
231
  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
- };
232
+ // Validation flags travel only when authored: a system field named or
233
+ // given options alone leaves its flags to the platform. Unset flags of an
234
+ // authored set take the platform's own defaults.
235
+ const authoredFlags = override.required !== undefined || override.requiredOnClose !== undefined || override.showOnCreate !== undefined;
236
+ const flags = authoredFlags
237
+ ? {
238
+ required: override.required ?? SYSTEM_FIELD_REQUIRED[key],
239
+ requiredOnClose: override.requiredOnClose ?? false,
240
+ showOnCreate: override.showOnCreate ?? false,
241
+ }
242
+ : {};
222
243
  if (key === "stage") {
223
244
  // Constructed directly, not via serializeField: the REST compose API
224
245
  // rejects stage picklistValues (stage mutations have dedicated
@@ -285,6 +306,28 @@ function validateAppOptions(opts) {
285
306
  export function picklistOptionLabels(options) {
286
307
  return options.map((option) => typeof option === "string" ? option : option.label);
287
308
  }
309
+ /**
310
+ * One `ViewRef` per authored view, keyed by its bag key and stamped with the
311
+ * owner's identity, so other stream roots (a portal's menu) can reference it.
312
+ */
313
+ export function appViewRefs(bags, owner, parentKind) {
314
+ const out = {};
315
+ for (const [bag, type] of Object.entries(APP_VIEW_BAGS)) {
316
+ for (const [key, view] of Object.entries(bags[bag] ?? {})) {
317
+ out[key] = {
318
+ __kind: "view",
319
+ refName: key,
320
+ name: view.name,
321
+ parent: owner.refName,
322
+ viewType: type,
323
+ parentKind,
324
+ parentName: owner.name,
325
+ ...(owner.namespace !== undefined ? { parentNamespace: owner.namespace } : {}),
326
+ };
327
+ }
328
+ }
329
+ return out;
330
+ }
288
331
  export function app(opts) {
289
332
  validateAppOptions(opts);
290
333
  const fieldEntries = Object.values(opts.fields);
@@ -347,6 +390,7 @@ export function app(opts) {
347
390
  name: opts.name,
348
391
  ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),
349
392
  fields,
393
+ views: appViewRefs(opts, { refName, name: opts.name, ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}) }, kind),
350
394
  agent(childRefName, name = childRefName) {
351
395
  return { __kind: "agent", refName: childRefName, name, parent: refName };
352
396
  },
@@ -424,6 +468,7 @@ export function app(opts) {
424
468
  ...(opts.widgets !== undefined ? { widgets: opts.widgets } : {}),
425
469
  ...(opts.dashboardViews !== undefined ? { dashboardViews: opts.dashboardViews } : {}),
426
470
  ...(opts.agentViews !== undefined ? { agentViews: opts.agentViews } : {}),
471
+ ...(opts.customViews !== undefined ? { customViews: opts.customViews } : {}),
427
472
  ...(opts.recordCreateForm !== undefined ? { recordCreateForm: opts.recordCreateForm } : {}),
428
473
  ...(opts.dynamicLayouts !== undefined ? { dynamicLayouts: opts.dynamicLayouts } : {}),
429
474
  ...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
@@ -153,6 +153,19 @@ export interface NormalizedAgentView extends ManagedViewSharing {
153
153
  readonly displayOrder?: number;
154
154
  readonly layout?: NormalizedAgentViewLayout;
155
155
  }
156
+ /** A Custom view (`elementum_custom_view`): a page of Elementum Blocks. */
157
+ export interface NormalizedCustomView extends ManagedViewSharing {
158
+ readonly key: string;
159
+ readonly name: string;
160
+ /** Own agent bag key, when the view has an agent. */
161
+ readonly agentKey?: string;
162
+ readonly allowRecordCreation?: boolean;
163
+ readonly filter?: Filter<RefExpr, RefExpr>;
164
+ readonly sort?: NormalizedManagedViewSort;
165
+ readonly displayOrder?: number;
166
+ /** Plain JSON with `AgentViewSpecMarker` objects at reference positions. */
167
+ readonly layout?: unknown;
168
+ }
156
169
  /** A calendar view (`elementum_calendar_view`). */
157
170
  export interface NormalizedCalendarView extends ManagedViewSharing {
158
171
  readonly key: string;
@@ -340,6 +353,8 @@ export interface NormalizedApp {
340
353
  readonly cloudLinkId?: string;
341
354
  readonly cloudLinkClientHandle?: string;
342
355
  readonly commentsEnabled?: boolean;
356
+ /** Element only: the platform gave it audit fields (created/updated at/by). */
357
+ readonly auditFields?: boolean;
343
358
  readonly lockStages?: boolean;
344
359
  readonly cloudOptions?: {
345
360
  readonly snowflake?: {
@@ -364,6 +379,7 @@ export interface NormalizedApp {
364
379
  readonly widgets?: readonly NormalizedWidget[];
365
380
  /** Agent-powered record views (`elementum_agent_view`). */
366
381
  readonly agentViews?: readonly NormalizedAgentView[];
382
+ readonly customViews?: readonly NormalizedCustomView[];
367
383
  /** New-record form (`elementum_record_create_form`). */
368
384
  readonly recordCreateForm?: NormalizedRecordCreateForm;
369
385
  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[];
@@ -213,7 +213,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
213
213
  }
214
214
  // --- View pass: layouts / list views / view order (entities/view), owner passed in.
215
215
  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);
216
+ 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
217
  if (viewBlocks.recordCreateFormBlocks.length > 1) {
218
218
  ctx.diagnostics.push(`app "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
219
219
  }
@@ -237,7 +237,11 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
237
237
  accessPolicies.push(entry);
238
238
  }
239
239
  const roles = rolesFromTf(roleBlocks, accessPolicyOwner, ctx);
240
- const serviceAccounts = serviceAccountsFromTf([...serviceAccountBlocks, ...roleBlocks], { label, ownerTfLabel: label }, ctx);
240
+ const serviceAccounts = serviceAccountsFromTf([...serviceAccountBlocks, ...roleBlocks], {
241
+ label,
242
+ ownerTfLabel: label,
243
+ sourceFile: `apps/${refName}/${refName}.ts`,
244
+ }, ctx);
241
245
  const app = {
242
246
  id: appId ?? "",
243
247
  name,
@@ -262,6 +266,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
262
266
  ...(dashboards.length > 0 && { dashboards }),
263
267
  ...(widgets.length > 0 && { widgets }),
264
268
  ...(agentViews.length > 0 && { agentViews }),
269
+ ...(customViews.length > 0 && { customViews }),
265
270
  ...(recordCreateForm !== undefined && { recordCreateForm }),
266
271
  ...(dynamicLayouts.length > 0 && { dynamicLayouts }),
267
272
  ...(relationships.length > 0 && { relationships }),
@@ -5,14 +5,14 @@
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 { 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, } from "./build.js";
9
9
  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";
10
+ 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
11
  export { type DisplayBlock } from "./display-blocks.js";
12
12
  export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
13
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, 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";
14
+ 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";
15
+ 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
16
  export { asc, desc, sortBy, type SortDirection, type SortOrder } from "../shared/types/common.js";
17
17
  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
18
  export { agentEvaluation, type AgentEvaluationConfigured, type AgentEvaluationOptions, } from "../agent-evaluation/index.js";
@@ -21,9 +21,9 @@ export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
21
21
  export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
22
22
  export { type ManagedViewSharing } from "../view/sharing.js";
23
23
  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";
24
+ 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
25
  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";
26
+ export { serviceAccountRoleRef, serviceAccountStatus, type AppServiceAccount, type ServiceAccountAccessPolicy, type ServiceAccountRole, type ServiceAccountRoleRef, type ServiceAccountStatus } from "../service-account/build.js";
27
27
  export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
28
28
  export * as filter from "../shared/filters/index.js";
29
29
  export { type Filter } from "../shared/filters/index.js";
@@ -7,6 +7,7 @@
7
7
  */
8
8
  export { app, } from "./build.js";
9
9
  export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, } from "../view/build.js";
10
+ export { runAutomationParameterValue, } from "../widget/build.js";
10
11
  export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
11
12
  export { dynamicLayout, } from "../dynamic-layout/build.js";
12
13
  export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, } from "../field/build.js";
@@ -1,7 +1,7 @@
1
1
  /** The app entity's graph module + resource-type constant (see src/graph/). */
2
2
  import { NO_CATALOG, } from "../../graph/types.js";
3
3
  import { appendFieldLocals } from "../field/locals.js";
4
- import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE } from "../view/types.js";
4
+ import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, CUSTOM_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE } from "../view/types.js";
5
5
  import { appFromTf } from "./from-tf.js";
6
6
  import { appendAppLocals } from "./locals.js";
7
7
  import { appToTf } from "./to-tf.js";
@@ -20,6 +20,7 @@ function extractAppStreamRoot(stream, ctx) {
20
20
  const kanbanViewBlocks = viewBlocks.filter((b) => b.type === KANBAN_VIEW_RESOURCE_TYPE);
21
21
  const dashboardViewBlocks = viewBlocks.filter((b) => b.type === DASHBOARD_VIEW_RESOURCE_TYPE);
22
22
  const agentViewBlocks = viewBlocks.filter((b) => b.type === AGENT_VIEW_RESOURCE_TYPE);
23
+ const customViewBlocks = viewBlocks.filter((b) => b.type === CUSTOM_VIEW_RESOURCE_TYPE);
23
24
  const managedViewOrderBlocks = stream.byKind.get("managed-view-order") ?? [];
24
25
  const recordCreateFormBlocks = stream.byKind.get("record-create-form") ?? [];
25
26
  const dynamicLayoutBlocks = stream.byKind.get("dynamic-layout") ?? [];
@@ -40,6 +41,7 @@ function extractAppStreamRoot(stream, ctx) {
40
41
  kanbanViewBlocks,
41
42
  dashboardViewBlocks,
42
43
  agentViewBlocks,
44
+ customViewBlocks,
43
45
  managedViewOrderBlocks,
44
46
  recordCreateFormBlocks,
45
47
  dynamicLayoutBlocks,
@@ -58,7 +60,8 @@ export const appModule = {
58
60
  stream: { role: "streamRoot", exportVerb: "apps" },
59
61
  authoring: { unit: "ownFile", bag: "apps" },
60
62
  parents: [{ parent: "org", child: "app" }],
61
- resource: { shape: "single", resourceType: APP_RESOURCE_TYPE, adoptable: true },
63
+ // The provider keeps only the system fields a workspace sets (all of them after an import).
64
+ resource: { shape: "single", resourceType: APP_RESOURCE_TYPE, adoptable: true, stateScopedMapAttributes: ["system_field_config"] },
62
65
  // Foreign/referenced apps: same KindId + bag; data facet emits
63
66
  // `data.elementum_app` (ref-only stubs on disk are later).
64
67
  data: { participates: true, lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootNamespace", compatibilityFallback: "name" }] },
@@ -15,7 +15,7 @@
15
15
  * never silent, never thrown (plan §4.3).
16
16
  */
17
17
  import { workspaceAspectKey } from "../../engine/build/context.js";
18
- import { DEPLOY_DEFAULT_STATUS_OPTION_VALUES, SYSTEM_FIELD_HCL_KEY_BY_KEY, SYSTEM_FIELD_KEY_BY_TAG } from "../../core/system-fields.js";
18
+ import { DEPLOY_DEFAULT_STATUS_OPTION_VALUES, SYSTEM_FIELD_HCL_KEY_BY_KEY, SYSTEM_FIELD_KEY_BY_TAG, SYSTEM_FIELD_REQUIRED } from "../../core/system-fields.js";
19
19
  import { EntityTfError } from "../../engine/entity.js";
20
20
  import { expr, snakeSlug } from "../../engine/tf/index.js";
21
21
  import { accessPolicyToTf } from "../access-policy/to-tf.js";
@@ -23,14 +23,14 @@ import { dashboardsToTf } from "../dashboard/to-tf.js";
23
23
  import { picklistLabel } from "../field/options.js";
24
24
  import { fieldMetadataFromEntries } from "../field/metadata.js";
25
25
  import { dynamicLayoutsToTf } from "../dynamic-layout/to-tf.js";
26
- import { fieldToTf } from "../field/to-tf.js";
26
+ import { authoredFieldKeysFromPayload, claimFieldDisplayName, fieldToTf } from "../field/to-tf.js";
27
27
  import { CATEGORY_ORG_BAG } from "../org/category.js";
28
28
  import { categoryIdExpr, missingCategoryDiagnostic } from "../org/category-ref.js";
29
29
  import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
30
30
  import { recordCreateFormToTf } from "../record-create-form/to-tf.js";
31
31
  import { relationshipsToTf } from "../relationship/to-tf.js";
32
32
  import { rolesToTf } from "../role/to-tf.js";
33
- import { serviceAccountsToTf } from "../service-account/to-tf.js";
33
+ import { appServiceAccountBlocks } from "../service-account/to-tf.js";
34
34
  import { relationshipTargetsFromBag, widgetsToTf } from "../widget/to-tf.js";
35
35
  import { viewToTf } from "../view/to-tf.js";
36
36
  import { APP_RESOURCE_TYPE } from "./module.js";
@@ -114,6 +114,7 @@ export function appToTf(entity, ctx) {
114
114
  // --- Field pass: fold system-tagged fields, emit one resource per custom field.
115
115
  const blocks = [];
116
116
  const fieldAddresses = new Map();
117
+ const fieldOwnership = authoredFieldKeysFromPayload(payload);
117
118
  const fieldMetadata = fieldMetadataFromEntries(payload.fields);
118
119
  const fieldNames = new Map();
119
120
  let statusOptions;
@@ -121,6 +122,7 @@ export function appToTf(entity, ctx) {
121
122
  const systemFieldConfig = {};
122
123
  const stageTfLabels = new Set();
123
124
  const objectId = expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]);
125
+ const fieldDisplayNames = new Map();
124
126
  for (const fieldEntry of payload.fields ?? []) {
125
127
  const typeKey = Object.keys(fieldEntry)[0];
126
128
  if (typeKey === undefined)
@@ -144,11 +146,15 @@ export function appToTf(entity, ctx) {
144
146
  // falls back to DEPLOY_DEFAULT "Title" (tofu Invalid index).
145
147
  if (name !== "")
146
148
  fieldNames.set(systemKey, name);
147
- systemFieldConfig[SYSTEM_FIELD_HCL_KEY_BY_KEY[systemKey]] = {
148
- required: inner.required ?? false,
149
- required_on_close: inner.requiredOnClose ?? false,
150
- show_on_create: inner.showOnCreate ?? false,
151
- };
149
+ // Only a system field with authored validation flags is managed; one
150
+ // that is just named or given options leaves its flags to the platform.
151
+ if (inner.required !== undefined || inner.requiredOnClose !== undefined || inner.showOnCreate !== undefined) {
152
+ systemFieldConfig[SYSTEM_FIELD_HCL_KEY_BY_KEY[systemKey]] = {
153
+ required: inner.required ?? SYSTEM_FIELD_REQUIRED[systemKey],
154
+ required_on_close: inner.requiredOnClose ?? false,
155
+ show_on_create: inner.showOnCreate ?? false,
156
+ };
157
+ }
152
158
  }
153
159
  switch (systemTag) {
154
160
  case "TITLE":
@@ -209,9 +215,11 @@ export function appToTf(entity, ctx) {
209
215
  diagnostics: ctx.diagnostics,
210
216
  orgRefs: ctx.orgRefs,
211
217
  workspaceAspects: ctx.workspaceAspects,
218
+ fieldOwnership,
212
219
  });
213
220
  if (field === undefined)
214
221
  continue;
222
+ claimFieldDisplayName(fieldDisplayNames, field);
215
223
  blocks.push(field.block);
216
224
  fieldAddresses.set(field.bagKey, field.address);
217
225
  }
@@ -272,7 +280,7 @@ export function appToTf(entity, ctx) {
272
280
  diagnostics: ctx.diagnostics,
273
281
  fieldAddresses,
274
282
  widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
275
- });
283
+ }, payload.customViews);
276
284
  blocks.push(...viewBlocks);
277
285
  const recordCreateForm = recordCreateFormToTf(payload.recordCreateForm, {
278
286
  ownerRefName: ctx.appRefName,
@@ -303,6 +311,7 @@ export function appToTf(entity, ctx) {
303
311
  orgRefs: ctx.orgRefs,
304
312
  workspaceAspects: ctx.workspaceAspects,
305
313
  diagnostics: ctx.diagnostics,
314
+ fieldOwnership: fieldAddresses,
306
315
  }));
307
316
  // --- Access policy pass (entities/access-policy), owner passed in.
308
317
  // Authored entries only. Creating an app also has the platform mint a
@@ -331,10 +340,9 @@ export function appToTf(entity, ctx) {
331
340
  orgRefs: ctx.orgRefs,
332
341
  diagnostics: ctx.diagnostics,
333
342
  }));
334
- blocks.push(...serviceAccountsToTf(payload.serviceAccounts, {
343
+ blocks.push(...appServiceAccountBlocks(payload, {
335
344
  ownerTfLabel: ctx.appTfLabel,
336
345
  appId: objectId,
337
- roles: payload.roles,
338
346
  orgRefs: ctx.orgRefs,
339
347
  diagnostics: ctx.diagnostics,
340
348
  }));
@@ -86,6 +86,18 @@ export interface ActionDef<TOutput> {
86
86
  }
87
87
  /** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
88
88
  export declare const FOR_EACH_PLACEHOLDER = "__forEach__";
89
+ /**
90
+ * CANONICAL reference-name rewrite — used ONLY for workflow-publish OUTPUTS
91
+ * (see DESIGN-canonical-reference-model.md). A workflow output's
92
+ * `taskReference.name` must be the platform's CANONICAL output name
93
+ * (`service_tasks`), NOT the refs-map display label — the platform validates
94
+ * the published output against the canonical name (edk#835). Task INPUTS,
95
+ * FILTERS and CALC mustaches are UNCHANGED (they keep `rewriteForwardTaskRefName`
96
+ * / the display refs-map path — #1271 owns those positions). Maps EDK's friendly
97
+ * accessor → canonical; identity for most kinds. Validated against
98
+ * TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
99
+ */
100
+ export declare function rewriteCanonicalOutputRefName(taskKey: string | undefined, name: string, taskRefKey?: string): string;
89
101
  /** One finalized automation-level output property (already serialized to wire). */
90
102
  export interface OutputEntry {
91
103
  readonly name: string;
@@ -143,9 +155,38 @@ type ResolvedRefs<I> = {
143
155
  };
144
156
  /** Static options or options computed from the typed outputs available so far. */
145
157
  export type ActionOptions<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TOptions> = TOptions | ((ctx: Context<TTrigger, TActions, TVars>) => TOptions);
146
- /** One context object for nested actions; forEach bodies add the current item. */
147
- export type NestedActionContext<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> = Context<TTrigger, TActions, TVars> & ([TItem] extends [never] ? Record<never, never> : {
158
+ /** One enclosing forEach, as `ctx.loops.<name>` sees it from inside its body. */
159
+ export interface ForEachScope<TItem> {
160
+ /** That loop's current item: what `ctx.item` is inside its own body. */
148
161
  readonly item: ForEachItem<TItem>;
162
+ }
163
+ /**
164
+ * Inside a loop body, the builders' item type parameter carries the whole
165
+ * loop scope: the nearest loop's item plus every enclosing loop by name. One
166
+ * parameter instead of two keeps the ~40-method builder interface cheap to
167
+ * type-check (a separate loops parameter pushed CI's tsc past its heap).
168
+ */
169
+ export interface LoopScope<TItem, TLoops> {
170
+ readonly __item: TItem;
171
+ readonly __loops: TLoops;
172
+ }
173
+ /** The nearest loop's item type in a builder's item parameter. */
174
+ type ScopeItem<T> = T extends LoopScope<infer TItem, unknown> ? TItem : T;
175
+ /**
176
+ * The enclosing loops in a builder's item parameter (none outside a body).
177
+ * `never` (the root builder) is checked first: a bare distributive
178
+ * conditional over `never` is `never`, which would erase every loop scope.
179
+ */
180
+ type ScopeLoops<T> = [T] extends [never] ? EmptyObject : T extends LoopScope<unknown, infer TLoops> ? TLoops : EmptyObject;
181
+ /**
182
+ * One context object for nested actions. forEach bodies add the current item
183
+ * (`ctx.item`, the nearest loop) and every enclosing loop by name
184
+ * (`ctx.loops.<name>.item`), so a task in an inner loop can still read an
185
+ * outer loop's current item.
186
+ */
187
+ export type NestedActionContext<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> = Context<TTrigger, TActions, TVars> & ([TItem] extends [never] ? Record<never, never> : {
188
+ readonly item: ForEachItem<ScopeItem<TItem>>;
189
+ readonly loops: ScopeLoops<TItem>;
149
190
  });
150
191
  type BuilderActionOptions<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem, TOptions> = TOptions | ((ctx: NestedActionContext<TTrigger, TActions, TVars, TItem>) => TOptions);
151
192
  type BuilderMode = "root" | "nested";
@@ -255,7 +296,7 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
255
296
  initiateCall<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").InitiateCallOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
256
297
  recordFieldLocking<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RecordFieldLockingOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
257
298
  unimplementedTask<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UnimplementedTaskOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
258
- forEach<TName extends string, TForEachItem>(name: TName, opts: ForEachConfig<TTrigger, TActions, TVars, TItem, TForEachItem>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
299
+ forEach<TName extends string, TForEachItem>(name: TName, opts: ForEachConfig<TTrigger, TActions, TVars, TItem, TForEachItem, TName>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
259
300
  switch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, SwitchConfig<TTrigger, TActions, TVars, TItem>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
260
301
  forkJoin<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, ForkJoinConfig<TTrigger, TActions, TVars, TItem>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
261
302
  }
@@ -277,9 +318,10 @@ export type ForEachBuilder<TTrigger, TActions extends Record<string, unknown>, T
277
318
  export type SwitchCaseBuilder<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> = NestedActionBuilder<TTrigger, TActions, TVars, TItem>;
278
319
  /** A forkJoin branch body builder. */
279
320
  export type ForkJoinBranchBuilder<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> = NestedActionBuilder<TTrigger, TActions, TVars, TItem>;
280
- export interface ForEachConfig<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TEnclosingItem, TItem> {
321
+ export interface ForEachConfig<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TEnclosingItem, TItem, TName extends string = string> {
281
322
  readonly collection: Ref<readonly TItem[]> | ((ctx: NestedActionContext<TTrigger, TActions, TVars, TEnclosingItem>) => Ref<readonly TItem[]>);
282
- readonly actions: (actions: ForEachBuilder<TTrigger, TActions, TVars, NoInfer<TItem>>) => NestedActionChain;
323
+ /** The loop body. Its context adds `ctx.item` and this loop as `ctx.loops.<name>`. */
324
+ readonly actions: (actions: ForEachBuilder<TTrigger, TActions, TVars, LoopScope<NoInfer<TItem>, ScopeLoops<TEnclosingItem> & Record<TName, ForEachScope<NoInfer<TItem>>>>>) => NestedActionChain;
283
325
  }
284
326
  export interface SwitchCase<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> {
285
327
  readonly label?: string;