@elementumai/edk 0.9.14 → 0.9.16
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/pull/util.d.ts +0 -15
- package/dist-sdk/pull/util.js +44 -5
- package/dist-sdk/src/catalog/factories.d.ts +4 -2
- package/dist-sdk/src/catalog/factories.js +4 -0
- package/dist-sdk/src/catalog/from-authoring.js +5 -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 +2 -2
- package/dist-sdk/src/catalog/types.d.ts +7 -2
- package/dist-sdk/src/core/types/app.d.ts +4 -4
- package/dist-sdk/src/engine/build/context.d.ts +5 -4
- package/dist-sdk/src/engine/build/source-context.d.ts +2 -0
- package/dist-sdk/src/engine/build/source-context.js +16 -0
- package/dist-sdk/src/engine/progress.d.ts +19 -1
- package/dist-sdk/src/engine/progress.js +33 -5
- package/dist-sdk/src/engine/pull/context.d.ts +9 -1
- package/dist-sdk/src/engine/pull/ref-only.d.ts +6 -2
- package/dist-sdk/src/engine/pull/ref-only.js +14 -3
- package/dist-sdk/src/engine/workspace/loader.js +23 -2
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +47 -12
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +5 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +23 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +6 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +50 -4
- package/dist-sdk/src/entities/agent/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/agent/from-tf.js +18 -3
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.js +15 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +98 -5
- package/dist-sdk/src/entities/agent/tools.js +12 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +47 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +9 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +82 -25
- package/dist-sdk/src/entities/app/build.d.ts +2 -2
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +4 -4
- package/dist-sdk/src/entities/app/module.js +8 -0
- package/dist-sdk/src/entities/app/to-tf.js +1 -0
- package/dist-sdk/src/entities/approval-chain/build.d.ts +8 -1
- package/dist-sdk/src/entities/approval-chain/build.js +3 -0
- package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +2 -1
- package/dist-sdk/src/entities/approval-chain/from-tf.js +20 -7
- package/dist-sdk/src/entities/approval-chain/printer.js +13 -2
- package/dist-sdk/src/entities/approval-chain/to-tf.js +3 -0
- package/dist-sdk/src/entities/automation/build.d.ts +19 -12
- package/dist-sdk/src/entities/automation/build.js +36 -13
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +4 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +19 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +222 -65
- package/dist-sdk/src/entities/automation/from-tf.d.ts +86 -6
- package/dist-sdk/src/entities/automation/from-tf.js +360 -63
- package/dist-sdk/src/entities/automation/index.d.ts +3 -2
- package/dist-sdk/src/entities/automation/index.js +3 -2
- package/dist-sdk/src/entities/automation/module.js +21 -16
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +5 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +12 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +22 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +32 -0
- package/dist-sdk/src/entities/automation/script-code.js +72 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +60 -24
- package/dist-sdk/src/entities/automation/tasks.js +33 -14
- package/dist-sdk/src/entities/automation/to-tf.d.ts +0 -2
- package/dist-sdk/src/entities/automation/to-tf.js +123 -46
- package/dist-sdk/src/entities/automation/triggers.d.ts +5 -2
- package/dist-sdk/src/entities/automation/types.d.ts +2 -0
- package/dist-sdk/src/entities/automation/types.js +5 -0
- package/dist-sdk/src/entities/automation/workflow-output.d.ts +35 -0
- package/dist-sdk/src/entities/automation/workflow-output.js +53 -0
- package/dist-sdk/src/entities/chart/build.d.ts +3 -3
- package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
- package/dist-sdk/src/entities/chart/from-tf.js +20 -13
- package/dist-sdk/src/entities/chart/to-tf.js +7 -5
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dashboard/to-tf.js +1 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +3 -2
- package/dist-sdk/src/entities/element/build.d.ts +11 -8
- package/dist-sdk/src/entities/element/build.js +14 -5
- package/dist-sdk/src/entities/element/locals.d.ts +2 -2
- package/dist-sdk/src/entities/element/locals.js +6 -2
- package/dist-sdk/src/entities/element/system-fields.d.ts +4 -0
- package/dist-sdk/src/entities/element/system-fields.js +12 -0
- package/dist-sdk/src/entities/element/to-tf.js +1 -0
- package/dist-sdk/src/entities/field/build.d.ts +2 -2
- package/dist-sdk/src/entities/field/from-tf.js +82 -4
- package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/field/to-tf.js +11 -4
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -2
- package/dist-sdk/src/entities/relationship/from-tf.js +8 -5
- package/dist-sdk/src/entities/relationship/to-tf.js +13 -3
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -6
- package/dist-sdk/src/entities/search-table/module.js +2 -2
- package/dist-sdk/src/entities/search-table/types.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +3 -3
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +10 -6
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +4 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +12 -2
- package/dist-sdk/src/entities/shared/filters/index.js +17 -1
- package/dist-sdk/src/entities/shared/filters/print.js +25 -11
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +39 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +6 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +47 -18
- package/dist-sdk/src/entities/skill/module.js +10 -0
- package/dist-sdk/src/entities/skill/to-tf.js +19 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +29 -7
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +18 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +77 -4
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +90 -46
- package/dist-sdk/src/entities/task/module.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.js +30 -9
- package/dist-sdk/src/entities/view/to-tf.js +18 -10
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.js +1 -0
- package/dist-sdk/src/graph/index.d.ts +15 -0
- package/dist-sdk/src/graph/index.js +19 -0
- package/dist-sdk/src/graph/types.d.ts +37 -1
- package/package.json +2 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { EntityTfError } from "../../engine/entity.js";
|
|
8
8
|
import { dataRefLabel, optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
9
|
-
import { isTfExpr, scopedLabelToBagKey, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
9
|
+
import { isTfExpr, sanitizeName, scopedLabelToBagKey, scopedResourceLabel, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
10
10
|
import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
|
|
11
11
|
import { dataAspectDisplayName } from "../shared/aspect-target-from-tf.js";
|
|
12
12
|
import { KNOWN_TOOL_ATTRS, TOOL_SUB_TYPE_BY_RESOURCE } from "./types.js";
|
|
@@ -276,8 +276,23 @@ export function toolFromTf(block, owner, ctx) {
|
|
|
276
276
|
else if (rawReturnFields !== undefined) {
|
|
277
277
|
ctx.diagnostics.push(`${where}: return_fields is not a list; dropped`);
|
|
278
278
|
}
|
|
279
|
+
// The provider schema doesn't validate that `fields`/`return_fields` are
|
|
280
|
+
// exclusive, and its read path can leave a stale `return_fields` on a
|
|
281
|
+
// resource whose `fields` was set later - so a real export CAN carry
|
|
282
|
+
// both, even though only `fields` (the newer, primary dialect) is
|
|
283
|
+
// actually effective. Printing both would emit a call the authoring
|
|
284
|
+
// type rejects (fields/returnFields are a closed either/or union there),
|
|
285
|
+
// failing the pulled workspace's own typecheck for a state the provider
|
|
286
|
+
// itself allows (review feedback, PR #1099, jj-deloitte).
|
|
287
|
+
if (searchTableFields !== undefined && returnFields !== undefined) {
|
|
288
|
+
ctx.diagnostics.push(`${where}: has both fields and return_fields; return_fields is the deprecated dialect and is ineffective once fields is set, so it's dropped`);
|
|
289
|
+
returnFields = undefined;
|
|
290
|
+
}
|
|
279
291
|
let searchTableKey;
|
|
280
292
|
let searchTableName;
|
|
293
|
+
let searchTableOwnerName;
|
|
294
|
+
let searchTableOwnerRefName;
|
|
295
|
+
let searchTableRawId;
|
|
281
296
|
if (subType.typeKey === "searchTable") {
|
|
282
297
|
const value = attrs["search_table_id"];
|
|
283
298
|
const resourceTypes = ["elementum_ai_search_table", "elementum_linked_ai_search_table", "elementum_table_search_table"];
|
|
@@ -289,18 +304,42 @@ export function toolFromTf(block, owner, ctx) {
|
|
|
289
304
|
// carries the `elements_<ns>_` prefix — decoding it with app scope leaves
|
|
290
305
|
// the prefix in place and camel-cases the whole label into a bag key that
|
|
291
306
|
// matches nothing. The table variant keeps its existing app-scope
|
|
292
|
-
// handling
|
|
293
|
-
// modelled end to end yet.
|
|
307
|
+
// handling.
|
|
294
308
|
const scope = matched.type === "elementum_table_search_table" ? "app" : "element";
|
|
295
309
|
searchTableKey = scopedLabelToBagKey(owner.ownerTfLabel, matched.label, scope);
|
|
296
310
|
}
|
|
297
311
|
else if (isTfExpr(value) && value.$expr === "data-attr" && value.type === "elementum_search_table") {
|
|
298
312
|
searchTableName = ctx.dataName(value.type, value.label);
|
|
313
|
+
// The generic search-table data source is used for both aspect-owned
|
|
314
|
+
// and table-owned tables. The presence of table_id is the only
|
|
315
|
+
// portable discriminator available in the HCL stream (mirrors
|
|
316
|
+
// skill-tool/from-tf.ts's identical handling).
|
|
317
|
+
const tableLabel = dataRefLabel(ctx.dataAttrs?.(value.type, value.label)?.["table_id"], "elementum_table");
|
|
318
|
+
if (tableLabel !== undefined) {
|
|
319
|
+
searchTableOwnerName = ctx.dataName("elementum_table", tableLabel);
|
|
320
|
+
if (searchTableOwnerName !== undefined) {
|
|
321
|
+
searchTableOwnerRefName = [...(ctx.foreignTableRefsById?.values() ?? [])].find((identity) => identity.name === searchTableOwnerName)?.tableRefName ?? tfLabelToTsLabel(sanitizeName(searchTableOwnerName));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
299
324
|
if (searchTableName === undefined) {
|
|
300
325
|
ctx.diagnostics.push(`${where}: search_table_id references data.${value.type}.${value.label} without a matching name lookup; skipped`);
|
|
301
326
|
return undefined;
|
|
302
327
|
}
|
|
303
328
|
}
|
|
329
|
+
else if (typeof value === "string" && value !== "") {
|
|
330
|
+
// The search table's own identity couldn't be resolved to a name or a
|
|
331
|
+
// local resource at all - the org-ref layer already fell back to a raw
|
|
332
|
+
// UUID here (live-confirmed on conciergeforfield, sanofi/us: several
|
|
333
|
+
// account-planning tools' search tables have no portable lookup).
|
|
334
|
+
// Round-trip it as unsafePlatformId() instead of silently dropping a
|
|
335
|
+
// live tool - a rebuild-and-plan on the dropped tool would otherwise
|
|
336
|
+
// DESTROY it. Same diagnostic style as aspectTargetFromTf's matching
|
|
337
|
+
// "kept as unresolved" case, so a pull summary surfaces this
|
|
338
|
+
// unmanaged id instead of the tool silently having a stand-in
|
|
339
|
+
// reference the author never sees (review feedback, PR #1099).
|
|
340
|
+
ctx.diagnostics.push(`${where}: search_table_id could not be resolved to a portable reference ("${value}"); kept as unresolved`);
|
|
341
|
+
searchTableRawId = value;
|
|
342
|
+
}
|
|
304
343
|
else {
|
|
305
344
|
ctx.diagnostics.push(`${where}: search_table_id is not a supported search-table reference; skipped`);
|
|
306
345
|
return undefined;
|
|
@@ -337,6 +376,9 @@ export function toolFromTf(block, owner, ctx) {
|
|
|
337
376
|
}),
|
|
338
377
|
...(searchTableKey !== undefined && { searchTableKey }),
|
|
339
378
|
...(searchTableName !== undefined && { searchTableName }),
|
|
379
|
+
...(searchTableOwnerName !== undefined && { searchTableOwnerName }),
|
|
380
|
+
...(searchTableOwnerRefName !== undefined && { searchTableOwnerRefName }),
|
|
381
|
+
...(searchTableRawId !== undefined && { searchTableRawId }),
|
|
340
382
|
};
|
|
341
383
|
}
|
|
342
384
|
function aspectTargetFromTf(value, attrName, owner, ctx, where) {
|
|
@@ -344,12 +386,13 @@ function aspectTargetFromTf(value, attrName, owner, ctx, where) {
|
|
|
344
386
|
ctx.diagnostics.push(`${where}: ${attrName} is missing; skipped`);
|
|
345
387
|
return undefined;
|
|
346
388
|
}
|
|
347
|
-
if (
|
|
389
|
+
if (owner.appLabel !== undefined && resourceRefLabel(value, owner.appType) === owner.appLabel) {
|
|
348
390
|
return { target: { kind: "self" }, fieldScopeLabel: owner.ownerTfLabel, fieldScope: "app" };
|
|
349
391
|
}
|
|
350
392
|
for (const [type, kind, scope] of [
|
|
351
393
|
["elementum_app", "foreignApp", "app"],
|
|
352
394
|
["elementum_element", "foreignElement", "element"],
|
|
395
|
+
["elementum_task", "foreignTask", "task"],
|
|
353
396
|
]) {
|
|
354
397
|
if (!isTfExpr(value) || value.$expr !== "data-attr" || value.type !== type)
|
|
355
398
|
continue;
|
|
@@ -24,6 +24,8 @@ export interface ToolToTfContext {
|
|
|
24
24
|
foreignAppRef(tfLabel: string, name: string, namespace?: string): void;
|
|
25
25
|
/** Records a foreign-ELEMENT data lookup for data.tf (board issue #42). */
|
|
26
26
|
foreignElementRef(tfLabel: string, name: string, namespace?: string): void;
|
|
27
|
+
/** Records a foreign-TASK data lookup for data.tf. */
|
|
28
|
+
foreignTaskRef?(tfLabel: string, name: string, namespace?: string): void;
|
|
27
29
|
foreignAutomationRef?(tfLabel: string, name: string, owner: {
|
|
28
30
|
readonly kind: "app" | "element";
|
|
29
31
|
readonly refName: string;
|
|
@@ -36,6 +38,13 @@ export interface ToolToTfContext {
|
|
|
36
38
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
37
39
|
/** Records an app-scoped service-account lookup by name. */
|
|
38
40
|
serviceAccountRef?(tfLabel: string, name: string): TfValue | void;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a table-owned search table not present in this workspace
|
|
43
|
+
* (`table.parent` names a Table entity with no local `workspaceAspects`
|
|
44
|
+
* entry): records the `data.elementum_table`/`data.elementum_search_table`
|
|
45
|
+
* lookups and returns the search table's id reference.
|
|
46
|
+
*/
|
|
47
|
+
tableSearchTableRef?(tfLabel: string, tableRefName: string, tableName: string, searchTableName: string): TfValue | void;
|
|
39
48
|
/** App-local automations whose publish resource will be emitted in this build. */
|
|
40
49
|
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
41
50
|
/** Degradations land here — reported by the caller, never silent. */
|
|
@@ -51,7 +51,7 @@ function resolveTarget(token, ctx) {
|
|
|
51
51
|
return { value: token.value, refName: token.value, kind: "app" };
|
|
52
52
|
}
|
|
53
53
|
const refName = token.refName ?? "";
|
|
54
|
-
const kind = token.__kind === "element" ? "element" : "app";
|
|
54
|
+
const kind = token.__kind === "element" ? "element" : token.__kind === "task" ? "task" : "app";
|
|
55
55
|
if (kind === "app" && refName === ctx.appRefName) {
|
|
56
56
|
return {
|
|
57
57
|
value: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]),
|
|
@@ -62,7 +62,7 @@ function resolveTarget(token, ctx) {
|
|
|
62
62
|
}
|
|
63
63
|
const sibling = ctx.workspaceAspects?.get(workspaceAspectKey(kind, refName));
|
|
64
64
|
if (sibling !== undefined) {
|
|
65
|
-
const resourceType = kind === "element" ? "elementum_element" : "elementum_app";
|
|
65
|
+
const resourceType = kind === "element" ? "elementum_element" : kind === "task" ? "elementum_task" : "elementum_app";
|
|
66
66
|
return {
|
|
67
67
|
value: expr.resourceAttr(resourceType, sibling.tfLabel, ["id"]),
|
|
68
68
|
refName,
|
|
@@ -80,6 +80,10 @@ function resolveTarget(token, ctx) {
|
|
|
80
80
|
ctx.foreignElementRef(tfLabel, name, token.namespace);
|
|
81
81
|
return { value: expr.dataAttr("elementum_element", tfLabel, ["id"]), refName, kind, foreignTfLabel: tfLabel };
|
|
82
82
|
}
|
|
83
|
+
if (kind === "task") {
|
|
84
|
+
ctx.foreignTaskRef?.(tfLabel, name, token.namespace);
|
|
85
|
+
return { value: expr.dataAttr("elementum_task", tfLabel, ["id"]), refName, kind, foreignTfLabel: tfLabel };
|
|
86
|
+
}
|
|
83
87
|
ctx.foreignAppRef(tfLabel, name, token.namespace);
|
|
84
88
|
return { value: expr.dataAttr("elementum_app", tfLabel, ["id"]), refName, kind, foreignTfLabel: tfLabel };
|
|
85
89
|
}
|
|
@@ -95,7 +99,8 @@ function resolveTarget(token, ctx) {
|
|
|
95
99
|
*/
|
|
96
100
|
function foreignTargetFieldRefValue(token, refName, target, ctx) {
|
|
97
101
|
const fieldName = token.name ?? refName;
|
|
98
|
-
const
|
|
102
|
+
const ownerLabel = target.foreignTfLabel ?? sanitizeName(target.refName);
|
|
103
|
+
const fieldLabel = `${target.kind}_${ownerLabel}_${tsLabelToTfLabel(refName)}`;
|
|
99
104
|
ctx.foreignFieldRef("elementum_field", fieldLabel, target.value, fieldName);
|
|
100
105
|
return expr.dataAttr("elementum_field", fieldLabel, ["id"]);
|
|
101
106
|
}
|
|
@@ -139,7 +144,7 @@ function fieldRefValue(token, where, ctx, target) {
|
|
|
139
144
|
ctx.diagnostics.push(`${where}: field "${refName}" belongs to ${parentKind} "${parent}", not the tool's target ${target.kind} "${target.refName}" — a tool's fields must belong to its own target aspect; dropped`);
|
|
140
145
|
return undefined;
|
|
141
146
|
}
|
|
142
|
-
if (target.localTfLabel === undefined)
|
|
147
|
+
if (target.localTfLabel === undefined || target.kind === "task")
|
|
143
148
|
return foreignTargetFieldRefValue(token, refName, target, ctx);
|
|
144
149
|
// Falls through to the local resource-address resolution below.
|
|
145
150
|
}
|
|
@@ -151,7 +156,7 @@ function fieldRefValue(token, where, ctx, target) {
|
|
|
151
156
|
// vs. real field resource, by authoring type) rather than reimplementing
|
|
152
157
|
// it here — see fieldRefToTfValue's doc comment for the system-field
|
|
153
158
|
// ordering rationale.
|
|
154
|
-
const value = fieldRefToTfValue(token.fieldType ?? "", refName, target?.localTfLabel ?? ctx.appTfLabel, target?.kind
|
|
159
|
+
const value = fieldRefToTfValue(token.fieldType ?? "", refName, target?.localTfLabel ?? ctx.appTfLabel, target?.kind === "element" ? "element" : "app");
|
|
155
160
|
if (value === undefined) {
|
|
156
161
|
ctx.diagnostics.push(`${where}: field token "${refName}" has no terraform field resource mapping (fieldType ${JSON.stringify(token.fieldType ?? "")}); dropped`);
|
|
157
162
|
}
|
|
@@ -338,30 +343,82 @@ export function toolToTf(entry, ctx) {
|
|
|
338
343
|
}
|
|
339
344
|
if (typeKey === "searchTable") {
|
|
340
345
|
const table = inner.searchTableId;
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
346
|
+
// The search table itself (not its owner - that's the __variant/parent
|
|
347
|
+
// fallback below) has no portable lookup at all: unsafePlatformId()
|
|
348
|
+
// round-trips it as a raw id directly, before the refName check below,
|
|
349
|
+
// which would otherwise treat this escape as "no search table token"
|
|
350
|
+
// and drop a live tool. Scoped to a token with NO refName - one that
|
|
351
|
+
// still carries a refName has a real portable lookup available and
|
|
352
|
+
// must go through the normal parent-mismatch check + resolution below,
|
|
353
|
+
// not be short-circuited here just because it also happens to carry an
|
|
354
|
+
// __unsafe marker.
|
|
355
|
+
if (table?.__unsafe === "platformId" && table.refName === undefined && typeof table.value === "string" && table.value !== "") {
|
|
356
|
+
attrs["search_table_id"] = table.value;
|
|
344
357
|
}
|
|
345
|
-
if (
|
|
346
|
-
ctx.diagnostics.push(`${where}: search table
|
|
358
|
+
else if (table?.refName === undefined || table.refName === "") {
|
|
359
|
+
ctx.diagnostics.push(`${where}: no search table token; dropped`);
|
|
347
360
|
return undefined;
|
|
348
361
|
}
|
|
349
|
-
if (target?.localTfLabel !== undefined) {
|
|
350
|
-
const resourceType = table.__variant === "linked"
|
|
351
|
-
? "elementum_linked_ai_search_table"
|
|
352
|
-
: table.__variant === "table"
|
|
353
|
-
? "elementum_table_search_table"
|
|
354
|
-
: "elementum_ai_search_table";
|
|
355
|
-
attrs["search_table_id"] = expr.resourceAttr(resourceType, scopedResourceLabel(target.localTfLabel, tsLabelToTfLabel(table.refName), target.kind), ["id"]);
|
|
356
|
-
}
|
|
357
|
-
else if (target !== undefined) {
|
|
358
|
-
const lookupLabel = sanitizeName(`${target.foreignTfLabel}_${table.name ?? table.refName}`);
|
|
359
|
-
ctx.foreignFieldRef("elementum_search_table", lookupLabel, target.value, table.name ?? table.refName);
|
|
360
|
-
attrs["search_table_id"] = expr.dataAttr("elementum_search_table", lookupLabel, ["id"]);
|
|
361
|
-
}
|
|
362
362
|
else {
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
if (target !== undefined && table.parent !== undefined && table.parent !== "" && table.parent !== target.refName) {
|
|
364
|
+
ctx.diagnostics.push(`${where}: search table belongs to "${table.parent}", not target "${target.refName}"; dropped`);
|
|
365
|
+
return undefined;
|
|
366
|
+
}
|
|
367
|
+
if (target === undefined) {
|
|
368
|
+
if (table.__variant !== "table") {
|
|
369
|
+
ctx.diagnostics.push(`${where}: missing target aspect is only valid for a table-owned search table; dropped`);
|
|
370
|
+
return undefined;
|
|
371
|
+
}
|
|
372
|
+
const workspaceTable = table.parent === undefined
|
|
373
|
+
? undefined
|
|
374
|
+
: ctx.workspaceAspects?.get(workspaceAspectKey("table", table.parent));
|
|
375
|
+
if (workspaceTable !== undefined) {
|
|
376
|
+
// sanitizeName, not tsLabelToTfLabel: table.refName here always comes
|
|
377
|
+
// from a search-table token factory (searchTableRef/
|
|
378
|
+
// tableSearchTableRef), which sets refName straight from the raw
|
|
379
|
+
// display name (ei's own labeling convention) - it's never a clean
|
|
380
|
+
// bijective camelCase identifier the way an authored bag key is.
|
|
381
|
+
attrs["search_table_id"] = expr.resourceAttr("elementum_table_search_table", `tables_${workspaceTable.tfLabel}_${sanitizeName(table.name ?? table.refName)}`, ["id"]);
|
|
382
|
+
}
|
|
383
|
+
else if (ctx.tableSearchTableRef !== undefined && table.parent !== undefined && table.parent !== "") {
|
|
384
|
+
// sanitizeName(table.parentName ?? table.parent), not
|
|
385
|
+
// sanitizeName(table.parent): table.parent is the camelCase
|
|
386
|
+
// refName, but ei labels the export from the table's DISPLAY name,
|
|
387
|
+
// and sanitizeName doesn't split a capital before a digit the way
|
|
388
|
+
// a camelCase refName needs to reverse that - "hcpLookupV2"
|
|
389
|
+
// sanitizes to "hcp_lookupv2" while ei's own label for "HCP Lookup
|
|
390
|
+
// v2" is "hcp_lookup_v2", a perpetual plan diff (review feedback,
|
|
391
|
+
// PR #1095, msivraj).
|
|
392
|
+
const lookup = ctx.tableSearchTableRef(`${sanitizeName(table.parentName ?? table.parent)}_${sanitizeName(table.name ?? table.refName)}`, table.parent, table.parentName ?? table.parent, table.name ?? table.refName);
|
|
393
|
+
if (lookup !== undefined)
|
|
394
|
+
attrs["search_table_id"] = lookup;
|
|
395
|
+
else {
|
|
396
|
+
ctx.diagnostics.push(`${where}: table-owned search table lookup could not be materialized; dropped`);
|
|
397
|
+
return undefined;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
// A __unsafe fallback here is unreachable: the top-level guard
|
|
402
|
+
// above already handles any token with no refName, and this
|
|
403
|
+
// branch only runs when table.refName IS set (review feedback,
|
|
404
|
+
// PR #1099 - cursor[bot]).
|
|
405
|
+
ctx.diagnostics.push(`${where}: table-owned search table has no portable lookup; dropped`);
|
|
406
|
+
return undefined;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
else if (target.localTfLabel !== undefined) {
|
|
410
|
+
const resourceType = table.__variant === "linked"
|
|
411
|
+
? "elementum_linked_ai_search_table"
|
|
412
|
+
: table.__variant === "table"
|
|
413
|
+
? "elementum_table_search_table"
|
|
414
|
+
: "elementum_ai_search_table";
|
|
415
|
+
attrs["search_table_id"] = expr.resourceAttr(resourceType, scopedResourceLabel(target.localTfLabel, tsLabelToTfLabel(table.refName), target.kind === "element" ? "element" : "app"), ["id"]);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
const lookupLabel = sanitizeName(`${target.foreignTfLabel}_${table.name ?? table.refName}`);
|
|
419
|
+
ctx.foreignFieldRef("elementum_search_table", lookupLabel, target.value, table.name ?? table.refName);
|
|
420
|
+
attrs["search_table_id"] = expr.dataAttr("elementum_search_table", lookupLabel, ["id"]);
|
|
421
|
+
}
|
|
365
422
|
}
|
|
366
423
|
}
|
|
367
424
|
if (inner.fields !== undefined && inner.fields.length > 0) {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
|
|
12
12
|
* record-experience configuration with build/pull round-trip support.
|
|
13
13
|
*/
|
|
14
|
-
import { type AgentRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef, type WidgetRef } from "../../catalog/index.js";
|
|
14
|
+
import { type AgentRef, type AppOrElementOrTaskRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef, type WidgetRef } from "../../catalog/index.js";
|
|
15
15
|
import type { WorkflowFieldType } from "../shared/types/field-types.js";
|
|
16
16
|
import { type SystemFieldKey } from "../../core/system-fields.js";
|
|
17
17
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
@@ -61,7 +61,7 @@ export interface AppPicklistDynamicSortOrder {
|
|
|
61
61
|
* doesn't recognize trips its post-apply consistency check).
|
|
62
62
|
*/
|
|
63
63
|
export interface AppPicklistDynamicConfig {
|
|
64
|
-
readonly relatedAspectId:
|
|
64
|
+
readonly relatedAspectId: AppOrElementOrTaskRef | UnsafePlatformId;
|
|
65
65
|
readonly relatedLabelFieldId: FieldRef | UnsafePlatformId;
|
|
66
66
|
readonly parentFieldId?: FieldRef | UnsafePlatformId;
|
|
67
67
|
readonly parentMappings?: readonly {
|
|
@@ -191,7 +191,7 @@ export type NormalizedDashboardWidget = {
|
|
|
191
191
|
readonly chartKey: string;
|
|
192
192
|
};
|
|
193
193
|
export interface NormalizedWidgetRef {
|
|
194
|
-
readonly kind: "app" | "element" | "automation" | "field" | "recordIdentity";
|
|
194
|
+
readonly kind: "app" | "element" | "task" | "automation" | "field" | "recordIdentity";
|
|
195
195
|
readonly key: string;
|
|
196
196
|
readonly name: string;
|
|
197
197
|
readonly parent?: string;
|
|
@@ -267,7 +267,7 @@ export interface NormalizedRecordCreateForm {
|
|
|
267
267
|
readonly sections: readonly NormalizedRecordCreateFormSection[];
|
|
268
268
|
}
|
|
269
269
|
export interface PulledDynamicLayoutRef {
|
|
270
|
-
readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element";
|
|
270
|
+
readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element" | "task";
|
|
271
271
|
readonly key: string;
|
|
272
272
|
readonly parent?: string;
|
|
273
273
|
readonly name?: string;
|
|
@@ -280,7 +280,7 @@ export interface NormalizedDynamicLayout {
|
|
|
280
280
|
readonly layout: Readonly<Record<string, unknown>>;
|
|
281
281
|
}
|
|
282
282
|
export interface PulledRelationshipRef {
|
|
283
|
-
readonly kind: "app" | "element" | "table" | "field" | "tableColumn" | "recordIdentity";
|
|
283
|
+
readonly kind: "app" | "element" | "table" | "task" | "field" | "tableColumn" | "recordIdentity";
|
|
284
284
|
readonly key: string;
|
|
285
285
|
readonly name: string;
|
|
286
286
|
readonly parent?: string;
|
|
@@ -290,7 +290,7 @@ export interface PulledRelationshipRef {
|
|
|
290
290
|
/** The recursive pull resolved this reference to an on-disk generated catalog token. */
|
|
291
291
|
readonly catalogRef?: boolean;
|
|
292
292
|
readonly namespace?: string;
|
|
293
|
-
readonly parentKind?: "app" | "element";
|
|
293
|
+
readonly parentKind?: "app" | "element" | "task";
|
|
294
294
|
readonly parentName?: string;
|
|
295
295
|
readonly parentNamespace?: string;
|
|
296
296
|
readonly target?: PulledRelationshipRef;
|
|
@@ -88,5 +88,13 @@ export const appModule = {
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
|
+
roundtrip: {
|
|
92
|
+
referenceAliases: [],
|
|
93
|
+
omittedAttributeDefaults: [
|
|
94
|
+
{ attribute: "id_field_name", value: "ID" },
|
|
95
|
+
{ attribute: "status_field_name", value: "Status" },
|
|
96
|
+
{ attribute: "title_field_name", value: "Title" },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
91
99
|
catalog: NO_CATALOG,
|
|
92
100
|
};
|
|
@@ -309,6 +309,7 @@ export function appToTf(entity, ctx) {
|
|
|
309
309
|
for (const [index, entry] of (payload.accessPolicies ?? []).entries()) {
|
|
310
310
|
const { block } = accessPolicyToTf(entry, index, {
|
|
311
311
|
ownerTfLabel: ctx.appTfLabel,
|
|
312
|
+
ownerRefName: ctx.appRefName,
|
|
312
313
|
scope: "app",
|
|
313
314
|
objectId,
|
|
314
315
|
orgRefs: ctx.orgRefs,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ApprovalProcessRef, type CatalogRef, type FieldRef } from "../../catalog/index.js";
|
|
2
|
+
import { type UnsafePlatformId } from "../../core/platform-id.js";
|
|
2
3
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
4
|
type AppOwner = CatalogRef<"app">;
|
|
4
5
|
type OwnedField<App extends AppOwner> = App extends {
|
|
@@ -21,7 +22,13 @@ interface DefineApprovalProcessBase<App extends AppOwner> extends EntityDeployOp
|
|
|
21
22
|
readonly approveButton?: string;
|
|
22
23
|
readonly denyButton?: string;
|
|
23
24
|
readonly exceptionButton?: string;
|
|
24
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Fields locked while approval is active.
|
|
27
|
+
*
|
|
28
|
+
* Pull uses `unsafePlatformId(...)` only when the platform export contains a
|
|
29
|
+
* system-field UUID that cannot be reconstructed as a portable catalog ref.
|
|
30
|
+
*/
|
|
31
|
+
readonly lockedFields?: readonly (OwnedField<App> | UnsafePlatformId)[];
|
|
25
32
|
}
|
|
26
33
|
export type DefineApprovalProcessOptions<App extends AppOwner = AppOwner> = DefineApprovalProcessBase<App> & ({
|
|
27
34
|
readonly stage?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
|
|
2
2
|
import { slimTokens, } from "../../catalog/index.js";
|
|
3
|
+
import { isUnsafePlatformId } from "../../core/platform-id.js";
|
|
3
4
|
/** Explicit escape hatch used only when pull cannot recover a portable stage key. */
|
|
4
5
|
export function unsafeApprovalStageId(value) {
|
|
5
6
|
if (value.trim() === "")
|
|
@@ -17,6 +18,8 @@ export function approvalProcess(opts) {
|
|
|
17
18
|
throw new EdkValidationError("approvalProcess numberOfDynamicApprovers must be an integer >= 0.");
|
|
18
19
|
}
|
|
19
20
|
for (const field of opts.lockedFields ?? []) {
|
|
21
|
+
if (isUnsafePlatformId(field))
|
|
22
|
+
continue;
|
|
20
23
|
if (field.parent !== opts.app.refName) {
|
|
21
24
|
throw new EdkValidationError(`approvalProcess locked field ${JSON.stringify(field.refName)} belongs to ${JSON.stringify(field.parent)}, not app ${JSON.stringify(opts.app.refName)}.`);
|
|
22
25
|
}
|
|
@@ -13,5 +13,6 @@ export interface NormalizedApprovalChain {
|
|
|
13
13
|
readonly defaultReason?: string;
|
|
14
14
|
readonly summary?: string;
|
|
15
15
|
readonly lockedFields: readonly string[];
|
|
16
|
+
readonly unsafeLockedFieldIds?: readonly string[];
|
|
16
17
|
}
|
|
17
|
-
export declare function approvalChainFromTf(block: TfBlock, appTfLabel: string,
|
|
18
|
+
export declare function approvalChainFromTf(block: TfBlock, appTfLabel: string, ctx: FromTfContext): NormalizedApprovalChain;
|
|
@@ -5,7 +5,7 @@ import { fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
|
5
5
|
import { APPROVAL_PROCESS_RESOURCE_TYPE } from "./module.js";
|
|
6
6
|
const KNOWN = new Set(["id", "app_id", "name", "stage_id", "number_of_dynamic_approvers", "locked_field_ids", "managed_by_automation", "approve_button_text", "deny_button_text", "exception_button_text", "default_reason", "approval_summary"]);
|
|
7
7
|
function stringAttr(attrs, key) { return typeof attrs[key] === "string" ? attrs[key] : undefined; }
|
|
8
|
-
export function approvalChainFromTf(block, appTfLabel,
|
|
8
|
+
export function approvalChainFromTf(block, appTfLabel, ctx) {
|
|
9
9
|
if (block.type !== APPROVAL_PROCESS_RESOURCE_TYPE || block.label === undefined)
|
|
10
10
|
throw new EntityTfError(`expected ${APPROVAL_PROCESS_RESOURCE_TYPE}`);
|
|
11
11
|
for (const key of Object.keys(block.attrs))
|
|
@@ -40,16 +40,29 @@ export function approvalChainFromTf(block, appTfLabel, _ctx) {
|
|
|
40
40
|
const rawFields = block.attrs["locked_field_ids"];
|
|
41
41
|
if (rawFields !== undefined && !Array.isArray(rawFields))
|
|
42
42
|
throw new EntityTfError(`${block.type}.${block.label}: locked_field_ids must be a list`);
|
|
43
|
-
const lockedFields =
|
|
43
|
+
const lockedFields = [];
|
|
44
|
+
const unsafeLockedFieldIds = [];
|
|
45
|
+
for (const value of rawFields ?? []) {
|
|
46
|
+
// Keep literal IDs literal even when state can identify the corresponding
|
|
47
|
+
// system field. Export deliberately avoids the owning app's computed
|
|
48
|
+
// `*_field_id` locals because they can be null during fresh import.
|
|
44
49
|
const key = fieldKeyFromTfRef(value, appTfLabel, "app");
|
|
45
|
-
if (key
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
if (key !== undefined) {
|
|
51
|
+
lockedFields.push(key);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
55
|
+
unsafeLockedFieldIds.push(value);
|
|
56
|
+
ctx.diagnostics.push(`${block.type}.${block.label}: locked field ${value} could not be resolved to a portable field reference; preserved with unsafePlatformId`);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
throw new EntityTfError(`${block.type}.${block.label}: locked field is not a local field reference or platform id`);
|
|
60
|
+
}
|
|
49
61
|
return {
|
|
50
62
|
refName: scopedLabelToBagKey(appTfLabel, block.label, "app"), name,
|
|
51
63
|
...(stage !== undefined && { stage }), ...(stageId !== undefined && { stageId }),
|
|
52
|
-
numberOfDynamicApprovers: count, managedByAutomation: managed, denyButton: deny, approveButton: approve,
|
|
64
|
+
numberOfDynamicApprovers: count, managedByAutomation: managed, denyButton: deny, approveButton: approve,
|
|
65
|
+
lockedFields, unsafeLockedFieldIds,
|
|
53
66
|
...(stringAttr(block.attrs, "exception_button_text") !== undefined && { exceptionButton: stringAttr(block.attrs, "exception_button_text") }),
|
|
54
67
|
...(stringAttr(block.attrs, "default_reason") !== undefined && { defaultReason: stringAttr(block.attrs, "default_reason") }),
|
|
55
68
|
...(stringAttr(block.attrs, "approval_summary") !== undefined && { summary: stringAttr(block.attrs, "approval_summary") }),
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
const safe = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value) ? value : JSON.stringify(value);
|
|
2
2
|
export function printApprovalChain(chain, appRefName) {
|
|
3
3
|
const imports = ["approvalProcess", ...(chain.stageId !== undefined ? ["unsafeApprovalStageId"] : [])];
|
|
4
|
-
const
|
|
4
|
+
const unsafeLockedFieldIds = chain.unsafeLockedFieldIds ?? [];
|
|
5
|
+
const lines = [
|
|
6
|
+
`import { ${imports.join(", ")} } from "@elementumai/edk/approvalProcesses";`,
|
|
7
|
+
...(unsafeLockedFieldIds.length > 0
|
|
8
|
+
? [`import { unsafePlatformId } from "@elementumai/edk/core";`]
|
|
9
|
+
: []),
|
|
10
|
+
`import catalog from "@catalog";`,
|
|
11
|
+
];
|
|
12
|
+
const lockedFields = [
|
|
13
|
+
...[...chain.lockedFields].sort().map((key) => `catalog.${safe(appRefName)}.fields.${safe(key)}`),
|
|
14
|
+
...[...unsafeLockedFieldIds].sort().map((id) => `unsafePlatformId(${JSON.stringify(id)})`),
|
|
15
|
+
];
|
|
5
16
|
const props = [
|
|
6
17
|
`app: catalog.${safe(appRefName)}`,
|
|
7
18
|
`name: ${JSON.stringify(chain.name)}`,
|
|
@@ -14,7 +25,7 @@ export function printApprovalChain(chain, appRefName) {
|
|
|
14
25
|
...(chain.exceptionButton !== undefined ? [`exceptionButton: ${JSON.stringify(chain.exceptionButton)}`] : []),
|
|
15
26
|
...(chain.defaultReason !== undefined ? [`defaultReason: ${JSON.stringify(chain.defaultReason)}`] : []),
|
|
16
27
|
...(chain.summary !== undefined ? [`summary: ${JSON.stringify(chain.summary)}`] : []),
|
|
17
|
-
...(
|
|
28
|
+
...(lockedFields.length > 0 ? [`lockedFields: [${lockedFields.join(", ")}]`] : []),
|
|
18
29
|
];
|
|
19
30
|
lines.push(``, `export default approvalProcess({`, ...props.map((prop) => ` ${prop},`), `});`, ``);
|
|
20
31
|
return lines.join("\n");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isUnsafePlatformId } from "../../core/platform-id.js";
|
|
1
2
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
3
|
import { appScopedResourceLabel, expr, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
3
4
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
@@ -30,6 +31,8 @@ export function approvalChainToTf(entity, ctx) {
|
|
|
30
31
|
attrs["approval_summary"] = payload.summary;
|
|
31
32
|
if (payload.lockedFieldIds !== undefined) {
|
|
32
33
|
attrs["locked_field_ids"] = payload.lockedFieldIds.map((field) => {
|
|
34
|
+
if (isUnsafePlatformId(field))
|
|
35
|
+
return field.value;
|
|
33
36
|
if (field.parent !== undefined && field.parent !== "" && field.parent !== ctx.appRefName)
|
|
34
37
|
throw new EntityTfError(`approval chain ${entity.refName}: locked field belongs to ${field.parent}`);
|
|
35
38
|
const value = fieldRefToTfValue(field.fieldType ?? "", field.refName ?? "", ctx.appTfLabel);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type { AppOrElementRef, AutomationCatalogRef } from "../../catalog/index.js";
|
|
1
|
+
import type { AppOrElementOrTaskRef, AppOrElementRef, AutomationCatalogRef } from "../../catalog/index.js";
|
|
2
2
|
import { type DeployableEntity, type EntityDeployOptions, type RecordFieldContext } from "../../engine/entity.js";
|
|
3
3
|
import type { RecordShape } from "../field/record-shape.js";
|
|
4
4
|
import type { ServiceAccountRef } from "../service-account/ref.js";
|
|
5
5
|
import { type Context, type ForEachItem } from "../shared/context.js";
|
|
6
6
|
import { type Ref, type Simplify, type ValueOrRef } from "../shared/ref.js";
|
|
7
7
|
import type { Filter } from "./filter.js";
|
|
8
|
-
import { type ScriptInput } from "./script-code.js";
|
|
8
|
+
import { type ScriptFile, type ScriptInput } from "./script-code.js";
|
|
9
|
+
import * as actionFactories from "./tasks.js";
|
|
9
10
|
import type { ScriptOutputs } from "./tasks.js";
|
|
11
|
+
import { type WorkflowOutputDeclaration } from "./workflow-output.js";
|
|
10
12
|
/** Structural empty object — neutral element for the accumulated action map. */
|
|
11
13
|
type EmptyObject = {
|
|
12
14
|
[K in never]: never;
|
|
@@ -128,11 +130,16 @@ export interface ActionChain {
|
|
|
128
130
|
*/
|
|
129
131
|
__executeScriptOutputSchemas(): ReadonlyMap<string, unknown>;
|
|
130
132
|
}
|
|
131
|
-
/** A value an output property can carry: a typed ctx ref, or
|
|
132
|
-
type
|
|
133
|
-
|
|
133
|
+
/** A value an output property can carry: a typed ctx ref, a literal, or an explicit typed ref. */
|
|
134
|
+
type BareOutputValue = Ref<unknown> | string | number | boolean | null;
|
|
135
|
+
type OutputValue = BareOutputValue | WorkflowOutputDeclaration;
|
|
136
|
+
/**
|
|
137
|
+
* `Ref<T>` values resolve to `T` by the time the platform hands them to a
|
|
138
|
+
* script; a `withFieldMappings(...)`-wrapped list input resolves to an array
|
|
139
|
+
* of alias-keyed field values (one object per list item).
|
|
140
|
+
*/
|
|
134
141
|
type ResolvedRefs<I> = {
|
|
135
|
-
[K in keyof I]: I[K] extends Ref<infer T> ? T : I[K];
|
|
142
|
+
[K in keyof I]: I[K] extends actionFactories.ExecuteScriptListInputToken ? readonly Record<string, unknown>[] : I[K] extends Ref<infer T> ? T : I[K];
|
|
136
143
|
};
|
|
137
144
|
/** Static options or options computed from the typed outputs available so far. */
|
|
138
145
|
export type ActionOptions<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TOptions> = TOptions | ((ctx: Context<TTrigger, TActions, TVars>) => TOptions);
|
|
@@ -171,9 +178,9 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
171
178
|
* carries no `output_schema`, so a rebuild doesn't invent one and drift
|
|
172
179
|
* from state.
|
|
173
180
|
*/
|
|
174
|
-
executeScript<TName extends string, I extends Record<string, ValueOrRef<unknown
|
|
181
|
+
executeScript<TName extends string, I extends Record<string, ValueOrRef<unknown> | actionFactories.ExecuteScriptListInputToken>, R extends Record<string, unknown> = Record<string, unknown>>(name: TName, opts: {
|
|
175
182
|
readonly inputs?: (ctx: NestedActionContext<TTrigger, TActions, TVars, TItem>) => I;
|
|
176
|
-
readonly code: (input: ScriptInput<ResolvedRefs<NoInfer<I>>>) => R;
|
|
183
|
+
readonly code: ((input: ScriptInput<ResolvedRefs<NoInfer<I>>>) => R) | ScriptFile;
|
|
177
184
|
/**
|
|
178
185
|
* Override the inferred output schema: property name → scalar type or a
|
|
179
186
|
* recursive `{ type: "array", items }` / `{ type: "object", properties }`
|
|
@@ -204,13 +211,13 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
204
211
|
readonly type?: TType;
|
|
205
212
|
}, displayName?: string, hclParent?: "trigger" | string): FluentActionBuilder<TMode, TItem, TTrigger, Simplify<TActions & Record<TName, Record<string, never>>>, Simplify<TVars & Record<TName, VariableValueOf<TType>>>>;
|
|
206
213
|
setVariable<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").SetVariableOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
207
|
-
recordSearch<TName extends string, A extends
|
|
214
|
+
recordSearch<TName extends string, A extends AppOrElementOrTaskRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RecordSearchOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").RecordSearchOutput<A>>;
|
|
208
215
|
tableRecordsSearch<TName extends string, A extends AppOrElementRef = AppOrElementRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").TableRecordsSearchOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").TableRecordsSearchOutput<A>>;
|
|
209
|
-
createRecord<TName extends string, A extends
|
|
210
|
-
updateField<TName extends string, A extends
|
|
216
|
+
createRecord<TName extends string, A extends AppOrElementOrTaskRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").CreateRecordOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").CreateRecordOutput<A>>;
|
|
217
|
+
updateField<TName extends string, A extends AppOrElementOrTaskRef, const Fields extends readonly import("./tasks.js").FieldAssignment[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UpdateFieldOptions<A, Fields>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
|
|
211
218
|
record: RecordShape<A>;
|
|
212
219
|
}>;
|
|
213
|
-
findRelatedRecords<TName extends string, A extends
|
|
220
|
+
findRelatedRecords<TName extends string, A extends AppOrElementOrTaskRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").FindRelatedRecordsOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").FindRelatedRecordsOutput<A>>;
|
|
214
221
|
relateRecords<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RelateRecordsOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
215
222
|
sendEmail<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").SendEmailOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
216
223
|
postComment<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").PostCommentOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|