@elementumai/edk 0.10.1 → 0.10.3

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 (125) hide show
  1. package/README.md +7 -7
  2. package/dist-sdk/src/catalog/org.d.ts +7 -5
  3. package/dist-sdk/src/catalog/org.js +14 -9
  4. package/dist-sdk/src/catalog/token.js +4 -0
  5. package/dist-sdk/src/core/types/app.d.ts +22 -0
  6. package/dist-sdk/src/engine/build/context.d.ts +8 -0
  7. package/dist-sdk/src/engine/build/source-context.d.ts +3 -4
  8. package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
  9. package/dist-sdk/src/engine/coverage-gaps.js +3 -0
  10. package/dist-sdk/src/engine/ei/state.d.ts +48 -0
  11. package/dist-sdk/src/engine/ei/state.js +91 -0
  12. package/dist-sdk/src/engine/pull/authored-address.d.ts +100 -0
  13. package/dist-sdk/src/engine/pull/authored-address.js +360 -0
  14. package/dist-sdk/src/engine/pull/context.d.ts +59 -0
  15. package/dist-sdk/src/engine/tf/expr.d.ts +7 -0
  16. package/dist-sdk/src/engine/tf/expr.js +62 -18
  17. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  18. package/dist-sdk/src/engine/tf/index.js +1 -1
  19. package/dist-sdk/src/engine/tf/labels.d.ts +10 -2
  20. package/dist-sdk/src/engine/tf/labels.js +15 -2
  21. package/dist-sdk/src/engine/tf/parse.js +19 -6
  22. package/dist-sdk/src/engine/workspace/backend.d.ts +34 -0
  23. package/dist-sdk/src/engine/workspace/backend.js +104 -0
  24. package/dist-sdk/src/engine/workspace/generated-file.d.ts +3 -0
  25. package/dist-sdk/src/engine/workspace/generated-file.js +6 -0
  26. package/dist-sdk/src/engine/workspace/loader.js +2 -2
  27. package/dist-sdk/src/entities/agent-tool/to-tf.js +1 -1
  28. package/dist-sdk/src/entities/app/build.d.ts +36 -4
  29. package/dist-sdk/src/entities/app/build.js +67 -4
  30. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +12 -0
  31. package/dist-sdk/src/entities/app/from-tf.js +13 -9
  32. package/dist-sdk/src/entities/app/module.js +3 -1
  33. package/dist-sdk/src/entities/app/stage-keys.d.ts +82 -0
  34. package/dist-sdk/src/entities/app/stage-keys.js +160 -0
  35. package/dist-sdk/src/entities/app/to-tf.js +21 -21
  36. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +9 -1
  37. package/dist-sdk/src/entities/approval-chain/from-tf.js +31 -3
  38. package/dist-sdk/src/entities/approval-chain/module.js +12 -4
  39. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +1 -0
  40. package/dist-sdk/src/entities/approval-chain/to-tf.js +6 -1
  41. package/dist-sdk/src/entities/automation/build.d.ts +2 -0
  42. package/dist-sdk/src/entities/automation/build.js +25 -17
  43. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +3 -0
  44. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +5 -3
  45. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +127 -31
  46. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
  47. package/dist-sdk/src/entities/automation/from-tf.js +172 -27
  48. package/dist-sdk/src/entities/automation/module.js +123 -37
  49. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +21 -0
  50. package/dist-sdk/src/entities/automation/output-key-wire-name.js +38 -0
  51. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -1
  52. package/dist-sdk/src/entities/automation/to-tf.js +191 -33
  53. package/dist-sdk/src/entities/automation/triggers.d.ts +2 -0
  54. package/dist-sdk/src/entities/automation/triggers.js +1 -0
  55. package/dist-sdk/src/entities/chart/from-tf.d.ts +6 -0
  56. package/dist-sdk/src/entities/chart/from-tf.js +9 -1
  57. package/dist-sdk/src/entities/dashboard/from-tf.js +51 -4
  58. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
  59. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +48 -4
  60. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +2 -0
  61. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -2
  62. package/dist-sdk/src/entities/element/build.js +1 -1
  63. package/dist-sdk/src/entities/element/from-tf.d.ts +12 -6
  64. package/dist-sdk/src/entities/element/from-tf.js +23 -7
  65. package/dist-sdk/src/entities/element/module.js +5 -3
  66. package/dist-sdk/src/entities/element/to-tf.d.ts +3 -2
  67. package/dist-sdk/src/entities/element/to-tf.js +36 -25
  68. package/dist-sdk/src/entities/field/allow-list.d.ts +18 -0
  69. package/dist-sdk/src/entities/field/allow-list.js +42 -0
  70. package/dist-sdk/src/entities/field/build.d.ts +38 -3
  71. package/dist-sdk/src/entities/field/build.js +7 -2
  72. package/dist-sdk/src/entities/field/from-tf.js +252 -76
  73. package/dist-sdk/src/entities/field/module.d.ts +6 -0
  74. package/dist-sdk/src/entities/field/module.js +24 -2
  75. package/dist-sdk/src/entities/field/options.d.ts +2 -0
  76. package/dist-sdk/src/entities/field/order.d.ts +25 -0
  77. package/dist-sdk/src/entities/field/order.js +74 -0
  78. package/dist-sdk/src/entities/field/to-tf.d.ts +6 -0
  79. package/dist-sdk/src/entities/field/to-tf.js +87 -0
  80. package/dist-sdk/src/entities/field/types.d.ts +5 -0
  81. package/dist-sdk/src/entities/field/types.js +8 -0
  82. package/dist-sdk/src/entities/relationship/build.d.ts +3 -3
  83. package/dist-sdk/src/entities/relationship/from-tf.js +4 -2
  84. package/dist-sdk/src/entities/relationship/to-tf.js +3 -1
  85. package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +8 -3
  86. package/dist-sdk/src/entities/service-account/workspace-owner.js +12 -4
  87. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +5 -0
  88. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +13 -0
  89. package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -0
  90. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +1 -1
  91. package/dist-sdk/src/entities/skill/to-tf.js +19 -14
  92. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
  93. package/dist-sdk/src/entities/skill-tool/from-tf.js +3 -0
  94. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  95. package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -1
  96. package/dist-sdk/src/entities/task/build.js +1 -1
  97. package/dist-sdk/src/entities/task/module.js +2 -1
  98. package/dist-sdk/src/entities/task/to-tf.js +4 -0
  99. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +11 -0
  100. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +13 -38
  101. package/dist-sdk/src/entities/view/custom-view-validate.d.ts +29 -0
  102. package/dist-sdk/src/entities/view/custom-view-validate.js +292 -0
  103. package/dist-sdk/src/entities/view/from-tf.d.ts +2 -0
  104. package/dist-sdk/src/entities/view/from-tf.js +40 -6
  105. package/dist-sdk/src/entities/view/module.js +4 -1
  106. package/dist-sdk/src/entities/view/to-tf.d.ts +6 -0
  107. package/dist-sdk/src/entities/view/to-tf.js +25 -9
  108. package/dist-sdk/src/entities/view/types.d.ts +6 -0
  109. package/dist-sdk/src/entities/view/types.js +6 -0
  110. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +2 -1
  111. package/dist-sdk/src/entities/visual-flow/from-tf.js +11 -2
  112. package/dist-sdk/src/entities/visual-flow/module.js +15 -5
  113. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +2 -0
  114. package/dist-sdk/src/entities/visual-flow/to-tf.js +1 -1
  115. package/dist-sdk/src/entities/widget/build.d.ts +8 -1
  116. package/dist-sdk/src/entities/widget/from-tf.js +12 -6
  117. package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
  118. package/dist-sdk/src/entities/widget/to-tf.js +16 -0
  119. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +8 -2
  120. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  121. package/dist-sdk/src/graph/index.d.ts +9 -2
  122. package/dist-sdk/src/graph/index.js +4 -0
  123. package/dist-sdk/src/graph/modules.js +2 -1
  124. package/dist-sdk/src/graph/types.d.ts +72 -3
  125. package/package.json +2 -17
@@ -161,7 +161,7 @@ export function visualFlowToTf(entity, ctx) {
161
161
  if (!stage.stage)
162
162
  throw new EntityTfError(`visual flow ${entity.refName}: every stage requires a stable key`);
163
163
  return {
164
- stage_id: expr.resourceAttr(ownerType, ctx.appTfLabel, ["stage_ids_by_key", { index: tsLabelToTfLabel(stage.stage) }]),
164
+ stage_id: expr.resourceAttr(ownerType, ctx.appTfLabel, ["stage_ids_by_key", { index: ctx.stageKeyByTfLabel?.get(tsLabelToTfLabel(stage.stage)) ?? tsLabelToTfLabel(stage.stage) }]),
165
165
  nodes: Object.entries(stage.nodes ?? {}).map(([key, node]) => ({
166
166
  key,
167
167
  ...(node.description !== undefined && { description: node.description }),
@@ -98,7 +98,14 @@ export type RunAutomationWidgetParameter = RunAutomationWidgetParameterBase & ({
98
98
  export interface RunAutomationWidget extends WidgetButtonStyle {
99
99
  readonly type: "runAutomation";
100
100
  readonly name: string;
101
- readonly automation: AutomationRef;
101
+ /**
102
+ * The automation this button runs. `displayName` is its name when the
103
+ * automation is not an authored file in this workspace; build looks it up
104
+ * by that name. `name` is not the lookup key.
105
+ */
106
+ readonly automation: AutomationRef & {
107
+ readonly displayName?: string;
108
+ };
102
109
  readonly parameters?: readonly RunAutomationWidgetParameter[];
103
110
  }
104
111
  /** One record-layout display widget (`elementum_widget`). */
@@ -96,7 +96,7 @@ function widgetFromTf(block, owner, ctx, dynamicLayoutCompanionLabels) {
96
96
  return undefined;
97
97
  return { key, type: "createRecord", name, target, ...buttonStyle(body, where, ctx) };
98
98
  }
99
- const automation = automationRef(body["automation_id"], owner);
99
+ const automation = automationRef(body["automation_id"], owner, ctx);
100
100
  if (automation === undefined) {
101
101
  ctx.diagnostics.push(`${where}.run_automation_action: automation_id is not resolvable; skipped`);
102
102
  return undefined;
@@ -266,18 +266,24 @@ function recordIdentityTarget(resourceType, target) {
266
266
  const targetType = target.kind === "app" ? "elementum_app" : "elementum_element";
267
267
  return resourceType === WIDGET_RESOURCE_TYPE || resourceType === targetType ? target : undefined;
268
268
  }
269
- function automationRef(value, owner) {
269
+ function automationRef(value, owner, ctx) {
270
270
  if (typeof value === "string")
271
271
  return value;
272
272
  const label = resourceRefLabel(value, AUTOMATION_RESOURCE_TYPE);
273
273
  if (label === undefined)
274
274
  return undefined;
275
+ // Automations keep the `apps_` prefix on elements; decoding with the
276
+ // widget owner's element scope leaves `apps…` in the bag key.
277
+ const key = scopedLabelToBagKey(owner.ownerTfLabel, label, "app");
278
+ // The display name lets build look the automation up when pull leaves it
279
+ // platform-managed, so it is not in source.
280
+ const exportedName = ctx.resourceByAddress?.(`${AUTOMATION_RESOURCE_TYPE}.${label}`)?.attrs["name"];
281
+ const displayName = typeof exportedName === "string" && exportedName !== "" ? exportedName : undefined;
275
282
  return {
276
283
  kind: "automation",
277
- // Automations keep the `apps_` prefix on elements; decoding with the
278
- // widget owner's element scope leaves `apps…` in the bag key.
279
- key: scopedLabelToBagKey(owner.ownerTfLabel, label, "app"),
280
- name: scopedLabelToBagKey(owner.ownerTfLabel, label, "app"),
284
+ key,
285
+ name: displayName ?? key,
286
+ ...(displayName !== undefined ? { displayName } : {}),
281
287
  parent: owner.ownerRefName,
282
288
  };
283
289
  }
@@ -5,6 +5,7 @@ interface RefWire {
5
5
  readonly __kind?: string;
6
6
  readonly refName?: string;
7
7
  readonly name?: string;
8
+ readonly displayName?: string;
8
9
  readonly namespace?: string;
9
10
  readonly parent?: string;
10
11
  readonly fieldType?: string;
@@ -315,6 +315,22 @@ function resolveAutomation(value, where, opts) {
315
315
  opts.diagnostics.push(`${where}: foreign automation references require a provider data lookup with app_id; use a raw id until that data-source tranche lands`);
316
316
  return undefined;
317
317
  }
318
+ const authored = opts.workspaceAspects
319
+ ?.get(workspaceAspectKey(opts.scope, opts.ownerRefName))
320
+ ?.automationRefNames;
321
+ if (authored !== undefined && !authored.has(refName)) {
322
+ // Not in source: pull leaves some automations platform-managed. Look the
323
+ // live one up by display name in this owner rather than reference a
324
+ // resource the build never declares.
325
+ const displayName = value?.displayName ?? "";
326
+ if (displayName === "") {
327
+ opts.diagnostics.push(`${where}: automation "${refName}" is not in this workspace, and the reference has no display name to look it up by; re-pull to record it`);
328
+ return undefined;
329
+ }
330
+ const label = `${opts.ownerTfLabel}_${tsLabelToTfLabel(refName)}`;
331
+ opts.orgRefs.rawLookup(AUTOMATION_RESOURCE_TYPE, label, displayName, { app_id: opts.objectId });
332
+ return expr.dataAttr(AUTOMATION_RESOURCE_TYPE, label, ["id"]);
333
+ }
318
334
  return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, automationResourceLabel(opts.ownerTfLabel, refName, opts.scope, opts.scope === "element" ? opts.ownerHandle : undefined), ["id"]);
319
335
  }
320
336
  function resolveManagedColumn(value, refName, target, opts) {
@@ -239,6 +239,7 @@ export type ListCollectionBlockSelfFetchingProps = {
239
239
  readonly direction: "ASC" | "DESC";
240
240
  }>) | (PropExpression);
241
241
  }) | (PropExpression);
242
+ readonly pageSize?: (((25) | (PropExpression)) | ((50) | (PropExpression)) | ((100) | (PropExpression))) | (PropExpression);
242
243
  readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
243
244
  };
244
245
  /**
@@ -493,6 +494,7 @@ export type DataTableBlockSelfFetchingProps = {
493
494
  readonly direction: "ASC" | "DESC";
494
495
  }>) | (PropExpression);
495
496
  }) | (PropExpression);
497
+ readonly pageSize?: (((25) | (PropExpression)) | ((50) | (PropExpression)) | ((100) | (PropExpression))) | (PropExpression);
496
498
  readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
497
499
  readonly selectedAspectId?: ((string) | (PropExpression)) | (null);
498
500
  readonly selectedHandle?: ((string) | (PropExpression)) | (null);
@@ -533,7 +535,7 @@ export type ActionCardItem = {
533
535
  /**
534
536
  * Customer-facing name: Chart
535
537
  * Customer-facing description: A bar, line, or donut chart in a card. Use it to compare values or show a trend.
536
- * Internal authoring guidance: Plot-only report chart in a card with optional title, metric, and caption, branded primary default palette, and no download. Use live grouped count fetch (aspectId + stable groupByFieldId) for useful bar, line, or donut category charts; bar and line share the same grouped dataset. Grouped count supports uncalculated single-value picklist/text fields plus filterJson/filterPreset and named quickFilterValue, ANDed with the block filter. Bind filterJson and use the same filterPreset as ListControls when the chart shares the view filter; omit that binding and give the chart its own filterPreset/filterJson when it should measure a different slice. Use date series (aspectId + stable dateFieldId, saved bucket day/week/month, and either an exact YYYY-MM-DD/YYYY-MM-DD range or relativeRange) for a bar or line trend. Exact range is a BETWEEN on that date field. relativeRange is { count, unit, optional offset } with unit day, week, month, quarter, or year. The runtime resolves it to an inclusive local-calendar BETWEEN that moves with today. Omit offset to include the current unfinished unit; offset 1 is the previous complete unit or units. Quarter and year have no series granularity, so set bucket to month unless a day or week bucket is intended. Set only one window. Write the window in the Spec. The builder has no range control. Plot the returned points in order, including zeros the API already filled. A blank window draws the empty plot. There is no runtime bucket switch. Use scalar fetch (aggregation + aspectId, optional fieldId/filterJson/filterPreset/quickFilterValue) only for one observation; prefer MetricsRowBlock for a single KPI and never present one scalar line point as a trend. Nonempty filterJson wins; a preset is only a seed. Never mix fetch and embedded data. Use embedded data for preview or when the agent already owns the complete dataset. Grouped numeric sum/avg/min/max is not supported by this count-shaped API. Pair charts with DataTableBlock/ListCollectionBlock and MetricsRowBlock to build dashboards.
538
+ * Internal authoring guidance: Plot-only report chart in a card with optional title, metric, and caption, branded primary default palette, and no download. Set showBackingList true on a fetch arm to show a fullscreen control that opens the records matching this chart. Use live grouped count fetch (aspectId + stable groupByFieldId) for useful bar, line, or donut category charts; bar and line share the same grouped dataset. Grouped count supports uncalculated single-value picklist/text fields plus filterJson/filterPreset and named quickFilterValue, ANDed with the block filter. Bind filterJson and use the same filterPreset as ListControls when the chart shares the view filter; omit that binding and give the chart its own filterPreset/filterJson when it should measure a different slice. Use date series (aspectId + stable dateFieldId, saved bucket day/week/month, and either an exact YYYY-MM-DD/YYYY-MM-DD range or relativeRange) for a bar or line trend. Exact range is a BETWEEN on that date field. relativeRange is { count, unit, optional offset } with unit day, week, month, quarter, or year. The runtime resolves it to an inclusive local-calendar BETWEEN that moves with today. Omit offset to include the current unfinished unit; offset 1 is the previous complete unit or units. Quarter and year have no series granularity, so set bucket to month unless a day or week bucket is intended. Set only one window. Write the window in the Spec. The builder has no range control. Plot the returned points in order, including zeros the API already filled. A blank window draws the empty plot. There is no runtime bucket switch. Use scalar fetch (aggregation + aspectId, optional fieldId/filterJson/filterPreset/quickFilterValue) only for one observation; prefer MetricsRowBlock for a single KPI and never present one scalar line point as a trend. Nonempty filterJson wins; a preset is only a seed. Never mix fetch and embedded data. Use embedded data for preview or when the agent already owns the complete dataset. Grouped numeric sum/avg/min/max is not supported by this count-shaped API. Pair charts with DataTableBlock/ListCollectionBlock and MetricsRowBlock to build dashboards.
537
539
  */
538
540
  export type ChartBlockElement = {
539
541
  readonly type: "ChartBlock";
@@ -575,6 +577,7 @@ export type ChartBlockFetchProps = {
575
577
  }))) | (PropExpression)) | (null);
576
578
  readonly filterPreset?: ((("createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned") | (PropExpression)) | ((ReadonlyArray<"createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned">) | (PropExpression))) | (PropExpression);
577
579
  readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
580
+ readonly showBackingList?: (boolean) | (PropExpression);
578
581
  };
579
582
  export type ChartBlockGroupedFetchProps = {
580
583
  readonly variant: ("bar" | "line" | "donut") | (PropExpression);
@@ -590,6 +593,7 @@ export type ChartBlockGroupedFetchProps = {
590
593
  }))) | (PropExpression)) | (null);
591
594
  readonly filterPreset?: ((("createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned") | (PropExpression)) | ((ReadonlyArray<"createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned">) | (PropExpression))) | (PropExpression);
592
595
  readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
596
+ readonly showBackingList?: (boolean) | (PropExpression);
593
597
  };
594
598
  export type ChartBlockDateSeriesProps = {
595
599
  readonly variant: ("bar" | "line") | (PropExpression);
@@ -608,6 +612,7 @@ export type ChartBlockDateSeriesProps = {
608
612
  }))) | (PropExpression)) | (null);
609
613
  readonly filterPreset?: ((("createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned") | (PropExpression)) | ((ReadonlyArray<"createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned">) | (PropExpression))) | (PropExpression);
610
614
  readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
615
+ readonly showBackingList?: (boolean) | (PropExpression);
611
616
  };
612
617
  export type ChartBlockRelativeRange = {
613
618
  readonly count: (number) | (PropExpression);
@@ -617,7 +622,7 @@ export type ChartBlockRelativeRange = {
617
622
  /**
618
623
  * Customer-facing name: Metrics
619
624
  * Customer-facing description: A single KPI tile with a caption and prominent value.
620
- * Internal authoring guidance: Single read-only KPI tile with a caption, prominent value, and optional static subtext below successful results. Use formattedValue for a complete display-ready metric, or calc for live Aspect.calculation data with optional explicit aspectId (otherwise the managed-view default), filterJson/filterPreset, quickFilterValue, number format, empty copy, and color/colorRules limited to default, primary organization theme, muted, error, success, or warning. Bind filterJson and use the same filterPreset as ListControls when the KPI should share its view filter; give the metric its own filterPreset/filterJson without that binding when it should measure a different slice. Each MetricsRowBlock renders exactly one KPI; compose several independent tiles in RowBlock. Prefer ChartBlock when the result needs a bar, line, donut, category comparison, or trend.
625
+ * Internal authoring guidance: Single read-only KPI tile with a caption, prominent value, and optional static subtext below successful results. Use formattedValue for a complete display-ready metric, or calc for live Aspect.calculation data with optional explicit aspectId (otherwise the managed-view default), filterJson/filterPreset, quickFilterValue, number format, empty copy, and color/colorRules limited to default, primary organization theme, muted, error, success, or warning. Set showBackingList true on the self-fetch branch to show a fullscreen control that opens the records matching this metric. Bind filterJson and use the same filterPreset as ListControls when the KPI should share its view filter; give the metric its own filterPreset/filterJson without that binding when it should measure a different slice. Each MetricsRowBlock renders exactly one KPI; compose several independent tiles in RowBlock. Prefer ChartBlock when the result needs a bar, line, donut, category comparison, or trend.
621
626
  */
622
627
  export type MetricsRowBlockElement = {
623
628
  readonly type: "MetricsRowBlock";
@@ -673,6 +678,7 @@ export type MetricsRowSelfFetchProps = {
673
678
  }))) | (PropExpression)) | (null);
674
679
  readonly filterPreset?: ((("createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned") | (PropExpression)) | ((ReadonlyArray<"createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned">) | (PropExpression))) | (PropExpression);
675
680
  readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
681
+ readonly showBackingList?: (boolean) | (PropExpression);
676
682
  readonly emptyMessage?: (string) | (PropExpression);
677
683
  };
678
684
  /**
@@ -1,5 +1,5 @@
1
1
  // Generated by `npm run generate:ragnarok` — do not edit. Refresh with `npm run refresh:ragnarok`.
2
- // Source: urn:elementum:elementum-blocks:spec:v1 version 1.38.0
3
- // Schema sha256: 6d96d9f9edee222052989a1c5eecf75d0da751ed102c8c3fb1a5e5229502990b
2
+ // Source: urn:elementum:elementum-blocks:spec:v1 version 1.39.0
3
+ // Schema sha256: 073dd4066f43c677f79f3e55af3f33786d4c33dc4d587527aa8d7f1d875d57b6
4
4
  // Generator revision: 2
5
5
  export {};
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Public graph barrel: KIND_MODULES + derived views for pull/build/canvas.
3
3
  */
4
- import { type CatalogRenderArgs, type CatalogRenderResult, type EntityKindModule, type KindId, type ParentEdge, matchType } from "./types.js";
5
- export type { AdoptionAddressAlias, AuthoringFacet, CanvasComponentId, CanvasFacet, CanvasView, CatalogAuthoringArgs, CatalogFacet, CatalogRenderArgs, CatalogRenderResult, CatalogRoot, DataFacet, DataFacetCatalogKind, EntityKindId, EntityKindModule, KindId, LifecycleFacet, OrgIdentityBag, ParentEdge, ParentageFacet, ResourceFacet, StreamFacet, StreamMatch, StreamPartition, StreamRootExtractResult, ToTfResult, } from "./types.js";
4
+ import { type CatalogRenderArgs, type CatalogRenderResult, type EntityKindModule, type KindId, type ParentEdge, type StateScopedPlatformEntry, matchType } from "./types.js";
5
+ export type { AdoptionAddressAlias, AuthoringFacet, CanvasComponentId, CanvasFacet, CanvasView, CatalogAuthoringArgs, CatalogFacet, CatalogRenderArgs, CatalogRenderResult, CatalogRoot, DataFacet, DataFacetCatalogKind, EntityKindId, EntityKindModule, KindId, LifecycleFacet, OrgIdentityBag, ParentEdge, ParentageFacet, ResourceFacet, StateScopedPlatformEntry, StreamFacet, StreamMatch, StreamPartition, StreamRootExtractResult, ToTfResult, } from "./types.js";
6
6
  export type { ReferenceLookupStrategy } from "./types.js";
7
7
  export { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE, defaultMatchResourceType, implementedResourceTypes, isResourceAdoptable, isTfLive, knownResourceTypes, matchType, singleResourceType, } from "./types.js";
8
8
  export { KIND_MODULES } from "./modules.js";
@@ -94,6 +94,12 @@ export declare const BUILD_VS_EXPORT_ATTRIBUTE_LOCALS: {
94
94
  readonly localPrefix: string;
95
95
  readonly listField?: string;
96
96
  }[];
97
+ export declare const BUILD_VS_EXPORT_PICKLIST_LABEL_ASSIGNMENTS: {
98
+ readonly resourceType: string;
99
+ readonly attribute: string;
100
+ readonly fieldAttribute: string;
101
+ readonly valueAttribute: string;
102
+ }[];
97
103
  export declare const BUILD_VS_EXPORT_TASK_OUTPUT_REFERENCE_NAMES: ReadonlyMap<string, ReadonlyMap<string, string>>;
98
104
  /** Kind id → module. */
99
105
  export declare const KIND_BY_ID: ReadonlyMap<KindId, EntityKindModule>;
@@ -134,6 +140,7 @@ export declare const UNREADABLE_ATTRIBUTES_BY_RESOURCE_TYPE: ReadonlyMap<string,
134
140
  * single-resource kind declares them. A re-pull keeps only the keys in state.
135
141
  */
136
142
  export declare const STATE_SCOPED_MAP_ATTRIBUTES_BY_RESOURCE_TYPE: ReadonlyMap<string, readonly string[]>;
143
+ export declare const STATE_SCOPED_PLATFORM_ENTRIES_BY_RESOURCE_TYPE: ReadonlyMap<string, readonly StateScopedPlatformEntry[]>;
137
144
  /** Entity-declared value equivalences used to compare builder and exporter HCL. */
138
145
  export declare const BUILD_VS_EXPORT_NORMALIZATIONS: {
139
146
  readonly omittedAttributeDefaults: {
@@ -64,6 +64,7 @@ export const BUILD_VS_EXPORT_NESTED_OMITTED_DEFAULTS = KIND_MODULES.flatMap((mod
64
64
  export const BUILD_VS_EXPORT_COMPUTED_REFERENCE_MAPS = KIND_MODULES.flatMap((module) => module.roundtrip?.computedReferenceMaps ?? []);
65
65
  export const BUILD_VS_EXPORT_RECORD_FIELD_OUTPUT_KEYS = KIND_MODULES.flatMap((module) => module.roundtrip?.recordFieldOutputKeys ?? []);
66
66
  export const BUILD_VS_EXPORT_ATTRIBUTE_LOCALS = KIND_MODULES.flatMap((module) => module.roundtrip?.exportedAttributeLocals ?? []);
67
+ export const BUILD_VS_EXPORT_PICKLIST_LABEL_ASSIGNMENTS = KIND_MODULES.flatMap((module) => module.roundtrip?.picklistLabelAssignments ?? []);
67
68
  export const BUILD_VS_EXPORT_TASK_OUTPUT_REFERENCE_NAMES = new Map(KIND_MODULES.flatMap((module) => Object.entries(module.roundtrip?.taskOutputReferenceNames ?? {}))
68
69
  .map(([taskType, names]) => [taskType, new Map(Object.entries(names))]));
69
70
  /** Kind id → module. */
@@ -127,6 +128,9 @@ export const UNREADABLE_ATTRIBUTES_BY_RESOURCE_TYPE = new Map(KIND_MODULES.flatM
127
128
  export const STATE_SCOPED_MAP_ATTRIBUTES_BY_RESOURCE_TYPE = new Map(KIND_MODULES.flatMap((m) => m.resource.shape === "single" && m.resource.stateScopedMapAttributes !== undefined
128
129
  ? [[m.resource.resourceType, m.resource.stateScopedMapAttributes]]
129
130
  : []));
131
+ export const STATE_SCOPED_PLATFORM_ENTRIES_BY_RESOURCE_TYPE = new Map(KIND_MODULES.flatMap((m) => m.resource.shape === "single" && m.resource.stateScopedPlatformEntries !== undefined
132
+ ? [[m.resource.resourceType, m.resource.stateScopedPlatformEntries]]
133
+ : []));
130
134
  /** Entity-declared value equivalences used to compare builder and exporter HCL. */
131
135
  export const BUILD_VS_EXPORT_NORMALIZATIONS = {
132
136
  omittedAttributeDefaults: KIND_MODULES.flatMap((module) => (module.roundtrip?.omittedAttributeDefaults ?? []).flatMap((equivalence) => implementedResourceTypes(module.resource).map((blockType) => ({ blockType, ...equivalence })))),
@@ -17,7 +17,7 @@ import { dashboardModule } from "../entities/dashboard/module.js";
17
17
  import { dashboardWidgetModule } from "../entities/dashboard-widget/module.js";
18
18
  import { datamineModule } from "../entities/datamine/module.js";
19
19
  import { dataLookupModules } from "../entities/data-lookup/module.js";
20
- import { fieldModule } from "../entities/field/module.js";
20
+ import { fieldModule, managedFieldOrderModule } from "../entities/field/module.js";
21
21
  import { fileReaderModule } from "../entities/file-reader/module.js";
22
22
  import { visualFlowModule } from "../entities/visual-flow/module.js";
23
23
  import { aiProviderModules, categoryModule, cloudLinkModule, connectorModule, emailAliasModule, groupModule, phoneProviderModule, roleModule, userModule, } from "../entities/org/index.js";
@@ -52,6 +52,7 @@ export const KIND_MODULES = [
52
52
  visualFlowModule,
53
53
  viewModule,
54
54
  managedViewOrderModule,
55
+ managedFieldOrderModule,
55
56
  recordCreateFormModule,
56
57
  dynamicLayoutModule,
57
58
  dashboardModule,
@@ -10,7 +10,7 @@ import type { DeployableEntity } from "../engine/entity.js";
10
10
  import type { FromTfContext } from "../engine/pull/context.js";
11
11
  import type { ChildResourceScope, TfBlock, TfValue } from "../engine/tf/index.js";
12
12
  import type { ValidationFailure } from "../engine/validation.js";
13
- export type KindId = "org" | "app" | "element" | "field" | "access-policy" | "agent" | "agent-evaluation" | "chart" | "agent-tool" | "agent-a2a-skill" | "automation" | "approval-chain" | "file-reader" | "visual-flow" | "skill" | "skill-tool" | "view" | "managed-view-order" | "record-create-form" | "dynamic-layout" | "dashboard" | "dashboard-widget" | "datamine" | "automation-value-references" | "organization" | "permission-template" | "service-account" | "stored-function" | "vault-entry" | "task" | "portal" | "widget" | "relationship" | "search-table" | "table" | "cloud-link" | "email-alias" | "category" | "connector" | "ai-provider-anthropic" | "ai-provider-bedrock" | "ai-provider-custom" | "ai-provider-deepgram" | "ai-provider-elevenlab" | "ai-provider-gemini" | "ai-provider-openai" | "ai-provider-snowflake" | "ai-provider-xai" | "ai-provider-managed" | "group" | "phone-provider" | "phone-service" | "role" | "user";
13
+ export type KindId = "org" | "app" | "element" | "field" | "access-policy" | "agent" | "agent-evaluation" | "chart" | "agent-tool" | "agent-a2a-skill" | "automation" | "approval-chain" | "file-reader" | "visual-flow" | "skill" | "skill-tool" | "view" | "managed-view-order" | "managed-field-order" | "record-create-form" | "dynamic-layout" | "dashboard" | "dashboard-widget" | "datamine" | "automation-value-references" | "organization" | "permission-template" | "service-account" | "stored-function" | "vault-entry" | "task" | "portal" | "widget" | "relationship" | "search-table" | "table" | "cloud-link" | "email-alias" | "category" | "connector" | "ai-provider-anthropic" | "ai-provider-bedrock" | "ai-provider-custom" | "ai-provider-deepgram" | "ai-provider-elevenlab" | "ai-provider-gemini" | "ai-provider-openai" | "ai-provider-snowflake" | "ai-provider-xai" | "ai-provider-managed" | "group" | "phone-provider" | "phone-service" | "role" | "user";
14
14
  /** @deprecated Use {@link KindId}. */
15
15
  export type EntityKindId = KindId;
16
16
  export type StreamFacet = {
@@ -43,6 +43,11 @@ export interface ParentEdge {
43
43
  }
44
44
  /** Parentage facet: who may own whom (multi-parent OK). */
45
45
  export type ParentageFacet = readonly ParentEdge[];
46
+ /** A reference list attribute and the name of the platform-created resource state decides on. */
47
+ export interface StateScopedPlatformEntry {
48
+ readonly attribute: string;
49
+ readonly name: string;
50
+ }
46
51
  export interface SubTypeRow {
47
52
  readonly key: string;
48
53
  readonly resourceType: string;
@@ -88,6 +93,13 @@ export type ResourceFacet = {
88
93
  * keys state holds (see `alignExportWithState`).
89
94
  */
90
95
  readonly stateScopedMapAttributes?: readonly string[];
96
+ /**
97
+ * Reference lists where the provider keeps an entry pointing at a
98
+ * platform-created resource (recognised by its `name`) only when state
99
+ * already holds that entry. The export always lists it; a re-pull drops
100
+ * it unless state holds its id (see `alignExportWithState`).
101
+ */
102
+ readonly stateScopedPlatformEntries?: readonly StateScopedPlatformEntry[];
91
103
  } | {
92
104
  readonly shape: "subTypes";
93
105
  readonly rows: readonly SubTypeRow[];
@@ -298,6 +310,14 @@ export interface OwnFileExtractResult {
298
310
  readonly validations?: readonly ValidationFailure[];
299
311
  /** Export address → canonical address rebuilt by the printed current API. */
300
312
  readonly adoptionAddressAliases?: readonly AdoptionAddressAlias[];
313
+ /**
314
+ * Own-file ref names released from state on this pull. Their authored files
315
+ * are archived so the next plan does not recreate the live resource (#1858).
316
+ */
317
+ readonly quarantineOwnFiles?: readonly {
318
+ readonly kind: string;
319
+ readonly refName: string;
320
+ }[];
301
321
  }
302
322
  export interface AdoptionAddressAlias {
303
323
  readonly from: string;
@@ -330,6 +350,8 @@ export interface MergePulledSourceContext {
330
350
  /** Workspace state read at write time; undefined when it could not be read. */
331
351
  readonly stateResources?: readonly {
332
352
  readonly type?: string;
353
+ readonly mode?: string;
354
+ readonly module?: string;
333
355
  readonly instances?: readonly {
334
356
  readonly attributes?: Record<string, unknown>;
335
357
  }[];
@@ -459,6 +481,11 @@ export interface BuildChildContext {
459
481
  readonly tfLabel: string;
460
482
  readonly streamRootEntity?: DeployableEntity;
461
483
  }>;
484
+ /** See `ToTfContext.outOfScopeApps`. */
485
+ readonly outOfScopeApps?: ReadonlyMap<string, {
486
+ readonly name: string;
487
+ readonly namespace?: string;
488
+ }>;
462
489
  /** The current app/element/table entity, forwarded for owner-local reference resolution. */
463
490
  readonly streamRootEntity?: DeployableEntity;
464
491
  /**
@@ -553,8 +580,12 @@ export type LifecycleFacet = {
553
580
  readonly rebindOwnFileOwner?: (item: unknown, extractedOwnerRefName: string, authoredOwnerRefName: string) => unknown;
554
581
  /** Print one extracted own-file instance to TypeScript source. */
555
582
  readonly printOwnFile?: (item: unknown, opts: PrintOwnFileOptions) => PrintedOwnFile;
556
- /** Re-pull: preserve author-owned values that the live export cannot represent. */
557
- readonly mergePulledSource?: (freshSource: string, existingSource: string, context?: MergePulledSourceContext) => string;
583
+ /**
584
+ * Re-pull: preserve author-owned values that the live export cannot represent.
585
+ * `existingSource` is undefined when no source file exists yet; state may
586
+ * still hold values the fresh print must agree with.
587
+ */
588
+ readonly mergePulledSource?: (freshSource: string, existingSource: string | undefined, context?: MergePulledSourceContext) => string;
558
589
  /**
559
590
  * Re-pull: true when an existing source file is earlier printer output
560
591
  * that can never build (it carries a placeholder the printer emits for a
@@ -584,6 +615,25 @@ export interface StreamPartition {
584
615
  readonly allResources: readonly TfBlock[];
585
616
  readonly allBlocks: readonly TfBlock[];
586
617
  }
618
+ /** Root-module state, by resource type and label. */
619
+ export interface StateAdoptionIndex {
620
+ /** Whether state already holds `type.label`. */
621
+ has(type: string, label: string): boolean;
622
+ /** The `id` state holds for `type.label`, if any. */
623
+ idOf(type: string, label: string): string | undefined;
624
+ }
625
+ /** One import an entity asks plan/apply to add. */
626
+ export interface StateAdoptionImport {
627
+ readonly type: string;
628
+ readonly label: string;
629
+ readonly id: string;
630
+ }
631
+ export interface StateAdoptionFacet {
632
+ /** Imports for built blocks that have no state but exist live. */
633
+ readonly importsFor: (blocks: readonly TfBlock[], state: StateAdoptionIndex) => readonly StateAdoptionImport[];
634
+ /** The user-facing warning for this kind's imports (printed once per distinct set). */
635
+ readonly warning: (imports: readonly StateAdoptionImport[]) => string;
636
+ }
587
637
  export interface EntityKindModule {
588
638
  readonly kind: KindId;
589
639
  /** Export participation. */
@@ -606,6 +656,12 @@ export interface EntityKindModule {
606
656
  readonly buildChecks?: {
607
657
  readonly validateBuiltBlocks: (blocks: readonly TfBlock[]) => readonly string[];
608
658
  };
659
+ /**
660
+ * Plan/apply: resources build emits that may already exist live without
661
+ * state (e.g. a workspace pulled before the kind was managed). Each returned
662
+ * import is written to `.tf/out` so the plan imports instead of creating.
663
+ */
664
+ readonly stateAdoption?: StateAdoptionFacet;
609
665
  /** Entity-specific equivalences used only by live build-vs-export comparison. */
610
666
  readonly roundtrip?: {
611
667
  readonly referenceAliases: readonly {
@@ -705,6 +761,19 @@ export interface EntityKindModule {
705
761
  readonly localPrefix: string;
706
762
  readonly listField?: string;
707
763
  }[];
764
+ /**
765
+ * Field-assignment lists (`<attribute>[i].<fieldAttribute>` set to
766
+ * `<attribute>[i].<valueAttribute>`) where the provider treats a static
767
+ * Dropdown option's label and its option id as the same value. The
768
+ * platform stores either one; the build always writes the option-id
769
+ * lookup `local.<field>_options_by_label["<label>"]`.
770
+ */
771
+ readonly picklistLabelAssignments?: readonly {
772
+ readonly resourceType: string;
773
+ readonly attribute: string;
774
+ readonly fieldAttribute: string;
775
+ readonly valueAttribute: string;
776
+ }[];
708
777
  };
709
778
  }
710
779
  export declare function implementedResourceTypes(resource: ResourceFacet): readonly string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementumai/edk",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "Elementum Development Kit — statically typed SDK for building Elementum apps, automations, and agents",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -191,23 +191,11 @@
191
191
  "pack:consumer": "npm run build:sdk && tsx src/scripts/test-package-consumer.ts",
192
192
  "release:local-sdk": "bash release/verify-local-sdk-prepare.sh",
193
193
  "release:notes": "tsx src/scripts/release-notes.ts",
194
- "test": "tsx src/scripts/test.ts",
195
- "test:unit": "vitest run",
196
- "test:runtime": "vitest run",
197
194
  "check:parity": "tsx src/scripts/check-provider-parity.ts",
198
- "pretest:provider": "npm run generate:graphql",
199
- "test:provider": "go -C provider test -timeout=120s -parallel=10 ./internal/...",
200
- "pretest:provider:cover": "npm run generate:graphql",
201
- "test:provider:cover": "go -C provider test -v -cover -timeout=120s -parallel=10 ./internal/...",
202
- "pretest:bridge": "npm run generate:graphql",
203
- "test:bridge": "go -C cmd/elementum test -v -timeout=30s ./...",
204
- "test:backend-lock": "vitest run __tests__/integration/http-backend-lock.test.ts __tests__/integration/http-state-backend.test.ts",
205
- "test:go": "npm run test:provider && npm run test:bridge",
206
195
  "test:distribution": "npm --prefix distribution test",
207
- "test:watch": "vitest",
208
- "test:cli": "vitest run __tests__/cli",
209
196
  "test:binary": "npm run build:sdk && npm run build:binary:bun && npm run smoke:binary:bun",
210
197
  "test:integration": "node integration/run.mjs",
198
+ "preston:gate": "bash integration/tools/preston-gate-commit.sh",
211
199
  "reap:orphans": "node integration/tools/reap-orphaned-test-entities.mjs",
212
200
  "typecheck": "npm run typecheck:ci",
213
201
  "pretypecheck:ci": "npm run generate:ragnarok",
@@ -222,8 +210,6 @@
222
210
  "typecheck:examples": "tsc --noEmit -p tsconfig.examples-check.json",
223
211
  "pretypecheck:consumer": "npm run generate:ragnarok",
224
212
  "typecheck:consumer": "tsc --noEmit -p tsconfig.package-consumer-check.json",
225
- "pretypecheck:tests": "npm run generate:ragnarok",
226
- "typecheck:tests": "tsc --noEmit -p tsconfig.typecheck-tests.json",
227
213
  "lint": "eslint src/cli src/internal/sdk-package.ts src/scripts/prepare-release-promotion.ts src/scripts/test-package-consumer.ts examples/package-consumer",
228
214
  "lint:all": "eslint .",
229
215
  "lint:generated": "eslint generated/",
@@ -255,7 +241,6 @@
255
241
  "tsx": "^4.21.0",
256
242
  "typescript": "^6.0.2",
257
243
  "typescript-eslint": "^8.59.1",
258
- "vitest": "^4.1.1",
259
244
  "yaml": "^2.9.0"
260
245
  },
261
246
  "allowScripts": {