@elementumai/edk 0.9.6 → 0.9.9
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/README.md +34 -3
- package/dist-sdk/src/catalog/factories.d.ts +26 -6
- package/dist-sdk/src/catalog/factories.js +41 -6
- package/dist-sdk/src/catalog/from-authoring.js +27 -33
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.js +93 -42
- package/dist-sdk/src/catalog/token.js +10 -0
- package/dist-sdk/src/catalog/types.d.ts +42 -3
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +2 -2
- package/dist-sdk/src/core/index.js +1 -1
- package/dist-sdk/src/core/platform-id.d.ts +2 -0
- package/dist-sdk/src/core/platform-id.js +4 -0
- package/dist-sdk/src/core/system-fields.d.ts +18 -0
- package/dist-sdk/src/core/system-fields.js +21 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +27 -24
- package/dist-sdk/src/core/triggers/on-demand.js +33 -12
- package/dist-sdk/src/core/types/app.d.ts +14 -9
- package/dist-sdk/src/core/types/aspect-category.d.ts +1 -0
- package/dist-sdk/src/core/types/aspect-category.js +1 -0
- package/dist-sdk/src/core/types/platform.d.ts +1 -1
- package/dist-sdk/src/engine/build/context.d.ts +24 -8
- package/dist-sdk/src/engine/build/source-context.d.ts +14 -17
- package/dist-sdk/src/engine/build/source-context.js +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +18 -0
- package/dist-sdk/src/engine/pull/org.d.ts +4 -0
- package/dist-sdk/src/engine/pull/org.js +17 -2
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +16 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +69 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +14 -0
- package/dist-sdk/src/engine/pull/ref-only.js +35 -2
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +15 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +33 -1
- package/dist-sdk/src/engine/workspace/loader.d.ts +40 -0
- package/dist-sdk/src/engine/workspace/loader.js +328 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +24 -4
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +11 -3
- package/dist-sdk/src/entities/agent/build.d.ts +54 -8
- package/dist-sdk/src/entities/agent/build.js +36 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +144 -3
- package/dist-sdk/src/entities/agent/from-tf.d.ts +7 -6
- package/dist-sdk/src/entities/agent/from-tf.js +176 -5
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -4
- package/dist-sdk/src/entities/agent/to-tf.js +186 -11
- package/dist-sdk/src/entities/agent/tools.d.ts +16 -5
- package/dist-sdk/src/entities/agent/tools.js +13 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +16 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +39 -6
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -12
- package/dist-sdk/src/entities/agent-tool/types.js +1 -0
- package/dist-sdk/src/entities/app/build.d.ts +44 -24
- package/dist-sdk/src/entities/app/build.js +18 -8
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +15 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.d.ts +45 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.js +98 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.d.ts +55 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.js +99 -0
- package/dist-sdk/src/entities/app/from-tf.js +79 -14
- package/dist-sdk/src/entities/app/index.d.ts +3 -2
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/to-tf.js +30 -6
- package/dist-sdk/src/entities/automation/build.d.ts +37 -18
- package/dist-sdk/src/entities/automation/build.js +121 -12
- package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +8 -10
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +103 -20
- package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/from-tf.js +1165 -91
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +15 -5
- package/dist-sdk/src/entities/automation/operators.d.ts +2 -2
- package/dist-sdk/src/entities/automation/operators.js +1 -0
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +17 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +45 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -4
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +33 -6
- package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +168 -36
- package/dist-sdk/src/entities/automation/task-label.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-label.js +18 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +159 -45
- package/dist-sdk/src/entities/automation/tasks.js +60 -47
- package/dist-sdk/src/entities/automation/to-tf.d.ts +7 -1
- package/dist-sdk/src/entities/automation/to-tf.js +816 -87
- package/dist-sdk/src/entities/automation/triggers.d.ts +14 -5
- package/dist-sdk/src/entities/automation/triggers.js +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +78 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.js +193 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +1 -1
- package/dist-sdk/src/entities/element/build.d.ts +30 -7
- package/dist-sdk/src/entities/element/build.js +7 -3
- package/dist-sdk/src/entities/element/from-tf.js +7 -3
- package/dist-sdk/src/entities/element/index.d.ts +3 -2
- package/dist-sdk/src/entities/element/index.js +3 -2
- package/dist-sdk/src/entities/element/to-tf.js +49 -8
- package/dist-sdk/src/entities/field/build.d.ts +94 -3
- package/dist-sdk/src/entities/field/build.js +82 -3
- package/dist-sdk/src/entities/field/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.js +104 -1
- package/dist-sdk/src/entities/field/locals.js +6 -7
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/options.d.ts +2 -0
- package/dist-sdk/src/entities/field/options.js +12 -2
- package/dist-sdk/src/entities/field/record-shape.d.ts +12 -15
- package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
- package/dist-sdk/src/entities/field/to-tf.js +191 -56
- package/dist-sdk/src/entities/field/types.js +2 -0
- package/dist-sdk/src/entities/org/category-ref.d.ts +5 -0
- package/dist-sdk/src/entities/org/category-ref.js +12 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -3
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +18 -13
- package/dist-sdk/src/entities/relationship/from-tf.js +100 -7
- package/dist-sdk/src/entities/role/from-tf.js +10 -4
- package/dist-sdk/src/entities/search-table/build.d.ts +1 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -0
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +3 -3
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/service-account/from-tf.js +10 -4
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/to-tf.js +7 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +9 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +39 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +24 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +4 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +13 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +14 -8
- package/dist-sdk/src/entities/shared/handle-description.d.ts +12 -0
- package/dist-sdk/src/entities/shared/handle-description.js +20 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +5 -3
- package/dist-sdk/src/entities/shared/tool-field-ref.js +11 -16
- package/dist-sdk/src/entities/shared/types/common.d.ts +7 -5
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
- package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
- package/dist-sdk/src/entities/skill/build.d.ts +51 -2
- package/dist-sdk/src/entities/skill/build.js +65 -8
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +79 -18
- package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/skill/from-tf.js +47 -5
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +89 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +327 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +9 -25
- package/dist-sdk/src/entities/skill/to-tf.js +29 -40
- package/dist-sdk/src/entities/skill/tools.d.ts +12 -2
- package/dist-sdk/src/entities/skill/tools.js +3 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -14
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -23
- package/dist-sdk/src/entities/table/to-tf.js +21 -5
- package/dist-sdk/src/entities/task/to-tf.js +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +36 -10
- package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/to-tf.js +49 -30
- package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
- package/dist-sdk/src/entities/widget/from-tf.js +2 -2
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +52 -23
- package/dist-sdk/src/graph/index.d.ts +19 -1
- package/dist-sdk/src/graph/index.js +20 -0
- package/dist-sdk/src/graph/types.d.ts +22 -0
- package/package.json +11 -5
|
@@ -27,9 +27,11 @@
|
|
|
27
27
|
import { randomUUID } from "crypto";
|
|
28
28
|
import { valid as validSemver } from "semver";
|
|
29
29
|
import { EntityTfError } from "../../engine/entity.js";
|
|
30
|
+
import { isOnDemandRecordType } from "../shared/types/field-types.js";
|
|
30
31
|
import { buildContext, createForEachItemProxy } from "../shared/context.js";
|
|
32
|
+
import { outputFieldTypesFromScriptSchema } from "./output-field-types.js";
|
|
31
33
|
import { isRef } from "../shared/ref.js";
|
|
32
|
-
import { OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
34
|
+
import { API_TASK_REF_WIRE_NAMES, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
33
35
|
import { extractScriptBody, inferOutputSchema, tryExtractFromCurrentSource } from "./script-code.js";
|
|
34
36
|
import { serializeNode } from "./serialize.js";
|
|
35
37
|
// Runtime factory imports stay below the public action-native surface. Their
|
|
@@ -56,7 +58,8 @@ function serializeTaskEntry(name, def, displayName, hclParent) {
|
|
|
56
58
|
};
|
|
57
59
|
if (def.operatorChildren && def.operatorChildren.length > 0) {
|
|
58
60
|
result.children = def.operatorChildren.map((child) => ({
|
|
59
|
-
label: child.label,
|
|
61
|
+
...(child.label !== undefined ? { label: child.label } : {}),
|
|
62
|
+
...(child.isDefault === true ? { isDefault: true } : {}),
|
|
60
63
|
...(child.filter !== undefined ? { filter: serializeNode(child.filter) } : {}),
|
|
61
64
|
...(child.defaultLabel !== undefined ? { defaultLabel: child.defaultLabel } : {}),
|
|
62
65
|
...(child.defaultFilterMode !== undefined ? { defaultFilterMode: child.defaultFilterMode } : {}),
|
|
@@ -104,6 +107,60 @@ function collectTaskKinds(tasks) {
|
|
|
104
107
|
visit(tasks);
|
|
105
108
|
return out;
|
|
106
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Map every executeScript task's refKey to its declared (wire-shaped)
|
|
112
|
+
* `output_schema`, descending into operator children — mirrors
|
|
113
|
+
* `collectTaskKinds`. Used at `.ref(refName)` time to resolve
|
|
114
|
+
* `OutputPropertyRef.valueType` for an automation-level output whose value
|
|
115
|
+
* is a plain ref to one of these tasks' `result.<prop>`.
|
|
116
|
+
*/
|
|
117
|
+
function collectExecuteScriptOutputSchemas(tasks) {
|
|
118
|
+
const out = new Map();
|
|
119
|
+
const visit = (entries) => {
|
|
120
|
+
for (const { name, def } of entries) {
|
|
121
|
+
if (def.key === "executeScript" && def.config.outputSchema !== undefined) {
|
|
122
|
+
out.set(name, def.config.outputSchema);
|
|
123
|
+
}
|
|
124
|
+
for (const child of def.operatorChildren ?? [])
|
|
125
|
+
visit(child.tasks);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
visit(tasks);
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Schema kinds `outputFieldTypesFromScriptSchema` maps to an EXACT field
|
|
133
|
+
* type — as opposed to its own catch-all default (`"TEXT"` for anything
|
|
134
|
+
* unrecognized, including `"object"`), which is real for the wire's own
|
|
135
|
+
* default but would be a wrong guess if promoted to `OutputPropertyRef.valueType`.
|
|
136
|
+
*/
|
|
137
|
+
const KNOWN_SCRIPT_OUTPUT_KINDS = new Set(["bool", "integer", "number", "string"]);
|
|
138
|
+
/**
|
|
139
|
+
* Resolve an automation-level output's `valueType` from its (already
|
|
140
|
+
* serialized) value: only when it's a plain ref to an executeScript task's
|
|
141
|
+
* `result.<prop>` whose declared schema has an EXACT (not catch-all-guessed)
|
|
142
|
+
* kind for that property. Anything else — a literal, a trigger/variable ref,
|
|
143
|
+
* a non-executeScript task, or an unmodeled schema kind (e.g. `object`) —
|
|
144
|
+
* returns `undefined` (unknown, not a guess).
|
|
145
|
+
*/
|
|
146
|
+
function resolveOutputValueType(value, scriptSchemas) {
|
|
147
|
+
if (value === null || typeof value !== "object")
|
|
148
|
+
return undefined;
|
|
149
|
+
const ref = value.taskReference;
|
|
150
|
+
if (ref === null || typeof ref !== "object")
|
|
151
|
+
return undefined;
|
|
152
|
+
const taskRefKey = ref.taskRefKey;
|
|
153
|
+
const name = ref.name;
|
|
154
|
+
if (typeof taskRefKey !== "string" || typeof name !== "string")
|
|
155
|
+
return undefined;
|
|
156
|
+
const schema = scriptSchemas.get(taskRefKey);
|
|
157
|
+
if (schema === undefined)
|
|
158
|
+
return undefined;
|
|
159
|
+
const resolved = outputFieldTypesFromScriptSchema(schema)?.get(name);
|
|
160
|
+
if (resolved === undefined || !KNOWN_SCRIPT_OUTPUT_KINDS.has(resolved.kind))
|
|
161
|
+
return undefined;
|
|
162
|
+
return resolved.fieldType;
|
|
163
|
+
}
|
|
107
164
|
/**
|
|
108
165
|
* Map every record-bearing task's refKey to the app refName that owns its
|
|
109
166
|
* `.record`/`.records` output, descending into operator children — mirrors
|
|
@@ -136,8 +193,14 @@ const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findR
|
|
|
136
193
|
* - recordSearch: `totalCount` → the platform's `Records Size`.
|
|
137
194
|
* - aiSearchTable: `records` → the platform's `All Records` (NOT
|
|
138
195
|
* recordSearch's `All found records` — #398.1).
|
|
139
|
-
* -
|
|
140
|
-
* `
|
|
196
|
+
* - tableRecordsSearch interpolations map `records` → `All matching table
|
|
197
|
+
* rows` in to-tf (`valueToTf`); do **not** rewrite the name here — ei
|
|
198
|
+
* publish envelopes keep the authored key `records`.
|
|
199
|
+
* - aiAgent: `result` / `result.<field>` → the provider refs-map key
|
|
200
|
+
* `Action Response` (text) / the authored schema field name (json).
|
|
201
|
+
* The JSON value stored under that key carries the separate platform
|
|
202
|
+
* taskReference.name (`ai_agent_task_response` /
|
|
203
|
+
* `ai_agent_task_structured_output.<normalized-field>`).
|
|
141
204
|
* - record-bearing tasks: the read path reinjects a `.record` hop on the id
|
|
142
205
|
* accessor; collapse it back to the platform's flat wire key on write
|
|
143
206
|
* (recordSearch: `First found record id`; createRecord/findRelatedRecords:
|
|
@@ -150,6 +213,9 @@ const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findR
|
|
|
150
213
|
* the platform's actual output name for that task kind.
|
|
151
214
|
*/
|
|
152
215
|
function rewriteForwardTaskRefName(taskKey, name) {
|
|
216
|
+
if (taskKey === "api") {
|
|
217
|
+
return API_TASK_REF_WIRE_NAMES[name] ?? name;
|
|
218
|
+
}
|
|
153
219
|
if (taskKey === "recordSearch" && name === "totalCount") {
|
|
154
220
|
return "Records Size";
|
|
155
221
|
}
|
|
@@ -161,8 +227,8 @@ function rewriteForwardTaskRefName(taskKey, name) {
|
|
|
161
227
|
if (segs[0] !== "result")
|
|
162
228
|
return name;
|
|
163
229
|
if (segs.length === 1)
|
|
164
|
-
return "
|
|
165
|
-
return
|
|
230
|
+
return "Action Response";
|
|
231
|
+
return segs.slice(1).join(".");
|
|
166
232
|
}
|
|
167
233
|
if (taskKey === "recordSearch" && name === "record.recordId") {
|
|
168
234
|
return "First found record id";
|
|
@@ -305,6 +371,7 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
305
371
|
userSearch: actionFactories.userSearch,
|
|
306
372
|
initiateCall: actionFactories.initiateCall,
|
|
307
373
|
recordFieldLocking: actionFactories.recordFieldLocking,
|
|
374
|
+
unimplementedTask: actionFactories.unimplementedTask,
|
|
308
375
|
};
|
|
309
376
|
const directMethods = Object.fromEntries(Object.entries(leafFactories).map(([method, factory]) => [
|
|
310
377
|
method,
|
|
@@ -402,8 +469,11 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
402
469
|
__triggerParams() {
|
|
403
470
|
return state.trigger.__params ?? [];
|
|
404
471
|
},
|
|
405
|
-
|
|
406
|
-
return state.outputs
|
|
472
|
+
__outputEntries() {
|
|
473
|
+
return state.outputs ?? [];
|
|
474
|
+
},
|
|
475
|
+
__executeScriptOutputSchemas() {
|
|
476
|
+
return collectExecuteScriptOutputSchemas(state.tasks);
|
|
407
477
|
},
|
|
408
478
|
__finalize() {
|
|
409
479
|
const taskKindByRefKey = collectTaskKinds(state.tasks);
|
|
@@ -476,7 +546,8 @@ export function automation(opts) {
|
|
|
476
546
|
return {
|
|
477
547
|
ref(refName) {
|
|
478
548
|
const triggerParams = opts.actions.__triggerParams();
|
|
479
|
-
const
|
|
549
|
+
const outputEntries = opts.actions.__outputEntries();
|
|
550
|
+
const scriptSchemas = opts.actions.__executeScriptOutputSchemas();
|
|
480
551
|
// Bag keys are the DECLARED names, verbatim (no canonicalization —
|
|
481
552
|
// access non-identifier names with brackets: trigger["STUDENT NAME 2"]).
|
|
482
553
|
// `required: true` is stamped only when true (canonical form) — it is
|
|
@@ -493,8 +564,20 @@ export function automation(opts) {
|
|
|
493
564
|
},
|
|
494
565
|
]))
|
|
495
566
|
: undefined;
|
|
496
|
-
const outputs =
|
|
497
|
-
? Object.fromEntries(
|
|
567
|
+
const outputs = outputEntries.length > 0
|
|
568
|
+
? Object.fromEntries(outputEntries.map(({ name: n, value }) => {
|
|
569
|
+
const valueType = resolveOutputValueType(value, scriptSchemas);
|
|
570
|
+
return [
|
|
571
|
+
n,
|
|
572
|
+
{
|
|
573
|
+
__kind: "outputProperty",
|
|
574
|
+
refName: n,
|
|
575
|
+
name: n,
|
|
576
|
+
parent: refName,
|
|
577
|
+
...(valueType !== undefined ? { valueType } : {}),
|
|
578
|
+
},
|
|
579
|
+
];
|
|
580
|
+
}))
|
|
498
581
|
: undefined;
|
|
499
582
|
return {
|
|
500
583
|
__kind: "automation",
|
|
@@ -507,6 +590,7 @@ export function automation(opts) {
|
|
|
507
590
|
},
|
|
508
591
|
def(refName) {
|
|
509
592
|
const sequence = opts.actions.__finalize();
|
|
593
|
+
const recordFieldContext = mergeOnDemandRecordFieldContext(sequence.recordFieldContext, sequence.trigger);
|
|
510
594
|
// `recordFieldContext` is a structural extension, not a declared `DeployableEntity`
|
|
511
595
|
// property (see `RecordFieldContext`'s doc comment) — assigning to `entity`
|
|
512
596
|
// first (rather than returning the literal directly) avoids an excess-property
|
|
@@ -528,9 +612,34 @@ export function automation(opts) {
|
|
|
528
612
|
...(sequence.outputProperties ? { outputProperties: sequence.outputProperties } : {}),
|
|
529
613
|
},
|
|
530
614
|
...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
|
|
531
|
-
...(
|
|
615
|
+
...(recordFieldContext !== undefined ? { recordFieldContext } : {}),
|
|
532
616
|
};
|
|
533
617
|
return entity;
|
|
534
618
|
},
|
|
535
619
|
};
|
|
536
620
|
}
|
|
621
|
+
function mergeOnDemandRecordFieldContext(existing, trigger) {
|
|
622
|
+
const targetRefName = soleOnDemandRecordTargetRefName(trigger);
|
|
623
|
+
if (targetRefName === undefined)
|
|
624
|
+
return existing;
|
|
625
|
+
return {
|
|
626
|
+
...existing,
|
|
627
|
+
triggerAppRefName: existing?.triggerAppRefName ?? targetRefName,
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
function soleOnDemandRecordTargetRefName(trigger) {
|
|
631
|
+
if (typeof trigger !== "object" || trigger === null || !("onDemand" in trigger))
|
|
632
|
+
return undefined;
|
|
633
|
+
const onDemand = trigger.onDemand;
|
|
634
|
+
if (typeof onDemand !== "object" || onDemand === null || !Array.isArray(onDemand.inputs))
|
|
635
|
+
return undefined;
|
|
636
|
+
const targets = onDemand.inputs.flatMap((input) => {
|
|
637
|
+
if (typeof input !== "object" || input === null)
|
|
638
|
+
return [];
|
|
639
|
+
const recordInput = input;
|
|
640
|
+
return isOnDemandRecordType(recordInput.type) && typeof recordInput.app?.refName === "string"
|
|
641
|
+
? [recordInput.app.refName]
|
|
642
|
+
: [];
|
|
643
|
+
});
|
|
644
|
+
return targets.length === 1 ? targets[0] : undefined;
|
|
645
|
+
}
|
|
@@ -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,
|
|
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
|
|
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
|
|
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
|
|
@@ -63,6 +65,8 @@ export type TriggerAst = {
|
|
|
63
65
|
inputs: Array<{
|
|
64
66
|
name: string;
|
|
65
67
|
type: string;
|
|
68
|
+
/** Required target for a record input; reconstructed from default_value. */
|
|
69
|
+
app?: AppRefAst | UnresolvedRefAst;
|
|
66
70
|
required?: boolean;
|
|
67
71
|
multiple?: boolean;
|
|
68
72
|
defaultValue?: unknown;
|
|
@@ -70,12 +74,6 @@ export type TriggerAst = {
|
|
|
70
74
|
}>;
|
|
71
75
|
/** Round-tripped from the wire's `onDemand.showTriggeredBy` flag. */
|
|
72
76
|
showTriggeredBy?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Set when a task in this workflow references `ctx.trigger.record` —
|
|
75
|
-
* i.e. this on-demand automation is invoked against a specific record.
|
|
76
|
-
* Not carried on the wire; inferred by scanning the deserialized tasks.
|
|
77
|
-
*/
|
|
78
|
-
hasRecord?: boolean;
|
|
79
77
|
} | {
|
|
80
78
|
kind: "recordCreate" | "recordUpdate" | "attachment";
|
|
81
79
|
/** The owning app — `{kind: "unresolved", ...}` when the aspect never made it into the pull's catalog. */
|
|
@@ -119,7 +117,7 @@ export type TriggerAst = {
|
|
|
119
117
|
} | {
|
|
120
118
|
kind: "approvalProcessStatusUpdated";
|
|
121
119
|
app: AppRefAst | UnresolvedRefAst;
|
|
122
|
-
approvalChain
|
|
120
|
+
approvalChain?: string | ApprovalChainRefAst;
|
|
123
121
|
status: "ACTIVE" | "STEP_APPROVED" | "CANCELLED" | "DENIED" | "APPROVED";
|
|
124
122
|
} | {
|
|
125
123
|
kind: "schedule";
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import type { AutomationAst } from "./ast.js";
|
|
34
34
|
import type { UnresolvedReferenceDiagnostic } from "../../../graph/types.js";
|
|
35
|
+
/** Keep the authored publish token across pull; live workflow versions are not author intent. */
|
|
36
|
+
export declare function preserveAuthoredAutomationRevision(freshSource: string, existingSource: string): string;
|
|
35
37
|
export interface PrintAutomationV2Options {
|
|
36
38
|
readonly refName?: string;
|
|
37
39
|
/**
|
|
@@ -88,6 +88,7 @@ const TASK_FACTORY_V2 = {
|
|
|
88
88
|
aiClassify: "aiClassify",
|
|
89
89
|
generateReport: "generateReport",
|
|
90
90
|
unzip: "unzip",
|
|
91
|
+
unimplementedTask: "unimplementedTask",
|
|
91
92
|
};
|
|
92
93
|
/**
|
|
93
94
|
* Per-factory arg-key renames: v1 AST arg name → v2 factory option name. The
|
|
@@ -108,8 +109,17 @@ const ARG_RENAMES = {
|
|
|
108
109
|
saveAttachment: { recordRef: "record" },
|
|
109
110
|
documentModel: { recordRef: "record", documentModel: "fileReader" },
|
|
110
111
|
initiateEmailConversation: { recordRef: "record" },
|
|
112
|
+
initiateCall: { recordId: "record", defaultLanguage: "language" },
|
|
111
113
|
generateReport: { recordRef: "record" },
|
|
112
114
|
};
|
|
115
|
+
const REVISION_PROPERTY = /^([ \t]*revision[ \t]*:[ \t]*)(["'`])([^"'`\r\n]+)\2[ \t]*,?[ \t]*$/m;
|
|
116
|
+
/** Keep the authored publish token across pull; live workflow versions are not author intent. */
|
|
117
|
+
export function preserveAuthoredAutomationRevision(freshSource, existingSource) {
|
|
118
|
+
const authored = REVISION_PROPERTY.exec(existingSource)?.[3];
|
|
119
|
+
if (authored === undefined || authored === "")
|
|
120
|
+
return freshSource;
|
|
121
|
+
return freshSource.replace(REVISION_PROPERTY, (_line, prefix) => `${prefix}${JSON.stringify(authored)},`);
|
|
122
|
+
}
|
|
113
123
|
function emptyImports() {
|
|
114
124
|
return {
|
|
115
125
|
filterOps: new Set(),
|
|
@@ -238,6 +248,21 @@ export function printAutomationV2(ast, opts = {}) {
|
|
|
238
248
|
// ---------------------------------------------------------------------------
|
|
239
249
|
function renderHeader(ast, imports, _opts) {
|
|
240
250
|
const lines = [];
|
|
251
|
+
if (imports.usesScriptInput) {
|
|
252
|
+
// executeScript task bodies are printed VERBATIM from the platform's
|
|
253
|
+
// plain-JavaScript source (script-code.ts) — they carry no type
|
|
254
|
+
// annotations of their own, so under this workspace's `noImplicitAny`
|
|
255
|
+
// every untyped nested function/variable in a pulled script body fails
|
|
256
|
+
// `tsc` (#749). The script text is later re-extracted byte-exact from
|
|
257
|
+
// this file's own source (`tryExtractFromCurrentSource`) and shipped to
|
|
258
|
+
// the platform as literal JavaScript, so annotating it in place isn't
|
|
259
|
+
// safe — `: any` would be invalid JS if the file is ever hand-edited
|
|
260
|
+
// into something the extractor can't match and falls back to
|
|
261
|
+
// `Function#toString()`. `@ts-nocheck` must lead the file to take
|
|
262
|
+
// effect, so it costs this one file's typechecking (still fully
|
|
263
|
+
// buildable) rather than the workspace's.
|
|
264
|
+
lines.push(`// @ts-nocheck — executeScript task bodies below are untyped platform JavaScript (see #749)`);
|
|
265
|
+
}
|
|
241
266
|
lines.push(`/**`);
|
|
242
267
|
lines.push(` * ${ast.name}`);
|
|
243
268
|
lines.push(` *`);
|
|
@@ -291,18 +316,19 @@ function printTrigger(trigger, state) {
|
|
|
291
316
|
const optionParts = [];
|
|
292
317
|
if (trigger.showTriggeredBy === true)
|
|
293
318
|
optionParts.push("showTriggeredBy: true");
|
|
294
|
-
if (trigger.hasRecord === true)
|
|
295
|
-
optionParts.push("record: true");
|
|
296
319
|
const optionsSuffix = optionParts.length > 0 ? `, { ${optionParts.join(", ")} }` : "";
|
|
297
320
|
if (trigger.inputs.length === 0)
|
|
298
321
|
return `${onDemand}({}${optionsSuffix})`;
|
|
299
322
|
const lines = trigger.inputs.map((i) => {
|
|
300
323
|
const parts = [`type: ${quote(i.type)}`];
|
|
324
|
+
if (i.type === "record" && i.app !== undefined) {
|
|
325
|
+
parts.push(`app: ${printRef(i.app, state, DEFAULT_CTX)}`);
|
|
326
|
+
}
|
|
301
327
|
if (i.required)
|
|
302
328
|
parts.push(`required: ${i.required}`);
|
|
303
329
|
if (i.multiple)
|
|
304
330
|
parts.push(`multiple: ${i.multiple}`);
|
|
305
|
-
if (i.defaultValue !== undefined && i.defaultValue !== null) {
|
|
331
|
+
if (i.type !== "record" && i.defaultValue !== undefined && i.defaultValue !== null) {
|
|
306
332
|
parts.push(`defaultValue: ${literalJson(i.defaultValue)}`);
|
|
307
333
|
}
|
|
308
334
|
if (i.description !== undefined)
|
|
@@ -360,11 +386,21 @@ function printTrigger(trigger, state) {
|
|
|
360
386
|
}
|
|
361
387
|
case "approvalProcessStatusUpdated": {
|
|
362
388
|
const approvalProcessStatusUpdated = trackFactory("approvalProcessStatusUpdated", state);
|
|
389
|
+
let approvalChain;
|
|
390
|
+
if (typeof trigger.approvalChain === "string") {
|
|
391
|
+
// Genuinely unreconstructable (a literal id, not a managed
|
|
392
|
+
// `elementum_approval_process` reference) - same escape hatch as
|
|
393
|
+
// dataMine's raw datamine id, never a bare string on the public
|
|
394
|
+
// typed option (edk#741 review).
|
|
395
|
+
state.imports.usesUnsafePlatformId = true;
|
|
396
|
+
approvalChain = `unsafePlatformId(${quote(trigger.approvalChain)})${unresolvedReferenceComment(trigger.approvalChain, state.unresolvedReferences)}`;
|
|
397
|
+
}
|
|
398
|
+
else if (trigger.approvalChain !== undefined) {
|
|
399
|
+
approvalChain = printRef(trigger.approvalChain, state, DEFAULT_CTX);
|
|
400
|
+
}
|
|
363
401
|
const parts = [
|
|
364
402
|
`app: ${printRef(trigger.app, state, DEFAULT_CTX)}`,
|
|
365
|
-
`approvalChain: ${
|
|
366
|
-
? quote(trigger.approvalChain)
|
|
367
|
-
: printRef(trigger.approvalChain, state, DEFAULT_CTX)}`,
|
|
403
|
+
...(approvalChain !== undefined ? [`approvalChain: ${approvalChain}`] : []),
|
|
368
404
|
`status: ${quote(trigger.status)}`,
|
|
369
405
|
];
|
|
370
406
|
return `${approvalProcessStatusUpdated}({\n ${parts.join(",\n ")}\n })`;
|
|
@@ -489,7 +525,21 @@ function formatExecuteScript(task, state, indent, refCtx = DEFAULT_CTX) {
|
|
|
489
525
|
const configPad = " ".repeat(indent + 1);
|
|
490
526
|
const lines = [];
|
|
491
527
|
if (task.args.inputs !== undefined && task.args.inputs !== null && typeof task.args.inputs === "object") {
|
|
492
|
-
|
|
528
|
+
// The platform can retain an execute-script input name after its value
|
|
529
|
+
// reference has disappeared. Terraform accepts that as an omitted
|
|
530
|
+
// optional `value`, but provider read normalizes it to an empty string.
|
|
531
|
+
// Use that same current-API literal in pulled source: JavaScript
|
|
532
|
+
// `undefined` cannot build, and `null` would create adoption drift against
|
|
533
|
+
// the normalized state. Dropping the property would also drop the
|
|
534
|
+
// platform-owned input name on the next apply.
|
|
535
|
+
const inputs = Object.fromEntries(Object.entries(task.args.inputs)
|
|
536
|
+
.map(([name, value]) => [name,
|
|
537
|
+
value === undefined || (value !== null &&
|
|
538
|
+
typeof value === "object" &&
|
|
539
|
+
value.kind === "literal" &&
|
|
540
|
+
value.value === undefined) ? "" : value,
|
|
541
|
+
]));
|
|
542
|
+
const obj = printObjectLiteral(inputs, state, indent + 1, refCtx);
|
|
493
543
|
lines.push(`${configPad}inputs: (${lambdaParams(obj, "ctx")}) => (${obj}),`);
|
|
494
544
|
}
|
|
495
545
|
const code = task.args.code ?? task.args.script;
|
|
@@ -515,7 +565,7 @@ function formatExecuteScript(task, state, indent, refCtx = DEFAULT_CTX) {
|
|
|
515
565
|
* `code:` is always a real function (#125 banned a raw-string alternative).
|
|
516
566
|
* This writes the body's text into the `.ts` source verbatim; byte-fidelity
|
|
517
567
|
* through the SUBSEQUENT `elementum build` (which would otherwise reformat
|
|
518
|
-
* it via
|
|
568
|
+
* it via a `toString()` on the loaded function) is handled separately at
|
|
519
569
|
* build time by `tryExtractFromCurrentSource` (`script-code.ts`), which reads
|
|
520
570
|
* this exact source text back out directly rather than trusting the
|
|
521
571
|
* transpiled runtime function.
|
|
@@ -587,8 +637,9 @@ function formatSwitch(task, state, indent, refCtx) {
|
|
|
587
637
|
const pad = " ".repeat(indent);
|
|
588
638
|
const configIndent = " ".repeat(indent + 1);
|
|
589
639
|
const children = task.children ?? [];
|
|
590
|
-
const
|
|
591
|
-
const
|
|
640
|
+
const isDefault = (child) => child.isDefault === true || child.label === null;
|
|
641
|
+
const cases = children.filter((ch) => !isDefault(ch));
|
|
642
|
+
const defaults = children.filter(isDefault);
|
|
592
643
|
const branchCtx = { ctxName: "ctx", selfTaskRefKeys: refCtx.selfTaskRefKeys };
|
|
593
644
|
const caseLines = cases.map((ch) => formatSwitchCase(ch, state, indent + 2, branchCtx));
|
|
594
645
|
const configParts = [];
|
|
@@ -603,7 +654,8 @@ function formatSwitchCase(ch, state, indent, refCtx) {
|
|
|
603
654
|
const pad = " ".repeat(indent);
|
|
604
655
|
const innerPad = " ".repeat(indent + 1);
|
|
605
656
|
const parts = [];
|
|
606
|
-
|
|
657
|
+
if (ch.label !== undefined)
|
|
658
|
+
parts.push(`${innerPad}label: ${ch.label === null ? "null" : quote(ch.label)}`);
|
|
607
659
|
// The switch case `condition:` is a `filter.*` expression evaluated in the
|
|
608
660
|
// switch's outer scope; v2 takes it as a bare value (no `(app) =>` lambda).
|
|
609
661
|
if (ch.filter)
|
|
@@ -623,7 +675,11 @@ function formatForkJoin(task, state, indent, refCtx) {
|
|
|
623
675
|
function formatForkJoinBranch(ch, state, indent, refCtx) {
|
|
624
676
|
const pad = " ".repeat(indent);
|
|
625
677
|
const innerPad = " ".repeat(indent + 1);
|
|
626
|
-
|
|
678
|
+
const parts = [];
|
|
679
|
+
if (ch.label !== undefined)
|
|
680
|
+
parts.push(`${innerPad}label: ${ch.label === null ? "null" : quote(ch.label)}`);
|
|
681
|
+
parts.push(`${innerPad}actions: ${formatNestedActions(ch.tasks, state, indent + 2, refCtx)}`);
|
|
682
|
+
return `${pad}{\n${parts.join(",\n")},\n${pad}}`;
|
|
627
683
|
}
|
|
628
684
|
// ---------------------------------------------------------------------------
|
|
629
685
|
// Task args
|
|
@@ -654,6 +710,21 @@ function printTaskArgs(task, state, indent, refCtx) {
|
|
|
654
710
|
continue;
|
|
655
711
|
}
|
|
656
712
|
const outKey = renames[k] ?? k;
|
|
713
|
+
if (task.factory === "aiSearchTable" && (k === "table" || outKey === "table")) {
|
|
714
|
+
if (typeof v === "string" || (isRefExpr(v) && v.kind === "unresolved")) {
|
|
715
|
+
const uuid = typeof v === "string" ? v : v.uuid;
|
|
716
|
+
state.imports.usesUnsafePlatformId = true;
|
|
717
|
+
lines.push(`${pad}${safeKey(outKey)}: unsafePlatformId(${quote(uuid)})${unresolvedReferenceComment(uuid, state.unresolvedReferences)},`);
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
// unimplementedTask's `id` is always a raw platform id — the referenced
|
|
722
|
+
// task has no CRUD, so there's never a portable typed ref to print instead.
|
|
723
|
+
if (task.factory === "unimplementedTask" && k === "id" && typeof v === "string") {
|
|
724
|
+
state.imports.usesUnsafePlatformId = true;
|
|
725
|
+
lines.push(`${pad}${safeKey(outKey)}: unsafePlatformId(${quote(v)}),`);
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
657
728
|
lines.push(`${pad}${safeKey(outKey)}: ${printArgValue(k, v, state, indent + 1, refCtx)},`);
|
|
658
729
|
}
|
|
659
730
|
if (lines.length === 0)
|
|
@@ -675,7 +746,7 @@ function printFieldAssignments(values, appHandle, state, indent, refCtx) {
|
|
|
675
746
|
return "[]";
|
|
676
747
|
const pad = " ".repeat(indent);
|
|
677
748
|
const inner = " ".repeat(indent + 1);
|
|
678
|
-
const lines = entries.map(([fieldKey,
|
|
749
|
+
const lines = entries.map(([fieldKey, rawValue]) => {
|
|
679
750
|
let fieldExpr;
|
|
680
751
|
if (appHandle && !fieldKey.startsWith(UNRESOLVED_FIELD_MARKER)) {
|
|
681
752
|
fieldExpr = `catalog.${appHandle}.fields${safeMember(fieldKey)}`;
|
|
@@ -687,8 +758,15 @@ function printFieldAssignments(values, appHandle, state, indent, refCtx) {
|
|
|
687
758
|
state.imports.usesUnsafePlatformId = true;
|
|
688
759
|
fieldExpr = `unsafePlatformId(${quote(uuid)})`;
|
|
689
760
|
}
|
|
690
|
-
const
|
|
691
|
-
|
|
761
|
+
const assignmentRecord = rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)
|
|
762
|
+
? rawValue
|
|
763
|
+
: undefined;
|
|
764
|
+
const assignment = assignmentRecord?.__fieldAssignment === true && "value" in assignmentRecord
|
|
765
|
+
? assignmentRecord
|
|
766
|
+
: undefined;
|
|
767
|
+
const valueExpr = printArgValue("", assignment?.value ?? rawValue, state, indent + 2, refCtx);
|
|
768
|
+
const updateMode = assignment?.updateMode === "add" ? `, updateMode: "add"` : "";
|
|
769
|
+
return `${inner}{ field: ${fieldExpr}, value: ${valueExpr}${updateMode} },`;
|
|
692
770
|
});
|
|
693
771
|
return `[\n${lines.join("\n")}\n${pad}]`;
|
|
694
772
|
}
|
|
@@ -862,6 +940,10 @@ function printRef(ref, state, refCtx) {
|
|
|
862
940
|
// modules are lazy-mounted there by `generated/catalog.ts`, not on the
|
|
863
941
|
// `org.ts` identity bag from `pull org --data-only`.
|
|
864
942
|
return `catalog.tables${safeMember(ref.tableHandle)}`;
|
|
943
|
+
case "tableColumn":
|
|
944
|
+
return `catalog.tables${safeMember(ref.tableHandle)}.columns${safeMember(ref.columnKey)}`;
|
|
945
|
+
case "searchTable":
|
|
946
|
+
return `catalog.${ref.appHandle}.searchTables${safeMember(ref.tableKey)}`;
|
|
865
947
|
case "user":
|
|
866
948
|
return `${trackFactory("userRef", state)}(${quote(ref.email)})`;
|
|
867
949
|
case "documentModel":
|
|
@@ -869,11 +951,10 @@ function printRef(ref, state, refCtx) {
|
|
|
869
951
|
case "documentModelField":
|
|
870
952
|
return `catalog.${ref.appHandle}.fileReaders${safeMember(ref.documentModelKey)}.fields${safeMember(ref.fieldKey)}`;
|
|
871
953
|
case "approvalChain":
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
return `{ __kind: "approvalChain", refName: ${quote(ref.approvalChainKey)}, name: ${quote(ref.approvalChainKey)}, parent: ${quote(ref.appHandle)}${ref.unresolvedId !== undefined ? `, unresolvedId: ${quote(ref.unresolvedId)}` : ""} }`;
|
|
954
|
+
if (ref.unresolvedId !== undefined) {
|
|
955
|
+
return `{ __kind: "approvalChain", refName: ${quote(ref.approvalChainKey)}, name: ${quote(ref.approvalChainKey)}, parent: ${quote(ref.appHandle)}, unresolvedId: ${quote(ref.unresolvedId)} }`;
|
|
956
|
+
}
|
|
957
|
+
return `catalog.${ref.appHandle}.approvalChains${safeMember(ref.approvalChainKey)}`;
|
|
877
958
|
case "connector": {
|
|
878
959
|
// Connectors are org-level (no appHandle), nested under their owning
|
|
879
960
|
// provider — mirrors printConnectorToken in
|
|
@@ -897,6 +978,8 @@ function printRef(ref, state, refCtx) {
|
|
|
897
978
|
}
|
|
898
979
|
case "cloudLink":
|
|
899
980
|
return `catalog.cloudLinks${safeMember(ref.handle)}`;
|
|
981
|
+
case "procedure":
|
|
982
|
+
return `catalog.cloudLinks${safeMember(ref.cloudLinkKey)}.procedures${safeMember(ref.procedureKey)}`;
|
|
900
983
|
case "unresolved":
|
|
901
984
|
// v2 value slots accept a literal directly — no `val()` wrapper. But this
|
|
902
985
|
// RefExpr kind is also the fallback for ref-typed positions (automation,
|
|
@@ -5,6 +5,13 @@ export interface AutomationFromTfResult {
|
|
|
5
5
|
readonly tfLabel: string;
|
|
6
6
|
readonly ast: AutomationAst;
|
|
7
7
|
readonly blocks: readonly TfBlock[];
|
|
8
|
+
/** Export address → address rebuilt from the printed current API. */
|
|
9
|
+
readonly adoptionAddressAliases: readonly {
|
|
10
|
+
readonly from: string;
|
|
11
|
+
readonly to: string;
|
|
12
|
+
}[];
|
|
13
|
+
/** Non-fatal issues found while extracting (edk#785: a task anchored to the trigger because its real parent is unsupported). */
|
|
14
|
+
readonly diagnostics?: readonly string[];
|
|
8
15
|
}
|
|
9
16
|
/**
|
|
10
17
|
* Best-effort resource footprint of one automation, used ONLY when whole-
|
|
@@ -30,6 +37,7 @@ export interface AutomationFromTfContext {
|
|
|
30
37
|
readonly ownerRefName: string;
|
|
31
38
|
readonly fieldKey: string;
|
|
32
39
|
readonly fieldName?: string;
|
|
40
|
+
readonly fieldType?: string;
|
|
33
41
|
}>;
|
|
34
42
|
readonly foreignFieldRefsByDataAddress?: ReadonlyMap<string, {
|
|
35
43
|
readonly ownerRefName: string;
|
|
@@ -43,6 +51,7 @@ export interface AutomationFromTfContext {
|
|
|
43
51
|
readonly fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
44
52
|
readonly foreignAppRefNames?: ReadonlyMap<string, string>;
|
|
45
53
|
readonly foreignElementRefNames?: ReadonlyMap<string, string>;
|
|
54
|
+
readonly procedureKeysByDiscriminator?: ReadonlyMap<string, string>;
|
|
46
55
|
}
|
|
47
56
|
export interface AutomationGraphFromTfResult {
|
|
48
57
|
readonly automation?: AutomationAst;
|
|
@@ -60,4 +69,4 @@ export declare function automationFromTf(doc: TfDocument, automationLabel: strin
|
|
|
60
69
|
}>, foreignTableRefsById?: ReadonlyMap<string, {
|
|
61
70
|
readonly tableRefName: string;
|
|
62
71
|
readonly name: string;
|
|
63
|
-
}>, picklistOptionLabelById?: ReadonlyMap<string, string>, fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>, foreignAppRefNames?: ReadonlyMap<string, string>, foreignElementRefNames?: ReadonlyMap<string, string>): AutomationFromTfResult;
|
|
72
|
+
}>, picklistOptionLabelById?: ReadonlyMap<string, string>, fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>, foreignAppRefNames?: ReadonlyMap<string, string>, foreignElementRefNames?: ReadonlyMap<string, string>, procedureKeysByDiscriminator?: ReadonlyMap<string, string>): AutomationFromTfResult;
|