@elementumai/edk 0.9.19 → 0.10.1
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 +159 -7
- package/dist-sdk/src/catalog/factories.d.ts +33 -2
- package/dist-sdk/src/catalog/factories.js +40 -1
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +11 -0
- package/dist-sdk/src/catalog/types.d.ts +40 -1
- package/dist-sdk/src/catalog/types.js +12 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +40 -4
- package/dist-sdk/src/core/triggers/on-demand.js +17 -2
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
- package/dist-sdk/src/engine/coverage-gaps.js +156 -0
- package/dist-sdk/src/engine/ei/run.d.ts +169 -0
- package/dist-sdk/src/engine/ei/run.js +1219 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
- package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
- package/dist-sdk/src/engine/pull/context.d.ts +68 -6
- package/dist-sdk/src/engine/pull/context.js +40 -1
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +10 -7
- package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
- package/dist-sdk/src/engine/pull/result-output.js +113 -3
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +28 -5
- package/dist-sdk/src/engine/tf/labels.js +54 -3
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.js +93 -4
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +44 -0
- package/dist-sdk/src/engine/validation.js +95 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
- package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +5 -2
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +46 -21
- package/dist-sdk/src/entities/agent/from-tf.js +11 -3
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.js +20 -6
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +18 -6
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
- package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
- package/dist-sdk/src/entities/app/auto-share.js +49 -0
- package/dist-sdk/src/entities/app/build.d.ts +105 -22
- package/dist-sdk/src/entities/app/build.js +107 -10
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -2
- package/dist-sdk/src/entities/app/index.d.ts +7 -6
- package/dist-sdk/src/entities/app/index.js +2 -8
- package/dist-sdk/src/entities/app/module.js +5 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +40 -13
- package/dist-sdk/src/entities/automation/build.d.ts +56 -6
- package/dist-sdk/src/entities/automation/build.js +230 -26
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +41 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +470 -58
- package/dist-sdk/src/entities/automation/from-tf.d.ts +37 -8
- package/dist-sdk/src/entities/automation/from-tf.js +791 -131
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +107 -15
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +20 -0
- package/dist-sdk/src/entities/automation/script-code.js +109 -5
- package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +39 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +85 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +116 -22
- package/dist-sdk/src/entities/automation/tasks.js +86 -24
- package/dist-sdk/src/entities/automation/to-tf.d.ts +24 -3
- package/dist-sdk/src/entities/automation/to-tf.js +1082 -132
- package/dist-sdk/src/entities/automation/triggers.d.ts +12 -6
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.d.ts +9 -0
- package/dist-sdk/src/entities/automation/types.js +19 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/chart/to-tf.js +10 -3
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
- package/dist-sdk/src/entities/element/build.d.ts +28 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/element/from-tf.js +62 -1
- package/dist-sdk/src/entities/element/index.d.ts +5 -3
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +9 -3
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +16 -16
- package/dist-sdk/src/entities/field/build.d.ts +17 -3
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -4
- package/dist-sdk/src/entities/field/from-tf.js +244 -49
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +2 -0
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +26 -5
- package/dist-sdk/src/entities/field/to-tf.js +137 -15
- package/dist-sdk/src/entities/field/types.d.ts +2 -0
- package/dist-sdk/src/entities/field/types.js +27 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
- package/dist-sdk/src/entities/role/from-tf.js +3 -3
- package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/role/to-tf.js +12 -4
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +20 -8
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +23 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +19 -4
- package/dist-sdk/src/entities/shared/filters/print.js +24 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +46 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +15 -2
- package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
- package/dist-sdk/src/entities/shared/ref.js +5 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +20 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +8 -0
- package/dist-sdk/src/entities/skill/access-policy.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +14 -6
- package/dist-sdk/src/entities/skill/from-tf.js +70 -15
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.js +14 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +49 -10
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -8
- package/dist-sdk/src/entities/skill-tool/to-tf.js +49 -14
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +2 -2
- package/dist-sdk/src/entities/task/build.d.ts +8 -0
- package/dist-sdk/src/entities/task/build.js +10 -1
- package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/task/from-tf.js +7 -2
- package/dist-sdk/src/entities/task/module.js +2 -2
- package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
- package/dist-sdk/src/entities/task/to-tf.js +28 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
- package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +133 -13
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +20 -8
- package/dist-sdk/src/entities/view/to-tf.js +86 -18
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +15 -15
- package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
- package/dist-sdk/src/entities/visual-flow/build.js +9 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +41 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +148 -13
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +12 -0
- package/dist-sdk/src/graph/index.js +21 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +83 -4
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +16 -3
|
@@ -31,15 +31,15 @@ import { isOnDemandRecordType } from "../shared/types/field-types.js";
|
|
|
31
31
|
import { buildContext, createForEachItemProxy } from "../shared/context.js";
|
|
32
32
|
import { outputFieldTypesFromScriptSchema } from "./output-field-types.js";
|
|
33
33
|
import { isRef } from "../shared/ref.js";
|
|
34
|
-
import { API_TASK_REF_WIRE_NAMES, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
35
|
-
import { extractScriptBody, inferOutputSchema, isScriptFile, readScriptFile, tryExtractFromCurrentSource } from "./script-code.js";
|
|
34
|
+
import { API_TASK_REF_WIRE_NAMES, OUTPUT_KEY_CANONICAL, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
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
|
|
38
38
|
// ActionDef return values are an internal serialization detail; authored
|
|
39
39
|
// automations call the direct fluent methods declared on ActionBuilder.
|
|
40
40
|
import * as operatorFactories from "./operators.js";
|
|
41
41
|
import * as actionFactories from "./tasks.js";
|
|
42
|
-
import { USER_SEARCH_REF_WIRE_NAMES, WHOLE_RECORD_REF_WIRE_NAMES } from "./task-output-labels.js";
|
|
42
|
+
import { AI_SEARCH_TABLE_OUTPUT_NAMES, TRIGGER_WHOLE_RECORD_MARKER, TRIGGER_WHOLE_RECORD_REF_NAME, USER_SEARCH_REF_WIRE_NAMES, WHOLE_RECORD_REF_WIRE_NAMES, } from "./task-output-labels.js";
|
|
43
43
|
import { isWorkflowOutputDeclaration, workflowOutputFieldType, } from "./workflow-output.js";
|
|
44
44
|
/** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
|
|
45
45
|
export const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
@@ -217,6 +217,77 @@ function findRelatedRecordsTotalCountError(taskRefKey) {
|
|
|
217
217
|
`for a match count, or ctx.actions.${taskRefKey ?? "<findRelatedRecordsTask>"}.record / .records ` +
|
|
218
218
|
`for related rows. Do not invent a count ref.`);
|
|
219
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* User and user-group searches have a closed output set; any other name
|
|
222
|
+
* (e.g. `totalCount`, which user search does not expose) would compile to a
|
|
223
|
+
* `refs["…"]` key the platform never returns.
|
|
224
|
+
*/
|
|
225
|
+
function assertKnownSearchOutput(taskKey, wireNames, name, taskRefKey) {
|
|
226
|
+
const known = new Set([...Object.keys(wireNames), ...Object.values(wireNames)]);
|
|
227
|
+
if (known.has(name))
|
|
228
|
+
return;
|
|
229
|
+
const outputs = Object.keys(wireNames).join(", ");
|
|
230
|
+
throw new EntityTfError(`${taskKey}${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; its outputs are ${outputs}.`);
|
|
231
|
+
}
|
|
232
|
+
/** Canonical service_tasks names. They are not authoring accessors. */
|
|
233
|
+
const EXECUTE_SCRIPT_CANONICAL_OUTPUT_NAMES = new Set(["stringArrayResult", "numberArrayResult"]);
|
|
234
|
+
/**
|
|
235
|
+
* Top-level property names on a wire `output_schema` object. `undefined` means
|
|
236
|
+
* the script declared no schema, so a `result.<prop>` cannot be checked.
|
|
237
|
+
*/
|
|
238
|
+
function declaredScriptResultProperties(schema) {
|
|
239
|
+
if (typeof schema !== "object" || schema === null || !("object" in schema))
|
|
240
|
+
return undefined;
|
|
241
|
+
const object = schema.object;
|
|
242
|
+
if (typeof object !== "object" || object === null)
|
|
243
|
+
return undefined;
|
|
244
|
+
const properties = object.properties;
|
|
245
|
+
if (!Array.isArray(properties))
|
|
246
|
+
return new Set();
|
|
247
|
+
const names = new Set();
|
|
248
|
+
for (const property of properties) {
|
|
249
|
+
if (typeof property !== "object" || property === null)
|
|
250
|
+
continue;
|
|
251
|
+
for (const node of Object.values(property)) {
|
|
252
|
+
if (typeof node === "object" && node !== null && typeof node.name === "string") {
|
|
253
|
+
names.add(node.name);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return names;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* A script's declared outputs are read under `result`. A bare
|
|
261
|
+
* `ctx.actions.<script>.<name>` would compile to a `refs["<name>"]` key the
|
|
262
|
+
* platform never sets, so apply fails with "Invalid index". When the script
|
|
263
|
+
* declares an output schema, `result.<prop>` is checked against that schema
|
|
264
|
+
* too. Authoring names are `result`, `textResult`, and `result.<prop>`.
|
|
265
|
+
* `Text Result` is the refs-map key `textResult` rewrites to, not a name
|
|
266
|
+
* someone authors. The canonical publish path also accepts the service_tasks
|
|
267
|
+
* contract names.
|
|
268
|
+
*/
|
|
269
|
+
function assertKnownScriptOutput(name, taskRefKey, schema, canonical, checkDeclaredResult) {
|
|
270
|
+
if (name === "result" || name === "textResult")
|
|
271
|
+
return;
|
|
272
|
+
if (canonical && EXECUTE_SCRIPT_CANONICAL_OUTPUT_NAMES.has(name))
|
|
273
|
+
return;
|
|
274
|
+
if (name.startsWith("result.")) {
|
|
275
|
+
// Filter `{type:"TASK"}` shapes are not refs-map reads. A switch left_value
|
|
276
|
+
// whose script does not declare the property stays a typed envelope on the
|
|
277
|
+
// task `.id` (#1151), which to-tf emits with a diagnostic.
|
|
278
|
+
if (!checkDeclaredResult)
|
|
279
|
+
return;
|
|
280
|
+
const declared = declaredScriptResultProperties(schema);
|
|
281
|
+
const property = name.slice("result.".length).split(".")[0] ?? "";
|
|
282
|
+
if (declared === undefined || declared.has(property))
|
|
283
|
+
return;
|
|
284
|
+
const listed = [...declared].join(", ");
|
|
285
|
+
throw new EntityTfError(`executeScript${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; ` +
|
|
286
|
+
`declared result properties are ${listed === "" ? "(none)" : listed}.`);
|
|
287
|
+
}
|
|
288
|
+
throw new EntityTfError(`executeScript${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; ` +
|
|
289
|
+
`script outputs are read under result. Use ctx.actions.${taskRefKey ?? "<script>"}.result.${name}.`);
|
|
290
|
+
}
|
|
220
291
|
/**
|
|
221
292
|
* Forward output-name rewrites, the inverse of the deserializer's read-side
|
|
222
293
|
* normalization (`applyOutputNameInverseRewrites` in
|
|
@@ -245,7 +316,7 @@ function findRelatedRecordsTotalCountError(taskRefKey) {
|
|
|
245
316
|
* - single-scalar-output tasks (see `OUTPUT_KEY_WIRE_NAME`): `output` →
|
|
246
317
|
* the platform's actual output name for that task kind.
|
|
247
318
|
*/
|
|
248
|
-
function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
|
|
319
|
+
function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDeclaredScriptResult = true) {
|
|
249
320
|
if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
|
|
250
321
|
throw findRelatedRecordsTotalCountError(taskRefKey);
|
|
251
322
|
}
|
|
@@ -256,16 +327,20 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
|
|
|
256
327
|
return "Records Size";
|
|
257
328
|
}
|
|
258
329
|
if (taskKey === "userGroupSearch") {
|
|
330
|
+
assertKnownSearchOutput("userGroupSearch", USER_GROUP_SEARCH_REF_WIRE_NAMES, name, taskRefKey);
|
|
259
331
|
return USER_GROUP_SEARCH_REF_WIRE_NAMES[name] ?? name;
|
|
260
332
|
}
|
|
261
333
|
if (taskKey === "userSearch") {
|
|
334
|
+
assertKnownSearchOutput("userSearch", USER_SEARCH_REF_WIRE_NAMES, name, taskRefKey);
|
|
262
335
|
return USER_SEARCH_REF_WIRE_NAMES[name] ?? name;
|
|
263
336
|
}
|
|
264
|
-
if (taskKey === "executeScript"
|
|
265
|
-
|
|
337
|
+
if (taskKey === "executeScript") {
|
|
338
|
+
assertKnownScriptOutput(name, taskRefKey, schema, false, checkDeclaredScriptResult);
|
|
339
|
+
if (name === "textResult")
|
|
340
|
+
return "Text Result";
|
|
266
341
|
}
|
|
267
|
-
if (taskKey === "aiSearchTable" && name
|
|
268
|
-
return
|
|
342
|
+
if (taskKey === "aiSearchTable" && AI_SEARCH_TABLE_OUTPUT_NAMES[name] !== undefined) {
|
|
343
|
+
return AI_SEARCH_TABLE_OUTPUT_NAMES[name][0];
|
|
269
344
|
}
|
|
270
345
|
if (taskKey === "aiAgent") {
|
|
271
346
|
const segs = name.split(".");
|
|
@@ -289,6 +364,90 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
|
|
|
289
364
|
}
|
|
290
365
|
return name;
|
|
291
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* CANONICAL reference-name rewrite — used ONLY for workflow-publish OUTPUTS
|
|
369
|
+
* (see DESIGN-canonical-reference-model.md). A workflow output's
|
|
370
|
+
* `taskReference.name` must be the platform's CANONICAL output name
|
|
371
|
+
* (`service_tasks`), NOT the refs-map display label — the platform validates
|
|
372
|
+
* the published output against the canonical name (edk#835). Task INPUTS,
|
|
373
|
+
* FILTERS and CALC mustaches are UNCHANGED (they keep `rewriteForwardTaskRefName`
|
|
374
|
+
* / the display refs-map path — #1271 owns those positions). Maps EDK's friendly
|
|
375
|
+
* accessor → canonical; identity for most kinds. Validated against
|
|
376
|
+
* TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
|
|
377
|
+
*/
|
|
378
|
+
export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema) {
|
|
379
|
+
if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
|
|
380
|
+
throw findRelatedRecordsTotalCountError(taskRefKey);
|
|
381
|
+
}
|
|
382
|
+
if (taskKey === "executeScript")
|
|
383
|
+
assertKnownScriptOutput(name, taskRefKey, schema, true, true);
|
|
384
|
+
if (taskKey === "api" && name.startsWith("file.")) {
|
|
385
|
+
// apiRequest's file SUB-refs (.file.content / .contentType / .name) have no
|
|
386
|
+
// canonical service_tasks output name of their own — they resolve by the
|
|
387
|
+
// provider's refs-map DISPLAY label ("Content" / "Content Type" / "Name", via
|
|
388
|
+
// API_TASK_REF_WIRE_NAMES). Keep the base display rewrite. Top-level api
|
|
389
|
+
// outputs ARE contract names and ride the envelope as identity.
|
|
390
|
+
return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
|
|
391
|
+
}
|
|
392
|
+
if ((taskKey === "recordSearch" || taskKey === "tableRecordsSearch") && name === "totalCount") {
|
|
393
|
+
// Both expose a `totalCount` accessor, but the executors' canonical count
|
|
394
|
+
// output is `count` (aspect_records_search.count / table_records_search.count).
|
|
395
|
+
return "count";
|
|
396
|
+
}
|
|
397
|
+
if (taskKey === "aiSearchTable" && AI_SEARCH_TABLE_OUTPUT_NAMES[name] !== undefined) {
|
|
398
|
+
return AI_SEARCH_TABLE_OUTPUT_NAMES[name][1];
|
|
399
|
+
}
|
|
400
|
+
if (taskKey === "userSearch" || taskKey === "userGroupSearch") {
|
|
401
|
+
if (taskKey === "userSearch" && (name === "user.managerName" || name === "user.managerEmail")) {
|
|
402
|
+
// Fail fast at build (like findRelatedRecords.totalCount) rather than let
|
|
403
|
+
// the platform reject it at publish: a user's manager fields are NOT
|
|
404
|
+
// referenceable workflow outputs — both the "Manager Name"/"Manager Email"
|
|
405
|
+
// display label and the "user.managerName"/"user.managerEmail" accessor are
|
|
406
|
+
// rejected at publish, and their real canonical name was never captured live.
|
|
407
|
+
const label = name === "user.managerName" ? "Manager Name" : "Manager Email";
|
|
408
|
+
throw new EntityTfError(`userSearch does not expose a referenceable "${name}" workflow output — the platform ` +
|
|
409
|
+
`rejects both the "${label}" label and "${name}" at publish. Reference ` +
|
|
410
|
+
`user.id / user.name / user.email instead, or drop this output.`);
|
|
411
|
+
}
|
|
412
|
+
// A userSearch/userGroupSearch workflow OUTPUT's canonical name IS the
|
|
413
|
+
// authoring accessor (count/group/group.id/group.name/groups and
|
|
414
|
+
// user/users/user.id/user.name/user.email). #1271's TASK_OUTPUT_REFERENCE_NAMES
|
|
415
|
+
// captured the userGroupSearch names live; the display refs-map labels the
|
|
416
|
+
// forward rewrite would otherwise emit ("Groups Size", "ID", …) are rejected
|
|
417
|
+
// at publish (edk#835). The display path stays for inputs/calc/filters,
|
|
418
|
+
// which #1271 owns. See docs/design/canonical-reference-model.md.
|
|
419
|
+
return name;
|
|
420
|
+
}
|
|
421
|
+
if (taskKey === "aiAgent") {
|
|
422
|
+
// aiAgent is NOT a #835 display-label victim: base already emits the correct
|
|
423
|
+
// platform reference via rewriteForwardTaskRefName + to-tf's
|
|
424
|
+
// aiAgentPlatformRefName. Keep that intact by delegating to the forward rewrite.
|
|
425
|
+
return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
|
|
426
|
+
}
|
|
427
|
+
if (taskKey === "documentModel") {
|
|
428
|
+
// file_reader's published output wire name is "text" (confirmed live wire
|
|
429
|
+
// data), NOT a #835 display-label victim. Keep base behavior.
|
|
430
|
+
return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
|
|
431
|
+
}
|
|
432
|
+
if (taskKey === "recordSearch" && name === "record.recordId") {
|
|
433
|
+
// recordSearch exposes a real canonical `recordId` output (service_tasks
|
|
434
|
+
// aspect_records_search.recordId, ASPECT_RECORD_ID) — validated live 0-diff.
|
|
435
|
+
return "recordId";
|
|
436
|
+
}
|
|
437
|
+
if (taskKey !== undefined && RECORD_BEARING_TASK_KEYS.has(taskKey) && name === "record.recordId") {
|
|
438
|
+
// createRecord/findRelatedRecords do NOT expose a `recordId` output
|
|
439
|
+
// (find_related_records has none in service_tasks). Their record-id reference
|
|
440
|
+
// is "Record" (ASPECT_RECORD_ID) — the base behavior. Keep via forward rewrite.
|
|
441
|
+
return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
|
|
442
|
+
}
|
|
443
|
+
const canonicalOutputKey = taskKey ? OUTPUT_KEY_CANONICAL[taskKey] : undefined;
|
|
444
|
+
if (canonicalOutputKey) {
|
|
445
|
+
const segs = name.split(".");
|
|
446
|
+
if (segs[0] === "output")
|
|
447
|
+
return [canonicalOutputKey, ...segs.slice(1)].join(".");
|
|
448
|
+
}
|
|
449
|
+
return name;
|
|
450
|
+
}
|
|
292
451
|
/**
|
|
293
452
|
* Walk a serialized wire node and rewrite, in place, the `name` of every task
|
|
294
453
|
* output reference whose target task needs an output-name rewrite. Two wire
|
|
@@ -299,10 +458,15 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
|
|
|
299
458
|
* the `ref*` filter helpers) — both need the same rewrite. Runs at finalize,
|
|
300
459
|
* when the full refKey→kind map is known.
|
|
301
460
|
*/
|
|
302
|
-
function rewriteTaskOutputRefs(node, taskKindByRefKey
|
|
461
|
+
function rewriteTaskOutputRefs(node, taskKindByRefKey, scriptSchemas,
|
|
462
|
+
// Workflow OUTPUTS pass canonical=true: a `taskReference.name` becomes the
|
|
463
|
+
// platform's CANONICAL service_tasks output name (edk#835). Task inputs and
|
|
464
|
+
// filters (canonical=false, the default) keep the display rewrite — #1271 owns
|
|
465
|
+
// those positions.
|
|
466
|
+
canonical = false) {
|
|
303
467
|
if (Array.isArray(node)) {
|
|
304
468
|
for (const item of node)
|
|
305
|
-
rewriteTaskOutputRefs(item, taskKindByRefKey);
|
|
469
|
+
rewriteTaskOutputRefs(item, taskKindByRefKey, scriptSchemas, canonical);
|
|
306
470
|
return;
|
|
307
471
|
}
|
|
308
472
|
if (node === null || typeof node !== "object")
|
|
@@ -315,16 +479,30 @@ function rewriteTaskOutputRefs(node, taskKindByRefKey) {
|
|
|
315
479
|
: undefined;
|
|
316
480
|
if (wholeRecord !== undefined)
|
|
317
481
|
mapped.name = wholeRecord;
|
|
482
|
+
// Field mappings read a trigger's whole record too, which shares its
|
|
483
|
+
// display name with the record ID (edk#1284); see TRIGGER_WHOLE_RECORD_MARKER.
|
|
484
|
+
const value = rec.value;
|
|
485
|
+
if (value?.triggerReference?.name === TRIGGER_WHOLE_RECORD_REF_NAME) {
|
|
486
|
+
rec.value = { ...value, [TRIGGER_WHOLE_RECORD_MARKER]: true };
|
|
487
|
+
}
|
|
318
488
|
}
|
|
319
489
|
const ref = rec.taskReference;
|
|
320
490
|
if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
|
|
321
|
-
|
|
491
|
+
const rewrite = canonical ? rewriteCanonicalOutputRefName : rewriteForwardTaskRefName;
|
|
492
|
+
ref.name = rewrite(taskKindByRefKey.get(ref.taskRefKey), ref.name, ref.taskRefKey, scriptSchemas.get(ref.taskRefKey));
|
|
322
493
|
}
|
|
323
494
|
if (rec.type === "TASK" && typeof rec.taskRefKey === "string" && typeof rec.name === "string") {
|
|
324
|
-
|
|
495
|
+
// Filter `{type:"TASK"}` shapes never appear in a workflow OUTPUT subtree;
|
|
496
|
+
// keep the display rewrite (#1271's filter path) regardless of `canonical`.
|
|
497
|
+
rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey, scriptSchemas.get(rec.taskRefKey), false);
|
|
498
|
+
}
|
|
499
|
+
for (const [key, v] of Object.entries(rec)) {
|
|
500
|
+
// A calc-engine mustache subtree (`calculationReference` → templateReference)
|
|
501
|
+
// keeps the display/forward rewrite even under an output, so its decode
|
|
502
|
+
// (decodeCalculationTaskMustache) stays idempotent.
|
|
503
|
+
const childCanonical = key === "calculationReference" ? false : canonical;
|
|
504
|
+
rewriteTaskOutputRefs(v, taskKindByRefKey, scriptSchemas, childCanonical);
|
|
325
505
|
}
|
|
326
|
-
for (const v of Object.values(rec))
|
|
327
|
-
rewriteTaskOutputRefs(v, taskKindByRefKey);
|
|
328
506
|
}
|
|
329
507
|
/**
|
|
330
508
|
* Walk serialized tasks and assign UUIDs to any `variable.create` entries that
|
|
@@ -419,19 +597,20 @@ function serializeOutputValue(value) {
|
|
|
419
597
|
}
|
|
420
598
|
return isRef(value) ? serializeNode(value) : { value };
|
|
421
599
|
}
|
|
422
|
-
function makeActionBuilder(state, mode = "root", item) {
|
|
423
|
-
const appendAction = (name, def, displayName, hclParent) => makeActionBuilder({ ...state, tasks: [...state.tasks, { name, def, displayName, hclParent }] }, mode, item);
|
|
600
|
+
function makeActionBuilder(state, mode = "root", item, loops = {}) {
|
|
601
|
+
const appendAction = (name, def, displayName, hclParent) => makeActionBuilder({ ...state, tasks: [...state.tasks, { name, def, displayName, hclParent }] }, mode, item, loops);
|
|
424
602
|
const context = () => {
|
|
425
603
|
const base = buildContext(state.tasks.map((entry) => entry.name));
|
|
426
|
-
return (item === undefined ? base : { ...base, item });
|
|
604
|
+
return (item === undefined ? base : { ...base, item, loops });
|
|
427
605
|
};
|
|
428
606
|
const resolveOptions = (value) => typeof value === "function" ? value(context()) : value;
|
|
429
|
-
const materializeNested = (callback, childItem) => callback(makeActionBuilder({ trigger: state.trigger, tasks: [] }, "nested", childItem)).__children();
|
|
607
|
+
const materializeNested = (callback, childItem, childLoops = loops) => callback(makeActionBuilder({ trigger: state.trigger, tasks: [] }, "nested", childItem, childLoops)).__children();
|
|
430
608
|
const leafFactories = {
|
|
431
609
|
recordSearch: actionFactories.recordSearch,
|
|
432
610
|
tableRecordsSearch: actionFactories.tableRecordsSearch,
|
|
433
611
|
createRecord: actionFactories.createRecord,
|
|
434
612
|
updateField: actionFactories.updateField,
|
|
613
|
+
bulkUpdateFields: actionFactories.bulkUpdateFields,
|
|
435
614
|
findRelatedRecords: actionFactories.findRelatedRecords,
|
|
436
615
|
relateRecords: actionFactories.relateRecords,
|
|
437
616
|
sendEmail: actionFactories.sendEmail,
|
|
@@ -452,6 +631,7 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
452
631
|
approvalStatusUpdate: actionFactories.approvalStatusUpdate,
|
|
453
632
|
addWatcher: actionFactories.addWatcher,
|
|
454
633
|
saveAttachment: actionFactories.saveAttachment,
|
|
634
|
+
unzip: actionFactories.unzip,
|
|
455
635
|
userSearch: actionFactories.userSearch,
|
|
456
636
|
userGroupSearch: actionFactories.userGroupSearch,
|
|
457
637
|
initiateCall: actionFactories.initiateCall,
|
|
@@ -479,8 +659,8 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
479
659
|
// A `scriptFile(...)` reference IS the exact text (no source scan, no
|
|
480
660
|
// toString(), no closure hazard: it is never a JS closure).
|
|
481
661
|
const body = isScriptFile(opts.code)
|
|
482
|
-
? readScriptFile(opts.code)
|
|
483
|
-
: tryExtractFromCurrentSource(name) ?? extractScriptBody(opts.code);
|
|
662
|
+
? toPlatformScriptBody(readScriptFile(opts.code), `executeScript "${name}" scriptFile("${opts.code.path}")`, { stripTypes: false })
|
|
663
|
+
: toPlatformScriptBody(tryExtractFromCurrentSource(name) ?? extractScriptBody(opts.code), `executeScript "${name}"`);
|
|
484
664
|
const outputs = opts.outputs === undefined ? inferOutputSchema(body) : (opts.outputs ?? undefined);
|
|
485
665
|
const def = actionFactories.executeScriptActionDefWithBody(body, {
|
|
486
666
|
...(opts.inputs !== undefined ? { inputs: opts.inputs(context()) } : {}),
|
|
@@ -500,8 +680,14 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
500
680
|
},
|
|
501
681
|
forEach(name, opts, displayName, hclParent) {
|
|
502
682
|
const authored = opts;
|
|
503
|
-
|
|
504
|
-
|
|
683
|
+
// Bind the body's item to this loop's real name, never the shared
|
|
684
|
+
// placeholder: replaceForEachPlaceholder rewrites every placeholder in
|
|
685
|
+
// a forEach task's subtree to that loop, including an OUTER loop's item
|
|
686
|
+
// captured in this task's own collection (an enclosing ctx.item) or
|
|
687
|
+
// read by name from inside (ctx.loops.<outer>.item) (#1320).
|
|
688
|
+
const childItem = createForEachItemProxy(name);
|
|
689
|
+
const childLoops = { ...loops, [name]: { item: childItem } };
|
|
690
|
+
const children = materializeNested(authored.actions, childItem, childLoops);
|
|
505
691
|
const def = operatorFactories.forEach(context(), {
|
|
506
692
|
collection: typeof authored.collection === "function" ? authored.collection(context()) : authored.collection,
|
|
507
693
|
actions: () => children,
|
|
@@ -545,7 +731,7 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
545
731
|
name,
|
|
546
732
|
value: serializeOutputValue(value),
|
|
547
733
|
}));
|
|
548
|
-
return makeActionBuilder({ ...state, outputs }, mode, item);
|
|
734
|
+
return makeActionBuilder({ ...state, outputs }, mode, item, loops);
|
|
549
735
|
},
|
|
550
736
|
__children() {
|
|
551
737
|
return state.tasks.map((entry) => ({
|
|
@@ -566,11 +752,16 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
566
752
|
},
|
|
567
753
|
__finalize() {
|
|
568
754
|
const taskKindByRefKey = collectTaskKinds(state.tasks);
|
|
755
|
+
const scriptSchemas = collectExecuteScriptOutputSchemas(state.tasks);
|
|
569
756
|
const tasks = state.tasks.map((t) => serializeTaskEntry(t.name, t.def, t.displayName, t.hclParent));
|
|
570
|
-
|
|
571
|
-
|
|
757
|
+
// Deep copy: the rewrites below mutate in place, and `state.outputs` is
|
|
758
|
+
// shared by every build of this definition (#1536).
|
|
759
|
+
const outputs = state.outputs?.map((o) => structuredClone(o));
|
|
760
|
+
rewriteTaskOutputRefs(tasks, taskKindByRefKey, scriptSchemas);
|
|
761
|
+
// Workflow OUTPUTS emit the platform's CANONICAL output name (edk#835);
|
|
762
|
+
// task inputs/filters above stay on the display path (#1271 owns them).
|
|
572
763
|
if (outputs)
|
|
573
|
-
rewriteTaskOutputRefs(outputs, taskKindByRefKey);
|
|
764
|
+
rewriteTaskOutputRefs(outputs, taskKindByRefKey, scriptSchemas, /* canonical */ true);
|
|
574
765
|
// Trigger reference names are NOT canonicalized: the authored name is
|
|
575
766
|
// the name, everywhere in EDK. (Mobius canonicalizes reference names in
|
|
576
767
|
// ITS storage — `ValueReference.ofTriggerReference` — but on the tf
|
|
@@ -685,6 +876,7 @@ export function automation(opts) {
|
|
|
685
876
|
def(refName) {
|
|
686
877
|
const sequence = opts.actions.__finalize();
|
|
687
878
|
const recordFieldContext = mergeOnDemandRecordFieldContext(sequence.recordFieldContext, sequence.trigger);
|
|
879
|
+
assertTriggerOnOwningAspect(refName, opts.app.refName, sequence.recordFieldContext?.triggerAppRefName);
|
|
688
880
|
// `recordFieldContext` is a structural extension, not a declared `DeployableEntity`
|
|
689
881
|
// property (see `RecordFieldContext`'s doc comment) — assigning to `entity`
|
|
690
882
|
// first (rather than returning the literal directly) avoids an excess-property
|
|
@@ -737,3 +929,15 @@ function soleOnDemandRecordTargetRefName(trigger) {
|
|
|
737
929
|
});
|
|
738
930
|
return targets.length === 1 ? targets[0] : undefined;
|
|
739
931
|
}
|
|
932
|
+
/**
|
|
933
|
+
* A record trigger carries no aspect of its own on the wire: it always fires
|
|
934
|
+
* on the automation's owning app or element. A trigger authored against any
|
|
935
|
+
* other app would silently attach to the owner, so it is a build error (#1594).
|
|
936
|
+
*/
|
|
937
|
+
export function assertTriggerOnOwningAspect(automationRefName, ownerRefName, triggerAppRefName) {
|
|
938
|
+
if (triggerAppRefName === undefined || triggerAppRefName === ownerRefName)
|
|
939
|
+
return;
|
|
940
|
+
throw new Error(`automation "${automationRefName}": its trigger is on "${triggerAppRefName}", but the automation is owned by "${ownerRefName}". ` +
|
|
941
|
+
`Record triggers always fire on the owning app or element; move this automation under "${triggerAppRefName}" ` +
|
|
942
|
+
`(set app: to it) or trigger on "${ownerRefName}".`);
|
|
943
|
+
}
|
|
@@ -84,33 +84,33 @@ export declare const calc: {
|
|
|
84
84
|
readonly dividedBy: <const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B) => import("../field/calc/types.js").ComposedExpr<"decimal", [A, B]>;
|
|
85
85
|
readonly gt: {
|
|
86
86
|
<const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
87
|
-
<T extends "
|
|
87
|
+
<T extends "text" | "date" | "datetime" | "handle" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
88
88
|
};
|
|
89
89
|
readonly lt: {
|
|
90
90
|
<const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
91
|
-
<T extends "
|
|
91
|
+
<T extends "text" | "date" | "datetime" | "handle" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
92
92
|
};
|
|
93
93
|
readonly gte: {
|
|
94
94
|
<const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
95
|
-
<T extends "
|
|
95
|
+
<T extends "text" | "date" | "datetime" | "handle" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
96
96
|
};
|
|
97
97
|
readonly lte: {
|
|
98
98
|
<const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
99
|
-
<T extends "
|
|
99
|
+
<T extends "text" | "date" | "datetime" | "handle" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
100
100
|
};
|
|
101
101
|
readonly eq: {
|
|
102
102
|
<const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
103
|
-
<T extends "group" | "bool" | "date" | "datetime" | "handle" | "json" | "
|
|
103
|
+
<T extends "text" | "group" | "bool" | "date" | "datetime" | "handle" | "json" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
104
104
|
};
|
|
105
105
|
readonly ne: {
|
|
106
106
|
<const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
107
|
-
<T extends "group" | "bool" | "date" | "datetime" | "handle" | "json" | "
|
|
107
|
+
<T extends "text" | "group" | "bool" | "date" | "datetime" | "handle" | "json" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
|
|
108
108
|
};
|
|
109
109
|
readonly and: <const A extends import("../field/calc/types.js").BoolLike, const B extends import("../field/calc/types.js").BoolLike, const Rest extends readonly import("../field/calc/types.js").BoolLike[]>(a: A, b: B, ...rest: Rest) => import("../field/calc/types.js").ComposedExpr<"bool", [A, B, ...Rest]>;
|
|
110
110
|
readonly or: <const A extends import("../field/calc/types.js").BoolLike, const B extends import("../field/calc/types.js").BoolLike, const Rest extends readonly import("../field/calc/types.js").BoolLike[]>(a: A, b: B, ...rest: Rest) => import("../field/calc/types.js").ComposedExpr<"bool", [A, B, ...Rest]>;
|
|
111
111
|
readonly if: {
|
|
112
112
|
<const Condition extends import("../field/calc/types.js").BoolLike, const Then extends import("../field/calc/types.js").NumericLike, const Else extends import("../field/calc/types.js").NumericLike>(cond: Condition, thenArm: Then, elseArm: Else): import("../field/calc/types.js").ComposedExpr<import("../field/calc/types.js").NumericPromotion<Then, Else>, [Condition, Then, Else]>;
|
|
113
|
-
<T extends "group" | "bool" | "date" | "datetime" | "handle" | "json" | "
|
|
113
|
+
<T extends "text" | "group" | "bool" | "date" | "datetime" | "handle" | "json" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const Condition extends import("../field/calc/types.js").BoolLike, const Then extends import("../field/calc/types.js").ExprLike<T>, const Else extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(cond: Condition, thenArm: Then, elseArm: Else): import("../field/calc/types.js").ComposedExpr<T, [Condition, Then, Else]>;
|
|
114
114
|
};
|
|
115
115
|
readonly ifs: <T extends ExprType, const Rest extends readonly unknown[]>(condition: import("../field/calc/types.js").BoolLike, value: import("../field/calc/types.js").ExprLike<T>, ...rest: Rest & (Rest extends readonly [] ? readonly [] : Rest extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, .../*elided*/ any] : never] : never] : never] : never] : never] : never] : never] : never] : never] : never] : never)) => import("../field/calc/types.js").ComposedExpr<T, [typeof condition, typeof value, ...Rest]>;
|
|
116
116
|
readonly isBlank: <T extends ExprType, const Value extends import("../field/calc/types.js").ExprLike<T>>(value: Value) => import("../field/calc/types.js").ComposedExpr<"bool", [Value]>;
|
|
@@ -31,13 +31,28 @@
|
|
|
31
31
|
* explicit `unsafePlatformId(...)` escape hatch and retain bridge diagnostics.
|
|
32
32
|
*/
|
|
33
33
|
import type { AutomationAst } from "./ast.js";
|
|
34
|
-
import type { UnresolvedReferenceDiagnostic } from "../../../graph/types.js";
|
|
35
|
-
/**
|
|
36
|
-
|
|
34
|
+
import type { MergePulledSourceContext, UnresolvedReferenceDiagnostic } from "../../../graph/types.js";
|
|
35
|
+
/**
|
|
36
|
+
* Keep the authored publish token across pull; live workflow versions are not
|
|
37
|
+
* author intent (#693). The token must still agree with what state tracks, or a
|
|
38
|
+
* fresh-state pull + adopt plans a republish that downgrades the live revision
|
|
39
|
+
* (#1590): adoption imports the live revision, and the provider's Read keeps
|
|
40
|
+
* whatever revision state holds. So the authored token wins only when it is at
|
|
41
|
+
* least the baseline — the state revision, or the freshly printed live revision
|
|
42
|
+
* when state has no entry yet (adoption is about to import it). An older
|
|
43
|
+
* authored token is replaced by that baseline. Without readable state the
|
|
44
|
+
* pre-#1590 behaviour (always keep authored) is unchanged.
|
|
45
|
+
*/
|
|
46
|
+
export declare function preserveAuthoredAutomationRevision(freshSource: string, existingSource: string, context?: MergePulledSourceContext): string;
|
|
37
47
|
/**
|
|
38
48
|
* Extract a string-literal (or `+`-concatenated literals) description from
|
|
39
49
|
* authored automation source. Pull reprints often omit description entirely
|
|
40
50
|
* because Go export cannot read it back from the platform today.
|
|
51
|
+
*
|
|
52
|
+
* Only the automation's own `description` counts: the top-level key of the
|
|
53
|
+
* `automation({ ... })` options object, in any key order. A notification
|
|
54
|
+
* step's or on-demand input's `description` inside the actions chain is not
|
|
55
|
+
* the automation's.
|
|
41
56
|
*/
|
|
42
57
|
export declare function extractAuthoredAutomationDescription(source: string): string | undefined;
|
|
43
58
|
/**
|
|
@@ -48,11 +63,21 @@ export declare function extractAuthoredAutomationDescription(source: string): st
|
|
|
48
63
|
* drops the attribute. Without this merge, pull → reprint → build clears
|
|
49
64
|
* description from config while state still has it, forcing an adopt update.
|
|
50
65
|
* Prefer a freshly pulled description when present; only reinstate the
|
|
51
|
-
* authored value when the fresh source omitted it.
|
|
66
|
+
* authored value when the fresh source omitted it. Both checks and the
|
|
67
|
+
* insertion point are scoped to the automation's own options object, so a
|
|
68
|
+
* step's `description` neither hides nor supplies the automation's.
|
|
69
|
+
*
|
|
70
|
+
* Fail safe: when the fresh source cannot be scanned to its end (for example
|
|
71
|
+
* a pulled script body the scanner cannot tokenize), the authored description
|
|
72
|
+
* is still restored once the scan has reached the top-level `actions` key.
|
|
73
|
+
* The pull printer emits every other option, description included, before
|
|
74
|
+
* `actions`, so at that point the fresh source provably has no description of
|
|
75
|
+
* its own and the insertion point was read exactly. A scan that stops before
|
|
76
|
+
* `actions` leaves the fresh source unchanged.
|
|
52
77
|
*/
|
|
53
78
|
export declare function preserveAuthoredAutomationDescription(freshSource: string, existingSource: string): string;
|
|
54
79
|
/** Pull merge: preserve authored revision + description across live reprint. */
|
|
55
|
-
export declare function preserveAuthoredAutomationPullMeta(freshSource: string, existingSource: string): string;
|
|
80
|
+
export declare function preserveAuthoredAutomationPullMeta(freshSource: string, existingSource: string, context?: MergePulledSourceContext): string;
|
|
56
81
|
/** A plain-JS script file printed beside the automation, relative to the automations folder. */
|
|
57
82
|
export interface PrintedScriptFile {
|
|
58
83
|
readonly path: string;
|
|
@@ -60,6 +85,14 @@ export interface PrintedScriptFile {
|
|
|
60
85
|
}
|
|
61
86
|
/** Folder (inside the automations folder) that holds printed script files. */
|
|
62
87
|
export declare const SCRIPT_FILES_DIR = "scripts";
|
|
88
|
+
/**
|
|
89
|
+
* Key of the placeholder printed for a forEach item reference to a sibling
|
|
90
|
+
* loop (no authored form, #1320). Build fails on it; re-pull archives a file
|
|
91
|
+
* that still carries it.
|
|
92
|
+
*/
|
|
93
|
+
export declare const UNRESOLVED_FOR_EACH_ITEM_KEY = "__edkUnresolvedForEachItem";
|
|
94
|
+
/** True when automation source still carries the unbuildable sibling-loop placeholder. */
|
|
95
|
+
export declare function hasUnresolvedForEachItem(source: string): boolean;
|
|
63
96
|
export interface PrintAutomationV2Options {
|
|
64
97
|
readonly refName?: string;
|
|
65
98
|
/**
|
|
@@ -76,6 +109,9 @@ export interface PrintAutomationV2Options {
|
|
|
76
109
|
*/
|
|
77
110
|
readonly foreignAppRefNames?: ReadonlyMap<string, string>;
|
|
78
111
|
readonly foreignElementRefNames?: ReadonlyMap<string, string>;
|
|
112
|
+
/** Namespace → refName, for owners ei exports with only a `namespace`. */
|
|
113
|
+
readonly foreignAppRefNamespaces?: ReadonlyMap<string, string>;
|
|
114
|
+
readonly foreignElementRefNamespaces?: ReadonlyMap<string, string>;
|
|
79
115
|
readonly foreignTaskRefNames?: ReadonlyMap<string, string>;
|
|
80
116
|
/** Diagnostics emitted by the bridge for raw UUIDs retained in this pull. */
|
|
81
117
|
readonly unresolvedReferences?: readonly UnresolvedReferenceDiagnostic[];
|