@elementumai/edk 0.10.4 → 0.12.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 (171) hide show
  1. package/README.md +49 -13
  2. package/dist-sdk/src/catalog/token.js +2 -1
  3. package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -0
  4. package/dist-sdk/src/core/triggers/on-demand.js +3 -0
  5. package/dist-sdk/src/core/wire/ref-serializer.js +26 -1
  6. package/dist-sdk/src/engine/build/context.d.ts +4 -0
  7. package/dist-sdk/src/engine/coverage-gaps.d.ts +7 -0
  8. package/dist-sdk/src/engine/coverage-gaps.js +12 -0
  9. package/dist-sdk/src/engine/ei/json-stream-reader.d.ts +43 -0
  10. package/dist-sdk/src/engine/ei/json-stream-reader.js +234 -0
  11. package/dist-sdk/src/engine/ei/run.d.ts +42 -1
  12. package/dist-sdk/src/engine/ei/run.js +201 -32
  13. package/dist-sdk/src/engine/ei/saved-plan.d.ts +16 -0
  14. package/dist-sdk/src/engine/ei/saved-plan.js +19 -0
  15. package/dist-sdk/src/engine/ei/state.d.ts +1 -1
  16. package/dist-sdk/src/engine/ei/state.js +17 -4
  17. package/dist-sdk/src/engine/progress.d.ts +3 -1
  18. package/dist-sdk/src/engine/progress.js +7 -3
  19. package/dist-sdk/src/engine/pull/authored-address.d.ts +15 -1
  20. package/dist-sdk/src/engine/pull/authored-address.js +180 -29
  21. package/dist-sdk/src/engine/pull/context.d.ts +37 -2
  22. package/dist-sdk/src/engine/pull/context.js +7 -4
  23. package/dist-sdk/src/engine/pull/ref-only.d.ts +18 -0
  24. package/dist-sdk/src/engine/pull/ref-only.js +52 -0
  25. package/dist-sdk/src/engine/tf/index.d.ts +2 -2
  26. package/dist-sdk/src/engine/tf/index.js +2 -2
  27. package/dist-sdk/src/engine/tf/labels.d.ts +22 -0
  28. package/dist-sdk/src/engine/tf/labels.js +50 -0
  29. package/dist-sdk/src/engine/tf/model.d.ts +2 -0
  30. package/dist-sdk/src/engine/tf/model.js +26 -0
  31. package/dist-sdk/src/engine/validation.d.ts +2 -0
  32. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +18 -0
  33. package/dist-sdk/src/entities/access-policy/from-tf.js +58 -24
  34. package/dist-sdk/src/entities/access-policy/member-list.d.ts +32 -0
  35. package/dist-sdk/src/entities/access-policy/member-list.js +57 -0
  36. package/dist-sdk/src/entities/access-policy/module.js +10 -0
  37. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +4 -3
  38. package/dist-sdk/src/entities/access-policy/to-tf.js +21 -12
  39. package/dist-sdk/src/entities/agent/build.js +7 -5
  40. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -0
  41. package/dist-sdk/src/entities/agent/from-tf.js +13 -3
  42. package/dist-sdk/src/entities/agent/to-tf.js +11 -5
  43. package/dist-sdk/src/entities/agent/tools.d.ts +8 -0
  44. package/dist-sdk/src/entities/agent/tools.js +6 -2
  45. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
  46. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +29 -0
  47. package/dist-sdk/src/entities/agent-tool/to-tf.js +56 -3
  48. package/dist-sdk/src/entities/agent-tool/types.d.ts +12 -8
  49. package/dist-sdk/src/entities/agent-tool/types.js +13 -9
  50. package/dist-sdk/src/entities/app/build.d.ts +12 -1
  51. package/dist-sdk/src/entities/app/build.js +80 -4
  52. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -7
  53. package/dist-sdk/src/entities/app/from-tf.js +17 -12
  54. package/dist-sdk/src/entities/app/stage-keys.d.ts +18 -3
  55. package/dist-sdk/src/entities/app/stage-keys.js +40 -6
  56. package/dist-sdk/src/entities/app/to-tf.js +7 -4
  57. package/dist-sdk/src/entities/automation/build.d.ts +52 -31
  58. package/dist-sdk/src/entities/automation/build.js +59 -20
  59. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +7 -4
  60. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +39 -14
  61. package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -2
  62. package/dist-sdk/src/entities/automation/from-tf.js +721 -93
  63. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  64. package/dist-sdk/src/entities/automation/module.d.ts +22 -2
  65. package/dist-sdk/src/entities/automation/module.js +244 -57
  66. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +22 -2
  67. package/dist-sdk/src/entities/automation/output-key-wire-name.js +54 -3
  68. package/dist-sdk/src/entities/automation/run-target.d.ts +61 -0
  69. package/dist-sdk/src/entities/automation/run-target.js +104 -0
  70. package/dist-sdk/src/entities/automation/script-code.d.ts +11 -1
  71. package/dist-sdk/src/entities/automation/script-code.js +106 -4
  72. package/dist-sdk/src/entities/automation/script-lint.d.ts +13 -0
  73. package/dist-sdk/src/entities/automation/script-lint.js +418 -0
  74. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -1
  75. package/dist-sdk/src/entities/automation/task-output-labels.js +58 -1
  76. package/dist-sdk/src/entities/automation/tasks.d.ts +67 -22
  77. package/dist-sdk/src/entities/automation/tasks.js +18 -4
  78. package/dist-sdk/src/entities/automation/to-tf.d.ts +1 -3
  79. package/dist-sdk/src/entities/automation/to-tf.js +354 -64
  80. package/dist-sdk/src/entities/automation/triggers.d.ts +63 -11
  81. package/dist-sdk/src/entities/automation/triggers.js +45 -5
  82. package/dist-sdk/src/entities/automation/types.d.ts +21 -0
  83. package/dist-sdk/src/entities/automation/types.js +26 -0
  84. package/dist-sdk/src/entities/chart/build.d.ts +9 -1
  85. package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
  86. package/dist-sdk/src/entities/chart/from-tf.js +25 -1
  87. package/dist-sdk/src/entities/chart/index.d.ts +1 -1
  88. package/dist-sdk/src/entities/chart/printer.js +5 -2
  89. package/dist-sdk/src/entities/chart/to-tf.js +19 -1
  90. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +11 -1
  91. package/dist-sdk/src/entities/dashboard/from-tf.js +57 -7
  92. package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
  93. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +8 -2
  94. package/dist-sdk/src/entities/dynamic-layout/condition-keys.d.ts +48 -0
  95. package/dist-sdk/src/entities/dynamic-layout/condition-keys.js +261 -0
  96. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
  97. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +66 -20
  98. package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
  99. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +4 -2
  100. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +341 -32
  101. package/dist-sdk/src/entities/element/build.d.ts +10 -0
  102. package/dist-sdk/src/entities/element/build.js +1 -0
  103. package/dist-sdk/src/entities/element/from-tf.js +14 -9
  104. package/dist-sdk/src/entities/element/to-tf.js +7 -4
  105. package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
  106. package/dist-sdk/src/entities/field/from-tf.js +79 -1
  107. package/dist-sdk/src/entities/field/module.js +14 -1
  108. package/dist-sdk/src/entities/field/to-tf.d.ts +38 -3
  109. package/dist-sdk/src/entities/field/to-tf.js +108 -34
  110. package/dist-sdk/src/entities/file-reader/module.js +3 -3
  111. package/dist-sdk/src/entities/file-reader/to-tf.js +3 -3
  112. package/dist-sdk/src/entities/file-reader/types.d.ts +4 -16
  113. package/dist-sdk/src/entities/file-reader/types.js +7 -0
  114. package/dist-sdk/src/entities/org/group.d.ts +1 -0
  115. package/dist-sdk/src/entities/org/group.js +2 -1
  116. package/dist-sdk/src/entities/org/role.js +5 -0
  117. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +8 -0
  118. package/dist-sdk/src/entities/record-create-form/from-tf.js +10 -2
  119. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +2 -1
  120. package/dist-sdk/src/entities/record-create-form/to-tf.js +14 -2
  121. package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -0
  122. package/dist-sdk/src/entities/relationship/from-tf.js +88 -10
  123. package/dist-sdk/src/entities/relationship/to-tf.d.ts +3 -2
  124. package/dist-sdk/src/entities/relationship/to-tf.js +79 -8
  125. package/dist-sdk/src/entities/role/from-tf.js +24 -7
  126. package/dist-sdk/src/entities/role/to-tf.js +25 -7
  127. package/dist-sdk/src/entities/service-account/from-tf.js +2 -1
  128. package/dist-sdk/src/entities/service-account/module.js +20 -0
  129. package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +5 -5
  130. package/dist-sdk/src/entities/service-account/role-fidelity.js +21 -13
  131. package/dist-sdk/src/entities/service-account/to-tf.js +12 -4
  132. package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
  133. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
  134. package/dist-sdk/src/entities/shared/filters/tf-codec.js +12 -7
  135. package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -3
  136. package/dist-sdk/src/entities/shared/types/field-types.js +3 -1
  137. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -2
  138. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +8 -1
  139. package/dist-sdk/src/entities/skill/from-tf.js +10 -3
  140. package/dist-sdk/src/entities/skill/module.js +18 -0
  141. package/dist-sdk/src/entities/skill/to-tf.d.ts +8 -1
  142. package/dist-sdk/src/entities/skill/to-tf.js +23 -14
  143. package/dist-sdk/src/entities/skill/tools.d.ts +8 -0
  144. package/dist-sdk/src/entities/skill/tools.js +6 -2
  145. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
  146. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
  147. package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -2
  148. package/dist-sdk/src/entities/task/to-tf.js +1 -0
  149. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +8 -2
  150. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +20 -10
  151. package/dist-sdk/src/entities/view/from-tf.d.ts +68 -4
  152. package/dist-sdk/src/entities/view/from-tf.js +394 -22
  153. package/dist-sdk/src/entities/view/module.js +20 -0
  154. package/dist-sdk/src/entities/view/portable.d.ts +11 -0
  155. package/dist-sdk/src/entities/view/portable.js +47 -0
  156. package/dist-sdk/src/entities/view/to-tf.d.ts +4 -1
  157. package/dist-sdk/src/entities/view/to-tf.js +25 -7
  158. package/dist-sdk/src/entities/view/types.js +1 -1
  159. package/dist-sdk/src/entities/widget/build.d.ts +4 -3
  160. package/dist-sdk/src/entities/widget/from-tf.d.ts +3 -0
  161. package/dist-sdk/src/entities/widget/from-tf.js +100 -3
  162. package/dist-sdk/src/entities/widget/to-tf.d.ts +16 -1
  163. package/dist-sdk/src/entities/widget/to-tf.js +77 -14
  164. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +30 -9
  165. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  166. package/dist-sdk/src/graph/field-resource-types.d.ts +2 -0
  167. package/dist-sdk/src/graph/field-resource-types.js +11 -0
  168. package/dist-sdk/src/graph/index.d.ts +41 -3
  169. package/dist-sdk/src/graph/index.js +24 -2
  170. package/dist-sdk/src/graph/types.d.ts +195 -5
  171. package/package.json +1 -1
@@ -7,7 +7,7 @@ import { type Ref, type Simplify, type ValueOrRef } from "../shared/ref.js";
7
7
  import type { Filter } from "./filter.js";
8
8
  import { type ScriptFile, type ScriptInput } from "./script-code.js";
9
9
  import * as actionFactories from "./tasks.js";
10
- import type { ScriptOutputs } from "./tasks.js";
10
+ import type { ExecuteScriptOutput, ScriptOutputs } from "./tasks.js";
11
11
  import { type WorkflowOutputDeclaration } from "./workflow-output.js";
12
12
  /** Structural empty object — neutral element for the accumulated action map. */
13
13
  type EmptyObject = {
@@ -97,7 +97,7 @@ export declare const FOR_EACH_PLACEHOLDER = "__forEach__";
97
97
  * accessor → canonical; identity for most kinds. Validated against
98
98
  * TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
99
99
  */
100
- export declare function rewriteCanonicalOutputRefName(taskKey: string | undefined, name: string, taskRefKey?: string, schema?: unknown): string;
100
+ export declare function rewriteCanonicalOutputRefName(taskKey: string | undefined, name: string, taskRefKey?: string, schema?: unknown, apiResponseType?: string): string;
101
101
  /** One finalized automation-level output property (already serialized to wire). */
102
102
  export interface OutputEntry {
103
103
  readonly name: string;
@@ -198,37 +198,63 @@ type WithAction<TMode extends BuilderMode, TItem, TTrigger, TActions extends Rec
198
198
  */
199
199
  interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown> = EmptyObject, TMode extends BuilderMode = "root", TItem = never> {
200
200
  /**
201
- * `inputs` is a ctx-lambda mapping input names to
202
- * refs/values; `code` is ALWAYS a FUNCTION — the TS contract is the
203
- * authoring surface (typed `input.parameters` from `inputs`; the return
204
- * type flows to `ctx.actions.<name>.result.*` downstream; no raw-string
205
- * alternative — #125). Under `elementum build`, the body ships byte-exact
206
- * from the automation file's own untranspiled source (see
207
- * `tryExtractFromCurrentSource` in `script-code.ts`) rather than from the
208
- * transpiled function's `toString()`, which would otherwise reformat a
209
- * pulled script's exact text on every rebuild. Outside `elementum build`
210
- * (e.g. constructing an automation directly in a test), the body falls
211
- * back to `extractScriptBody`'s `toString()` extraction.
201
+ * `inputs` is a ctx-lambda mapping input names to refs/values. `code` is
202
+ * either an inline function (#125) or a `scriptFile(...)` reference to a
203
+ * plain `.js` body. Under `elementum build`, an inline body's text ships
204
+ * byte-exact from the automation file (see `tryExtractFromCurrentSource`);
205
+ * outside build it falls back to `extractScriptBody`'s `toString()`. A
206
+ * `scriptFile` body is the file's text, never type-stripped.
212
207
  *
213
- * The output schema is INFERRED from the code's `return {...}` literals —
214
- * property names statically, property types from literal values (default
215
- * text). Pass `outputs` only to override: a non-text property whose value
216
- * isn't a literal, or a return the scan can't enumerate. Pass `outputs:
217
- * null` (rather than omitting it) to explicitly suppress inference — the
218
- * printer does this for pulled actions whose platform resource genuinely
219
- * carries no `output_schema`, so a rebuild doesn't invent one and drift
220
- * from state.
208
+ * Downstream `ctx.actions.<name>.result.*` typing:
209
+ * - inline function: from the function's return type;
210
+ * - `scriptFile` with a declared `outputs`: from that schema (#2125);
211
+ * - `scriptFile` with `outputs` omitted or `null`: `Record<string, unknown>`.
212
+ *
213
+ * For an inline function the output schema is also INFERRED from
214
+ * `return {...}` literals (property names statically; types from literals,
215
+ * default text). Pass `outputs` to override a non-text property or a return
216
+ * the scan can't enumerate. Pass `outputs: null` to suppress inference —
217
+ * the printer does this for pulled actions with no platform
218
+ * `output_schema`, so a rebuild doesn't invent one and drift from state.
219
+ * For `scriptFile`, inference from the file is not available at the type
220
+ * level: declare `outputs` when downstream steps need typed results.
221
+ */
222
+ executeScript<TName extends string, I extends Record<string, ValueOrRef<unknown> | actionFactories.ExecuteScriptListInputToken>, const O extends ScriptOutputs>(name: TName, opts: {
223
+ readonly inputs?: (ctx: NestedActionContext<TTrigger, TActions, TVars, TItem>) => I;
224
+ readonly code: ScriptFile;
225
+ readonly outputs: O;
226
+ }, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
227
+ result: ExecuteScriptOutput<O>["result"];
228
+ textResult: string;
229
+ stringArrayResult: readonly string[];
230
+ numberArrayResult: readonly number[];
231
+ }>;
232
+ /**
233
+ * `scriptFile` with `outputs` omitted, `null`, or typed `ScriptOutputs | null`
234
+ * (or wider): untyped result, as before #2125. A plain non-null
235
+ * `ScriptOutputs` variable still takes the overload above, so each result
236
+ * key is a union of every output value type rather than `unknown`.
221
237
  */
238
+ executeScript<TName extends string, I extends Record<string, ValueOrRef<unknown> | actionFactories.ExecuteScriptListInputToken>>(name: TName, opts: {
239
+ readonly inputs?: (ctx: NestedActionContext<TTrigger, TActions, TVars, TItem>) => I;
240
+ readonly code: ScriptFile;
241
+ readonly outputs?: ScriptOutputs | null;
242
+ }, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
243
+ result: Record<string, unknown>;
244
+ textResult: string;
245
+ stringArrayResult: readonly string[];
246
+ numberArrayResult: readonly number[];
247
+ }>;
248
+ /** Inline function: result keys follow the function's return type. */
222
249
  executeScript<TName extends string, I extends Record<string, ValueOrRef<unknown> | actionFactories.ExecuteScriptListInputToken>, R extends Record<string, unknown> = Record<string, unknown>>(name: TName, opts: {
223
250
  readonly inputs?: (ctx: NestedActionContext<TTrigger, TActions, TVars, TItem>) => I;
224
- readonly code: ((input: ScriptInput<ResolvedRefs<NoInfer<I>>>) => R) | ScriptFile;
251
+ readonly code: (input: ScriptInput<ResolvedRefs<NoInfer<I>>>) => R;
225
252
  /**
226
253
  * Override the inferred output schema: property name → scalar type or a
227
254
  * recursive `{ type: "array", items }` / `{ type: "object", properties }`
228
255
  * descriptor; the object form may also carry `name` for the root.
229
- * `null`
230
- * explicitly means "no schema" and suppresses inference; omitting the
231
- * option infers from the code body.
256
+ * `null` explicitly means "no schema" and suppresses inference; omitting
257
+ * the option infers from the code body.
232
258
  */
233
259
  readonly outputs?: ScriptOutputs | null;
234
260
  }, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
@@ -278,12 +304,7 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
278
304
  aiFileAnalysis<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AiFileAnalysisOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
279
305
  output: unknown;
280
306
  }>;
281
- apiRequest<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApiRequestOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
282
- response: unknown;
283
- file?: unknown;
284
- statusCode?: unknown;
285
- textResponse?: unknown;
286
- }>;
307
+ apiRequest<TName extends string, R extends import("./tasks.js").ApiResponseType = "JSON">(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApiRequestOptions<R>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").ApiRequestOutputs<R>>;
287
308
  calculation<TName extends string, const Values extends import("./tasks.js").CalculationValues>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").CalculationOptions<Values>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").CalculationValueOutputs<Values>>;
288
309
  calculation<TName extends string, const Entries extends readonly import("./tasks.js").CalculationEntry[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").LegacyCalculationOptions<Entries>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").CalculationOutputs<Entries>>;
289
310
  procedure<TName extends string, const Parameters extends readonly import("../../catalog/types.js").ProcedureParameterType[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").TypedProcedureOptions<Parameters>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
@@ -31,7 +31,7 @@ import { isOnDemandRecordType } from "../shared/types/field-types.js";
31
31
  import { buildContext, createForEachItemProxy } from "../shared/context.js";
32
32
  import { outputFieldTypesFromScriptSchema, scriptSchemaIsSingleStringArray } from "./output-field-types.js";
33
33
  import { isRef } from "../shared/ref.js";
34
- import { API_TASK_REF_WIRE_NAMES, OUTPUT_KEY_CANONICAL, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
34
+ import { apiTaskCanonicalOutputName, apiTaskJsonRefsKeys, apiTaskRefsIndex, OUTPUT_KEY_CANONICAL, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
35
35
  import { extractScriptBody, inferOutputSchema, isScriptFile, readScriptFile, toPlatformScriptBody, tryExtractFromCurrentSource } from "./script-code.js";
36
36
  import { serializeNode } from "./serialize.js";
37
37
  // Runtime factory imports stay below the public action-native surface. Their
@@ -130,6 +130,30 @@ function collectExecuteScriptOutputSchemas(tasks) {
130
130
  visit(tasks);
131
131
  return out;
132
132
  }
133
+ /** Build error for an output a JSON apiRequest doesn't have (edk#2058). */
134
+ function apiTaskMissingOutput(taskRefKey, name, apiResponseType) {
135
+ throw new EntityTfError(`apiRequest task "${taskRefKey ?? "?"}" has no "${name}" output: a ${apiResponseType ?? "JSON"} response ` +
136
+ `exposes only .response, .textResponse and .statusCode (refs ${apiTaskJsonRefsKeys().map((k) => `"${k}"`).join(", ")}). ` +
137
+ "Reference one of those, or set the task's responseType to the kind of response it returns.");
138
+ }
139
+ /**
140
+ * Map every apiRequest task's refKey to its `responseType`, descending into
141
+ * operator children — mirrors `collectTaskKinds`. Its refs-map keys depend on
142
+ * it (edk#2058).
143
+ */
144
+ function collectApiResponseTypes(tasks) {
145
+ const out = new Map();
146
+ const visit = (entries) => {
147
+ for (const { name, def } of entries) {
148
+ if (def.key === "api" && typeof def.config.responseType === "string")
149
+ out.set(name, def.config.responseType);
150
+ for (const child of def.operatorChildren ?? [])
151
+ visit(child.tasks);
152
+ }
153
+ };
154
+ visit(tasks);
155
+ return out;
156
+ }
133
157
  /**
134
158
  * Resolve an automation-level output's `valueType` from its (already
135
159
  * serialized) value. Explicit workflowOutput metadata wins. Otherwise, infer
@@ -327,12 +351,12 @@ function assertKnownScriptOutput(name, taskRefKey, schema, checkDeclaredResult)
327
351
  * - single-scalar-output tasks (see `OUTPUT_KEY_WIRE_NAME`): `output` →
328
352
  * the platform's actual output name for that task kind.
329
353
  */
330
- function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDeclaredScriptResult = true) {
354
+ function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDeclaredScriptResult = true, apiResponseType) {
331
355
  if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
332
356
  throw findRelatedRecordsTotalCountError(taskRefKey);
333
357
  }
334
358
  if (taskKey === "api") {
335
- return API_TASK_REF_WIRE_NAMES[name] ?? name;
359
+ return apiTaskRefsIndex(apiResponseType, name) ?? apiTaskMissingOutput(taskRefKey, name, apiResponseType);
336
360
  }
337
361
  if (taskKey === "recordSearch" && name === "totalCount") {
338
362
  return "Records Size";
@@ -386,7 +410,7 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDecla
386
410
  * accessor → canonical; identity for most kinds. Validated against
387
411
  * TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
388
412
  */
389
- export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema) {
413
+ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema, apiResponseType) {
390
414
  if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
391
415
  throw findRelatedRecordsTotalCountError(taskRefKey);
392
416
  }
@@ -399,8 +423,10 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema)
399
423
  // provider's refs-map DISPLAY label ("Content" / "Content Type" / "Name", via
400
424
  // API_TASK_REF_WIRE_NAMES). Keep the base display rewrite. Top-level api
401
425
  // outputs ARE contract names and ride the envelope as identity.
402
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
426
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, true, apiResponseType);
403
427
  }
428
+ if (taskKey === "api")
429
+ return apiTaskCanonicalOutputName(apiResponseType, name) ?? apiTaskMissingOutput(taskRefKey, name, apiResponseType);
404
430
  if ((taskKey === "recordSearch" || taskKey === "tableRecordsSearch") && name === "totalCount") {
405
431
  // Both expose a `totalCount` accessor, but the executors' canonical count
406
432
  // output is `count` (aspect_records_search.count / table_records_search.count).
@@ -460,6 +486,15 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema)
460
486
  }
461
487
  return name;
462
488
  }
489
+ /** Rename a task's `.record` reference to its whole-record output, in place. */
490
+ function useWholeTaskRecord(value, taskKindByRefKey) {
491
+ const mapped = value?.taskReference;
492
+ if (typeof mapped?.taskRefKey !== "string" || mapped.name !== "record")
493
+ return;
494
+ const wholeRecord = WHOLE_RECORD_REF_WIRE_NAMES[taskKindByRefKey.get(mapped.taskRefKey) ?? ""];
495
+ if (wholeRecord !== undefined)
496
+ mapped.name = wholeRecord;
497
+ }
463
498
  /**
464
499
  * Walk a serialized wire node and rewrite, in place, the `name` of every task
465
500
  * output reference whose target task needs an output-name rewrite. Two wire
@@ -477,22 +512,23 @@ function rewriteTaskOutputRefs(node, taskKindByRefKey, scriptSchemas,
477
512
  // those positions.
478
513
  canonical = false,
479
514
  // Field assignments rebuild an undeclared result.* as the value envelope.
480
- checkDeclaredScriptResult = true) {
515
+ checkDeclaredScriptResult = true, apiResponseTypes = new Map()) {
481
516
  if (Array.isArray(node)) {
482
517
  for (const item of node)
483
- rewriteTaskOutputRefs(item, taskKindByRefKey, scriptSchemas, canonical, checkDeclaredScriptResult);
518
+ rewriteTaskOutputRefs(item, taskKindByRefKey, scriptSchemas, canonical, checkDeclaredScriptResult, apiResponseTypes);
484
519
  return;
485
520
  }
486
521
  if (node === null || typeof node !== "object")
487
522
  return;
488
523
  const rec = node;
524
+ // A script input reads a task's `.record` as the whole record, mapped or not.
525
+ const scriptInputs = rec.executeScript?.inputs;
526
+ if (Array.isArray(scriptInputs)) {
527
+ for (const input of scriptInputs)
528
+ useWholeTaskRecord(input?.value, taskKindByRefKey);
529
+ }
489
530
  if (Array.isArray(rec.field_mappings)) {
490
- const mapped = rec.value?.taskReference;
491
- const wholeRecord = typeof mapped?.taskRefKey === "string" && mapped.name === "record"
492
- ? WHOLE_RECORD_REF_WIRE_NAMES[taskKindByRefKey.get(mapped.taskRefKey) ?? ""]
493
- : undefined;
494
- if (wholeRecord !== undefined)
495
- mapped.name = wholeRecord;
531
+ useWholeTaskRecord(rec.value, taskKindByRefKey);
496
532
  // Field mappings read a trigger's whole record too, which shares its
497
533
  // display name with the record ID (edk#1284); see TRIGGER_WHOLE_RECORD_MARKER.
498
534
  const value = rec.value;
@@ -504,14 +540,15 @@ checkDeclaredScriptResult = true) {
504
540
  if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
505
541
  const kind = taskKindByRefKey.get(ref.taskRefKey);
506
542
  const schema = scriptSchemas.get(ref.taskRefKey);
543
+ const apiResponseType = apiResponseTypes.get(ref.taskRefKey);
507
544
  ref.name = canonical
508
- ? rewriteCanonicalOutputRefName(kind, ref.name, ref.taskRefKey, schema)
509
- : rewriteForwardTaskRefName(kind, ref.name, ref.taskRefKey, schema, checkDeclaredScriptResult);
545
+ ? rewriteCanonicalOutputRefName(kind, ref.name, ref.taskRefKey, schema, apiResponseType)
546
+ : rewriteForwardTaskRefName(kind, ref.name, ref.taskRefKey, schema, checkDeclaredScriptResult, apiResponseType);
510
547
  }
511
548
  if (rec.type === "TASK" && typeof rec.taskRefKey === "string" && typeof rec.name === "string") {
512
549
  // Filter `{type:"TASK"}` shapes never appear in a workflow OUTPUT subtree;
513
550
  // keep the display rewrite (#1271's filter path) regardless of `canonical`.
514
- rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey, scriptSchemas.get(rec.taskRefKey), false);
551
+ rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey, scriptSchemas.get(rec.taskRefKey), false, apiResponseTypes.get(rec.taskRefKey));
515
552
  }
516
553
  for (const [key, v] of Object.entries(rec)) {
517
554
  // A calc-engine mustache subtree (`calculationReference` → templateReference)
@@ -519,7 +556,7 @@ checkDeclaredScriptResult = true) {
519
556
  // (decodeCalculationTaskMustache) stays idempotent.
520
557
  const childCanonical = key === "calculationReference" ? false : canonical;
521
558
  const childCheck = key === "workflowFields" ? false : checkDeclaredScriptResult;
522
- rewriteTaskOutputRefs(v, taskKindByRefKey, scriptSchemas, childCanonical, childCheck);
559
+ rewriteTaskOutputRefs(v, taskKindByRefKey, scriptSchemas, childCanonical, childCheck, apiResponseTypes);
523
560
  }
524
561
  }
525
562
  /**
@@ -667,7 +704,8 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
667
704
  // untranspiled source when running under `elementum build`
668
705
  // (tryExtractFromCurrentSource); fall back to the toString()-based
669
706
  // extractScriptBody otherwise (e.g. an automation built directly in a
670
- // test, with no tracked source file). Either way the body is computed
707
+ // test, with no tracked source file, or a hand-typed body whose source
708
+ // is not plain JavaScript, #1927). Either way the body is computed
671
709
  // exactly ONCE here and threaded straight into the ActionDef — no
672
710
  // separate re-extraction downstream.
673
711
  // Explicit `outputs` always wins; an explicit `null` means "no schema"
@@ -771,15 +809,16 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
771
809
  __finalize() {
772
810
  const taskKindByRefKey = collectTaskKinds(state.tasks);
773
811
  const scriptSchemas = collectExecuteScriptOutputSchemas(state.tasks);
812
+ const apiResponseTypes = collectApiResponseTypes(state.tasks);
774
813
  const tasks = state.tasks.map((t) => serializeTaskEntry(t.name, t.def, t.displayName, t.hclParent));
775
814
  // Deep copy: the rewrites below mutate in place, and `state.outputs` is
776
815
  // shared by every build of this definition (#1536).
777
816
  const outputs = state.outputs?.map((o) => structuredClone(o));
778
- rewriteTaskOutputRefs(tasks, taskKindByRefKey, scriptSchemas);
817
+ rewriteTaskOutputRefs(tasks, taskKindByRefKey, scriptSchemas, false, true, apiResponseTypes);
779
818
  // Workflow OUTPUTS emit the platform's CANONICAL output name (edk#835);
780
819
  // task inputs/filters above stay on the display path (#1271 owns them).
781
820
  if (outputs)
782
- rewriteTaskOutputRefs(outputs, taskKindByRefKey, scriptSchemas, /* canonical */ true);
821
+ rewriteTaskOutputRefs(outputs, taskKindByRefKey, scriptSchemas, /* canonical */ true, true, apiResponseTypes);
783
822
  // Trigger reference names are NOT canonicalized: the authored name is
784
823
  // the name, everywhere in EDK. (Mobius canonicalizes reference names in
785
824
  // ITS storage — `ValueReference.ofTriggerReference` — but on the tf
@@ -97,13 +97,13 @@ export type TriggerAst = {
97
97
  customResponse?: {
98
98
  success?: {
99
99
  enabled: boolean;
100
- format: "JSON" | "XML" | "Text";
100
+ format: "JSON" | "XML" | "TEXT";
101
101
  statusCode?: number;
102
102
  body: string;
103
103
  };
104
104
  failure?: {
105
105
  enabled: boolean;
106
- format: "JSON" | "XML" | "Text";
106
+ format: "JSON" | "XML" | "TEXT";
107
107
  statusCode?: number;
108
108
  body: string;
109
109
  };
@@ -111,14 +111,15 @@ export type TriggerAst = {
111
111
  } | {
112
112
  kind: "temporal";
113
113
  app: AppRefAst | UnresolvedRefAst;
114
- fieldKey: string;
114
+ field: FieldRefAst | UnresolvedRefAst;
115
115
  temporalUnit: "MINUTES" | "HOURS" | "DAYS";
116
116
  value: number;
117
+ filter?: Filter<RefExpr, RefExpr>;
117
118
  } | {
118
119
  kind: "approvalProcessStatusUpdated";
119
120
  app: AppRefAst | UnresolvedRefAst;
120
121
  approvalChain?: string | ApprovalChainRefAst;
121
- status: "ACTIVE" | "STEP_APPROVED" | "CANCELLED" | "DENIED" | "APPROVED";
122
+ status: "ACTIVE" | "STEP_APPROVED" | "CANCELLED" | "DENIED" | "APPROVED" | "EXCEPTION";
122
123
  filter?: Filter<RefExpr, RefExpr>;
123
124
  } | {
124
125
  kind: "schedule";
@@ -133,6 +134,7 @@ export type TriggerAst = {
133
134
  datamine: DatamineRefAst | string;
134
135
  fireOnAlert?: boolean;
135
136
  fireOnRecovery?: boolean;
137
+ filter?: Filter<RefExpr, RefExpr>;
136
138
  } | {
137
139
  kind: "emailReceived";
138
140
  emailAliasId: string;
@@ -142,6 +144,7 @@ export type TriggerAst = {
142
144
  kind: "surveyResponseCreate";
143
145
  app: AppRefAst | UnresolvedRefAst;
144
146
  survey: string;
147
+ filter?: Filter<RefExpr, RefExpr>;
145
148
  };
146
149
  export interface AutomationAst {
147
150
  readonly ownerHandle: string;
@@ -534,6 +534,7 @@ function emptyImports() {
534
534
  usesScriptInput: false,
535
535
  usesRefType: false,
536
536
  usesTableSearchTableRef: false,
537
+ usesGroupRef: false,
537
538
  };
538
539
  }
539
540
  /** Folder (inside the automations folder) that holds printed script files. */
@@ -776,8 +777,12 @@ function renderHeader(ast, imports, _opts) {
776
777
  return alias ? `${name} as ${alias}` : name;
777
778
  });
778
779
  lines.push(`import { ${sortedSpecifiers.join(", ")} } from "${sdkPackageSpecifier("automations")}";`);
779
- if (imports.usesTableSearchTableRef) {
780
- lines.push(`import { tableSearchTableRef } from "${sdkPackageSpecifier("catalog")}";`);
780
+ const catalogNamed = [
781
+ ...(imports.usesGroupRef ? ["groupRef"] : []),
782
+ ...(imports.usesTableSearchTableRef ? ["tableSearchTableRef"] : []),
783
+ ];
784
+ if (catalogNamed.length > 0) {
785
+ lines.push(`import { ${catalogNamed.join(", ")} } from "${sdkPackageSpecifier("catalog")}";`);
781
786
  }
782
787
  if (imports.usesSecret || imports.usesTemplate || imports.usesUnresolvedField || imports.usesUnsafePlatformId || imports.usesRefType) {
783
788
  const coreNamed = [];
@@ -869,15 +874,14 @@ function printTrigger(trigger, state) {
869
874
  }
870
875
  case "temporal": {
871
876
  const temporal = trackFactory("temporal", state);
872
- const fieldExpr = trigger.app.kind === "app"
873
- ? printFieldRef(trigger.app.appHandle, trigger.fieldKey, state)
874
- : `${quote(trigger.fieldKey.replace(/^__unresolved_/, ""))} as any /* TODO: unresolved field */`;
875
877
  const parts = [
876
878
  `app: ${printRef(trigger.app, state, DEFAULT_CTX)}`,
877
- `field: ${fieldExpr}`,
879
+ `field: ${printRef(trigger.field, state, DEFAULT_CTX)}`,
878
880
  `temporalUnit: ${quote(trigger.temporalUnit)}`,
879
881
  `value: ${trigger.value}`,
880
882
  ];
883
+ if (trigger.filter)
884
+ parts.push(`filter: ${printFilter(trigger.filter, state)}`);
881
885
  return `${temporal}({\n ${parts.join(",\n ")}\n })`;
882
886
  }
883
887
  case "approvalProcessStatusUpdated": {
@@ -939,6 +943,9 @@ function printTrigger(trigger, state) {
939
943
  if (trigger.fireOnRecovery !== undefined) {
940
944
  parts.push(`fireOnRecovery: ${trigger.fireOnRecovery}`);
941
945
  }
946
+ if (trigger.filter) {
947
+ parts.push(`filter: ${printFilter(trigger.filter, state)}`);
948
+ }
942
949
  return `${dataMine}({ ${parts.join(", ")} })`;
943
950
  }
944
951
  case "emailReceived": {
@@ -955,6 +962,7 @@ function printTrigger(trigger, state) {
955
962
  const parts = [
956
963
  `app: ${printRef(trigger.app, state, DEFAULT_CTX)}`,
957
964
  `survey: unsafePlatformId(${quote(trigger.survey)})${unresolvedReferenceComment(trigger.survey, state.unresolvedReferences)}`,
965
+ ...(trigger.filter ? [`filter: ${printFilter(trigger.filter, state)}`] : []),
958
966
  ];
959
967
  return `${surveyResponseCreate}({\n ${parts.join(",\n ")}\n })`;
960
968
  }
@@ -975,13 +983,6 @@ function recordTriggerBody(trigger, state) {
975
983
  parts.push(`thinkUi: ${trigger.thinkUi}`);
976
984
  return `{ ${parts.join(", ")} }`;
977
985
  }
978
- function printFieldRef(appHandle, fieldKey, state) {
979
- if (!fieldKey.startsWith("__unresolved_")) {
980
- return `catalog.${catalogOwnerHandle(state, appHandle)}.fields${safeMember(fieldKey)}`;
981
- }
982
- const uuid = fieldKey.replace(/^__unresolved_/, "");
983
- return `${quote(uuid)} as any /* TODO: unresolved field */`;
984
- }
985
986
  // ---------------------------------------------------------------------------
986
987
  // Tasks
987
988
  // ---------------------------------------------------------------------------
@@ -1062,7 +1063,7 @@ function formatExecuteScript(task, state, indent, refCtx = DEFAULT_CTX) {
1062
1063
  }
1063
1064
  }
1064
1065
  if (task.args.outputs !== undefined && task.args.outputs !== null && typeof task.args.outputs === "object") {
1065
- lines.push(`${configPad}outputs: ${printObjectLiteral(task.args.outputs, state, indent + 1, DEFAULT_CTX)},`);
1066
+ lines.push(`${configPad}outputs: ${printOutputSchemaLiteral(task.args.outputs, indent + 1)},`);
1066
1067
  }
1067
1068
  else {
1068
1069
  // No `output_schema` on the platform resource — print an explicit `null`
@@ -1862,6 +1863,10 @@ function printRef(ref, state, refCtx) {
1862
1863
  state.imports.usesSecret = true;
1863
1864
  return `secret(${quote(ref.key)})`;
1864
1865
  case "orgGroup":
1866
+ if (ref.inOrgCatalog === false) {
1867
+ state.imports.usesGroupRef = true;
1868
+ return `groupRef({ name: ${quote(ref.name)} })`;
1869
+ }
1865
1870
  state.imports.usesOrg = true;
1866
1871
  return `org.groups${safeMember(ref.groupKey)}`;
1867
1872
  case "documentModel":
@@ -2008,6 +2013,26 @@ function printObjectLiteral(obj, state, indent, refCtx) {
2008
2013
  });
2009
2014
  return `{\n${lines.join("\n")}\n${" ".repeat(indent - 1)}}`;
2010
2015
  }
2016
+ /**
2017
+ * An output schema is plain data: a property named `code` or `script` is an
2018
+ * output's type, not a script body, so none of printArgValue's detection applies.
2019
+ */
2020
+ function printOutputSchemaLiteral(value, indent) {
2021
+ const pad = " ".repeat(indent);
2022
+ const closePad = " ".repeat(indent - 1);
2023
+ if (Array.isArray(value)) {
2024
+ if (value.length === 0)
2025
+ return "[]";
2026
+ return `[\n${value.map((item) => `${pad}${printOutputSchemaLiteral(item, indent + 1)},`).join("\n")}\n${closePad}]`;
2027
+ }
2028
+ if (value && typeof value === "object") {
2029
+ const entries = Object.entries(value);
2030
+ if (entries.length === 0)
2031
+ return "{}";
2032
+ return `{\n${entries.map(([k, v]) => `${pad}${safeKey(k)}: ${printOutputSchemaLiteral(v, indent + 1)},`).join("\n")}\n${closePad}}`;
2033
+ }
2034
+ return literalJson(value);
2035
+ }
2011
2036
  function printArrayLiteral(arr, state, indent, refCtx) {
2012
2037
  if (arr.length === 0)
2013
2038
  return "[]";
@@ -64,6 +64,7 @@ interface DecodeContext {
64
64
  readonly tableRefName: string;
65
65
  readonly name: string;
66
66
  }>;
67
+ readonly foreignFileReaderRefsById?: FromTfContext["foreignFileReaderRefsById"];
67
68
  readonly picklistOptionLabelById?: ReadonlyMap<string, string>;
68
69
  readonly fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
69
70
  /** Task resource address → target aspect refName (from `object_id`). */
@@ -81,6 +82,12 @@ interface DecodeContext {
81
82
  readonly stringifiedValueReferences?: {
82
83
  unresolved: boolean;
83
84
  };
85
+ /** Names of static group recipients org.ts doesn't carry yet (edk#2241), for one pull diagnostic each. */
86
+ readonly groupsMissingFromOrg?: Set<string>;
87
+ /** Says what a task id that matches none of this automation's tasks points to (#2054). */
88
+ readonly describeUnresolvedTask?: (taskId: string) => string;
89
+ /** This automation's platform id, from its import block. */
90
+ readonly automationId?: string;
84
91
  }
85
92
  /**
86
93
  * The same outputs as seen from a CALCULATION formula, which addresses a
@@ -92,6 +99,8 @@ interface DecodeContext {
92
99
  export declare const RECORD_SEARCH_CALCULATION_REF_NAME_TO_TS: Readonly<Record<string, readonly string[]>>;
93
100
  export declare const AI_SEARCH_TABLE_TASK_REF_SEGMENT_TO_TS: Readonly<Record<string, string>>;
94
101
  export declare const TABLE_RECORDS_SEARCH_TASK_REF_SEGMENT_TO_TS: Readonly<Record<string, string>>;
102
+ /** Option ids `filterOptionLabel` will print as labels. The export still holds the id. */
103
+ export declare function filterOptionIdsPrintedAsLabels(doc: TfDocument, optionLabelById: ReadonlyMap<string, string> | undefined): ReadonlySet<string>;
95
104
  export declare function inferredPublishOutputType(value: TfValue, ctx: DecodeContext): {
96
105
  readonly fieldType: string;
97
106
  readonly multiple: boolean;
@@ -129,13 +138,35 @@ export declare class UnsupportedMultiTriggerError extends EntityTfError {
129
138
  readonly triggerCount: number;
130
139
  constructor(automationName: string, triggerCount: number);
131
140
  }
141
+ /**
142
+ * A filter names a task id that is not one of its automation's tasks (#2054).
143
+ * Pull fails on it rather than skip the automation: the message says what the
144
+ * id points to so it can be fixed in the platform's automation builder.
145
+ */
146
+ export declare class UnresolvedTaskFilterRefError extends EntityTfError {
147
+ readonly taskId: string;
148
+ readonly target: string;
149
+ readonly automationId: string | undefined;
150
+ readonly where: string | undefined;
151
+ constructor(taskId: string, target: string, automationId: string | undefined, where?: string);
152
+ /** Run `decode`, naming `where` (the task, branch or trigger whose filter it is) on this error. */
153
+ static within<T>(where: string, decode: () => T): T;
154
+ }
132
155
  /**
133
156
  * A bare service_account_id belongs to an app this export does not contain.
134
157
  * Pull cannot print a serviceAccountRef until that app is in the workspace,
135
158
  * and printing nothing would clear the live account.
136
159
  */
137
160
  export declare class UnresolvedForeignServiceAccountError extends EntityTfError {
138
- constructor(automationLabel: string);
161
+ constructor(automationLabel: string, message?: string);
162
+ }
163
+ /**
164
+ * The service account is another app's, looked up through that app
165
+ * (`data.elementum_app.<label>`), and no app in the workspace declares it.
166
+ * Pull names the app so the next step can say which one to pull.
167
+ */
168
+ export declare class UnresolvedServiceAccountOwnerAppError extends UnresolvedForeignServiceAccountError {
169
+ constructor(automationLabel: string, serviceAccountName: string | undefined, missingApp: string);
139
170
  }
140
171
  /**
141
172
  * #1320: a task reads the current item of a loop that doesn't enclose it.
@@ -176,6 +207,8 @@ export interface AutomationFromTfContext {
176
207
  readonly procedureKeysByDiscriminator?: ReadonlyMap<string, string>;
177
208
  readonly groupKeysByName?: ReadonlyMap<string, string>;
178
209
  readonly serviceAccountsById?: FromTfContext["serviceAccountsById"];
210
+ readonly foreignFileReaderRefsById?: FromTfContext["foreignFileReaderRefsById"];
211
+ readonly foreignAppRefNamespaces?: ReadonlyMap<string, string>;
179
212
  }
180
213
  export interface AutomationGraphFromTfResult {
181
214
  readonly automation?: AutomationAst;
@@ -199,5 +232,5 @@ export declare function automationFromTf(doc: TfDocument, automationLabel: strin
199
232
  }>, foreignTableRefsById?: ReadonlyMap<string, {
200
233
  readonly tableRefName: string;
201
234
  readonly name: string;
202
- }>, picklistOptionLabelById?: ReadonlyMap<string, string>, fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>, foreignAppRefNames?: ReadonlyMap<string, string>, foreignElementRefNames?: ReadonlyMap<string, string>, procedureKeysByDiscriminator?: ReadonlyMap<string, string>, foreignTaskRefNames?: ReadonlyMap<string, string>, groupKeysByName?: ReadonlyMap<string, string>, serviceAccountsById?: FromTfContext["serviceAccountsById"]): AutomationFromTfResult;
235
+ }>, picklistOptionLabelById?: ReadonlyMap<string, string>, fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>, foreignAppRefNames?: ReadonlyMap<string, string>, foreignElementRefNames?: ReadonlyMap<string, string>, procedureKeysByDiscriminator?: ReadonlyMap<string, string>, foreignTaskRefNames?: ReadonlyMap<string, string>, groupKeysByName?: ReadonlyMap<string, string>, serviceAccountsById?: FromTfContext["serviceAccountsById"], foreignFileReaderRefsById?: FromTfContext["foreignFileReaderRefsById"], foreignAppRefNamespaces?: ReadonlyMap<string, string>): AutomationFromTfResult;
203
236
  export {};