@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
|
@@ -20,6 +20,20 @@ export type NormalizedVisualFlowAction = {
|
|
|
20
20
|
readonly kind: "object";
|
|
21
21
|
readonly object: NormalizedFlowObject;
|
|
22
22
|
readonly name?: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: "datamine";
|
|
25
|
+
readonly refName: string;
|
|
26
|
+
readonly parent: string;
|
|
27
|
+
readonly parentName?: string;
|
|
28
|
+
readonly name?: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: "table";
|
|
31
|
+
readonly refName: string;
|
|
32
|
+
readonly name?: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: "relationship";
|
|
35
|
+
readonly refName: string;
|
|
36
|
+
readonly name?: string;
|
|
23
37
|
};
|
|
24
38
|
export interface NormalizedVisualFlowNode {
|
|
25
39
|
readonly description?: string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
|
-
import { plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
|
+
import { dataRefLabel, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
3
3
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
4
|
import { dataAspectDisplayName, dataAspectRefName } from "../shared/aspect-target-from-tf.js";
|
|
5
|
+
import { DATAMINE_RESOURCE_TYPE } from "../datamine/module.js";
|
|
6
|
+
import { RELATIONSHIP_RESOURCE_TYPE } from "../relationship/module.js";
|
|
7
|
+
import { TABLE_RESOURCE_TYPE } from "../table/module.js";
|
|
5
8
|
import { VISUAL_FLOW_RESOURCE_TYPE } from "./module.js";
|
|
6
9
|
const KNOWN = new Set(["id", "object_id", "stages"]);
|
|
7
10
|
const symbols = new Set(["SQUARE", "DIAMOND", "CIRCLE"]);
|
|
@@ -37,7 +40,7 @@ function objectRef(value, ctx, where) {
|
|
|
37
40
|
}
|
|
38
41
|
function actionFromTf(value, ownerLabel, scope, ctx, where) {
|
|
39
42
|
const action = requiredObject(value, where);
|
|
40
|
-
const variants = ["agent", "automation", "user", "api", "object"].filter((key) => action[key] !== undefined);
|
|
43
|
+
const variants = ["agent", "automation", "user", "api", "object", "datamine", "table", "relationship"].filter((key) => action[key] !== undefined);
|
|
41
44
|
if (variants.length !== 1)
|
|
42
45
|
throw new EntityTfError(`${where}: expected exactly one action variant`);
|
|
43
46
|
const kind = variants[0];
|
|
@@ -52,7 +55,52 @@ function actionFromTf(value, ownerLabel, scope, ctx, where) {
|
|
|
52
55
|
throw new EntityTfError(`${where}.${kind}: name is required`);
|
|
53
56
|
return { kind, name };
|
|
54
57
|
}
|
|
55
|
-
|
|
58
|
+
if (kind === "object")
|
|
59
|
+
return { kind: "object", object: objectRef(body["object_id"], ctx, `${where}.object`), ...(name !== undefined ? { name } : {}) };
|
|
60
|
+
if (kind === "datamine")
|
|
61
|
+
return { kind: "datamine", ...datamineFromTf(body["datamine_id"], ctx, `${where}.datamine`), ...(name !== undefined ? { name } : {}) };
|
|
62
|
+
if (kind === "table")
|
|
63
|
+
return { kind: "table", refName: tableFromTf(body["table_id"], ctx, `${where}.table`), ...(name !== undefined ? { name } : {}) };
|
|
64
|
+
return { kind: "relationship", refName: ownedRef(body["relationship_id"], RELATIONSHIP_RESOURCE_TYPE, ownerLabel, scope, where), ...(name !== undefined ? { name } : {}) };
|
|
65
|
+
}
|
|
66
|
+
function tableFromTf(value, ctx, where) {
|
|
67
|
+
if (value === undefined || !isTfExpr(value) || (value.$expr !== "resource-attr" && value.$expr !== "data-attr") || value.type !== TABLE_RESOURCE_TYPE || value.path.length !== 1 || value.path[0] !== "id") {
|
|
68
|
+
throw new EntityTfError(`${where}: expected a typed elementum_table reference`);
|
|
69
|
+
}
|
|
70
|
+
if (value.$expr === "data-attr") {
|
|
71
|
+
const display = ctx.dataName(TABLE_RESOURCE_TYPE, value.label);
|
|
72
|
+
return display !== undefined ? ( /* prefer stable tf label */tfLabelToTsLabel(value.label)) : tfLabelToTsLabel(value.label);
|
|
73
|
+
}
|
|
74
|
+
return tfLabelToTsLabel(value.label);
|
|
75
|
+
}
|
|
76
|
+
function datamineFromTf(value, ctx, where) {
|
|
77
|
+
if (value === undefined || !isTfExpr(value) || (value.$expr !== "resource-attr" && value.$expr !== "data-attr") || value.type !== DATAMINE_RESOURCE_TYPE || value.path.length !== 1 || value.path[0] !== "id") {
|
|
78
|
+
throw new EntityTfError(`${where}: expected a typed elementum_datamine reference`);
|
|
79
|
+
}
|
|
80
|
+
const label = value.label;
|
|
81
|
+
let tableLabel;
|
|
82
|
+
let parentName;
|
|
83
|
+
if (value.$expr === "resource-attr") {
|
|
84
|
+
const block = ctx.resourceByAddress?.(`${DATAMINE_RESOURCE_TYPE}.${label}`);
|
|
85
|
+
tableLabel = block !== undefined ? resourceRefLabel(block.attrs["table_id"], TABLE_RESOURCE_TYPE) : undefined;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const attrs = ctx.dataAttrs?.(DATAMINE_RESOURCE_TYPE, label);
|
|
89
|
+
const tableId = attrs?.["table_id"];
|
|
90
|
+
tableLabel = tableId !== undefined ? (resourceRefLabel(tableId, TABLE_RESOURCE_TYPE) ?? dataRefLabel(tableId, TABLE_RESOURCE_TYPE)) : undefined;
|
|
91
|
+
if (tableLabel !== undefined)
|
|
92
|
+
parentName = ctx.dataName(TABLE_RESOURCE_TYPE, tableLabel);
|
|
93
|
+
}
|
|
94
|
+
if (tableLabel !== undefined) {
|
|
95
|
+
const prefix = `${tableLabel}_`;
|
|
96
|
+
const refName = label.startsWith(prefix) ? tfLabelToTsLabel(label.slice(prefix.length)) : tfLabelToTsLabel(label);
|
|
97
|
+
return { refName, parent: tfLabelToTsLabel(tableLabel), ...(parentName !== undefined ? { parentName } : {}) };
|
|
98
|
+
}
|
|
99
|
+
const underscore = label.indexOf("_");
|
|
100
|
+
if (underscore > 0) {
|
|
101
|
+
return { refName: tfLabelToTsLabel(label.slice(underscore + 1)), parent: tfLabelToTsLabel(label.slice(0, underscore)) };
|
|
102
|
+
}
|
|
103
|
+
throw new EntityTfError(`${where}: datamine reference is missing its owning table`);
|
|
56
104
|
}
|
|
57
105
|
function nodeFromTf(value, ownerLabel, scope, ctx, where) {
|
|
58
106
|
const node = requiredObject(value, where);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { visualFlow, flowAgentAction, flowApiAction, flowAutomationAction, flowObjectAction, flowObjectTarget, flowUserAction, visualFlowPosition, visualFlowSymbol, type DefineVisualFlowOptions, type VisualFlowAction, type VisualFlowConnection, type VisualFlowNode, type VisualFlowPosition, type VisualFlowStage, type VisualFlowSymbol, type VisualFlowTarget, } from "./build.js";
|
|
1
|
+
export { visualFlow, flowAgentAction, flowApiAction, flowAutomationAction, flowObjectAction, flowRelationshipAction, flowTableAction, flowDatamineAction, flowObjectTarget, flowUserAction, visualFlowPosition, visualFlowSymbol, type DefineVisualFlowOptions, type VisualFlowAction, type VisualFlowConnection, type VisualFlowNode, type VisualFlowPosition, type VisualFlowStage, type VisualFlowSymbol, type VisualFlowTarget, } from "./build.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { visualFlow, flowAgentAction, flowApiAction, flowAutomationAction, flowObjectAction, flowObjectTarget, flowUserAction, visualFlowPosition, visualFlowSymbol, } from "./build.js";
|
|
1
|
+
export { visualFlow, flowAgentAction, flowApiAction, flowAutomationAction, flowObjectAction, flowRelationshipAction, flowTableAction, flowDatamineAction, flowObjectTarget, flowUserAction, visualFlowPosition, visualFlowSymbol, } from "./build.js";
|
|
@@ -18,6 +18,19 @@ function actionExpr(action, owner, refs) {
|
|
|
18
18
|
case "user": return `flowUserAction(${quote(action.name)})`;
|
|
19
19
|
case "api": return `flowApiAction(${quote(action.name)})`;
|
|
20
20
|
case "object": return `flowObjectAction(${objectExpr(action.object, refs)}${action.name !== undefined ? `, ${quote(action.name)}` : ""})`;
|
|
21
|
+
case "datamine": {
|
|
22
|
+
const parentName = action.parentName !== undefined ? `, parentName: ${quote(action.parentName)}` : "";
|
|
23
|
+
const nameArg = action.name !== undefined ? `, ${quote(action.name)}` : "";
|
|
24
|
+
return `flowDatamineAction({ __kind: "datamine", refName: ${quote(action.refName)}, name: ${quote(action.name ?? action.refName)}, parent: ${quote(action.parent)}${parentName} }${nameArg})`;
|
|
25
|
+
}
|
|
26
|
+
case "table": {
|
|
27
|
+
const nameArg = action.name !== undefined ? `, ${quote(action.name)}` : "";
|
|
28
|
+
return `flowTableAction({ __kind: "table", refName: ${quote(action.refName)}, name: ${quote(action.name ?? action.refName)} }${nameArg})`;
|
|
29
|
+
}
|
|
30
|
+
case "relationship": {
|
|
31
|
+
const nameArg = action.name !== undefined ? `, ${quote(action.name)}` : "";
|
|
32
|
+
return `flowRelationshipAction({ __kind: "relationship", refName: ${quote(action.refName)}, name: ${quote(action.name ?? action.refName)}, parent: ${quote(owner)} }${nameArg})`;
|
|
33
|
+
}
|
|
21
34
|
}
|
|
22
35
|
}
|
|
23
36
|
function nodeLines(node, owner, refs) {
|
|
@@ -56,6 +69,9 @@ export function printVisualFlow(flow, owner, scope, refs = {}) {
|
|
|
56
69
|
user: "flowUserAction",
|
|
57
70
|
api: "flowApiAction",
|
|
58
71
|
object: "flowObjectAction",
|
|
72
|
+
datamine: "flowDatamineAction",
|
|
73
|
+
table: "flowTableAction",
|
|
74
|
+
relationship: "flowRelationshipAction",
|
|
59
75
|
}[node.action.kind]);
|
|
60
76
|
}
|
|
61
77
|
}
|
|
@@ -65,8 +81,11 @@ export function printVisualFlow(flow, owner, scope, refs = {}) {
|
|
|
65
81
|
"flowAgentAction",
|
|
66
82
|
"flowApiAction",
|
|
67
83
|
"flowAutomationAction",
|
|
84
|
+
"flowDatamineAction",
|
|
68
85
|
"flowObjectAction",
|
|
69
86
|
"flowObjectTarget",
|
|
87
|
+
"flowRelationshipAction",
|
|
88
|
+
"flowTableAction",
|
|
70
89
|
"flowUserAction",
|
|
71
90
|
"visualFlowPosition",
|
|
72
91
|
"visualFlowSymbol",
|
|
@@ -4,6 +4,9 @@ import { EntityTfError } from "../../engine/entity.js";
|
|
|
4
4
|
import { appScopedResourceLabel, expr, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
5
5
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
6
6
|
import { ELEMENT_RESOURCE_TYPE } from "../element/module.js";
|
|
7
|
+
import { DATAMINE_RESOURCE_TYPE } from "../datamine/module.js";
|
|
8
|
+
import { RELATIONSHIP_RESOURCE_TYPE } from "../relationship/module.js";
|
|
9
|
+
import { TABLE_RESOURCE_TYPE } from "../table/module.js";
|
|
7
10
|
import { VISUAL_FLOW_RESOURCE_TYPE } from "./module.js";
|
|
8
11
|
function ownedResourceRef(ref, expected, ctx) {
|
|
9
12
|
if (ref.__kind !== expected || !ref.refName || ref.parent !== ctx.appRefName) {
|
|
@@ -27,7 +30,7 @@ function objectRef(ref, ctx) {
|
|
|
27
30
|
const name = ref.name ?? ref.refName;
|
|
28
31
|
return resolveForeignRef(kind, { name, namespace: ref.namespace }, ctx.orgRefs, ctx.diagnostics, "visual flow object").value;
|
|
29
32
|
}
|
|
30
|
-
function actionToTf(action, ctx) {
|
|
33
|
+
function actionToTf(action, ctx, dataBlocks) {
|
|
31
34
|
switch (action.kind) {
|
|
32
35
|
case "agent": {
|
|
33
36
|
const ref = action.agent;
|
|
@@ -55,10 +58,90 @@ function actionToTf(action, ctx) {
|
|
|
55
58
|
throw new EntityTfError("visual flow object action is missing its object reference");
|
|
56
59
|
return { object: { object_id: objectRef(ref, ctx), ...(action.name !== undefined && action.name !== "" ? { name: action.name } : {}) } };
|
|
57
60
|
}
|
|
61
|
+
case "datamine": {
|
|
62
|
+
const ref = action.datamine;
|
|
63
|
+
if (ref === undefined)
|
|
64
|
+
throw new EntityTfError("visual flow datamine action is missing its datamine reference");
|
|
65
|
+
return { datamine: { datamine_id: datamineRefToTf(ref, ctx, dataBlocks), ...(action.name !== undefined && action.name !== "" ? { name: action.name } : {}) } };
|
|
66
|
+
}
|
|
67
|
+
case "table": {
|
|
68
|
+
const ref = action.table;
|
|
69
|
+
if (ref === undefined)
|
|
70
|
+
throw new EntityTfError("visual flow table action is missing its table reference");
|
|
71
|
+
return { table: { table_id: tableRefToTf(ref, ctx, dataBlocks), ...(action.name !== undefined && action.name !== "" ? { name: action.name } : {}) } };
|
|
72
|
+
}
|
|
73
|
+
case "relationship": {
|
|
74
|
+
const ref = action.relationship;
|
|
75
|
+
if (ref === undefined)
|
|
76
|
+
throw new EntityTfError("visual flow relationship action is missing its relationship reference");
|
|
77
|
+
if (ref.__kind !== "relationship" || !ref.refName || ref.parent !== ctx.appRefName) {
|
|
78
|
+
throw new EntityTfError(`visual flow relationship must be a typed reference owned by ${ctx.appRefName}`);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
relationship: {
|
|
82
|
+
relationship_id: expr.resourceAttr(RELATIONSHIP_RESOURCE_TYPE, appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(ref.refName)), ["id"]),
|
|
83
|
+
...(action.name !== undefined && action.name !== "" ? { name: action.name } : {}),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
58
87
|
default:
|
|
59
88
|
throw new EntityTfError("visual flow action must come from a public action factory");
|
|
60
89
|
}
|
|
61
90
|
}
|
|
91
|
+
function tableRefToTf(ref, ctx, dataBlocks) {
|
|
92
|
+
if (ref.__kind !== "table" || !ref.refName) {
|
|
93
|
+
throw new EntityTfError("visual flow table must be a typed table reference");
|
|
94
|
+
}
|
|
95
|
+
const local = ctx.workspaceAspects?.get(workspaceAspectKey("table", ref.refName));
|
|
96
|
+
if (local !== undefined)
|
|
97
|
+
return expr.resourceAttr(TABLE_RESOURCE_TYPE, local.tfLabel, ["id"]);
|
|
98
|
+
const name = ref.name ?? ref.refName;
|
|
99
|
+
const label = tsLabelToTfLabel(ref.refName);
|
|
100
|
+
ctx.orgRefs.rawLookup(TABLE_RESOURCE_TYPE, label, name);
|
|
101
|
+
dataBlocks.set(`${TABLE_RESOURCE_TYPE}.${label}`, {
|
|
102
|
+
kind: "data",
|
|
103
|
+
type: TABLE_RESOURCE_TYPE,
|
|
104
|
+
label,
|
|
105
|
+
attrs: { name },
|
|
106
|
+
});
|
|
107
|
+
return expr.dataAttr(TABLE_RESOURCE_TYPE, label, ["id"]);
|
|
108
|
+
}
|
|
109
|
+
function datamineRefToTf(ref, ctx, dataBlocks) {
|
|
110
|
+
if (ref.__kind !== "datamine" || !ref.refName) {
|
|
111
|
+
throw new EntityTfError("visual flow datamine must be a typed datamine reference");
|
|
112
|
+
}
|
|
113
|
+
if (ref.parent === undefined || ref.parent === "") {
|
|
114
|
+
throw new EntityTfError(`visual flow datamine ${JSON.stringify(ref.refName)} is missing its owning table`);
|
|
115
|
+
}
|
|
116
|
+
const label = `${tsLabelToTfLabel(ref.parent)}_${tsLabelToTfLabel(ref.refName)}`;
|
|
117
|
+
const tableSibling = ctx.workspaceAspects?.get(workspaceAspectKey("table", ref.parent));
|
|
118
|
+
if (tableSibling !== undefined && tableSibling.managedDatamineLabels?.has(label) === true) {
|
|
119
|
+
return expr.resourceAttr(DATAMINE_RESOURCE_TYPE, label, ["id"]);
|
|
120
|
+
}
|
|
121
|
+
let tableId;
|
|
122
|
+
if (tableSibling !== undefined) {
|
|
123
|
+
tableId = expr.resourceAttr(TABLE_RESOURCE_TYPE, tableSibling.tfLabel, ["id"]);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
const tableLabel = tsLabelToTfLabel(ref.parent);
|
|
127
|
+
const tableName = typeof ref.parentName === "string" && ref.parentName !== "" ? ref.parentName : ref.parent;
|
|
128
|
+
ctx.orgRefs.rawLookup(TABLE_RESOURCE_TYPE, tableLabel, tableName);
|
|
129
|
+
dataBlocks.set(`${TABLE_RESOURCE_TYPE}.${tableLabel}`, {
|
|
130
|
+
kind: "data",
|
|
131
|
+
type: TABLE_RESOURCE_TYPE,
|
|
132
|
+
label: tableLabel,
|
|
133
|
+
attrs: { name: tableName },
|
|
134
|
+
});
|
|
135
|
+
tableId = expr.dataAttr(TABLE_RESOURCE_TYPE, tableLabel, ["id"]);
|
|
136
|
+
}
|
|
137
|
+
dataBlocks.set(`${DATAMINE_RESOURCE_TYPE}.${label}`, {
|
|
138
|
+
kind: "data",
|
|
139
|
+
type: DATAMINE_RESOURCE_TYPE,
|
|
140
|
+
label,
|
|
141
|
+
attrs: { table_id: tableId, name: ref.name ?? ref.refName },
|
|
142
|
+
});
|
|
143
|
+
return expr.dataAttr(DATAMINE_RESOURCE_TYPE, label, ["id"]);
|
|
144
|
+
}
|
|
62
145
|
export function visualFlowToTf(entity, ctx) {
|
|
63
146
|
if (entity.kind !== "visual-flow")
|
|
64
147
|
throw new EntityTfError(`visualFlowToTf expects visual-flow; got ${entity.kind}`);
|
|
@@ -73,6 +156,7 @@ export function visualFlowToTf(entity, ctx) {
|
|
|
73
156
|
throw new EntityTfError(`visual flow ${entity.refName} has no payload`);
|
|
74
157
|
const ownerType = APP_RESOURCE_TYPE;
|
|
75
158
|
const label = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName));
|
|
159
|
+
const dataBlocks = new Map();
|
|
76
160
|
const stages = (payload.stages ?? []).map((stage) => {
|
|
77
161
|
if (!stage.stage)
|
|
78
162
|
throw new EntityTfError(`visual flow ${entity.refName}: every stage requires a stable key`);
|
|
@@ -87,11 +171,11 @@ export function visualFlowToTf(entity, ctx) {
|
|
|
87
171
|
x: node.x ?? 0,
|
|
88
172
|
y: node.y ?? 0,
|
|
89
173
|
connects_to: (node.connectsTo ?? []).map((connection) => typeof connection === "string" ? { target: connection } : { target: connection.target ?? "", ...(connection.label !== undefined && { label: connection.label }) }),
|
|
90
|
-
...(node.action !== undefined && { action: actionToTf(node.action, ctx) }),
|
|
174
|
+
...(node.action !== undefined && { action: actionToTf(node.action, ctx, dataBlocks) }),
|
|
91
175
|
...(node.target?.object !== undefined && { target: { object: { object_id: objectRef(node.target.object, ctx), name: node.target.name ?? node.target.object.name ?? node.target.object.refName ?? "Object" } } }),
|
|
92
176
|
})),
|
|
93
177
|
};
|
|
94
178
|
});
|
|
95
179
|
const block = { kind: "resource", type: VISUAL_FLOW_RESOURCE_TYPE, label, attrs: { object_id: expr.resourceAttr(ownerType, ctx.appTfLabel, ["id"]), stages } };
|
|
96
|
-
return { blocks: [block], address: `${VISUAL_FLOW_RESOURCE_TYPE}.${label}` };
|
|
180
|
+
return { blocks: [...dataBlocks.values(), block], address: `${VISUAL_FLOW_RESOURCE_TYPE}.${label}` };
|
|
97
181
|
}
|
|
@@ -65,6 +65,18 @@ export interface CreateRecordWidget extends WidgetButtonStyle {
|
|
|
65
65
|
readonly name: string;
|
|
66
66
|
readonly target: AppOrElementRef;
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Values the platform resolves when the button is pressed:
|
|
70
|
+
* - `currentRecord` binds an `ASPECT_RECORD` (`type: "record"`) parameter to
|
|
71
|
+
* the record the button is on.
|
|
72
|
+
* - `triggeredByUser` binds a `USER_ID` (`type: "userId"`) parameter to the
|
|
73
|
+
* user who pressed the button.
|
|
74
|
+
*/
|
|
75
|
+
export declare const runAutomationParameterValue: {
|
|
76
|
+
readonly currentRecord: "CURRENT_RECORD";
|
|
77
|
+
readonly triggeredByUser: "TRIGGERED_BY_USER";
|
|
78
|
+
};
|
|
79
|
+
export type RunAutomationParameterValue = (typeof runAutomationParameterValue)[keyof typeof runAutomationParameterValue];
|
|
68
80
|
interface RunAutomationWidgetParameterBase {
|
|
69
81
|
readonly name: string;
|
|
70
82
|
readonly fieldType: WorkflowFieldType;
|
|
@@ -76,7 +88,10 @@ export type RunAutomationWidgetParameter = RunAutomationWidgetParameterBase & ({
|
|
|
76
88
|
readonly field: FieldRef;
|
|
77
89
|
readonly value?: never;
|
|
78
90
|
} | {
|
|
79
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Static value; supports the provider's `{{field-id}}` interpolation syntax,
|
|
93
|
+
* or a {@link runAutomationParameterValue} resolved at click time.
|
|
94
|
+
*/
|
|
80
95
|
readonly field?: never;
|
|
81
96
|
readonly value: string;
|
|
82
97
|
});
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Values the platform resolves when the button is pressed:
|
|
3
|
+
* - `currentRecord` binds an `ASPECT_RECORD` (`type: "record"`) parameter to
|
|
4
|
+
* the record the button is on.
|
|
5
|
+
* - `triggeredByUser` binds a `USER_ID` (`type: "userId"`) parameter to the
|
|
6
|
+
* user who pressed the button.
|
|
7
|
+
*/
|
|
8
|
+
export const runAutomationParameterValue = {
|
|
9
|
+
currentRecord: "CURRENT_RECORD",
|
|
10
|
+
triggeredByUser: "TRIGGERED_BY_USER",
|
|
11
|
+
};
|
|
@@ -119,8 +119,8 @@ function widgetFromTf(block, owner, ctx, dynamicLayoutCompanionLabels) {
|
|
|
119
119
|
...(typeof rec["value"] === "string" && { value: rec["value"] }),
|
|
120
120
|
}];
|
|
121
121
|
})
|
|
122
|
-
:
|
|
123
|
-
if (parametersRaw !== undefined && !Array.isArray(parametersRaw)) {
|
|
122
|
+
: [];
|
|
123
|
+
if (parametersRaw !== undefined && parametersRaw !== null && !Array.isArray(parametersRaw)) {
|
|
124
124
|
ctx.diagnostics.push(`${where}.run_automation_action.parameters: expected a list; dropped`);
|
|
125
125
|
}
|
|
126
126
|
return {
|
|
@@ -129,7 +129,7 @@ function widgetFromTf(block, owner, ctx, dynamicLayoutCompanionLabels) {
|
|
|
129
129
|
name,
|
|
130
130
|
automation,
|
|
131
131
|
...buttonStyle(body, where, ctx),
|
|
132
|
-
|
|
132
|
+
parameters,
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
function buttonStyle(attrs, where, ctx) {
|
|
@@ -45,6 +45,8 @@ export declare function relationshipTargetsFromBag(relationships: Readonly<Recor
|
|
|
45
45
|
export interface WidgetsToTfOptions {
|
|
46
46
|
readonly ownerRefName: string;
|
|
47
47
|
readonly ownerTfLabel: string;
|
|
48
|
+
/** Element handle, used to prefix element automation resource labels. */
|
|
49
|
+
readonly ownerHandle?: string;
|
|
48
50
|
readonly ownerType: "elementum_app" | "elementum_element";
|
|
49
51
|
readonly scope: ChildResourceScope;
|
|
50
52
|
readonly objectId: TfValue;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
2
2
|
import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
|
|
3
|
-
import {
|
|
4
|
-
import { AUTOMATION_RESOURCE_TYPE } from "../automation/types.js";
|
|
3
|
+
import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tfLabelToTsLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
4
|
+
import { AUTOMATION_RESOURCE_TYPE, automationResourceLabel } from "../automation/types.js";
|
|
5
5
|
import { fieldMetadataFromEntries } from "../field/metadata.js";
|
|
6
|
-
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
6
|
+
import { authoredFieldKeysFromPayload, fieldRefToTfValue, } from "../field/to-tf.js";
|
|
7
|
+
import { runAutomationParameterValue } from "./build.js";
|
|
7
8
|
import { WIDGET_RESOURCE_TYPE } from "./module.js";
|
|
8
9
|
import { filterToTf } from "../access-policy/to-tf.js";
|
|
9
10
|
export function relationshipTargetsFromBag(relationships) {
|
|
@@ -57,6 +58,7 @@ export function widgetsToTf(widgets, opts) {
|
|
|
57
58
|
objectId: opts.objectId,
|
|
58
59
|
diagnostics: opts.diagnostics,
|
|
59
60
|
orgRefs: opts.orgRefs,
|
|
61
|
+
fieldAddresses: opts.fieldAddresses,
|
|
60
62
|
});
|
|
61
63
|
attrs["related_link_action"] = body;
|
|
62
64
|
break;
|
|
@@ -132,7 +134,15 @@ function resolveAspect(value, where, opts) {
|
|
|
132
134
|
const kind = value?.__kind === "element" ? "element" : "app";
|
|
133
135
|
const refName = value?.refName ?? "";
|
|
134
136
|
if (kind === opts.scope && refName === opts.ownerRefName) {
|
|
135
|
-
return {
|
|
137
|
+
return {
|
|
138
|
+
value: opts.objectId,
|
|
139
|
+
kind,
|
|
140
|
+
refName,
|
|
141
|
+
tfLabel: opts.ownerTfLabel,
|
|
142
|
+
name: value?.name ?? refName,
|
|
143
|
+
managed: true,
|
|
144
|
+
fieldOwnership: opts.fieldAddresses,
|
|
145
|
+
};
|
|
136
146
|
}
|
|
137
147
|
const sibling = opts.workspaceAspects?.get(workspaceAspectKey(kind, refName));
|
|
138
148
|
if (sibling !== undefined) {
|
|
@@ -140,7 +150,15 @@ function resolveAspect(value, where, opts) {
|
|
|
140
150
|
const payloadName = typeof sibling.streamRootEntity?.payload === "object" && sibling.streamRootEntity.payload !== null
|
|
141
151
|
? sibling.streamRootEntity.payload.name
|
|
142
152
|
: undefined;
|
|
143
|
-
return {
|
|
153
|
+
return {
|
|
154
|
+
value: expr.resourceAttr(type, sibling.tfLabel, ["id"]),
|
|
155
|
+
kind,
|
|
156
|
+
refName,
|
|
157
|
+
tfLabel: sibling.tfLabel,
|
|
158
|
+
name: value?.name ?? payloadName,
|
|
159
|
+
managed: true,
|
|
160
|
+
fieldOwnership: authoredFieldKeysFromPayload(sibling.streamRootEntity?.payload),
|
|
161
|
+
};
|
|
144
162
|
}
|
|
145
163
|
const name = value?.name ?? refName;
|
|
146
164
|
if (name === "") {
|
|
@@ -166,7 +184,7 @@ function resolveAspect(value, where, opts) {
|
|
|
166
184
|
function resolveManagedSystemColumn(key, target) {
|
|
167
185
|
if (!target.managed || target.tfLabel === undefined || target.kind === undefined)
|
|
168
186
|
return undefined;
|
|
169
|
-
return fieldRefToTfValue("HANDLE", key, target.tfLabel, target.kind);
|
|
187
|
+
return fieldRefToTfValue("HANDLE", key, target.tfLabel, target.kind, target.fieldOwnership);
|
|
170
188
|
}
|
|
171
189
|
function resolveColumns(columns, target, where, opts) {
|
|
172
190
|
const out = [];
|
|
@@ -217,7 +235,7 @@ function resolveColumns(columns, target, where, opts) {
|
|
|
217
235
|
}
|
|
218
236
|
if (target.managed && target.kind !== undefined && target.tfLabel !== undefined) {
|
|
219
237
|
const column = resolveManagedColumn(value, refName, target, opts);
|
|
220
|
-
const direct = fieldRefToTfValue(column.fieldType, column.refName, target.tfLabel, target.kind);
|
|
238
|
+
const direct = fieldRefToTfValue(column.fieldType, column.refName, target.tfLabel, target.kind, target.fieldOwnership);
|
|
221
239
|
if (direct !== undefined) {
|
|
222
240
|
out.push(direct);
|
|
223
241
|
continue;
|
|
@@ -239,15 +257,27 @@ function runAutomationParameters(widget, where, opts) {
|
|
|
239
257
|
if (fieldId !== undefined && parameter.value !== undefined) {
|
|
240
258
|
opts.diagnostics.push(`${where}.parameters[${index}]: field and value are mutually exclusive; value dropped`);
|
|
241
259
|
}
|
|
260
|
+
const fieldType = parameter.fieldType ?? "TEXT";
|
|
261
|
+
let value = fieldId === undefined ? parameter.value ?? null : null;
|
|
262
|
+
if (value === runAutomationParameterValue.triggeredByUser && fieldType !== "USER_ID") {
|
|
263
|
+
opts.diagnostics.push(`${where}.parameters[${index}]: TRIGGERED_BY_USER binds a USER_ID parameter; ` +
|
|
264
|
+
`${JSON.stringify(parameter.name ?? "")} is ${fieldType}. Declare the on-demand input as type "userId" ` +
|
|
265
|
+
`and set fieldType "USER_ID"; value dropped`);
|
|
266
|
+
value = null;
|
|
267
|
+
}
|
|
242
268
|
return {
|
|
243
269
|
name: parameter.name ?? "",
|
|
244
|
-
field_type:
|
|
270
|
+
field_type: fieldType,
|
|
245
271
|
multiple: parameter.multiple ?? false,
|
|
246
272
|
required: parameter.required ?? false,
|
|
247
273
|
field_id: fieldId ?? null,
|
|
248
|
-
value
|
|
274
|
+
value,
|
|
249
275
|
};
|
|
250
276
|
});
|
|
277
|
+
// An authored list, including an empty one, is the live parameter set.
|
|
278
|
+
// CURRENT_RECORD is injected only when the author omitted parameters.
|
|
279
|
+
if (widget.parameters !== undefined)
|
|
280
|
+
return authored;
|
|
251
281
|
const recordParam = onDemandRecordParamForWidget(widget.automation, opts);
|
|
252
282
|
if (recordParam === undefined || authored.some((parameter) => parameter.name === recordParam)) {
|
|
253
283
|
return authored;
|
|
@@ -260,7 +290,7 @@ function runAutomationParameters(widget, where, opts) {
|
|
|
260
290
|
multiple: false,
|
|
261
291
|
required: false,
|
|
262
292
|
field_id: null,
|
|
263
|
-
value:
|
|
293
|
+
value: runAutomationParameterValue.currentRecord,
|
|
264
294
|
},
|
|
265
295
|
];
|
|
266
296
|
}
|
|
@@ -285,10 +315,7 @@ function resolveAutomation(value, where, opts) {
|
|
|
285
315
|
opts.diagnostics.push(`${where}: foreign automation references require a provider data lookup with app_id; use a raw id until that data-source tranche lands`);
|
|
286
316
|
return undefined;
|
|
287
317
|
}
|
|
288
|
-
|
|
289
|
-
// when the owner is an element. `scopedResourceLabel(..., opts.scope)` would
|
|
290
|
-
// mint `elements_…` here and plan an undeclared resource.
|
|
291
|
-
return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, appScopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(refName)), ["id"]);
|
|
318
|
+
return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, automationResourceLabel(opts.ownerTfLabel, refName, opts.scope, opts.scope === "element" ? opts.ownerHandle : undefined), ["id"]);
|
|
292
319
|
}
|
|
293
320
|
function resolveManagedColumn(value, refName, target, opts) {
|
|
294
321
|
const meta = siblingFieldMetadata(target, opts);
|