@elementumai/edk 0.9.9 → 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 +5 -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.d.ts +1 -1
- package/dist-sdk/src/entities/app/to-tf.js +7 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +78 -19
- 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/script-code.d.ts +7 -0
- package/dist-sdk/src/entities/automation/script-code.js +17 -3
- 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 +162 -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/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +4 -0
- package/dist-sdk/src/entities/datamine/from-tf.js +23 -3
- 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
|
@@ -47,6 +47,14 @@ export interface SkillSearchRawIdField {
|
|
|
47
47
|
readonly description: string;
|
|
48
48
|
}
|
|
49
49
|
export type SkillSearchFieldInput<Target extends ToolTarget = ToolTarget> = SkillSearchField<Target> | SkillSearchRawIdField;
|
|
50
|
+
/** A runtime value supplied by the agent for a search filter variable. */
|
|
51
|
+
export interface SkillFilterVariable {
|
|
52
|
+
/** Stable platform identifier referenced by the filter JSON. */
|
|
53
|
+
readonly id: UnsafePlatformId;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly description: string;
|
|
56
|
+
readonly required: boolean;
|
|
57
|
+
}
|
|
50
58
|
export interface SkillRecordField<Target extends ToolTarget = ToolTarget> {
|
|
51
59
|
readonly field: FieldRef<Target["refName"]>;
|
|
52
60
|
readonly name: string;
|
|
@@ -93,6 +101,7 @@ export type SkillSearchRecordsToolOptions<Target extends ToolTarget = ToolTarget
|
|
|
93
101
|
readonly fields?: readonly SkillSearchFieldInput<Target>[];
|
|
94
102
|
/** Maximum number of records the search returns. */
|
|
95
103
|
readonly limit?: number;
|
|
104
|
+
readonly filterVariables?: readonly SkillFilterVariable[];
|
|
96
105
|
};
|
|
97
106
|
export declare function skillSearchRecords<Target extends ToolTarget>(opts: SkillSearchRecordsToolOptions<Target>): SkillTool;
|
|
98
107
|
/**
|
|
@@ -106,6 +115,7 @@ export type SkillSearchTableToolV2<Target extends ElementCatalogRef = ElementCat
|
|
|
106
115
|
readonly fields: readonly SkillSearchFieldInput<Target>[];
|
|
107
116
|
/** Maximum number of records the search returns. */
|
|
108
117
|
readonly limit?: number;
|
|
118
|
+
readonly filterVariables?: readonly SkillFilterVariable[];
|
|
109
119
|
};
|
|
110
120
|
export declare function skillSearchTable<Target extends ElementCatalogRef>(opts: SkillSearchTableToolV2<Target>): SkillTool;
|
|
111
121
|
export type SkillCreateRecordToolV2<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
|
|
@@ -3,6 +3,14 @@ import { assertHandleDescriptionNotEmpty } from "../shared/handle-description.js
|
|
|
3
3
|
function targetOf(opts) {
|
|
4
4
|
return ("app" in opts && opts.app !== undefined ? opts.app : opts.element);
|
|
5
5
|
}
|
|
6
|
+
function filterVariableToken(variable) {
|
|
7
|
+
return {
|
|
8
|
+
id: variable.id.value,
|
|
9
|
+
name: variable.name,
|
|
10
|
+
description: variable.description,
|
|
11
|
+
required: variable.required,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
6
14
|
function serializeRunAs(runAs) {
|
|
7
15
|
if ("currentUser" in runAs)
|
|
8
16
|
return { currentUser: true };
|
|
@@ -95,6 +103,7 @@ export function skillSearchRecords(opts) {
|
|
|
95
103
|
queryDescription: opts.queryDescription,
|
|
96
104
|
...(opts.fields !== undefined ? { fields: opts.fields.map(searchFieldToken) } : {}),
|
|
97
105
|
...(opts.limit !== undefined ? { limit: opts.limit } : {}),
|
|
106
|
+
...(opts.filterVariables !== undefined ? { filterVariables: opts.filterVariables.map(filterVariableToken) } : {}),
|
|
98
107
|
},
|
|
99
108
|
});
|
|
100
109
|
}
|
|
@@ -107,6 +116,7 @@ export function skillSearchTable(opts) {
|
|
|
107
116
|
queryDescription: opts.queryDescription,
|
|
108
117
|
fields: opts.fields.map(searchFieldToken),
|
|
109
118
|
...(opts.limit !== undefined ? { limit: opts.limit } : {}),
|
|
119
|
+
...(opts.filterVariables !== undefined ? { filterVariables: opts.filterVariables.map(filterVariableToken) } : {}),
|
|
110
120
|
},
|
|
111
121
|
});
|
|
112
122
|
}
|
|
@@ -22,6 +22,12 @@ export interface NormalizedSkillToolField {
|
|
|
22
22
|
readonly required?: boolean;
|
|
23
23
|
readonly defaultValue?: string;
|
|
24
24
|
}
|
|
25
|
+
export interface NormalizedFilterVariable {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly description: string;
|
|
29
|
+
readonly required: boolean;
|
|
30
|
+
}
|
|
25
31
|
export type NormalizedSkillToolTarget = {
|
|
26
32
|
readonly kind: "self";
|
|
27
33
|
} | {
|
|
@@ -56,6 +62,7 @@ export interface NormalizedSkillTool {
|
|
|
56
62
|
readonly startMessage?: string;
|
|
57
63
|
readonly target?: NormalizedSkillToolTarget;
|
|
58
64
|
readonly fields?: readonly NormalizedSkillToolField[];
|
|
65
|
+
readonly filterVariables?: readonly NormalizedFilterVariable[];
|
|
59
66
|
readonly queryDescription?: string;
|
|
60
67
|
readonly limit?: number;
|
|
61
68
|
readonly handleDescription?: string;
|
|
@@ -349,8 +349,27 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
349
349
|
if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && attrs["filter"] !== undefined) {
|
|
350
350
|
ctx.diagnostics.push(`${where}: filter is not supported on the terraform path yet; a rebuilt stream will omit it`);
|
|
351
351
|
}
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
let filterVariables;
|
|
353
|
+
const rawFilterVariables = attrs["filter_variables"];
|
|
354
|
+
if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && Array.isArray(rawFilterVariables)) {
|
|
355
|
+
filterVariables = [];
|
|
356
|
+
for (const item of rawFilterVariables) {
|
|
357
|
+
if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item)) {
|
|
358
|
+
ctx.diagnostics.push(`${where}: filter_variables item has an unrecognized shape; dropped`);
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
const rec = item;
|
|
362
|
+
if (typeof rec["id"] !== "string" || rec["id"] === "" || typeof rec["name"] !== "string" || typeof rec["description"] !== "string" || typeof rec["required"] !== "boolean") {
|
|
363
|
+
ctx.diagnostics.push(`${where}: filter_variables item is missing a required attribute; dropped`);
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
filterVariables.push({ id: rec["id"], name: rec["name"], description: rec["description"], required: rec["required"] });
|
|
367
|
+
}
|
|
368
|
+
if (filterVariables.length === 0)
|
|
369
|
+
filterVariables = undefined;
|
|
370
|
+
}
|
|
371
|
+
else if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && rawFilterVariables !== undefined) {
|
|
372
|
+
ctx.diagnostics.push(`${where}: filter_variables is not a list; dropped`);
|
|
354
373
|
}
|
|
355
374
|
let handleDescription;
|
|
356
375
|
if (subType.typeKey === "updateRecord") {
|
|
@@ -366,6 +385,7 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
366
385
|
...common,
|
|
367
386
|
target,
|
|
368
387
|
...(fields !== undefined && { fields }),
|
|
388
|
+
...(filterVariables !== undefined && { filterVariables }),
|
|
369
389
|
...((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && {
|
|
370
390
|
queryDescription: optionalString(attrs, "query_description", where, ctx) ?? "",
|
|
371
391
|
}),
|
|
@@ -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) {
|
|
@@ -264,6 +277,14 @@ export function skillToolToTf(entry, ctx) {
|
|
|
264
277
|
if (inner.limit !== undefined)
|
|
265
278
|
attrs["result_limit"] = inner.limit;
|
|
266
279
|
}
|
|
280
|
+
if ((typeKey === "searchAspect" || typeKey === "searchTable") && inner.filterVariables !== undefined && inner.filterVariables.length > 0) {
|
|
281
|
+
attrs["filter_variables"] = inner.filterVariables.map((variable) => ({
|
|
282
|
+
id: typeof variable.id === "string" ? variable.id : variable.id?.value ?? "",
|
|
283
|
+
name: variable.name ?? "",
|
|
284
|
+
description: variable.description ?? "",
|
|
285
|
+
required: variable.required ?? false,
|
|
286
|
+
}));
|
|
287
|
+
}
|
|
267
288
|
if (inner.fields !== undefined || typeKey === "createRecord" || typeKey === "updateRecord") {
|
|
268
289
|
const fieldValues = [];
|
|
269
290
|
for (const f of inner.fields ?? []) {
|
|
@@ -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";
|
|
@@ -285,7 +293,28 @@ function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics
|
|
|
285
293
|
}
|
|
286
294
|
return true;
|
|
287
295
|
});
|
|
288
|
-
|
|
296
|
+
const widgetIds = [];
|
|
297
|
+
for (const [index, widget] of (section.widgets ?? []).entries()) {
|
|
298
|
+
const widgetWhere = `${where}.widgets[${index}]`;
|
|
299
|
+
const key = widget.refName ?? "";
|
|
300
|
+
if (widget.__kind !== "widget" || key === "") {
|
|
301
|
+
diagnostics.push(`${widgetWhere}: expected a typed widget reference; dropped`);
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
if (widget.parent !== undefined && widget.parent !== ownerRefName) {
|
|
305
|
+
diagnostics.push(`${widgetWhere}: widget belongs to ${JSON.stringify(widget.parent)}, not ${JSON.stringify(ownerRefName)}; dropped`);
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (!widgetKeys?.has(key)) {
|
|
309
|
+
diagnostics.push(`${widgetWhere}: widget ${JSON.stringify(key)} is not declared in this ${scope}; dropped`);
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
widgetIds.push(expr.resourceAttr(WIDGET_RESOURCE_TYPE, scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(key), scope), ["id"]));
|
|
313
|
+
}
|
|
314
|
+
sec.field_ids = [
|
|
315
|
+
...resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics, fieldAddresses),
|
|
316
|
+
...widgetIds,
|
|
317
|
+
];
|
|
289
318
|
}
|
|
290
319
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && section.name !== undefined) {
|
|
291
320
|
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,28 @@ 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
|
+
* The widget only names the target and display columns. The platform finds
|
|
15
|
+
* rows through an authored `relationships[]` join on **this** app/element
|
|
16
|
+
* whose columns join comparable stored values (TEXT→TEXT, or this object's
|
|
17
|
+
* `relationField` → related title/id). Do not join system `"id"` (HANDLE)
|
|
18
|
+
* to a child `relationField`. A child `relationField` / dynamic dropdown
|
|
19
|
+
* with `autoRelate` stores an instance link; it does not populate this widget.
|
|
20
|
+
*/
|
|
21
|
+
export interface RelatedRecordsWidget<Target extends AppOrElementRef = AppOrElementRef> {
|
|
12
22
|
readonly type: "relatedRecords";
|
|
13
23
|
readonly name: string;
|
|
14
|
-
readonly target:
|
|
15
|
-
readonly columns?: readonly FieldRef[];
|
|
24
|
+
readonly target: Target;
|
|
25
|
+
readonly columns?: readonly (FieldRef | RecordIdentityRef<Target>)[];
|
|
16
26
|
readonly rows?: number;
|
|
17
27
|
}
|
|
18
|
-
export interface LinkRecordsWidget extends WidgetButtonStyle {
|
|
28
|
+
export interface LinkRecordsWidget<Target extends AppOrElementRef = AppOrElementRef> extends WidgetButtonStyle {
|
|
19
29
|
readonly type: "linkRecords";
|
|
20
30
|
readonly name: string;
|
|
21
|
-
readonly target:
|
|
22
|
-
readonly columns?: readonly FieldRef[];
|
|
31
|
+
readonly target: Target;
|
|
32
|
+
readonly columns?: readonly (FieldRef | RecordIdentityRef<Target>)[];
|
|
23
33
|
readonly rows?: number;
|
|
24
34
|
/** Provider-native filter payload. */
|
|
25
35
|
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[];
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { dataRefLabel, optionalBoolean, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
|
-
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
2
|
+
import { bareChildResourceLabel, isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
3
3
|
import { AUTOMATION_RESOURCE_TYPE } from "../automation/types.js";
|
|
4
4
|
import { fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
5
5
|
import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
6
6
|
import { WIDGET_RESOURCE_TYPE } from "./module.js";
|
|
7
7
|
import { filterFromTf } from "../access-policy/from-tf.js";
|
|
8
|
+
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
8
9
|
const KNOWN_ROOT_ATTRS = new Set(["object_id", "related_object", "related_link_action", "related_create_action", "run_automation_action"]);
|
|
9
|
-
export function widgetsFromTf(blocks, owner, ctx) {
|
|
10
|
+
export function widgetsFromTf(blocks, owner, ctx, dynamicLayoutCompanionLabels = new Set()) {
|
|
10
11
|
const out = [];
|
|
11
12
|
for (const block of blocks) {
|
|
12
|
-
const widget = widgetFromTf(block, owner, ctx);
|
|
13
|
+
const widget = widgetFromTf(block, owner, ctx, dynamicLayoutCompanionLabels);
|
|
13
14
|
if (widget !== undefined)
|
|
14
15
|
out.push(widget);
|
|
15
16
|
}
|
|
16
17
|
return out;
|
|
17
18
|
}
|
|
18
|
-
function widgetFromTf(block, owner, ctx) {
|
|
19
|
+
function widgetFromTf(block, owner, ctx, dynamicLayoutCompanionLabels) {
|
|
19
20
|
const label = block.label ?? "";
|
|
20
21
|
const where = `${WIDGET_RESOURCE_TYPE}.${label || "?"}`;
|
|
21
22
|
for (const attr of Object.keys(block.attrs)) {
|
|
@@ -32,6 +33,8 @@ function widgetFromTf(block, owner, ctx) {
|
|
|
32
33
|
return undefined;
|
|
33
34
|
}
|
|
34
35
|
const variant = variants[0];
|
|
36
|
+
if (variant === "run_automation_action" && dynamicLayoutCompanionLabels.has(label))
|
|
37
|
+
return undefined;
|
|
35
38
|
const body = plainObject(block.attrs[variant]);
|
|
36
39
|
if (body === undefined) {
|
|
37
40
|
ctx.diagnostics.push(`${where}.${variant}: expected an object; skipped`);
|
|
@@ -54,9 +57,26 @@ function widgetFromTf(block, owner, ctx) {
|
|
|
54
57
|
const target = aspectRef(body["object_id"], owner, ctx);
|
|
55
58
|
if (target === undefined)
|
|
56
59
|
return undefined;
|
|
57
|
-
const
|
|
58
|
-
?
|
|
59
|
-
:
|
|
60
|
+
const targetTfLabel = typeof target !== "string" && (target.kind === "app" || target.kind === "element")
|
|
61
|
+
? (target.key === owner.ownerRefName ? owner.ownerTfLabel : target.namespace ?? tsLabelToTfLabel(target.key))
|
|
62
|
+
: undefined;
|
|
63
|
+
const filterOwner = targetTfLabel !== undefined && typeof target !== "string" && (target.kind === "app" || target.kind === "element")
|
|
64
|
+
? {
|
|
65
|
+
type: target.kind === "app" ? "elementum_app" : "elementum_element",
|
|
66
|
+
label: targetTfLabel,
|
|
67
|
+
ownerRefName: target.key,
|
|
68
|
+
ownerTfLabel: targetTfLabel,
|
|
69
|
+
scope: target.kind,
|
|
70
|
+
foreignFieldRefsById: ctx.foreignFieldRefsById,
|
|
71
|
+
}
|
|
72
|
+
: {
|
|
73
|
+
type: owner.type,
|
|
74
|
+
label: owner.label,
|
|
75
|
+
ownerRefName: owner.ownerRefName,
|
|
76
|
+
ownerTfLabel: owner.ownerTfLabel,
|
|
77
|
+
scope: owner.scope,
|
|
78
|
+
foreignFieldRefsById: ctx.foreignFieldRefsById,
|
|
79
|
+
};
|
|
60
80
|
const filter = body["filter"] === undefined
|
|
61
81
|
? undefined
|
|
62
82
|
: filterFromTf(body["filter"], filterOwner, `${where}.${variant}.filter`);
|
|
@@ -89,7 +109,7 @@ function widgetFromTf(block, owner, ctx) {
|
|
|
89
109
|
return [];
|
|
90
110
|
}
|
|
91
111
|
const rec = raw;
|
|
92
|
-
const field = ownerFieldRef(rec["field_id"], owner);
|
|
112
|
+
const field = ownerFieldRef(rec["field_id"], owner, ctx);
|
|
93
113
|
return [{
|
|
94
114
|
name: typeof rec["name"] === "string" ? rec["name"] : "",
|
|
95
115
|
fieldType: typeof rec["field_type"] === "string" ? rec["field_type"] : "TEXT",
|
|
@@ -146,7 +166,7 @@ function columnsAndRows(attrs, target, owner, ctx, where) {
|
|
|
146
166
|
}
|
|
147
167
|
function aspectRef(value, owner, ctx) {
|
|
148
168
|
if (typeof value === "string")
|
|
149
|
-
return value;
|
|
169
|
+
return aspectRefFromRawId(value, owner, ctx) ?? value;
|
|
150
170
|
if (resourceRefLabel(value, owner.type) === owner.label) {
|
|
151
171
|
return { kind: owner.scope, key: owner.ownerRefName, name: owner.ownerRefName };
|
|
152
172
|
}
|
|
@@ -155,18 +175,45 @@ function aspectRef(value, owner, ctx) {
|
|
|
155
175
|
if (resourceLabel !== undefined)
|
|
156
176
|
return { kind, key: tfLabelToTsLabel(resourceLabel), name: tfLabelToTsLabel(resourceLabel) };
|
|
157
177
|
const dataLabel = dataRefLabel(value, type);
|
|
158
|
-
if (dataLabel !== undefined)
|
|
159
|
-
|
|
160
|
-
return { kind, key: tfLabelToTsLabel(dataLabel), name };
|
|
161
|
-
}
|
|
178
|
+
if (dataLabel !== undefined)
|
|
179
|
+
return { kind, ...resolveDataAspectTarget(ctx, kind, dataLabel) };
|
|
162
180
|
}
|
|
163
181
|
return undefined;
|
|
164
182
|
}
|
|
183
|
+
function aspectRefFromRawId(id, owner, ctx) {
|
|
184
|
+
if (id === "")
|
|
185
|
+
return undefined;
|
|
186
|
+
const imported = ctx.importedResource?.(id);
|
|
187
|
+
if (imported === undefined)
|
|
188
|
+
return undefined;
|
|
189
|
+
if (imported.type === owner.type && imported.label === owner.label) {
|
|
190
|
+
return { kind: owner.scope, key: owner.ownerRefName, name: owner.ownerRefName };
|
|
191
|
+
}
|
|
192
|
+
if (imported.type !== "elementum_app" && imported.type !== "elementum_element")
|
|
193
|
+
return undefined;
|
|
194
|
+
const kind = imported.type === "elementum_app" ? "app" : "element";
|
|
195
|
+
const name = typeof imported.attrs["name"] === "string" ? imported.attrs["name"] : tfLabelToTsLabel(imported.label);
|
|
196
|
+
const namespace = typeof imported.attrs["namespace"] === "string" ? imported.attrs["namespace"] : undefined;
|
|
197
|
+
const refName = namespace !== undefined
|
|
198
|
+
? (kind === "app" ? ctx.foreignAppRefNamespaces?.get(namespace) : ctx.foreignElementRefNamespaces?.get(namespace))
|
|
199
|
+
: (kind === "app" ? ctx.foreignAppRefNames?.get(name) : ctx.foreignElementRefNames?.get(name));
|
|
200
|
+
return {
|
|
201
|
+
kind,
|
|
202
|
+
key: refName ?? tfLabelToTsLabel(imported.label),
|
|
203
|
+
name,
|
|
204
|
+
...(namespace !== undefined ? { namespace } : {}),
|
|
205
|
+
...(refName !== undefined ? { catalogRef: true } : {}),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
165
208
|
function widgetFieldRef(value, target, owner, ctx) {
|
|
166
209
|
if (typeof value === "string")
|
|
167
|
-
return value;
|
|
168
|
-
const targetLabel = typeof target === "string"
|
|
169
|
-
|
|
210
|
+
return fieldRefFromRawId(value, target, owner, ctx) ?? value;
|
|
211
|
+
const targetLabel = typeof target === "string"
|
|
212
|
+
? undefined
|
|
213
|
+
: target.key === owner.ownerRefName
|
|
214
|
+
? owner.ownerTfLabel
|
|
215
|
+
: target.namespace ?? tsLabelToTfLabel(target.key);
|
|
216
|
+
const targetScope = typeof target === "string" || target.kind === "automation" || target.kind === "field" || target.kind === "recordIdentity" ? owner.scope : target.kind;
|
|
170
217
|
if (targetLabel !== undefined) {
|
|
171
218
|
const key = fieldKeyFromTfRef(value, targetLabel, targetScope);
|
|
172
219
|
if (key !== undefined) {
|
|
@@ -179,6 +226,10 @@ function widgetFieldRef(value, target, owner, ctx) {
|
|
|
179
226
|
return { kind: "field", key: tfLabelToTsLabel(dataLabel), name, ...(typeof target !== "string" && { parent: target.key }), fieldType: "TEXT" };
|
|
180
227
|
}
|
|
181
228
|
if (isTfExpr(value) && value.$expr === "resource-attr" && value.path.length === 1 && value.path[0] === "id") {
|
|
229
|
+
const identityTarget = recordIdentityTarget(value.type, target);
|
|
230
|
+
if (identityTarget !== undefined) {
|
|
231
|
+
return { kind: "recordIdentity", key: "id", name: "Record ID", target: identityTarget };
|
|
232
|
+
}
|
|
182
233
|
const subType = SUB_TYPE_BY_RESOURCE.get(value.type);
|
|
183
234
|
if (subType !== undefined) {
|
|
184
235
|
return { kind: "field", key: tfLabelToTsLabel(value.label), name: tfLabelToTsLabel(value.label), ...(typeof target !== "string" && { parent: target.key }), fieldType: subType.authoringType };
|
|
@@ -186,6 +237,12 @@ function widgetFieldRef(value, target, owner, ctx) {
|
|
|
186
237
|
}
|
|
187
238
|
return undefined;
|
|
188
239
|
}
|
|
240
|
+
function recordIdentityTarget(resourceType, target) {
|
|
241
|
+
if (typeof target === "string" || (target.kind !== "app" && target.kind !== "element"))
|
|
242
|
+
return undefined;
|
|
243
|
+
const targetType = target.kind === "app" ? "elementum_app" : "elementum_element";
|
|
244
|
+
return resourceType === WIDGET_RESOURCE_TYPE || resourceType === targetType ? target : undefined;
|
|
245
|
+
}
|
|
189
246
|
function automationRef(value, owner) {
|
|
190
247
|
if (typeof value === "string")
|
|
191
248
|
return value;
|
|
@@ -199,11 +256,68 @@ function automationRef(value, owner) {
|
|
|
199
256
|
parent: owner.ownerRefName,
|
|
200
257
|
};
|
|
201
258
|
}
|
|
202
|
-
function ownerFieldRef(value, owner) {
|
|
259
|
+
function ownerFieldRef(value, owner, ctx) {
|
|
203
260
|
if (value === undefined || value === null)
|
|
204
261
|
return undefined;
|
|
205
262
|
if (typeof value === "string")
|
|
206
|
-
return value;
|
|
263
|
+
return fieldRefFromRawId(value, owner.ownerRefName, owner, ctx) ?? value;
|
|
207
264
|
const key = fieldKeyFromTfRef(value, owner.ownerTfLabel, owner.scope);
|
|
208
265
|
return key === undefined ? undefined : { kind: "field", key, name: key, parent: owner.ownerRefName, fieldType: "TEXT" };
|
|
209
266
|
}
|
|
267
|
+
function fieldRefFromRawId(id, target, owner, ctx) {
|
|
268
|
+
if (id === "")
|
|
269
|
+
return undefined;
|
|
270
|
+
const stateRef = ctx.foreignFieldRefsById?.get(id);
|
|
271
|
+
if (stateRef !== undefined) {
|
|
272
|
+
// runAutomation field_id is owner-scoped (same check as fieldKeyFromTfValue).
|
|
273
|
+
// Widget columns accept any registry hit and keep the field's real parent.
|
|
274
|
+
if (typeof target === "string" && target === owner.ownerRefName && stateRef.ownerRefName !== owner.ownerRefName) {
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
kind: "field",
|
|
279
|
+
key: stateRef.fieldKey,
|
|
280
|
+
name: stateRef.fieldName ?? stateRef.fieldKey,
|
|
281
|
+
parent: stateRef.ownerRefName,
|
|
282
|
+
fieldType: "TEXT",
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
const imported = ctx.importedResource?.(id);
|
|
286
|
+
if (imported === undefined)
|
|
287
|
+
return undefined;
|
|
288
|
+
const subType = SUB_TYPE_BY_RESOURCE.get(imported.type);
|
|
289
|
+
if (subType === undefined)
|
|
290
|
+
return undefined;
|
|
291
|
+
const ownerKey = fieldKeyIfScopedTo(imported.type, imported.label, owner.ownerTfLabel, owner.scope);
|
|
292
|
+
if (ownerKey !== undefined) {
|
|
293
|
+
return {
|
|
294
|
+
kind: "field",
|
|
295
|
+
key: ownerKey,
|
|
296
|
+
name: typeof imported.attrs["name"] === "string" ? imported.attrs["name"] : ownerKey,
|
|
297
|
+
parent: owner.ownerRefName,
|
|
298
|
+
fieldType: subType.authoringType,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
if (typeof target !== "string" && target.kind !== "automation" && target.kind !== "field" && target.kind !== "recordIdentity") {
|
|
302
|
+
const targetTfLabel = target.key === owner.ownerRefName
|
|
303
|
+
? owner.ownerTfLabel
|
|
304
|
+
: target.namespace ?? tsLabelToTfLabel(target.key);
|
|
305
|
+
const targetKey = fieldKeyIfScopedTo(imported.type, imported.label, targetTfLabel, target.kind);
|
|
306
|
+
if (targetKey !== undefined) {
|
|
307
|
+
return {
|
|
308
|
+
kind: "field",
|
|
309
|
+
key: targetKey,
|
|
310
|
+
name: typeof imported.attrs["name"] === "string" ? imported.attrs["name"] : targetKey,
|
|
311
|
+
parent: target.key,
|
|
312
|
+
fieldType: subType.authoringType,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
/** `fieldKeyFromTfRef` camelCases any label; only treat it as owned when the scoped prefix was actually stripped. */
|
|
319
|
+
function fieldKeyIfScopedTo(type, label, ownerTfLabel, scope) {
|
|
320
|
+
if (bareChildResourceLabel(ownerTfLabel, label, scope) === label)
|
|
321
|
+
return undefined;
|
|
322
|
+
return fieldKeyFromTfRef({ $expr: "resource-attr", type, label, path: ["id"] }, ownerTfLabel, scope);
|
|
323
|
+
}
|
|
@@ -8,6 +8,7 @@ interface RefWire {
|
|
|
8
8
|
readonly namespace?: string;
|
|
9
9
|
readonly parent?: string;
|
|
10
10
|
readonly fieldType?: string;
|
|
11
|
+
readonly target?: RefWire | string;
|
|
11
12
|
}
|
|
12
13
|
interface WidgetParameterWire {
|
|
13
14
|
readonly name?: string;
|
|
@@ -31,6 +32,16 @@ export interface AppWidgetWire {
|
|
|
31
32
|
readonly automation?: RefWire | string;
|
|
32
33
|
readonly parameters?: readonly WidgetParameterWire[];
|
|
33
34
|
}
|
|
35
|
+
export interface RelationshipTargetWire {
|
|
36
|
+
readonly kind?: string;
|
|
37
|
+
readonly refName?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function relationshipTargetsFromBag(relationships: Readonly<Record<string, {
|
|
40
|
+
readonly target?: {
|
|
41
|
+
readonly __kind?: string;
|
|
42
|
+
readonly refName?: string;
|
|
43
|
+
};
|
|
44
|
+
}>> | undefined): RelationshipTargetWire[];
|
|
34
45
|
export interface WidgetsToTfOptions {
|
|
35
46
|
readonly ownerRefName: string;
|
|
36
47
|
readonly ownerTfLabel: string;
|
|
@@ -41,6 +52,12 @@ export interface WidgetsToTfOptions {
|
|
|
41
52
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
42
53
|
readonly diagnostics: string[];
|
|
43
54
|
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
55
|
+
/**
|
|
56
|
+
* Targets of this owner's authored `relationships[]` joins. A foreign
|
|
57
|
+
* `relatedRecords` widget needs one of these; child `relationField` /
|
|
58
|
+
* `autoRelate` does not populate the widget.
|
|
59
|
+
*/
|
|
60
|
+
readonly relationshipTargets?: readonly RelationshipTargetWire[];
|
|
44
61
|
}
|
|
45
62
|
export declare function widgetsToTf(widgets: Readonly<Record<string, AppWidgetWire>> | undefined, opts: WidgetsToTfOptions): TfBlock[];
|
|
46
63
|
export {};
|