@elementumai/edk 0.9.10 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sdk/src/catalog/factories.d.ts +8 -1
- package/dist-sdk/src/catalog/factories.js +13 -1
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/types.d.ts +19 -2
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/engine/build/context.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +3 -3
- package/dist-sdk/src/entities/access-policy/from-tf.js +27 -8
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +13 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +34 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +13 -7
- package/dist-sdk/src/entities/agent-tool/to-tf.js +13 -0
- package/dist-sdk/src/entities/app/build.d.ts +15 -2
- package/dist-sdk/src/entities/app/build.js +6 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +13 -3
- package/dist-sdk/src/entities/app/from-tf.js +6 -3
- package/dist-sdk/src/entities/app/to-tf.js +5 -1
- package/dist-sdk/src/entities/automation/from-tf.js +113 -1
- package/dist-sdk/src/entities/automation/module.js +1 -0
- package/dist-sdk/src/entities/automation/tasks.js +17 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/automation/to-tf.js +153 -46
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +11 -2
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -1
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +8 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +12 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +64 -10
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +54 -6
- package/dist-sdk/src/entities/element/build.d.ts +7 -0
- package/dist-sdk/src/entities/element/from-tf.js +1 -1
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +19 -1
- package/dist-sdk/src/entities/field/build.d.ts +10 -1
- package/dist-sdk/src/entities/field/build.js +2 -1
- package/dist-sdk/src/entities/field/calc/index.js +7 -7
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +32 -0
- package/dist-sdk/src/entities/field/calc/types.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +10 -2
- package/dist-sdk/src/entities/relationship/build.d.ts +14 -7
- package/dist-sdk/src/entities/relationship/from-tf.js +14 -14
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +18 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +21 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +16 -4
- package/dist-sdk/src/entities/skill/tools.d.ts +10 -0
- package/dist-sdk/src/entities/skill/tools.js +10 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +22 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +21 -0
- package/dist-sdk/src/entities/table/catalog-render.js +2 -1
- package/dist-sdk/src/entities/view/from-tf.js +9 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/view/to-tf.js +34 -5
- package/dist-sdk/src/entities/widget/build.d.ts +17 -7
- package/dist-sdk/src/entities/widget/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/widget/from-tf.js +132 -18
- package/dist-sdk/src/entities/widget/to-tf.d.ts +17 -0
- package/dist-sdk/src/entities/widget/to-tf.js +40 -0
- package/dist-sdk/src/graph/types.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { splitCamelCase } from "../../engine/tf/labels.js";
|
|
1
2
|
/**
|
|
2
3
|
* Public field-component keys are listed exhaustively against the authoring
|
|
3
4
|
* variant map. Adding a field component there without adding it here is a
|
|
@@ -45,3 +46,14 @@ export const DYNAMIC_LAYOUT_COMPARISON_KEYS = new Set([
|
|
|
45
46
|
"equals", "notEquals", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual",
|
|
46
47
|
"contains", "notContains", "in", "notIn", "empty", "notEmpty",
|
|
47
48
|
]);
|
|
49
|
+
/**
|
|
50
|
+
* Dynamic-layout automation buttons are runnable only after a parameterless
|
|
51
|
+
* run-automation display widget exists for the selected automation. App Admin
|
|
52
|
+
* creates that widget as a save side effect; EDK emits an explicit companion
|
|
53
|
+
* resource instead so OpenTofu owns the complete contract.
|
|
54
|
+
*/
|
|
55
|
+
export const DYNAMIC_LAYOUT_ACTION_WIDGET_NAME_PREFIX = "EDK dynamic layout action ";
|
|
56
|
+
export function dynamicLayoutActionWidgetName(layoutKey, componentId) {
|
|
57
|
+
const words = (value) => splitCamelCase(value.replace(/[_-]+/g, " ")).toLowerCase();
|
|
58
|
+
return `${DYNAMIC_LAYOUT_ACTION_WIDGET_NAME_PREFIX}${words(layoutKey)} ${words(componentId)}`;
|
|
59
|
+
}
|
|
@@ -8,3 +8,10 @@ export interface DynamicLayoutOwner {
|
|
|
8
8
|
readonly ownerTfLabel: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function dynamicLayoutsFromTf(blocks: readonly TfBlock[], owner: DynamicLayoutOwner, ctx: FromTfContext): NormalizedDynamicLayout[];
|
|
11
|
+
/**
|
|
12
|
+
* Widget resource labels referenced by dynamic-layout automation buttons.
|
|
13
|
+
* The label is the companion widget's stable Terraform identity; its display
|
|
14
|
+
* name is mutable and cannot safely distinguish generated from authored
|
|
15
|
+
* widgets during pull.
|
|
16
|
+
*/
|
|
17
|
+
export declare function dynamicLayoutCompanionWidgetLabels(blocks: readonly TfBlock[]): ReadonlySet<string>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { dataRefLabel, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
2
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
3
3
|
import { fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
4
|
+
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
5
|
+
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
4
6
|
import { DYNAMIC_LAYOUT_RESOURCE_TYPE } from "./module.js";
|
|
5
7
|
import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY, } from "./dialect.js";
|
|
6
8
|
const KNOWN_ATTRS = new Set([
|
|
@@ -17,6 +19,30 @@ export function dynamicLayoutsFromTf(blocks, owner, ctx) {
|
|
|
17
19
|
}
|
|
18
20
|
return out;
|
|
19
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Widget resource labels referenced by dynamic-layout automation buttons.
|
|
24
|
+
* The label is the companion widget's stable Terraform identity; its display
|
|
25
|
+
* name is mutable and cannot safely distinguish generated from authored
|
|
26
|
+
* widgets during pull.
|
|
27
|
+
*/
|
|
28
|
+
export function dynamicLayoutCompanionWidgetLabels(blocks) {
|
|
29
|
+
const labels = new Set();
|
|
30
|
+
for (const block of blocks) {
|
|
31
|
+
const components = plainObject(block.attrs["components"]);
|
|
32
|
+
if (components === undefined)
|
|
33
|
+
continue;
|
|
34
|
+
for (const raw of Object.values(components)) {
|
|
35
|
+
const component = plainObject(raw);
|
|
36
|
+
const button = component === undefined ? undefined : plainObject(component["automation_button"]);
|
|
37
|
+
const label = button === undefined
|
|
38
|
+
? undefined
|
|
39
|
+
: resourceRefLabel(button["widget_id"], WIDGET_RESOURCE_TYPE);
|
|
40
|
+
if (label !== undefined)
|
|
41
|
+
labels.add(label);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return labels;
|
|
45
|
+
}
|
|
20
46
|
function dynamicLayoutFromTf(block, owner, ctx) {
|
|
21
47
|
const where = `${DYNAMIC_LAYOUT_RESOURCE_TYPE}.${block.label ?? "?"}`;
|
|
22
48
|
for (const key of Object.keys(block.attrs)) {
|
|
@@ -91,15 +117,30 @@ function componentMap(values, owner, ctx, where) {
|
|
|
91
117
|
});
|
|
92
118
|
delete update["fieldIds"];
|
|
93
119
|
}
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
const label = resourceRefLabel(
|
|
120
|
+
const section = plainUnknownObject(component["section"]);
|
|
121
|
+
if (section !== undefined && section["agentId"] !== undefined) {
|
|
122
|
+
const label = resourceRefLabel(section["agentId"], "elementum_agent");
|
|
97
123
|
if (label !== undefined) {
|
|
98
|
-
|
|
124
|
+
section["agent"] = pulledRef("agent", scopedLabelToBagKey(owner.ownerTfLabel, label, "app"), owner.ownerRefName);
|
|
99
125
|
}
|
|
100
126
|
else
|
|
101
|
-
ctx.diagnostics.push(`${where}.components.${id}.
|
|
102
|
-
delete
|
|
127
|
+
ctx.diagnostics.push(`${where}.components.${id}.section: agent_id is not a managed agent ref; dropped`);
|
|
128
|
+
delete section["agentId"];
|
|
129
|
+
}
|
|
130
|
+
const automation = plainUnknownObject(component["automationButton"]);
|
|
131
|
+
if (automation !== undefined) {
|
|
132
|
+
// Build derives the backing widget from the component itself, so the
|
|
133
|
+
// binding is never authored and must not be printed back into source.
|
|
134
|
+
delete automation["widgetId"];
|
|
135
|
+
if (automation["automationId"] !== undefined) {
|
|
136
|
+
const label = resourceRefLabel(automation["automationId"], "elementum_automation");
|
|
137
|
+
if (label !== undefined) {
|
|
138
|
+
automation["automation"] = pulledRef("automation", scopedLabelToBagKey(owner.ownerTfLabel, label, "app"), owner.ownerRefName);
|
|
139
|
+
}
|
|
140
|
+
else
|
|
141
|
+
ctx.diagnostics.push(`${where}.components.${id}.automationButton: automation_id is not a managed automation ref; dropped`);
|
|
142
|
+
delete automation["automationId"];
|
|
143
|
+
}
|
|
103
144
|
}
|
|
104
145
|
const create = plainUnknownObject(component["createButton"]);
|
|
105
146
|
if (create !== undefined && create["targetAspectId"] !== undefined) {
|
|
@@ -208,13 +249,26 @@ function aspectRef(value, owner, ctx) {
|
|
|
208
249
|
if (resourceLabel !== undefined)
|
|
209
250
|
return pulledRef(kind, tfLabelToTsLabel(resourceLabel));
|
|
210
251
|
const dataLabel = dataRefLabel(value, type);
|
|
211
|
-
if (dataLabel !== undefined)
|
|
212
|
-
|
|
252
|
+
if (dataLabel !== undefined) {
|
|
253
|
+
// Same namespace-only foreign-target shape widget/from-tf.ts and
|
|
254
|
+
// dashboard/from-tf.ts resolve via the shared helper - a guessed
|
|
255
|
+
// tfLabel-derived name matches nothing on the platform and breaks
|
|
256
|
+
// elementum build/plan. No printer-side catalogRef distinction here
|
|
257
|
+
// (unlike widget), so only key/name/namespace are carried through.
|
|
258
|
+
const resolved = resolveDataAspectTarget(ctx, kind, dataLabel);
|
|
259
|
+
return pulledRef(kind, resolved.key, undefined, resolved.name, resolved.namespace);
|
|
260
|
+
}
|
|
213
261
|
}
|
|
214
262
|
return undefined;
|
|
215
263
|
}
|
|
216
|
-
function pulledRef(kind, key, parent, name) {
|
|
217
|
-
return {
|
|
264
|
+
function pulledRef(kind, key, parent, name, namespace) {
|
|
265
|
+
return {
|
|
266
|
+
__pulledRef: kind,
|
|
267
|
+
key,
|
|
268
|
+
...(parent !== undefined && { parent }),
|
|
269
|
+
...(name !== undefined && { name }),
|
|
270
|
+
...(namespace !== undefined && { namespace }),
|
|
271
|
+
};
|
|
218
272
|
}
|
|
219
273
|
function camelObject(value) {
|
|
220
274
|
const out = {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
2
2
|
import { resolveForeignRef } from "../shared/foreign-ref.js";
|
|
3
|
-
import { expr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
3
|
+
import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
4
4
|
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
5
5
|
import { SYSTEM_FIELD_ID_ATTR_BY_KEY } from "../view/types.js";
|
|
6
|
+
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
6
7
|
import { DYNAMIC_LAYOUT_RESOURCE_TYPE } from "./module.js";
|
|
7
|
-
import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS, dynamicLayoutFieldComponentWireKey, } from "./dialect.js";
|
|
8
|
+
import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS, dynamicLayoutActionWidgetName, dynamicLayoutFieldComponentWireKey, } from "./dialect.js";
|
|
8
9
|
export function dynamicLayoutsToTf(layouts, opts) {
|
|
9
10
|
const blocks = [];
|
|
10
11
|
for (const [key, layout] of Object.entries(layouts ?? {})) {
|
|
@@ -13,6 +14,7 @@ export function dynamicLayoutsToTf(layouts, opts) {
|
|
|
13
14
|
opts.diagnostics.push(`${where}: key is not a canonical tsLabel; dropped`);
|
|
14
15
|
continue;
|
|
15
16
|
}
|
|
17
|
+
const componentResult = componentMap(layout.components ?? {}, key, where, opts);
|
|
16
18
|
const attrs = {
|
|
17
19
|
app_id: opts.objectId,
|
|
18
20
|
name: layout.name ?? "",
|
|
@@ -20,7 +22,7 @@ export function dynamicLayoutsToTf(layouts, opts) {
|
|
|
20
22
|
document_id: layout.documentId ?? "",
|
|
21
23
|
document_version: layout.documentVersion ?? "1.0.0",
|
|
22
24
|
root_component: layout.rootComponent ?? "",
|
|
23
|
-
components:
|
|
25
|
+
components: componentResult.components,
|
|
24
26
|
};
|
|
25
27
|
if (layout.description !== undefined)
|
|
26
28
|
attrs["description"] = layout.description;
|
|
@@ -47,11 +49,16 @@ export function dynamicLayoutsToTf(layouts, opts) {
|
|
|
47
49
|
label: scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(key), "app"),
|
|
48
50
|
attrs,
|
|
49
51
|
});
|
|
52
|
+
blocks.push(...componentResult.companionWidgets);
|
|
50
53
|
}
|
|
51
54
|
return blocks;
|
|
52
55
|
}
|
|
53
|
-
function
|
|
56
|
+
function companionWidgetLabel(layoutKey, componentId, opts) {
|
|
57
|
+
return scopedResourceLabel(opts.ownerTfLabel, sanitizeName(dynamicLayoutActionWidgetName(layoutKey, componentId)), "app");
|
|
58
|
+
}
|
|
59
|
+
function componentMap(components, layoutKey, where, opts) {
|
|
54
60
|
const out = {};
|
|
61
|
+
const companionWidgets = [];
|
|
55
62
|
for (const [componentId, component] of Object.entries(components)) {
|
|
56
63
|
const attrs = {};
|
|
57
64
|
for (const [key, value] of Object.entries(component)) {
|
|
@@ -64,6 +71,17 @@ function componentMap(components, where, opts) {
|
|
|
64
71
|
const wireKey = dynamicLayoutFieldComponentWireKey(key);
|
|
65
72
|
attrs[snakeKey(wireKey)] = fieldComponent(value, `${where}.components[${JSON.stringify(componentId)}].${key}`, opts);
|
|
66
73
|
}
|
|
74
|
+
else if (key === "section") {
|
|
75
|
+
const rec = object(value);
|
|
76
|
+
const section = snakeObject(rec, where, opts);
|
|
77
|
+
delete section["agent"];
|
|
78
|
+
if (rec["agent"] !== undefined) {
|
|
79
|
+
const agent = resolveAgent(rec["agent"], `${where}.components.${componentId}.section`, opts);
|
|
80
|
+
if (agent !== undefined)
|
|
81
|
+
section["agent_id"] = agent;
|
|
82
|
+
}
|
|
83
|
+
attrs["section"] = section;
|
|
84
|
+
}
|
|
67
85
|
else if (key === "updateBlock") {
|
|
68
86
|
const rec = object(value);
|
|
69
87
|
const block = {};
|
|
@@ -83,8 +101,26 @@ function componentMap(components, where, opts) {
|
|
|
83
101
|
delete button["automation"];
|
|
84
102
|
const token = rec["automation"];
|
|
85
103
|
const automation = resolveAutomation(token, `${where}.components.${componentId}.automationButton`, opts);
|
|
86
|
-
if (automation !== undefined)
|
|
104
|
+
if (automation !== undefined) {
|
|
87
105
|
button["automation_id"] = automation;
|
|
106
|
+
// The renderer executes the automation through a widget, not the
|
|
107
|
+
// automation id; without this binding it reports the button as not
|
|
108
|
+
// ready to run. Points at the companion widget build emits alongside.
|
|
109
|
+
button["widget_id"] = expr.resourceAttr(WIDGET_RESOURCE_TYPE, companionWidgetLabel(layoutKey, componentId, opts), ["id"]);
|
|
110
|
+
companionWidgets.push({
|
|
111
|
+
kind: "resource",
|
|
112
|
+
type: WIDGET_RESOURCE_TYPE,
|
|
113
|
+
label: companionWidgetLabel(layoutKey, componentId, opts),
|
|
114
|
+
attrs: {
|
|
115
|
+
object_id: opts.objectId,
|
|
116
|
+
run_automation_action: {
|
|
117
|
+
name: dynamicLayoutActionWidgetName(layoutKey, componentId),
|
|
118
|
+
automation_id: automation,
|
|
119
|
+
button_type: "PRIMARY",
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
88
124
|
attrs["automation_button"] = button;
|
|
89
125
|
}
|
|
90
126
|
else if (key === "createButton") {
|
|
@@ -102,7 +138,7 @@ function componentMap(components, where, opts) {
|
|
|
102
138
|
}
|
|
103
139
|
out[componentId] = attrs;
|
|
104
140
|
}
|
|
105
|
-
return out;
|
|
141
|
+
return { components: out, companionWidgets };
|
|
106
142
|
}
|
|
107
143
|
function fieldComponent(value, where, opts) {
|
|
108
144
|
const rec = object(value);
|
|
@@ -228,6 +264,18 @@ function resolveAutomation(token, where, opts) {
|
|
|
228
264
|
}
|
|
229
265
|
return expr.resourceAttr("elementum_automation", scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(refName), "app"), ["id"]);
|
|
230
266
|
}
|
|
267
|
+
function resolveAgent(token, where, opts) {
|
|
268
|
+
const refName = token?.refName ?? "";
|
|
269
|
+
if (token?.parent !== undefined && token.parent !== opts.ownerRefName) {
|
|
270
|
+
opts.diagnostics.push(`${where}: agent targets a different app; dropped`);
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
if (!isCanonicalTsLabel(refName)) {
|
|
274
|
+
opts.diagnostics.push(`${where}: agent key "${refName}" is not a canonical tsLabel; dropped`);
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
return expr.resourceAttr("elementum_agent", scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(refName), "app"), ["id"]);
|
|
278
|
+
}
|
|
231
279
|
function resolveAspect(token, where, opts) {
|
|
232
280
|
const kind = token?.__kind === "element" ? "element" : "app";
|
|
233
281
|
const refName = token?.refName ?? "";
|
|
@@ -114,6 +114,13 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
|
|
|
114
114
|
* not both.
|
|
115
115
|
*/
|
|
116
116
|
readonly recordCreateForm?: AppRecordCreateForm;
|
|
117
|
+
/**
|
|
118
|
+
* Parent-owned joins keyed by stable ref name. A `relatedRecords` widget
|
|
119
|
+
* targeting another app/element lists rows through a matching entry here
|
|
120
|
+
* whose columns join comparable stored values, not through that child's
|
|
121
|
+
* `relationField` / `autoRelate`. Do not join system `"id"` (HANDLE) to a
|
|
122
|
+
* child `relationField`.
|
|
123
|
+
*/
|
|
117
124
|
readonly relationships?: Readonly<Record<string, AppRelationship>>;
|
|
118
125
|
/** Display order of `listViews` (by key). Defaults to declaration order. */
|
|
119
126
|
readonly viewOrder?: readonly string[];
|
|
@@ -144,7 +144,7 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
144
144
|
ctx.diagnostics.push(`element "${label}": no import block in the stream — adoption has no identity to bind`);
|
|
145
145
|
}
|
|
146
146
|
const dashboards = dashboardsFromTf(viewBlocks.dashboardBlocks, viewBlocks.dashboardWidgetBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: refName, ownerRefName: refName, scope: "element", ownerType: "ELEMENT_ASPECT" }, ctx);
|
|
147
|
-
const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, [], viewBlocks.managedViewOrderBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel:
|
|
147
|
+
const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, [], viewBlocks.managedViewOrderBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "element" }, ctx);
|
|
148
148
|
if (viewBlocks.recordCreateFormBlocks.length > 1) {
|
|
149
149
|
ctx.diagnostics.push(`element "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
|
|
150
150
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* field resources in ei's dialect. No status_options/stages (apps always
|
|
4
4
|
* emit those; element captures do not).
|
|
5
5
|
*/
|
|
6
|
-
import type
|
|
6
|
+
import { type ToTfContext } from "../../engine/build/context.js";
|
|
7
7
|
import { type DeployableEntity } from "../../engine/entity.js";
|
|
8
8
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
9
9
|
export interface ElementToTfResult {
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
* field resources in ei's dialect. No status_options/stages (apps always
|
|
4
4
|
* emit those; element captures do not).
|
|
5
5
|
*/
|
|
6
|
+
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
6
7
|
import { EntityTfError } from "../../engine/entity.js";
|
|
7
8
|
import { expr, snakeSlug } from "../../engine/tf/index.js";
|
|
8
9
|
import { accessPolicyToTf } from "../access-policy/to-tf.js";
|
|
9
10
|
import { displayBlocksToLayoutSections } from "../app/display-blocks-to-layout.js";
|
|
11
|
+
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
10
12
|
import { displayBlocksToRecordCreateFormSections } from "../app/display-blocks-to-record-create-form.js";
|
|
11
13
|
import { dashboardsToTf } from "../dashboard/to-tf.js";
|
|
12
14
|
import { fieldToTf } from "../field/to-tf.js";
|
|
@@ -16,7 +18,7 @@ import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
|
|
|
16
18
|
import { recordCreateFormToTf } from "../record-create-form/to-tf.js";
|
|
17
19
|
import { relationshipsToTf } from "../relationship/to-tf.js";
|
|
18
20
|
import { rolesToTf } from "../role/to-tf.js";
|
|
19
|
-
import { widgetsToTf } from "../widget/to-tf.js";
|
|
21
|
+
import { relationshipTargetsFromBag, widgetsToTf } from "../widget/to-tf.js";
|
|
20
22
|
import { viewToTf } from "../view/to-tf.js";
|
|
21
23
|
import { ELEMENT_RESOURCE_TYPE } from "./module.js";
|
|
22
24
|
/** System-field tags that fold into the element resource (no field resource). */
|
|
@@ -195,6 +197,7 @@ export function elementToTf(entity, ctx) {
|
|
|
195
197
|
workspaceAspects: ctx.workspaceAspects,
|
|
196
198
|
diagnostics: ctx.diagnostics,
|
|
197
199
|
fieldAddresses,
|
|
200
|
+
relationshipTargets: relationshipTargetsFromBag(payload.relationships),
|
|
198
201
|
}));
|
|
199
202
|
// An element has exactly one implicit layout (the platform's Initiate
|
|
200
203
|
// stage — see layoutToTf's element-scope stage_id omission) — "layout" is
|
|
@@ -217,6 +220,7 @@ export function elementToTf(entity, ctx) {
|
|
|
217
220
|
orgRefs: ctx.orgRefs,
|
|
218
221
|
diagnostics: ctx.diagnostics,
|
|
219
222
|
fieldAddresses,
|
|
223
|
+
widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
|
|
220
224
|
});
|
|
221
225
|
blocks.push(...viewBlocks);
|
|
222
226
|
const recordCreateFormForToTf = payload.recordCreateForm ??
|
|
@@ -254,6 +258,20 @@ export function elementToTf(entity, ctx) {
|
|
|
254
258
|
orgRefs: ctx.orgRefs,
|
|
255
259
|
diagnostics: ctx.diagnostics,
|
|
256
260
|
fieldAddresses,
|
|
261
|
+
// An element has no service accounts of its own. Hand the sibling app's
|
|
262
|
+
// authored bag to the shared resolver so a managed account becomes a
|
|
263
|
+
// direct resource ref and Terraform sequences same-apply creation.
|
|
264
|
+
resolveServiceAccountApp: (appRefName) => {
|
|
265
|
+
const app = ctx.workspaceAspects?.get(workspaceAspectKey("app", appRefName));
|
|
266
|
+
if (app === undefined)
|
|
267
|
+
return undefined;
|
|
268
|
+
const serviceAccounts = app.streamRootEntity?.payload?.serviceAccounts;
|
|
269
|
+
return {
|
|
270
|
+
appTfLabel: app.tfLabel,
|
|
271
|
+
appId: expr.resourceAttr(APP_RESOURCE_TYPE, app.tfLabel, ["id"]),
|
|
272
|
+
...(serviceAccounts !== undefined ? { serviceAccounts } : {}),
|
|
273
|
+
};
|
|
274
|
+
},
|
|
257
275
|
});
|
|
258
276
|
blocks.push(block);
|
|
259
277
|
}
|
|
@@ -102,6 +102,11 @@ export interface DynamicDropdownConfig {
|
|
|
102
102
|
readonly source: AppOrElementRef | UnsafePlatformId;
|
|
103
103
|
readonly label: FieldRef | UnsafePlatformId;
|
|
104
104
|
readonly parent?: DynamicDropdownParent;
|
|
105
|
+
/**
|
|
106
|
+
* When true (platform default), selecting a value creates an instance-level
|
|
107
|
+
* link from **this** record. It does not author a parent `relationships[]`
|
|
108
|
+
* join and does not populate a `relatedRecords` widget on the other object.
|
|
109
|
+
*/
|
|
105
110
|
readonly autoRelate?: boolean;
|
|
106
111
|
readonly displayAs?: DropdownDisplay;
|
|
107
112
|
readonly filter?: Filter;
|
|
@@ -148,7 +153,11 @@ export interface TextFieldOptions extends BaseFieldOptions {
|
|
|
148
153
|
export interface RelationFieldOptions extends BaseFieldOptions {
|
|
149
154
|
readonly relatedObject: AppOrElementRef | UnsafePlatformId;
|
|
150
155
|
readonly relatedLabelField: FieldRef | UnsafePlatformId;
|
|
151
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Defaults to `true` on the platform. Selecting a related record creates an
|
|
158
|
+
* instance-level link from **this** record. Reverse `relatedRecords` on the
|
|
159
|
+
* other object still needs that object's authored `relationships[]` join.
|
|
160
|
+
*/
|
|
152
161
|
readonly autoRelate?: boolean;
|
|
153
162
|
}
|
|
154
163
|
export declare function textField(opts: TextFieldOptions): AppField & {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* literal form (`{ name, type: "TEXT" }`) remains valid where ever an
|
|
18
18
|
* AppField is accepted.
|
|
19
19
|
*/
|
|
20
|
-
import { coerce } from "./calc/runtime.js";
|
|
20
|
+
import { assertCalculatedFieldRoot, coerce } from "./calc/runtime.js";
|
|
21
21
|
/** Product-visible rendering modes for dynamically sourced values. */
|
|
22
22
|
export const dropdownDisplay = {
|
|
23
23
|
dropdown: "DROPDOWN",
|
|
@@ -148,6 +148,7 @@ export function relationField(opts) {
|
|
|
148
148
|
/** Create a calculated field whose platform field kind is inferred from its expression. */
|
|
149
149
|
export function calculatedField(opts) {
|
|
150
150
|
const expression = coerce(opts.expression);
|
|
151
|
+
assertCalculatedFieldRoot(expression, opts.name);
|
|
151
152
|
const type = (() => {
|
|
152
153
|
switch (expression.__exprType) {
|
|
153
154
|
case "number": return "NUMBER";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* reads close to the math expression. Same shape as the Java
|
|
14
14
|
* `ExpressionUtil.addition` / `subtraction` / etc. helpers.
|
|
15
15
|
*/
|
|
16
|
-
import { coerce, makeComposedExpr, makeExpr } from "./runtime.js";
|
|
16
|
+
import { coerce, makeComparisonExpr, makeComposedExpr, makeExpr } from "./runtime.js";
|
|
17
17
|
import { concat, toText, len, trim, upper, lower, left, right, mid, substitute, find, search, split, splitText, regexMatch, regexReplace, regexExtract, jsonEscape, jsonUnescape, repeat, } from "./text.js";
|
|
18
18
|
import { round, power, sqrt, toNumber, uuid } from "./numeric.js";
|
|
19
19
|
import { now, makeDate, dateTime, dateValue, dateDiff, dateDif, truncateDateTime, dateTimeTrunc, weekday, year, month, day, hour, minute, second, } from "./date.js";
|
|
@@ -108,32 +108,32 @@ function dividedBy(a, b) {
|
|
|
108
108
|
function gt(a, b) {
|
|
109
109
|
const ae = coerce(a);
|
|
110
110
|
const be = coerce(b);
|
|
111
|
-
return
|
|
111
|
+
return makeComparisonExpr([ae, be], () => `${ae.toCalcString()} > ${be.toCalcString()}`);
|
|
112
112
|
}
|
|
113
113
|
function lt(a, b) {
|
|
114
114
|
const ae = coerce(a);
|
|
115
115
|
const be = coerce(b);
|
|
116
|
-
return
|
|
116
|
+
return makeComparisonExpr([ae, be], () => `${ae.toCalcString()} < ${be.toCalcString()}`);
|
|
117
117
|
}
|
|
118
118
|
function gte(a, b) {
|
|
119
119
|
const ae = coerce(a);
|
|
120
120
|
const be = coerce(b);
|
|
121
|
-
return
|
|
121
|
+
return makeComparisonExpr([ae, be], () => `${ae.toCalcString()} >= ${be.toCalcString()}`);
|
|
122
122
|
}
|
|
123
123
|
function lte(a, b) {
|
|
124
124
|
const ae = coerce(a);
|
|
125
125
|
const be = coerce(b);
|
|
126
|
-
return
|
|
126
|
+
return makeComparisonExpr([ae, be], () => `${ae.toCalcString()} <= ${be.toCalcString()}`);
|
|
127
127
|
}
|
|
128
128
|
function eq(a, b) {
|
|
129
129
|
const ae = coerce(a);
|
|
130
130
|
const be = coerce(b);
|
|
131
|
-
return
|
|
131
|
+
return makeComparisonExpr([ae, be], () => `${ae.toCalcString()} = ${be.toCalcString()}`);
|
|
132
132
|
}
|
|
133
133
|
function ne(a, b) {
|
|
134
134
|
const ae = coerce(a);
|
|
135
135
|
const be = coerce(b);
|
|
136
|
-
return
|
|
136
|
+
return makeComparisonExpr([ae, be], () => `${ae.toCalcString()} <> ${be.toCalcString()}`);
|
|
137
137
|
}
|
|
138
138
|
// ---------------------------------------------------------------------------
|
|
139
139
|
// Logical
|
|
@@ -40,6 +40,25 @@ export declare function isExpr(value: unknown): value is Expr<ExprType, ExprCard
|
|
|
40
40
|
export declare function expressionContext(expressions: readonly Expr<ExprType, ExprCardinality, ExprContext>[]): ExprContext;
|
|
41
41
|
/** Build a scalar parent node while preserving record-context metadata. */
|
|
42
42
|
export declare function makeComposedExpr<T extends ExprType>(type: T, expressions: readonly Expr<ExprType, ExprCardinality, ExprContext>[], serialize: () => string): Expr<T, "single", ExprContext>;
|
|
43
|
+
/**
|
|
44
|
+
* Build a comparison node, tagged so {@link assertCalculatedFieldRoot} can
|
|
45
|
+
* reject it at the root of a calculation. The grammar's root production is
|
|
46
|
+
* "expression", which covers arithmetic, function calls, column refs and
|
|
47
|
+
* literals but NOT comparisons — those are a separate "boolean expression"
|
|
48
|
+
* production reachable only as a function argument.
|
|
49
|
+
*/
|
|
50
|
+
export declare function makeComparisonExpr(expressions: readonly Expr<ExprType, ExprCardinality, ExprContext>[], serialize: () => string): Expr<"bool", "single", ExprContext>;
|
|
51
|
+
/**
|
|
52
|
+
* Throw when `expression` is a comparison standing alone as a whole
|
|
53
|
+
* calculated field. `owner` names the field in the message so the author can
|
|
54
|
+
* find it without reading the generated HCL.
|
|
55
|
+
*
|
|
56
|
+
* Scoped to calculated fields: the provider runs
|
|
57
|
+
* `aspectFieldCalculationValidateV3` on every create and update there, so the
|
|
58
|
+
* shape is a hard apply failure. Automation calculation tasks validate only on
|
|
59
|
+
* read, where the provider degrades to a diagnostic.
|
|
60
|
+
*/
|
|
61
|
+
export declare function assertCalculatedFieldRoot(expression: Expr<ExprType, ExprCardinality, ExprContext>, owner?: string): void;
|
|
43
62
|
/**
|
|
44
63
|
* Emit the wire form of a field reference. UUID ids emit as
|
|
45
64
|
* `"<uuid>"`; placeholder ids fall back to `"<name>"`. The server
|
|
@@ -56,6 +56,38 @@ export function expressionContext(expressions) {
|
|
|
56
56
|
export function makeComposedExpr(type, expressions, serialize) {
|
|
57
57
|
return makeExpr(type, serialize, { context: expressionContext(expressions) });
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Build a comparison node, tagged so {@link assertCalculatedFieldRoot} can
|
|
61
|
+
* reject it at the root of a calculation. The grammar's root production is
|
|
62
|
+
* "expression", which covers arithmetic, function calls, column refs and
|
|
63
|
+
* literals but NOT comparisons — those are a separate "boolean expression"
|
|
64
|
+
* production reachable only as a function argument.
|
|
65
|
+
*/
|
|
66
|
+
export function makeComparisonExpr(expressions, serialize) {
|
|
67
|
+
return {
|
|
68
|
+
...makeComposedExpr("bool", expressions, serialize),
|
|
69
|
+
__exprBoolShape: "comparison",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Throw when `expression` is a comparison standing alone as a whole
|
|
74
|
+
* calculated field. `owner` names the field in the message so the author can
|
|
75
|
+
* find it without reading the generated HCL.
|
|
76
|
+
*
|
|
77
|
+
* Scoped to calculated fields: the provider runs
|
|
78
|
+
* `aspectFieldCalculationValidateV3` on every create and update there, so the
|
|
79
|
+
* shape is a hard apply failure. Automation calculation tasks validate only on
|
|
80
|
+
* read, where the provider degrades to a diagnostic.
|
|
81
|
+
*/
|
|
82
|
+
export function assertCalculatedFieldRoot(expression, owner) {
|
|
83
|
+
if (expression.__exprBoolShape !== "comparison")
|
|
84
|
+
return;
|
|
85
|
+
const subject = owner === undefined ? "calculation" : `calculation "${owner}"`;
|
|
86
|
+
throw new Error(`${subject}: a comparison cannot be the whole calculation — the platform ` +
|
|
87
|
+
`parses "${expression.toCalcString()}" as a boolean expression, which its ` +
|
|
88
|
+
`grammar only accepts inside a function. Wrap it, e.g. ` +
|
|
89
|
+
`calc.if(<comparison>, true, false).`);
|
|
90
|
+
}
|
|
59
91
|
/**
|
|
60
92
|
* True if `value` looks like an `AppField`. Structural check — looks
|
|
61
93
|
* for the `type` + `id` + `name` triplet every variant carries.
|
|
@@ -14,6 +14,12 @@ export interface Expr<T extends ExprType, Cardinality extends ExprCardinality =
|
|
|
14
14
|
readonly __exprType: T;
|
|
15
15
|
readonly __exprCardinality: Cardinality;
|
|
16
16
|
readonly __exprContext: Context;
|
|
17
|
+
/**
|
|
18
|
+
* Set on comparison nodes (`a > b`, `a = b`, …). The platform grammar
|
|
19
|
+
* parses those as a "boolean expression", a production a calculation's
|
|
20
|
+
* root does not accept, so the root must be a function call.
|
|
21
|
+
*/
|
|
22
|
+
readonly __exprBoolShape?: "comparison";
|
|
17
23
|
}
|
|
18
24
|
export type AnyExpr = Expr<ExprType, ExprCardinality, ExprContext>;
|
|
19
25
|
export type ScalarExpr<T extends ExprType = ExprType, Context extends ExprContext = ExprContext> = Expr<T, "single", Context>;
|
|
@@ -21,8 +21,16 @@ function serializeStructureField(f) {
|
|
|
21
21
|
return { date: { name: f.name, format: f.format } };
|
|
22
22
|
case "datetime":
|
|
23
23
|
return { datetime: { name: f.name, format: f.format } };
|
|
24
|
-
case "object":
|
|
25
|
-
|
|
24
|
+
case "object": {
|
|
25
|
+
// ei's own export omits `properties` entirely for an object with no
|
|
26
|
+
// discovered sub-fields (e.g. a nested array-of-objects item type ei
|
|
27
|
+
// couldn't further introspect) rather than emitting an empty array —
|
|
28
|
+
// always including it here planned a spurious in-place update on
|
|
29
|
+
// every build (live-confirmed on purchaseorder/eu-sanofi's
|
|
30
|
+
// "New file reader"'s `to_PurchaseOrderItem` array field).
|
|
31
|
+
const properties = f.properties.map(serializeStructureField);
|
|
32
|
+
return { object: { name: f.name, ...(properties.length > 0 ? { properties } : {}) } };
|
|
33
|
+
}
|
|
26
34
|
case "array":
|
|
27
35
|
return { array: { name: f.name, arrayType: serializeStructureField(f.itemType) } };
|
|
28
36
|
}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import type { AppOrElementRef, FieldRef, TableColumnRef, TableRef } from "../../catalog/index.js";
|
|
1
|
+
import type { AppOrElementRef, FieldRef, RecordIdentityRef, TableColumnRef, TableRef } from "../../catalog/index.js";
|
|
2
2
|
import type { Filter } from "../shared/filters/types.js";
|
|
3
3
|
import type { AppViewFieldRef } from "../app/build.js";
|
|
4
|
-
export interface AppRelationshipColumn {
|
|
4
|
+
export interface AppRelationshipColumn<Target extends AppOrElementRef | TableRef = AppOrElementRef | TableRef> {
|
|
5
5
|
/** Field on the owning app/element. */
|
|
6
6
|
readonly field: AppViewFieldRef;
|
|
7
7
|
/** Field/column on `target`. */
|
|
8
|
-
readonly relatedField: FieldRef | TableColumnRef
|
|
8
|
+
readonly relatedField: FieldRef | TableColumnRef | RecordIdentityRef<Target>;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* A parent-owned join (`elementum_relationship`) keyed under this app/element's
|
|
12
|
+
* `relationships` bag. `relatedRecords` widgets on this object list rows
|
|
13
|
+
* through these joins. Columns must join comparable stored values; do not
|
|
14
|
+
* join this object's system `"id"` (HANDLE) to a child `relationField`.
|
|
15
|
+
* A child `relationField` / `autoRelate` is not a substitute for a join
|
|
16
|
+
* owned here.
|
|
17
|
+
*/
|
|
18
|
+
export interface AppRelationship<Target extends AppOrElementRef | TableRef = AppOrElementRef | TableRef> {
|
|
19
|
+
readonly target: Target;
|
|
20
|
+
readonly columns: readonly AppRelationshipColumn<Target>[];
|
|
14
21
|
/** Uses the same typed filter DSL as access policies. */
|
|
15
22
|
readonly filter?: Filter;
|
|
16
23
|
}
|
|
@@ -2,7 +2,7 @@ import { dataRefLabel, resourceRefLabel } from "../../engine/pull/context.js";
|
|
|
2
2
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
3
3
|
import { filterFromTf } from "../access-policy/from-tf.js";
|
|
4
4
|
import { fieldKeyFromTfRef, fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
5
|
-
import {
|
|
5
|
+
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
6
6
|
import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
7
7
|
import { RELATIONSHIP_RESOURCE_TYPE } from "./module.js";
|
|
8
8
|
const KNOWN_ATTRS = new Set(["object_id", "related_object_id", "columns", "filter"]);
|
|
@@ -123,19 +123,7 @@ function targetRef(value, owner, ctx) {
|
|
|
123
123
|
const dataLabel = dataRefLabel(value, type);
|
|
124
124
|
if (dataLabel !== undefined) {
|
|
125
125
|
if (kind === "app" || kind === "element") {
|
|
126
|
-
|
|
127
|
-
const refName = dataAspectRefName(ctx, kind, dataLabel, displayName);
|
|
128
|
-
const attrs = ctx.dataAttrs?.(type, dataLabel);
|
|
129
|
-
const namespace = typeof attrs?.namespace === "string" ? attrs.namespace : undefined;
|
|
130
|
-
return {
|
|
131
|
-
kind,
|
|
132
|
-
key: refName ?? tfLabelToTsLabel(dataLabel),
|
|
133
|
-
name: displayName ?? refName ?? tfLabelToTsLabel(dataLabel),
|
|
134
|
-
tfLabel: dataLabel,
|
|
135
|
-
managed: false,
|
|
136
|
-
...(namespace !== undefined ? { namespace } : {}),
|
|
137
|
-
...(refName !== undefined ? { catalogRef: true } : {}),
|
|
138
|
-
};
|
|
126
|
+
return { kind, tfLabel: dataLabel, managed: false, ...resolveDataAspectTarget(ctx, kind, dataLabel) };
|
|
139
127
|
}
|
|
140
128
|
const name = ctx.dataName(type, dataLabel) ?? tfLabelToTsLabel(dataLabel);
|
|
141
129
|
return { kind, key: tfLabelToTsLabel(dataLabel), name, tfLabel: dataLabel, managed: false };
|
|
@@ -146,6 +134,18 @@ function targetRef(value, owner, ctx) {
|
|
|
146
134
|
function relatedFieldRef(value, target, ctx) {
|
|
147
135
|
if (value === undefined)
|
|
148
136
|
return undefined;
|
|
137
|
+
if (isTfExpr(value) && value.$expr === "resource-attr" && value.path.length === 1 && value.path[0] === "id") {
|
|
138
|
+
const targetType = target.kind === "app"
|
|
139
|
+
? "elementum_app"
|
|
140
|
+
: target.kind === "element"
|
|
141
|
+
? "elementum_element"
|
|
142
|
+
: target.kind === "table"
|
|
143
|
+
? "elementum_table"
|
|
144
|
+
: undefined;
|
|
145
|
+
if (value.type === RELATIONSHIP_RESOURCE_TYPE || value.type === targetType) {
|
|
146
|
+
return { kind: "recordIdentity", key: "id", name: "Record ID", target };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
149
|
if (isTfExpr(value) && value.$expr === "resource-attr" && value.path.length === 1 && value.path[0] === "id") {
|
|
150
150
|
const subType = SUB_TYPE_BY_RESOURCE.get(value.type);
|
|
151
151
|
if (subType !== undefined) {
|