@elementumai/edk 0.9.20 → 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 +19 -7
- package/dist-sdk/src/catalog/factories.d.ts +10 -2
- package/dist-sdk/src/catalog/factories.js +10 -1
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/token.js +4 -0
- package/dist-sdk/src/catalog/types.d.ts +7 -1
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -2
- package/dist-sdk/src/core/triggers/on-demand.js +7 -0
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- 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 +21 -1
- package/dist-sdk/src/engine/ei/run.js +89 -2
- 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/result-output.js +27 -1
- package/dist-sdk/src/engine/tf/index.d.ts +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -5
- package/dist-sdk/src/engine/tf/labels.js +45 -3
- package/dist-sdk/src/engine/tf/parse.js +3 -2
- package/dist-sdk/src/engine/validation.d.ts +5 -0
- package/dist-sdk/src/engine/validation.js +12 -2
- 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/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +42 -19
- 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 +14 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +11 -5
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- 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 +17 -3
- package/dist-sdk/src/entities/app/build.js +56 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
- package/dist-sdk/src/entities/app/from-tf.js +4 -0
- package/dist-sdk/src/entities/app/index.d.ts +2 -1
- package/dist-sdk/src/entities/app/index.js +1 -8
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +21 -2
- package/dist-sdk/src/entities/automation/build.d.ts +10 -2
- package/dist-sdk/src/entities/automation/build.js +104 -17
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +17 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +156 -19
- package/dist-sdk/src/entities/automation/from-tf.d.ts +9 -2
- package/dist-sdk/src/entities/automation/from-tf.js +366 -86
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- 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 +70 -7
- package/dist-sdk/src/entities/automation/script-code.d.ts +5 -2
- package/dist-sdk/src/entities/automation/script-code.js +23 -5
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +37 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +76 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +92 -20
- package/dist-sdk/src/entities/automation/tasks.js +48 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +20 -3
- package/dist-sdk/src/entities/automation/to-tf.js +606 -62
- package/dist-sdk/src/entities/automation/triggers.d.ts +8 -4
- 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/data-lookup/module.js +2 -0
- 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 +3 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +4 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +8 -14
- package/dist-sdk/src/entities/field/build.d.ts +3 -2
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +4 -4
- package/dist-sdk/src/entities/field/from-tf.js +205 -48
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +4 -4
- package/dist-sdk/src/entities/field/to-tf.js +7 -1
- 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/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/service-account/from-tf.js +3 -3
- 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/filters/ast.d.ts +15 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +5 -0
- package/dist-sdk/src/entities/shared/filters/index.js +5 -0
- package/dist-sdk/src/entities/shared/filters/print.js +7 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +5 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +42 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -3
- 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 +10 -0
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -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 +12 -5
- package/dist-sdk/src/entities/skill/from-tf.js +4 -2
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +41 -8
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +0 -6
- package/dist-sdk/src/entities/skill-tool/to-tf.js +22 -9
- 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/from-tf.js +9 -1
- package/dist-sdk/src/entities/view/to-tf.d.ts +6 -7
- package/dist-sdk/src/entities/view/to-tf.js +19 -8
- 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/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 +7 -6
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +133 -9
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +1 -0
- package/dist-sdk/src/graph/types.d.ts +29 -3
- package/package.json +7 -3
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* (`skill_id`) — this module never names the skill or app resource types.
|
|
7
7
|
* Mirrors `entities/agent-tool/to-tf.ts`.
|
|
8
8
|
*/
|
|
9
|
+
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
9
10
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
10
11
|
import { automationRunTargetResourceAttr } from "../automation/to-tf.js";
|
|
11
12
|
import { appScopedResourceLabel, childPartFromScopedLabel, expr, sanitizeName, scopedResourceLabel, stableIdSuffix, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
@@ -145,6 +146,18 @@ function fieldRefValue(token, where, ctx, target) {
|
|
|
145
146
|
* target). Tool-name validity is enforced in the authoring builders
|
|
146
147
|
* (entities/skill/tools.ts), not here.
|
|
147
148
|
*/
|
|
149
|
+
/**
|
|
150
|
+
* A whole skill tool the build cannot emit (edk#1480): the site states the
|
|
151
|
+
* consequence itself instead of leaving it to the generic "dropped" wording.
|
|
152
|
+
*/
|
|
153
|
+
function droppedSkillTool(entity, detail) {
|
|
154
|
+
return typedCoverageGap({
|
|
155
|
+
kind: "dropped",
|
|
156
|
+
entity,
|
|
157
|
+
detail,
|
|
158
|
+
consequence: "the skill is built without this tool, so an agent's call to it does nothing",
|
|
159
|
+
});
|
|
160
|
+
}
|
|
148
161
|
export function skillToolToTf(entry, ctx) {
|
|
149
162
|
const typeKey = Object.keys(entry)[0];
|
|
150
163
|
if (typeKey === undefined)
|
|
@@ -153,15 +166,15 @@ export function skillToolToTf(entry, ctx) {
|
|
|
153
166
|
const inner = entry[typeKey];
|
|
154
167
|
const name = inner?.name ?? "";
|
|
155
168
|
if (subType === undefined) {
|
|
156
|
-
ctx.diagnostics.push(`skill tool "${name}"
|
|
169
|
+
ctx.diagnostics.push(droppedSkillTool(`skill tool "${name}"`, `unknown tool kind "${typeKey}"; dropped`));
|
|
157
170
|
return undefined;
|
|
158
171
|
}
|
|
159
172
|
if (subType.implemented !== true) {
|
|
160
|
-
ctx.diagnostics.push(`skill tool "${name}"
|
|
173
|
+
ctx.diagnostics.push(droppedSkillTool(`skill tool "${name}"`, `tool kind "${typeKey}" is not supported on the terraform path yet; dropped`));
|
|
161
174
|
return undefined;
|
|
162
175
|
}
|
|
163
176
|
if (inner === undefined || typeof inner !== "object") {
|
|
164
|
-
ctx.diagnostics.push(`skill tool entry "${typeKey}"
|
|
177
|
+
ctx.diagnostics.push(droppedSkillTool(`skill tool entry "${typeKey}"`, "non-object body; dropped"));
|
|
165
178
|
return undefined;
|
|
166
179
|
}
|
|
167
180
|
const where = `skill tool "${name}"`;
|
|
@@ -204,7 +217,7 @@ export function skillToolToTf(entry, ctx) {
|
|
|
204
217
|
? sanitizeName(automation.name)
|
|
205
218
|
: undefined;
|
|
206
219
|
if (automationTfLabel === undefined) {
|
|
207
|
-
ctx.diagnostics.push(
|
|
220
|
+
ctx.diagnostics.push(droppedSkillTool(where, "no target automation token; dropped"));
|
|
208
221
|
return undefined;
|
|
209
222
|
}
|
|
210
223
|
if (automation?.parent !== undefined && automation.parent !== ctx.appRefName) {
|
|
@@ -218,13 +231,13 @@ export function skillToolToTf(entry, ctx) {
|
|
|
218
231
|
typeof automation.name === "string" && automation.name !== "") {
|
|
219
232
|
const lookup = ctx.foreignAutomationRef(automationTfLabel, automation.parentKind ?? "app", automation.parent, automation.parentName, automation.name);
|
|
220
233
|
if (lookup === undefined) {
|
|
221
|
-
ctx.diagnostics.push(
|
|
234
|
+
ctx.diagnostics.push(droppedSkillTool(where, "foreign automation lookup could not be materialized; dropped"));
|
|
222
235
|
return undefined;
|
|
223
236
|
}
|
|
224
237
|
attrs["automation_id"] = lookup;
|
|
225
238
|
}
|
|
226
239
|
else {
|
|
227
|
-
ctx.diagnostics.push(
|
|
240
|
+
ctx.diagnostics.push(droppedSkillTool(where, "cross-app automation targets are not supported; dropped"));
|
|
228
241
|
return undefined;
|
|
229
242
|
}
|
|
230
243
|
}
|
|
@@ -256,11 +269,11 @@ export function skillToolToTf(entry, ctx) {
|
|
|
256
269
|
if (typeKey === "runAgent") {
|
|
257
270
|
const target = inner.targetAgentId;
|
|
258
271
|
if (target?.refName === undefined || target.refName === "") {
|
|
259
|
-
ctx.diagnostics.push(
|
|
272
|
+
ctx.diagnostics.push(droppedSkillTool(where, "no target agent token; dropped"));
|
|
260
273
|
return undefined;
|
|
261
274
|
}
|
|
262
275
|
if (target.parent !== undefined && target.parent !== ctx.appRefName) {
|
|
263
|
-
ctx.diagnostics.push(
|
|
276
|
+
ctx.diagnostics.push(droppedSkillTool(where, "cross-app target agents are not supported; dropped"));
|
|
264
277
|
return undefined;
|
|
265
278
|
}
|
|
266
279
|
attrs["target_agent_id"] = expr.resourceAttr("elementum_agent", appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(target.refName)), ["id"]);
|
|
@@ -269,7 +282,7 @@ export function skillToolToTf(entry, ctx) {
|
|
|
269
282
|
return { block, address: `${subType.resourceType}.${tfLabel}` };
|
|
270
283
|
}
|
|
271
284
|
if (inner.aspectId === undefined && typeKey !== "searchTable") {
|
|
272
|
-
ctx.diagnostics.push(
|
|
285
|
+
ctx.diagnostics.push(droppedSkillTool(where, "no target aspect token; dropped"));
|
|
273
286
|
return undefined;
|
|
274
287
|
}
|
|
275
288
|
const aspectId = inner.aspectId;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CategoryRef, type CloudLinkRef } from "../../catalog/index.js";
|
|
2
2
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
|
+
import { type AppField } from "../app/build.js";
|
|
3
4
|
declare const taskStatusTagBrand: unique symbol;
|
|
4
5
|
export type TaskStatusTag = string & {
|
|
5
6
|
readonly [taskStatusTagBrand]: "TaskStatusTag";
|
|
@@ -35,6 +36,13 @@ export interface DefineTaskOptions extends EntityDeployOptions {
|
|
|
35
36
|
readonly options?: readonly TaskStatusOption[];
|
|
36
37
|
};
|
|
37
38
|
readonly commentsEnabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Custom fields, authored inline with the same field builders apps use
|
|
41
|
+
* (`textField`, `dropdownField`, …), keyed by a stable bag key that names
|
|
42
|
+
* the field's terraform address (edk#1464). The task's title, ID and status
|
|
43
|
+
* fields stay on `titleField`/`idField`/`statusField`.
|
|
44
|
+
*/
|
|
45
|
+
readonly fields?: Record<string, AppField>;
|
|
38
46
|
}
|
|
39
47
|
export interface TaskConfigured {
|
|
40
48
|
def(refName: string): DeployableEntity;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { slimTokens } from "../../catalog/index.js";
|
|
2
|
+
import { serializeField } from "../app/build.js";
|
|
2
3
|
export const taskStatusTag = { closed: "CLOSED" };
|
|
4
|
+
/** Keys the task's own system fields use; a custom field can't take one (its id local would collide). */
|
|
5
|
+
const TASK_SYSTEM_FIELD_KEYS = new Set(["title", "id", "status"]);
|
|
3
6
|
export function task(opts) {
|
|
4
7
|
if (opts.name.trim() === "")
|
|
5
8
|
throw new Error("task requires a non-empty name.");
|
|
@@ -12,6 +15,12 @@ export function task(opts) {
|
|
|
12
15
|
return { def(refName) {
|
|
13
16
|
const handle = opts.handle ?? refName.replace(/[^A-Za-z]/g, "").toUpperCase();
|
|
14
17
|
const namespace = opts.namespace ?? refName.replace(/[^A-Za-z]/g, "").toLowerCase();
|
|
15
|
-
|
|
18
|
+
const { fields: authoredFields, ...rest } = opts;
|
|
19
|
+
for (const key of Object.keys(authoredFields ?? {})) {
|
|
20
|
+
if (TASK_SYSTEM_FIELD_KEYS.has(key))
|
|
21
|
+
throw new Error(`task ${JSON.stringify(opts.name)}: fields.${key} collides with the task's ${key} system field; use ${key}Field or another key.`);
|
|
22
|
+
}
|
|
23
|
+
const fields = authoredFields === undefined ? undefined : Object.entries(authoredFields).map(([bagKey, field]) => serializeField(field, bagKey));
|
|
24
|
+
return { kind: "task", parent: "org", refName, payload: slimTokens({ ...rest, handle, namespace, ...(fields !== undefined && fields.length > 0 ? { fields } : {}) }), ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}) };
|
|
16
25
|
} };
|
|
17
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
2
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import type { NormalizedField } from "../app/deserializer/normalize.js";
|
|
3
4
|
export interface NormalizedTask {
|
|
4
5
|
readonly refName: string;
|
|
5
6
|
readonly name: string;
|
|
@@ -23,6 +24,7 @@ export interface NormalizedTask {
|
|
|
23
24
|
readonly name?: string;
|
|
24
25
|
readonly description?: string;
|
|
25
26
|
readonly options?: readonly Record<string, unknown>[];
|
|
26
|
-
};
|
|
27
|
+
}; /** Custom fields (edk#1464). */
|
|
28
|
+
readonly fields?: readonly NormalizedField[];
|
|
27
29
|
}
|
|
28
|
-
export declare function taskFromTf(block: TfBlock, ctx: FromTfContext): NormalizedTask;
|
|
30
|
+
export declare function taskFromTf(block: TfBlock, ctx: FromTfContext, fieldBlocks?: readonly TfBlock[]): NormalizedTask;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { dataRefLabel, optionalBoolean, optionalString, plainObject } from "../../engine/pull/context.js";
|
|
2
2
|
import { tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
3
|
+
import { fieldFromTf } from "../field/from-tf.js";
|
|
3
4
|
import { TASK_RESOURCE_TYPE } from "./module.js";
|
|
4
5
|
const KNOWN = new Set(["id", "name", "handle", "namespace", "category_id", "cloud_link_id", "description", "icon", "color", "title_field_name", "title_field_description", "id_field_name", "id_field_description", "status_field_name", "status_field_description", "status_options", "status_option_ids_by_label", "title_field_id", "id_field_id", "status_field_id", "comments_enabled", "comments_display_block_id"]);
|
|
5
|
-
export function taskFromTf(block, ctx) {
|
|
6
|
+
export function taskFromTf(block, ctx, fieldBlocks = []) {
|
|
6
7
|
if (block.type !== TASK_RESOURCE_TYPE || !block.label)
|
|
7
8
|
throw new Error(`expected ${TASK_RESOURCE_TYPE}`);
|
|
8
9
|
for (const key of Object.keys(block.attrs))
|
|
@@ -25,7 +26,11 @@ export function taskFromTf(block, ctx) {
|
|
|
25
26
|
const idDescription = optionalString(block.attrs, "id_field_description", `task ${block.label}`, ctx);
|
|
26
27
|
const statusName = optionalString(block.attrs, "status_field_name", `task ${block.label}`, ctx);
|
|
27
28
|
const statusDescription = optionalString(block.attrs, "status_field_description", `task ${block.label}`, ctx);
|
|
28
|
-
|
|
29
|
+
const refName = tfLabelToTsLabel(block.label);
|
|
30
|
+
const owner = { type: TASK_RESOURCE_TYPE, label: block.label, scope: "task", refName };
|
|
31
|
+
const fields = fieldBlocks.flatMap((fieldBlock) => fieldFromTf(fieldBlock, owner, ctx) ?? []);
|
|
32
|
+
return { refName, name, handle, namespace,
|
|
33
|
+
...(fields.length > 0 && { fields }),
|
|
29
34
|
...(categoryLabel !== undefined && { categoryRef: tfLabelToTsLabel(categoryLabel) }),
|
|
30
35
|
...(cloudLabel !== undefined && { cloudLinkRef: tfLabelToTsLabel(cloudLabel) }),
|
|
31
36
|
...(optionalString(block.attrs, "description", `task ${block.label}`, ctx) !== undefined && { description: optionalString(block.attrs, "description", `task ${block.label}`, ctx) }),
|
|
@@ -3,10 +3,10 @@ import { taskFromTf } from "./from-tf.js";
|
|
|
3
3
|
import { taskToTf } from "./to-tf.js";
|
|
4
4
|
export const TASK_RESOURCE_TYPE = "elementum_task";
|
|
5
5
|
function extract(stream, ctx) { const blocks = stream.byKind.get("task") ?? []; if (blocks.length !== 1)
|
|
6
|
-
throw new Error(`expected exactly one ${TASK_RESOURCE_TYPE}, found ${blocks.length}`); return { instance: taskFromTf(blocks[0], ctx) }; }
|
|
6
|
+
throw new Error(`expected exactly one ${TASK_RESOURCE_TYPE}, found ${blocks.length}`); return { instance: taskFromTf(blocks[0], ctx, stream.byKind.get("field") ?? []) }; }
|
|
7
7
|
export const taskModule = {
|
|
8
8
|
kind: "task", stream: { role: "streamRoot", exportVerb: "tasks" }, authoring: { unit: "ownFile", bag: "tasks" }, parents: [{ parent: "org", child: "task" }],
|
|
9
9
|
resource: { shape: "single", resourceType: TASK_RESOURCE_TYPE, adoptable: true }, data: { participates: true, lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootNamespace", compatibilityFallback: "name" }] },
|
|
10
|
-
lifecycle: { participates: true, extractStreamRoot: extract, toTf: (entity, ctx) => taskToTf(entity, { orgRefs: ctx.orgRefs, diagnostics: ctx.diagnostics }) },
|
|
10
|
+
lifecycle: { participates: true, extractStreamRoot: extract, toTf: (entity, ctx) => taskToTf(entity, { orgRefs: ctx.orgRefs, diagnostics: ctx.diagnostics, workspaceAspects: ctx.workspaceAspects }) },
|
|
11
11
|
canvas: { participates: true, label: "Tasks", glyph: "☑", component: "appDetail" }, catalog: NO_CATALOG,
|
|
12
12
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type { OrgRefLookup } from "../../engine/build/context.js";
|
|
1
|
+
import type { OrgRefLookup, WorkspaceAspect } from "../../engine/build/context.js";
|
|
2
2
|
import { type DeployableEntity } from "../../engine/entity.js";
|
|
3
3
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
4
|
+
export interface TaskToTfResult {
|
|
5
|
+
readonly blocks: readonly TfBlock[];
|
|
6
|
+
/** Custom field bag key → `<resourceType>.<tfLabel>` (edk#1464). */
|
|
7
|
+
readonly fieldAddresses: ReadonlyMap<string, string>;
|
|
8
|
+
}
|
|
4
9
|
export declare function taskToTf(entity: DeployableEntity, ctx: {
|
|
5
10
|
orgRefs: OrgRefLookup;
|
|
6
11
|
diagnostics: string[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
12
|
+
workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
13
|
+
}): TaskToTfResult;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { authoredFieldKeysFromPayload, claimFieldDisplayName, fieldToTf } from "../field/to-tf.js";
|
|
1
2
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
3
|
import { expr } from "../../engine/tf/index.js";
|
|
3
4
|
import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
@@ -46,5 +47,31 @@ export function taskToTf(entity, ctx) {
|
|
|
46
47
|
attrs["status_field_description"] = p.statusField.description;
|
|
47
48
|
if (p.statusField?.options !== undefined)
|
|
48
49
|
attrs["status_options"] = p.statusField.options.map((option) => ({ label: option.label ?? "", ...(option.color !== undefined && { color: option.color }), tags: [...(option.tags ?? [])] }));
|
|
49
|
-
|
|
50
|
+
const blocks = [{ kind: "resource", type: TASK_RESOURCE_TYPE, label: p.namespace, attrs }];
|
|
51
|
+
// Custom fields (edk#1464): the same field resources apps emit, owned by the task.
|
|
52
|
+
const fieldAddresses = new Map();
|
|
53
|
+
const fieldOwnership = authoredFieldKeysFromPayload(p);
|
|
54
|
+
const displayNames = new Map();
|
|
55
|
+
const objectId = expr.resourceAttr(TASK_RESOURCE_TYPE, p.namespace, ["id"]);
|
|
56
|
+
for (const entry of p.fields ?? []) {
|
|
57
|
+
const typeKey = Object.keys(entry)[0];
|
|
58
|
+
if (typeKey === undefined)
|
|
59
|
+
continue;
|
|
60
|
+
const field = fieldToTf(typeKey, entry[typeKey], {
|
|
61
|
+
ownerTfLabel: p.namespace,
|
|
62
|
+
appRefName: entity.refName,
|
|
63
|
+
scope: "task",
|
|
64
|
+
objectId,
|
|
65
|
+
diagnostics: ctx.diagnostics,
|
|
66
|
+
orgRefs: ctx.orgRefs,
|
|
67
|
+
...(ctx.workspaceAspects !== undefined && { workspaceAspects: ctx.workspaceAspects }),
|
|
68
|
+
...(fieldOwnership !== undefined && { fieldOwnership }),
|
|
69
|
+
});
|
|
70
|
+
if (field === undefined)
|
|
71
|
+
continue;
|
|
72
|
+
claimFieldDisplayName(displayNames, field);
|
|
73
|
+
blocks.push(field.block);
|
|
74
|
+
fieldAddresses.set(field.bagKey, field.address);
|
|
75
|
+
}
|
|
76
|
+
return { blocks, fieldAddresses };
|
|
50
77
|
}
|
|
@@ -459,10 +459,15 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
459
459
|
if (Array.isArray(fieldIds)) {
|
|
460
460
|
const fields = [];
|
|
461
461
|
const widgets = [];
|
|
462
|
+
const widgetAts = {};
|
|
462
463
|
for (const f of fieldIds) {
|
|
463
464
|
const widgetLabel = resourceRefLabel(f, WIDGET_RESOURCE_TYPE);
|
|
464
465
|
if (widgetLabel !== undefined) {
|
|
465
|
-
|
|
466
|
+
const key = scopedLabelToBagKey(ownerTfLabel, widgetLabel, scope);
|
|
467
|
+
widgets.push(key);
|
|
468
|
+
// `at` is an index in the field list. A widget after every field
|
|
469
|
+
// is the build default, so only an earlier index has to round-trip.
|
|
470
|
+
widgetAts[key] = fields.length;
|
|
466
471
|
continue;
|
|
467
472
|
}
|
|
468
473
|
const key = fieldRefFromTf(f, ownerLabel, ownerTfLabel, scope, ctx);
|
|
@@ -472,6 +477,9 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
472
477
|
section.fields = fields;
|
|
473
478
|
if (widgets.length > 0)
|
|
474
479
|
section.widgets = widgets;
|
|
480
|
+
const placed = Object.entries(widgetAts).filter(([, at]) => at < fields.length);
|
|
481
|
+
if (placed.length > 0)
|
|
482
|
+
section.widgetAts = Object.fromEntries(placed);
|
|
475
483
|
}
|
|
476
484
|
}
|
|
477
485
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && typeof rec["name"] === "string") {
|
|
@@ -40,6 +40,12 @@ export interface AppLayoutSectionWire {
|
|
|
40
40
|
readonly __kind?: string;
|
|
41
41
|
readonly refName?: string;
|
|
42
42
|
readonly parent?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Index in this group's field list where the widget is inserted.
|
|
45
|
+
* Omitted widgets stay after the fields, which is where a group that
|
|
46
|
+
* only has trailing action buttons belongs.
|
|
47
|
+
*/
|
|
48
|
+
readonly at?: number;
|
|
43
49
|
}[];
|
|
44
50
|
}
|
|
45
51
|
export interface AppLayoutWire {
|
|
@@ -109,13 +115,6 @@ export interface ViewToTfOptions {
|
|
|
109
115
|
readonly ownerTfLabel: string;
|
|
110
116
|
/** App children use `apps_<ns>_`; element children use `<ns>_`. */
|
|
111
117
|
readonly scope?: ChildResourceScope;
|
|
112
|
-
/**
|
|
113
|
-
* The owning aspect's display name — `elementum_managed_view_order`'s label
|
|
114
|
-
* has no authored bag key (it's a derived aspect-wide singleton), so ei
|
|
115
|
-
* derives it from the NAME (its `SanitizeName`, not the namespace);
|
|
116
|
-
* matching that here keeps the build-vs-export address-stable across a real pull.
|
|
117
|
-
*/
|
|
118
|
-
readonly aspectName: string;
|
|
119
118
|
/** The owning aspect's id reference — computed by the caller. */
|
|
120
119
|
readonly objectId: TfValue;
|
|
121
120
|
/** App stage terraform labels declared by systemFields.stage.options. */
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* with the same `EntityTfError` path used by access-policy row filters.
|
|
11
11
|
*/
|
|
12
12
|
import { agentViewLayoutToTf, viewBlocksToTf } from "./agent-view-layout-to-tf.js";
|
|
13
|
-
import { expr, isCanonicalTsLabel,
|
|
13
|
+
import { expr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
14
14
|
import { fieldRefToTfValue as customFieldRefToTfValue } from "../field/to-tf.js";
|
|
15
15
|
import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
|
|
16
16
|
import { filterToTf, principalListToTf } from "../access-policy/to-tf.js";
|
|
@@ -36,7 +36,7 @@ function appendViewSharingAttrs(attrs, view, where, ctx) {
|
|
|
36
36
|
}
|
|
37
37
|
/** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
|
|
38
38
|
export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder, opts, customViews) {
|
|
39
|
-
const { ownerRefName, ownerTfLabel, scope = "app",
|
|
39
|
+
const { ownerRefName, ownerTfLabel, scope = "app", objectId, diagnostics, fieldAddresses } = opts;
|
|
40
40
|
const principalCtx = { ...opts, scope, objectId };
|
|
41
41
|
const blocks = [];
|
|
42
42
|
for (const [stageKey, layout] of Object.entries(layouts ?? {})) {
|
|
@@ -312,7 +312,9 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
312
312
|
blocks.push({
|
|
313
313
|
kind: "resource",
|
|
314
314
|
type: MANAGED_VIEW_ORDER_RESOURCE_TYPE,
|
|
315
|
-
|
|
315
|
+
// No name of its own: labelled from the owner's namespace, like the record
|
|
316
|
+
// create form, so renaming the app or element keeps its address.
|
|
317
|
+
label: scopedResourceLabel(ownerTfLabel, "view_order", scope),
|
|
316
318
|
attrs: { object_id: objectId, view_ids: viewIds },
|
|
317
319
|
});
|
|
318
320
|
}
|
|
@@ -386,6 +388,7 @@ function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectI
|
|
|
386
388
|
// provider re-places them when it recreates the layout.
|
|
387
389
|
const fields = section.fields ?? [];
|
|
388
390
|
const widgetIds = [];
|
|
391
|
+
const inserted = [];
|
|
389
392
|
for (const [index, widget] of (section.widgets ?? []).entries()) {
|
|
390
393
|
const widgetWhere = `${where}.widgets[${index}]`;
|
|
391
394
|
const key = widget.refName ?? "";
|
|
@@ -401,12 +404,20 @@ function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectI
|
|
|
401
404
|
diagnostics.push(`${widgetWhere}: widget ${JSON.stringify(key)} is not declared in this ${scope}; dropped`);
|
|
402
405
|
continue;
|
|
403
406
|
}
|
|
404
|
-
|
|
407
|
+
const widgetId = expr.resourceAttr(WIDGET_RESOURCE_TYPE, scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(key), scope), ["id"]);
|
|
408
|
+
if (typeof widget.at === "number")
|
|
409
|
+
inserted.push({ at: widget.at, id: widgetId });
|
|
410
|
+
else
|
|
411
|
+
widgetIds.push(widgetId);
|
|
405
412
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
413
|
+
const fieldIds = resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics, fieldAddresses);
|
|
414
|
+
// Insert from the back so each `at` is an index in the original field
|
|
415
|
+
// list, not an index that earlier inserts have already shifted.
|
|
416
|
+
for (const widget of inserted.sort((left, right) => right.at - left.at)) {
|
|
417
|
+
const index = Math.max(0, Math.min(widget.at, fieldIds.length));
|
|
418
|
+
fieldIds.splice(index, 0, widget.id);
|
|
419
|
+
}
|
|
420
|
+
sec.field_ids = [...fieldIds, ...widgetIds];
|
|
410
421
|
}
|
|
411
422
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && section.name !== undefined) {
|
|
412
423
|
sec.name = section.name;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentRef, type AppCatalogRef, type AppOrElementRef, type AutomationRef } from "../../catalog/index.js";
|
|
1
|
+
import { type AgentRef, type AppCatalogRef, type AppOrElementRef, type AutomationRef, type DatamineRef, type RelationshipRef, type TableRef } from "../../catalog/index.js";
|
|
2
2
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
3
|
declare const positionBrand: unique symbol;
|
|
4
4
|
declare const symbolBrand: unique symbol;
|
|
@@ -39,6 +39,18 @@ type ActionPayload = {
|
|
|
39
39
|
readonly kind: "object";
|
|
40
40
|
readonly object: AppOrElementRef;
|
|
41
41
|
readonly name?: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: "datamine";
|
|
44
|
+
readonly datamine: DatamineRef;
|
|
45
|
+
readonly name?: string;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: "table";
|
|
48
|
+
readonly table: TableRef;
|
|
49
|
+
readonly name?: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "relationship";
|
|
52
|
+
readonly relationship: RelationshipRef;
|
|
53
|
+
readonly name?: string;
|
|
42
54
|
};
|
|
43
55
|
export type VisualFlowAction = ActionPayload & {
|
|
44
56
|
readonly [actionBrand]: "VisualFlowAction";
|
|
@@ -54,6 +66,9 @@ export declare function flowAutomationAction(automation: AutomationRef, name?: s
|
|
|
54
66
|
export declare function flowUserAction(name: string): VisualFlowAction;
|
|
55
67
|
export declare function flowApiAction(name: string): VisualFlowAction;
|
|
56
68
|
export declare function flowObjectAction(object: AppOrElementRef, name?: string): VisualFlowAction;
|
|
69
|
+
export declare function flowDatamineAction(datamine: DatamineRef, name?: string): VisualFlowAction;
|
|
70
|
+
export declare function flowTableAction(table: TableRef, name?: string): VisualFlowAction;
|
|
71
|
+
export declare function flowRelationshipAction(relationship: RelationshipRef, name?: string): VisualFlowAction;
|
|
57
72
|
export declare function flowObjectTarget(object: AppOrElementRef, name?: string): VisualFlowTarget;
|
|
58
73
|
export interface VisualFlowConnection {
|
|
59
74
|
readonly target: string;
|
|
@@ -26,6 +26,15 @@ export function flowApiAction(name) {
|
|
|
26
26
|
export function flowObjectAction(object, name) {
|
|
27
27
|
return { kind: "object", object, ...(name !== undefined ? { name } : {}) };
|
|
28
28
|
}
|
|
29
|
+
export function flowDatamineAction(datamine, name) {
|
|
30
|
+
return { kind: "datamine", datamine, ...(name !== undefined ? { name } : {}) };
|
|
31
|
+
}
|
|
32
|
+
export function flowTableAction(table, name) {
|
|
33
|
+
return { kind: "table", table, ...(name !== undefined ? { name } : {}) };
|
|
34
|
+
}
|
|
35
|
+
export function flowRelationshipAction(relationship, name) {
|
|
36
|
+
return { kind: "relationship", relationship, ...(name !== undefined ? { name } : {}) };
|
|
37
|
+
}
|
|
29
38
|
export function flowObjectTarget(object, name) {
|
|
30
39
|
return { object, ...(name !== undefined ? { name } : {}) };
|
|
31
40
|
}
|
|
@@ -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",
|