@elementumai/edk 0.9.10 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sdk/src/catalog/factories.d.ts +8 -1
- package/dist-sdk/src/catalog/factories.js +13 -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/types.d.ts +19 -2
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/engine/build/context.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +3 -3
- package/dist-sdk/src/entities/access-policy/from-tf.js +27 -8
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +13 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +34 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +13 -7
- package/dist-sdk/src/entities/agent-tool/to-tf.js +13 -0
- package/dist-sdk/src/entities/app/build.d.ts +15 -2
- package/dist-sdk/src/entities/app/build.js +6 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +13 -3
- package/dist-sdk/src/entities/app/from-tf.js +6 -3
- package/dist-sdk/src/entities/app/to-tf.js +5 -1
- package/dist-sdk/src/entities/automation/from-tf.js +113 -1
- package/dist-sdk/src/entities/automation/module.js +1 -0
- package/dist-sdk/src/entities/automation/tasks.js +17 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/automation/to-tf.js +153 -46
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +11 -2
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -1
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +8 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +12 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +64 -10
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +54 -6
- package/dist-sdk/src/entities/element/build.d.ts +7 -0
- package/dist-sdk/src/entities/element/from-tf.js +1 -1
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +19 -1
- package/dist-sdk/src/entities/field/build.d.ts +10 -1
- package/dist-sdk/src/entities/field/build.js +2 -1
- package/dist-sdk/src/entities/field/calc/index.js +7 -7
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +32 -0
- package/dist-sdk/src/entities/field/calc/types.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +10 -2
- package/dist-sdk/src/entities/relationship/build.d.ts +14 -7
- package/dist-sdk/src/entities/relationship/from-tf.js +14 -14
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +18 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +21 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +16 -4
- package/dist-sdk/src/entities/skill/tools.d.ts +10 -0
- package/dist-sdk/src/entities/skill/tools.js +10 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +22 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +21 -0
- package/dist-sdk/src/entities/table/catalog-render.js +2 -1
- package/dist-sdk/src/entities/view/from-tf.js +9 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/view/to-tf.js +34 -5
- package/dist-sdk/src/entities/widget/build.d.ts +17 -7
- package/dist-sdk/src/entities/widget/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/widget/from-tf.js +132 -18
- package/dist-sdk/src/entities/widget/to-tf.d.ts +17 -0
- package/dist-sdk/src/entities/widget/to-tf.js +40 -0
- package/dist-sdk/src/graph/types.d.ts +8 -0
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ import { recordCreateFormToTf } from "../record-create-form/to-tf.js";
|
|
|
31
31
|
import { relationshipsToTf } from "../relationship/to-tf.js";
|
|
32
32
|
import { rolesToTf } from "../role/to-tf.js";
|
|
33
33
|
import { serviceAccountsToTf } from "../service-account/to-tf.js";
|
|
34
|
-
import { widgetsToTf } from "../widget/to-tf.js";
|
|
34
|
+
import { relationshipTargetsFromBag, widgetsToTf } from "../widget/to-tf.js";
|
|
35
35
|
import { viewToTf } from "../view/to-tf.js";
|
|
36
36
|
import { APP_RESOURCE_TYPE } from "./module.js";
|
|
37
37
|
/** System-field tags that fold into the app resource instead of emitting a field resource. */
|
|
@@ -80,6 +80,8 @@ export function appToTf(entity, ctx) {
|
|
|
80
80
|
appAttrs["color"] = payload.color;
|
|
81
81
|
if (payload.commentsEnabled !== undefined)
|
|
82
82
|
appAttrs["comments_enabled"] = payload.commentsEnabled;
|
|
83
|
+
if (payload.lockStages !== undefined)
|
|
84
|
+
appAttrs["lock_stages"] = payload.lockStages;
|
|
83
85
|
const categoryName = payload.category?.name;
|
|
84
86
|
if (categoryName !== undefined && categoryName !== "") {
|
|
85
87
|
const category = ctx.orgRefs.byName(CATEGORY_ORG_BAG, categoryName);
|
|
@@ -260,6 +262,7 @@ export function appToTf(entity, ctx) {
|
|
|
260
262
|
workspaceAspects: ctx.workspaceAspects,
|
|
261
263
|
diagnostics: ctx.diagnostics,
|
|
262
264
|
fieldAddresses,
|
|
265
|
+
relationshipTargets: relationshipTargetsFromBag(payload.relationships),
|
|
263
266
|
}));
|
|
264
267
|
const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.calendarViews, payload.kanbanViews, payload.dashboardViews, payload.agentViews, payload.viewOrder, {
|
|
265
268
|
ownerRefName: ctx.appRefName,
|
|
@@ -271,6 +274,7 @@ export function appToTf(entity, ctx) {
|
|
|
271
274
|
orgRefs: ctx.orgRefs,
|
|
272
275
|
diagnostics: ctx.diagnostics,
|
|
273
276
|
fieldAddresses,
|
|
277
|
+
widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
|
|
274
278
|
});
|
|
275
279
|
blocks.push(...viewBlocks);
|
|
276
280
|
const recordCreateForm = recordCreateFormToTf(payload.recordCreateForm, {
|
|
@@ -28,6 +28,7 @@ const TRIGGER_KINDS = {
|
|
|
28
28
|
elementum_approval_chain_trigger: "approvalProcessStatusUpdated",
|
|
29
29
|
elementum_datamine_trigger: "dataMine",
|
|
30
30
|
elementum_survey_trigger: "surveyResponseCreate",
|
|
31
|
+
elementum_schedule_trigger: "schedule",
|
|
31
32
|
};
|
|
32
33
|
const TASK_FACTORIES = {
|
|
33
34
|
elementum_message_task: "postComment",
|
|
@@ -232,6 +233,8 @@ const TRIGGER_ATTRIBUTES = new Set([
|
|
|
232
233
|
"authenticated", "custom_response", "show_triggered_by", "parameters",
|
|
233
234
|
"approval_chain_template_id", "status", "datamine_id", "fire_on_alert",
|
|
234
235
|
"fire_on_recovery", "email_alias_id", "survey_template_id",
|
|
236
|
+
"frequency", "interval", "timezone", "start_at", "weekdays", "day_of_month",
|
|
237
|
+
"end_at", "ends_after_count", "interval_unit",
|
|
235
238
|
]);
|
|
236
239
|
const TASK_ATTRIBUTES = new Set([
|
|
237
240
|
"parent", "name", "depends_on", "filter", "fields", "inputs", "output_schema",
|
|
@@ -402,6 +405,17 @@ const RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS = {
|
|
|
402
405
|
"All found records": "records",
|
|
403
406
|
Record: "record",
|
|
404
407
|
};
|
|
408
|
+
/**
|
|
409
|
+
* The same outputs as seen from a CALCULATION formula, which addresses a
|
|
410
|
+
* reference by its WorkflowTaskReference name rather than the refs-map
|
|
411
|
+
* display key above (`to-tf.ts`'s `CALCULATION_TASK_OUTPUT_REF_NAME` is the
|
|
412
|
+
* write side). Only the names that differ from their authoring path are
|
|
413
|
+
* listed; the rest already read back correctly.
|
|
414
|
+
*/
|
|
415
|
+
const RECORD_SEARCH_CALCULATION_REF_NAME_TO_TS = {
|
|
416
|
+
count: ["totalCount"],
|
|
417
|
+
recordId: ["record", "recordId"],
|
|
418
|
+
};
|
|
405
419
|
// aiSearchTable's own output ref name — same scoping reason as
|
|
406
420
|
// RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS: "All Records" is a platform-fixed
|
|
407
421
|
// wire key on elementum_ai_search_table_task only. A trigger field could
|
|
@@ -526,6 +540,22 @@ function lookupFieldKeyByDisplayName(ownerRefName, displayName, ctx) {
|
|
|
526
540
|
}
|
|
527
541
|
return undefined;
|
|
528
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* `record.<field-uuid>[.suffix]` — how a calculation formula names a found
|
|
545
|
+
* record's field (the calc engine resolves it by field id, not display
|
|
546
|
+
* name). Mirrors the same shape already handled for live filters in
|
|
547
|
+
* `decodeReferenceString`, resolving the id back to its authoring bag key.
|
|
548
|
+
*/
|
|
549
|
+
function calculationRecordFieldPath(taskAddress, wireName, ctx) {
|
|
550
|
+
if (taskAddress === undefined)
|
|
551
|
+
return undefined;
|
|
552
|
+
const [head, ...tail] = wireName.split(".");
|
|
553
|
+
if (head !== "record" || tail.length === 0 || !/^[a-f0-9-]{36}$/i.test(tail[0]))
|
|
554
|
+
return undefined;
|
|
555
|
+
const ownerRefName = ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) ?? ctx.appRefName;
|
|
556
|
+
const fieldKey = resolveFieldKeyFromId(tail[0], ownerRefName, ctx);
|
|
557
|
+
return ["record", fieldKey ?? tail[0], ...tail.slice(1)];
|
|
558
|
+
}
|
|
529
559
|
function taskRecordSearchFieldPath(taskAddress, wireName, ctx) {
|
|
530
560
|
if (ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) === undefined)
|
|
531
561
|
return undefined;
|
|
@@ -796,6 +826,25 @@ function decodeTaskReferenceFromString(taskIdOrKey, pathSegments, ctx) {
|
|
|
796
826
|
if (aiAgentPath !== undefined)
|
|
797
827
|
return { kind: "taskRef", task: refKey, path: aiAgentPath };
|
|
798
828
|
}
|
|
829
|
+
// A task's own record output can be addressed by an unresolved field UUID
|
|
830
|
+
// (`record.<field-uuid>[.suffix]`) the same way a recordSearch task's
|
|
831
|
+
// found-record fields already are below - an updateField task's "record"
|
|
832
|
+
// refers to the record it just updated (same-app field, live-confirmed on
|
|
833
|
+
// purchaseorder/eu-sanofi), so it needs the identical UUID resolution or
|
|
834
|
+
// it falls through to the raw-uuid escape even for a resolvable field.
|
|
835
|
+
if (block?.type === "elementum_update_field_task" &&
|
|
836
|
+
pathSegments.length >= 2 &&
|
|
837
|
+
pathSegments[0] === "record" &&
|
|
838
|
+
/^[a-f0-9-]{36}$/i.test(pathSegments[1])) {
|
|
839
|
+
const taskAddress = block.label !== undefined ? `${block.type}.${block.label}` : undefined;
|
|
840
|
+
const ownerRefName = (taskAddress !== undefined ? ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) : undefined) ?? ctx.appRefName;
|
|
841
|
+
const fieldKey = resolveFieldKeyFromId(pathSegments[1], ownerRefName, ctx);
|
|
842
|
+
return {
|
|
843
|
+
kind: "taskRef",
|
|
844
|
+
task: refKey,
|
|
845
|
+
path: ["record", fieldKey ?? pathSegments[1], ...pathSegments.slice(2)],
|
|
846
|
+
};
|
|
847
|
+
}
|
|
799
848
|
if (block?.type === "elementum_record_search_task" && pathSegments.length >= 1) {
|
|
800
849
|
const [head, ...tail] = pathSegments;
|
|
801
850
|
if (head === "count") {
|
|
@@ -1694,12 +1743,22 @@ function decodeCalculationTaskMustache(taskId, wireName, ctx) {
|
|
|
1694
1743
|
if (aiAgentPath !== undefined)
|
|
1695
1744
|
return { kind: "taskRef", task: refKey, path: aiAgentPath };
|
|
1696
1745
|
}
|
|
1746
|
+
// A calculation mustache carries the WorkflowTaskReference name, not the
|
|
1747
|
+
// refs-map display key: a found record's field is `record.<field-uuid>`
|
|
1748
|
+
// and the task's own outputs are their internal names. Both are addressed
|
|
1749
|
+
// here before the display-key tables below, which never match them.
|
|
1750
|
+
const taskAddress = taskBlock?.label !== undefined ? `${taskBlock.type}.${taskBlock.label}` : undefined;
|
|
1751
|
+
const calcRecordFieldPath = calculationRecordFieldPath(taskAddress, wireName, ctx);
|
|
1752
|
+
if (calcRecordFieldPath !== undefined)
|
|
1753
|
+
return { kind: "taskRef", task: refKey, path: calcRecordFieldPath };
|
|
1697
1754
|
if (taskBlock?.type === "elementum_record_search_task") {
|
|
1755
|
+
const calcOwnOutput = RECORD_SEARCH_CALCULATION_REF_NAME_TO_TS[wireName];
|
|
1756
|
+
if (calcOwnOutput !== undefined)
|
|
1757
|
+
return { kind: "taskRef", task: refKey, path: [...calcOwnOutput] };
|
|
1698
1758
|
const recordSearchName = RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS[wireName];
|
|
1699
1759
|
if (recordSearchName !== undefined) {
|
|
1700
1760
|
return { kind: "taskRef", task: refKey, path: [recordSearchName] };
|
|
1701
1761
|
}
|
|
1702
|
-
const taskAddress = taskBlock.label !== undefined ? `${taskBlock.type}.${taskBlock.label}` : undefined;
|
|
1703
1762
|
if (taskAddress !== undefined) {
|
|
1704
1763
|
const recordFieldPath = taskRecordSearchFieldPath(taskAddress, wireName, ctx);
|
|
1705
1764
|
if (recordFieldPath !== undefined) {
|
|
@@ -1791,6 +1850,23 @@ function resolveVariableReference(rawId, rawName, outputName, ctx) {
|
|
|
1791
1850
|
return { kind: "variableParamRef", varTask: byOutput.refKey, name: byOutput.varName };
|
|
1792
1851
|
}
|
|
1793
1852
|
}
|
|
1853
|
+
// 4. The variable's real platform id only exists in deployed state, never
|
|
1854
|
+
// in the static export text a `variable_task`/`update_variable_task` block
|
|
1855
|
+
// carries (no `variable_id`/`id` attribute on the wire) - so a workflow
|
|
1856
|
+
// OUTPUT's `variableReference.name` is always the synthetic
|
|
1857
|
+
// "variable|<uuid>" placeholder, and #2/#3's name-based matches routinely
|
|
1858
|
+
// miss on casing/spacing (output "Output Message" vs. variable "Output
|
|
1859
|
+
// message" - live-confirmed on purchaseorder/eu-sanofi's Authorization
|
|
1860
|
+
// Check automation). With exactly one variable task in the whole
|
|
1861
|
+
// automation there is no other candidate it could mean. Scoped to
|
|
1862
|
+
// outputName (workflow_publish outputs only) - a bare filter reference's
|
|
1863
|
+
// "variable.<uuid>" is a DIFFERENT wire dialect with no such guarantee
|
|
1864
|
+
// (board issue #171 contract: a filter referencing variable.<uuid> must
|
|
1865
|
+
// NOT bind to a same-automation variable task).
|
|
1866
|
+
if (rawId !== undefined && outputName !== undefined && variableTasks.length === 1) {
|
|
1867
|
+
const only = variableTasks[0];
|
|
1868
|
+
return { kind: "variableParamRef", varTask: only.refKey, name: only.varName };
|
|
1869
|
+
}
|
|
1794
1870
|
return undefined;
|
|
1795
1871
|
}
|
|
1796
1872
|
function decodeFilterReferenceEnvelope(value, ctx, outputName) {
|
|
@@ -1985,6 +2061,42 @@ function triggerFromBlock(block, ctx) {
|
|
|
1985
2061
|
if (typeof block.attrs.survey_template_id !== "string")
|
|
1986
2062
|
throw new EntityTfError("survey trigger requires survey_template_id");
|
|
1987
2063
|
return { kind, app, survey: block.attrs.survey_template_id };
|
|
2064
|
+
case "schedule": {
|
|
2065
|
+
if (typeof block.attrs.frequency !== "string")
|
|
2066
|
+
throw new EntityTfError("schedule trigger requires frequency");
|
|
2067
|
+
if (typeof block.attrs.timezone !== "string")
|
|
2068
|
+
throw new EntityTfError("schedule trigger requires timezone");
|
|
2069
|
+
if (typeof block.attrs.start_at !== "string")
|
|
2070
|
+
throw new EntityTfError("schedule trigger requires start_at");
|
|
2071
|
+
const frequency = block.attrs.frequency;
|
|
2072
|
+
if (frequency !== "HOURLY" && frequency !== "DAILY" && frequency !== "WEEKLY" && frequency !== "MONTHLY") {
|
|
2073
|
+
throw new EntityTfError(`schedule trigger frequency "${frequency}" is not a public EDK schedule frequency`);
|
|
2074
|
+
}
|
|
2075
|
+
if (block.attrs.end_at !== undefined) {
|
|
2076
|
+
throw new EntityTfError("schedule trigger end_at is not a public EDK schedule option");
|
|
2077
|
+
}
|
|
2078
|
+
if (block.attrs.ends_after_count !== undefined) {
|
|
2079
|
+
throw new EntityTfError("schedule trigger ends_after_count is not a public EDK schedule option");
|
|
2080
|
+
}
|
|
2081
|
+
if (block.attrs.interval_unit !== undefined) {
|
|
2082
|
+
throw new EntityTfError("schedule trigger interval_unit is not a public EDK schedule option");
|
|
2083
|
+
}
|
|
2084
|
+
if (block.attrs.filter !== undefined) {
|
|
2085
|
+
throw new EntityTfError("schedule trigger filter is not a public EDK schedule option");
|
|
2086
|
+
}
|
|
2087
|
+
const weekdays = Array.isArray(block.attrs.weekdays)
|
|
2088
|
+
? block.attrs.weekdays.filter((day) => typeof day === "string")
|
|
2089
|
+
: undefined;
|
|
2090
|
+
return {
|
|
2091
|
+
kind,
|
|
2092
|
+
frequency,
|
|
2093
|
+
timezone: block.attrs.timezone,
|
|
2094
|
+
startAt: block.attrs.start_at,
|
|
2095
|
+
...(typeof block.attrs.interval === "number" ? { interval: block.attrs.interval } : {}),
|
|
2096
|
+
...(weekdays !== undefined && weekdays.length > 0 ? { weekdays } : {}),
|
|
2097
|
+
...(typeof block.attrs.day_of_month === "number" ? { dayOfMonth: block.attrs.day_of_month } : {}),
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
1988
2100
|
default: throw new EntityTfError(`trigger "${kind}" is outside the Terraform contract`);
|
|
1989
2101
|
}
|
|
1990
2102
|
}
|
|
@@ -204,6 +204,7 @@ export const automationModule = {
|
|
|
204
204
|
fieldNames: ctx.fieldNames ?? new Map(),
|
|
205
205
|
fieldMetadata: ctx.fieldMetadata ?? new Map(),
|
|
206
206
|
...(ctx.fieldNamesByAppRefName !== undefined ? { fieldNamesByAppRefName: ctx.fieldNamesByAppRefName } : {}),
|
|
207
|
+
...(ctx.fieldAddressesByAppRefName !== undefined ? { fieldAddressesByAppRefName: ctx.fieldAddressesByAppRefName } : {}),
|
|
207
208
|
...(ctx.allowUnknownPicklistOptions === true ? { allowUnknownPicklistOptions: true } : {}),
|
|
208
209
|
orgRefs: ctx.orgRefs,
|
|
209
210
|
workspaceAspects: ctx.workspaceAspects,
|
|
@@ -360,7 +360,22 @@ export function aiEmailAnalysis(opts) {
|
|
|
360
360
|
},
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
+
function isFileReaderCatalogRef(value) {
|
|
364
|
+
return (typeof value === "object" &&
|
|
365
|
+
value !== null &&
|
|
366
|
+
value.__kind === "documentModel" &&
|
|
367
|
+
typeof value.refName === "string");
|
|
368
|
+
}
|
|
369
|
+
function isUnresolvedFileReaderPlaceholder(value) {
|
|
370
|
+
return typeof value === "string";
|
|
371
|
+
}
|
|
372
|
+
function assertFileReaderReference(value, taskName) {
|
|
373
|
+
if (isFileReaderCatalogRef(value) || isUnresolvedFileReaderPlaceholder(value))
|
|
374
|
+
return;
|
|
375
|
+
throw new Error(`${taskName} requires a FileReaderCatalogRef or an unresolved pulled placeholder.`);
|
|
376
|
+
}
|
|
363
377
|
export function aiFileAnalysis(opts) {
|
|
378
|
+
assertFileReaderReference(opts.documentModel, "aiFileAnalysis");
|
|
364
379
|
return {
|
|
365
380
|
key: "aiFileAnalysis",
|
|
366
381
|
config: {
|
|
@@ -715,6 +730,7 @@ export function runAutomation(opts) {
|
|
|
715
730
|
};
|
|
716
731
|
}
|
|
717
732
|
export function readFile(opts) {
|
|
733
|
+
assertFileReaderReference(opts.fileReader, "readFile");
|
|
718
734
|
return {
|
|
719
735
|
key: "documentModel",
|
|
720
736
|
config: {
|
|
@@ -727,6 +743,7 @@ export function readFile(opts) {
|
|
|
727
743
|
export function bulkExcel(opts) {
|
|
728
744
|
if (opts.fieldMappings.length === 0)
|
|
729
745
|
throw new Error("bulkExcel requires at least one fieldMapping.");
|
|
746
|
+
assertFileReaderReference(opts.documentModel, "bulkExcel");
|
|
730
747
|
return {
|
|
731
748
|
key: "bulkExcel",
|
|
732
749
|
config: {
|
|
@@ -18,6 +18,14 @@ export interface AutomationToTfContext {
|
|
|
18
18
|
* typed against a DIFFERENT aspect resolve cross-app refs (#490).
|
|
19
19
|
*/
|
|
20
20
|
readonly fieldNamesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
21
|
+
/**
|
|
22
|
+
* Field resource ADDRESSES for every app/element in this build, keyed the
|
|
23
|
+
* same way as {@link fieldNamesByAppRefName}. The calc engine addresses a
|
|
24
|
+
* found record's field by field id rather than display name, so a
|
|
25
|
+
* cross-aspect `recordSearch` output used inside a calculation needs the
|
|
26
|
+
* searched aspect's own `<resource>.<label>.id` to interpolate.
|
|
27
|
+
*/
|
|
28
|
+
readonly fieldAddressesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
21
29
|
/** Build-time tolerance for stale labels retained by pulled automations. */
|
|
22
30
|
readonly allowUnknownPicklistOptions?: boolean;
|
|
23
31
|
readonly orgRefs?: OrgRefLookup;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EntityTfError, recordFieldContextOf } from "../../engine/entity.js";
|
|
2
2
|
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEY_SET } from "../../core/system-fields.js";
|
|
3
3
|
import { isUnsafePlatformId } from "../../core/platform-id.js";
|
|
4
|
-
import { appResourceLabelPrefix, appScopedResourceLabel, expr, isTfExpr, isUuid, sanitizeName, scopedResourceLabel,
|
|
4
|
+
import { appResourceLabelPrefix, appScopedResourceLabel, expr, isTfExpr, isUuid, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
5
5
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
6
6
|
import { SEARCH_TABLE_RESOURCE_TYPES } from "../search-table/types.js";
|
|
7
7
|
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
@@ -58,6 +58,7 @@ const TRIGGER_RESOURCES = {
|
|
|
58
58
|
approvalChain: "elementum_approval_chain_trigger",
|
|
59
59
|
datamine: "elementum_datamine_trigger",
|
|
60
60
|
survey: "elementum_survey_trigger",
|
|
61
|
+
schedule: "elementum_schedule_trigger",
|
|
61
62
|
};
|
|
62
63
|
/**
|
|
63
64
|
* setVariable tasks share one wire key ("variable") but two distinct
|
|
@@ -564,7 +565,12 @@ function tokenToTf(value, ctx, dataBlocks) {
|
|
|
564
565
|
}
|
|
565
566
|
else {
|
|
566
567
|
const tableLabel = tsLabelToTfLabel(value.parent);
|
|
567
|
-
|
|
568
|
+
// value.parent is the table's refName, not its display name - the
|
|
569
|
+
// platform's data.elementum_table lookup keys by name, so a
|
|
570
|
+
// catalog-carried parentName (same escape FieldRef/TableColumnRef
|
|
571
|
+
// already use) must win when present, or the lookup 404s with the
|
|
572
|
+
// camelCase refName instead of the real table name.
|
|
573
|
+
const tableName = typeof value.parentName === "string" && value.parentName !== "" ? value.parentName : value.parent;
|
|
568
574
|
if (ctx.orgRefs !== undefined) {
|
|
569
575
|
ctx.orgRefs.rawLookup(TABLE_RESOURCE_TYPE, tableLabel, tableName);
|
|
570
576
|
}
|
|
@@ -882,28 +888,86 @@ function calculationFormulaRefToParts(value, refs) {
|
|
|
882
888
|
throw new EntityTfError("calculation formula is not a trigger/task/variable ref, literal, or template");
|
|
883
889
|
}
|
|
884
890
|
/**
|
|
885
|
-
* Calc-engine mustache for a prior task output
|
|
886
|
-
* `{{task name="<
|
|
887
|
-
*
|
|
891
|
+
* Calc-engine mustache for a prior task output:
|
|
892
|
+
* `{{task name="<reference name>" id="<task-id>"}}`, with the task id
|
|
893
|
+
* interpolated from the task resource.
|
|
894
|
+
*
|
|
895
|
+
* `name` is the WorkflowTaskReference's own name, NOT the Terraform
|
|
896
|
+
* `refs[…]` map key. Mobius parses this mustache itself
|
|
897
|
+
* (`CalcParamVisitor#visitCalculatedParameter` → `ValueReference
|
|
898
|
+
* .ofTaskReference(id, name)`) and then resolves the reference against the
|
|
899
|
+
* workflow's available refs; an unknown name throws `paramNotFound` and the
|
|
900
|
+
* whole task create fails with "Unable to validate". The refs-map key is a
|
|
901
|
+
* localized DISPLAY label from mobius' `shared.json` bundle ("Records Size",
|
|
902
|
+
* "Triage SLA (business days)") and never resolves here.
|
|
888
903
|
*/
|
|
889
|
-
function calculationTaskMustache(taskRefKey,
|
|
890
|
-
if (
|
|
891
|
-
throw new EntityTfError(`calculation task output name "${
|
|
904
|
+
function calculationTaskMustache(taskRefKey, name, refs) {
|
|
905
|
+
if (name.includes('"')) {
|
|
906
|
+
throw new EntityTfError(`calculation task output name "${name}" contains a double quote`);
|
|
892
907
|
}
|
|
893
908
|
const target = refs.tasks.get(taskRefKey);
|
|
894
909
|
if (target === undefined) {
|
|
895
910
|
refs.owner.diagnostics.push(`automation unresolved task ref ${JSON.stringify(taskRefKey)} preserved as a literal calculation reference`);
|
|
896
|
-
return [`{{task name="${
|
|
897
|
-
}
|
|
898
|
-
if (wireName.includes('"')) {
|
|
899
|
-
throw new EntityTfError(`calculation task output name "${wireName}" contains a double quote`);
|
|
911
|
+
return [`{{task name="${name}" id="${taskRefKey}"}}`];
|
|
900
912
|
}
|
|
901
913
|
return [
|
|
902
|
-
|
|
914
|
+
'{{task name="',
|
|
915
|
+
...calculationTaskRefName(target.type, name, taskRefKey, refs),
|
|
916
|
+
'" id="',
|
|
903
917
|
expr.resourceAttr(target.type, target.label, ["id"]),
|
|
904
918
|
`"}}`,
|
|
905
919
|
];
|
|
906
920
|
}
|
|
921
|
+
/**
|
|
922
|
+
* Task-own outputs whose calc-engine reference name differs from the
|
|
923
|
+
* refs-map key. Keys are the display labels the refs map uses (and that
|
|
924
|
+
* `build.ts`'s `rewriteForwardTaskRefName` already rewrote authoring names
|
|
925
|
+
* into); values are the underlying reference names — captured live with
|
|
926
|
+
* `ei refs --from-remote` against a real record-search task, and matching
|
|
927
|
+
* mobius' `shared.json` `aspect_records_search` label table.
|
|
928
|
+
*/
|
|
929
|
+
const CALCULATION_TASK_OUTPUT_REF_NAME = {
|
|
930
|
+
elementum_record_search_task: {
|
|
931
|
+
"Records Size": "count",
|
|
932
|
+
"First found record id": "recordId",
|
|
933
|
+
},
|
|
934
|
+
};
|
|
935
|
+
function calculationTaskRefName(targetType, name, taskRefKey, refs) {
|
|
936
|
+
const segments = name.split(".");
|
|
937
|
+
if (segments[0] === "record" && segments.length >= 2) {
|
|
938
|
+
const suffix = segments.slice(2).join(".");
|
|
939
|
+
return [
|
|
940
|
+
"record.",
|
|
941
|
+
calculationRecordFieldId(segments[1], calculationFieldScope(taskRefKey, refs)),
|
|
942
|
+
suffix.length > 0 ? `.${suffix}` : "",
|
|
943
|
+
];
|
|
944
|
+
}
|
|
945
|
+
const refName = CALCULATION_TASK_OUTPUT_REF_NAME[targetType]?.[name] ?? name;
|
|
946
|
+
if (refName.includes('"')) {
|
|
947
|
+
throw new EntityTfError(`calculation task output name "${refName}" contains a double quote`);
|
|
948
|
+
}
|
|
949
|
+
return [refName];
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* The aspect whose fields a task's `record.<field>` output belongs to. A
|
|
953
|
+
* cross-aspect `recordSearch` reads the SEARCHED aspect's fields, and the
|
|
954
|
+
* calc engine wants their ids, so that aspect must be part of this build —
|
|
955
|
+
* a `data.elementum_app` stub carries display names but no field resources.
|
|
956
|
+
*/
|
|
957
|
+
function calculationFieldScope(taskRefKey, refs) {
|
|
958
|
+
const taskApp = refs.recordFieldContext?.taskAppRefNameByRefKey?.[taskRefKey];
|
|
959
|
+
if (taskApp === undefined || taskApp === refs.owner.appRefName)
|
|
960
|
+
return refs.owner;
|
|
961
|
+
const fieldAddresses = refs.fieldAddressesByAppRefName?.get(taskApp);
|
|
962
|
+
if (fieldAddresses === undefined) {
|
|
963
|
+
throw new EntityTfError(`automation calculation reads a field of "${taskApp}", but that app/element is not authored in ` +
|
|
964
|
+
`this workspace — the calc engine addresses a found record's field by field id, which only a ` +
|
|
965
|
+
`built aspect can supply`);
|
|
966
|
+
}
|
|
967
|
+
const aspect = refs.owner.workspaceAspects?.get(workspaceAspectKey("app", taskApp))
|
|
968
|
+
?? refs.owner.workspaceAspects?.get(workspaceAspectKey("element", taskApp));
|
|
969
|
+
return { appRefName: taskApp, appTfLabel: aspect?.tfLabel ?? refs.owner.appTfLabel, fieldAddresses };
|
|
970
|
+
}
|
|
907
971
|
function calculationTriggerMustache(name, refs) {
|
|
908
972
|
const parts = name.split(".");
|
|
909
973
|
if (parts[0] !== "record" || parts.length < 2) {
|
|
@@ -914,22 +978,22 @@ function calculationTriggerMustache(name, refs) {
|
|
|
914
978
|
const suffixPart = suffix.length > 0 ? `.${suffix}` : "";
|
|
915
979
|
return [
|
|
916
980
|
'{{trigger name="record.',
|
|
917
|
-
calculationRecordFieldId(fieldKey, refs),
|
|
981
|
+
calculationRecordFieldId(fieldKey, refs.owner),
|
|
918
982
|
`${suffixPart}"}}`,
|
|
919
983
|
];
|
|
920
984
|
}
|
|
921
|
-
function calculationRecordFieldId(fieldKey,
|
|
985
|
+
function calculationRecordFieldId(fieldKey, scope) {
|
|
922
986
|
if (fieldKey.startsWith(UNRESOLVED_FIELD_MARKER))
|
|
923
987
|
return fieldKey.slice(UNRESOLVED_FIELD_MARKER.length);
|
|
924
988
|
if (isUuid(fieldKey))
|
|
925
989
|
return fieldKey;
|
|
926
|
-
const address =
|
|
990
|
+
const address = scope.fieldAddresses.get(fieldKey);
|
|
927
991
|
if (address !== undefined)
|
|
928
992
|
return addressExpr(address, ["id"]);
|
|
929
993
|
if (SYSTEM_FIELD_KEY_SET.has(fieldKey)) {
|
|
930
|
-
return expr.local(`${
|
|
994
|
+
return expr.local(`${scope.appTfLabel}_${tsLabelToTfLabel(fieldKey)}_field_id`);
|
|
931
995
|
}
|
|
932
|
-
throw new EntityTfError(`automation calculation targets field "${fieldKey}" which does not exist in app "${
|
|
996
|
+
throw new EntityTfError(`automation calculation targets field "${fieldKey}" which does not exist in app "${scope.appRefName}"`);
|
|
933
997
|
}
|
|
934
998
|
function flattenAdjacentFormulaParts(parts) {
|
|
935
999
|
const out = [];
|
|
@@ -1112,6 +1176,39 @@ function taskWireRefName(name, taskRefKey, refs) {
|
|
|
1112
1176
|
fieldNames: foreignNames ?? new Map(),
|
|
1113
1177
|
});
|
|
1114
1178
|
}
|
|
1179
|
+
/**
|
|
1180
|
+
* The platform refs-map key for one task output, given the emitting task's
|
|
1181
|
+
* resource type. Shared by `refs[…]` inputs and calculation mustaches so both
|
|
1182
|
+
* dialects address the same output the same way.
|
|
1183
|
+
*
|
|
1184
|
+
* aiFileAnalysis/readFile's refs are keyed by whatever arbitrary field names
|
|
1185
|
+
* the file reader schema itself defines (e.g. "title", "document_type") -
|
|
1186
|
+
* wireRefName's generic segment table (TS_REF_SEGMENT_TO_WIRE) is for a
|
|
1187
|
+
* DIFFERENT thing (a task's own canonical record-identity fields, e.g.
|
|
1188
|
+
* createRecord's generic "id"/"title"), and wrongly rewrites a reader field
|
|
1189
|
+
* literally named "title" into the wire key "Title", which doesn't exist in
|
|
1190
|
+
* these two resources' actual refs map - confirmed live via a real apply's
|
|
1191
|
+
* "Invalid index" error. Their field names pass through verbatim.
|
|
1192
|
+
*/
|
|
1193
|
+
function taskOutputWireRefKey(targetType, name, taskRefKey, refs) {
|
|
1194
|
+
if (targetType === "elementum_ai_file_read_task" || targetType === "elementum_file_reader_task")
|
|
1195
|
+
return name;
|
|
1196
|
+
if (targetType === "elementum_ai_agent_task")
|
|
1197
|
+
return name;
|
|
1198
|
+
// aiSearchTable's collection is `refs["All Records"]`, not recordSearch's
|
|
1199
|
+
// globally-mapped `refs["All found records"]` (TS_REF_SEGMENT_TO_WIRE).
|
|
1200
|
+
// Accept both the authoring segment and the already-rewritten wire name
|
|
1201
|
+
// from rewriteForwardTaskRefName so either path emits the same key.
|
|
1202
|
+
if (targetType === "elementum_ai_search_table_task" && (name === "records" || name === "All Records")) {
|
|
1203
|
+
return "All Records";
|
|
1204
|
+
}
|
|
1205
|
+
// tableRecordsSearch uses yet another wire key: "All matching table rows".
|
|
1206
|
+
if (targetType === "elementum_table_records_search_task" &&
|
|
1207
|
+
(name === "records" || name === "All matching table rows")) {
|
|
1208
|
+
return "All matching table rows";
|
|
1209
|
+
}
|
|
1210
|
+
return taskWireRefName(name, taskRefKey, refs);
|
|
1211
|
+
}
|
|
1115
1212
|
function triggerWireRefName(name, refs) {
|
|
1116
1213
|
const scalarParams = refs.triggerParamNames.filter((param) => !refs.recordParamNames.includes(param));
|
|
1117
1214
|
const declared = onDemandTriggerRefKey(name, scalarParams);
|
|
@@ -1230,6 +1327,32 @@ function workflowPublishOutputEnvelope(value, refs) {
|
|
|
1230
1327
|
}
|
|
1231
1328
|
if (isObject(value.variableReference)) {
|
|
1232
1329
|
const id = typeof value.variableReference.id === "string" ? value.variableReference.id : undefined;
|
|
1330
|
+
// A freshly-authored `ctx.variables[...]` reference carries the SAME
|
|
1331
|
+
// randomUUID `stampAndCollectVariableIds` just minted for this build's
|
|
1332
|
+
// own `elementum_variable_task` create entry — that id is never the
|
|
1333
|
+
// variable's real (deploy-time-assigned) platform id, so baking it in as
|
|
1334
|
+
// a literal string here always mismatches live state on the very next
|
|
1335
|
+
// plan. Interpolate the live resource instead.
|
|
1336
|
+
//
|
|
1337
|
+
// `elementum_variable_task` carries TWO platform ids: `id` is the TASK's
|
|
1338
|
+
// id, `variable_id` is the id of the variable that task creates. A
|
|
1339
|
+
// publish output addresses the VARIABLE, so it must interpolate
|
|
1340
|
+
// `variable_id`. This differs from taskReference's `taskId:
|
|
1341
|
+
// expr.resourceAttr(...)` treatment just above, which does want `.id`.
|
|
1342
|
+
//
|
|
1343
|
+
// Sending the task id instead fails at the PUBLISH step
|
|
1344
|
+
// ("Failed to publish workflow"). The emitted shape stays
|
|
1345
|
+
// `{ name = "variable|<id>" }` with no sibling `id`, byte-identical to
|
|
1346
|
+
// ei's export — the provider recovers the id from the name when it builds
|
|
1347
|
+
// VariableReferenceInput (workflow_publish_resource.go).
|
|
1348
|
+
const target = id !== undefined ? refs.variableById.get(id) : undefined;
|
|
1349
|
+
if (target !== undefined) {
|
|
1350
|
+
return {
|
|
1351
|
+
taskReference: null,
|
|
1352
|
+
triggerReference: null,
|
|
1353
|
+
variableReference: { name: expr.template(["variable|", expr.resourceAttr(target.type, target.label, ["variable_id"])]) },
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1233
1356
|
const name = typeof value.variableReference.name === "string" ? value.variableReference.name : undefined;
|
|
1234
1357
|
// ei export / pull shape: `variableReference = { name = "variable|<uuid>" }`
|
|
1235
1358
|
// with sibling null refs — not fieldType+id. Prefer that wire form.
|
|
@@ -1316,33 +1439,7 @@ function valueToTf(value, refs) {
|
|
|
1316
1439
|
refs.owner.diagnostics.push(`automation unresolved task ref ${JSON.stringify(value.taskReference.taskRefKey)} preserved as a literal reference`);
|
|
1317
1440
|
return `{{task name="${value.taskReference.name}" id="${value.taskReference.taskRefKey}"}}`;
|
|
1318
1441
|
}
|
|
1319
|
-
|
|
1320
|
-
// names the file reader schema itself defines (e.g. "title",
|
|
1321
|
-
// "document_type") - wireRefName's generic segment table
|
|
1322
|
-
// (TS_REF_SEGMENT_TO_WIRE) is for a DIFFERENT thing (a task's own
|
|
1323
|
-
// canonical record-identity fields, e.g. createRecord's generic "id"/
|
|
1324
|
-
// "title"), and wrongly rewrites a reader field literally named "title"
|
|
1325
|
-
// into the wire key "Title", which doesn't exist in these two
|
|
1326
|
-
// resources' actual refs map - confirmed live via a real apply's
|
|
1327
|
-
// "Invalid index" error. Their field names pass through verbatim.
|
|
1328
|
-
const isFileReaderTask = target.type === "elementum_ai_file_read_task" || target.type === "elementum_file_reader_task";
|
|
1329
|
-
const isAiAgentTask = target.type === "elementum_ai_agent_task";
|
|
1330
|
-
// aiSearchTable's collection is `refs["All Records"]`, not recordSearch's
|
|
1331
|
-
// globally-mapped `refs["All found records"]` (TS_REF_SEGMENT_TO_WIRE).
|
|
1332
|
-
// Accept both the authoring segment and the already-rewritten wire name
|
|
1333
|
-
// from rewriteForwardTaskRefName so either path emits the same key.
|
|
1334
|
-
const isAiSearchTableRecords = target.type === "elementum_ai_search_table_task" &&
|
|
1335
|
-
(value.taskReference.name === "records" || value.taskReference.name === "All Records");
|
|
1336
|
-
// tableRecordsSearch uses yet another wire key: "All matching table rows".
|
|
1337
|
-
const isTableRecordsSearchRecords = target.type === "elementum_table_records_search_task" &&
|
|
1338
|
-
(value.taskReference.name === "records" || value.taskReference.name === "All matching table rows");
|
|
1339
|
-
const refKey = isFileReaderTask || isAiAgentTask
|
|
1340
|
-
? value.taskReference.name
|
|
1341
|
-
: isAiSearchTableRecords
|
|
1342
|
-
? "All Records"
|
|
1343
|
-
: isTableRecordsSearchRecords
|
|
1344
|
-
? "All matching table rows"
|
|
1345
|
-
: taskWireRefName(value.taskReference.name, value.taskReference.taskRefKey, refs);
|
|
1442
|
+
const refKey = taskOutputWireRefKey(target.type, value.taskReference.name, value.taskReference.taskRefKey, refs);
|
|
1346
1443
|
return expr.resourceAttr(target.type, target.label, ["refs", { index: refKey }]);
|
|
1347
1444
|
}
|
|
1348
1445
|
if (isObject(value.forEachReference) && typeof value.forEachReference.forEachTaskRefKey === "string" && typeof value.forEachReference.name === "string") {
|
|
@@ -1635,6 +1732,15 @@ function configAttrs(kind, config, refs) {
|
|
|
1635
1732
|
for (const [key, raw] of Object.entries(config)) {
|
|
1636
1733
|
if (key === "name" || key === "type" || key === "aspectId" && kind.endsWith("_trigger"))
|
|
1637
1734
|
continue;
|
|
1735
|
+
// Authoring-only schedule envelope (rrule / dtStart). The provider HCL
|
|
1736
|
+
// contract owns frequency/interval/timezone/start_at/weekdays/day_of_month
|
|
1737
|
+
// — the same fields WorkflowScheduleTriggerInput accepts.
|
|
1738
|
+
if (kind === "elementum_schedule_trigger" && (key === "rrule" || key === "dtStart"))
|
|
1739
|
+
continue;
|
|
1740
|
+
// interval defaults to 1 on the provider (Optional+Computed). Omit the
|
|
1741
|
+
// default so build matches export's omit-when-1 convention.
|
|
1742
|
+
if (kind === "elementum_schedule_trigger" && key === "interval" && raw === 1)
|
|
1743
|
+
continue;
|
|
1638
1744
|
// A config value of exactly `undefined` almost always means the
|
|
1639
1745
|
// authoring builder was called with a required option omitted (e.g. a
|
|
1640
1746
|
// TS-only-enforced field that no runtime actually type-checks at
|
|
@@ -2216,6 +2322,7 @@ export function automationToTf(entity, ctx) {
|
|
|
2216
2322
|
variableById,
|
|
2217
2323
|
...(recordFieldContext !== undefined ? { recordFieldContext } : {}),
|
|
2218
2324
|
...(ctx.fieldNamesByAppRefName !== undefined ? { fieldNamesByAppRefName: ctx.fieldNamesByAppRefName } : {}),
|
|
2325
|
+
...(ctx.fieldAddressesByAppRefName !== undefined ? { fieldAddressesByAppRefName: ctx.fieldAddressesByAppRefName } : {}),
|
|
2219
2326
|
...(ctx.allowUnknownPicklistOptions === true ? { allowUnknownPicklistOptions: true } : {}),
|
|
2220
2327
|
};
|
|
2221
2328
|
let triggerAttrs;
|
|
@@ -2424,7 +2531,7 @@ export function automationToTf(entity, ctx) {
|
|
|
2424
2531
|
// (a default branch renamed "Default Path" exports as
|
|
2425
2532
|
// "..._default_path", not a hardcoded "..._default") - confirmed live.
|
|
2426
2533
|
const fallbackLabel = isDefault ? "default" : `branch_${index + 1}`;
|
|
2427
|
-
const branchLabel = `${tfLabel}_${
|
|
2534
|
+
const branchLabel = `${tfLabel}_${sanitizeName(child.label ?? child.defaultLabel ?? fallbackLabel)}`;
|
|
2428
2535
|
const branchAttrs = {
|
|
2429
2536
|
[wireType === "switch" ? "switch_task" : "fork_join_task"]: address,
|
|
2430
2537
|
...(isDefault
|
|
@@ -35,6 +35,7 @@ export const TRIGGER_SUB_TYPES = [
|
|
|
35
35
|
{ typeKey: "conversationEnd", resourceType: "elementum_agent_conversation_ended_trigger", implemented: true },
|
|
36
36
|
{ typeKey: "slackMessage", resourceType: "elementum_slack_message_trigger", implemented: true },
|
|
37
37
|
{ typeKey: "survey", resourceType: "elementum_survey_trigger", implemented: true },
|
|
38
|
+
{ typeKey: "schedule", resourceType: "elementum_schedule_trigger", implemented: true },
|
|
38
39
|
];
|
|
39
40
|
/**
|
|
40
41
|
* Task kinds. All rows are implemented as of `aiFileAnalysis` (the last
|
|
@@ -7,6 +7,7 @@ import { DASHBOARD_WIDGET_RESOURCE_TYPE } from "../dashboard-widget/module.js";
|
|
|
7
7
|
import { DASHBOARD_RESOURCE_TYPE } from "./module.js";
|
|
8
8
|
import { CHART_RESOURCE_TYPE } from "../chart/types.js";
|
|
9
9
|
import { dashboardWidgetSize } from "./build.js";
|
|
10
|
+
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
10
11
|
const KNOWN_DASHBOARD_ATTRS = new Set(["name", "owner_id", "owner_type", "favorite", "tags"]);
|
|
11
12
|
export function dashboardsFromTf(blocks, widgetBlocks, owner, ctx) {
|
|
12
13
|
const dashboards = [];
|
|
@@ -93,8 +94,16 @@ function aspectRef(value, owner, ctx) {
|
|
|
93
94
|
if (resourceLabel !== undefined)
|
|
94
95
|
return { kind, key: tfLabelToTsLabel(resourceLabel), name: tfLabelToTsLabel(resourceLabel) };
|
|
95
96
|
const dataLabel = dataRefLabel(value, type);
|
|
96
|
-
if (dataLabel !== undefined)
|
|
97
|
-
|
|
97
|
+
if (dataLabel !== undefined) {
|
|
98
|
+
// Same namespace-only foreign-target shape widget/from-tf.ts resolves
|
|
99
|
+
// via the shared helper - a guessed tfLabel-derived name matches
|
|
100
|
+
// nothing on the platform and breaks elementum build/plan.
|
|
101
|
+
// printDashboardTargetRef always emits appRef()/elementRef() regardless
|
|
102
|
+
// of provenance, so catalogRef (widget's raw-literal-vs-factory-call
|
|
103
|
+
// switch) has no printer to gate here - only key/name/namespace matter.
|
|
104
|
+
const resolved = resolveDataAspectTarget(ctx, kind, dataLabel);
|
|
105
|
+
return { kind, key: resolved.key, name: resolved.name, ...(resolved.namespace !== undefined ? { namespace: resolved.namespace } : {}) };
|
|
106
|
+
}
|
|
98
107
|
}
|
|
99
108
|
return undefined;
|
|
100
109
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppOrElementRef, AutomationRef } from "../../catalog/index.js";
|
|
1
|
+
import type { AgentRef, AppOrElementRef, AutomationRef } from "../../catalog/index.js";
|
|
2
2
|
import type { AppViewFieldRef } from "../app/build.js";
|
|
3
3
|
export type DynamicLayoutTypedValue = {
|
|
4
4
|
readonly string: string;
|
|
@@ -78,6 +78,7 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
78
78
|
readonly icon?: string;
|
|
79
79
|
readonly color?: string;
|
|
80
80
|
readonly collapsible?: boolean;
|
|
81
|
+
readonly agent?: AgentRef;
|
|
81
82
|
readonly defaultCollapsed?: boolean;
|
|
82
83
|
readonly hidden?: boolean;
|
|
83
84
|
readonly className?: string;
|
|
@@ -2,3 +2,11 @@ export declare const DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY: Read
|
|
|
2
2
|
export declare const DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS: ReadonlySet<string>;
|
|
3
3
|
export declare function dynamicLayoutFieldComponentWireKey(publicKey: string): string;
|
|
4
4
|
export declare const DYNAMIC_LAYOUT_COMPARISON_KEYS: ReadonlySet<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Dynamic-layout automation buttons are runnable only after a parameterless
|
|
7
|
+
* run-automation display widget exists for the selected automation. App Admin
|
|
8
|
+
* creates that widget as a save side effect; EDK emits an explicit companion
|
|
9
|
+
* resource instead so OpenTofu owns the complete contract.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DYNAMIC_LAYOUT_ACTION_WIDGET_NAME_PREFIX = "EDK dynamic layout action ";
|
|
12
|
+
export declare function dynamicLayoutActionWidgetName(layoutKey: string, componentId: string): string;
|