@elementumai/edk 0.9.5 → 0.9.7

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 (97) hide show
  1. package/README.md +31 -1
  2. package/dist-sdk/src/catalog/factories.d.ts +12 -3
  3. package/dist-sdk/src/catalog/factories.js +9 -6
  4. package/dist-sdk/src/catalog/org.js +26 -13
  5. package/dist-sdk/src/catalog/types.d.ts +22 -1
  6. package/dist-sdk/src/core/index.d.ts +1 -1
  7. package/dist-sdk/src/core/system-fields.d.ts +4 -0
  8. package/dist-sdk/src/core/system-fields.js +15 -0
  9. package/dist-sdk/src/core/types/app.d.ts +14 -9
  10. package/dist-sdk/src/core/types/platform.d.ts +1 -1
  11. package/dist-sdk/src/engine/build/context.d.ts +4 -0
  12. package/dist-sdk/src/engine/pull/context.d.ts +9 -0
  13. package/dist-sdk/src/engine/pull/ref-only.d.ts +14 -0
  14. package/dist-sdk/src/engine/pull/ref-only.js +35 -2
  15. package/dist-sdk/src/entities/access-policy/from-tf.js +14 -2
  16. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +6 -0
  17. package/dist-sdk/src/entities/access-policy/to-tf.js +4 -1
  18. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +18 -1
  19. package/dist-sdk/src/entities/agent/module.js +1 -0
  20. package/dist-sdk/src/entities/agent/to-tf.d.ts +1 -0
  21. package/dist-sdk/src/entities/agent/to-tf.js +1 -0
  22. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +9 -0
  23. package/dist-sdk/src/entities/agent-tool/from-tf.js +10 -2
  24. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
  25. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -3
  26. package/dist-sdk/src/entities/app/build.d.ts +42 -22
  27. package/dist-sdk/src/entities/app/build.js +12 -5
  28. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +10 -0
  29. package/dist-sdk/src/entities/app/from-tf.js +71 -8
  30. package/dist-sdk/src/entities/app/index.d.ts +3 -2
  31. package/dist-sdk/src/entities/app/index.js +2 -1
  32. package/dist-sdk/src/entities/app/to-tf.js +16 -0
  33. package/dist-sdk/src/entities/automation/build.d.ts +31 -19
  34. package/dist-sdk/src/entities/automation/build.js +85 -7
  35. package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
  36. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +5 -3
  37. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +26 -12
  38. package/dist-sdk/src/entities/automation/from-tf.js +364 -31
  39. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  40. package/dist-sdk/src/entities/automation/module.js +2 -2
  41. package/dist-sdk/src/entities/automation/operators.d.ts +2 -2
  42. package/dist-sdk/src/entities/automation/operators.js +1 -0
  43. package/dist-sdk/src/entities/automation/output-field-types.d.ts +17 -0
  44. package/dist-sdk/src/entities/automation/output-field-types.js +45 -0
  45. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +8 -0
  46. package/dist-sdk/src/entities/automation/output-key-wire-name.js +16 -0
  47. package/dist-sdk/src/entities/automation/script-code.js +153 -25
  48. package/dist-sdk/src/entities/automation/tasks.d.ts +100 -37
  49. package/dist-sdk/src/entities/automation/tasks.js +44 -43
  50. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -1
  51. package/dist-sdk/src/entities/automation/to-tf.js +454 -58
  52. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +78 -0
  53. package/dist-sdk/src/entities/automation/value-ref-tf.js +193 -0
  54. package/dist-sdk/src/entities/element/build.js +1 -0
  55. package/dist-sdk/src/entities/element/index.d.ts +2 -1
  56. package/dist-sdk/src/entities/element/index.js +2 -1
  57. package/dist-sdk/src/entities/field/build.d.ts +94 -3
  58. package/dist-sdk/src/entities/field/build.js +82 -3
  59. package/dist-sdk/src/entities/field/from-tf.js +92 -1
  60. package/dist-sdk/src/entities/field/locals.js +6 -7
  61. package/dist-sdk/src/entities/field/options.d.ts +2 -0
  62. package/dist-sdk/src/entities/field/options.js +12 -2
  63. package/dist-sdk/src/entities/field/record-shape.d.ts +12 -15
  64. package/dist-sdk/src/entities/field/to-tf.d.ts +12 -2
  65. package/dist-sdk/src/entities/field/to-tf.js +172 -51
  66. package/dist-sdk/src/entities/field/types.js +2 -0
  67. package/dist-sdk/src/entities/record-create-form/to-tf.js +5 -8
  68. package/dist-sdk/src/entities/relationship/from-tf.js +91 -9
  69. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +9 -0
  70. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +39 -0
  71. package/dist-sdk/src/entities/shared/filters/ast.d.ts +18 -1
  72. package/dist-sdk/src/entities/shared/filters/ast.js +1 -0
  73. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +6 -1
  74. package/dist-sdk/src/entities/shared/filters/tf-codec.js +6 -4
  75. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +5 -3
  76. package/dist-sdk/src/entities/shared/tool-field-ref.js +11 -16
  77. package/dist-sdk/src/entities/shared/types/common.d.ts +7 -5
  78. package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
  79. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
  80. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +44 -15
  81. package/dist-sdk/src/entities/skill/from-tf.js +11 -1
  82. package/dist-sdk/src/entities/skill/input-coverage.d.ts +68 -0
  83. package/dist-sdk/src/entities/skill/input-coverage.js +184 -0
  84. package/dist-sdk/src/entities/skill/module.js +2 -0
  85. package/dist-sdk/src/entities/skill/to-tf.d.ts +3 -0
  86. package/dist-sdk/src/entities/skill/to-tf.js +7 -2
  87. package/dist-sdk/src/entities/skill/tools.d.ts +10 -1
  88. package/dist-sdk/src/entities/skill/tools.js +0 -5
  89. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
  90. package/dist-sdk/src/entities/skill-tool/from-tf.js +40 -11
  91. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +4 -2
  92. package/dist-sdk/src/entities/skill-tool/to-tf.js +24 -16
  93. package/dist-sdk/src/entities/table/to-tf.js +18 -1
  94. package/dist-sdk/src/entities/view/to-tf.js +8 -3
  95. package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
  96. package/dist-sdk/src/graph/types.d.ts +3 -0
  97. package/package.json +2 -1
@@ -28,8 +28,9 @@ import { randomUUID } from "crypto";
28
28
  import { valid as validSemver } from "semver";
29
29
  import { EntityTfError } from "../../engine/entity.js";
30
30
  import { buildContext, createForEachItemProxy } from "../shared/context.js";
31
+ import { outputFieldTypesFromScriptSchema } from "./output-field-types.js";
31
32
  import { isRef } from "../shared/ref.js";
32
- import { OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
33
+ import { API_TASK_REF_WIRE_NAMES, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
33
34
  import { extractScriptBody, inferOutputSchema, tryExtractFromCurrentSource } from "./script-code.js";
34
35
  import { serializeNode } from "./serialize.js";
35
36
  // Runtime factory imports stay below the public action-native surface. Their
@@ -56,7 +57,8 @@ function serializeTaskEntry(name, def, displayName, hclParent) {
56
57
  };
57
58
  if (def.operatorChildren && def.operatorChildren.length > 0) {
58
59
  result.children = def.operatorChildren.map((child) => ({
59
- label: child.label,
60
+ ...(child.label !== undefined ? { label: child.label } : {}),
61
+ ...(child.isDefault === true ? { isDefault: true } : {}),
60
62
  ...(child.filter !== undefined ? { filter: serializeNode(child.filter) } : {}),
61
63
  ...(child.defaultLabel !== undefined ? { defaultLabel: child.defaultLabel } : {}),
62
64
  ...(child.defaultFilterMode !== undefined ? { defaultFilterMode: child.defaultFilterMode } : {}),
@@ -104,6 +106,60 @@ function collectTaskKinds(tasks) {
104
106
  visit(tasks);
105
107
  return out;
106
108
  }
109
+ /**
110
+ * Map every executeScript task's refKey to its declared (wire-shaped)
111
+ * `output_schema`, descending into operator children — mirrors
112
+ * `collectTaskKinds`. Used at `.ref(refName)` time to resolve
113
+ * `OutputPropertyRef.valueType` for an automation-level output whose value
114
+ * is a plain ref to one of these tasks' `result.<prop>`.
115
+ */
116
+ function collectExecuteScriptOutputSchemas(tasks) {
117
+ const out = new Map();
118
+ const visit = (entries) => {
119
+ for (const { name, def } of entries) {
120
+ if (def.key === "executeScript" && def.config.outputSchema !== undefined) {
121
+ out.set(name, def.config.outputSchema);
122
+ }
123
+ for (const child of def.operatorChildren ?? [])
124
+ visit(child.tasks);
125
+ }
126
+ };
127
+ visit(tasks);
128
+ return out;
129
+ }
130
+ /**
131
+ * Schema kinds `outputFieldTypesFromScriptSchema` maps to an EXACT field
132
+ * type — as opposed to its own catch-all default (`"TEXT"` for anything
133
+ * unrecognized, including `"object"`), which is real for the wire's own
134
+ * default but would be a wrong guess if promoted to `OutputPropertyRef.valueType`.
135
+ */
136
+ const KNOWN_SCRIPT_OUTPUT_KINDS = new Set(["bool", "integer", "number", "string"]);
137
+ /**
138
+ * Resolve an automation-level output's `valueType` from its (already
139
+ * serialized) value: only when it's a plain ref to an executeScript task's
140
+ * `result.<prop>` whose declared schema has an EXACT (not catch-all-guessed)
141
+ * kind for that property. Anything else — a literal, a trigger/variable ref,
142
+ * a non-executeScript task, or an unmodeled schema kind (e.g. `object`) —
143
+ * returns `undefined` (unknown, not a guess).
144
+ */
145
+ function resolveOutputValueType(value, scriptSchemas) {
146
+ if (value === null || typeof value !== "object")
147
+ return undefined;
148
+ const ref = value.taskReference;
149
+ if (ref === null || typeof ref !== "object")
150
+ return undefined;
151
+ const taskRefKey = ref.taskRefKey;
152
+ const name = ref.name;
153
+ if (typeof taskRefKey !== "string" || typeof name !== "string")
154
+ return undefined;
155
+ const schema = scriptSchemas.get(taskRefKey);
156
+ if (schema === undefined)
157
+ return undefined;
158
+ const resolved = outputFieldTypesFromScriptSchema(schema)?.get(name);
159
+ if (resolved === undefined || !KNOWN_SCRIPT_OUTPUT_KINDS.has(resolved.kind))
160
+ return undefined;
161
+ return resolved.fieldType;
162
+ }
107
163
  /**
108
164
  * Map every record-bearing task's refKey to the app refName that owns its
109
165
  * `.record`/`.records` output, descending into operator children — mirrors
@@ -136,6 +192,9 @@ const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findR
136
192
  * - recordSearch: `totalCount` → the platform's `Records Size`.
137
193
  * - aiSearchTable: `records` → the platform's `All Records` (NOT
138
194
  * recordSearch's `All found records` — #398.1).
195
+ * - tableRecordsSearch interpolations map `records` → `All matching table
196
+ * rows` in to-tf (`valueToTf`); do **not** rewrite the name here — ei
197
+ * publish envelopes keep the authored key `records`.
139
198
  * - aiAgent: `result` / `result.<field>` → the platform's
140
199
  * `ai_agent_task_response` (text) / `ai_agent_task_structured_output.<field>` (json).
141
200
  * - record-bearing tasks: the read path reinjects a `.record` hop on the id
@@ -150,6 +209,9 @@ const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findR
150
209
  * the platform's actual output name for that task kind.
151
210
  */
152
211
  function rewriteForwardTaskRefName(taskKey, name) {
212
+ if (taskKey === "api") {
213
+ return API_TASK_REF_WIRE_NAMES[name] ?? name;
214
+ }
153
215
  if (taskKey === "recordSearch" && name === "totalCount") {
154
216
  return "Records Size";
155
217
  }
@@ -402,8 +464,11 @@ function makeActionBuilder(state, mode = "root", item) {
402
464
  __triggerParams() {
403
465
  return state.trigger.__params ?? [];
404
466
  },
405
- __outputNames() {
406
- return state.outputs?.map((o) => o.name) ?? [];
467
+ __outputEntries() {
468
+ return state.outputs ?? [];
469
+ },
470
+ __executeScriptOutputSchemas() {
471
+ return collectExecuteScriptOutputSchemas(state.tasks);
407
472
  },
408
473
  __finalize() {
409
474
  const taskKindByRefKey = collectTaskKinds(state.tasks);
@@ -476,7 +541,8 @@ export function automation(opts) {
476
541
  return {
477
542
  ref(refName) {
478
543
  const triggerParams = opts.actions.__triggerParams();
479
- const outputNames = opts.actions.__outputNames();
544
+ const outputEntries = opts.actions.__outputEntries();
545
+ const scriptSchemas = opts.actions.__executeScriptOutputSchemas();
480
546
  // Bag keys are the DECLARED names, verbatim (no canonicalization —
481
547
  // access non-identifier names with brackets: trigger["STUDENT NAME 2"]).
482
548
  // `required: true` is stamped only when true (canonical form) — it is
@@ -493,8 +559,20 @@ export function automation(opts) {
493
559
  },
494
560
  ]))
495
561
  : undefined;
496
- const outputs = outputNames.length > 0
497
- ? Object.fromEntries(outputNames.map((n) => [n, { __kind: "outputProperty", refName: n, name: n, parent: refName }]))
562
+ const outputs = outputEntries.length > 0
563
+ ? Object.fromEntries(outputEntries.map(({ name: n, value }) => {
564
+ const valueType = resolveOutputValueType(value, scriptSchemas);
565
+ return [
566
+ n,
567
+ {
568
+ __kind: "outputProperty",
569
+ refName: n,
570
+ name: n,
571
+ parent: refName,
572
+ ...(valueType !== undefined ? { valueType } : {}),
573
+ },
574
+ ];
575
+ }))
498
576
  : undefined;
499
577
  return {
500
578
  __kind: "automation",
@@ -7,11 +7,14 @@ export function renderAutomationCatalogEntry(args) {
7
7
  const triggerKeys = Object.keys(ref.trigger ?? {}).sort();
8
8
  const outputKeys = Object.keys(ref.outputs ?? {}).sort();
9
9
  const { keyName, baseIndent } = args;
10
- if (triggerKeys.length === 0 && outputKeys.length === 0) {
10
+ if ((ref.name === "" || ref.name === keyName) && triggerKeys.length === 0 && outputKeys.length === 0) {
11
11
  return bareFactoryEntry("automationRef", keyName, baseIndent);
12
12
  }
13
13
  const lines = [`${baseIndent}${safeCatalogKey(keyName)}: automationRef({`];
14
14
  const extraFactories = [];
15
+ if (ref.name !== "" && ref.name !== keyName) {
16
+ lines.push(`${baseIndent} name: ${JSON.stringify(ref.name)},`);
17
+ }
15
18
  if (triggerKeys.length > 0) {
16
19
  extraFactories.push("triggerParameterRef");
17
20
  lines.push(`${baseIndent} trigger: {`);
@@ -26,7 +29,7 @@ export function renderAutomationCatalogEntry(args) {
26
29
  lines.push(`${baseIndent} outputs: {`);
27
30
  for (const key of outputKeys) {
28
31
  const prop = ref.outputs[key];
29
- lines.push(`${baseIndent} ${safeCatalogKey(key)}: outputPropertyRef({ name: ${JSON.stringify(prop.name)}, parent: ${JSON.stringify(prop.parent ?? "")} }),`);
32
+ lines.push(`${baseIndent} ${safeCatalogKey(key)}: outputPropertyRef({ name: ${JSON.stringify(prop.name)}, parent: ${JSON.stringify(prop.parent ?? "")}${prop.valueType !== undefined ? `, valueType: ${JSON.stringify(prop.valueType)}` : ""} }),`);
30
33
  }
31
34
  lines.push(`${baseIndent} },`);
32
35
  }
@@ -21,7 +21,7 @@ export type { RefExpr, SortAst, AppRefAst, ApprovalChainRefAst, DatamineRefAst,
21
21
  *
22
22
  * `children` carries the AST for operator tasks (forEach / switch). For
23
23
  * forEach the array has exactly one entry; for switch each entry is a case
24
- * branch (plus optionally a default, stored with `label: null`).
24
+ * branch (plus optionally a default, marked with `isDefault`).
25
25
  */
26
26
  export interface TaskCall {
27
27
  readonly factory: string;
@@ -40,10 +40,12 @@ export interface PulledRawCalculationAst {
40
40
  readonly resultType: "attachment" | "bool" | "date" | "datetime" | "decimal" | "group" | "handle" | "html" | "json" | "multiPicklist" | "number" | "picklist" | "text" | "user";
41
41
  }
42
42
  export interface OperatorChildAst {
43
- readonly label: string | null;
43
+ readonly label?: string | null;
44
+ /** True only for a switch default branch; label absence is not a default discriminator. */
45
+ readonly isDefault?: boolean;
44
46
  readonly filter?: Filter<RefExpr, RefExpr>;
45
47
  readonly tasks: readonly TaskCall[];
46
- /** The switch default branch's actual display label, when `label` is `null` and it deviates from "Default". */
48
+ /** The switch default branch's actual display label when it deviates from "Default". */
47
49
  readonly defaultLabel?: string;
48
50
  /**
49
51
  * Which of the two mutually-exclusive wire shapes this switch default
@@ -587,8 +587,9 @@ function formatSwitch(task, state, indent, refCtx) {
587
587
  const pad = " ".repeat(indent);
588
588
  const configIndent = " ".repeat(indent + 1);
589
589
  const children = task.children ?? [];
590
- const cases = children.filter((ch) => ch.label != null);
591
- const defaults = children.filter((ch) => ch.label == null);
590
+ const isDefault = (child) => child.isDefault === true || child.label === null;
591
+ const cases = children.filter((ch) => !isDefault(ch));
592
+ const defaults = children.filter(isDefault);
592
593
  const branchCtx = { ctxName: "ctx", selfTaskRefKeys: refCtx.selfTaskRefKeys };
593
594
  const caseLines = cases.map((ch) => formatSwitchCase(ch, state, indent + 2, branchCtx));
594
595
  const configParts = [];
@@ -603,7 +604,8 @@ function formatSwitchCase(ch, state, indent, refCtx) {
603
604
  const pad = " ".repeat(indent);
604
605
  const innerPad = " ".repeat(indent + 1);
605
606
  const parts = [];
606
- parts.push(`${innerPad}label: ${ch.label == null ? "null" : quote(ch.label)}`);
607
+ if (ch.label !== undefined)
608
+ parts.push(`${innerPad}label: ${ch.label === null ? "null" : quote(ch.label)}`);
607
609
  // The switch case `condition:` is a `filter.*` expression evaluated in the
608
610
  // switch's outer scope; v2 takes it as a bare value (no `(app) =>` lambda).
609
611
  if (ch.filter)
@@ -623,7 +625,11 @@ function formatForkJoin(task, state, indent, refCtx) {
623
625
  function formatForkJoinBranch(ch, state, indent, refCtx) {
624
626
  const pad = " ".repeat(indent);
625
627
  const innerPad = " ".repeat(indent + 1);
626
- return `${pad}{\n${innerPad}label: ${ch.label == null ? "null" : quote(ch.label)},\n${innerPad}actions: ${formatNestedActions(ch.tasks, state, indent + 2, refCtx)},\n${pad}}`;
628
+ const parts = [];
629
+ if (ch.label !== undefined)
630
+ parts.push(`${innerPad}label: ${ch.label === null ? "null" : quote(ch.label)}`);
631
+ parts.push(`${innerPad}actions: ${formatNestedActions(ch.tasks, state, indent + 2, refCtx)}`);
632
+ return `${pad}{\n${parts.join(",\n")},\n${pad}}`;
627
633
  }
628
634
  // ---------------------------------------------------------------------------
629
635
  // Task args
@@ -675,7 +681,7 @@ function printFieldAssignments(values, appHandle, state, indent, refCtx) {
675
681
  return "[]";
676
682
  const pad = " ".repeat(indent);
677
683
  const inner = " ".repeat(indent + 1);
678
- const lines = entries.map(([fieldKey, value]) => {
684
+ const lines = entries.map(([fieldKey, rawValue]) => {
679
685
  let fieldExpr;
680
686
  if (appHandle && !fieldKey.startsWith(UNRESOLVED_FIELD_MARKER)) {
681
687
  fieldExpr = `catalog.${appHandle}.fields${safeMember(fieldKey)}`;
@@ -687,8 +693,15 @@ function printFieldAssignments(values, appHandle, state, indent, refCtx) {
687
693
  state.imports.usesUnsafePlatformId = true;
688
694
  fieldExpr = `unsafePlatformId(${quote(uuid)})`;
689
695
  }
690
- const valueExpr = printArgValue("", value, state, indent + 2, refCtx);
691
- return `${inner}{ field: ${fieldExpr}, value: ${valueExpr} },`;
696
+ const assignmentRecord = rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)
697
+ ? rawValue
698
+ : undefined;
699
+ const assignment = assignmentRecord?.__fieldAssignment === true && "value" in assignmentRecord
700
+ ? assignmentRecord
701
+ : undefined;
702
+ const valueExpr = printArgValue("", assignment?.value ?? rawValue, state, indent + 2, refCtx);
703
+ const updateMode = assignment?.updateMode === "add" ? `, updateMode: "add"` : "";
704
+ return `${inner}{ field: ${fieldExpr}, value: ${valueExpr}${updateMode} },`;
692
705
  });
693
706
  return `[\n${lines.join("\n")}\n${pad}]`;
694
707
  }
@@ -862,6 +875,8 @@ function printRef(ref, state, refCtx) {
862
875
  // modules are lazy-mounted there by `generated/catalog.ts`, not on the
863
876
  // `org.ts` identity bag from `pull org --data-only`.
864
877
  return `catalog.tables${safeMember(ref.tableHandle)}`;
878
+ case "tableColumn":
879
+ return `catalog.tables${safeMember(ref.tableHandle)}.columns${safeMember(ref.columnKey)}`;
865
880
  case "user":
866
881
  return `${trackFactory("userRef", state)}(${quote(ref.email)})`;
867
882
  case "documentModel":
@@ -869,11 +884,10 @@ function printRef(ref, state, refCtx) {
869
884
  case "documentModelField":
870
885
  return `catalog.${ref.appHandle}.fileReaders${safeMember(ref.documentModelKey)}.fields${safeMember(ref.fieldKey)}`;
871
886
  case "approvalChain":
872
- // Approval chains are reference-only in the HCL architecture: EDK does
873
- // not have approval-chain authoring files from which catalog regeneration
874
- // could rebuild this bag. Keep the provider label as a fully typed token
875
- // instead of emitting a catalog lookup that disappears on `edk build`.
876
- return `{ __kind: "approvalChain", refName: ${quote(ref.approvalChainKey)}, name: ${quote(ref.approvalChainKey)}, parent: ${quote(ref.appHandle)}${ref.unresolvedId !== undefined ? `, unresolvedId: ${quote(ref.unresolvedId)}` : ""} }`;
887
+ if (ref.unresolvedId !== undefined) {
888
+ return `{ __kind: "approvalChain", refName: ${quote(ref.approvalChainKey)}, name: ${quote(ref.approvalChainKey)}, parent: ${quote(ref.appHandle)}, unresolvedId: ${quote(ref.unresolvedId)} }`;
889
+ }
890
+ return `catalog.${ref.appHandle}.approvalChains${safeMember(ref.approvalChainKey)}`;
877
891
  case "connector": {
878
892
  // Connectors are org-level (no appHandle), nested under their owning
879
893
  // provider — mirrors printConnectorToken in