@elementumai/edk 0.10.2 → 0.10.4
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 +7 -7
- package/dist-sdk/src/catalog/org.d.ts +7 -5
- package/dist-sdk/src/catalog/org.js +14 -9
- package/dist-sdk/src/catalog/token.js +4 -0
- package/dist-sdk/src/core/types/app.d.ts +22 -0
- package/dist-sdk/src/engine/build/context.d.ts +8 -0
- package/dist-sdk/src/engine/build/source-context.d.ts +3 -4
- package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
- package/dist-sdk/src/engine/coverage-gaps.js +3 -0
- package/dist-sdk/src/engine/ei/state.d.ts +48 -0
- package/dist-sdk/src/engine/ei/state.js +91 -0
- package/dist-sdk/src/engine/pull/authored-address.d.ts +100 -0
- package/dist-sdk/src/engine/pull/authored-address.js +360 -0
- package/dist-sdk/src/engine/pull/context.d.ts +69 -0
- package/dist-sdk/src/engine/tf/expr.d.ts +7 -0
- package/dist-sdk/src/engine/tf/expr.js +62 -18
- package/dist-sdk/src/engine/tf/index.d.ts +2 -1
- package/dist-sdk/src/engine/tf/index.js +2 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +10 -2
- package/dist-sdk/src/engine/tf/labels.js +15 -2
- package/dist-sdk/src/engine/tf/parse.js +19 -6
- package/dist-sdk/src/engine/tf/scan.d.ts +22 -0
- package/dist-sdk/src/engine/tf/scan.js +123 -0
- package/dist-sdk/src/engine/workspace/backend.d.ts +34 -0
- package/dist-sdk/src/engine/workspace/backend.js +104 -0
- package/dist-sdk/src/engine/workspace/generated-file.d.ts +3 -0
- package/dist-sdk/src/engine/workspace/generated-file.js +6 -0
- package/dist-sdk/src/engine/workspace/loader.d.ts +8 -0
- package/dist-sdk/src/engine/workspace/loader.js +22 -2
- package/dist-sdk/src/entities/agent/to-tf.d.ts +13 -11
- package/dist-sdk/src/entities/agent/to-tf.js +17 -12
- package/dist-sdk/src/entities/agent-tool/from-tf.js +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +10 -1
- package/dist-sdk/src/entities/app/build.d.ts +36 -4
- package/dist-sdk/src/entities/app/build.js +67 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +18 -0
- package/dist-sdk/src/entities/app/from-tf.js +17 -9
- package/dist-sdk/src/entities/app/module.js +1 -0
- package/dist-sdk/src/entities/app/stage-keys.d.ts +82 -0
- package/dist-sdk/src/entities/app/stage-keys.js +160 -0
- package/dist-sdk/src/entities/app/to-tf.js +17 -21
- package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +9 -1
- package/dist-sdk/src/entities/approval-chain/from-tf.js +31 -3
- package/dist-sdk/src/entities/approval-chain/module.js +12 -4
- package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/approval-chain/to-tf.js +6 -1
- package/dist-sdk/src/entities/automation/build.js +25 -8
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +3 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +5 -3
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +90 -17
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +140 -23
- package/dist-sdk/src/entities/automation/module.js +158 -44
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +8 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +2 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +18 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/to-tf.js +200 -38
- package/dist-sdk/src/entities/automation/triggers.d.ts +2 -0
- package/dist-sdk/src/entities/automation/triggers.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +51 -4
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +48 -4
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -2
- package/dist-sdk/src/entities/element/build.js +1 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +12 -6
- package/dist-sdk/src/entities/element/from-tf.js +26 -8
- package/dist-sdk/src/entities/element/module.js +3 -2
- package/dist-sdk/src/entities/element/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/element/to-tf.js +32 -25
- package/dist-sdk/src/entities/field/allow-list.d.ts +18 -0
- package/dist-sdk/src/entities/field/allow-list.js +42 -0
- package/dist-sdk/src/entities/field/build.d.ts +38 -3
- package/dist-sdk/src/entities/field/build.js +7 -2
- package/dist-sdk/src/entities/field/from-tf.js +178 -20
- package/dist-sdk/src/entities/field/module.js +2 -0
- package/dist-sdk/src/entities/field/options.d.ts +2 -0
- package/dist-sdk/src/entities/field/order.d.ts +9 -0
- package/dist-sdk/src/entities/field/order.js +33 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/to-tf.js +87 -0
- package/dist-sdk/src/entities/field/types.js +3 -0
- package/dist-sdk/src/entities/relationship/build.d.ts +3 -3
- package/dist-sdk/src/entities/relationship/from-tf.js +4 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +3 -1
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +8 -3
- package/dist-sdk/src/entities/service-account/workspace-owner.js +12 -4
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +5 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +13 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +1 -1
- package/dist-sdk/src/entities/skill/module.js +28 -2
- package/dist-sdk/src/entities/skill/to-tf.js +19 -14
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -1
- package/dist-sdk/src/entities/task/build.js +1 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +6 -2
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +13 -38
- package/dist-sdk/src/entities/view/custom-view-validate.d.ts +29 -0
- package/dist-sdk/src/entities/view/custom-view-validate.js +293 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +10 -0
- package/dist-sdk/src/entities/view/from-tf.js +164 -26
- package/dist-sdk/src/entities/view/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/view/to-tf.js +14 -6
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +2 -1
- package/dist-sdk/src/entities/visual-flow/from-tf.js +11 -2
- package/dist-sdk/src/entities/visual-flow/module.js +15 -5
- package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +8 -1
- package/dist-sdk/src/entities/widget/from-tf.js +12 -6
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +16 -0
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +8 -2
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +6 -0
- package/dist-sdk/src/graph/index.js +1 -0
- package/dist-sdk/src/graph/types.d.ts +66 -2
- package/package.json +2 -17
|
@@ -49,7 +49,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
49
49
|
diagnostics.push(`layouts.${stageKey} has no matching authored stage option; dropped`);
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
|
-
blocks.push(layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses, opts.widgetKeys));
|
|
52
|
+
blocks.push(layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses, opts.widgetKeys, opts.stageKeyByTfLabel?.get(stageTfLabel)));
|
|
53
53
|
}
|
|
54
54
|
const viewAddressByKey = new Map();
|
|
55
55
|
for (const [viewKey, view] of Object.entries(listViews ?? {})) {
|
|
@@ -266,10 +266,12 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
266
266
|
objectId,
|
|
267
267
|
diagnostics,
|
|
268
268
|
fieldAddresses,
|
|
269
|
+
fieldNames: opts.fieldNames,
|
|
270
|
+
fieldMetadata: opts.fieldMetadata,
|
|
269
271
|
orgRefs: opts.orgRefs,
|
|
270
272
|
workspaceAspects: opts.workspaceAspects,
|
|
271
273
|
resolveField: (ref, fieldWhere) => fieldRefToTfValue(ref, ownerTfLabel, scope, fieldWhere, diagnostics, fieldAddresses),
|
|
272
|
-
}, { editorPolicy: false }));
|
|
274
|
+
}, { editorPolicy: false, strictStructure: true }));
|
|
273
275
|
}
|
|
274
276
|
else {
|
|
275
277
|
// The page needs a layout document, and the platform rejects a blank
|
|
@@ -343,7 +345,7 @@ export function managedViewSortToTf(sort, ownerTfLabel, scope, where, diagnostic
|
|
|
343
345
|
}
|
|
344
346
|
return expr.jsonencode({ orders });
|
|
345
347
|
}
|
|
346
|
-
function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses, widgetKeys) {
|
|
348
|
+
function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses, widgetKeys, stageIdKey) {
|
|
347
349
|
const sections = [];
|
|
348
350
|
for (const section of layout.sections) {
|
|
349
351
|
const authoringType = section.type ?? "group";
|
|
@@ -420,8 +422,14 @@ function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectI
|
|
|
420
422
|
}
|
|
421
423
|
const fieldIds = resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics, fieldAddresses);
|
|
422
424
|
// Insert from the back so each `at` is an index in the original field
|
|
423
|
-
// list, not an index that earlier inserts have already shifted.
|
|
424
|
-
|
|
425
|
+
// list, not an index that earlier inserts have already shifted. When
|
|
426
|
+
// several widgets share the same `at`, insert later-authored ones first
|
|
427
|
+
// so the final order matches the authored widgets array (stable insert
|
|
428
|
+
// at one index would otherwise reverse them and plan a layout replace).
|
|
429
|
+
const ranked = inserted
|
|
430
|
+
.map((widget, order) => ({ ...widget, order }))
|
|
431
|
+
.sort((left, right) => right.at - left.at || right.order - left.order);
|
|
432
|
+
for (const widget of ranked) {
|
|
425
433
|
const index = Math.max(0, Math.min(widget.at, fieldIds.length));
|
|
426
434
|
fieldIds.splice(index, 0, widget.id);
|
|
427
435
|
}
|
|
@@ -447,7 +455,7 @@ function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectI
|
|
|
447
455
|
// in, instead of referencing a `<ownerTfLabel>_stage_ids_by_key` local that
|
|
448
456
|
// `element/locals.ts` never defines.
|
|
449
457
|
if (scope !== "element") {
|
|
450
|
-
attrs["stage_id"] = expr.local(`${ownerTfLabel}_stage_ids_by_key`, [{ index: tfLabel }]);
|
|
458
|
+
attrs["stage_id"] = expr.local(`${ownerTfLabel}_stage_ids_by_key`, [{ index: stageIdKey ?? tfLabel }]);
|
|
451
459
|
}
|
|
452
460
|
return {
|
|
453
461
|
kind: "resource",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
import { type StageHandleIndex } from "../app/stage-keys.js";
|
|
2
3
|
import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
|
|
3
4
|
export type NormalizedFlowObject = {
|
|
4
5
|
readonly kind: "app" | "element";
|
|
@@ -60,4 +61,4 @@ export interface NormalizedVisualFlow {
|
|
|
60
61
|
readonly refName: string;
|
|
61
62
|
readonly stages: readonly NormalizedVisualFlowStage[];
|
|
62
63
|
}
|
|
63
|
-
export declare function visualFlowFromTf(block: TfBlock, ownerType: "elementum_app" | "elementum_element", ownerLabel: string, scope: ChildResourceScope, ctx: FromTfContext): NormalizedVisualFlow;
|
|
64
|
+
export declare function visualFlowFromTf(block: TfBlock, ownerType: "elementum_app" | "elementum_element", ownerLabel: string, scope: ChildResourceScope, ctx: FromTfContext, stageHandles?: StageHandleIndex): NormalizedVisualFlow;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
2
|
import { dataRefLabel, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
3
|
+
import { LostStageHandleError, lostStageMessage, pulledStageHandle } from "../app/stage-keys.js";
|
|
3
4
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
5
|
import { dataAspectDisplayName, dataAspectRefName } from "../shared/aspect-target-from-tf.js";
|
|
5
6
|
import { DATAMINE_RESOURCE_TYPE } from "../datamine/module.js";
|
|
@@ -147,7 +148,7 @@ function nodeFromTf(value, ownerLabel, scope, ctx, where) {
|
|
|
147
148
|
...(target !== undefined ? { target } : {}),
|
|
148
149
|
}];
|
|
149
150
|
}
|
|
150
|
-
export function visualFlowFromTf(block, ownerType, ownerLabel, scope, ctx) {
|
|
151
|
+
export function visualFlowFromTf(block, ownerType, ownerLabel, scope, ctx, stageHandles) {
|
|
151
152
|
if (block.type !== VISUAL_FLOW_RESOURCE_TYPE || !block.label)
|
|
152
153
|
throw new EntityTfError(`expected ${VISUAL_FLOW_RESOURCE_TYPE}`);
|
|
153
154
|
for (const key of Object.keys(block.attrs))
|
|
@@ -170,7 +171,15 @@ export function visualFlowFromTf(block, ownerType, ownerLabel, scope, ctx) {
|
|
|
170
171
|
const rawNodes = stage["nodes"];
|
|
171
172
|
if (!Array.isArray(rawNodes))
|
|
172
173
|
throw new EntityTfError(`${block.type}.${block.label}.stages[${index}]: nodes must be a list`);
|
|
173
|
-
|
|
174
|
+
// Imported keys may keep punctuation; pull a handle build maps back to
|
|
175
|
+
// this same stage. A stage whose only handle is another stage's key keeps
|
|
176
|
+
// the flow unmanaged rather than binding it to that stage (#1136).
|
|
177
|
+
const pulled = pulledStageHandle(entry.index, stageHandles);
|
|
178
|
+
if (pulled.kind === "lost")
|
|
179
|
+
throw new LostStageHandleError(lostStageMessage(`${block.type}.${block.label}.stages[${index}]`, entry.index, pulled, "the flow is left unmanaged"));
|
|
180
|
+
if (pulled.kind === "none")
|
|
181
|
+
throw new EntityTfError(`${block.type}.${block.label}.stages[${index}]: stage key ${JSON.stringify(entry.index)} has no terraform label handle`);
|
|
182
|
+
return { stage: tfLabelToTsLabel(pulled.handle), nodes: Object.fromEntries(rawNodes.map((node, nodeIndex) => nodeFromTf(node, ownerLabel, scope, ctx, `${block.type}.${block.label}.stages[${index}].nodes[${nodeIndex}]`))) };
|
|
174
183
|
});
|
|
175
184
|
return { refName: scopedLabelToBagKey(ownerLabel, block.label, scope), stages };
|
|
176
185
|
}
|
|
@@ -3,6 +3,7 @@ import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
|
3
3
|
import { ELEMENT_RESOURCE_TYPE } from "../element/module.js";
|
|
4
4
|
import { visualFlowFromTf } from "./from-tf.js";
|
|
5
5
|
import { printVisualFlow } from "./printer.js";
|
|
6
|
+
import { appStageKeyByHandle, LostStageHandleError, stageHandleIndexFromTfStages } from "../app/stage-keys.js";
|
|
6
7
|
import { visualFlowToTf } from "./to-tf.js";
|
|
7
8
|
export const VISUAL_FLOW_RESOURCE_TYPE = "elementum_flow";
|
|
8
9
|
function extract(blocks, _stream, ctx) {
|
|
@@ -12,15 +13,24 @@ function extract(blocks, _stream, ctx) {
|
|
|
12
13
|
if (ctx.parentScope === "table")
|
|
13
14
|
return { items, skipped: blocks.map((block) => `${block.type}.${block.label ?? "?"}`), diagnostics: ["visual flows cannot belong to tables"] };
|
|
14
15
|
const ownerType = ctx.parentScope === "element" ? ELEMENT_RESOURCE_TYPE : APP_RESOURCE_TYPE;
|
|
15
|
-
|
|
16
|
+
// Elements carry no stages; an app's stage handles keep flow stages on their own stage (#1136).
|
|
17
|
+
const stageHandles = ownerType === APP_RESOURCE_TYPE ? stageHandleIndexFromTfStages(ctx.resourceByAddress?.(`${APP_RESOURCE_TYPE}.${ctx.appTfLabel}`)?.attrs["stages"]) : undefined;
|
|
18
|
+
const releaseIfManaged = [];
|
|
19
|
+
for (const block of blocks) {
|
|
16
20
|
try {
|
|
17
|
-
items.push(visualFlowFromTf(block, ownerType, ctx.appTfLabel, ctx.parentScope, ctx));
|
|
21
|
+
items.push(visualFlowFromTf(block, ownerType, ctx.appTfLabel, ctx.parentScope, ctx, stageHandles));
|
|
18
22
|
}
|
|
19
23
|
catch (error) {
|
|
20
|
-
|
|
24
|
+
const address = `${block.type}.${block.label ?? "?"}`;
|
|
25
|
+
skipped.push(address);
|
|
26
|
+
// A flow on a stage with no handle of its own has no authored form:
|
|
27
|
+
// release an earlier adoption instead of destroying it (#1136).
|
|
28
|
+
if (error instanceof LostStageHandleError)
|
|
29
|
+
releaseIfManaged.push(address);
|
|
21
30
|
diagnostics.push(error instanceof Error ? error.message : String(error));
|
|
22
31
|
}
|
|
23
|
-
|
|
32
|
+
}
|
|
33
|
+
return { items, skipped, ...(releaseIfManaged.length > 0 && { releaseIfManaged }), diagnostics };
|
|
24
34
|
}
|
|
25
35
|
export const visualFlowModule = {
|
|
26
36
|
kind: "visual-flow", stream: { role: "streamMember" }, authoring: { unit: "ownFile", bag: "visual-flows" },
|
|
@@ -36,6 +46,6 @@ export const visualFlowModule = {
|
|
|
36
46
|
...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
|
|
37
47
|
}),
|
|
38
48
|
};
|
|
39
|
-
}, toTf: (entity, ctx) => visualFlowToTf(entity, { appRefName: ctx.appRefName, appTfLabel: ctx.appTfLabel, parentScope: ctx.parentScope, orgRefs: ctx.orgRefs, workspaceAspects: ctx.workspaceAspects, diagnostics: ctx.diagnostics }) },
|
|
49
|
+
}, toTf: (entity, ctx) => visualFlowToTf(entity, { appRefName: ctx.appRefName, appTfLabel: ctx.appTfLabel, parentScope: ctx.parentScope, orgRefs: ctx.orgRefs, workspaceAspects: ctx.workspaceAspects, diagnostics: ctx.diagnostics, stageKeyByTfLabel: appStageKeyByHandle(ctx.streamRootEntity?.payload) }) },
|
|
40
50
|
canvas: { participates: true, label: "Visual flow", glyph: "⇢", component: "generic" }, catalog: NO_CATALOG,
|
|
41
51
|
};
|
|
@@ -8,6 +8,8 @@ export interface VisualFlowToTfContext {
|
|
|
8
8
|
readonly orgRefs: OrgRefLookup;
|
|
9
9
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
10
10
|
readonly diagnostics?: string[];
|
|
11
|
+
/** Owning app's stage handle → real `stage_ids_by_key` key (#1136). */
|
|
12
|
+
readonly stageKeyByTfLabel?: ReadonlyMap<string, string>;
|
|
11
13
|
}
|
|
12
14
|
export declare function visualFlowToTf(entity: DeployableEntity, ctx: VisualFlowToTfContext): {
|
|
13
15
|
blocks: readonly TfBlock[];
|
|
@@ -161,7 +161,7 @@ export function visualFlowToTf(entity, ctx) {
|
|
|
161
161
|
if (!stage.stage)
|
|
162
162
|
throw new EntityTfError(`visual flow ${entity.refName}: every stage requires a stable key`);
|
|
163
163
|
return {
|
|
164
|
-
stage_id: expr.resourceAttr(ownerType, ctx.appTfLabel, ["stage_ids_by_key", { index: tsLabelToTfLabel(stage.stage) }]),
|
|
164
|
+
stage_id: expr.resourceAttr(ownerType, ctx.appTfLabel, ["stage_ids_by_key", { index: ctx.stageKeyByTfLabel?.get(tsLabelToTfLabel(stage.stage)) ?? tsLabelToTfLabel(stage.stage) }]),
|
|
165
165
|
nodes: Object.entries(stage.nodes ?? {}).map(([key, node]) => ({
|
|
166
166
|
key,
|
|
167
167
|
...(node.description !== undefined && { description: node.description }),
|
|
@@ -98,7 +98,14 @@ export type RunAutomationWidgetParameter = RunAutomationWidgetParameterBase & ({
|
|
|
98
98
|
export interface RunAutomationWidget extends WidgetButtonStyle {
|
|
99
99
|
readonly type: "runAutomation";
|
|
100
100
|
readonly name: string;
|
|
101
|
-
|
|
101
|
+
/**
|
|
102
|
+
* The automation this button runs. `displayName` is its name when the
|
|
103
|
+
* automation is not an authored file in this workspace; build looks it up
|
|
104
|
+
* by that name. `name` is not the lookup key.
|
|
105
|
+
*/
|
|
106
|
+
readonly automation: AutomationRef & {
|
|
107
|
+
readonly displayName?: string;
|
|
108
|
+
};
|
|
102
109
|
readonly parameters?: readonly RunAutomationWidgetParameter[];
|
|
103
110
|
}
|
|
104
111
|
/** One record-layout display widget (`elementum_widget`). */
|
|
@@ -96,7 +96,7 @@ function widgetFromTf(block, owner, ctx, dynamicLayoutCompanionLabels) {
|
|
|
96
96
|
return undefined;
|
|
97
97
|
return { key, type: "createRecord", name, target, ...buttonStyle(body, where, ctx) };
|
|
98
98
|
}
|
|
99
|
-
const automation = automationRef(body["automation_id"], owner);
|
|
99
|
+
const automation = automationRef(body["automation_id"], owner, ctx);
|
|
100
100
|
if (automation === undefined) {
|
|
101
101
|
ctx.diagnostics.push(`${where}.run_automation_action: automation_id is not resolvable; skipped`);
|
|
102
102
|
return undefined;
|
|
@@ -266,18 +266,24 @@ function recordIdentityTarget(resourceType, target) {
|
|
|
266
266
|
const targetType = target.kind === "app" ? "elementum_app" : "elementum_element";
|
|
267
267
|
return resourceType === WIDGET_RESOURCE_TYPE || resourceType === targetType ? target : undefined;
|
|
268
268
|
}
|
|
269
|
-
function automationRef(value, owner) {
|
|
269
|
+
function automationRef(value, owner, ctx) {
|
|
270
270
|
if (typeof value === "string")
|
|
271
271
|
return value;
|
|
272
272
|
const label = resourceRefLabel(value, AUTOMATION_RESOURCE_TYPE);
|
|
273
273
|
if (label === undefined)
|
|
274
274
|
return undefined;
|
|
275
|
+
// Automations keep the `apps_` prefix on elements; decoding with the
|
|
276
|
+
// widget owner's element scope leaves `apps…` in the bag key.
|
|
277
|
+
const key = scopedLabelToBagKey(owner.ownerTfLabel, label, "app");
|
|
278
|
+
// The display name lets build look the automation up when pull leaves it
|
|
279
|
+
// platform-managed, so it is not in source.
|
|
280
|
+
const exportedName = ctx.resourceByAddress?.(`${AUTOMATION_RESOURCE_TYPE}.${label}`)?.attrs["name"];
|
|
281
|
+
const displayName = typeof exportedName === "string" && exportedName !== "" ? exportedName : undefined;
|
|
275
282
|
return {
|
|
276
283
|
kind: "automation",
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
name: scopedLabelToBagKey(owner.ownerTfLabel, label, "app"),
|
|
284
|
+
key,
|
|
285
|
+
name: displayName ?? key,
|
|
286
|
+
...(displayName !== undefined ? { displayName } : {}),
|
|
281
287
|
parent: owner.ownerRefName,
|
|
282
288
|
};
|
|
283
289
|
}
|
|
@@ -315,6 +315,22 @@ function resolveAutomation(value, where, opts) {
|
|
|
315
315
|
opts.diagnostics.push(`${where}: foreign automation references require a provider data lookup with app_id; use a raw id until that data-source tranche lands`);
|
|
316
316
|
return undefined;
|
|
317
317
|
}
|
|
318
|
+
const authored = opts.workspaceAspects
|
|
319
|
+
?.get(workspaceAspectKey(opts.scope, opts.ownerRefName))
|
|
320
|
+
?.automationRefNames;
|
|
321
|
+
if (authored !== undefined && !authored.has(refName)) {
|
|
322
|
+
// Not in source: pull leaves some automations platform-managed. Look the
|
|
323
|
+
// live one up by display name in this owner rather than reference a
|
|
324
|
+
// resource the build never declares.
|
|
325
|
+
const displayName = value?.displayName ?? "";
|
|
326
|
+
if (displayName === "") {
|
|
327
|
+
opts.diagnostics.push(`${where}: automation "${refName}" is not in this workspace, and the reference has no display name to look it up by; re-pull to record it`);
|
|
328
|
+
return undefined;
|
|
329
|
+
}
|
|
330
|
+
const label = `${opts.ownerTfLabel}_${tsLabelToTfLabel(refName)}`;
|
|
331
|
+
opts.orgRefs.rawLookup(AUTOMATION_RESOURCE_TYPE, label, displayName, { app_id: opts.objectId });
|
|
332
|
+
return expr.dataAttr(AUTOMATION_RESOURCE_TYPE, label, ["id"]);
|
|
333
|
+
}
|
|
318
334
|
return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, automationResourceLabel(opts.ownerTfLabel, refName, opts.scope, opts.scope === "element" ? opts.ownerHandle : undefined), ["id"]);
|
|
319
335
|
}
|
|
320
336
|
function resolveManagedColumn(value, refName, target, opts) {
|
|
@@ -239,6 +239,7 @@ export type ListCollectionBlockSelfFetchingProps = {
|
|
|
239
239
|
readonly direction: "ASC" | "DESC";
|
|
240
240
|
}>) | (PropExpression);
|
|
241
241
|
}) | (PropExpression);
|
|
242
|
+
readonly pageSize?: (((25) | (PropExpression)) | ((50) | (PropExpression)) | ((100) | (PropExpression))) | (PropExpression);
|
|
242
243
|
readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
|
|
243
244
|
};
|
|
244
245
|
/**
|
|
@@ -493,6 +494,7 @@ export type DataTableBlockSelfFetchingProps = {
|
|
|
493
494
|
readonly direction: "ASC" | "DESC";
|
|
494
495
|
}>) | (PropExpression);
|
|
495
496
|
}) | (PropExpression);
|
|
497
|
+
readonly pageSize?: (((25) | (PropExpression)) | ((50) | (PropExpression)) | ((100) | (PropExpression))) | (PropExpression);
|
|
496
498
|
readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
|
|
497
499
|
readonly selectedAspectId?: ((string) | (PropExpression)) | (null);
|
|
498
500
|
readonly selectedHandle?: ((string) | (PropExpression)) | (null);
|
|
@@ -533,7 +535,7 @@ export type ActionCardItem = {
|
|
|
533
535
|
/**
|
|
534
536
|
* Customer-facing name: Chart
|
|
535
537
|
* Customer-facing description: A bar, line, or donut chart in a card. Use it to compare values or show a trend.
|
|
536
|
-
* Internal authoring guidance: Plot-only report chart in a card with optional title, metric, and caption, branded primary default palette, and no download. Use live grouped count fetch (aspectId + stable groupByFieldId) for useful bar, line, or donut category charts; bar and line share the same grouped dataset. Grouped count supports uncalculated single-value picklist/text fields plus filterJson/filterPreset and named quickFilterValue, ANDed with the block filter. Bind filterJson and use the same filterPreset as ListControls when the chart shares the view filter; omit that binding and give the chart its own filterPreset/filterJson when it should measure a different slice. Use date series (aspectId + stable dateFieldId, saved bucket day/week/month, and either an exact YYYY-MM-DD/YYYY-MM-DD range or relativeRange) for a bar or line trend. Exact range is a BETWEEN on that date field. relativeRange is { count, unit, optional offset } with unit day, week, month, quarter, or year. The runtime resolves it to an inclusive local-calendar BETWEEN that moves with today. Omit offset to include the current unfinished unit; offset 1 is the previous complete unit or units. Quarter and year have no series granularity, so set bucket to month unless a day or week bucket is intended. Set only one window. Write the window in the Spec. The builder has no range control. Plot the returned points in order, including zeros the API already filled. A blank window draws the empty plot. There is no runtime bucket switch. Use scalar fetch (aggregation + aspectId, optional fieldId/filterJson/filterPreset/quickFilterValue) only for one observation; prefer MetricsRowBlock for a single KPI and never present one scalar line point as a trend. Nonempty filterJson wins; a preset is only a seed. Never mix fetch and embedded data. Use embedded data for preview or when the agent already owns the complete dataset. Grouped numeric sum/avg/min/max is not supported by this count-shaped API. Pair charts with DataTableBlock/ListCollectionBlock and MetricsRowBlock to build dashboards.
|
|
538
|
+
* Internal authoring guidance: Plot-only report chart in a card with optional title, metric, and caption, branded primary default palette, and no download. Set showBackingList true on a fetch arm to show a fullscreen control that opens the records matching this chart. Use live grouped count fetch (aspectId + stable groupByFieldId) for useful bar, line, or donut category charts; bar and line share the same grouped dataset. Grouped count supports uncalculated single-value picklist/text fields plus filterJson/filterPreset and named quickFilterValue, ANDed with the block filter. Bind filterJson and use the same filterPreset as ListControls when the chart shares the view filter; omit that binding and give the chart its own filterPreset/filterJson when it should measure a different slice. Use date series (aspectId + stable dateFieldId, saved bucket day/week/month, and either an exact YYYY-MM-DD/YYYY-MM-DD range or relativeRange) for a bar or line trend. Exact range is a BETWEEN on that date field. relativeRange is { count, unit, optional offset } with unit day, week, month, quarter, or year. The runtime resolves it to an inclusive local-calendar BETWEEN that moves with today. Omit offset to include the current unfinished unit; offset 1 is the previous complete unit or units. Quarter and year have no series granularity, so set bucket to month unless a day or week bucket is intended. Set only one window. Write the window in the Spec. The builder has no range control. Plot the returned points in order, including zeros the API already filled. A blank window draws the empty plot. There is no runtime bucket switch. Use scalar fetch (aggregation + aspectId, optional fieldId/filterJson/filterPreset/quickFilterValue) only for one observation; prefer MetricsRowBlock for a single KPI and never present one scalar line point as a trend. Nonempty filterJson wins; a preset is only a seed. Never mix fetch and embedded data. Use embedded data for preview or when the agent already owns the complete dataset. Grouped numeric sum/avg/min/max is not supported by this count-shaped API. Pair charts with DataTableBlock/ListCollectionBlock and MetricsRowBlock to build dashboards.
|
|
537
539
|
*/
|
|
538
540
|
export type ChartBlockElement = {
|
|
539
541
|
readonly type: "ChartBlock";
|
|
@@ -575,6 +577,7 @@ export type ChartBlockFetchProps = {
|
|
|
575
577
|
}))) | (PropExpression)) | (null);
|
|
576
578
|
readonly filterPreset?: ((("createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned") | (PropExpression)) | ((ReadonlyArray<"createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned">) | (PropExpression))) | (PropExpression);
|
|
577
579
|
readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
|
|
580
|
+
readonly showBackingList?: (boolean) | (PropExpression);
|
|
578
581
|
};
|
|
579
582
|
export type ChartBlockGroupedFetchProps = {
|
|
580
583
|
readonly variant: ("bar" | "line" | "donut") | (PropExpression);
|
|
@@ -590,6 +593,7 @@ export type ChartBlockGroupedFetchProps = {
|
|
|
590
593
|
}))) | (PropExpression)) | (null);
|
|
591
594
|
readonly filterPreset?: ((("createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned") | (PropExpression)) | ((ReadonlyArray<"createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned">) | (PropExpression))) | (PropExpression);
|
|
592
595
|
readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
|
|
596
|
+
readonly showBackingList?: (boolean) | (PropExpression);
|
|
593
597
|
};
|
|
594
598
|
export type ChartBlockDateSeriesProps = {
|
|
595
599
|
readonly variant: ("bar" | "line") | (PropExpression);
|
|
@@ -608,6 +612,7 @@ export type ChartBlockDateSeriesProps = {
|
|
|
608
612
|
}))) | (PropExpression)) | (null);
|
|
609
613
|
readonly filterPreset?: ((("createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned") | (PropExpression)) | ((ReadonlyArray<"createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned">) | (PropExpression))) | (PropExpression);
|
|
610
614
|
readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
|
|
615
|
+
readonly showBackingList?: (boolean) | (PropExpression);
|
|
611
616
|
};
|
|
612
617
|
export type ChartBlockRelativeRange = {
|
|
613
618
|
readonly count: (number) | (PropExpression);
|
|
@@ -617,7 +622,7 @@ export type ChartBlockRelativeRange = {
|
|
|
617
622
|
/**
|
|
618
623
|
* Customer-facing name: Metrics
|
|
619
624
|
* Customer-facing description: A single KPI tile with a caption and prominent value.
|
|
620
|
-
* Internal authoring guidance: Single read-only KPI tile with a caption, prominent value, and optional static subtext below successful results. Use formattedValue for a complete display-ready metric, or calc for live Aspect.calculation data with optional explicit aspectId (otherwise the managed-view default), filterJson/filterPreset, quickFilterValue, number format, empty copy, and color/colorRules limited to default, primary organization theme, muted, error, success, or warning. Bind filterJson and use the same filterPreset as ListControls when the KPI should share its view filter; give the metric its own filterPreset/filterJson without that binding when it should measure a different slice. Each MetricsRowBlock renders exactly one KPI; compose several independent tiles in RowBlock. Prefer ChartBlock when the result needs a bar, line, donut, category comparison, or trend.
|
|
625
|
+
* Internal authoring guidance: Single read-only KPI tile with a caption, prominent value, and optional static subtext below successful results. Use formattedValue for a complete display-ready metric, or calc for live Aspect.calculation data with optional explicit aspectId (otherwise the managed-view default), filterJson/filterPreset, quickFilterValue, number format, empty copy, and color/colorRules limited to default, primary organization theme, muted, error, success, or warning. Set showBackingList true on the self-fetch branch to show a fullscreen control that opens the records matching this metric. Bind filterJson and use the same filterPreset as ListControls when the KPI should share its view filter; give the metric its own filterPreset/filterJson without that binding when it should measure a different slice. Each MetricsRowBlock renders exactly one KPI; compose several independent tiles in RowBlock. Prefer ChartBlock when the result needs a bar, line, donut, category comparison, or trend.
|
|
621
626
|
*/
|
|
622
627
|
export type MetricsRowBlockElement = {
|
|
623
628
|
readonly type: "MetricsRowBlock";
|
|
@@ -673,6 +678,7 @@ export type MetricsRowSelfFetchProps = {
|
|
|
673
678
|
}))) | (PropExpression)) | (null);
|
|
674
679
|
readonly filterPreset?: ((("createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned") | (PropExpression)) | ((ReadonlyArray<"createdByCurrentUser" | "createdInLast24Hours" | "createdInLast7Days" | "createdInLast30Days" | "createdInLast90Days" | "createdInLastYear" | "closedInLast24Hours" | "closedInLast7Days" | "closedInLast30Days" | "closedInLast90Days" | "closedInLastYear" | "assignedToCurrentUser" | "unassigned">) | (PropExpression))) | (PropExpression);
|
|
675
680
|
readonly quickFilterValue?: ((string) | (PropExpression)) | (null);
|
|
681
|
+
readonly showBackingList?: (boolean) | (PropExpression);
|
|
676
682
|
readonly emptyMessage?: (string) | (PropExpression);
|
|
677
683
|
};
|
|
678
684
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by `npm run generate:ragnarok` — do not edit. Refresh with `npm run refresh:ragnarok`.
|
|
2
|
-
// Source: urn:elementum:elementum-blocks:spec:v1 version 1.
|
|
3
|
-
// Schema sha256:
|
|
2
|
+
// Source: urn:elementum:elementum-blocks:spec:v1 version 1.39.0
|
|
3
|
+
// Schema sha256: 073dd4066f43c677f79f3e55af3f33786d4c33dc4d587527aa8d7f1d875d57b6
|
|
4
4
|
// Generator revision: 2
|
|
5
5
|
export {};
|
|
@@ -94,6 +94,12 @@ export declare const BUILD_VS_EXPORT_ATTRIBUTE_LOCALS: {
|
|
|
94
94
|
readonly localPrefix: string;
|
|
95
95
|
readonly listField?: string;
|
|
96
96
|
}[];
|
|
97
|
+
export declare const BUILD_VS_EXPORT_PICKLIST_LABEL_ASSIGNMENTS: {
|
|
98
|
+
readonly resourceType: string;
|
|
99
|
+
readonly attribute: string;
|
|
100
|
+
readonly fieldAttribute: string;
|
|
101
|
+
readonly valueAttribute: string;
|
|
102
|
+
}[];
|
|
97
103
|
export declare const BUILD_VS_EXPORT_TASK_OUTPUT_REFERENCE_NAMES: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
98
104
|
/** Kind id → module. */
|
|
99
105
|
export declare const KIND_BY_ID: ReadonlyMap<KindId, EntityKindModule>;
|
|
@@ -64,6 +64,7 @@ export const BUILD_VS_EXPORT_NESTED_OMITTED_DEFAULTS = KIND_MODULES.flatMap((mod
|
|
|
64
64
|
export const BUILD_VS_EXPORT_COMPUTED_REFERENCE_MAPS = KIND_MODULES.flatMap((module) => module.roundtrip?.computedReferenceMaps ?? []);
|
|
65
65
|
export const BUILD_VS_EXPORT_RECORD_FIELD_OUTPUT_KEYS = KIND_MODULES.flatMap((module) => module.roundtrip?.recordFieldOutputKeys ?? []);
|
|
66
66
|
export const BUILD_VS_EXPORT_ATTRIBUTE_LOCALS = KIND_MODULES.flatMap((module) => module.roundtrip?.exportedAttributeLocals ?? []);
|
|
67
|
+
export const BUILD_VS_EXPORT_PICKLIST_LABEL_ASSIGNMENTS = KIND_MODULES.flatMap((module) => module.roundtrip?.picklistLabelAssignments ?? []);
|
|
67
68
|
export const BUILD_VS_EXPORT_TASK_OUTPUT_REFERENCE_NAMES = new Map(KIND_MODULES.flatMap((module) => Object.entries(module.roundtrip?.taskOutputReferenceNames ?? {}))
|
|
68
69
|
.map(([taskType, names]) => [taskType, new Map(Object.entries(names))]));
|
|
69
70
|
/** Kind id → module. */
|
|
@@ -310,6 +310,14 @@ export interface OwnFileExtractResult {
|
|
|
310
310
|
readonly validations?: readonly ValidationFailure[];
|
|
311
311
|
/** Export address → canonical address rebuilt by the printed current API. */
|
|
312
312
|
readonly adoptionAddressAliases?: readonly AdoptionAddressAlias[];
|
|
313
|
+
/**
|
|
314
|
+
* Own-file ref names released from state on this pull. Their authored files
|
|
315
|
+
* are archived so the next plan does not recreate the live resource (#1858).
|
|
316
|
+
*/
|
|
317
|
+
readonly quarantineOwnFiles?: readonly {
|
|
318
|
+
readonly kind: string;
|
|
319
|
+
readonly refName: string;
|
|
320
|
+
}[];
|
|
313
321
|
}
|
|
314
322
|
export interface AdoptionAddressAlias {
|
|
315
323
|
readonly from: string;
|
|
@@ -342,6 +350,8 @@ export interface MergePulledSourceContext {
|
|
|
342
350
|
/** Workspace state read at write time; undefined when it could not be read. */
|
|
343
351
|
readonly stateResources?: readonly {
|
|
344
352
|
readonly type?: string;
|
|
353
|
+
readonly mode?: string;
|
|
354
|
+
readonly module?: string;
|
|
345
355
|
readonly instances?: readonly {
|
|
346
356
|
readonly attributes?: Record<string, unknown>;
|
|
347
357
|
}[];
|
|
@@ -463,6 +473,13 @@ export interface BuildChildContext {
|
|
|
463
473
|
* used in a formula needs the searched aspect's field resources.
|
|
464
474
|
*/
|
|
465
475
|
readonly fieldAddressesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
476
|
+
/**
|
|
477
|
+
* Every app/element authored in the workspace, keyed like
|
|
478
|
+
* `workspaceAspects` (`<kind>:<refName>`), including those a partial build
|
|
479
|
+
* (pull's root-only build) leaves out. Tells an authored sibling outside this
|
|
480
|
+
* build apart from an aspect the workspace never authors.
|
|
481
|
+
*/
|
|
482
|
+
readonly authoredAspectKeys?: ReadonlySet<string>;
|
|
466
483
|
/** Pulled roots may retain picklist labels removed from the live field. */
|
|
467
484
|
readonly allowUnknownPicklistOptions?: boolean;
|
|
468
485
|
/** Every app/element/table stream root in this build, by refName (see `ToTfContext.workspaceAspects`). */
|
|
@@ -471,6 +488,11 @@ export interface BuildChildContext {
|
|
|
471
488
|
readonly tfLabel: string;
|
|
472
489
|
readonly streamRootEntity?: DeployableEntity;
|
|
473
490
|
}>;
|
|
491
|
+
/** See `ToTfContext.outOfScopeApps`. */
|
|
492
|
+
readonly outOfScopeApps?: ReadonlyMap<string, {
|
|
493
|
+
readonly name: string;
|
|
494
|
+
readonly namespace?: string;
|
|
495
|
+
}>;
|
|
474
496
|
/** The current app/element/table entity, forwarded for owner-local reference resolution. */
|
|
475
497
|
readonly streamRootEntity?: DeployableEntity;
|
|
476
498
|
/**
|
|
@@ -565,8 +587,12 @@ export type LifecycleFacet = {
|
|
|
565
587
|
readonly rebindOwnFileOwner?: (item: unknown, extractedOwnerRefName: string, authoredOwnerRefName: string) => unknown;
|
|
566
588
|
/** Print one extracted own-file instance to TypeScript source. */
|
|
567
589
|
readonly printOwnFile?: (item: unknown, opts: PrintOwnFileOptions) => PrintedOwnFile;
|
|
568
|
-
/**
|
|
569
|
-
|
|
590
|
+
/**
|
|
591
|
+
* Re-pull: preserve author-owned values that the live export cannot represent.
|
|
592
|
+
* `existingSource` is undefined when no source file exists yet; state may
|
|
593
|
+
* still hold values the fresh print must agree with.
|
|
594
|
+
*/
|
|
595
|
+
readonly mergePulledSource?: (freshSource: string, existingSource: string | undefined, context?: MergePulledSourceContext) => string;
|
|
570
596
|
/**
|
|
571
597
|
* Re-pull: true when an existing source file is earlier printer output
|
|
572
598
|
* that can never build (it carries a placeholder the printer emits for a
|
|
@@ -596,6 +622,25 @@ export interface StreamPartition {
|
|
|
596
622
|
readonly allResources: readonly TfBlock[];
|
|
597
623
|
readonly allBlocks: readonly TfBlock[];
|
|
598
624
|
}
|
|
625
|
+
/** Root-module state, by resource type and label. */
|
|
626
|
+
export interface StateAdoptionIndex {
|
|
627
|
+
/** Whether state already holds `type.label`. */
|
|
628
|
+
has(type: string, label: string): boolean;
|
|
629
|
+
/** The `id` state holds for `type.label`, if any. */
|
|
630
|
+
idOf(type: string, label: string): string | undefined;
|
|
631
|
+
}
|
|
632
|
+
/** One import an entity asks plan/apply to add. */
|
|
633
|
+
export interface StateAdoptionImport {
|
|
634
|
+
readonly type: string;
|
|
635
|
+
readonly label: string;
|
|
636
|
+
readonly id: string;
|
|
637
|
+
}
|
|
638
|
+
export interface StateAdoptionFacet {
|
|
639
|
+
/** Imports for built blocks that have no state but exist live. */
|
|
640
|
+
readonly importsFor: (blocks: readonly TfBlock[], state: StateAdoptionIndex) => readonly StateAdoptionImport[];
|
|
641
|
+
/** The user-facing warning for this kind's imports (printed once per distinct set). */
|
|
642
|
+
readonly warning: (imports: readonly StateAdoptionImport[]) => string;
|
|
643
|
+
}
|
|
599
644
|
export interface EntityKindModule {
|
|
600
645
|
readonly kind: KindId;
|
|
601
646
|
/** Export participation. */
|
|
@@ -618,6 +663,12 @@ export interface EntityKindModule {
|
|
|
618
663
|
readonly buildChecks?: {
|
|
619
664
|
readonly validateBuiltBlocks: (blocks: readonly TfBlock[]) => readonly string[];
|
|
620
665
|
};
|
|
666
|
+
/**
|
|
667
|
+
* Plan/apply: resources build emits that may already exist live without
|
|
668
|
+
* state (e.g. a workspace pulled before the kind was managed). Each returned
|
|
669
|
+
* import is written to `.tf/out` so the plan imports instead of creating.
|
|
670
|
+
*/
|
|
671
|
+
readonly stateAdoption?: StateAdoptionFacet;
|
|
621
672
|
/** Entity-specific equivalences used only by live build-vs-export comparison. */
|
|
622
673
|
readonly roundtrip?: {
|
|
623
674
|
readonly referenceAliases: readonly {
|
|
@@ -717,6 +768,19 @@ export interface EntityKindModule {
|
|
|
717
768
|
readonly localPrefix: string;
|
|
718
769
|
readonly listField?: string;
|
|
719
770
|
}[];
|
|
771
|
+
/**
|
|
772
|
+
* Field-assignment lists (`<attribute>[i].<fieldAttribute>` set to
|
|
773
|
+
* `<attribute>[i].<valueAttribute>`) where the provider treats a static
|
|
774
|
+
* Dropdown option's label and its option id as the same value. The
|
|
775
|
+
* platform stores either one; the build always writes the option-id
|
|
776
|
+
* lookup `local.<field>_options_by_label["<label>"]`.
|
|
777
|
+
*/
|
|
778
|
+
readonly picklistLabelAssignments?: readonly {
|
|
779
|
+
readonly resourceType: string;
|
|
780
|
+
readonly attribute: string;
|
|
781
|
+
readonly fieldAttribute: string;
|
|
782
|
+
readonly valueAttribute: string;
|
|
783
|
+
}[];
|
|
720
784
|
};
|
|
721
785
|
}
|
|
722
786
|
export declare function implementedResourceTypes(resource: ResourceFacet): readonly string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementumai/edk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
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",
|
|
@@ -191,23 +191,11 @@
|
|
|
191
191
|
"pack:consumer": "npm run build:sdk && tsx src/scripts/test-package-consumer.ts",
|
|
192
192
|
"release:local-sdk": "bash release/verify-local-sdk-prepare.sh",
|
|
193
193
|
"release:notes": "tsx src/scripts/release-notes.ts",
|
|
194
|
-
"test": "tsx src/scripts/test.ts",
|
|
195
|
-
"test:unit": "vitest run",
|
|
196
|
-
"test:runtime": "vitest run",
|
|
197
194
|
"check:parity": "tsx src/scripts/check-provider-parity.ts",
|
|
198
|
-
"pretest:provider": "npm run generate:graphql",
|
|
199
|
-
"test:provider": "go -C provider test -timeout=120s -parallel=10 ./internal/...",
|
|
200
|
-
"pretest:provider:cover": "npm run generate:graphql",
|
|
201
|
-
"test:provider:cover": "go -C provider test -v -cover -timeout=120s -parallel=10 ./internal/...",
|
|
202
|
-
"pretest:bridge": "npm run generate:graphql",
|
|
203
|
-
"test:bridge": "go -C cmd/elementum test -v -timeout=30s ./...",
|
|
204
|
-
"test:backend-lock": "vitest run __tests__/integration/http-backend-lock.test.ts __tests__/integration/http-state-backend.test.ts",
|
|
205
|
-
"test:go": "npm run test:provider && npm run test:bridge",
|
|
206
195
|
"test:distribution": "npm --prefix distribution test",
|
|
207
|
-
"test:watch": "vitest",
|
|
208
|
-
"test:cli": "vitest run __tests__/cli",
|
|
209
196
|
"test:binary": "npm run build:sdk && npm run build:binary:bun && npm run smoke:binary:bun",
|
|
210
197
|
"test:integration": "node integration/run.mjs",
|
|
198
|
+
"preston:gate": "bash integration/tools/preston-gate-commit.sh",
|
|
211
199
|
"reap:orphans": "node integration/tools/reap-orphaned-test-entities.mjs",
|
|
212
200
|
"typecheck": "npm run typecheck:ci",
|
|
213
201
|
"pretypecheck:ci": "npm run generate:ragnarok",
|
|
@@ -222,8 +210,6 @@
|
|
|
222
210
|
"typecheck:examples": "tsc --noEmit -p tsconfig.examples-check.json",
|
|
223
211
|
"pretypecheck:consumer": "npm run generate:ragnarok",
|
|
224
212
|
"typecheck:consumer": "tsc --noEmit -p tsconfig.package-consumer-check.json",
|
|
225
|
-
"pretypecheck:tests": "npm run generate:ragnarok",
|
|
226
|
-
"typecheck:tests": "tsc --noEmit -p tsconfig.typecheck-tests.json",
|
|
227
213
|
"lint": "eslint src/cli src/internal/sdk-package.ts src/scripts/prepare-release-promotion.ts src/scripts/test-package-consumer.ts examples/package-consumer",
|
|
228
214
|
"lint:all": "eslint .",
|
|
229
215
|
"lint:generated": "eslint generated/",
|
|
@@ -255,7 +241,6 @@
|
|
|
255
241
|
"tsx": "^4.21.0",
|
|
256
242
|
"typescript": "^6.0.2",
|
|
257
243
|
"typescript-eslint": "^8.59.1",
|
|
258
|
-
"vitest": "^4.1.1",
|
|
259
244
|
"yaml": "^2.9.0"
|
|
260
245
|
},
|
|
261
246
|
"allowScripts": {
|