@elementumai/edk 0.12.0 → 0.13.0

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 (193) hide show
  1. package/README.md +2 -0
  2. package/dist-sdk/src/catalog/factories.d.ts +7 -1
  3. package/dist-sdk/src/catalog/factories.js +2 -0
  4. package/dist-sdk/src/catalog/index.d.ts +2 -2
  5. package/dist-sdk/src/catalog/index.js +1 -1
  6. package/dist-sdk/src/catalog/org.js +79 -34
  7. package/dist-sdk/src/catalog/token.js +5 -0
  8. package/dist-sdk/src/catalog/types.d.ts +7 -1
  9. package/dist-sdk/src/catalog/types.js +3 -0
  10. package/dist-sdk/src/core/system-fields.d.ts +1 -1
  11. package/dist-sdk/src/core/system-fields.js +1 -1
  12. package/dist-sdk/src/core/types/app.d.ts +6 -0
  13. package/dist-sdk/src/engine/build/context.d.ts +3 -0
  14. package/dist-sdk/src/engine/pull/authored-address.js +42 -6
  15. package/dist-sdk/src/engine/pull/authored-root.d.ts +88 -0
  16. package/dist-sdk/src/engine/pull/authored-root.js +306 -0
  17. package/dist-sdk/src/engine/pull/context.d.ts +10 -0
  18. package/dist-sdk/src/engine/pull/field-refs-registry.d.ts +114 -0
  19. package/dist-sdk/src/engine/pull/field-refs-registry.js +501 -0
  20. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  21. package/dist-sdk/src/engine/pull/org.js +2 -0
  22. package/dist-sdk/src/engine/pull/partition.d.ts +8 -0
  23. package/dist-sdk/src/engine/pull/partition.js +43 -0
  24. package/dist-sdk/src/engine/pull/pulled-roots.d.ts +89 -0
  25. package/dist-sdk/src/engine/pull/pulled-roots.js +203 -0
  26. package/dist-sdk/src/engine/pull/ref-only.d.ts +4 -0
  27. package/dist-sdk/src/engine/pull/ref-only.js +7 -1
  28. package/dist-sdk/src/engine/pull/source-resources.d.ts +39 -0
  29. package/dist-sdk/src/engine/pull/source-resources.js +110 -0
  30. package/dist-sdk/src/engine/pull/stream-root.d.ts +148 -0
  31. package/dist-sdk/src/engine/pull/stream-root.js +563 -0
  32. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.d.ts +47 -0
  33. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.js +115 -0
  34. package/dist-sdk/src/entities/access-policy/build.d.ts +2 -1
  35. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +7 -0
  36. package/dist-sdk/src/entities/access-policy/from-tf.js +18 -3
  37. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +19 -0
  38. package/dist-sdk/src/entities/access-policy/to-tf.js +65 -8
  39. package/dist-sdk/src/entities/agent/build.d.ts +52 -1
  40. package/dist-sdk/src/entities/agent/build.js +34 -0
  41. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -0
  42. package/dist-sdk/src/entities/agent/from-tf.d.ts +34 -1
  43. package/dist-sdk/src/entities/agent/from-tf.js +262 -2
  44. package/dist-sdk/src/entities/agent/index.d.ts +1 -1
  45. package/dist-sdk/src/entities/agent/to-tf.d.ts +8 -10
  46. package/dist-sdk/src/entities/agent/to-tf.js +158 -14
  47. package/dist-sdk/src/entities/agent-tool/from-tf.js +6 -0
  48. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  49. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -2
  50. package/dist-sdk/src/entities/app/build.d.ts +33 -13
  51. package/dist-sdk/src/entities/app/build.js +14 -12
  52. package/dist-sdk/src/entities/app/from-tf.js +24 -9
  53. package/dist-sdk/src/entities/app/index.d.ts +1 -0
  54. package/dist-sdk/src/entities/app/index.js +1 -0
  55. package/dist-sdk/src/entities/app/module.js +1 -0
  56. package/dist-sdk/src/entities/app/stage-keys.d.ts +2 -2
  57. package/dist-sdk/src/entities/app/stage-keys.js +3 -3
  58. package/dist-sdk/src/entities/app/to-tf.js +1 -0
  59. package/dist-sdk/src/entities/approval-chain/build.d.ts +46 -11
  60. package/dist-sdk/src/entities/approval-chain/build.js +120 -8
  61. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +24 -2
  62. package/dist-sdk/src/entities/approval-chain/from-tf.js +148 -6
  63. package/dist-sdk/src/entities/approval-chain/index.d.ts +4 -1
  64. package/dist-sdk/src/entities/approval-chain/index.js +4 -1
  65. package/dist-sdk/src/entities/approval-chain/module.js +23 -5
  66. package/dist-sdk/src/entities/approval-chain/printer.d.ts +1 -1
  67. package/dist-sdk/src/entities/approval-chain/printer.js +91 -5
  68. package/dist-sdk/src/entities/approval-chain/steps-tf.d.ts +77 -0
  69. package/dist-sdk/src/entities/approval-chain/steps-tf.js +255 -0
  70. package/dist-sdk/src/entities/approval-chain/steps.d.ts +71 -0
  71. package/dist-sdk/src/entities/approval-chain/steps.js +83 -0
  72. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +16 -6
  73. package/dist-sdk/src/entities/approval-chain/to-tf.js +37 -4
  74. package/dist-sdk/src/entities/automation/build.js +70 -27
  75. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +20 -5
  76. package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -5
  77. package/dist-sdk/src/entities/automation/from-tf.js +593 -101
  78. package/dist-sdk/src/entities/automation/index.d.ts +1 -0
  79. package/dist-sdk/src/entities/automation/index.js +1 -0
  80. package/dist-sdk/src/entities/automation/module.d.ts +4 -3
  81. package/dist-sdk/src/entities/automation/module.js +33 -12
  82. package/dist-sdk/src/entities/automation/refs-read.d.ts +19 -0
  83. package/dist-sdk/src/entities/automation/refs-read.js +48 -0
  84. package/dist-sdk/src/entities/automation/slack-message-refs.d.ts +9 -0
  85. package/dist-sdk/src/entities/automation/slack-message-refs.js +75 -0
  86. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +11 -0
  87. package/dist-sdk/src/entities/automation/task-output-labels.js +23 -0
  88. package/dist-sdk/src/entities/automation/tasks.d.ts +29 -4
  89. package/dist-sdk/src/entities/automation/tasks.js +34 -11
  90. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -0
  91. package/dist-sdk/src/entities/automation/to-tf.js +337 -77
  92. package/dist-sdk/src/entities/automation/triggers.d.ts +0 -8
  93. package/dist-sdk/src/entities/automation/triggers.js +26 -11
  94. package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +50 -0
  95. package/dist-sdk/src/entities/automation/unsafe-script-output.js +92 -0
  96. package/dist-sdk/src/entities/chart/build.d.ts +9 -1
  97. package/dist-sdk/src/entities/chart/from-tf.js +3 -0
  98. package/dist-sdk/src/entities/chart/to-tf.js +19 -2
  99. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -0
  100. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +44 -5
  101. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +46 -12
  102. package/dist-sdk/src/entities/element/audit-field-guard.d.ts +9 -0
  103. package/dist-sdk/src/entities/element/audit-field-guard.js +88 -0
  104. package/dist-sdk/src/entities/element/build.js +2 -1
  105. package/dist-sdk/src/entities/element/from-tf.js +15 -2
  106. package/dist-sdk/src/entities/element/module.js +3 -0
  107. package/dist-sdk/src/entities/element/system-fields.d.ts +13 -0
  108. package/dist-sdk/src/entities/element/system-fields.js +23 -0
  109. package/dist-sdk/src/entities/element/to-tf.js +1 -0
  110. package/dist-sdk/src/entities/field/build.d.ts +9 -0
  111. package/dist-sdk/src/entities/field/from-tf.d.ts +29 -1
  112. package/dist-sdk/src/entities/field/from-tf.js +99 -6
  113. package/dist-sdk/src/entities/field/module.js +4 -0
  114. package/dist-sdk/src/entities/field/to-tf.d.ts +5 -1
  115. package/dist-sdk/src/entities/field/to-tf.js +33 -12
  116. package/dist-sdk/src/entities/org/category.js +1 -0
  117. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  118. package/dist-sdk/src/entities/org/index.js +1 -0
  119. package/dist-sdk/src/entities/org/voice-auth.d.ts +5 -0
  120. package/dist-sdk/src/entities/org/voice-auth.js +33 -0
  121. package/dist-sdk/src/entities/organization/build.d.ts +3 -0
  122. package/dist-sdk/src/entities/organization/build.js +2 -0
  123. package/dist-sdk/src/entities/organization/index.d.ts +1 -0
  124. package/dist-sdk/src/entities/organization/index.js +1 -0
  125. package/dist-sdk/src/entities/organization/to-tf.d.ts +2 -0
  126. package/dist-sdk/src/entities/organization/to-tf.js +59 -1
  127. package/dist-sdk/src/entities/organization/voice-auth.d.ts +60 -0
  128. package/dist-sdk/src/entities/organization/voice-auth.js +60 -0
  129. package/dist-sdk/src/entities/phone-service/build.d.ts +9 -1
  130. package/dist-sdk/src/entities/phone-service/build.js +1 -0
  131. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +3 -0
  132. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +1 -0
  133. package/dist-sdk/src/entities/phone-service/from-tf.js +8 -1
  134. package/dist-sdk/src/entities/phone-service/to-tf.js +16 -0
  135. package/dist-sdk/src/entities/record-create-form/from-tf.js +2 -2
  136. package/dist-sdk/src/entities/relationship/from-tf.js +7 -2
  137. package/dist-sdk/src/entities/relationship/module.js +2 -2
  138. package/dist-sdk/src/entities/relationship/pair-check.d.ts +6 -2
  139. package/dist-sdk/src/entities/relationship/pair-check.js +105 -18
  140. package/dist-sdk/src/entities/relationship/to-tf.js +5 -2
  141. package/dist-sdk/src/entities/role/permission-levels.d.ts +7 -0
  142. package/dist-sdk/src/entities/role/permission-levels.js +78 -0
  143. package/dist-sdk/src/entities/role/to-tf.js +32 -2
  144. package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
  145. package/dist-sdk/src/entities/service-account/module.js +4 -1
  146. package/dist-sdk/src/entities/service-account/resource-type.d.ts +2 -0
  147. package/dist-sdk/src/entities/service-account/resource-type.js +2 -0
  148. package/dist-sdk/src/entities/service-account/role-membership-check.d.ts +20 -0
  149. package/dist-sdk/src/entities/service-account/role-membership-check.js +80 -0
  150. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
  151. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +36 -0
  152. package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
  153. package/dist-sdk/src/entities/shared/filters/index.d.ts +85 -14
  154. package/dist-sdk/src/entities/shared/filters/index.js +18 -6
  155. package/dist-sdk/src/entities/shared/filters/option-lookups.d.ts +57 -0
  156. package/dist-sdk/src/entities/shared/filters/option-lookups.js +108 -0
  157. package/dist-sdk/src/entities/shared/filters/print.js +9 -5
  158. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +12 -7
  159. package/dist-sdk/src/entities/shared/filters/tf-codec.js +9 -5
  160. package/dist-sdk/src/entities/shared/raw-option-id.d.ts +30 -0
  161. package/dist-sdk/src/entities/shared/raw-option-id.js +41 -0
  162. package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
  163. package/dist-sdk/src/entities/skill/input-coverage.js +5 -2
  164. package/dist-sdk/src/entities/sla/build.d.ts +96 -0
  165. package/dist-sdk/src/entities/sla/build.js +124 -0
  166. package/dist-sdk/src/entities/sla/from-tf.d.ts +40 -0
  167. package/dist-sdk/src/entities/sla/from-tf.js +164 -0
  168. package/dist-sdk/src/entities/sla/index.d.ts +1 -0
  169. package/dist-sdk/src/entities/sla/index.js +1 -0
  170. package/dist-sdk/src/entities/sla/module.d.ts +4 -0
  171. package/dist-sdk/src/entities/sla/module.js +73 -0
  172. package/dist-sdk/src/entities/sla/printer.d.ts +2 -0
  173. package/dist-sdk/src/entities/sla/printer.js +84 -0
  174. package/dist-sdk/src/entities/sla/to-tf.d.ts +12 -0
  175. package/dist-sdk/src/entities/sla/to-tf.js +81 -0
  176. package/dist-sdk/src/entities/table/build.d.ts +7 -2
  177. package/dist-sdk/src/entities/table/build.js +22 -1
  178. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +4 -1
  179. package/dist-sdk/src/entities/table/from-tf.js +89 -14
  180. package/dist-sdk/src/entities/table/index.d.ts +1 -1
  181. package/dist-sdk/src/entities/table/to-tf.js +41 -2
  182. package/dist-sdk/src/entities/task/from-tf.js +2 -1
  183. package/dist-sdk/src/entities/view/from-tf.js +7 -4
  184. package/dist-sdk/src/entities/widget/from-tf.js +13 -2
  185. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +49 -4
  186. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  187. package/dist-sdk/src/graph/index.d.ts +5 -0
  188. package/dist-sdk/src/graph/index.js +7 -0
  189. package/dist-sdk/src/graph/modules.js +11 -1
  190. package/dist-sdk/src/graph/resource-types.d.ts +47 -0
  191. package/dist-sdk/src/graph/resource-types.js +62 -0
  192. package/dist-sdk/src/graph/types.d.ts +78 -6
  193. package/package.json +6 -3
@@ -0,0 +1,81 @@
1
+ import { EntityTfError } from "../../engine/entity.js";
2
+ import { filterToTf } from "../access-policy/to-tf.js";
3
+ import { appScopedResourceLabel, expr, tsLabelToTfLabel } from "../../engine/tf/index.js";
4
+ import { APP_RESOURCE_TYPE } from "../app/module.js";
5
+ import { APPROVAL_PROCESS_RESOURCE_TYPE } from "../approval-chain/module.js";
6
+ import { SLA_RESOURCE_TYPE } from "./module.js";
7
+ export function slaToTf(entity, ctx) {
8
+ if (entity.kind !== "sla")
9
+ throw new EntityTfError(`slaToTf expects kind "sla"; got "${entity.kind}"`);
10
+ const payload = entity.payload;
11
+ if (payload === null)
12
+ throw new EntityTfError(`sla "${entity.refName}" has no payload`);
13
+ const approvalOwned = payload.approvalProcess !== undefined;
14
+ if (approvalOwned) {
15
+ if (payload.approvalProcess?.parent !== ctx.appRefName) {
16
+ throw new EntityTfError(`sla "${entity.refName}" approval process is not under owning app "${ctx.appRefName}"`);
17
+ }
18
+ }
19
+ else if (payload.app?.refName !== ctx.appRefName) {
20
+ throw new EntityTfError(`sla "${entity.refName}" does not reference owning app "${ctx.appRefName}"`);
21
+ }
22
+ const label = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName));
23
+ const attrs = {
24
+ name: payload.name ?? "",
25
+ ...(payload.description !== undefined ? { description: payload.description } : {}),
26
+ active: payload.active ?? true,
27
+ targets: (payload.targets ?? []).map((target, index) => {
28
+ const base = {
29
+ name: target.name ?? "",
30
+ time_period: target.timePeriod ?? 0,
31
+ time_unit: target.timeUnit ?? "",
32
+ working_start_time: target.workingStartTime ?? "",
33
+ working_end_time: target.workingEndTime ?? "",
34
+ ...(target.workingTimezone !== undefined ? { working_timezone: target.workingTimezone } : {}),
35
+ working_week_days: [...(target.workingWeekDays ?? [])],
36
+ };
37
+ if (target.filter !== undefined) {
38
+ base["filter"] = filterToTf(target.filter, `elementum_sla.${label}.targets[${index}].filter`, {
39
+ ownerTfLabel: ctx.appTfLabel,
40
+ appRefName: ctx.appRefName,
41
+ ownerRefName: ctx.appRefName,
42
+ scope: "app",
43
+ objectId: expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]),
44
+ diagnostics: ctx.diagnostics ?? [],
45
+ resolvePicklistLiterals: false,
46
+ ...(ctx.fieldAddresses !== undefined ? { fieldAddresses: ctx.fieldAddresses } : {}),
47
+ });
48
+ }
49
+ if (target.approval !== undefined) {
50
+ const approval = {};
51
+ if (target.approval.entityType !== undefined)
52
+ approval["entity_type"] = target.approval.entityType;
53
+ if (Object.keys(approval).length > 0)
54
+ base["approval"] = approval;
55
+ }
56
+ return base;
57
+ }),
58
+ };
59
+ if (approvalOwned) {
60
+ const processTfLabel = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(payload.approvalProcess.refName ?? ""));
61
+ attrs["approval_process_id"] = expr.resourceAttr(APPROVAL_PROCESS_RESOURCE_TYPE, processTfLabel, ["id"]);
62
+ }
63
+ else {
64
+ attrs["app_id"] = expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]);
65
+ attrs["stage_ids"] = (payload.stages ?? []).map((stage) => expr.local(`${ctx.appTfLabel}_stage_ids_by_key`, [{ index: stageIndex(entity.refName, stage, ctx.stageKeyByTfLabel) }]));
66
+ }
67
+ const block = { kind: "resource", type: SLA_RESOURCE_TYPE, label, attrs };
68
+ return { blocks: [block], address: `${SLA_RESOURCE_TYPE}.${label}` };
69
+ }
70
+ function stageIndex(refName, stage, stageKeyByTfLabel) {
71
+ const tfLabel = tsLabelToTfLabel(stage);
72
+ if (stageKeyByTfLabel === undefined)
73
+ return tfLabel;
74
+ const key = stageKeyByTfLabel.get(tfLabel);
75
+ if (key !== undefined)
76
+ return key;
77
+ if ([...stageKeyByTfLabel.values()].includes(stage))
78
+ return stage;
79
+ const known = [...new Set(stageKeyByTfLabel.keys())].sort().join(", ");
80
+ throw new EntityTfError(`sla "${refName}": stage "${stage}" is not a stage of the owning app (stages: ${known})`);
81
+ }
@@ -42,6 +42,11 @@ export declare function databricksTableMapping(opts: {
42
42
  readonly schema: string;
43
43
  readonly table: string;
44
44
  }): CloudMapping;
45
+ /** A table row window. The platform Limit scalar is `{ count, offset }`. */
46
+ export interface TableLimit {
47
+ readonly count: number;
48
+ readonly offset?: number;
49
+ }
45
50
  export declare function snowflakeTableView(opts: {
46
51
  readonly database: string;
47
52
  readonly schema: string;
@@ -68,7 +73,7 @@ export interface DefineTableV2Options<Columns extends Readonly<Record<string, Ta
68
73
  readonly color?: string;
69
74
  readonly cloudMapping?: CloudMapping;
70
75
  readonly filter?: Filter;
71
- readonly limit?: unknown;
76
+ readonly limit?: TableLimit;
72
77
  readonly orderBy?: unknown;
73
78
  }
74
79
  export interface TableAuthoringPayload {
@@ -85,7 +90,7 @@ export interface TableAuthoringPayload {
85
90
  readonly color?: string;
86
91
  readonly cloudMapping?: Record<string, unknown>;
87
92
  readonly filter?: Filter;
88
- readonly limit?: unknown;
93
+ readonly limit?: TableLimit;
89
94
  readonly orderBy?: unknown;
90
95
  }
91
96
  type TableColumnRefs<Columns extends Readonly<Record<string, TableColumn>>, Parent extends string> = {
@@ -19,6 +19,27 @@ export function bigQueryTableMapping(opts) {
19
19
  export function databricksTableMapping(opts) {
20
20
  return { cloudLink: opts.cloudLink, databricks: { databaseName: opts.database, schemaName: opts.schema, tableName: opts.table } };
21
21
  }
22
+ function nonNegativeInteger(value) {
23
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
24
+ }
25
+ /** Rejects a bare number and any shape other than `{ count, offset? }`. */
26
+ function tableLimitFromAuthoring(value, where) {
27
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
28
+ throw new EdkValidationError(`${where} must be { count, offset? } with a non-negative integer count.`);
29
+ }
30
+ const rec = value;
31
+ const extra = Object.keys(rec).filter((key) => key !== "count" && key !== "offset");
32
+ if (extra.length > 0) {
33
+ throw new EdkValidationError(`${where} only carries count and offset.`);
34
+ }
35
+ if (!nonNegativeInteger(rec.count)) {
36
+ throw new EdkValidationError(`${where}.count must be a non-negative integer.`);
37
+ }
38
+ if (rec.offset !== undefined && !nonNegativeInteger(rec.offset)) {
39
+ throw new EdkValidationError(`${where}.offset must be a non-negative integer.`);
40
+ }
41
+ return { count: rec.count, ...(rec.offset !== undefined ? { offset: rec.offset } : {}) };
42
+ }
22
43
  export function snowflakeTableView(opts) {
23
44
  return { snowflake: { databaseName: opts.database, schemaName: opts.schema, name: opts.name } };
24
45
  }
@@ -60,7 +81,7 @@ function payloadFor(opts, refName) {
60
81
  ...(joins != null && joins.length > 0 ? { joins } : {}),
61
82
  ...(opts.view !== undefined ? { views: [opts.view] } : {}),
62
83
  ...(opts.filter !== undefined ? { filter: opts.filter } : {}),
63
- ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
84
+ ...(opts.limit !== undefined ? { limit: tableLimitFromAuthoring(opts.limit, "table limit") } : {}),
64
85
  ...(opts.orderBy !== undefined ? { orderBy: opts.orderBy } : {}),
65
86
  });
66
87
  }
@@ -37,7 +37,10 @@ export interface NormalizedTable {
37
37
  readonly description?: string;
38
38
  readonly icon?: string;
39
39
  readonly color?: string;
40
- readonly limit?: number;
40
+ readonly limit?: {
41
+ readonly count: number;
42
+ readonly offset?: number;
43
+ };
41
44
  readonly orderBy?: unknown;
42
45
  readonly filter?: Filter<NormalizedTableFilterField, TfValue>;
43
46
  readonly joins: readonly NormalizedJoin[];
@@ -3,7 +3,29 @@ import { isTfExpr, sanitizeName, snakeSlug, tfLabelToTsLabel, tsLabelToTfLabel }
3
3
  import { tableDataminesFromTf } from "../datamine/from-tf.js";
4
4
  import { TABLE_RESOURCE_TYPE } from "./module.js";
5
5
  import { EntityTfError } from "../../engine/entity.js";
6
+ import { catalogRefForAspectOwner } from "../shared/aspect-target-from-tf.js";
6
7
  import { filterFromTf } from "../shared/filters/tf-codec.js";
8
+ import { optionLookupDecode } from "../shared/filters/option-lookups.js";
9
+ function nonNegativeInteger(value) {
10
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
11
+ }
12
+ /** A present limit that is not {count, offset} fails the pull. Dropping it would clear the live limit on the next apply (#2679). */
13
+ function tableLimitFromAttr(value, where) {
14
+ const rec = plainObject(value);
15
+ if (rec === undefined)
16
+ throw new EntityTfError(`${where} must be { count, offset }`);
17
+ const extra = Object.keys(rec).filter((key) => key !== "count" && key !== "offset");
18
+ if (extra.length > 0)
19
+ throw new EntityTfError(`${where} only carries count and offset`);
20
+ const count = rec["count"];
21
+ const offset = rec["offset"];
22
+ if (!nonNegativeInteger(count))
23
+ throw new EntityTfError(`${where}.count must be a non-negative integer`);
24
+ if (offset !== undefined && offset !== null && !nonNegativeInteger(offset)) {
25
+ throw new EntityTfError(`${where}.offset must be a non-negative integer`);
26
+ }
27
+ return { count, ...(nonNegativeInteger(offset) ? { offset } : {}) };
28
+ }
7
29
  function str(obj, key) {
8
30
  return typeof obj[key] === "string" ? obj[key] : undefined;
9
31
  }
@@ -12,18 +34,65 @@ function stringList(value) {
12
34
  return undefined;
13
35
  return value;
14
36
  }
15
- function sourceRef(value) {
16
- for (const [kind, type] of [
17
- ["app", "elementum_app"],
18
- ["element", "elementum_element"],
19
- ["table", "elementum_table"],
20
- ]) {
21
- const label = dataRefLabel(value, type) ?? resourceRefLabel(value, type);
22
- if (label !== undefined)
23
- return { kind, refName: tfLabelToTsLabel(label) };
37
+ const SOURCE_TYPES = [
38
+ ["app", "elementum_app"],
39
+ ["element", "elementum_element"],
40
+ ["table", "elementum_table"],
41
+ ];
42
+ function ownerLabel(value) {
43
+ for (const [kind, type] of SOURCE_TYPES) {
44
+ const dataLabel = dataRefLabel(value, type);
45
+ if (dataLabel !== undefined)
46
+ return { kind, type, label: dataLabel, data: true };
47
+ const resourceLabel = resourceRefLabel(value, type);
48
+ if (resourceLabel !== undefined)
49
+ return { kind, type, label: resourceLabel, data: false };
24
50
  }
25
51
  return undefined;
26
52
  }
53
+ function stringAttr(attrs, key) {
54
+ const value = attrs?.[key];
55
+ return typeof value === "string" && value !== "" ? value : undefined;
56
+ }
57
+ /**
58
+ * Catalog key for an app or element source. The export labels the resource
59
+ * by sanitized namespace, which is not the workspace refName when the two
60
+ * differ (#2667). The field-label prefix stays the export label; only the
61
+ * catalog key is remapped.
62
+ */
63
+ function aspectOwnerRefName(ctx, owner) {
64
+ const attrs = owner.data
65
+ ? ctx.dataAttrs?.(owner.type, owner.label)
66
+ : ctx.resourceByAddress?.(`${owner.type}.${owner.label}`)?.attrs;
67
+ const namespace = stringAttr(attrs, "namespace");
68
+ const name = owner.data
69
+ ? ctx.dataName(owner.type, owner.label) ?? stringAttr(attrs, "name")
70
+ : stringAttr(attrs, "name");
71
+ return catalogRefForAspectOwner({
72
+ ...(namespace !== undefined && { namespace }),
73
+ ...(name !== undefined && { name }),
74
+ tfLabel: owner.label,
75
+ refNamesByNamespace: owner.kind === "app" ? ctx.foreignAppRefNamespaces : ctx.foreignElementRefNamespaces,
76
+ refNamesByName: owner.kind === "app" ? ctx.foreignAppRefNames : ctx.foreignElementRefNames,
77
+ }) ?? tfLabelToTsLabel(owner.label);
78
+ }
79
+ function sourceRef(value, ctx) {
80
+ const owner = ownerLabel(value);
81
+ if (owner === undefined)
82
+ return undefined;
83
+ if (owner.kind !== "app" && owner.kind !== "element") {
84
+ return { kind: "table", refName: tfLabelToTsLabel(owner.label) };
85
+ }
86
+ return {
87
+ kind: owner.kind,
88
+ refName: aspectOwnerRefName(ctx, {
89
+ kind: owner.kind,
90
+ type: owner.type,
91
+ label: owner.label,
92
+ data: owner.data,
93
+ }),
94
+ };
95
+ }
27
96
  function rawRef(value) {
28
97
  if (typeof value === "string")
29
98
  return value;
@@ -44,10 +113,14 @@ function fieldSourceRef(value, ctx) {
44
113
  if (fieldLabel === undefined)
45
114
  return undefined;
46
115
  const attrs = ctx.dataAttrs?.("elementum_field", fieldLabel);
47
- const owner = sourceRef(attrs?.["object_id"]);
116
+ const ownerValue = attrs?.["object_id"];
117
+ const owner = sourceRef(ownerValue, ctx);
48
118
  if (owner === undefined)
49
119
  return undefined;
50
- const prefix = `${owner.refName}_`;
120
+ // Column labels are prefixed with the export label (the sanitized
121
+ // namespace), not the workspace refName the catalog is keyed by.
122
+ const prefixLabel = ownerLabel(ownerValue)?.label;
123
+ const prefix = `${prefixLabel === undefined ? owner.refName : tfLabelToTsLabel(prefixLabel)}_`;
51
124
  const fieldPart = fieldLabel.startsWith(prefix) ? fieldLabel.slice(prefix.length) : fieldLabel;
52
125
  if (owner.kind === "table")
53
126
  return { kind: "tableColumn", parentRefName: owner.refName, refName: tfLabelToTsLabel(fieldPart) };
@@ -108,6 +181,8 @@ function tableFilterFromTf(value, tableTfLabel, columnKeyByName, ctx, where) {
108
181
  return filterFromTf(value, {
109
182
  field: (field) => tableFilterFieldFromTf(field, tableTfLabel, columnKeyByName, ctx, where),
110
183
  reference: () => { throw new EntityTfError("table filters do not support reference values"); },
184
+ // #2582: a stored option lookup prints as filter.textOption(label).
185
+ ...optionLookupDecode,
111
186
  });
112
187
  }
113
188
  function tableFilterFieldFromTf(value, tableTfLabel, columnKeyByName, ctx, where) {
@@ -212,7 +287,7 @@ export function tableFromTf(block, ctx, datamineBlocks = []) {
212
287
  const join = plainObject(item);
213
288
  if (join === undefined)
214
289
  return [];
215
- const joinedSource = sourceRef(join["source_id"]);
290
+ const joinedSource = sourceRef(join["source_id"], ctx);
216
291
  return [{
217
292
  type: (str(join, "type") ?? "LEFT"),
218
293
  ...(joinedSource !== undefined && { sourceRef: joinedSource }),
@@ -228,7 +303,7 @@ export function tableFromTf(block, ctx, datamineBlocks = []) {
228
303
  }];
229
304
  });
230
305
  const categoryLabel = dataRefLabel(attrs["category_id"], "elementum_category");
231
- const source = sourceRef(attrs["source_id"]);
306
+ const source = sourceRef(attrs["source_id"], ctx);
232
307
  const sourceID = typeof attrs["source_id"] === "string" ? attrs["source_id"] : undefined;
233
308
  const view = dataView(attrs);
234
309
  const datamines = tableDataminesFromTf(datamineBlocks, tableTfLabel, columnKeyByName, ctx, new Map(columns.flatMap((column) => [column.state.id, column.sourceFieldId]
@@ -246,7 +321,7 @@ export function tableFromTf(block, ctx, datamineBlocks = []) {
246
321
  ...(optionalString(attrs, "description", `table ${block.label}`, ctx) !== undefined && { description: optionalString(attrs, "description", `table ${block.label}`, ctx) }),
247
322
  ...(optionalString(attrs, "icon", `table ${block.label}`, ctx) !== undefined && { icon: optionalString(attrs, "icon", `table ${block.label}`, ctx) }),
248
323
  ...(optionalString(attrs, "color", `table ${block.label}`, ctx) !== undefined && { color: optionalString(attrs, "color", `table ${block.label}`, ctx) }),
249
- ...(typeof attrs["limit"] === "number" && { limit: attrs["limit"] }),
324
+ ...(attrs["limit"] !== undefined && attrs["limit"] !== null && { limit: tableLimitFromAttr(attrs["limit"], `elementum_table.${block.label}.limit`) }),
250
325
  ...(attrs["order_by"] !== undefined && { orderBy: orderBy(attrs["order_by"]) }),
251
326
  ...(attrs["filter"] !== undefined && {
252
327
  filter: tableFilterFromTf(attrs["filter"], tableTfLabel, columnKeyByName, ctx, `elementum_table.${tableTfLabel}.filter`),
@@ -2,7 +2,7 @@
2
2
  * v2 table authoring — `table`. Org-owned top-level entity.
3
3
  * Standalone from v1's `src/tables`.
4
4
  */
5
- export { table, bigQueryTableMapping, databricksTableMapping, snowflakeTableMapping, snowflakeTableView, tablePayloadToCreateRequest, tablePayloadToReadOnlyUpdateRequest, tablePayloadToUpdateRequest, type DefineTableV2Options, type TableAuthoringPayload, type TableConfigured, type TableView, } from "./build.js";
5
+ export { table, bigQueryTableMapping, databricksTableMapping, snowflakeTableMapping, snowflakeTableView, tablePayloadToCreateRequest, tablePayloadToReadOnlyUpdateRequest, tablePayloadToUpdateRequest, type DefineTableV2Options, type TableAuthoringPayload, type TableLimit, type TableConfigured, type TableView, } from "./build.js";
6
6
  export { type TableDatamine, type DatamineSchedule, type DatamineTimeUnit } from "../datamine/build.js";
7
7
  export { calculationColumn, bigQueryColumn, serializeTableField, snowflakeColumn, sourceColumn, tableAggregation, tableColumnTag, tableColumnType, tableExpansion, type CalculationColumnOptions, type SourceColumnOptions, type TableAggregation, type TableColumn, type TableColumnTag, type TableColumnType, type TableCalculationField, type TableCloudField, type TableField, type TableExpansion, type TableReferenceField, } from "./fields.js";
8
8
  export { serializeJoin, tableJoin, tableJoinType, type TableJoinFieldPair, type TableJoin, type TableJoinOptions, type TableJoinType, } from "./joins.js";
@@ -8,7 +8,29 @@ import { tableDataminesToTf, } from "../datamine/to-tf.js";
8
8
  import { authoredFieldKeysFromPayload, fieldRefToTfValue } from "../field/to-tf.js";
9
9
  import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
10
10
  import { filterToTf as serializeFilterToTf } from "../shared/filters/tf-codec.js";
11
+ import { optionSelectionLiteral, optionsLocalName } from "../shared/filters/option-lookups.js";
11
12
  import { TABLE_RESOURCE_TYPE } from "./module.js";
13
+ function nonNegativeInteger(value) {
14
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
15
+ }
16
+ /**
17
+ * The platform's Limit scalar is {count, offset}; offset is written even when
18
+ * it is the default 0 so build matches what export writes (#2679).
19
+ */
20
+ function tableLimitToTf(limit, where) {
21
+ if (limit === null || typeof limit !== "object" || Array.isArray(limit)) {
22
+ throw new EntityTfError(`${where} must be { count, offset? }`);
23
+ }
24
+ const extra = Object.keys(limit).filter((key) => key !== "count" && key !== "offset");
25
+ if (extra.length > 0)
26
+ throw new EntityTfError(`${where} only carries count and offset`);
27
+ if (!nonNegativeInteger(limit.count))
28
+ throw new EntityTfError(`${where}.count must be a non-negative integer`);
29
+ if (limit.offset !== undefined && !nonNegativeInteger(limit.offset)) {
30
+ throw new EntityTfError(`${where}.offset must be a non-negative integer`);
31
+ }
32
+ return { count: limit.count, offset: limit.offset ?? 0 };
33
+ }
12
34
  function tableColumnName(column) {
13
35
  for (const kind of ["cloud", "calculation", "reference"]) {
14
36
  const value = column[kind];
@@ -108,6 +130,23 @@ function tableFilterToTf(filter, orgRefs, ownRef, ownLabel, ownColumnNames, work
108
130
  field: (field) => fieldId(field, orgRefs, ownRef, ownLabel, ownColumnNames, workspaceAspects, diagnostics),
109
131
  aspect: (aspect) => aspectId(aspect, orgRefs, workspaceAspects, diagnostics, "table filter aspect"),
110
132
  reference: () => { throw new EntityTfError("table filters do not support reference values"); },
133
+ // #2582: a Dropdown option is selected with filter.textOption(label).
134
+ literal: optionSelectionLiteral({
135
+ where: `table ${ownRef} filter`,
136
+ address: `${TABLE_RESOURCE_TYPE}.${ownLabel}`,
137
+ name: ownRef,
138
+ ownerKind: "table",
139
+ optionsLocal: (field) => {
140
+ const ref = field;
141
+ if (ref.__kind !== "field")
142
+ return undefined;
143
+ const kind = ref.parentKind ?? "app";
144
+ if (kind !== "app" && kind !== "element")
145
+ return undefined;
146
+ const local = workspaceAspects?.get(workspaceAspectKey(kind, ref.parent ?? ""));
147
+ return local === undefined ? undefined : optionsLocalName(local.tfLabel, kind, field);
148
+ },
149
+ }),
111
150
  });
112
151
  }
113
152
  export function tableToTf(entity, ctx) {
@@ -208,8 +247,8 @@ export function tableToTf(entity, ctx) {
208
247
  if (p.filter !== undefined) {
209
248
  attrs["filter"] = tableFilterToTf(p.filter, ctx.orgRefs, entity.refName, label, columnNames, ctx.workspaceAspects, ctx.diagnostics);
210
249
  }
211
- if (typeof p.limit === "number")
212
- attrs["limit"] = p.limit;
250
+ if (p.limit !== undefined)
251
+ attrs["limit"] = tableLimitToTf(p.limit, `table ${entity.refName} limit`);
213
252
  if (p.orderBy !== undefined)
214
253
  attrs["order_by"] =
215
254
  typeof p.orderBy === "string"
@@ -28,7 +28,8 @@ export function taskFromTf(block, ctx, fieldBlocks = []) {
28
28
  const statusDescription = optionalString(block.attrs, "status_field_description", `task ${block.label}`, ctx);
29
29
  const refName = tfLabelToTsLabel(block.label);
30
30
  const owner = { type: TASK_RESOURCE_TYPE, label: block.label, scope: "task", refName };
31
- const fields = fieldBlocks.flatMap((fieldBlock) => fieldFromTf(fieldBlock, owner, ctx) ?? []);
31
+ const usedFieldKeys = new Set();
32
+ const fields = fieldBlocks.flatMap((fieldBlock) => fieldFromTf(fieldBlock, owner, ctx, usedFieldKeys) ?? []);
32
33
  return { refName, name, handle, namespace,
33
34
  ...(fields.length > 0 && { fields }),
34
35
  ...(categoryLabel !== undefined && { categoryRef: tfLabelToTsLabel(categoryLabel) }),
@@ -13,7 +13,7 @@ import { SYSTEM_FIELD_KEY_SET } from "../../core/system-fields.js";
13
13
  import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
14
14
  import { expr, isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
15
15
  import { lostStageMessage, pulledStageHandle } from "../app/stage-keys.js";
16
- import { decodeForeignDataField, fieldBlockOwner, fieldKeyFromForeignDataLabel, fieldKeyFromTfValue, ownerMayHaveCustomField } from "../field/from-tf.js";
16
+ import { decodeForeignDataField, elementAuditFieldReference, fieldBlockOwner, fieldKeyFromForeignDataLabel, fieldKeyFromTfValue, ownerMayHaveCustomField } from "../field/from-tf.js";
17
17
  import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
18
18
  import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
19
19
  import { DASHBOARD_WIDGET_RESOURCE_TYPE } from "../dashboard-widget/module.js";
@@ -327,7 +327,10 @@ function agentViewFromTf(block, owner, ctx) {
327
327
  }
328
328
  const agentLabel = resourceRefLabel(attrs["agent_id"], "elementum_agent");
329
329
  if (agentLabel === undefined) {
330
- ctx.diagnostics.push(`${where}: agent_id is not an elementum_agent resource reference; skipped`);
330
+ // An agent_id that isn't a resource reference can't be built; leave the
331
+ // view unmanaged so adoption does not import it.
332
+ ctx.diagnostics.push(`${where}: agent_id is not an elementum_agent resource reference; the view is left unmanaged so it is not destroyed`);
333
+ ctx.skipped.push(`${AGENT_VIEW_RESOURCE_TYPE}.${label}`);
331
334
  return undefined;
332
335
  }
333
336
  const scope = owner.scope ?? "app";
@@ -543,7 +546,7 @@ function fieldRefFromTf(v, owner, ctx, site) {
543
546
  const ownerLabel = owner.label;
544
547
  const fieldKey = fieldKeyFromTfValue(v, tfLabelToTsLabel(ownerLabel), owner.ownerTfLabel, owner.scope ?? "app", ctx);
545
548
  if (fieldKey !== undefined)
546
- return keptIdOrKey(unextractedFieldId(v, fieldKey, owner, ctx, site), fieldKey);
549
+ return keptIdOrKey(unextractedFieldId(v, fieldKey, owner, ctx, site), elementAuditFieldReference(v, fieldKey, owner, ctx));
547
550
  const ownData = ownDataFieldRef(v, owner, ctx, site, false);
548
551
  if (ownData !== undefined)
549
552
  return authoredRef(ownData);
@@ -573,7 +576,7 @@ function fieldRefFromTf(v, owner, ctx, site) {
573
576
  const attr = v.name.startsWith(`${ownerLabel}_`) ? v.name.slice(ownerLabel.length + 1) : undefined;
574
577
  const systemKey = attr !== undefined ? SYSTEM_FIELD_KEY_BY_ID_ATTR.get(attr) : undefined;
575
578
  if (systemKey !== undefined)
576
- return systemKey;
579
+ return elementAuditFieldReference(v, systemKey, owner, ctx);
577
580
  }
578
581
  // Custom field ref resolution is shared with agent-tool's field refs
579
582
  // (src/entities/agent-tool/from-tf.ts) via entities/field/from-tf.ts.
@@ -1,5 +1,5 @@
1
1
  import { typedCoverageGap } from "../../engine/coverage-gaps.js";
2
- import { dataRefLabel, optionalBoolean, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
2
+ import { dataRefLabel, optionalBoolean, optionalString, plainObject, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
3
3
  import { bareChildResourceLabel, isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
4
4
  import { AUTOMATION_RESOURCE_TYPE } from "../automation/types.js";
5
5
  import { decodeForeignDataField, fieldKeyFromTfRef } from "../field/from-tf.js";
@@ -42,7 +42,18 @@ function widgetFromTf(block, owner, ctx, dynamicLayoutCompanionLabels) {
42
42
  ctx.diagnostics.push(`${where}.${variant}: expected an object; skipped`);
43
43
  return undefined;
44
44
  }
45
- const name = optionalString(body, "name", `${where}.${variant}`, ctx) ?? "";
45
+ // name is required and build always sends it, so a value pull cannot read
46
+ // must not become "" (that would blank the live button on the next apply,
47
+ // edk#2509). Refuse to author it instead.
48
+ const nameRaw = body["name"];
49
+ if (typeof nameRaw !== "string") {
50
+ reportAuthoringBlocker(ctx, {
51
+ address: where,
52
+ description: `${where}.${variant}.name is ${nameRaw === undefined ? "missing" : `not a string (${JSON.stringify(nameRaw)})`}, so pull cannot write the widget's name and build would send "".`,
53
+ remedy: "Export did not write the widget's name as text. Pull again with the current EDK; if it persists, report it to the EDK maintainers.",
54
+ });
55
+ }
56
+ const name = typeof nameRaw === "string" ? nameRaw : "";
46
57
  if (variant === "related_object") {
47
58
  const target = aspectRef(body["object_id"], owner, ctx);
48
59
  if (target === undefined)
@@ -6,7 +6,7 @@ export type ElementumBlocksSpec = {
6
6
  export type ElementumBlocks = {
7
7
  readonly [key: string]: ElementumBlocksElement;
8
8
  };
9
- export type ElementumBlocksElement = (StackBlockElement) | (RowBlockElement) | (PanesBlockElement) | (ListControlsBlockElement) | (ListCollectionBlockElement) | (HeaderBlockElement) | (BodyBlockElement) | (BulletsBlockElement) | (DetailsListBlockElement) | (DetailsFieldsBlockElement) | (DividerBlockElement) | (SpacerBlockElement) | (CardBlockElement) | (DataTableBlockElement) | (ActionCardBlockElement) | (ChartBlockElement) | (MetricsRowBlockElement) | (PageHeaderBlockElement) | (ButtonBlockElement);
9
+ export type ElementumBlocksElement = (StackBlockElement) | (RowBlockElement) | (PanesBlockElement) | (ListControlsBlockElement) | (ListCollectionBlockElement) | (HeaderBlockElement) | (BodyBlockElement) | (BulletsBlockElement) | (DetailsListBlockElement) | (DetailsFieldsBlockElement) | (DividerBlockElement) | (SpacerBlockElement) | (CardBlockElement) | (DataTableBlockElement) | (ActionCardBlockElement) | (ChartBlockElement) | (MetricsRowBlockElement) | (PageHeaderBlockElement) | (ButtonBlockElement) | (ImageBlockElement) | (TabsBlockElement);
10
10
  /**
11
11
  * Customer-facing name: Stack
12
12
  * Customer-facing description: Stacks blocks from top to bottom with even spacing. Valid as the page root for simple portal or report layouts, and as a vertical section under Panes for process and list-to-record views.
@@ -102,7 +102,7 @@ export type PanesBlockProps = {
102
102
  /**
103
103
  * Customer-facing name: List controls
104
104
  * Customer-facing description: Search, filters, grouping, and sort controls that sit above a list.
105
- * Internal authoring guidance: Toolbar of search, quick filters, filter popover, group-by, and sort. Prefer a `kind: "filters"` list. `kind: "statusGroups"` is legacyStatusGroups: Open/Closed only, with no All chip. If a spec already has legacyStatusGroups or filterPreset and the user is changing filters, rewrite them into one `kind: "filters"` list. Put a preset filter on the chips that should include it. Do not leave filterPreset beside that list. Bind quickFilterValue to $bindState: "/query/statusGroup". Bind filterJson to $bindState: "/query/filter". When a view has more than one App, bind every App to /query/filter/<aspectId> and /query/statusGroup/<aspectId>. A view with one App keeps the shared paths. filterJson is the menu filter the list uses, besides the managed filter. A kind: "filters" chip writes its filter there. legacyStatusGroups writes the preset and Open/Closed there together. A preset alone fills the menu when there is no chip list. The All chip and a cleared filter menu do not return to this preset. The block applies the managed filter at query time and does not store it in filterJson. This block writes that JSON; self-fetching siblings on the same App bound to the same path refetch from it. Looks like list chrome above a collection, not the results themselves. `field` is the aspect field id, not the display name. A picklist value is { "type": "TEXT", "value": "<id>" }. Do not use `UUID` for that id. A dynamic id is the related record id `aspectId:handle`, still `TEXT`. `AspectPicklistField` uses `EQUALS`. `AspectMultiPicklistField` uses `CONTAINS` with one `TEXT` value. Open/Closed chips are statusGroup with filter omitted: { id, label, statusGroup: "open" | "closed" }. The toolbar builds that clause from the STATUS field and every CLOSED picklist tag and writes it into filterJson. Open is status not in those values. Closed is status in those values. Do not author that tree, do not use the STAGE field, and do not use the words "open" or "closed" as values. A specific status such as Pending is a normal chip filter: STATUS field id, value id from findPicklistValue, EQUALS, TEXT value. All is filter null and no statusGroup, only when the admin asks. Mix All, statusGroup chips, and named chips in one `kind: "filters"` list. A chip that already has `filter` uses that tree. Put the admin default on sortPreset as a Sort document with aspect field ids in orders[].field. orders may contain more than one key: the first key orders records, each later key orders ties, and direction is set per key. Put the same sortPreset on ListControlsBlock and on the ListCollectionBlock or DataTableBlock that owns the default. Bind sortJson to $bindState: "/query/sort" on both. When a view has more than one App, bind each App’s ListControlsBlock and ListCollectionBlock or DataTableBlock to /query/sort/<aspectId>, matching the filter and quick-filter paths. ListControls writes the live sort and /query/sortAspectId from filterAspectId. Keep sort out of filterJson. The menu offers system fields by semantic tag, then custom text, number, decimal, date, datetime, checkbox, single picklist, user, and group fields; it omits multi-picklist, attachment, and JSON fields. Restore copies sortPreset back into sortJson during the visit.
105
+ * Internal authoring guidance: Toolbar of search, quick filters, filter popover, group-by, and sort. Prefer a `kind: "filters"` list. `kind: "statusGroups"` is legacyStatusGroups: Open/Closed only, with no All chip. If a spec already has legacyStatusGroups or filterPreset and the user is changing filters, rewrite them into one `kind: "filters"` list. Put a preset filter on the chips that should include it. Do not leave filterPreset beside that list. Bind quickFilterValue to $bindState: "/query/statusGroup". Bind filterJson to $bindState: "/query/filter". When a view has more than one App, bind every App to /query/filter/<aspectId> and /query/statusGroup/<aspectId>. A view with one App keeps the shared paths. Exception: independent ListControls/list pairs on the same App, including in a multi-App view, use /query/filter/{blockKey} and /query/statusGroup/{blockKey}. For independent same-aspect ListControls/list pairs, give each control a stable element key and bind the control and its paired list to /query/filter/{blockKey} and /query/statusGroup/{blockKey}; each pair may define different quickFilters chips. Shared and aspect-scoped paths remain first-class for one shared pair or different Apps. filterJson is the menu filter the list uses, besides the managed filter. A kind: "filters" chip writes its filter there. legacyStatusGroups writes the preset and Open/Closed there together. A preset alone fills the menu when there is no chip list. The All chip and a cleared filter menu do not return to this preset. The block applies the managed filter at query time and does not store it in filterJson. This block writes that JSON; self-fetching siblings on the same App bound to the same path refetch from it. Looks like list chrome above a collection, not the results themselves. `field` is the aspect field id, not the display name. A picklist value is { "type": "TEXT", "value": "<id>" }. Do not use `UUID` for that id. A dynamic id is the related record id `aspectId:handle`, still `TEXT`. `AspectPicklistField` uses `EQUALS`. `AspectMultiPicklistField` uses `CONTAINS` with one `TEXT` value. Open/Closed chips are statusGroup with filter omitted: { id, label, statusGroup: "open" | "closed" }. The toolbar builds that clause from the STATUS field and every CLOSED picklist tag and writes it into filterJson. Open is status not in those values. Closed is status in those values. Do not author that tree, do not use the STAGE field, and do not use the words "open" or "closed" as values. A specific status such as Pending is a normal chip filter: STATUS field id, value id from findPicklistValue, EQUALS, TEXT value. All is filter null and no statusGroup, only when the admin asks. Mix All, statusGroup chips, and named chips in one `kind: "filters"` list. A chip that already has `filter` uses that tree. Put the admin default on sortPreset as a Sort document with aspect field ids in orders[].field. orders may contain more than one key: the first key orders records, each later key orders ties, and direction is set per key. Put the same sortPreset on ListControlsBlock and on the ListCollectionBlock or DataTableBlock that owns the default. Bind sortJson to $bindState: "/query/sort" on both. When a view has more than one App, bind each App’s ListControlsBlock and ListCollectionBlock or DataTableBlock to /query/sort/<aspectId>, matching the filter and quick-filter paths. ListControls writes the live sort and /query/sortAspectId from filterAspectId. Keep sort out of filterJson. The menu offers system fields by semantic tag, then custom text, number, decimal, date, datetime, checkbox, single picklist, user, and group fields; it omits multi-picklist, attachment, and JSON fields. Restore copies sortPreset back into sortJson during the visit.
106
106
  */
107
107
  export type ListControlsBlockElement = {
108
108
  readonly type: "ListControlsBlock";
@@ -167,7 +167,7 @@ export type ListControlsOption = {
167
167
  /**
168
168
  * Customer-facing name: Record list
169
169
  * Customer-facing description: A compact stacked list of records with titles and status pills. Use it for queues and pickers.
170
- * Internal authoring guidance: Dual presentational/self-fetching selectable stacked list with title, identifier, pills, and optional collapsible groups. Place every ListCollectionBlock under a root PanesBlock so clicks can support secondary/detail panes. Use items for authored content, or aspectId/search/filter props for live records; self-fetching falls back to the runtime default aspect. Optional density: "compact" | "standard" | "comfortable" (List View names); omit to keep today’s spacing. Live lists show a matching record count in the collection footer. Set showExport: true to show Export in the top-right of the collection; omit or false keeps Export hidden. Optional fields is an ordered string[] of real aspect field ids shown as labeled attribute chips beside each title (user/group avatars, picklist color, locale dates, number/currency). Omit fields to keep today’s fixed system pills; when fields is set, do not also expect those pills. Never invent field UUIDs; resolve ids from Owning App fields when the admin asks in plain language (for example "show Team and Priority on each row"). To share a ListControls filter, bind filterJson and use the same filterPreset on this list; state changes refetch it. When a view has more than one App, bind every App to /query/filter/<aspectId> and /query/statusGroup/<aspectId>. A view with one App keeps the shared paths. Use filterPreset without that binding only for an independent list seed. Looks like a ticket queue, not a spreadsheet. Prefer DataTableBlock for dense columns.
170
+ * Internal authoring guidance: Dual presentational/self-fetching selectable stacked list with title, identifier, pills, and optional collapsible groups. Place every ListCollectionBlock under a root PanesBlock so clicks can support secondary/detail panes. Use items for authored content, or aspectId/search/filter props for live records; self-fetching falls back to the runtime default aspect. Optional density: "compact" | "standard" | "comfortable" (List View names); omit to keep today’s spacing. Live lists show a matching record count in the collection footer. Set showExport: true to show Export in the top-right of the collection; omit or false keeps Export hidden. Optional fields is an ordered string[] of real aspect field ids shown as labeled attribute chips beside each title (user/group avatars, picklist color, locale dates, number/currency). Omit fields to keep today’s fixed system pills; when fields is set, do not also expect those pills. Never invent field UUIDs; resolve ids from Owning App fields when the admin asks in plain language (for example "show Team and Priority on each row"). To share a ListControls filter, bind this list’s filterJson and quickFilterValue to the exact same paths as the control: use /query/filter and /query/statusGroup for one shared pair, or /query/filter/{blockKey} and /query/statusGroup/{blockKey} for an independent same-aspect pair. Each block-keyed pair can define its own quickFilters chips. For a view with more than one App, use /query/filter/<aspectId> and /query/statusGroup/<aspectId> for every block serving that App. Exception: independent ListControls/list pairs on the same App, including in a multi-App view, use /query/filter/{blockKey} and /query/statusGroup/{blockKey}. Shared and aspect-scoped paths remain first-class. Use filterPreset only for a no-chip seed or an independent list filter. Looks like a ticket queue, not a spreadsheet. Prefer DataTableBlock for dense columns.
171
171
  */
172
172
  export type ListCollectionBlockElement = {
173
173
  readonly type: "ListCollectionBlock";
@@ -420,7 +420,7 @@ export type CardBlockProps = {
420
420
  /**
421
421
  * Customer-facing name: Data table
422
422
  * Customer-facing description: A spreadsheet-style table with typed columns for structured rows.
423
- * Internal authoring guidance: Dual presentational/self-fetching data table with typed columns, row selection, optional nested children, and loading/empty/error states. Use rows or object columns for authored data, or aspectId with record columns for live records; self-fetching falls back to the runtime default aspect. Optional density: "compact" | "standard" | "comfortable" (List View names); omit to keep today’s spacing. Self-fetching columns are registered system keys (handle, title, status, priority, assignee, assignmentGroup, createdBy, createdTime, updatedAt, stage) and/or real aspect field ids - never invent field UUIDs - as strings, or { key, width?, minWidth?, maxWidth? } for admin default widths (key is the same system key or field id). Prefer semantic system keys when they exist. Optional columnHeaders maps the same column string to a display label; omit to use i18n/system headers or the field name from aspect metadata. Object columns with header/type/align select the presentational branch. Live tables show a matching record count in the collection footer; CMV users may resize columns (browser-local, not written back to Spec). Set showExport: true to show Export in the top-right of the collection; omit or false keeps Export hidden. Presentational rows may set href (absolute https:// opens a new tab, "/path" navigates inside Elementum) so the primary title cell renders as a link; same rules as ActionCardBlock. Per-cell links use a cell-hint object with href. To share a ListControls filter, bind filterJson and use the same filterPreset on this table; state changes refetch it. When a view has more than one App, bind every App to /query/filter/<aspectId> and /query/statusGroup/<aspectId>. A view with one App keeps the shared paths. Use filterPreset without that binding only for an independent table seed. Looks like a spreadsheet-style grid; wrap in CardBlock with padding "none". Prefer ListCollectionBlock for compact record queues.
423
+ * Internal authoring guidance: Dual presentational/self-fetching data table with typed columns, row selection, optional nested children, and loading/empty/error states. Use rows or object columns for authored data, or aspectId with record columns for live records; self-fetching falls back to the runtime default aspect. Optional density: "compact" | "standard" | "comfortable" (List View names); omit to keep today’s spacing. Self-fetching columns are registered system keys (handle, title, status, priority, assignee, assignmentGroup, createdBy, createdTime, updatedAt, stage) and/or real aspect field ids - never invent field UUIDs - as strings, or { key, width?, minWidth?, maxWidth? } for admin default widths (key is the same system key or field id). Prefer semantic system keys when they exist. Optional columnHeaders maps the same column string to a display label; omit to use i18n/system headers or the field name from aspect metadata. Object columns with header/type/align select the presentational branch. Live tables show a matching record count in the collection footer; CMV users may resize columns (browser-local, not written back to Spec). Set showExport: true to show Export in the top-right of the collection; omit or false keeps Export hidden. Presentational rows may set href (absolute https:// opens a new tab, "/path" navigates inside Elementum) so the primary title cell renders as a link; same rules as ActionCardBlock. Per-cell links use a cell-hint object with href. To share a ListControls filter, bind this table’s filterJson and quickFilterValue to the exact same paths as the control: use /query/filter and /query/statusGroup for one shared pair, or /query/filter/{blockKey} and /query/statusGroup/{blockKey} for an independent same-aspect pair. Each block-keyed pair can define its own quickFilters chips. For a view with more than one App, use /query/filter/<aspectId> and /query/statusGroup/<aspectId> for every block serving that App. Shared and aspect-scoped paths remain first-class. Use filterPreset only for a no-chip seed or an independent table filter. Looks like a spreadsheet-style grid; wrap in CardBlock with padding "none". Prefer ListCollectionBlock for compact record queues.
424
424
  */
425
425
  export type DataTableBlockElement = {
426
426
  readonly type: "DataTableBlock";
@@ -975,3 +975,48 @@ export type ButtonBlockStaticItem = {
975
975
  */
976
976
  readonly viewId?: string;
977
977
  };
978
+ /**
979
+ * Customer-facing name: Image
980
+ * Customer-facing description: Displays an image from a URL.
981
+ * Internal authoring guidance: Use ImageBlock for a static image URL. Provide alt for meaningful images; omit alt for decorative images. Named organization asset keys such as organizationBanner are not resolved yet.
982
+ */
983
+ export type ImageBlockElement = {
984
+ readonly type: "ImageBlock";
985
+ readonly props: ImageBlockProps;
986
+ readonly children?: ReadonlyArray<string>;
987
+ readonly visible?: VisibilityCondition;
988
+ readonly repeat?: RepeatConfig;
989
+ readonly on?: ElementOn;
990
+ readonly watch?: ElementWatch;
991
+ readonly validation?: ElementValidation;
992
+ };
993
+ export type ImageBlockProps = {
994
+ readonly image: (string) | (PropExpression);
995
+ readonly alt?: (string) | (PropExpression);
996
+ };
997
+ /**
998
+ * Customer-facing name: Tabs
999
+ * Customer-facing description: Switches between sections, showing one at a time.
1000
+ * Internal authoring guidance: Use TabsBlock when the admin asks to split the view into tabs or sections. Use one child per tab, in the same order as tabs. Use a StackBlock child when a tab holds more than one block. Omit defaultIndex to open on the first tab. Do not nest TabsBlock.
1001
+ */
1002
+ export type TabsBlockElement = {
1003
+ readonly type: "TabsBlock";
1004
+ readonly props: TabsBlockProps;
1005
+ readonly children?: ReadonlyArray<string>;
1006
+ readonly visible?: VisibilityCondition;
1007
+ readonly repeat?: RepeatConfig;
1008
+ readonly on?: ElementOn;
1009
+ readonly watch?: ElementWatch;
1010
+ readonly validation?: ElementValidation;
1011
+ };
1012
+ export type TabsBlockProps = {
1013
+ readonly tabs: (ReadonlyArray<TabsBlockTab>) | (PropExpression);
1014
+ readonly defaultIndex?: (number) | (PropExpression);
1015
+ };
1016
+ export type TabsBlockTab = {
1017
+ readonly label: string;
1018
+ /**
1019
+ * Lucide icon name, e.g. inbox.
1020
+ */
1021
+ readonly icon?: string;
1022
+ };
@@ -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.42.1
3
- // Schema sha256: f00541d39820c1807cd2b7342863bb79cdad2f734a4785b54380109656a47e01
2
+ // Source: urn:elementum:elementum-blocks:spec:v1 version 1.45.0
3
+ // Schema sha256: 91b420eaae8a05c4f85c273d2651067786d3e3de650b71cc1520b3ca1a1818e0
4
4
  // Generator revision: 2
5
5
  export {};
@@ -167,6 +167,11 @@ export declare const UNREADABLE_ATTRIBUTES_BY_RESOURCE_TYPE: ReadonlyMap<string,
167
167
  */
168
168
  export declare const STATE_SCOPED_MAP_ATTRIBUTES_BY_RESOURCE_TYPE: ReadonlyMap<string, readonly string[]>;
169
169
  export declare const STATE_SCOPED_PLATFORM_ENTRIES_BY_RESOURCE_TYPE: ReadonlyMap<string, readonly StateScopedPlatformEntry[]>;
170
+ /**
171
+ * Resource type → option-list attributes where the provider keeps an inactive
172
+ * option only when state holds it, as each sub-type row declares them.
173
+ */
174
+ export declare const STATE_SCOPED_INACTIVE_OPTIONS_BY_RESOURCE_TYPE: ReadonlyMap<string, readonly string[]>;
170
175
  /** Resource type → the kind's own re-pull alignment, as each single-resource kind declares it. */
171
176
  export declare const STATE_ALIGNMENTS_BY_RESOURCE_TYPE: ReadonlyMap<string, StateAlignment>;
172
177
  /** Every kind's `--portable` leave-out rules (edk#1894). */
@@ -142,6 +142,13 @@ export const STATE_SCOPED_MAP_ATTRIBUTES_BY_RESOURCE_TYPE = new Map(KIND_MODULES
142
142
  export const STATE_SCOPED_PLATFORM_ENTRIES_BY_RESOURCE_TYPE = new Map(KIND_MODULES.flatMap((m) => m.resource.shape === "single" && m.resource.stateScopedPlatformEntries !== undefined
143
143
  ? [[m.resource.resourceType, m.resource.stateScopedPlatformEntries]]
144
144
  : []));
145
+ /**
146
+ * Resource type → option-list attributes where the provider keeps an inactive
147
+ * option only when state holds it, as each sub-type row declares them.
148
+ */
149
+ export const STATE_SCOPED_INACTIVE_OPTIONS_BY_RESOURCE_TYPE = new Map(KIND_MODULES.flatMap((m) => m.resource.shape === "subTypes"
150
+ ? m.resource.rows.flatMap((row) => (row.stateScopedInactiveOptions === undefined ? [] : [[row.resourceType, row.stateScopedInactiveOptions]]))
151
+ : []));
145
152
  /** Resource type → the kind's own re-pull alignment, as each single-resource kind declares it. */
146
153
  export const STATE_ALIGNMENTS_BY_RESOURCE_TYPE = new Map(KIND_MODULES.flatMap((m) => m.resource.shape === "single" && m.resource.alignWithState !== undefined
147
154
  ? [[m.resource.resourceType, m.resource.alignWithState]]