@elementumai/edk 0.9.7 → 0.9.9
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 +3 -2
- package/dist-sdk/src/catalog/factories.d.ts +14 -3
- package/dist-sdk/src/catalog/factories.js +32 -0
- package/dist-sdk/src/catalog/from-authoring.js +27 -33
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.js +67 -29
- package/dist-sdk/src/catalog/token.js +10 -0
- package/dist-sdk/src/catalog/types.d.ts +20 -2
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +1 -1
- package/dist-sdk/src/core/index.js +1 -1
- package/dist-sdk/src/core/platform-id.d.ts +2 -0
- package/dist-sdk/src/core/platform-id.js +4 -0
- package/dist-sdk/src/core/system-fields.d.ts +14 -0
- package/dist-sdk/src/core/system-fields.js +6 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +27 -24
- package/dist-sdk/src/core/triggers/on-demand.js +33 -12
- package/dist-sdk/src/core/types/aspect-category.d.ts +1 -0
- package/dist-sdk/src/core/types/aspect-category.js +1 -0
- package/dist-sdk/src/engine/build/context.d.ts +20 -8
- package/dist-sdk/src/engine/build/source-context.d.ts +14 -17
- package/dist-sdk/src/engine/build/source-context.js +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +9 -0
- package/dist-sdk/src/engine/pull/org.d.ts +4 -0
- package/dist-sdk/src/engine/pull/org.js +17 -2
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +16 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +69 -0
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +15 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +33 -1
- package/dist-sdk/src/engine/workspace/loader.d.ts +40 -0
- package/dist-sdk/src/engine/workspace/loader.js +328 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +10 -2
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +7 -2
- package/dist-sdk/src/entities/agent/build.d.ts +54 -8
- package/dist-sdk/src/entities/agent/build.js +36 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +126 -2
- package/dist-sdk/src/entities/agent/from-tf.d.ts +7 -6
- package/dist-sdk/src/entities/agent/from-tf.js +176 -5
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/to-tf.d.ts +4 -4
- package/dist-sdk/src/entities/agent/to-tf.js +185 -11
- package/dist-sdk/src/entities/agent/tools.d.ts +16 -5
- package/dist-sdk/src/entities/agent/tools.js +13 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +29 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +10 -9
- package/dist-sdk/src/entities/agent-tool/types.js +1 -0
- package/dist-sdk/src/entities/app/build.d.ts +2 -2
- package/dist-sdk/src/entities/app/build.js +6 -3
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.d.ts +45 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.js +98 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.d.ts +55 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.js +99 -0
- package/dist-sdk/src/entities/app/from-tf.js +9 -7
- package/dist-sdk/src/entities/app/to-tf.js +15 -7
- package/dist-sdk/src/entities/automation/build.d.ts +8 -1
- package/dist-sdk/src/entities/automation/build.js +36 -5
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +3 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +77 -8
- package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/from-tf.js +803 -62
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +13 -3
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +12 -4
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +17 -6
- package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +15 -11
- package/dist-sdk/src/entities/automation/task-label.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-label.js +18 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +60 -9
- package/dist-sdk/src/entities/automation/tasks.js +16 -4
- package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/automation/to-tf.js +385 -52
- package/dist-sdk/src/entities/automation/triggers.d.ts +14 -5
- package/dist-sdk/src/entities/automation/triggers.js +1 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +1 -1
- package/dist-sdk/src/entities/element/build.d.ts +30 -7
- package/dist-sdk/src/entities/element/build.js +6 -3
- package/dist-sdk/src/entities/element/from-tf.js +7 -3
- package/dist-sdk/src/entities/element/index.d.ts +1 -1
- package/dist-sdk/src/entities/element/index.js +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +49 -8
- package/dist-sdk/src/entities/field/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.js +12 -0
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/field/to-tf.js +19 -5
- package/dist-sdk/src/entities/org/category-ref.d.ts +5 -0
- package/dist-sdk/src/entities/org/category-ref.js +12 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -3
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +13 -5
- package/dist-sdk/src/entities/relationship/from-tf.js +15 -4
- package/dist-sdk/src/entities/role/from-tf.js +10 -4
- package/dist-sdk/src/entities/search-table/build.d.ts +1 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -0
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +3 -3
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/service-account/from-tf.js +10 -4
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/to-tf.js +7 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +3 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +8 -4
- package/dist-sdk/src/entities/shared/handle-description.d.ts +12 -0
- package/dist-sdk/src/entities/shared/handle-description.js +20 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
- package/dist-sdk/src/entities/skill/build.d.ts +51 -2
- package/dist-sdk/src/entities/skill/build.js +65 -8
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +35 -3
- package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/skill/from-tf.js +39 -7
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +21 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +148 -5
- package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -25
- package/dist-sdk/src/entities/skill/to-tf.js +22 -38
- package/dist-sdk/src/entities/skill/tools.d.ts +2 -1
- package/dist-sdk/src/entities/skill/tools.js +3 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +5 -5
- package/dist-sdk/src/entities/skill-tool/to-tf.js +5 -7
- package/dist-sdk/src/entities/table/to-tf.js +3 -4
- package/dist-sdk/src/entities/task/to-tf.js +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +36 -10
- package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/to-tf.js +44 -30
- package/dist-sdk/src/entities/widget/from-tf.js +2 -2
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +52 -23
- package/dist-sdk/src/graph/index.d.ts +19 -1
- package/dist-sdk/src/graph/index.js +20 -0
- package/dist-sdk/src/graph/types.d.ts +19 -0
- package/package.json +10 -5
|
@@ -8,18 +8,19 @@
|
|
|
8
8
|
import { optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
9
9
|
import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
|
|
10
10
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import { fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
12
12
|
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
13
13
|
import { filterFromTf, principalList } from "../access-policy/from-tf.js";
|
|
14
14
|
import { listViewDensity, } from "./build.js";
|
|
15
15
|
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";
|
|
16
|
-
function viewFilter(value, owner, where) {
|
|
16
|
+
function viewFilter(value, owner, where, ctx) {
|
|
17
17
|
return value === undefined ? undefined : filterFromTf(value, {
|
|
18
18
|
type: owner.type,
|
|
19
19
|
label: owner.label,
|
|
20
20
|
ownerRefName: tfLabelToTsLabel(owner.label),
|
|
21
21
|
ownerTfLabel: owner.ownerTfLabel,
|
|
22
22
|
scope: owner.scope ?? "app",
|
|
23
|
+
foreignFieldRefsById: ctx.foreignFieldRefsById,
|
|
23
24
|
}, `${where}.filter`);
|
|
24
25
|
}
|
|
25
26
|
/** All three view resource kinds → the normalized shapes the app printer consumes. */
|
|
@@ -104,7 +105,7 @@ function dashboardViewFromTf(block, owner, ctx) {
|
|
|
104
105
|
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
105
106
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
106
107
|
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
107
|
-
const filter = viewFilter(attrs["filter"], owner, where);
|
|
108
|
+
const filter = viewFilter(attrs["filter"], owner, where, ctx);
|
|
108
109
|
return {
|
|
109
110
|
key: scopedLabelToBagKey(owner.ownerTfLabel, label, scope),
|
|
110
111
|
name: optionalString(attrs, "name", where, ctx) ?? "",
|
|
@@ -161,7 +162,7 @@ function typedFieldViewFromTf(block, owner, resourceType, knownAttrs, includeAll
|
|
|
161
162
|
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
162
163
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
163
164
|
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
164
|
-
const filter = viewFilter(attrs["filter"], owner, where);
|
|
165
|
+
const filter = viewFilter(attrs["filter"], owner, where, ctx);
|
|
165
166
|
return {
|
|
166
167
|
key: scopedLabelToBagKey(owner.ownerTfLabel, label, scope),
|
|
167
168
|
name: optionalString(attrs, "name", where, ctx) ?? "",
|
|
@@ -197,7 +198,7 @@ function agentViewFromTf(block, owner, ctx) {
|
|
|
197
198
|
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
198
199
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
199
200
|
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
200
|
-
const filter = viewFilter(attrs["filter"], owner, where);
|
|
201
|
+
const filter = viewFilter(attrs["filter"], owner, where, ctx);
|
|
201
202
|
return {
|
|
202
203
|
key: scopedLabelToBagKey(owner.ownerTfLabel, label, scope),
|
|
203
204
|
name: optionalString(attrs, "name", where, ctx) ?? "",
|
|
@@ -220,8 +221,33 @@ function layoutFromTf(block, owner, ctx) {
|
|
|
220
221
|
ctx.diagnostics.push(`${where}: object_id does not reference ${owner.type}.${owner.label}; skipped`);
|
|
221
222
|
return undefined;
|
|
222
223
|
}
|
|
223
|
-
const stageKey = stageKeyFromTf(attrs["stage_id"], owner.label);
|
|
224
224
|
const scope = owner.scope ?? "app";
|
|
225
|
+
// Elements carry no stage_ids_by_key at all (see element/locals.ts) - an
|
|
226
|
+
// element's stage_id is always "" (build-side, see view/to-tf.ts's
|
|
227
|
+
// layoutToTf) or the platform's own Initiate stage id (a live pull) -
|
|
228
|
+
// neither resolves through stageKeyFromTf. But an element has exactly one
|
|
229
|
+
// possible layout, so "which stage" is never actually ambiguous the way
|
|
230
|
+
// it is for apps: always use the synthetic "layout" key, deterministically,
|
|
231
|
+
// with no diagnostic - matching both elementToTf's own bag key and the
|
|
232
|
+
// bridge's ei-side resource label convention (hcl_app.go's generateLayoutIR:
|
|
233
|
+
// "<prefix>_layout", a fixed suffix, not stage-name-derived) so a re-adopt
|
|
234
|
+
// resolves to the SAME terraform address instead of planning a replace.
|
|
235
|
+
if (scope === "element") {
|
|
236
|
+
const sectionsAttr = attrs["sections"];
|
|
237
|
+
const sections = [];
|
|
238
|
+
if (Array.isArray(sectionsAttr)) {
|
|
239
|
+
for (const item of sectionsAttr) {
|
|
240
|
+
const section = sectionFromTf(item, owner.label, owner.ownerTfLabel, scope, where, ctx);
|
|
241
|
+
if (section !== undefined)
|
|
242
|
+
sections.push(section);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else if (sectionsAttr !== undefined) {
|
|
246
|
+
ctx.diagnostics.push(`${where}: sections is not a list; dropped`);
|
|
247
|
+
}
|
|
248
|
+
return { stageKey: "layout", sections };
|
|
249
|
+
}
|
|
250
|
+
const stageKey = stageKeyFromTf(attrs["stage_id"], owner.label);
|
|
225
251
|
const labelStageKey = scopedLabelToBagKey(owner.ownerTfLabel, label, scope);
|
|
226
252
|
const canInferStageKey = typeof attrs["stage_id"] === "string" && owner.stageKeys?.has(labelStageKey) === true;
|
|
227
253
|
if (stageKey === undefined && !canInferStageKey) {
|
|
@@ -296,6 +322,9 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
296
322
|
}
|
|
297
323
|
/** A `field_ids`/`columns` entry → a system-field key or a custom field's bag key. */
|
|
298
324
|
function fieldRefFromTf(v, ownerLabel, ownerTfLabel, scope, ctx) {
|
|
325
|
+
const fieldKey = fieldKeyFromTfValue(v, tfLabelToTsLabel(ownerLabel), ownerTfLabel, scope, ctx);
|
|
326
|
+
if (fieldKey !== undefined)
|
|
327
|
+
return fieldKey;
|
|
299
328
|
if (!isTfExpr(v)) {
|
|
300
329
|
ctx.diagnostics.push(`field reference has an unrecognized (non-expression) shape; dropped`);
|
|
301
330
|
return undefined;
|
|
@@ -308,9 +337,6 @@ function fieldRefFromTf(v, ownerLabel, ownerTfLabel, scope, ctx) {
|
|
|
308
337
|
}
|
|
309
338
|
// Custom field ref resolution is shared with agent-tool's field refs
|
|
310
339
|
// (src/entities/agent-tool/from-tf.ts) via entities/field/from-tf.ts.
|
|
311
|
-
const fieldKey = fieldKeyFromTfRef(v, ownerTfLabel, scope);
|
|
312
|
-
if (fieldKey !== undefined)
|
|
313
|
-
return fieldKey;
|
|
314
340
|
ctx.diagnostics.push(`field reference ${JSON.stringify(v)} does not resolve to a known field; dropped`);
|
|
315
341
|
return undefined;
|
|
316
342
|
}
|
|
@@ -350,7 +376,7 @@ function listViewFromTf(block, owner, ctx) {
|
|
|
350
376
|
// reported non-null) on ANY list view with either attribute set. Round-
|
|
351
377
|
// round-tripping both values avoids ever manufacturing that diff. Filters
|
|
352
378
|
// and sorts decode through their shared typed codecs.
|
|
353
|
-
const filter = viewFilter(attrs["filter"], owner, where);
|
|
379
|
+
const filter = viewFilter(attrs["filter"], owner, where, ctx);
|
|
354
380
|
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
355
381
|
const density = listViewDensityFromTf(attrs["density"], where, ctx);
|
|
356
382
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
@@ -99,6 +99,8 @@ export interface ViewToTfOptions {
|
|
|
99
99
|
/** Declared sibling dashboard keys, for fail-fast dashboard-view references. */
|
|
100
100
|
readonly dashboardKeys?: ReadonlySet<string>;
|
|
101
101
|
readonly orgRefs?: OrgRefLookup;
|
|
102
|
+
/** Known emitted field addresses keyed by field bag key, for robust reference resolution. */
|
|
103
|
+
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
102
104
|
/** Degradations land here — reported by the caller, never silent. */
|
|
103
105
|
readonly diagnostics: string[];
|
|
104
106
|
}
|
|
@@ -27,7 +27,7 @@ function appendViewSharingAttrs(attrs, view, where, ctx) {
|
|
|
27
27
|
}
|
|
28
28
|
/** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
|
|
29
29
|
export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder, opts) {
|
|
30
|
-
const { ownerRefName, ownerTfLabel, scope = "app", aspectName, objectId, diagnostics } = opts;
|
|
30
|
+
const { ownerRefName, ownerTfLabel, scope = "app", aspectName, objectId, diagnostics, fieldAddresses } = opts;
|
|
31
31
|
const principalCtx = { ...opts, scope, objectId };
|
|
32
32
|
const blocks = [];
|
|
33
33
|
for (const [stageKey, layout] of Object.entries(layouts ?? {})) {
|
|
@@ -40,7 +40,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
40
40
|
diagnostics.push(`layouts.${stageKey} has no matching authored stage option; dropped`);
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
43
|
-
blocks.push(layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics));
|
|
43
|
+
blocks.push(layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses));
|
|
44
44
|
}
|
|
45
45
|
const viewAddressByKey = new Map();
|
|
46
46
|
for (const [viewKey, view] of Object.entries(listViews ?? {})) {
|
|
@@ -58,7 +58,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
58
58
|
// defaulting to `true` planned false→true against live views that
|
|
59
59
|
// disallow create. Platform default when unset on create is still true.
|
|
60
60
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
61
|
-
columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics),
|
|
61
|
+
columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics, fieldAddresses),
|
|
62
62
|
density: view.density ?? "STANDARD",
|
|
63
63
|
rows: view.rows ?? 25,
|
|
64
64
|
};
|
|
@@ -69,10 +69,11 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
69
69
|
objectId,
|
|
70
70
|
diagnostics,
|
|
71
71
|
resolvePicklistLiterals: false,
|
|
72
|
+
fieldAddresses,
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
if (view.sort !== undefined)
|
|
75
|
-
attrs.sort = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics);
|
|
76
|
+
attrs.sort = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics, fieldAddresses);
|
|
76
77
|
appendViewSharingAttrs(attrs, view, where, principalCtx);
|
|
77
78
|
blocks.push({ kind: "resource", type: LIST_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
|
|
78
79
|
viewAddressByKey.set(viewKey, { type: LIST_VIEW_RESOURCE_TYPE, label: tfLabel });
|
|
@@ -96,23 +97,23 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
96
97
|
aspect_id: objectId,
|
|
97
98
|
name: view.name ?? "",
|
|
98
99
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
99
|
-
columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics),
|
|
100
|
+
columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics, fieldAddresses),
|
|
100
101
|
};
|
|
101
102
|
if (view.displayByField !== undefined) {
|
|
102
|
-
const displayBy = fieldRefToTfValue(view.displayByField, ownerTfLabel, scope, `${where}.displayByField`, diagnostics);
|
|
103
|
+
const displayBy = fieldRefToTfValue(view.displayByField, ownerTfLabel, scope, `${where}.displayByField`, diagnostics, fieldAddresses);
|
|
103
104
|
if (displayBy !== undefined)
|
|
104
105
|
attrs["display_by_field"] = displayBy;
|
|
105
106
|
}
|
|
106
107
|
if (resourceType === KANBAN_VIEW_RESOURCE_TYPE) {
|
|
107
108
|
const allowed = view.allowedFilterFields;
|
|
108
109
|
if (allowed !== undefined) {
|
|
109
|
-
attrs["allowed_filter_fields"] = resolveFieldRefs(allowed, ownerTfLabel, scope, `${where}.allowedFilterFields`, diagnostics);
|
|
110
|
+
attrs["allowed_filter_fields"] = resolveFieldRefs(allowed, ownerTfLabel, scope, `${where}.allowedFilterFields`, diagnostics, fieldAddresses);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
if (view.filter !== undefined)
|
|
113
|
-
attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false });
|
|
114
|
+
attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
114
115
|
if (view.sort !== undefined)
|
|
115
|
-
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics);
|
|
116
|
+
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics, fieldAddresses);
|
|
116
117
|
appendViewSharingAttrs(attrs, view, where, principalCtx);
|
|
117
118
|
blocks.push({ kind: "resource", type: resourceType, label: tfLabel, attrs });
|
|
118
119
|
viewAddressByKey.set(viewKey, { type: resourceType, label: tfLabel });
|
|
@@ -152,9 +153,9 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
152
153
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
153
154
|
};
|
|
154
155
|
if (view.filter !== undefined)
|
|
155
|
-
attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false });
|
|
156
|
+
attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
156
157
|
if (view.sort !== undefined)
|
|
157
|
-
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `dashboardViews.${viewKey}.sort`, diagnostics);
|
|
158
|
+
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `dashboardViews.${viewKey}.sort`, diagnostics, fieldAddresses);
|
|
158
159
|
appendViewSharingAttrs(attrs, view, `dashboardViews.${viewKey}`, principalCtx);
|
|
159
160
|
blocks.push({ kind: "resource", type: DASHBOARD_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
|
|
160
161
|
viewAddressByKey.set(viewKey, { type: DASHBOARD_VIEW_RESOURCE_TYPE, label: tfLabel });
|
|
@@ -185,9 +186,9 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
185
186
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
186
187
|
};
|
|
187
188
|
if (view.filter !== undefined)
|
|
188
|
-
attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false });
|
|
189
|
+
attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
189
190
|
if (view.sort !== undefined)
|
|
190
|
-
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `agentViews.${viewKey}.sort`, diagnostics);
|
|
191
|
+
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `agentViews.${viewKey}.sort`, diagnostics, fieldAddresses);
|
|
191
192
|
appendViewSharingAttrs(attrs, view, `agentViews.${viewKey}`, principalCtx);
|
|
192
193
|
if (view.displayOrder !== undefined)
|
|
193
194
|
attrs["display_order"] = view.displayOrder;
|
|
@@ -233,10 +234,10 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
233
234
|
}
|
|
234
235
|
return { blocks };
|
|
235
236
|
}
|
|
236
|
-
function managedViewSortToTf(sort, ownerTfLabel, scope, where, diagnostics) {
|
|
237
|
+
function managedViewSortToTf(sort, ownerTfLabel, scope, where, diagnostics, fieldAddresses) {
|
|
237
238
|
const orders = [];
|
|
238
239
|
for (const [index, order] of sort.orders.entries()) {
|
|
239
|
-
const field = fieldRefToTfValue(order.field, ownerTfLabel, scope, `${where}.orders[${index}].field`, diagnostics);
|
|
240
|
+
const field = fieldRefToTfValue(order.field, ownerTfLabel, scope, `${where}.orders[${index}].field`, diagnostics, fieldAddresses);
|
|
240
241
|
if (field === undefined)
|
|
241
242
|
continue;
|
|
242
243
|
orders.push({
|
|
@@ -247,7 +248,7 @@ function managedViewSortToTf(sort, ownerTfLabel, scope, where, diagnostics) {
|
|
|
247
248
|
}
|
|
248
249
|
return expr.jsonencode({ orders });
|
|
249
250
|
}
|
|
250
|
-
function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics) {
|
|
251
|
+
function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses) {
|
|
251
252
|
const sections = [];
|
|
252
253
|
for (const section of layout.sections) {
|
|
253
254
|
const authoringType = section.type ?? "group";
|
|
@@ -284,7 +285,7 @@ function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics
|
|
|
284
285
|
}
|
|
285
286
|
return true;
|
|
286
287
|
});
|
|
287
|
-
sec.field_ids = resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics);
|
|
288
|
+
sec.field_ids = resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics, fieldAddresses);
|
|
288
289
|
}
|
|
289
290
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && section.name !== undefined) {
|
|
290
291
|
sec.name = section.name;
|
|
@@ -298,27 +299,33 @@ function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics
|
|
|
298
299
|
// address ei never produced) and index the map with a key that doesn't
|
|
299
300
|
// exist, breaking every plan.
|
|
300
301
|
const tfLabel = tsLabelToTfLabel(stageKey);
|
|
302
|
+
const attrs = { object_id: objectId, sections };
|
|
303
|
+
// Elements carry no `stages`/`stage_ids_by_key` at all (unlike apps) — they
|
|
304
|
+
// only ever have the platform's single auto-created Initiate stage.
|
|
305
|
+
// `elementum_layout.stage_id` is Optional+Computed; omitting it lets the
|
|
306
|
+
// provider's own Initiate-stage resolution (`fetchInitiateStageID`) fill it
|
|
307
|
+
// in, instead of referencing a `<ownerTfLabel>_stage_ids_by_key` local that
|
|
308
|
+
// `element/locals.ts` never defines.
|
|
309
|
+
if (scope !== "element") {
|
|
310
|
+
attrs["stage_id"] = expr.local(`${ownerTfLabel}_stage_ids_by_key`, [{ index: tfLabel }]);
|
|
311
|
+
}
|
|
301
312
|
return {
|
|
302
313
|
kind: "resource",
|
|
303
314
|
type: LAYOUT_RESOURCE_TYPE,
|
|
304
315
|
label: scopedResourceLabel(ownerTfLabel, tfLabel, scope),
|
|
305
|
-
attrs
|
|
306
|
-
object_id: objectId,
|
|
307
|
-
stage_id: expr.local(`${ownerTfLabel}_stage_ids_by_key`, [{ index: tfLabel }]),
|
|
308
|
-
sections,
|
|
309
|
-
},
|
|
316
|
+
attrs,
|
|
310
317
|
};
|
|
311
318
|
}
|
|
312
|
-
function resolveFieldRefs(refs, ownerTfLabel, scope, where, diagnostics) {
|
|
319
|
+
function resolveFieldRefs(refs, ownerTfLabel, scope, where, diagnostics, fieldAddresses) {
|
|
313
320
|
const out = [];
|
|
314
321
|
for (const ref of refs) {
|
|
315
|
-
const resolved = fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics);
|
|
322
|
+
const resolved = fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics, fieldAddresses);
|
|
316
323
|
if (resolved !== undefined)
|
|
317
324
|
out.push(resolved);
|
|
318
325
|
}
|
|
319
326
|
return out;
|
|
320
327
|
}
|
|
321
|
-
function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics) {
|
|
328
|
+
function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics, fieldAddresses) {
|
|
322
329
|
if (typeof ref === "object" && ref !== null && "__unsafe" in ref) {
|
|
323
330
|
if (ref.__unsafe === "platformId")
|
|
324
331
|
return ref.value;
|
|
@@ -342,13 +349,20 @@ function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics) {
|
|
|
342
349
|
return undefined;
|
|
343
350
|
}
|
|
344
351
|
const refName = ref.refName ?? "";
|
|
345
|
-
if (!SUB_TYPE_BY_AUTHORING_TYPE.has(ref.fieldType ?? "")) {
|
|
346
|
-
diagnostics.push(`${where}: field "${refName}" (type ${ref.fieldType ?? "?"}) has no terraform field resource mapping; dropped`);
|
|
347
|
-
return undefined;
|
|
348
|
-
}
|
|
349
352
|
if (!isCanonicalTsLabel(refName)) {
|
|
350
353
|
diagnostics.push(`${where}: field bag key "${refName}" is not a canonical tsLabel; dropped`);
|
|
351
354
|
return undefined;
|
|
352
355
|
}
|
|
353
|
-
|
|
356
|
+
const knownAddress = fieldAddresses?.get(refName);
|
|
357
|
+
if (knownAddress !== undefined) {
|
|
358
|
+
const dotIndex = knownAddress.indexOf(".");
|
|
359
|
+
if (dotIndex !== -1) {
|
|
360
|
+
return expr.resourceAttr(knownAddress.slice(0, dotIndex), knownAddress.slice(dotIndex + 1), ["id"]);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (!SUB_TYPE_BY_AUTHORING_TYPE.has(ref.fieldType ?? "")) {
|
|
364
|
+
diagnostics.push(`${where}: field "${refName}" (type ${ref.fieldType ?? "?"}) has no terraform field resource mapping; dropped`);
|
|
365
|
+
return undefined;
|
|
366
|
+
}
|
|
367
|
+
return customFieldRefToTfValue(ref.fieldType, refName, ownerTfLabel, scope, fieldAddresses);
|
|
354
368
|
}
|
|
@@ -55,8 +55,8 @@ function widgetFromTf(block, owner, ctx) {
|
|
|
55
55
|
if (target === undefined)
|
|
56
56
|
return undefined;
|
|
57
57
|
const filterOwner = typeof target !== "string" && (target.kind === "app" || target.kind === "element")
|
|
58
|
-
? { type: `elementum_${target.kind}`, label: target.key, ownerRefName: target.key, ownerTfLabel: target.key, scope: target.kind }
|
|
59
|
-
: { type: owner.type, label: owner.label, ownerRefName: owner.ownerRefName, ownerTfLabel: owner.ownerTfLabel, scope: owner.scope };
|
|
58
|
+
? { type: `elementum_${target.kind}`, label: target.key, ownerRefName: target.key, ownerTfLabel: target.key, scope: target.kind, foreignFieldRefsById: ctx.foreignFieldRefsById }
|
|
59
|
+
: { type: owner.type, label: owner.label, ownerRefName: owner.ownerRefName, ownerTfLabel: owner.ownerTfLabel, scope: owner.scope, foreignFieldRefsById: ctx.foreignFieldRefsById };
|
|
60
60
|
const filter = body["filter"] === undefined
|
|
61
61
|
? undefined
|
|
62
62
|
: filterFromTf(body["filter"], filterOwner, `${where}.${variant}.filter`);
|
|
@@ -40,6 +40,7 @@ export interface WidgetsToTfOptions {
|
|
|
40
40
|
readonly orgRefs: OrgRefLookup;
|
|
41
41
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
42
42
|
readonly diagnostics: string[];
|
|
43
|
+
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
43
44
|
}
|
|
44
45
|
export declare function widgetsToTf(widgets: Readonly<Record<string, AppWidgetWire>> | undefined, opts: WidgetsToTfOptions): TfBlock[];
|
|
45
46
|
export {};
|
|
@@ -20,9 +20,10 @@ export function widgetsToTf(widgets, opts) {
|
|
|
20
20
|
if (target === undefined)
|
|
21
21
|
continue;
|
|
22
22
|
const body = { name: widget.name ?? "", object_id: target.value };
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
// Always emitted, even empty — the provider schema treats columns as
|
|
24
|
+
// always-present on related-object/related-link widgets, so omitting
|
|
25
|
+
// it when empty diffs against ei's own export (see hcl_widget.go).
|
|
26
|
+
body["columns"] = resolveColumns(widget.columns, target, `${where}.columns`, opts);
|
|
26
27
|
if (widget.rows !== undefined)
|
|
27
28
|
body["rows"] = widget.rows;
|
|
28
29
|
attrs["related_object"] = body;
|
|
@@ -34,9 +35,10 @@ export function widgetsToTf(widgets, opts) {
|
|
|
34
35
|
continue;
|
|
35
36
|
const body = buttonBody(widget);
|
|
36
37
|
body["object_id"] = target.value;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// Always emitted, even empty — the provider schema treats columns as
|
|
39
|
+
// always-present on related-object/related-link widgets, so omitting
|
|
40
|
+
// it when empty diffs against ei's own export (see hcl_widget.go).
|
|
41
|
+
body["columns"] = resolveColumns(widget.columns, target, `${where}.columns`, opts);
|
|
40
42
|
if (widget.rows !== undefined)
|
|
41
43
|
body["rows"] = widget.rows;
|
|
42
44
|
if (widget.filter !== undefined)
|
|
@@ -65,22 +67,9 @@ export function widgetsToTf(widgets, opts) {
|
|
|
65
67
|
continue;
|
|
66
68
|
const body = buttonBody(widget);
|
|
67
69
|
body["automation_id"] = automationId;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (fieldId !== undefined && parameter.value !== undefined) {
|
|
72
|
-
opts.diagnostics.push(`${where}.parameters[${index}]: field and value are mutually exclusive; value dropped`);
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
name: parameter.name ?? "",
|
|
76
|
-
field_type: parameter.fieldType ?? "TEXT",
|
|
77
|
-
multiple: parameter.multiple ?? false,
|
|
78
|
-
required: parameter.required ?? false,
|
|
79
|
-
field_id: fieldId ?? null,
|
|
80
|
-
value: fieldId === undefined ? parameter.value ?? null : null,
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
}
|
|
70
|
+
const parameters = runAutomationParameters(widget, where, opts);
|
|
71
|
+
if (parameters.length > 0)
|
|
72
|
+
body["parameters"] = parameters;
|
|
84
73
|
attrs["run_automation_action"] = body;
|
|
85
74
|
break;
|
|
86
75
|
}
|
|
@@ -175,6 +164,46 @@ function resolveColumns(columns, target, where, opts) {
|
|
|
175
164
|
}
|
|
176
165
|
return out;
|
|
177
166
|
}
|
|
167
|
+
function runAutomationParameters(widget, where, opts) {
|
|
168
|
+
const authored = (widget.parameters ?? []).map((parameter, index) => {
|
|
169
|
+
const fieldId = resolveOwnerField(parameter.field, `${where}.parameters[${index}].field`, opts);
|
|
170
|
+
if (fieldId !== undefined && parameter.value !== undefined) {
|
|
171
|
+
opts.diagnostics.push(`${where}.parameters[${index}]: field and value are mutually exclusive; value dropped`);
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
name: parameter.name ?? "",
|
|
175
|
+
field_type: parameter.fieldType ?? "TEXT",
|
|
176
|
+
multiple: parameter.multiple ?? false,
|
|
177
|
+
required: parameter.required ?? false,
|
|
178
|
+
field_id: fieldId ?? null,
|
|
179
|
+
value: fieldId === undefined ? parameter.value ?? null : null,
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
const recordParam = onDemandRecordParamForWidget(widget.automation, opts);
|
|
183
|
+
if (recordParam === undefined || authored.some((parameter) => parameter.name === recordParam)) {
|
|
184
|
+
return authored;
|
|
185
|
+
}
|
|
186
|
+
return [
|
|
187
|
+
...authored,
|
|
188
|
+
{
|
|
189
|
+
name: recordParam,
|
|
190
|
+
field_type: "ASPECT_RECORD",
|
|
191
|
+
multiple: false,
|
|
192
|
+
required: false,
|
|
193
|
+
field_id: null,
|
|
194
|
+
value: "CURRENT_RECORD",
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
function onDemandRecordParamForWidget(automation, opts) {
|
|
199
|
+
if (typeof automation === "string" || automation?.refName === undefined || automation.refName === "") {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
return opts.workspaceAspects
|
|
203
|
+
?.get(workspaceAspectKey(opts.scope, opts.ownerRefName))
|
|
204
|
+
?.onDemandRecordParamByAutomationRefName
|
|
205
|
+
?.get(automation.refName);
|
|
206
|
+
}
|
|
178
207
|
function resolveAutomation(value, where, opts) {
|
|
179
208
|
if (typeof value === "string")
|
|
180
209
|
return value;
|
|
@@ -199,7 +228,7 @@ function resolveOwnerField(value, where, opts) {
|
|
|
199
228
|
opts.diagnostics.push(`${where}: field belongs to a different aspect; dropped`);
|
|
200
229
|
return undefined;
|
|
201
230
|
}
|
|
202
|
-
const resolved = fieldRefToTfValue(value.fieldType ?? "", refName, opts.ownerTfLabel, opts.scope);
|
|
231
|
+
const resolved = fieldRefToTfValue(value.fieldType ?? "", refName, opts.ownerTfLabel, opts.scope, opts.fieldAddresses);
|
|
203
232
|
if (resolved === undefined)
|
|
204
233
|
opts.diagnostics.push(`${where}: field ${JSON.stringify(refName)} has no Terraform mapping; dropped`);
|
|
205
234
|
return resolved;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Public graph barrel: KIND_MODULES + derived views for pull/build/canvas.
|
|
3
3
|
*/
|
|
4
4
|
import { type CatalogRenderArgs, type CatalogRenderResult, type EntityKindModule, type KindId, type ParentEdge, matchType } from "./types.js";
|
|
5
|
-
export type { AuthoringFacet, CanvasComponentId, CanvasFacet, CanvasView, CatalogAuthoringArgs, CatalogFacet, CatalogRenderArgs, CatalogRenderResult, CatalogRoot, DataFacet, DataFacetCatalogKind, EntityKindId, EntityKindModule, KindId, LifecycleFacet, OrgIdentityBag, ParentEdge, ParentageFacet, ResourceFacet, StreamFacet, StreamMatch, StreamPartition, StreamRootExtractResult, ToTfResult, } from "./types.js";
|
|
5
|
+
export type { AdoptionAddressAlias, AuthoringFacet, CanvasComponentId, CanvasFacet, CanvasView, CatalogAuthoringArgs, CatalogFacet, CatalogRenderArgs, CatalogRenderResult, CatalogRoot, DataFacet, DataFacetCatalogKind, EntityKindId, EntityKindModule, KindId, LifecycleFacet, OrgIdentityBag, ParentEdge, ParentageFacet, ResourceFacet, StreamFacet, StreamMatch, StreamPartition, StreamRootExtractResult, ToTfResult, } from "./types.js";
|
|
6
6
|
export type { ReferenceLookupStrategy } from "./types.js";
|
|
7
7
|
export { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE, defaultMatchResourceType, implementedResourceTypes, isResourceAdoptable, isTfLive, knownResourceTypes, matchType, singleResourceType, } from "./types.js";
|
|
8
8
|
export { KIND_MODULES } from "./modules.js";
|
|
@@ -62,6 +62,24 @@ export declare const ENTITY_KIND_BY_ID: ReadonlyMap<KindId, EntityKindModule>;
|
|
|
62
62
|
export declare const TYPE_TO_KIND: ReadonlyMap<string, EntityKindModule>;
|
|
63
63
|
/** Stream-root kinds (app, element, …). */
|
|
64
64
|
export declare const STREAM_ROOT_MODULES: readonly EntityKindModule[];
|
|
65
|
+
/**
|
|
66
|
+
* Every stream-root kind's own resource type (`elementum_app`,
|
|
67
|
+
* `elementum_element`, …) — lets engine code recognize "this is a stream
|
|
68
|
+
* root" generically, without hardcoding one kind's resource type (see
|
|
69
|
+
* `engine/pull/system-field-state.ts`'s state-backed system-field lookup,
|
|
70
|
+
* which the app path used to own alone before it generalized to cover
|
|
71
|
+
* element-owned system fields too).
|
|
72
|
+
*/
|
|
73
|
+
export declare const STREAM_ROOT_RESOURCE_TYPES: ReadonlySet<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Terraform resource type → canonical public authoring type, for every
|
|
76
|
+
* subTyped kind that populates `SubTypeRow.authoringType` (today: field's
|
|
77
|
+
* "USER"/"GROUP"/… discriminant). Lets engine code (e.g.
|
|
78
|
+
* field-refs-registry.ts's `bootstrapFromState`) resolve a resource type to
|
|
79
|
+
* its authoring type generically, without naming the kind or importing
|
|
80
|
+
* entities/ directly.
|
|
81
|
+
*/
|
|
82
|
+
export declare const AUTHORING_TYPE_BY_RESOURCE_TYPE: ReadonlyMap<string, string>;
|
|
65
83
|
/** Own-file children of a parent kind (build discovery + pull print paths). */
|
|
66
84
|
export declare function ownFileChildrenOf(parent: KindId): readonly EntityKindModule[];
|
|
67
85
|
/**
|
|
@@ -78,6 +78,26 @@ export const TYPE_TO_KIND = (() => {
|
|
|
78
78
|
})();
|
|
79
79
|
/** Stream-root kinds (app, element, …). */
|
|
80
80
|
export const STREAM_ROOT_MODULES = KIND_MODULES.filter((m) => m.stream.role === "streamRoot");
|
|
81
|
+
/**
|
|
82
|
+
* Every stream-root kind's own resource type (`elementum_app`,
|
|
83
|
+
* `elementum_element`, …) — lets engine code recognize "this is a stream
|
|
84
|
+
* root" generically, without hardcoding one kind's resource type (see
|
|
85
|
+
* `engine/pull/system-field-state.ts`'s state-backed system-field lookup,
|
|
86
|
+
* which the app path used to own alone before it generalized to cover
|
|
87
|
+
* element-owned system fields too).
|
|
88
|
+
*/
|
|
89
|
+
export const STREAM_ROOT_RESOURCE_TYPES = new Set(STREAM_ROOT_MODULES.flatMap((m) => knownResourceTypes(m.resource)));
|
|
90
|
+
/**
|
|
91
|
+
* Terraform resource type → canonical public authoring type, for every
|
|
92
|
+
* subTyped kind that populates `SubTypeRow.authoringType` (today: field's
|
|
93
|
+
* "USER"/"GROUP"/… discriminant). Lets engine code (e.g.
|
|
94
|
+
* field-refs-registry.ts's `bootstrapFromState`) resolve a resource type to
|
|
95
|
+
* its authoring type generically, without naming the kind or importing
|
|
96
|
+
* entities/ directly.
|
|
97
|
+
*/
|
|
98
|
+
export const AUTHORING_TYPE_BY_RESOURCE_TYPE = new Map(KIND_MODULES.flatMap((m) => m.resource.shape === "subTypes"
|
|
99
|
+
? m.resource.rows.flatMap((row) => (row.authoringType === undefined ? [] : [[row.resourceType, row.authoringType]]))
|
|
100
|
+
: []));
|
|
81
101
|
/** Own-file children of a parent kind (build discovery + pull print paths). */
|
|
82
102
|
export function ownFileChildrenOf(parent) {
|
|
83
103
|
return KIND_MODULES.filter((m) => m.authoring.unit === "ownFile" &&
|
|
@@ -50,6 +50,15 @@ export interface SubTypeRow {
|
|
|
50
50
|
readonly label: string;
|
|
51
51
|
readonly glyph?: string;
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Canonical public authoring type this resource type normalizes to (e.g.
|
|
55
|
+
* field's "USER"/"GROUP"). Optional — most subTyped kinds have no such
|
|
56
|
+
* discriminant; kinds that do (today: field) populate it so engine code
|
|
57
|
+
* can resolve a resource type to its authoring type generically, without
|
|
58
|
+
* naming the kind or importing entities/ (see field-refs-registry.ts's
|
|
59
|
+
* `bootstrapFromState`).
|
|
60
|
+
*/
|
|
61
|
+
readonly authoringType?: string;
|
|
53
62
|
}
|
|
54
63
|
export interface CompositeMember {
|
|
55
64
|
readonly role: string;
|
|
@@ -243,6 +252,12 @@ export interface OwnFileExtractResult {
|
|
|
243
252
|
readonly items: readonly unknown[];
|
|
244
253
|
readonly skipped: readonly string[];
|
|
245
254
|
readonly diagnostics: readonly string[];
|
|
255
|
+
/** Export address → canonical address rebuilt by the printed current API. */
|
|
256
|
+
readonly adoptionAddressAliases?: readonly AdoptionAddressAlias[];
|
|
257
|
+
}
|
|
258
|
+
export interface AdoptionAddressAlias {
|
|
259
|
+
readonly from: string;
|
|
260
|
+
readonly to: string;
|
|
246
261
|
}
|
|
247
262
|
export interface PrintedOwnFile {
|
|
248
263
|
readonly refName: string;
|
|
@@ -347,6 +362,8 @@ export interface BuildChildContext {
|
|
|
347
362
|
* catalog (#490).
|
|
348
363
|
*/
|
|
349
364
|
readonly fieldNamesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
365
|
+
/** Pulled roots may retain picklist labels removed from the live field. */
|
|
366
|
+
readonly allowUnknownPicklistOptions?: boolean;
|
|
350
367
|
/** Every app/element/table stream root in this build, by refName (see `ToTfContext.workspaceAspects`). */
|
|
351
368
|
readonly workspaceAspects?: ReadonlyMap<string, {
|
|
352
369
|
readonly kind: ChildResourceScope | "table";
|
|
@@ -429,6 +446,8 @@ export type LifecycleFacet = {
|
|
|
429
446
|
readonly extractOwnFile?: (ownBlocks: readonly TfBlock[], stream: StreamPartition, ctx: StreamExtractContext) => OwnFileExtractResult;
|
|
430
447
|
/** Print one extracted own-file instance to TypeScript source. */
|
|
431
448
|
readonly printOwnFile?: (item: unknown, opts: PrintOwnFileOptions) => PrintedOwnFile;
|
|
449
|
+
/** Re-pull: preserve author-owned values that the live export cannot represent. */
|
|
450
|
+
readonly mergePulledSource?: (freshSource: string, existingSource: string) => string;
|
|
432
451
|
/** Build: emit HCL for one discovered DeployableEntity. */
|
|
433
452
|
readonly toTf?: (entity: DeployableEntity, ctx: BuildChildContext) => ToTfResult;
|
|
434
453
|
/** Optional locals contribution after a root/own-file emit. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementumai/edk",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "Elementum Development Kit — statically typed SDK for building Elementum apps, automations, and agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -148,6 +148,8 @@
|
|
|
148
148
|
"scripts": {
|
|
149
149
|
"sync:version": "tsx src/scripts/sync-cli-version.ts",
|
|
150
150
|
"sync:skills": "tsx src/scripts/sync-skill-assets.ts",
|
|
151
|
+
"check:skills": "tsx src/scripts/sync-skill-assets.ts --check",
|
|
152
|
+
"clean:skills": "tsx src/scripts/sync-skill-assets.ts --clean",
|
|
151
153
|
"sync:compatibility": "tsx src/scripts/sync-compatibility.ts",
|
|
152
154
|
"check:release-context": "tsx src/scripts/release-context.ts v0.0.0 HEAD >/dev/null",
|
|
153
155
|
"fetch:schema": "make -C provider fetch-schema",
|
|
@@ -157,9 +159,9 @@
|
|
|
157
159
|
"build:sdk": "rm -rf dist-sdk && tsc -p tsconfig.sdk.json",
|
|
158
160
|
"build:cli": "npm run sync:version && npm run sync:skills && npm run sync:compatibility && rm -rf dist-cli && tsc -p tsconfig.cli.json",
|
|
159
161
|
"prebuild:provider": "npm run generate:graphql",
|
|
160
|
-
"build:provider": "go -C provider build
|
|
162
|
+
"build:provider": "go -C provider build .",
|
|
161
163
|
"prebuild:bridge": "npm run generate:graphql",
|
|
162
|
-
"build:bridge": "mkdir -p integration/.toolchain && go -C cmd/elementum build -
|
|
164
|
+
"build:bridge": "mkdir -p integration/.toolchain && go -C cmd/elementum build -o ../../integration/.toolchain/ei .",
|
|
163
165
|
"build:go": "npm run build:provider && npm run build:bridge",
|
|
164
166
|
"build:distribution": "npm --prefix distribution run build",
|
|
165
167
|
"version": "npm run sync:version && npm run sync:skills && git add src/cli/version.ts src/cli/skills-assets.ts skills/user/*/SKILL.md",
|
|
@@ -170,6 +172,7 @@
|
|
|
170
172
|
"elementum": "bash integration/tools/elementum-local.sh",
|
|
171
173
|
"local:clone": "bash integration/tools/clone-golden.sh",
|
|
172
174
|
"smoke:binary:bun": "node dist-cli/src/scripts/smoke-bun-binary.js",
|
|
175
|
+
"smoke:binary:workspace": "node dist-cli/src/scripts/smoke-bun-binary.js --workspace-only",
|
|
173
176
|
"prepare": "husky || true",
|
|
174
177
|
"prepack": "npm run build:sdk",
|
|
175
178
|
"pack:dry-run": "npm pack --dry-run",
|
|
@@ -180,7 +183,9 @@
|
|
|
180
183
|
"test:runtime": "vitest run",
|
|
181
184
|
"check:parity": "tsx src/scripts/check-provider-parity.ts",
|
|
182
185
|
"pretest:provider": "npm run generate:graphql",
|
|
183
|
-
"test:provider": "go -C provider test -
|
|
186
|
+
"test:provider": "go -C provider test -timeout=120s -parallel=10 ./internal/...",
|
|
187
|
+
"pretest:provider:cover": "npm run generate:graphql",
|
|
188
|
+
"test:provider:cover": "go -C provider test -v -cover -timeout=120s -parallel=10 ./internal/...",
|
|
184
189
|
"pretest:bridge": "npm run generate:graphql",
|
|
185
190
|
"test:bridge": "go -C cmd/elementum test -v -timeout=30s ./...",
|
|
186
191
|
"test:backend-lock": "vitest run __tests__/integration/http-backend-lock.test.ts __tests__/integration/http-state-backend.test.ts",
|
|
@@ -188,7 +193,7 @@
|
|
|
188
193
|
"test:distribution": "npm --prefix distribution test",
|
|
189
194
|
"test:watch": "vitest",
|
|
190
195
|
"test:cli": "vitest run __tests__/cli",
|
|
191
|
-
"test:binary": "npm run build:binary:bun && npm run smoke:binary:bun",
|
|
196
|
+
"test:binary": "npm run build:sdk && npm run build:binary:bun && npm run smoke:binary:bun",
|
|
192
197
|
"test:integration": "node integration/run.mjs",
|
|
193
198
|
"typecheck": "npm run typecheck:ci",
|
|
194
199
|
"typecheck:ci": "tsc --noEmit -p tsconfig.ci.json && tsc --noEmit -p tsconfig.examples-check.json",
|