@elementumai/edk 0.9.10 → 0.9.12
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 +39 -5
- package/dist-sdk/src/catalog/factories.d.ts +42 -14
- package/dist-sdk/src/catalog/factories.js +77 -14
- package/dist-sdk/src/catalog/from-authoring.js +4 -4
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/org.js +3 -2
- package/dist-sdk/src/catalog/token.js +4 -0
- package/dist-sdk/src/catalog/types.d.ts +32 -5
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +4 -28
- package/dist-sdk/src/core/triggers/on-demand.js +2 -4
- package/dist-sdk/src/engine/build/context.d.ts +3 -0
- package/dist-sdk/src/engine/entity.d.ts +2 -0
- package/dist-sdk/src/engine/logging.d.ts +90 -0
- package/dist-sdk/src/engine/logging.js +124 -0
- package/dist-sdk/src/engine/progress.d.ts +119 -0
- package/dist-sdk/src/engine/progress.js +647 -0
- package/dist-sdk/src/engine/pull/result-output.d.ts +24 -0
- package/dist-sdk/src/engine/pull/result-output.js +48 -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/tools.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +13 -0
- package/dist-sdk/src/entities/app/build.d.ts +22 -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 +10 -7
- package/dist-sdk/src/entities/app/to-tf.js +14 -14
- package/dist-sdk/src/entities/automation/build.d.ts +11 -16
- package/dist-sdk/src/entities/automation/build.js +38 -8
- package/dist-sdk/src/entities/automation/catalog-render.js +1 -1
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +1 -2
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +23 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +239 -34
- package/dist-sdk/src/entities/automation/from-tf.js +276 -19
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/module.js +3 -2
- package/dist-sdk/src/entities/automation/output-field-types.js +25 -13
- package/dist-sdk/src/entities/automation/script-code.d.ts +12 -4
- package/dist-sdk/src/entities/automation/script-code.js +659 -101
- package/dist-sdk/src/entities/automation/tasks.d.ts +60 -28
- package/dist-sdk/src/entities/automation/tasks.js +48 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/automation/to-tf.js +514 -103
- package/dist-sdk/src/entities/automation/triggers.d.ts +15 -9
- package/dist-sdk/src/entities/automation/triggers.js +4 -2
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/build.d.ts +15 -3
- package/dist-sdk/src/entities/chart/build.js +6 -1
- package/dist-sdk/src/entities/chart/from-tf.d.ts +8 -2
- package/dist-sdk/src/entities/chart/from-tf.js +71 -8
- package/dist-sdk/src/entities/chart/index.d.ts +1 -1
- package/dist-sdk/src/entities/chart/index.js +1 -1
- package/dist-sdk/src/entities/chart/printer.js +27 -7
- package/dist-sdk/src/entities/chart/to-tf.js +56 -2
- package/dist-sdk/src/entities/dashboard/from-tf.js +11 -2
- package/dist-sdk/src/entities/datamine/from-tf.js +11 -1
- 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 +8 -0
- package/dist-sdk/src/entities/element/from-tf.js +4 -3
- package/dist-sdk/src/entities/element/module.js +1 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/element/to-tf.js +28 -2
- 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/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +73 -1
- package/dist-sdk/src/entities/field/metadata.d.ts +18 -0
- package/dist-sdk/src/entities/field/metadata.js +34 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +10 -2
- package/dist-sdk/src/entities/relationship/build.d.ts +27 -9
- package/dist-sdk/src/entities/relationship/column-contract.d.ts +24 -0
- package/dist-sdk/src/entities/relationship/column-contract.js +41 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +33 -48
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +33 -2
- 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/shared/context.d.ts +6 -3
- package/dist-sdk/src/entities/shared/context.js +19 -1
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +28 -0
- package/dist-sdk/src/entities/shared/filters/print.js +2 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +8 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +10 -6
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +52 -27
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/skill/to-tf.js +17 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +48 -12
- package/dist-sdk/src/entities/skill/tools.js +12 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +15 -12
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -46
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +66 -7
- package/dist-sdk/src/entities/table/build.js +10 -2
- 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 +39 -12
- package/dist-sdk/src/entities/widget/build.d.ts +43 -7
- package/dist-sdk/src/entities/widget/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/widget/from-tf.js +162 -23
- package/dist-sdk/src/entities/widget/to-tf.d.ts +17 -0
- package/dist-sdk/src/entities/widget/to-tf.js +150 -6
- package/dist-sdk/src/graph/types.d.ts +13 -0
- package/package.json +1 -1
- package/dist-sdk/src/core/types/platform.d.ts +0 -2
- package/dist-sdk/src/core/types/platform.js +0 -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 } from "../../engine/tf/index.js";
|
|
9
|
+
import { isTfExpr, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
10
10
|
import { dataAspectDisplayName, dataAspectRefName } from "../shared/aspect-target-from-tf.js";
|
|
11
11
|
import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
|
|
12
12
|
import { KNOWN_SKILL_TOOL_ATTRS, SKILL_TOOL_SUB_TYPE_BY_RESOURCE, UNAUTHORABLE_SKILL_TOOL_ATTRS, } from "./types.js";
|
|
@@ -148,47 +148,6 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
148
148
|
...(typeof rec["required"] === "boolean" && { required: rec["required"] }),
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
// The tool's own `inputs` attribute can be genuinely absent even when the
|
|
152
|
-
// target automation's onDemand trigger declares required parameters —
|
|
153
|
-
// the platform doesn't enforce that binding at tool-creation time (a
|
|
154
|
-
// live Deloitte "sentiment-analysis" skill hit this: a `run_automation`
|
|
155
|
-
// tool with zero `inputs` targeting an automation whose trigger requires
|
|
156
|
-
// one). `AutomationToolV2` (entities/agent/tools.ts) requires every such
|
|
157
|
-
// parameter to be mapped, so printing nothing here would emit a
|
|
158
|
-
// `skillAutomation({...})` call that can't compile (edk#483). This must
|
|
159
|
-
// NOT be "fixed" by inventing an `inputs` entry that isn't really on the
|
|
160
|
-
// platform — `elementum build` re-serializes whatever `inputs` prints
|
|
161
|
-
// straight back to HCL, so a fabricated entry becomes a genuine plan
|
|
162
|
-
// diff proposing to write fake data onto a live tool (caught live: a
|
|
163
|
-
// rebuilt `run_automation` tool proposed adding an `inputs` block with a
|
|
164
|
-
// literal "TODO: ..." description). Only RECORD which required
|
|
165
|
-
// parameters are unmapped; `printTool` (print-skill-v2.ts) decides how
|
|
166
|
-
// to keep the generated file compiling without asserting any of this as
|
|
167
|
-
// real authored data.
|
|
168
|
-
const mappedParams = new Set(inputs.map((i) => i.parameterName));
|
|
169
|
-
// Found by following the trigger's OWN `automation` reference (mirrors
|
|
170
|
-
// `automationFromTfDocument`'s `references(block.attrs.automation, ...)`
|
|
171
|
-
// in entities/automation/from-tf.ts) rather than guessing that the
|
|
172
|
-
// trigger shares its automation's Terraform label — that label equality
|
|
173
|
-
// holds by observed export convention, not by contract, and a silent
|
|
174
|
-
// miss here would reproduce the exact tsc-failing call this fix is for,
|
|
175
|
-
// with no diagnostic to explain why.
|
|
176
|
-
const trigger = automationLabel === undefined
|
|
177
|
-
? undefined
|
|
178
|
-
: ctx.resourcesOfType?.("elementum_on_demand_trigger").find((block) => {
|
|
179
|
-
const ref = block.attrs["automation"];
|
|
180
|
-
return isTfExpr(ref) && ref.$expr === "resource-attr" && ref.type === "elementum_automation" && ref.label === automationLabel;
|
|
181
|
-
});
|
|
182
|
-
const missingRequiredInputs = [];
|
|
183
|
-
for (const item of Array.isArray(trigger?.attrs["parameters"]) ? trigger.attrs["parameters"] : []) {
|
|
184
|
-
if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item))
|
|
185
|
-
continue;
|
|
186
|
-
const rec = item;
|
|
187
|
-
if (rec["required"] !== true || typeof rec["name"] !== "string" || mappedParams.has(rec["name"]))
|
|
188
|
-
continue;
|
|
189
|
-
ctx.diagnostics.push(`${where}: target automation's onDemand trigger requires "${rec["name"]}", but this tool has no input mapping for it — printed source will need a human-authored inputs entry before this tool can be adopted`);
|
|
190
|
-
missingRequiredInputs.push(rec["name"]);
|
|
191
|
-
}
|
|
192
151
|
const outputs = [];
|
|
193
152
|
for (const item of Array.isArray(attrs["outputs"]) ? attrs["outputs"] : []) {
|
|
194
153
|
if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item))
|
|
@@ -212,11 +171,13 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
212
171
|
: { automationKey: scopedLabelToBagKey(owner.ownerTfLabel, automationLabel) }),
|
|
213
172
|
...(inputs.length > 0 && { inputs }),
|
|
214
173
|
...(outputs.length > 0 && { outputs }),
|
|
215
|
-
...(missingRequiredInputs.length > 0 && { missingRequiredInputs }),
|
|
216
174
|
};
|
|
217
175
|
}
|
|
218
176
|
let searchTableKey;
|
|
219
177
|
let searchTableName;
|
|
178
|
+
let tableOwnedSearchTable = false;
|
|
179
|
+
let searchTableOwnerName;
|
|
180
|
+
let searchTableOwnerRefName;
|
|
220
181
|
if (subType.typeKey === "searchTable") {
|
|
221
182
|
const value = attrs["search_table_id"];
|
|
222
183
|
const resourceTypes = ["elementum_ai_search_table", "elementum_linked_ai_search_table", "elementum_table_search_table"];
|
|
@@ -224,6 +185,7 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
224
185
|
.map((type) => ({ type, label: resourceRefLabel(value, type) }))
|
|
225
186
|
.find((candidate) => candidate.label !== undefined);
|
|
226
187
|
if (matched?.label !== undefined) {
|
|
188
|
+
tableOwnedSearchTable = matched.type === "elementum_table_search_table";
|
|
227
189
|
// A managed or linked search table is owned by an ELEMENT, so its label
|
|
228
190
|
// carries the `elements_<ns>_` prefix — decoding it with app scope leaves
|
|
229
191
|
// the prefix in place and camel-cases the whole label into a bag key that
|
|
@@ -235,6 +197,17 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
235
197
|
}
|
|
236
198
|
else if (isTfExpr(value) && value.$expr === "data-attr" && value.type === "elementum_search_table") {
|
|
237
199
|
searchTableName = ctx.dataName(value.type, value.label);
|
|
200
|
+
// The generic search-table data source is used for both aspect-owned and
|
|
201
|
+
// table-owned tables. The presence of table_id is the only portable
|
|
202
|
+
// discriminator available in the HCL stream.
|
|
203
|
+
tableOwnedSearchTable = ctx.dataAttrs?.(value.type, value.label)?.["table_id"] !== undefined;
|
|
204
|
+
const tableLabel = dataRefLabel(ctx.dataAttrs?.(value.type, value.label)?.["table_id"], "elementum_table");
|
|
205
|
+
if (tableLabel !== undefined) {
|
|
206
|
+
searchTableOwnerName = ctx.dataName("elementum_table", tableLabel);
|
|
207
|
+
if (searchTableOwnerName !== undefined) {
|
|
208
|
+
searchTableOwnerRefName = [...(ctx.foreignTableRefsById?.values() ?? [])].find((identity) => identity.name === searchTableOwnerName)?.tableRefName ?? tfLabelToTsLabel(sanitizeName(searchTableOwnerName));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
238
211
|
if (searchTableName === undefined) {
|
|
239
212
|
ctx.diagnostics.push(`${where}: search_table_id references data.${value.type}.${value.label} without a matching name lookup; skipped`);
|
|
240
213
|
return undefined;
|
|
@@ -256,7 +229,16 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
256
229
|
let fieldScopeLabel = owner.ownerTfLabel;
|
|
257
230
|
let fieldScope = "app";
|
|
258
231
|
const selfLabel = resourceRefLabel(targetAttr, owner.appType);
|
|
259
|
-
if (
|
|
232
|
+
if (subType.typeKey === "searchTable" && targetAttr === "") {
|
|
233
|
+
if (tableOwnedSearchTable) {
|
|
234
|
+
target = { kind: "tableOwned" };
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
ctx.diagnostics.push(`${where}: empty target_id is only valid for a table-owned search table; skipped`);
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else if (selfLabel === owner.appLabel) {
|
|
260
242
|
target = { kind: "self" };
|
|
261
243
|
}
|
|
262
244
|
else if (isTfExpr(targetAttr) && targetAttr.$expr === "data-attr" && targetAttr.type === "elementum_app") {
|
|
@@ -349,8 +331,27 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
349
331
|
if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && attrs["filter"] !== undefined) {
|
|
350
332
|
ctx.diagnostics.push(`${where}: filter is not supported on the terraform path yet; a rebuilt stream will omit it`);
|
|
351
333
|
}
|
|
352
|
-
|
|
353
|
-
|
|
334
|
+
let filterVariables;
|
|
335
|
+
const rawFilterVariables = attrs["filter_variables"];
|
|
336
|
+
if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && Array.isArray(rawFilterVariables)) {
|
|
337
|
+
filterVariables = [];
|
|
338
|
+
for (const item of rawFilterVariables) {
|
|
339
|
+
if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item)) {
|
|
340
|
+
ctx.diagnostics.push(`${where}: filter_variables item has an unrecognized shape; dropped`);
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
const rec = item;
|
|
344
|
+
if (typeof rec["id"] !== "string" || rec["id"] === "" || typeof rec["name"] !== "string" || typeof rec["description"] !== "string" || typeof rec["required"] !== "boolean") {
|
|
345
|
+
ctx.diagnostics.push(`${where}: filter_variables item is missing a required attribute; dropped`);
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
filterVariables.push({ id: rec["id"], name: rec["name"], description: rec["description"], required: rec["required"] });
|
|
349
|
+
}
|
|
350
|
+
if (filterVariables.length === 0)
|
|
351
|
+
filterVariables = undefined;
|
|
352
|
+
}
|
|
353
|
+
else if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && rawFilterVariables !== undefined) {
|
|
354
|
+
ctx.diagnostics.push(`${where}: filter_variables is not a list; dropped`);
|
|
354
355
|
}
|
|
355
356
|
let handleDescription;
|
|
356
357
|
if (subType.typeKey === "updateRecord") {
|
|
@@ -366,11 +367,14 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
366
367
|
...common,
|
|
367
368
|
target,
|
|
368
369
|
...(fields !== undefined && { fields }),
|
|
370
|
+
...(filterVariables !== undefined && { filterVariables }),
|
|
369
371
|
...((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && {
|
|
370
372
|
queryDescription: optionalString(attrs, "query_description", where, ctx) ?? "",
|
|
371
373
|
}),
|
|
372
374
|
...(searchTableKey !== undefined && { searchTableKey }),
|
|
373
375
|
...(searchTableName !== undefined && { searchTableName }),
|
|
376
|
+
...(searchTableOwnerName !== undefined && { searchTableOwnerName }),
|
|
377
|
+
...(searchTableOwnerRefName !== undefined && { searchTableOwnerRefName }),
|
|
374
378
|
...(typeof attrs["result_limit"] === "number" && { limit: attrs["result_limit"] }),
|
|
375
379
|
...(handleDescription !== undefined && { handleDescription }),
|
|
376
380
|
};
|
|
@@ -32,6 +32,10 @@ export interface SkillToolToTfContext {
|
|
|
32
32
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
33
33
|
/** Records an app-scoped service-account lookup by name. */
|
|
34
34
|
serviceAccountRef?(tfLabel: string, name: string): TfValue | void;
|
|
35
|
+
/** Records a table-owned search-table data lookup for a pulled public ref. */
|
|
36
|
+
tableSearchTableRef?(tfLabel: string, tableRefName: string, tableName: string, searchTableName: string): TfValue | void;
|
|
37
|
+
/** Resolves a table-column token for a table-owned search tool. */
|
|
38
|
+
tableColumnRef?(tableRefName: string, tableName: string, columnName: string): TfValue | void;
|
|
35
39
|
/** App-local automations whose publish resource will be emitted in this build. */
|
|
36
40
|
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
37
41
|
/** Degradations land here — reported by the caller, never silent. */
|
|
@@ -31,6 +31,19 @@ function serviceAccountIdValue(token, where, ctx) {
|
|
|
31
31
|
}
|
|
32
32
|
/** authoring AppOrElementRef token → target_id value (workspace resource or foreign data ref). */
|
|
33
33
|
function targetIdValue(token, ctx) {
|
|
34
|
+
// Legacy escape hatch (pre-#889): pull used to print an unresolved target
|
|
35
|
+
// as a bare platform-id string cast (`"<uuid>" as any`) rather than
|
|
36
|
+
// unsafePlatformId(...) — already-pulled workspaces still have this shape
|
|
37
|
+
// on disk and must keep round-tripping directly as target_id.
|
|
38
|
+
if (typeof token === "string") {
|
|
39
|
+
return { value: token, refName: token, kind: "app" };
|
|
40
|
+
}
|
|
41
|
+
// Pull's escape hatch for a target export couldn't resolve to any
|
|
42
|
+
// portable reference (#648) - the platform id round-trips directly as
|
|
43
|
+
// target_id, no name/namespace data lookup needed or even possible.
|
|
44
|
+
if (token.__unsafe === "platformId" && typeof token.value === "string" && token.value !== "") {
|
|
45
|
+
return { value: token.value, refName: token.value, kind: "app" };
|
|
46
|
+
}
|
|
34
47
|
const refName = token.refName ?? "";
|
|
35
48
|
const kind = token.__kind === "element" ? "element" : "app";
|
|
36
49
|
if (kind === "app" && refName === ctx.appRefName) {
|
|
@@ -225,24 +238,56 @@ export function skillToolToTf(entry, ctx) {
|
|
|
225
238
|
const block = { kind: "resource", type: subType.resourceType, label: tfLabel, attrs };
|
|
226
239
|
return { block, address: `${subType.resourceType}.${tfLabel}` };
|
|
227
240
|
}
|
|
228
|
-
if (inner.aspectId === undefined) {
|
|
241
|
+
if (inner.aspectId === undefined && typeKey !== "searchTable") {
|
|
229
242
|
ctx.diagnostics.push(`${where}: no target aspect token; dropped`);
|
|
230
243
|
return undefined;
|
|
231
244
|
}
|
|
232
|
-
const
|
|
233
|
-
|
|
245
|
+
const aspectId = inner.aspectId;
|
|
246
|
+
const target = aspectId === undefined ? undefined : targetIdValue(aspectId, ctx);
|
|
247
|
+
if (target !== undefined)
|
|
248
|
+
attrs["target_id"] = target.value;
|
|
249
|
+
else
|
|
250
|
+
attrs["target_id"] = "";
|
|
234
251
|
if (typeKey === "searchTable") {
|
|
235
252
|
const table = inner.searchTableId;
|
|
236
253
|
if (table?.refName === undefined || table.refName === "") {
|
|
237
254
|
ctx.diagnostics.push(`${where}: no search table token; dropped`);
|
|
238
255
|
return undefined;
|
|
239
256
|
}
|
|
240
|
-
if (table.parent !== undefined && table.parent !== "" && table.parent !== target.refName) {
|
|
257
|
+
if (target !== undefined && table.parent !== undefined && table.parent !== "" && table.parent !== target.refName) {
|
|
241
258
|
ctx.diagnostics.push(`${where}: search table belongs to "${table.parent}", not target "${target.refName}"; dropped`);
|
|
242
259
|
return undefined;
|
|
243
260
|
}
|
|
244
|
-
if (target
|
|
245
|
-
|
|
261
|
+
if (target === undefined) {
|
|
262
|
+
if (table.__variant !== "table") {
|
|
263
|
+
ctx.diagnostics.push(`${where}: missing target aspect is only valid for a table-owned search table; dropped`);
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
const workspaceTable = table.parent === undefined
|
|
267
|
+
? undefined
|
|
268
|
+
: ctx.workspaceAspects?.get(workspaceAspectKey("table", table.parent));
|
|
269
|
+
if (workspaceTable !== undefined) {
|
|
270
|
+
attrs["search_table_id"] = expr.resourceAttr("elementum_table_search_table", `tables_${workspaceTable.tfLabel}_${tsLabelToTfLabel(table.refName)}`, ["id"]);
|
|
271
|
+
}
|
|
272
|
+
else if (ctx.tableSearchTableRef !== undefined && table.parent !== undefined && table.parent !== "") {
|
|
273
|
+
const lookup = ctx.tableSearchTableRef(`${sanitizeName(table.parent)}_${sanitizeName(table.name ?? table.refName)}`, table.parent, table.parentName ?? table.parent, table.name ?? table.refName);
|
|
274
|
+
if (lookup !== undefined)
|
|
275
|
+
attrs["search_table_id"] = lookup;
|
|
276
|
+
else {
|
|
277
|
+
ctx.diagnostics.push(`${where}: table-owned search table lookup could not be materialized; dropped`);
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
else if (table.__unsafe === "platformId" && typeof table.value === "string" && table.value !== "") {
|
|
282
|
+
attrs["search_table_id"] = table.value;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
ctx.diagnostics.push(`${where}: table-owned search table has no portable lookup; dropped`);
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else if (target.localTfLabel === undefined) {
|
|
290
|
+
const targetName = aspectId?.name ?? aspectId?.refName ?? table.parent;
|
|
246
291
|
const lookupLabel = sanitizeName(`${targetName}_${table.name ?? table.refName}`);
|
|
247
292
|
ctx.foreignFieldRef("elementum_search_table", lookupLabel, target.value, table.name ?? table.refName);
|
|
248
293
|
attrs["search_table_id"] = expr.dataAttr("elementum_search_table", lookupLabel, ["id"]);
|
|
@@ -264,6 +309,14 @@ export function skillToolToTf(entry, ctx) {
|
|
|
264
309
|
if (inner.limit !== undefined)
|
|
265
310
|
attrs["result_limit"] = inner.limit;
|
|
266
311
|
}
|
|
312
|
+
if ((typeKey === "searchAspect" || typeKey === "searchTable") && inner.filterVariables !== undefined && inner.filterVariables.length > 0) {
|
|
313
|
+
attrs["filter_variables"] = inner.filterVariables.map((variable) => ({
|
|
314
|
+
id: typeof variable.id === "string" ? variable.id : variable.id?.value ?? "",
|
|
315
|
+
name: variable.name ?? "",
|
|
316
|
+
description: variable.description ?? "",
|
|
317
|
+
required: variable.required ?? false,
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
267
320
|
if (inner.fields !== undefined || typeKey === "createRecord" || typeKey === "updateRecord") {
|
|
268
321
|
const fieldValues = [];
|
|
269
322
|
for (const f of inner.fields ?? []) {
|
|
@@ -274,7 +327,13 @@ export function skillToolToTf(entry, ctx) {
|
|
|
274
327
|
? f.fieldId
|
|
275
328
|
: f.fieldId === undefined
|
|
276
329
|
? undefined
|
|
277
|
-
:
|
|
330
|
+
: target === undefined && f.fieldId.__unsafe === "platformId" && typeof f.fieldId.value === "string"
|
|
331
|
+
? f.fieldId.value
|
|
332
|
+
: target === undefined && f.fieldId.__kind === "tableColumn" && ctx.tableColumnRef !== undefined
|
|
333
|
+
? ctx.tableColumnRef(f.fieldId.parent ?? "", f.fieldId.parentName ?? f.fieldId.parent ?? "", f.fieldId.name ?? f.fieldId.refName ?? "")
|
|
334
|
+
: target === undefined
|
|
335
|
+
? undefined
|
|
336
|
+
: fieldRefValue(f.fieldId, where, ctx, target);
|
|
278
337
|
if (ref === undefined)
|
|
279
338
|
continue;
|
|
280
339
|
fieldValues.push({
|
|
@@ -80,18 +80,26 @@ export function table(opts) {
|
|
|
80
80
|
return {
|
|
81
81
|
...initial,
|
|
82
82
|
ref(refName) {
|
|
83
|
+
const parentName = opts.name ?? opts.handle ?? refName;
|
|
84
|
+
const columnNames = Object.fromEntries(Object.entries(opts.columns ?? {}).map(([colKey, col]) => [colKey, col.name ?? colKey]));
|
|
83
85
|
const columns = Object.fromEntries(Object.entries(opts.columns ?? {}).map(([key, column]) => [key, {
|
|
84
86
|
__kind: "tableColumn",
|
|
85
87
|
refName: key,
|
|
86
88
|
parent: refName,
|
|
89
|
+
parentName,
|
|
87
90
|
name: column.name,
|
|
88
91
|
...(column.kind === "cloud" ? { fieldType: "snowflake" in column.cloud ? column.cloud.snowflake.type : column.cloud.bigQuery.type } : {}),
|
|
89
92
|
...(column.tags !== undefined ? { tags: column.tags } : {}),
|
|
90
93
|
}]));
|
|
91
94
|
const datamines = Object.fromEntries(Object.entries(opts.datamines ?? {}).map(([key, datamine]) => [key, {
|
|
92
|
-
__kind: "datamine",
|
|
95
|
+
__kind: "datamine",
|
|
96
|
+
refName: key,
|
|
97
|
+
parent: refName,
|
|
98
|
+
parentName,
|
|
99
|
+
name: datamine.name,
|
|
100
|
+
columnNames,
|
|
93
101
|
}]));
|
|
94
|
-
return { __kind: "table", refName, name:
|
|
102
|
+
return { __kind: "table", refName, name: parentName, columns, datamines };
|
|
95
103
|
},
|
|
96
104
|
def(refName) {
|
|
97
105
|
return entityFor(opts, refName);
|
|
@@ -24,6 +24,7 @@ export function renderTableCatalogEntry(args) {
|
|
|
24
24
|
const colParts = [
|
|
25
25
|
`name: ${JSON.stringify(column.name)}`,
|
|
26
26
|
`parent: ${JSON.stringify(parentHandle)}`,
|
|
27
|
+
`parentName: ${JSON.stringify(ref.name)}`,
|
|
27
28
|
];
|
|
28
29
|
if (column.fieldType !== undefined) {
|
|
29
30
|
colParts.push(`fieldType: ${JSON.stringify(column.fieldType)}`);
|
|
@@ -39,7 +40,7 @@ export function renderTableCatalogEntry(args) {
|
|
|
39
40
|
if (datamines.length > 0) {
|
|
40
41
|
extraFactories.push("datamineRef");
|
|
41
42
|
const parentHandle = named.refName ?? args.keyName;
|
|
42
|
-
parts.push(`datamines: { ${datamines.map(([key, datamine]) => `${safeCatalogKey(key)}: datamineRef({ name: ${JSON.stringify(datamine.name)}, parent: ${JSON.stringify(parentHandle)} })`).join(", ")} }`);
|
|
43
|
+
parts.push(`datamines: { ${datamines.map(([key, datamine]) => `${safeCatalogKey(key)}: datamineRef({ name: ${JSON.stringify(datamine.name)}, parent: ${JSON.stringify(parentHandle)}, parentName: ${JSON.stringify(ref.name)} })`).join(", ")} }`);
|
|
43
44
|
}
|
|
44
45
|
if (ref.categoryId !== undefined) {
|
|
45
46
|
parts.push(`categoryId: ${JSON.stringify(ref.categoryId)}`);
|
|
@@ -10,6 +10,7 @@ import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
|
|
|
10
10
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
11
11
|
import { fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
12
12
|
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
13
|
+
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
13
14
|
import { filterFromTf, principalList } from "../access-policy/from-tf.js";
|
|
14
15
|
import { listViewDensity, } from "./build.js";
|
|
15
16
|
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, KNOWN_AGENT_VIEW_ATTRS, KNOWN_CALENDAR_VIEW_ATTRS, KNOWN_DASHBOARD_VIEW_ATTRS, KNOWN_KANBAN_VIEW_ATTRS, KNOWN_LAYOUT_ATTRS, KNOWN_LAYOUT_SECTION_ATTRS, KNOWN_LIST_VIEW_ATTRS, KNOWN_MANAGED_VIEW_ORDER_ATTRS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, SECTION_TYPE_FROM_WIRE, SYSTEM_FIELD_KEY_BY_ID_ATTR, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
|
|
@@ -307,12 +308,20 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
307
308
|
const fieldIds = rec["field_ids"];
|
|
308
309
|
if (Array.isArray(fieldIds)) {
|
|
309
310
|
const fields = [];
|
|
311
|
+
const widgets = [];
|
|
310
312
|
for (const f of fieldIds) {
|
|
313
|
+
const widgetLabel = resourceRefLabel(f, WIDGET_RESOURCE_TYPE);
|
|
314
|
+
if (widgetLabel !== undefined) {
|
|
315
|
+
widgets.push(scopedLabelToBagKey(ownerTfLabel, widgetLabel, scope));
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
311
318
|
const key = fieldRefFromTf(f, ownerLabel, ownerTfLabel, scope, ctx);
|
|
312
319
|
if (key !== undefined)
|
|
313
320
|
fields.push(key);
|
|
314
321
|
}
|
|
315
322
|
section.fields = fields;
|
|
323
|
+
if (widgets.length > 0)
|
|
324
|
+
section.widgets = widgets;
|
|
316
325
|
}
|
|
317
326
|
}
|
|
318
327
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && typeof rec["name"] === "string") {
|
|
@@ -31,6 +31,11 @@ export interface AppLayoutSectionWire {
|
|
|
31
31
|
readonly color?: string;
|
|
32
32
|
readonly maxColumns?: number;
|
|
33
33
|
readonly fields?: readonly ViewFieldRefWire[];
|
|
34
|
+
readonly widgets?: readonly {
|
|
35
|
+
readonly __kind?: string;
|
|
36
|
+
readonly refName?: string;
|
|
37
|
+
readonly parent?: string;
|
|
38
|
+
}[];
|
|
34
39
|
}
|
|
35
40
|
export interface AppLayoutWire {
|
|
36
41
|
readonly sections: readonly AppLayoutSectionWire[];
|
|
@@ -101,6 +106,8 @@ export interface ViewToTfOptions {
|
|
|
101
106
|
readonly orgRefs?: OrgRefLookup;
|
|
102
107
|
/** Known emitted field addresses keyed by field bag key, for robust reference resolution. */
|
|
103
108
|
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
109
|
+
/** Declared sibling widget keys, for typed classic-layout placement. */
|
|
110
|
+
readonly widgetKeys?: ReadonlySet<string>;
|
|
104
111
|
/** Degradations land here — reported by the caller, never silent. */
|
|
105
112
|
readonly diagnostics: string[];
|
|
106
113
|
}
|
|
@@ -14,6 +14,7 @@ import { fieldRefToTfValue as customFieldRefToTfValue } from "../field/to-tf.js"
|
|
|
14
14
|
import { filterToTf, principalListToTf } from "../access-policy/to-tf.js";
|
|
15
15
|
import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
|
|
16
16
|
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
17
|
+
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
17
18
|
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
|
|
18
19
|
/** Elements only have `id`/`title` as real system fields (no status/stage/audit fields) — see `element/locals.ts`. */
|
|
19
20
|
const ELEMENT_SYSTEM_FIELD_KEYS = new Set(["id", "title"]);
|
|
@@ -40,7 +41,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
40
41
|
diagnostics.push(`layouts.${stageKey} has no matching authored stage option; dropped`);
|
|
41
42
|
continue;
|
|
42
43
|
}
|
|
43
|
-
blocks.push(layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses));
|
|
44
|
+
blocks.push(layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses, opts.widgetKeys));
|
|
44
45
|
}
|
|
45
46
|
const viewAddressByKey = new Map();
|
|
46
47
|
for (const [viewKey, view] of Object.entries(listViews ?? {})) {
|
|
@@ -50,6 +51,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
50
51
|
}
|
|
51
52
|
const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
|
|
52
53
|
const where = `listViews.${viewKey}`;
|
|
54
|
+
const listColumns = resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics, fieldAddresses);
|
|
53
55
|
const attrs = {
|
|
54
56
|
aspect_id: objectId,
|
|
55
57
|
name: view.name ?? "",
|
|
@@ -58,7 +60,11 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
58
60
|
// defaulting to `true` planned false→true against live views that
|
|
59
61
|
// disallow create. Platform default when unset on create is still true.
|
|
60
62
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
61
|
-
|
|
63
|
+
// ei's own export omits `columns` entirely for a view with none
|
|
64
|
+
// configured rather than emitting an empty array — always including it
|
|
65
|
+
// planned a spurious in-place update on every build (live-confirmed on
|
|
66
|
+
// purchaseorder/eu-sanofi's Calendar/Kanban/List views).
|
|
67
|
+
...(listColumns.length > 0 ? { columns: listColumns } : {}),
|
|
62
68
|
density: view.density ?? "STANDARD",
|
|
63
69
|
rows: view.rows ?? 25,
|
|
64
70
|
};
|
|
@@ -93,11 +99,13 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
93
99
|
}
|
|
94
100
|
const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
|
|
95
101
|
const where = `${bagName}.${viewKey}`;
|
|
102
|
+
const bagColumns = resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics, fieldAddresses);
|
|
96
103
|
const attrs = {
|
|
97
104
|
aspect_id: objectId,
|
|
98
105
|
name: view.name ?? "",
|
|
99
106
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
100
|
-
|
|
107
|
+
// See the list-view `columns` comment above — same omit-when-empty fix.
|
|
108
|
+
...(bagColumns.length > 0 ? { columns: bagColumns } : {}),
|
|
101
109
|
};
|
|
102
110
|
if (view.displayByField !== undefined) {
|
|
103
111
|
const displayBy = fieldRefToTfValue(view.displayByField, ownerTfLabel, scope, `${where}.displayByField`, diagnostics, fieldAddresses);
|
|
@@ -248,7 +256,7 @@ function managedViewSortToTf(sort, ownerTfLabel, scope, where, diagnostics, fiel
|
|
|
248
256
|
}
|
|
249
257
|
return expr.jsonencode({ orders });
|
|
250
258
|
}
|
|
251
|
-
function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses) {
|
|
259
|
+
function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses, widgetKeys) {
|
|
252
260
|
const sections = [];
|
|
253
261
|
for (const section of layout.sections) {
|
|
254
262
|
const authoringType = section.type ?? "group";
|
|
@@ -262,13 +270,11 @@ function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics
|
|
|
262
270
|
display_location: section.displayLocation ?? "CENTER",
|
|
263
271
|
display_order: section.displayOrder ?? 0,
|
|
264
272
|
};
|
|
265
|
-
//
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
|
|
270
|
-
if (section.sideNavItem === false)
|
|
271
|
-
sec.side_nav_item = false;
|
|
273
|
+
// Always emit side_nav_item (match hcl_app.go export). Omitting the true
|
|
274
|
+
// platform default inside a RequiresReplace sections list plans
|
|
275
|
+
// known→unknown and forces cannot_update replaces (Cloud Builder intake).
|
|
276
|
+
// Authored omit means true — same default discovery uses for nil API values.
|
|
277
|
+
sec.side_nav_item = section.sideNavItem ?? true;
|
|
272
278
|
if (wireType === GROUP_SECTION_WIRE_TYPE) {
|
|
273
279
|
sec.name = section.name ?? "";
|
|
274
280
|
if (section.icon !== undefined)
|
|
@@ -285,7 +291,28 @@ function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics
|
|
|
285
291
|
}
|
|
286
292
|
return true;
|
|
287
293
|
});
|
|
288
|
-
|
|
294
|
+
const widgetIds = [];
|
|
295
|
+
for (const [index, widget] of (section.widgets ?? []).entries()) {
|
|
296
|
+
const widgetWhere = `${where}.widgets[${index}]`;
|
|
297
|
+
const key = widget.refName ?? "";
|
|
298
|
+
if (widget.__kind !== "widget" || key === "") {
|
|
299
|
+
diagnostics.push(`${widgetWhere}: expected a typed widget reference; dropped`);
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (widget.parent !== undefined && widget.parent !== ownerRefName) {
|
|
303
|
+
diagnostics.push(`${widgetWhere}: widget belongs to ${JSON.stringify(widget.parent)}, not ${JSON.stringify(ownerRefName)}; dropped`);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (!widgetKeys?.has(key)) {
|
|
307
|
+
diagnostics.push(`${widgetWhere}: widget ${JSON.stringify(key)} is not declared in this ${scope}; dropped`);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
widgetIds.push(expr.resourceAttr(WIDGET_RESOURCE_TYPE, scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(key), scope), ["id"]));
|
|
311
|
+
}
|
|
312
|
+
sec.field_ids = [
|
|
313
|
+
...resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics, fieldAddresses),
|
|
314
|
+
...widgetIds,
|
|
315
|
+
];
|
|
289
316
|
}
|
|
290
317
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && section.name !== undefined) {
|
|
291
318
|
sec.name = section.name;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppOrElementRef, AutomationRef, FieldRef } from "../../catalog/index.js";
|
|
1
|
+
import type { AppOrElementRef, AutomationRef, FieldRef, RecordIdentityRef } from "../../catalog/index.js";
|
|
2
2
|
import type { WorkflowFieldType } from "../shared/types/field-types.js";
|
|
3
3
|
import type { Filter } from "../shared/filters/types.js";
|
|
4
4
|
export type WidgetButtonType = "INLINE" | "PRIMARY" | "SECONDARY";
|
|
@@ -8,18 +8,54 @@ export interface WidgetButtonStyle {
|
|
|
8
8
|
readonly icon?: string;
|
|
9
9
|
readonly fullWidth?: boolean;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Lists matching records from `target` on this object's record page.
|
|
13
|
+
*
|
|
14
|
+
* Shipped authoring fields today: `type`, `name`, `target`, `columns`, `rows`.
|
|
15
|
+
* The widget only names the target and display columns. The platform finds
|
|
16
|
+
* rows through an authored `relationships[]` join on **this** app/element
|
|
17
|
+
* whose columns join comparable stored values (TEXT→TEXT, or this object's
|
|
18
|
+
* `relationField` → related title/id). Do not join system `"id"` (HANDLE)
|
|
19
|
+
* to a child `relationField`. A child `relationField` / dynamic dropdown
|
|
20
|
+
* with `autoRelate` stores an instance link; it does not populate this widget.
|
|
21
|
+
* Prefer TEXT, PICKLIST, and similar short scalars as display columns;
|
|
22
|
+
* RICH_TEXT / longtext cells often render blank inline and force click-in.
|
|
23
|
+
* Authored `columns` seed the Everyone Display Settings table-state default.
|
|
24
|
+
* Show/Hide Columns (ColumnOrder) and Just Me are not an EDK surface.
|
|
25
|
+
*
|
|
26
|
+
* TRACKING — planned App knobs, **NOT YET SUPPORTED**. They are documented
|
|
27
|
+
* here so authors see the desired surface at this type. They are **not**
|
|
28
|
+
* live optional props (that would silently no-op on build/apply).
|
|
29
|
+
*
|
|
30
|
+
* - `removeLabel?: string` — rename the unlink/Remove row-menu action
|
|
31
|
+
* (e.g. `"Unlink"`). Today Remove only unlinks the related row.
|
|
32
|
+
* - `allowDelete?: boolean` — optional related-row **true delete** of the
|
|
33
|
+
* related record (not just unlink). Today Delete lives on the related
|
|
34
|
+
* record's own detail ⋮ menu, not this widget.
|
|
35
|
+
*
|
|
36
|
+
* Blocked on platform GraphQL `DisplayWidgetRelatedAspect` plus its
|
|
37
|
+
* create/update inputs, which currently expose only
|
|
38
|
+
* `aspect` / `columns` / `filter` / `name` / `rows` / `sort`. Stay draft
|
|
39
|
+
* until those fields land and EDK can bind them through HCL
|
|
40
|
+
* (pull → plan → apply).
|
|
41
|
+
*/
|
|
42
|
+
export interface RelatedRecordsWidget<Target extends AppOrElementRef = AppOrElementRef> {
|
|
12
43
|
readonly type: "relatedRecords";
|
|
13
44
|
readonly name: string;
|
|
14
|
-
readonly target:
|
|
15
|
-
|
|
45
|
+
readonly target: Target;
|
|
46
|
+
/**
|
|
47
|
+
* Display columns for the record-page table. Create/update also seeds the
|
|
48
|
+
* organization (Everyone) Display Settings table-state default. Show/Hide
|
|
49
|
+
* Columns (ColumnOrder) and Just Me preferences are not authored here.
|
|
50
|
+
*/
|
|
51
|
+
readonly columns?: readonly (FieldRef | RecordIdentityRef<Target>)[];
|
|
16
52
|
readonly rows?: number;
|
|
17
53
|
}
|
|
18
|
-
export interface LinkRecordsWidget extends WidgetButtonStyle {
|
|
54
|
+
export interface LinkRecordsWidget<Target extends AppOrElementRef = AppOrElementRef> extends WidgetButtonStyle {
|
|
19
55
|
readonly type: "linkRecords";
|
|
20
56
|
readonly name: string;
|
|
21
|
-
readonly target:
|
|
22
|
-
readonly columns?: readonly FieldRef[];
|
|
57
|
+
readonly target: Target;
|
|
58
|
+
readonly columns?: readonly (FieldRef | RecordIdentityRef<Target>)[];
|
|
23
59
|
readonly rows?: number;
|
|
24
60
|
/** Provider-native filter payload. */
|
|
25
61
|
readonly filter?: Filter;
|
|
@@ -8,4 +8,4 @@ export interface WidgetOwner {
|
|
|
8
8
|
readonly ownerTfLabel: string;
|
|
9
9
|
readonly scope: ChildResourceScope;
|
|
10
10
|
}
|
|
11
|
-
export declare function widgetsFromTf(blocks: readonly TfBlock[], owner: WidgetOwner, ctx: FromTfContext): NormalizedWidget[];
|
|
11
|
+
export declare function widgetsFromTf(blocks: readonly TfBlock[], owner: WidgetOwner, ctx: FromTfContext, dynamicLayoutCompanionLabels?: ReadonlySet<string>): NormalizedWidget[];
|