@elementumai/edk 0.9.15 → 0.9.17
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.
- package/dist-sdk/pull/util.d.ts +0 -15
- package/dist-sdk/pull/util.js +44 -5
- package/dist-sdk/src/engine/build/context.d.ts +2 -2
- package/dist-sdk/src/engine/progress.d.ts +4 -0
- package/dist-sdk/src/engine/progress.js +16 -4
- package/dist-sdk/src/engine/pull/context.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +4 -0
- package/dist-sdk/src/engine/pull/ref-only.js +11 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +47 -12
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +5 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +23 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +27 -2
- package/dist-sdk/src/entities/agent/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/agent/from-tf.js +18 -3
- package/dist-sdk/src/entities/agent/to-tf.js +14 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +79 -2
- package/dist-sdk/src/entities/agent/tools.js +2 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +45 -3
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +72 -20
- package/dist-sdk/src/entities/app/module.js +8 -0
- package/dist-sdk/src/entities/app/to-tf.js +1 -0
- package/dist-sdk/src/entities/automation/build.d.ts +12 -5
- package/dist-sdk/src/entities/automation/build.js +30 -11
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +4 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +108 -23
- package/dist-sdk/src/entities/automation/from-tf.d.ts +73 -5
- package/dist-sdk/src/entities/automation/from-tf.js +270 -30
- package/dist-sdk/src/entities/automation/index.d.ts +2 -1
- package/dist-sdk/src/entities/automation/index.js +2 -1
- package/dist-sdk/src/entities/automation/module.js +6 -7
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +5 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +12 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +22 -0
- package/dist-sdk/src/entities/automation/script-code.js +13 -4
- package/dist-sdk/src/entities/automation/tasks.d.ts +61 -5
- package/dist-sdk/src/entities/automation/tasks.js +42 -9
- package/dist-sdk/src/entities/automation/to-tf.d.ts +0 -2
- package/dist-sdk/src/entities/automation/to-tf.js +85 -36
- package/dist-sdk/src/entities/automation/triggers.d.ts +5 -2
- package/dist-sdk/src/entities/automation/types.d.ts +2 -0
- package/dist-sdk/src/entities/automation/types.js +5 -0
- package/dist-sdk/src/entities/automation/workflow-output.d.ts +35 -0
- package/dist-sdk/src/entities/automation/workflow-output.js +53 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dashboard/to-tf.js +1 -0
- package/dist-sdk/src/entities/element/build.d.ts +11 -8
- package/dist-sdk/src/entities/element/build.js +14 -5
- package/dist-sdk/src/entities/element/locals.d.ts +2 -2
- package/dist-sdk/src/entities/element/locals.js +6 -2
- package/dist-sdk/src/entities/element/system-fields.d.ts +4 -0
- package/dist-sdk/src/entities/element/system-fields.js +12 -0
- package/dist-sdk/src/entities/element/to-tf.js +1 -0
- package/dist-sdk/src/entities/field/from-tf.js +47 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +2 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -6
- package/dist-sdk/src/entities/search-table/module.js +2 -2
- package/dist-sdk/src/entities/search-table/types.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +12 -2
- package/dist-sdk/src/entities/shared/filters/index.js +17 -1
- package/dist-sdk/src/entities/shared/filters/print.js +25 -11
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +39 -7
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +18 -2
- package/dist-sdk/src/entities/skill/module.js +9 -0
- package/dist-sdk/src/entities/skill/to-tf.js +18 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +18 -4
- package/dist-sdk/src/entities/skill/tools.js +1 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +58 -3
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +78 -43
- package/dist-sdk/src/entities/view/from-tf.js +30 -9
- package/dist-sdk/src/entities/view/to-tf.js +18 -10
- package/dist-sdk/src/entities/widget/from-tf.js +1 -1
- package/dist-sdk/src/entities/widget/to-tf.js +1 -0
- package/dist-sdk/src/graph/index.d.ts +13 -0
- package/dist-sdk/src/graph/index.js +5 -0
- package/dist-sdk/src/graph/types.d.ts +10 -0
- package/package.json +2 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { sanitizeName, tfLabelToTsLabel, isTfExpr } from "../../engine/tf/index.js";
|
|
3
3
|
import { renderAutomationCatalogEntry } from "./catalog-render.js";
|
|
4
4
|
import { preserveAuthoredAutomationPullMeta, printAutomationV2WithScriptFiles, SCRIPT_FILES_DIR } from "./deserializer/print-automation.js";
|
|
5
|
-
import { automationFromTf, automationOwnedAddresses } from "./from-tf.js";
|
|
5
|
+
import { automationFromTf, automationOwnedAddresses, UnsupportedMultiTriggerError } from "./from-tf.js";
|
|
6
6
|
import { scriptFileRefs } from "./script-code.js";
|
|
7
7
|
import { automationToTf } from "./to-tf.js";
|
|
8
8
|
import { ALL_AUTOMATION_SUB_TYPES, AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
|
|
@@ -120,8 +120,13 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
120
120
|
// extract (issue #395 / PR #417 review).
|
|
121
121
|
items.push({ ...extracted.ast, refName: extracted.refName });
|
|
122
122
|
adoptionAddressAliases.push(...extracted.adoptionAddressAliases);
|
|
123
|
+
diagnostics.push(...(extracted.diagnostics ?? []).map((diagnostic) => `${autoLabel}: ${diagnostic}`));
|
|
123
124
|
}
|
|
124
125
|
catch (err) {
|
|
126
|
+
// Multi-trigger is unsupported, not an extract gap. Skipping it would
|
|
127
|
+
// let `pull app` / `pull element` succeed without the automation.
|
|
128
|
+
if (err instanceof UnsupportedMultiTriggerError)
|
|
129
|
+
throw err;
|
|
125
130
|
// Report the automation's FULL graph (trigger/tasks/branches/publish),
|
|
126
131
|
// not just its root - otherwise those children's otherwise-adoptable
|
|
127
132
|
// resource TYPES get imported into state anyway, and build (which
|
|
@@ -220,12 +225,6 @@ export const automationModule = {
|
|
|
220
225
|
.filter((sibling) => sibling.kind === "automation" &&
|
|
221
226
|
sibling.payload?.status === "ACTIVE")
|
|
222
227
|
.map((sibling) => sibling.refName)),
|
|
223
|
-
automationNamesByRefName: new Map((ctx.siblingEntities ?? [])
|
|
224
|
-
.filter((sibling) => sibling.kind === "automation")
|
|
225
|
-
.flatMap((sibling) => {
|
|
226
|
-
const name = sibling.payload?.name;
|
|
227
|
-
return typeof name === "string" && name !== "" ? [[sibling.refName, name]] : [];
|
|
228
|
-
})),
|
|
229
228
|
}),
|
|
230
229
|
},
|
|
231
230
|
catalog: {
|
|
@@ -15,3 +15,8 @@ export declare function outputFieldTypesFromScriptSchema(schema: unknown): Map<s
|
|
|
15
15
|
multiple: boolean;
|
|
16
16
|
kind: string;
|
|
17
17
|
}> | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* A nested result path belongs to its declared top-level object even when the
|
|
20
|
+
* current schema projection does not yet model that object's item properties.
|
|
21
|
+
*/
|
|
22
|
+
export declare function scriptOutputReferenceIsDeclared(outputTypes: ReadonlyMap<string, unknown> | undefined, name: string): boolean;
|
|
@@ -55,3 +55,15 @@ export function outputFieldTypesFromScriptSchema(schema) {
|
|
|
55
55
|
}
|
|
56
56
|
return out.size > 0 ? out : undefined;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* A nested result path belongs to its declared top-level object even when the
|
|
60
|
+
* current schema projection does not yet model that object's item properties.
|
|
61
|
+
*/
|
|
62
|
+
export function scriptOutputReferenceIsDeclared(outputTypes, name) {
|
|
63
|
+
if (outputTypes?.has(name) === true)
|
|
64
|
+
return true;
|
|
65
|
+
if (!name.startsWith("result."))
|
|
66
|
+
return false;
|
|
67
|
+
const root = `result.${name.slice("result.".length).split(".")[0]}`;
|
|
68
|
+
return outputTypes?.has(root) === true;
|
|
69
|
+
}
|
|
@@ -16,6 +16,26 @@
|
|
|
16
16
|
* either side can never introduce a cycle.
|
|
17
17
|
*/
|
|
18
18
|
export declare const OUTPUT_KEY_WIRE_NAME: Readonly<Record<string, string>>;
|
|
19
|
+
/**
|
|
20
|
+
* Compares a raw wire segment against an {@link OUTPUT_KEY_WIRE_NAME} value.
|
|
21
|
+
* The Title-Case wire name above is confirmed against each task's own
|
|
22
|
+
* `refs` map (a stable, schema-derived attribute), but a `taskReference.name`
|
|
23
|
+
* embedded in a filter/formula envelope is a SEPARATE serialization the
|
|
24
|
+
* platform lowercases (live-confirmed on conciergeforfield, sanofi/us: the
|
|
25
|
+
* same aiTransform task's `refs` map has `Response`, but every
|
|
26
|
+
* `taskReference.name` pointing at it says `response`). A case-sensitive
|
|
27
|
+
* compare silently missed the envelope form and fell through to the raw
|
|
28
|
+
* segment, printing an unmapped `.response`/`.refs["response"]` accessor
|
|
29
|
+
* that doesn't exist ("Invalid index" on every plan).
|
|
30
|
+
*
|
|
31
|
+
* Accepts the exact wire key OR that key fully lowercased - not a full
|
|
32
|
+
* case-fold on both sides. `documentModel`'s wire key is already `"text"`,
|
|
33
|
+
* and a file-reader task's schema can declare its own field named `Text`
|
|
34
|
+
* (an arbitrary user-chosen schema name, not this table's business) -
|
|
35
|
+
* folding both sides to lowercase would alias that unrelated `Text` field
|
|
36
|
+
* onto `.output` too and rebuild it as `refs["text"]`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function matchesOutputWireKey(segment: string, wireKey: string): boolean;
|
|
19
39
|
/**
|
|
20
40
|
* apiRequest task outputs in authoring use camelCase segments (`statusCode`,
|
|
21
41
|
* `file.content`, …) but the provider refs map uses display labels — confirmed
|
|
@@ -21,6 +21,28 @@ export const OUTPUT_KEY_WIRE_NAME = {
|
|
|
21
21
|
aiClassify: "Response",
|
|
22
22
|
documentModel: "text",
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Compares a raw wire segment against an {@link OUTPUT_KEY_WIRE_NAME} value.
|
|
26
|
+
* The Title-Case wire name above is confirmed against each task's own
|
|
27
|
+
* `refs` map (a stable, schema-derived attribute), but a `taskReference.name`
|
|
28
|
+
* embedded in a filter/formula envelope is a SEPARATE serialization the
|
|
29
|
+
* platform lowercases (live-confirmed on conciergeforfield, sanofi/us: the
|
|
30
|
+
* same aiTransform task's `refs` map has `Response`, but every
|
|
31
|
+
* `taskReference.name` pointing at it says `response`). A case-sensitive
|
|
32
|
+
* compare silently missed the envelope form and fell through to the raw
|
|
33
|
+
* segment, printing an unmapped `.response`/`.refs["response"]` accessor
|
|
34
|
+
* that doesn't exist ("Invalid index" on every plan).
|
|
35
|
+
*
|
|
36
|
+
* Accepts the exact wire key OR that key fully lowercased - not a full
|
|
37
|
+
* case-fold on both sides. `documentModel`'s wire key is already `"text"`,
|
|
38
|
+
* and a file-reader task's schema can declare its own field named `Text`
|
|
39
|
+
* (an arbitrary user-chosen schema name, not this table's business) -
|
|
40
|
+
* folding both sides to lowercase would alias that unrelated `Text` field
|
|
41
|
+
* onto `.output` too and rebuild it as `refs["text"]`.
|
|
42
|
+
*/
|
|
43
|
+
export function matchesOutputWireKey(segment, wireKey) {
|
|
44
|
+
return segment === wireKey || segment === wireKey.toLowerCase();
|
|
45
|
+
}
|
|
24
46
|
/**
|
|
25
47
|
* apiRequest task outputs in authoring use camelCase segments (`statusCode`,
|
|
26
48
|
* `file.content`, …) but the provider refs map uses display labels — confirmed
|
|
@@ -157,7 +157,7 @@ export function stripTsIgnoreLines(code) {
|
|
|
157
157
|
.join("\n");
|
|
158
158
|
}
|
|
159
159
|
function finishBody(rawBody, rawParams, fullSrc) {
|
|
160
|
-
const body = dedent(stripTsIgnoreLines(rawBody).replace(/^\n+/, "").replace(/\
|
|
160
|
+
const body = dedent(stripTsIgnoreLines(rawBody).replace(/^\n+/, "").replace(/\n[ \t]*$/, ""));
|
|
161
161
|
const params = collectParamNames(rawParams);
|
|
162
162
|
const unknown = freeIdentifiers(body, params);
|
|
163
163
|
if (unknown.length > 0) {
|
|
@@ -513,12 +513,21 @@ function splitTopLevelExpressions(value) {
|
|
|
513
513
|
parts.push(value.slice(start).trim());
|
|
514
514
|
return parts.filter((part) => part.length > 0);
|
|
515
515
|
}
|
|
516
|
-
/**
|
|
516
|
+
/**
|
|
517
|
+
* Strip the common leading indentation (the flush-left fixed point survives
|
|
518
|
+
* ei's heredoc round trip). A blank line is sliced the same as any other
|
|
519
|
+
* line, not force-replaced with "" - the printer (annotateScriptLines) pads
|
|
520
|
+
* a blank line's own original content (e.g. accidental trailing whitespace
|
|
521
|
+
* an editor left in the deployed script - live-confirmed on
|
|
522
|
+
* conciergeforfield, sanofi/us) with the SAME indent every real line gets,
|
|
523
|
+
* specifically so this slice lands back on that original content instead
|
|
524
|
+
* of discarding it.
|
|
525
|
+
*/
|
|
517
526
|
function dedent(body) {
|
|
518
527
|
const lines = body.split("\n");
|
|
519
528
|
const indents = lines.filter((l) => l.trim() !== "").map((l) => /^\s*/.exec(l)[0].length);
|
|
520
529
|
const min = indents.length > 0 ? Math.min(...indents) : 0;
|
|
521
|
-
return lines.map((l) =>
|
|
530
|
+
return lines.map((l) => l.slice(min)).join("\n");
|
|
522
531
|
}
|
|
523
532
|
/**
|
|
524
533
|
* AST-based free-identifier scan using the real TypeScript compiler parser.
|
|
@@ -1274,7 +1283,7 @@ function scanExecuteScriptBodies(src) {
|
|
|
1274
1283
|
if (name !== undefined) {
|
|
1275
1284
|
const body = extractCodeBody(call.args[1]);
|
|
1276
1285
|
if (body !== undefined) {
|
|
1277
|
-
result.set(name, dedent(stripTsIgnoreLines(body).replace(/^\n+/, "").replace(/\
|
|
1286
|
+
result.set(name, dedent(stripTsIgnoreLines(body).replace(/^\n+/, "").replace(/\n[ \t]*$/, "")));
|
|
1278
1287
|
}
|
|
1279
1288
|
}
|
|
1280
1289
|
}
|
|
@@ -203,6 +203,24 @@ export type AiAgentOutput<S extends Record<string, AiAgentOutputField> | undefin
|
|
|
203
203
|
} : {
|
|
204
204
|
readonly result: string;
|
|
205
205
|
};
|
|
206
|
+
/**
|
|
207
|
+
* One file handed to an AI agent. Set exactly one:
|
|
208
|
+
* `file` is a file from an earlier task, `attachment` is one attachment field,
|
|
209
|
+
* and `record` is every file on a record.
|
|
210
|
+
*/
|
|
211
|
+
export type AiAgentAttachment = {
|
|
212
|
+
readonly file: ValueOrRef<unknown>;
|
|
213
|
+
readonly attachment?: never;
|
|
214
|
+
readonly record?: never;
|
|
215
|
+
} | {
|
|
216
|
+
readonly attachment: ValueOrRef<unknown>;
|
|
217
|
+
readonly file?: never;
|
|
218
|
+
readonly record?: never;
|
|
219
|
+
} | {
|
|
220
|
+
readonly record: ValueOrRef<unknown>;
|
|
221
|
+
readonly file?: never;
|
|
222
|
+
readonly attachment?: never;
|
|
223
|
+
};
|
|
206
224
|
export interface AiAgentOptions<S extends Record<string, AiAgentOutputField> | undefined = Record<string, AiAgentOutputField> | undefined> {
|
|
207
225
|
readonly agent: AgentRef;
|
|
208
226
|
readonly prompt: ValueOrRef<unknown>;
|
|
@@ -212,6 +230,8 @@ export interface AiAgentOptions<S extends Record<string, AiAgentOutputField> | u
|
|
|
212
230
|
readonly schema?: S;
|
|
213
231
|
/** Optional connector override. */
|
|
214
232
|
readonly connector?: ConnectorRef;
|
|
233
|
+
/** Files the agent reads while it runs. */
|
|
234
|
+
readonly attachments?: readonly AiAgentAttachment[];
|
|
215
235
|
}
|
|
216
236
|
export declare function aiAgent<const S extends Record<string, AiAgentOutputField> | undefined = undefined>(opts: AiAgentOptions<S>): ActionDef<AiAgentOutput<S>>;
|
|
217
237
|
export interface VariableDecl {
|
|
@@ -236,6 +256,8 @@ export type ScriptOutputScalarType = "text" | "string" | "integer" | "number" |
|
|
|
236
256
|
export type ScriptOutputType = ScriptOutputScalarType | {
|
|
237
257
|
readonly type: "array";
|
|
238
258
|
readonly items: ScriptOutputType;
|
|
259
|
+
/** Name stored on the array's item schema node, distinct from the array property's own name. */
|
|
260
|
+
readonly itemName?: string;
|
|
239
261
|
} | {
|
|
240
262
|
readonly type: "object";
|
|
241
263
|
readonly properties?: ScriptOutputProperties;
|
|
@@ -283,6 +305,36 @@ type ExecuteScriptOutput<O extends ScriptOutputs | undefined> = {
|
|
|
283
305
|
readonly [K in keyof ScriptOutputPropertiesOf<O>]: ExecuteScriptFieldValue<Extract<ScriptOutputPropertiesOf<O>[K], ScriptOutputType>>;
|
|
284
306
|
} : Record<string, unknown>;
|
|
285
307
|
};
|
|
308
|
+
/**
|
|
309
|
+
* One field an executeScript list-valued input exposes to the script, and
|
|
310
|
+
* what to call it there. `alias` is the script-facing property name
|
|
311
|
+
* (`item.<alias>` inside the script body); `field` is the platform field
|
|
312
|
+
* read from each item of the referenced list.
|
|
313
|
+
*/
|
|
314
|
+
export interface ExecuteScriptFieldMapping {
|
|
315
|
+
readonly alias: string;
|
|
316
|
+
/**
|
|
317
|
+
* `UnsafePlatformId` is a pull-fidelity fallback for a mapping export
|
|
318
|
+
* couldn't resolve to a portable field reference - preserved as-is rather
|
|
319
|
+
* than dropped, mirroring the same escape hatch used for a field
|
|
320
|
+
* assignment export can't reconstruct.
|
|
321
|
+
*/
|
|
322
|
+
readonly field: FieldRef | UnsafePlatformId;
|
|
323
|
+
}
|
|
324
|
+
declare const EXECUTE_SCRIPT_LIST_INPUT_MARKER: "__edkExecuteScriptListInput";
|
|
325
|
+
/** @internal — used by build.ts's fluent `.executeScript()` typing; not part of the public surface. */
|
|
326
|
+
export interface ExecuteScriptListInputToken {
|
|
327
|
+
readonly [EXECUTE_SCRIPT_LIST_INPUT_MARKER]: true;
|
|
328
|
+
readonly value: ValueOrRef<unknown>;
|
|
329
|
+
readonly fields: readonly ExecuteScriptFieldMapping[];
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Wrap a list-valued executeScript input (e.g. a prior task's `.records`)
|
|
333
|
+
* with the field mappings the script can read off each item - which fields,
|
|
334
|
+
* and under what alias. Only meaningful for a list-shaped input; a scalar
|
|
335
|
+
* input has no per-item fields to map.
|
|
336
|
+
*/
|
|
337
|
+
export declare function withFieldMappings(value: ValueOrRef<unknown>, fields: readonly ExecuteScriptFieldMapping[]): ExecuteScriptListInputToken;
|
|
286
338
|
export interface ExecuteScriptOptions<O extends ScriptOutputs | undefined = undefined> {
|
|
287
339
|
/**
|
|
288
340
|
* A FUNCTION whose body ships as the platform script (v3):
|
|
@@ -300,7 +352,11 @@ export interface ExecuteScriptOptions<O extends ScriptOutputs | undefined = unde
|
|
|
300
352
|
* print this form).
|
|
301
353
|
*/
|
|
302
354
|
readonly code: ScriptCodeFn<Record<string, unknown>, Record<string, unknown>> | ScriptFile;
|
|
303
|
-
|
|
355
|
+
/**
|
|
356
|
+
* A list-valued input can carry {@link withFieldMappings} to declare which
|
|
357
|
+
* fields of each list item the script can read, and under what alias.
|
|
358
|
+
*/
|
|
359
|
+
readonly inputs?: Record<string, ValueOrRef<unknown> | ExecuteScriptListInputToken>;
|
|
304
360
|
/**
|
|
305
361
|
* Output schema: property name → `"text" | "integer" | "number" |
|
|
306
362
|
* "decimal" | "boolean" | "object"`, or `{ name, properties }` when the
|
|
@@ -637,8 +693,8 @@ export type CalculationExpression = string | Ref<unknown> | Expr<ExprType, ExprC
|
|
|
637
693
|
/** Relationship rows included when a calculation traverses related records. */
|
|
638
694
|
export interface CalculationValueOptions<Expression extends CalculationExpression = CalculationExpression> {
|
|
639
695
|
readonly expression: Expression;
|
|
640
|
-
/**
|
|
641
|
-
readonly id?:
|
|
696
|
+
/** Platform-managed; calculation entry IDs cannot be authored. */
|
|
697
|
+
readonly id?: never;
|
|
642
698
|
/** Override the task-level record context for this value. */
|
|
643
699
|
readonly record?: ValueOrRef<string>;
|
|
644
700
|
/** Override the task-level relationship inclusion for this value. */
|
|
@@ -647,8 +703,8 @@ export interface CalculationValueOptions<Expression extends CalculationExpressio
|
|
|
647
703
|
export type CalculationValueInput = CalculationExpression | CalculationValueOptions;
|
|
648
704
|
export type CalculationValues = Readonly<Record<string, CalculationValueInput>>;
|
|
649
705
|
export interface CalculationEntry<Name extends string = string, Expression extends CalculationExpression = CalculationExpression> {
|
|
650
|
-
/**
|
|
651
|
-
readonly id?:
|
|
706
|
+
/** Platform-managed; calculation entry IDs cannot be authored. */
|
|
707
|
+
readonly id?: never;
|
|
652
708
|
readonly name: Name;
|
|
653
709
|
/**
|
|
654
710
|
* Prefer a typed calc expression. Raw strings and refs remain supported for
|
|
@@ -135,6 +135,14 @@ export function postComment(opts) {
|
|
|
135
135
|
},
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
+
function serializeAiAgentAttachment(attachment) {
|
|
139
|
+
const present = ["file", "attachment", "record"].filter((key) => attachment[key] !== undefined);
|
|
140
|
+
if (present.length !== 1) {
|
|
141
|
+
throw new Error("aiAgent attachment must set exactly one of file, attachment, or record.");
|
|
142
|
+
}
|
|
143
|
+
const key = present[0];
|
|
144
|
+
return { [key]: serializeValueOrRef(attachment[key]) };
|
|
145
|
+
}
|
|
138
146
|
export function aiAgent(opts) {
|
|
139
147
|
if (opts.outputType === "json" && (opts.schema === undefined || Object.keys(opts.schema).length === 0)) {
|
|
140
148
|
throw new Error('aiAgent with outputType "json" requires at least one field in schema.');
|
|
@@ -156,6 +164,9 @@ export function aiAgent(opts) {
|
|
|
156
164
|
}
|
|
157
165
|
: {}),
|
|
158
166
|
...(opts.connector !== undefined ? { aiProviderConnectorId: opts.connector } : {}),
|
|
167
|
+
...(opts.attachments !== undefined
|
|
168
|
+
? { attachments: opts.attachments.map(serializeAiAgentAttachment) }
|
|
169
|
+
: {}),
|
|
159
170
|
},
|
|
160
171
|
};
|
|
161
172
|
}
|
|
@@ -209,7 +220,12 @@ function outputSchemaNode(name, type) {
|
|
|
209
220
|
}
|
|
210
221
|
}
|
|
211
222
|
if (type.type === "array") {
|
|
212
|
-
return {
|
|
223
|
+
return {
|
|
224
|
+
array: {
|
|
225
|
+
...(name === undefined ? {} : { name }),
|
|
226
|
+
item: outputSchemaNode(type.itemName, type.items),
|
|
227
|
+
},
|
|
228
|
+
};
|
|
213
229
|
}
|
|
214
230
|
const properties = type.properties === undefined
|
|
215
231
|
? undefined
|
|
@@ -227,6 +243,19 @@ function outputSchema(outputs) {
|
|
|
227
243
|
const properties = Object.entries(declared).map(([name, type]) => outputSchemaNode(name, type));
|
|
228
244
|
return { object: { ...(rootName !== undefined ? { name: rootName } : {}), properties } };
|
|
229
245
|
}
|
|
246
|
+
const EXECUTE_SCRIPT_LIST_INPUT_MARKER = "__edkExecuteScriptListInput";
|
|
247
|
+
/**
|
|
248
|
+
* Wrap a list-valued executeScript input (e.g. a prior task's `.records`)
|
|
249
|
+
* with the field mappings the script can read off each item - which fields,
|
|
250
|
+
* and under what alias. Only meaningful for a list-shaped input; a scalar
|
|
251
|
+
* input has no per-item fields to map.
|
|
252
|
+
*/
|
|
253
|
+
export function withFieldMappings(value, fields) {
|
|
254
|
+
return { [EXECUTE_SCRIPT_LIST_INPUT_MARKER]: true, value, fields };
|
|
255
|
+
}
|
|
256
|
+
function isExecuteScriptListInputToken(value) {
|
|
257
|
+
return typeof value === "object" && value !== null && value[EXECUTE_SCRIPT_LIST_INPUT_MARKER] === true;
|
|
258
|
+
}
|
|
230
259
|
/**
|
|
231
260
|
* Build the executeScript `ActionDef` from an ALREADY-RESOLVED body string.
|
|
232
261
|
* Shared by the public `executeScript()` factory below (which resolves the
|
|
@@ -237,10 +266,16 @@ function outputSchema(outputs) {
|
|
|
237
266
|
* so the body is computed exactly once, not re-derived by each layer.
|
|
238
267
|
*/
|
|
239
268
|
export function executeScriptActionDefWithBody(body, opts) {
|
|
240
|
-
const inputs = Object.entries(opts.inputs ?? {}).map(([name,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
269
|
+
const inputs = Object.entries(opts.inputs ?? {}).map(([name, entry]) => {
|
|
270
|
+
if (isExecuteScriptListInputToken(entry)) {
|
|
271
|
+
return {
|
|
272
|
+
name,
|
|
273
|
+
value: serializeValueOrRef(entry.value),
|
|
274
|
+
field_mappings: entry.fields.map((f) => ({ alias: f.alias, field_id: f.field })),
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return { name, value: serializeValueOrRef(entry) };
|
|
278
|
+
});
|
|
244
279
|
return {
|
|
245
280
|
key: "executeScript",
|
|
246
281
|
config: {
|
|
@@ -617,7 +652,6 @@ function normalizeCalculationOptions(opts) {
|
|
|
617
652
|
return Object.entries(opts.values).map(([name, value]) => {
|
|
618
653
|
const advanced = typeof value === "object" && value !== null && "expression" in value;
|
|
619
654
|
return {
|
|
620
|
-
...(advanced && value.id !== undefined ? { id: value.id } : {}),
|
|
621
655
|
name,
|
|
622
656
|
expression: advanced ? value.expression : value,
|
|
623
657
|
...(advanced && value.record !== undefined
|
|
@@ -653,8 +687,8 @@ export function calculation(opts) {
|
|
|
653
687
|
// `outputType`/`multiple`/`referencedFields`) this used to mirror. Sending
|
|
654
688
|
// the GET shape back on create/update 500s server-side with no
|
|
655
689
|
// field-level error, because it isn't what the write mutation's input type
|
|
656
|
-
// actually accepts.
|
|
657
|
-
//
|
|
690
|
+
// actually accepts. Calculation entry IDs are server-assigned state and
|
|
691
|
+
// are intentionally absent from the public authoring API.
|
|
658
692
|
const calculations = [];
|
|
659
693
|
for (const c of entries) {
|
|
660
694
|
const rawCalculationReference = isExpr(c.expression)
|
|
@@ -705,7 +739,6 @@ export function calculation(opts) {
|
|
|
705
739
|
},
|
|
706
740
|
};
|
|
707
741
|
calculations.push({
|
|
708
|
-
...(c.id !== undefined ? { id: c.id } : {}),
|
|
709
742
|
name: c.name,
|
|
710
743
|
recordId: c.record !== undefined ? serializeValueOrRef(c.record) : null,
|
|
711
744
|
calculationReference: wireCalculationReference,
|
|
@@ -33,8 +33,6 @@ export interface AutomationToTfContext {
|
|
|
33
33
|
readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
|
|
34
34
|
/** App-local automations whose publish resource will be emitted in this build. */
|
|
35
35
|
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
36
|
-
/** Display names for app-local authored automations, keyed by source refName. */
|
|
37
|
-
readonly automationNamesByRefName?: ReadonlyMap<string, string>;
|
|
38
36
|
/**
|
|
39
37
|
* Every app/element stream root discovered in this same build, keyed by
|
|
40
38
|
* `workspaceAspectKey` — lets a cross-aspect token (an app/element ref, or
|
|
@@ -10,7 +10,7 @@ import { resolveForeignRef } from "../shared/foreign-ref.js";
|
|
|
10
10
|
import { filterToTf as serializeFilterToTf } from "../shared/filters/tf-codec.js";
|
|
11
11
|
import { referenceValueTypeForField } from "../shared/filters/index.js";
|
|
12
12
|
import { API_TASK_REF_AUTHORING_NAMES, API_TASK_REF_WIRE_NAMES } from "./output-key-wire-name.js";
|
|
13
|
-
import { outputFieldTypesFromScriptSchema } from "./output-field-types.js";
|
|
13
|
+
import { outputFieldTypesFromScriptSchema, scriptOutputReferenceIsDeclared } from "./output-field-types.js";
|
|
14
14
|
import { CONNECTOR_ORG_BAG } from "../org/connector.js";
|
|
15
15
|
import { FILE_READER_SUB_TYPE_BY_RESOURCE, FILE_READER_SUB_TYPE_BY_TYPE_KEY } from "../file-reader/types.js";
|
|
16
16
|
import { UNRESOLVED_FIELD_MARKER } from "../shared/ref.js";
|
|
@@ -443,9 +443,9 @@ function automationTargetToTf(value, ctx, dataBlocks) {
|
|
|
443
443
|
if (managedOwnerLabel !== undefined) {
|
|
444
444
|
const managedLabel = scopedLabel(managedOwnerLabel, tsLabelToTfLabel(value.refName));
|
|
445
445
|
const targetOwner = ctx.workspaceAspects?.get(workspaceAspectKey(ownerKind, isOwn ? ctx.appRefName : value.parent ?? ""));
|
|
446
|
-
const
|
|
447
|
-
const isActive =
|
|
448
|
-
?
|
|
446
|
+
const targetActiveRefs = targetOwner?.activeAutomationRefNames;
|
|
447
|
+
const isActive = targetActiveRefs !== undefined
|
|
448
|
+
? targetActiveRefs.has(value.refName)
|
|
449
449
|
: isOwn && ctx.activeAutomationRefNames?.has(value.refName) === true;
|
|
450
450
|
// The on-demand trigger resource exposes the parameter ids from the
|
|
451
451
|
// mutable draft workflow. Once an ACTIVE target is published, however,
|
|
@@ -454,12 +454,6 @@ function automationTargetToTf(value, ctx, dataBlocks) {
|
|
|
454
454
|
// ids describe that same current revision. Draft/inactive targets retain
|
|
455
455
|
// the direct resource references below because they have no publish edge.
|
|
456
456
|
if (isActive) {
|
|
457
|
-
const lookupName = targetActiveNames?.get(value.refName) ??
|
|
458
|
-
(isOwn ? ctx.automationNamesByRefName?.get(value.refName) : undefined) ??
|
|
459
|
-
value.name;
|
|
460
|
-
if (lookupName === undefined || lookupName === "") {
|
|
461
|
-
throw new EntityTfError(`managed ACTIVE automation ref "${value.refName}" has no lookup name`);
|
|
462
|
-
}
|
|
463
457
|
// Data block addresses are module-global even though EDK emits one
|
|
464
458
|
// file per automation. Scope the lookup to this caller so two callers
|
|
465
459
|
// of the same target cannot declare a duplicate data address.
|
|
@@ -470,7 +464,7 @@ function automationTargetToTf(value, ctx, dataBlocks) {
|
|
|
470
464
|
label: currentBindingLabel,
|
|
471
465
|
attrs: {
|
|
472
466
|
app_id: expr.resourceAttr(ownerKind === "element" ? "elementum_element" : "elementum_app", managedOwnerLabel, ["id"]),
|
|
473
|
-
|
|
467
|
+
id: expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, managedLabel, ["id"]),
|
|
474
468
|
depends_on: [expr.resourceAttr(WORKFLOW_PUBLISH_RESOURCE_TYPE, managedLabel)],
|
|
475
469
|
},
|
|
476
470
|
});
|
|
@@ -971,7 +965,18 @@ function calculationFormulaRefToParts(value, refs) {
|
|
|
971
965
|
return calculationTaskMustache(value.taskReference.taskRefKey, value.taskReference.name, refs);
|
|
972
966
|
}
|
|
973
967
|
if (isObject(value.variableReference) && typeof value.variableReference.id === "string") {
|
|
974
|
-
|
|
968
|
+
// `value.variableReference.id` is the client-side id `stampAndCollectVariableIds`
|
|
969
|
+
// just minted for this build's own `elementum_variable_task` create entry, not the
|
|
970
|
+
// variable's real (deploy-time-assigned) platform id - baking it in as a literal
|
|
971
|
+
// here always mismatches live state on the very next plan. Interpolate the live
|
|
972
|
+
// resource's `variable_id` instead, the same fix already applied to workflow_publish
|
|
973
|
+
// outputs and task input values referencing the same variable.
|
|
974
|
+
const target = refs.variableById.get(value.variableReference.id);
|
|
975
|
+
if (target === undefined) {
|
|
976
|
+
refs.owner.diagnostics.push(`automation unresolved variable ref ${JSON.stringify(value.variableReference.id)} preserved as a literal calculation reference`);
|
|
977
|
+
return [`variable.${value.variableReference.id}`];
|
|
978
|
+
}
|
|
979
|
+
return ["variable.", expr.resourceAttr(target.type, target.label, ["variable_id"])];
|
|
975
980
|
}
|
|
976
981
|
if (isObject(value.templateReference))
|
|
977
982
|
return calculationTemplateToParts(value.templateReference, refs);
|
|
@@ -1124,8 +1129,8 @@ const TS_TRIGGER_REF_TO_WIRE = {
|
|
|
1124
1129
|
// ("record.createdBy.email") never reaches this flat lookup table (see
|
|
1125
1130
|
// from-tf.ts's matching comment) — this table is for genuine trigger-level
|
|
1126
1131
|
// pseudo-fields only, keyed by the DIRECT ts accessor name, not a dotted
|
|
1127
|
-
// record path.
|
|
1128
|
-
//
|
|
1132
|
+
// record path. Record-path refs are handled below from app fields and
|
|
1133
|
+
// suffix mappings.
|
|
1129
1134
|
slackThreadId: "Slack Thread ID",
|
|
1130
1135
|
slackChannelId: "Slack Channel ID",
|
|
1131
1136
|
messageAuthorEmail: "Message Author Email",
|
|
@@ -1162,13 +1167,6 @@ const FIELD_REF_SUFFIX_TO_WIRE = {
|
|
|
1162
1167
|
"employee.manager.email": " Manager Email",
|
|
1163
1168
|
"employee.manager.name": " Manager Name",
|
|
1164
1169
|
};
|
|
1165
|
-
// Confirmed live on demoapptwo: the "...Email"/"...Manager Email" audit refs
|
|
1166
|
-
// lowercase "by", unlike every other audit-field ref suffix. Only these two
|
|
1167
|
-
// keys/suffixes are overridden; closedBy is not confirmed and is left alone.
|
|
1168
|
-
const AUDIT_FIELD_EMAIL_WIRE_NAME = {
|
|
1169
|
-
createdBy: "Created by",
|
|
1170
|
-
updatedBy: "Updated by",
|
|
1171
|
-
};
|
|
1172
1170
|
const PROVIDER_FIXED_SYSTEM_FIELD_KEYS = new Set([
|
|
1173
1171
|
"stage",
|
|
1174
1172
|
"createdAt",
|
|
@@ -1224,18 +1222,13 @@ function wireRefName(name, ctx) {
|
|
|
1224
1222
|
if (wireSuffix === undefined) {
|
|
1225
1223
|
throw new EntityTfError(`automation reference "${name}" has unsupported record-field path "${suffix}"`);
|
|
1226
1224
|
}
|
|
1227
|
-
//
|
|
1228
|
-
//
|
|
1229
|
-
//
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
// other system field) keeps the field's own display casing.
|
|
1235
|
-
const auditEmailName = systemFieldKey !== undefined && (wireSuffix === " Email" || wireSuffix === " Manager Email")
|
|
1236
|
-
? AUDIT_FIELD_EMAIL_WIRE_NAME[systemFieldKey]
|
|
1237
|
-
: undefined;
|
|
1238
|
-
return `${auditEmailName ?? fieldName}${wireSuffix}`;
|
|
1225
|
+
// Email audit refs have historically varied in the capitalization of
|
|
1226
|
+
// "by" between organizations. The provider exposes both spellings as
|
|
1227
|
+
// aliases, so author the established lowercase wire name consistently.
|
|
1228
|
+
const refName = `${fieldName}${wireSuffix}`;
|
|
1229
|
+
return /^(Created|Updated) By (?:Manager )?Email$/.test(refName)
|
|
1230
|
+
? refName.replace(/ By(?= (?:Manager )?Email$)/, " by")
|
|
1231
|
+
: refName;
|
|
1239
1232
|
}
|
|
1240
1233
|
// A webhook trigger's body/headers refs (ctx.trigger.body["X"]) can only
|
|
1241
1234
|
// type-check against DeepRefs<WebhookTriggerOutput>, so parts[0] being
|
|
@@ -1690,6 +1683,18 @@ function valueToTf(value, refs) {
|
|
|
1690
1683
|
return value.map((item) => valueToTf(item, refs));
|
|
1691
1684
|
if (!isObject(value))
|
|
1692
1685
|
throw new EntityTfError(`unsupported automation value ${String(value)}`);
|
|
1686
|
+
if (typeof value.__edkUnresolvedForEachItem === "string") {
|
|
1687
|
+
// Printed by print-automation.ts for a forEachItemRef pointing at a
|
|
1688
|
+
// sibling or non-nearest-ancestor loop - EDK has no authoring primitive
|
|
1689
|
+
// for "another loop's current item". Fail the build loudly instead of
|
|
1690
|
+
// silently reinterpreting this as a task-output reference: `ctx.actions`
|
|
1691
|
+
// would have turned ANY property-access shape into a real, but WRONG,
|
|
1692
|
+
// task ref (review feedback on PR #1097, cursor[bot]).
|
|
1693
|
+
const path = Array.isArray(value.path) ? value.path.join(".") : "";
|
|
1694
|
+
throw new EntityTfError(`unresolved forEach item reference to "${value.__edkUnresolvedForEachItem}"${path ? `.${path}` : ""}: ` +
|
|
1695
|
+
`EDK cannot express a reference to another loop's current item - re-express this by hand ` +
|
|
1696
|
+
`(e.g. restructure the loops, or pass the value through a variable) before this automation can build`);
|
|
1697
|
+
}
|
|
1693
1698
|
if (value.__unsafe === "platformId" && typeof value.value === "string") {
|
|
1694
1699
|
refs.owner.diagnostics.push(`automation raw UUID fallback ${JSON.stringify(value.value)} is source-org-only and non-portable`);
|
|
1695
1700
|
return value.value;
|
|
@@ -1896,6 +1901,24 @@ function filterReferenceToTf(value, refs, role = "value", realType, operator) {
|
|
|
1896
1901
|
},
|
|
1897
1902
|
});
|
|
1898
1903
|
}
|
|
1904
|
+
const isUndeclaredScriptOutput = task.type === TASK_RESOURCES.executeScript &&
|
|
1905
|
+
wireName.startsWith("result.") &&
|
|
1906
|
+
!scriptOutputReferenceIsDeclared(task.outputFieldTypes, wireName);
|
|
1907
|
+
if (isUndeclaredScriptOutput) {
|
|
1908
|
+
// A pulled live workflow can retain this dangling envelope even
|
|
1909
|
+
// though the provider cannot expose it through `refs`. Pull rejects
|
|
1910
|
+
// multiple/DECIMAL variants, so the scalar envelope is lossless.
|
|
1911
|
+
refs.owner.diagnostics.push(`automation switch preserves reference to ${JSON.stringify(wireName)} on execute-script task ` +
|
|
1912
|
+
`${JSON.stringify(value.taskRefKey)} even though that task does not declare the output`);
|
|
1913
|
+
return expr.jsonencode({
|
|
1914
|
+
fieldType: (realType ?? "TEXT").toUpperCase(),
|
|
1915
|
+
multiple: false,
|
|
1916
|
+
taskReference: {
|
|
1917
|
+
name: wireName,
|
|
1918
|
+
taskId: expr.resourceAttr(task.type, task.label, ["id"]),
|
|
1919
|
+
},
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1899
1922
|
return expr.resourceAttr(task.type, task.label, ["refs", { index: wireName }]);
|
|
1900
1923
|
}
|
|
1901
1924
|
return expr.template([
|
|
@@ -2022,6 +2045,8 @@ function triggerRecordFieldPath(reference) {
|
|
|
2022
2045
|
return { fieldKey: path[1], suffix: path.slice(2).join(".") };
|
|
2023
2046
|
}
|
|
2024
2047
|
function fieldFromFilterLeftValue(value, refs) {
|
|
2048
|
+
if (isObject(value) && value.type === "FIELD")
|
|
2049
|
+
return token(value.value ?? value.field);
|
|
2025
2050
|
if (!isObject(value) || !isObject(value.value) || value.value.type?.toString().toUpperCase() !== "TRIGGER") {
|
|
2026
2051
|
return undefined;
|
|
2027
2052
|
}
|
|
@@ -2302,7 +2327,6 @@ function configAttrs(kind, config, refs) {
|
|
|
2302
2327
|
}
|
|
2303
2328
|
}
|
|
2304
2329
|
return {
|
|
2305
|
-
...(typeof item.id === "string" ? { id: item.id } : {}),
|
|
2306
2330
|
variable_name: item.name,
|
|
2307
2331
|
formula: calculationFormulaToTf(reference.templateReference, refs),
|
|
2308
2332
|
...(includeType !== "AUTO" ? { include_type: includeType } : {}),
|
|
@@ -2558,7 +2582,6 @@ export function automationToTf(entity, ctx) {
|
|
|
2558
2582
|
workspaceAspects: ctx.workspaceAspects,
|
|
2559
2583
|
diagnostics: ctx.diagnostics ?? [],
|
|
2560
2584
|
activeAutomationRefNames: ctx.activeAutomationRefNames,
|
|
2561
|
-
automationNamesByRefName: ctx.automationNamesByRefName,
|
|
2562
2585
|
};
|
|
2563
2586
|
if (entity.kind !== "automation")
|
|
2564
2587
|
throw new EntityTfError(`automationToTf expects kind "automation"; got "${entity.kind}"`);
|
|
@@ -2917,6 +2940,15 @@ export function automationToTf(entity, ctx) {
|
|
|
2917
2940
|
if (children.length === 0)
|
|
2918
2941
|
throw new EntityTfError(`${wireType} task "${refKey}" must have branches`);
|
|
2919
2942
|
const usedLabels = new Map();
|
|
2943
|
+
// Separate from usedLabels above: that map rejects two branches
|
|
2944
|
+
// sharing the same RAW display label/no-label, but a genuinely
|
|
2945
|
+
// unlabeled branch's fixed "case" fallback and an EXPLICIT label
|
|
2946
|
+
// like "Case" have different raw labels ("" vs "Case") yet
|
|
2947
|
+
// sanitize to the identical tf suffix ("case") - a real address
|
|
2948
|
+
// collision usedLabels never catches. Live-confirmed shape
|
|
2949
|
+
// (review feedback, PR #1100, cursor[bot]): unlabeled sibling next
|
|
2950
|
+
// to a branch explicitly labeled "Case".
|
|
2951
|
+
const usedSuffixes = new Map();
|
|
2920
2952
|
for (const [index, child] of children.entries()) {
|
|
2921
2953
|
const isDefault = wireType === "switch" && (child.isDefault === true || child.label === null);
|
|
2922
2954
|
const displayLabel = isDefault
|
|
@@ -2929,6 +2961,13 @@ export function automationToTf(entity, ctx) {
|
|
|
2929
2961
|
: `${wireType} task "${refKey}" reuses label ${JSON.stringify(displayLabel)} on cases ${prior} and ${index + 1}`);
|
|
2930
2962
|
}
|
|
2931
2963
|
usedLabels.set(displayLabel, index + 1);
|
|
2964
|
+
const fallbackLabel = isDefault ? "default" : "case";
|
|
2965
|
+
const suffix = sanitizeName(child.label ?? child.defaultLabel ?? fallbackLabel);
|
|
2966
|
+
const priorSuffix = usedSuffixes.get(suffix);
|
|
2967
|
+
if (priorSuffix !== undefined) {
|
|
2968
|
+
throw new EntityTfError(`${wireType} task "${refKey}" cases ${priorSuffix} and ${index + 1} both sanitize to the terraform label suffix ${JSON.stringify(suffix)}; give each branch/case a distinct label`);
|
|
2969
|
+
}
|
|
2970
|
+
usedSuffixes.set(suffix, index + 1);
|
|
2932
2971
|
}
|
|
2933
2972
|
let previous;
|
|
2934
2973
|
for (const [index, child] of children.entries()) {
|
|
@@ -2937,7 +2976,17 @@ export function automationToTf(entity, ctx) {
|
|
|
2937
2976
|
// ei's own resource label follows the branch's real display text
|
|
2938
2977
|
// (a default branch renamed "Default Path" exports as
|
|
2939
2978
|
// "..._default_path", not a hardcoded "..._default") - confirmed live.
|
|
2940
|
-
|
|
2979
|
+
// A genuinely unlabeled non-default branch/case exports with the
|
|
2980
|
+
// fixed literal suffix "case" (no index) regardless of wireType or
|
|
2981
|
+
// position - live-confirmed on conciergeforfield (sanofi/us): both
|
|
2982
|
+
// an unlabeled elementum_fork_join_branch and an unlabeled
|
|
2983
|
+
// elementum_switch_case exported as "..._case". The prior
|
|
2984
|
+
// "branch_${index+1}" fallback never matched this, so every
|
|
2985
|
+
// rebuild relabeled the resource and planned a destroy+create for
|
|
2986
|
+
// an otherwise-unchanged branch. usedSuffixes above already
|
|
2987
|
+
// rejects the fixed "case" suffix colliding with an explicitly
|
|
2988
|
+
// labeled sibling that sanitizes to the same thing.
|
|
2989
|
+
const fallbackLabel = isDefault ? "default" : "case";
|
|
2941
2990
|
const branchLabel = `${tfLabel}_${sanitizeName(child.label ?? child.defaultLabel ?? fallbackLabel)}`;
|
|
2942
2991
|
const branchAttrs = {
|
|
2943
2992
|
[wireType === "switch" ? "switch_task" : "fork_join_task"]: address,
|
|
@@ -219,8 +219,11 @@ export interface SlackMessageTriggerOutput {
|
|
|
219
219
|
export declare function slackMessage(): TriggerChain<SlackMessageTriggerOutput>;
|
|
220
220
|
export interface SurveyResponseCreateTriggerOptions {
|
|
221
221
|
readonly app: AppOrElementRef;
|
|
222
|
-
/**
|
|
223
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Survey template id until survey templates are catalog-modeled. The
|
|
224
|
+
* explicit wrapper marks this platform-owned value as non-portable.
|
|
225
|
+
*/
|
|
226
|
+
readonly survey: UnsafePlatformId;
|
|
224
227
|
}
|
|
225
228
|
export type SurveyResponseCreateTriggerOutput = Record<string, unknown>;
|
|
226
229
|
/** Fires when a response is created for the selected survey template. */
|
|
@@ -77,3 +77,5 @@ export declare const AUTOMATION_TASK_TYPE_SET: ReadonlySet<string>;
|
|
|
77
77
|
*/
|
|
78
78
|
export declare const ALL_AUTOMATION_TASK_TYPE_SET: ReadonlySet<string>;
|
|
79
79
|
export declare const AUTOMATION_BRANCH_TYPE_SET: ReadonlySet<string>;
|
|
80
|
+
/** Whether an exported address belongs to an automation composite. */
|
|
81
|
+
export declare function isAutomationResourceAddress(address: string): boolean;
|