@elementumai/edk 0.10.4 → 0.12.0
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 +49 -13
- package/dist-sdk/src/catalog/token.js +2 -1
- package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -0
- package/dist-sdk/src/core/triggers/on-demand.js +3 -0
- package/dist-sdk/src/core/wire/ref-serializer.js +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +4 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +7 -0
- package/dist-sdk/src/engine/coverage-gaps.js +12 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.d.ts +43 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.js +234 -0
- package/dist-sdk/src/engine/ei/run.d.ts +42 -1
- package/dist-sdk/src/engine/ei/run.js +201 -32
- package/dist-sdk/src/engine/ei/saved-plan.d.ts +16 -0
- package/dist-sdk/src/engine/ei/saved-plan.js +19 -0
- package/dist-sdk/src/engine/ei/state.d.ts +1 -1
- package/dist-sdk/src/engine/ei/state.js +17 -4
- package/dist-sdk/src/engine/progress.d.ts +3 -1
- package/dist-sdk/src/engine/progress.js +7 -3
- package/dist-sdk/src/engine/pull/authored-address.d.ts +15 -1
- package/dist-sdk/src/engine/pull/authored-address.js +180 -29
- package/dist-sdk/src/engine/pull/context.d.ts +37 -2
- package/dist-sdk/src/engine/pull/context.js +7 -4
- package/dist-sdk/src/engine/pull/ref-only.d.ts +18 -0
- package/dist-sdk/src/engine/pull/ref-only.js +52 -0
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -0
- package/dist-sdk/src/engine/tf/labels.js +50 -0
- package/dist-sdk/src/engine/tf/model.d.ts +2 -0
- package/dist-sdk/src/engine/tf/model.js +26 -0
- package/dist-sdk/src/engine/validation.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +18 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +58 -24
- package/dist-sdk/src/entities/access-policy/member-list.d.ts +32 -0
- package/dist-sdk/src/entities/access-policy/member-list.js +57 -0
- package/dist-sdk/src/entities/access-policy/module.js +10 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +4 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +21 -12
- package/dist-sdk/src/entities/agent/build.js +7 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -0
- package/dist-sdk/src/entities/agent/from-tf.js +13 -3
- package/dist-sdk/src/entities/agent/to-tf.js +11 -5
- package/dist-sdk/src/entities/agent/tools.d.ts +8 -0
- package/dist-sdk/src/entities/agent/tools.js +6 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +29 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +56 -3
- package/dist-sdk/src/entities/agent-tool/types.d.ts +12 -8
- package/dist-sdk/src/entities/agent-tool/types.js +13 -9
- package/dist-sdk/src/entities/app/build.d.ts +12 -1
- package/dist-sdk/src/entities/app/build.js +80 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -7
- package/dist-sdk/src/entities/app/from-tf.js +17 -12
- package/dist-sdk/src/entities/app/stage-keys.d.ts +18 -3
- package/dist-sdk/src/entities/app/stage-keys.js +40 -6
- package/dist-sdk/src/entities/app/to-tf.js +7 -4
- package/dist-sdk/src/entities/automation/build.d.ts +52 -31
- package/dist-sdk/src/entities/automation/build.js +59 -20
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +7 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +39 -14
- package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -2
- package/dist-sdk/src/entities/automation/from-tf.js +721 -93
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +22 -2
- package/dist-sdk/src/entities/automation/module.js +244 -57
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +22 -2
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +54 -3
- package/dist-sdk/src/entities/automation/run-target.d.ts +61 -0
- package/dist-sdk/src/entities/automation/run-target.js +104 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +11 -1
- package/dist-sdk/src/entities/automation/script-code.js +106 -4
- package/dist-sdk/src/entities/automation/script-lint.d.ts +13 -0
- package/dist-sdk/src/entities/automation/script-lint.js +418 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -1
- package/dist-sdk/src/entities/automation/task-output-labels.js +58 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +67 -22
- package/dist-sdk/src/entities/automation/tasks.js +18 -4
- package/dist-sdk/src/entities/automation/to-tf.d.ts +1 -3
- package/dist-sdk/src/entities/automation/to-tf.js +354 -64
- package/dist-sdk/src/entities/automation/triggers.d.ts +63 -11
- package/dist-sdk/src/entities/automation/triggers.js +45 -5
- package/dist-sdk/src/entities/automation/types.d.ts +21 -0
- package/dist-sdk/src/entities/automation/types.js +26 -0
- package/dist-sdk/src/entities/chart/build.d.ts +9 -1
- package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
- package/dist-sdk/src/entities/chart/from-tf.js +25 -1
- package/dist-sdk/src/entities/chart/index.d.ts +1 -1
- package/dist-sdk/src/entities/chart/printer.js +5 -2
- package/dist-sdk/src/entities/chart/to-tf.js +19 -1
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +57 -7
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +8 -2
- package/dist-sdk/src/entities/dynamic-layout/condition-keys.d.ts +48 -0
- package/dist-sdk/src/entities/dynamic-layout/condition-keys.js +261 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +66 -20
- package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +341 -32
- package/dist-sdk/src/entities/element/build.d.ts +10 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +14 -9
- package/dist-sdk/src/entities/element/to-tf.js +7 -4
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +79 -1
- package/dist-sdk/src/entities/field/module.js +14 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +38 -3
- package/dist-sdk/src/entities/field/to-tf.js +108 -34
- package/dist-sdk/src/entities/file-reader/module.js +3 -3
- package/dist-sdk/src/entities/file-reader/to-tf.js +3 -3
- package/dist-sdk/src/entities/file-reader/types.d.ts +4 -16
- package/dist-sdk/src/entities/file-reader/types.js +7 -0
- package/dist-sdk/src/entities/org/group.d.ts +1 -0
- package/dist-sdk/src/entities/org/group.js +2 -1
- package/dist-sdk/src/entities/org/role.js +5 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +10 -2
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +14 -2
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +88 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +79 -8
- package/dist-sdk/src/entities/role/from-tf.js +24 -7
- package/dist-sdk/src/entities/role/to-tf.js +25 -7
- package/dist-sdk/src/entities/service-account/from-tf.js +2 -1
- package/dist-sdk/src/entities/service-account/module.js +20 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +5 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.js +21 -13
- package/dist-sdk/src/entities/service-account/to-tf.js +12 -4
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +12 -7
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -3
- package/dist-sdk/src/entities/shared/types/field-types.js +3 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +8 -1
- package/dist-sdk/src/entities/skill/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill/module.js +18 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +8 -1
- package/dist-sdk/src/entities/skill/to-tf.js +23 -14
- package/dist-sdk/src/entities/skill/tools.d.ts +8 -0
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -2
- package/dist-sdk/src/entities/task/to-tf.js +1 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +8 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +20 -10
- package/dist-sdk/src/entities/view/from-tf.d.ts +68 -4
- package/dist-sdk/src/entities/view/from-tf.js +394 -22
- package/dist-sdk/src/entities/view/module.js +20 -0
- package/dist-sdk/src/entities/view/portable.d.ts +11 -0
- package/dist-sdk/src/entities/view/portable.js +47 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/view/to-tf.js +25 -7
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +4 -3
- package/dist-sdk/src/entities/widget/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/widget/from-tf.js +100 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +16 -1
- package/dist-sdk/src/entities/widget/to-tf.js +77 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +30 -9
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/field-resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/field-resource-types.js +11 -0
- package/dist-sdk/src/graph/index.d.ts +41 -3
- package/dist-sdk/src/graph/index.js +24 -2
- package/dist-sdk/src/graph/types.d.ts +195 -5
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentRef, AppOrElementRef, AutomationRef, FieldRef, WidgetRef } from "../../catalog/index.js";
|
|
2
|
+
import type { UnsafePlatformId } from "../../core/platform-id.js";
|
|
2
3
|
import type { AppViewFieldRef } from "../app/build.js";
|
|
3
4
|
import type { Filter } from "../shared/filters/types.js";
|
|
4
5
|
export type DynamicLayoutTypedValue = {
|
|
@@ -305,8 +306,12 @@ export interface AppDynamicLayout {
|
|
|
305
306
|
readonly name: string;
|
|
306
307
|
readonly description?: string;
|
|
307
308
|
readonly active?: boolean;
|
|
308
|
-
/**
|
|
309
|
-
|
|
309
|
+
/**
|
|
310
|
+
* Stage handle. Pull uses `unsafePlatformId(...)` when export could not
|
|
311
|
+
* resolve the stage, so the layout is not replaced. Omit for the app-level
|
|
312
|
+
* default DASHBOARD layout.
|
|
313
|
+
*/
|
|
314
|
+
readonly stage?: string | UnsafePlatformId;
|
|
310
315
|
readonly documentId: string;
|
|
311
316
|
readonly documentVersion?: string;
|
|
312
317
|
readonly rootComponent: string;
|
|
@@ -320,6 +325,7 @@ export interface AppDynamicLayout {
|
|
|
320
325
|
readonly updatedAt?: string;
|
|
321
326
|
readonly createdBy?: string;
|
|
322
327
|
readonly description?: string;
|
|
328
|
+
readonly explicitUpdateBlock?: boolean;
|
|
323
329
|
};
|
|
324
330
|
}
|
|
325
331
|
/** Element-owned DASHBOARD layout. Elements have no stages, so it is always the element's default layout. */
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Restore a dynamic layout's authored condition keys on a re-pull (#2414).
|
|
3
|
+
*
|
|
4
|
+
* The platform stores a layout's conditions without their keys, so the export
|
|
5
|
+
* names them `condition_0001`, `condition_0002`, … in document order. State
|
|
6
|
+
* still holds the authored keys (`hasValidationMessage`), and every reference
|
|
7
|
+
* to them — a component's `show_when`, `hide_when`, `enable_when`,
|
|
8
|
+
* `disable_when` and `require_when`, a condition's `all`, `any` and `not`, a
|
|
9
|
+
* dependency's `condition` — would then differ from state, so adoption plans
|
|
10
|
+
* an update.
|
|
11
|
+
*
|
|
12
|
+
* Same pairing the provider applies on its own reads
|
|
13
|
+
* (`preserveDynamicLayoutConditionIDs`): by position from each component and
|
|
14
|
+
* dependency both sides share, following `all`/`any`/`not` children, and only
|
|
15
|
+
* when the two conditions have the same content; then any condition left
|
|
16
|
+
* whose content is unique in state. Several exported conditions can pair with
|
|
17
|
+
* one state key: the platform returns a condition referenced from several
|
|
18
|
+
* places (`all`, `not`, a component) as separate copies, and the rename
|
|
19
|
+
* collapses them back into the one authored condition, as the provider's read
|
|
20
|
+
* does. Content is compared with every referenced
|
|
21
|
+
* condition replaced by its own content, and every reference in the export
|
|
22
|
+
* (`elementum_text_field.x.id`, `data.elementum_role.y.id`, a stage's
|
|
23
|
+
* `local.<app>_stage_ids_by_key["<key>"]`, an option's
|
|
24
|
+
* `local.<field>_options_by_label["<label>"]`) replaced by the value state
|
|
25
|
+
* holds for it. A condition that cannot be compared keeps its exported key.
|
|
26
|
+
*
|
|
27
|
+
* Registered as the dynamic layout's `alignWithState` (module.ts), which
|
|
28
|
+
* `alignExportWithState` runs on a re-pull.
|
|
29
|
+
*/
|
|
30
|
+
import type { StateAlignment } from "../../graph/index.js";
|
|
31
|
+
type Plain = null | string | number | boolean | Plain[] | {
|
|
32
|
+
[key: string]: Plain;
|
|
33
|
+
};
|
|
34
|
+
interface LayoutSide {
|
|
35
|
+
readonly conditions: Readonly<Record<string, unknown>>;
|
|
36
|
+
readonly components: Readonly<Record<string, unknown>>;
|
|
37
|
+
readonly dependencies: readonly unknown[];
|
|
38
|
+
/** Plain value of a field reference on this side, or undefined when it cannot be resolved. */
|
|
39
|
+
readonly plain: (value: unknown) => Plain | undefined;
|
|
40
|
+
}
|
|
41
|
+
/** Export condition key → state condition key, the provider's `preserveDynamicLayoutConditionIDs` pairing. */
|
|
42
|
+
export declare function pairLayoutConditions(exported: LayoutSide, state: LayoutSide): Map<string, string>;
|
|
43
|
+
/**
|
|
44
|
+
* The exported layout's attributes with its condition keys restored from the
|
|
45
|
+
* layout's state attributes, or the same object when nothing pairs.
|
|
46
|
+
*/
|
|
47
|
+
export declare const restoreLayoutConditionKeys: StateAlignment;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { isTfExpr } from "../../engine/tf/model.js";
|
|
2
|
+
const COMPONENT_REFERENCE_LISTS = ["show_when", "hide_when", "enable_when", "disable_when", "require_when"];
|
|
3
|
+
const GROUP_KINDS = ["all", "any"];
|
|
4
|
+
function asMap(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && !isTfExpr(value)
|
|
6
|
+
? value
|
|
7
|
+
: undefined;
|
|
8
|
+
}
|
|
9
|
+
function stringList(value) {
|
|
10
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Plain data with nulls dropped and keys sorted, or undefined when a value
|
|
14
|
+
* cannot be resolved. Null and missing are the same value: state lists every
|
|
15
|
+
* optional attribute, the export only the ones it sets.
|
|
16
|
+
*/
|
|
17
|
+
function plainValue(value, resolve) {
|
|
18
|
+
if (value === undefined || value === null)
|
|
19
|
+
return null;
|
|
20
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
|
|
21
|
+
return value;
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
const items = value.map((item) => plainValue(item, resolve));
|
|
24
|
+
return items.some((item) => item === undefined) ? undefined : items;
|
|
25
|
+
}
|
|
26
|
+
if (typeof value !== "object")
|
|
27
|
+
return undefined;
|
|
28
|
+
if (isTfExpr(value)) {
|
|
29
|
+
const resolved = resolve === undefined ? undefined : resolve(value);
|
|
30
|
+
return resolved === undefined ? undefined : plainValue(resolved, undefined);
|
|
31
|
+
}
|
|
32
|
+
const out = {};
|
|
33
|
+
for (const key of Object.keys(value).sort()) {
|
|
34
|
+
const child = plainValue(value[key], resolve);
|
|
35
|
+
if (child === undefined)
|
|
36
|
+
return undefined;
|
|
37
|
+
if (child !== null)
|
|
38
|
+
out[key] = child;
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
/** {@link conditionFingerprint} in the provider: the condition's content with every referenced condition replaced by its fingerprint. */
|
|
43
|
+
function fingerprint(side, id, visiting = new Set()) {
|
|
44
|
+
if (visiting.has(id))
|
|
45
|
+
return undefined;
|
|
46
|
+
const condition = side.conditions[id];
|
|
47
|
+
if (condition === undefined)
|
|
48
|
+
return undefined;
|
|
49
|
+
const normalized = side.plain(condition);
|
|
50
|
+
if (normalized === undefined || normalized === null || typeof normalized !== "object" || Array.isArray(normalized))
|
|
51
|
+
return undefined;
|
|
52
|
+
visiting.add(id);
|
|
53
|
+
try {
|
|
54
|
+
const next = { ...normalized };
|
|
55
|
+
for (const kind of GROUP_KINDS) {
|
|
56
|
+
const group = asMap(next[kind]);
|
|
57
|
+
if (group === undefined)
|
|
58
|
+
continue;
|
|
59
|
+
const refs = Array.isArray(group["conditions"]) ? group["conditions"] : [];
|
|
60
|
+
const children = [];
|
|
61
|
+
for (const ref of refs) {
|
|
62
|
+
const child = typeof ref === "string" ? fingerprint(side, ref, visiting) : undefined;
|
|
63
|
+
if (child === undefined)
|
|
64
|
+
return undefined;
|
|
65
|
+
children.push(child);
|
|
66
|
+
}
|
|
67
|
+
next[kind] = { ...group, conditions: children };
|
|
68
|
+
}
|
|
69
|
+
const negation = asMap(next["not"]);
|
|
70
|
+
if (negation !== undefined) {
|
|
71
|
+
const child = typeof negation["condition"] === "string" ? fingerprint(side, negation["condition"], visiting) : undefined;
|
|
72
|
+
if (child === undefined)
|
|
73
|
+
return undefined;
|
|
74
|
+
next["not"] = { ...negation, condition: child };
|
|
75
|
+
}
|
|
76
|
+
return JSON.stringify(next);
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
visiting.delete(id);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Export condition key → state condition key, the provider's `preserveDynamicLayoutConditionIDs` pairing. */
|
|
83
|
+
export function pairLayoutConditions(exported, state) {
|
|
84
|
+
const renames = new Map();
|
|
85
|
+
const pair = (exportedId, stateId) => {
|
|
86
|
+
if (renames.has(exportedId))
|
|
87
|
+
return;
|
|
88
|
+
const left = fingerprint(exported, exportedId);
|
|
89
|
+
if (left === undefined || left !== fingerprint(state, stateId))
|
|
90
|
+
return;
|
|
91
|
+
renames.set(exportedId, stateId);
|
|
92
|
+
const exportedCondition = asMap(exported.conditions[exportedId]) ?? {};
|
|
93
|
+
const stateCondition = asMap(state.conditions[stateId]) ?? {};
|
|
94
|
+
for (const kind of GROUP_KINDS) {
|
|
95
|
+
const exportedGroup = asMap(exportedCondition[kind]);
|
|
96
|
+
const stateGroup = asMap(stateCondition[kind]);
|
|
97
|
+
if (exportedGroup !== undefined && stateGroup !== undefined)
|
|
98
|
+
pairLists(stringList(exportedGroup["conditions"]), stringList(stateGroup["conditions"]));
|
|
99
|
+
}
|
|
100
|
+
const exportedNot = asMap(exportedCondition["not"])?.["condition"];
|
|
101
|
+
const stateNot = asMap(stateCondition["not"])?.["condition"];
|
|
102
|
+
if (typeof exportedNot === "string" && typeof stateNot === "string")
|
|
103
|
+
pair(exportedNot, stateNot);
|
|
104
|
+
};
|
|
105
|
+
const pairLists = (exportedRefs, stateRefs) => {
|
|
106
|
+
for (let i = 0; i < exportedRefs.length && i < stateRefs.length; i++)
|
|
107
|
+
pair(exportedRefs[i], stateRefs[i]);
|
|
108
|
+
};
|
|
109
|
+
for (const componentId of Object.keys(exported.components).sort()) {
|
|
110
|
+
const exportedComponent = asMap(exported.components[componentId]);
|
|
111
|
+
const stateComponent = asMap(state.components[componentId]);
|
|
112
|
+
if (exportedComponent === undefined || stateComponent === undefined)
|
|
113
|
+
continue;
|
|
114
|
+
for (const list of COMPONENT_REFERENCE_LISTS)
|
|
115
|
+
pairLists(stringList(exportedComponent[list]), stringList(stateComponent[list]));
|
|
116
|
+
}
|
|
117
|
+
for (let i = 0; i < exported.dependencies.length && i < state.dependencies.length; i++) {
|
|
118
|
+
const exportedDependency = asMap(exported.dependencies[i]);
|
|
119
|
+
const stateDependency = asMap(state.dependencies[i]);
|
|
120
|
+
if (exportedDependency === undefined || stateDependency === undefined)
|
|
121
|
+
continue;
|
|
122
|
+
const same = ["source_field_id", "target_field_id", "type"].every((key) => {
|
|
123
|
+
const left = exported.plain(exportedDependency[key]);
|
|
124
|
+
return left !== undefined && JSON.stringify(left) === JSON.stringify(state.plain(stateDependency[key]));
|
|
125
|
+
});
|
|
126
|
+
const exportedRef = exportedDependency["condition"];
|
|
127
|
+
const stateRef = stateDependency["condition"];
|
|
128
|
+
if (same && typeof exportedRef === "string" && typeof stateRef === "string")
|
|
129
|
+
pair(exportedRef, stateRef);
|
|
130
|
+
}
|
|
131
|
+
// Every valid condition is reachable from a component or dependency; this
|
|
132
|
+
// covers a remotely reordered graph. Only a fingerprint unique in state
|
|
133
|
+
// qualifies, so two authored conditions with equal content are never merged.
|
|
134
|
+
const stateByFingerprint = new Map();
|
|
135
|
+
for (const id of Object.keys(state.conditions).sort()) {
|
|
136
|
+
const print = fingerprint(state, id);
|
|
137
|
+
if (print !== undefined)
|
|
138
|
+
stateByFingerprint.set(print, [...(stateByFingerprint.get(print) ?? []), id]);
|
|
139
|
+
}
|
|
140
|
+
for (const id of Object.keys(exported.conditions).sort()) {
|
|
141
|
+
if (renames.has(id))
|
|
142
|
+
continue;
|
|
143
|
+
const print = fingerprint(exported, id);
|
|
144
|
+
const candidates = print === undefined ? undefined : stateByFingerprint.get(print);
|
|
145
|
+
if (candidates?.length === 1)
|
|
146
|
+
pair(id, candidates[0]);
|
|
147
|
+
}
|
|
148
|
+
// A rename onto a key the export keeps for another condition would merge
|
|
149
|
+
// the two. Dropping one rename can leave the key it vacated in use, which
|
|
150
|
+
// invalidates a rename onto that key in turn, so repeat until none drops.
|
|
151
|
+
for (let dropped = true; dropped;) {
|
|
152
|
+
dropped = false;
|
|
153
|
+
for (const [from, to] of [...renames]) {
|
|
154
|
+
if (from !== to && to in exported.conditions && !renames.has(to)) {
|
|
155
|
+
renames.delete(from);
|
|
156
|
+
dropped = true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return renames;
|
|
161
|
+
}
|
|
162
|
+
function renameRef(value, renames) {
|
|
163
|
+
return typeof value === "string" ? (renames.get(value) ?? value) : value;
|
|
164
|
+
}
|
|
165
|
+
function renameList(value, renames) {
|
|
166
|
+
return Array.isArray(value) ? value.map((item) => renameRef(item, renames)) : value;
|
|
167
|
+
}
|
|
168
|
+
function withAttribute(map, key, value) {
|
|
169
|
+
return value === undefined ? map : { ...map, [key]: value };
|
|
170
|
+
}
|
|
171
|
+
/** JSON with object keys sorted, so two equal bodies print the same. */
|
|
172
|
+
function stableJson(value) {
|
|
173
|
+
if (Array.isArray(value))
|
|
174
|
+
return `[${value.map(stableJson).join(",")}]`;
|
|
175
|
+
if (typeof value === "object" && value !== null) {
|
|
176
|
+
const object = value;
|
|
177
|
+
return `{${Object.keys(object).sort().map((key) => `${JSON.stringify(key)}:${stableJson(object[key])}`).join(",")}}`;
|
|
178
|
+
}
|
|
179
|
+
return JSON.stringify(value) ?? "null";
|
|
180
|
+
}
|
|
181
|
+
/** The renamed conditions; copies of one authored condition collapse onto its key, anything else on one key is a bug. */
|
|
182
|
+
function collapseConditions(address, entries) {
|
|
183
|
+
const out = {};
|
|
184
|
+
const from = new Map();
|
|
185
|
+
for (const [exportedId, key, body] of entries) {
|
|
186
|
+
const earlier = from.get(key);
|
|
187
|
+
if (earlier !== undefined && stableJson(out[key]) !== stableJson(body)) {
|
|
188
|
+
throw new Error(`${address}: restoring authored condition keys from state would merge exported conditions "${earlier}" and "${exportedId}", ` +
|
|
189
|
+
`which differ, into "${key}". This is an EDK bug (edk#2414); please report it with the layout's state and export.`);
|
|
190
|
+
}
|
|
191
|
+
if (earlier === undefined)
|
|
192
|
+
from.set(key, exportedId);
|
|
193
|
+
out[key] = body;
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
/** The layout's attributes with every renamed condition key and reference rewritten. */
|
|
198
|
+
function renameConditions(address, attrs, renames) {
|
|
199
|
+
const next = { ...attrs };
|
|
200
|
+
const conditions = asMap(attrs["conditions"]);
|
|
201
|
+
if (conditions !== undefined) {
|
|
202
|
+
next["conditions"] = collapseConditions(address, Object.entries(conditions).map(([id, condition]) => {
|
|
203
|
+
let body = (asMap(condition) ?? {});
|
|
204
|
+
for (const kind of GROUP_KINDS) {
|
|
205
|
+
const group = asMap(body[kind]);
|
|
206
|
+
if (group !== undefined)
|
|
207
|
+
body = { ...body, [kind]: withAttribute(group, "conditions", renameList(group["conditions"], renames)) };
|
|
208
|
+
}
|
|
209
|
+
const negation = asMap(body["not"]);
|
|
210
|
+
if (negation !== undefined)
|
|
211
|
+
body = { ...body, not: withAttribute(negation, "condition", renameRef(negation["condition"], renames)) };
|
|
212
|
+
return [id, renames.get(id) ?? id, asMap(condition) === undefined ? condition : body];
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
const components = asMap(attrs["components"]);
|
|
216
|
+
if (components !== undefined) {
|
|
217
|
+
next["components"] = Object.fromEntries(Object.entries(components).map(([id, component]) => {
|
|
218
|
+
const body = asMap(component);
|
|
219
|
+
if (body === undefined)
|
|
220
|
+
return [id, component];
|
|
221
|
+
let renamed = body;
|
|
222
|
+
for (const list of COMPONENT_REFERENCE_LISTS)
|
|
223
|
+
renamed = withAttribute(renamed, list, renameList(body[list], renames));
|
|
224
|
+
return [id, renamed];
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
if (Array.isArray(attrs["dependencies"])) {
|
|
228
|
+
next["dependencies"] = attrs["dependencies"].map((dependency) => {
|
|
229
|
+
const body = asMap(dependency);
|
|
230
|
+
return body === undefined ? dependency : withAttribute(body, "condition", renameRef(body["condition"], renames));
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return next;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The exported layout's attributes with its condition keys restored from the
|
|
237
|
+
* layout's state attributes, or the same object when nothing pairs.
|
|
238
|
+
*/
|
|
239
|
+
export const restoreLayoutConditionKeys = (attrs, stateAttributes, { address, resolve }) => {
|
|
240
|
+
const exportedConditions = asMap(attrs["conditions"]);
|
|
241
|
+
const stateConditions = asMap(stateAttributes["conditions"]);
|
|
242
|
+
if (exportedConditions === undefined || stateConditions === undefined)
|
|
243
|
+
return attrs;
|
|
244
|
+
const exported = {
|
|
245
|
+
conditions: exportedConditions,
|
|
246
|
+
components: asMap(attrs["components"]) ?? {},
|
|
247
|
+
dependencies: Array.isArray(attrs["dependencies"]) ? attrs["dependencies"] : [],
|
|
248
|
+
plain: (value) => plainValue(value, resolve),
|
|
249
|
+
};
|
|
250
|
+
const state = {
|
|
251
|
+
conditions: stateConditions,
|
|
252
|
+
components: asMap(stateAttributes["components"]) ?? {},
|
|
253
|
+
dependencies: Array.isArray(stateAttributes["dependencies"]) ? stateAttributes["dependencies"] : [],
|
|
254
|
+
plain: (value) => plainValue(value, undefined),
|
|
255
|
+
};
|
|
256
|
+
const renames = pairLayoutConditions(exported, state);
|
|
257
|
+
for (const [from, to] of [...renames])
|
|
258
|
+
if (from === to)
|
|
259
|
+
renames.delete(from);
|
|
260
|
+
return renames.size === 0 ? attrs : renameConditions(address, attrs, renames);
|
|
261
|
+
};
|
|
@@ -2,6 +2,7 @@ import { type FromTfContext } from "../../engine/pull/context.js";
|
|
|
2
2
|
import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
|
|
3
3
|
import type { NormalizedDynamicLayout } from "../app/deserializer/normalize.js";
|
|
4
4
|
import { type StageHandleIndex } from "../app/stage-keys.js";
|
|
5
|
+
import { type UnextractedFieldOwner } from "../view/from-tf.js";
|
|
5
6
|
export interface DynamicLayoutOwner {
|
|
6
7
|
readonly type: string;
|
|
7
8
|
readonly label: string;
|
|
@@ -11,6 +12,8 @@ export interface DynamicLayoutOwner {
|
|
|
11
12
|
readonly scope?: ChildResourceScope;
|
|
12
13
|
/** The owning app's stage handles, so pull never writes another stage's handle (#1136). */
|
|
13
14
|
readonly stageHandles?: StageHandleIndex;
|
|
15
|
+
/** The owner's extracted fields, so a field pull did not extract keeps its platform id (#1966). */
|
|
16
|
+
readonly unextracted?: UnextractedFieldOwner;
|
|
14
17
|
}
|
|
15
18
|
export declare function dynamicLayoutsFromTf(blocks: readonly TfBlock[], owner: DynamicLayoutOwner, ctx: FromTfContext): NormalizedDynamicLayout[];
|
|
16
19
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { unsafePlatformId } from "../../core/platform-id.js";
|
|
2
|
+
import { dataRefLabel, optionalString, plainObject, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
3
|
+
import { isTfExpr, isUuid, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
3
4
|
import { filterFromTf } from "../access-policy/from-tf.js";
|
|
4
5
|
import { fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
5
6
|
import { filterOwnerForAspect } from "../relationship/from-tf.js";
|
|
@@ -7,6 +8,7 @@ import { filterWireToTf } from "../shared/filters/tf-codec.js";
|
|
|
7
8
|
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
8
9
|
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
9
10
|
import { lostStageMessage, pulledStageHandle } from "../app/stage-keys.js";
|
|
11
|
+
import { unextractedFieldRefId } from "../view/from-tf.js";
|
|
10
12
|
import { DYNAMIC_LAYOUT_RESOURCE_TYPE } from "./module.js";
|
|
11
13
|
import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY, dynamicLayoutCompanionWidgetLabel, } from "./dialect.js";
|
|
12
14
|
const KNOWN_ATTRS = new Set([
|
|
@@ -81,18 +83,26 @@ function dynamicLayoutFromTf(block, owner, ctx) {
|
|
|
81
83
|
ctx.releaseIfManaged?.push(`${DYNAMIC_LAYOUT_RESOURCE_TYPE}.${block.label ?? ""}`);
|
|
82
84
|
return undefined;
|
|
83
85
|
}
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
+
const stageValue = block.attrs["stage_id"];
|
|
87
|
+
const rawStageId = typeof stageValue === "string" && isUuid(stageValue) ? stageValue : undefined;
|
|
88
|
+
const resolvedStageKey = stageKey(stageValue, owner, ctx, `${where}.stage_id`);
|
|
89
|
+
if (stageValue !== undefined && stageIndex(stageValue, owner) === undefined && rawStageId === undefined) {
|
|
86
90
|
ctx.diagnostics.push(`${where}: stage_id has an unrecognized shape; layout kept unscoped instead of guessing`);
|
|
87
91
|
}
|
|
92
|
+
if (rawStageId !== undefined && resolvedStageKey === undefined) {
|
|
93
|
+
ctx.diagnostics.push(`${where}: stage_id ${JSON.stringify(rawStageId)} could not be resolved to a stage handle; kept with unsafePlatformId so the layout is not replaced`);
|
|
94
|
+
}
|
|
95
|
+
const identity = layoutIdentity(block, owner, ctx, where, resolvedStageKey ?? rawStageId);
|
|
96
|
+
if (identity === undefined)
|
|
97
|
+
return undefined;
|
|
88
98
|
const layout = {
|
|
89
|
-
name:
|
|
99
|
+
name: identity.name,
|
|
90
100
|
...(typeof block.attrs["description"] === "string" && { description: block.attrs["description"] }),
|
|
91
101
|
...(typeof block.attrs["active"] === "boolean" && { active: block.attrs["active"] }),
|
|
92
|
-
...(resolvedStageKey !== undefined
|
|
93
|
-
documentId:
|
|
102
|
+
...(resolvedStageKey !== undefined ? { stage: resolvedStageKey } : rawStageId !== undefined ? { stage: unsafePlatformId(rawStageId) } : {}),
|
|
103
|
+
documentId: identity.documentId,
|
|
94
104
|
...(typeof block.attrs["document_version"] === "string" && { documentVersion: block.attrs["document_version"] }),
|
|
95
|
-
rootComponent:
|
|
105
|
+
rootComponent: identity.rootComponent,
|
|
96
106
|
components: componentMap(componentsRaw, scopedLabelToBagKey(owner.ownerTfLabel, block.label ?? "", scopeOf(owner)), owner, ctx, where),
|
|
97
107
|
};
|
|
98
108
|
const conditions = plainObject(block.attrs["conditions"]);
|
|
@@ -115,6 +125,37 @@ function dynamicLayoutFromTf(block, owner, ctx) {
|
|
|
115
125
|
layout,
|
|
116
126
|
};
|
|
117
127
|
}
|
|
128
|
+
/** The attributes the provider requires non-empty, by public key. */
|
|
129
|
+
const LAYOUT_IDENTITY_ATTRS = [["name", "name"], ["documentId", "document_id"], ["rootComponent", "root_component"]];
|
|
130
|
+
/**
|
|
131
|
+
* The layout's name, document id and root component. The provider rejects an
|
|
132
|
+
* empty name and a blank (whitespace-only) document_id or root_component, so pull fails closed naming the layout instead of writing `""`
|
|
133
|
+
* that adoption and every plan then reject (#2052). Export fills a UI-built
|
|
134
|
+
* layout's blank header from its platform id (#1220), so this only fires
|
|
135
|
+
* when that fill was lost.
|
|
136
|
+
*/
|
|
137
|
+
function layoutIdentity(block, owner, ctx, where, stage) {
|
|
138
|
+
const values = LAYOUT_IDENTITY_ATTRS.map(([, attr]) => optionalString(block.attrs, attr, where, ctx));
|
|
139
|
+
const [name, documentId, rootComponent] = values;
|
|
140
|
+
// name: exact "" only (LengthAtLeast(1) allows whitespace). document_id and
|
|
141
|
+
// root_component: the provider's Validate trims them and rejects blank at plan time.
|
|
142
|
+
const blank = [name === undefined || name === "", documentId === undefined || documentId.trim() === "", rootComponent === undefined || rootComponent.trim() === ""];
|
|
143
|
+
if (!blank.includes(true) && name !== undefined && documentId !== undefined && rootComponent !== undefined) {
|
|
144
|
+
return { name, documentId, rootComponent };
|
|
145
|
+
}
|
|
146
|
+
const missing = LAYOUT_IDENTITY_ATTRS.filter((_, index) => blank[index]).map(([, attr]) => attr);
|
|
147
|
+
const address = `${DYNAMIC_LAYOUT_RESOURCE_TYPE}.${block.label ?? ""}`;
|
|
148
|
+
const id = ctx.importId(address);
|
|
149
|
+
reportAuthoringBlocker(ctx, {
|
|
150
|
+
address,
|
|
151
|
+
description: `${where}: dynamic layout ${JSON.stringify(name ?? "")}${id === undefined ? "" : ` (import id ${id})`} on ${scopeOf(owner)} ` +
|
|
152
|
+
`${owner.ownerRefName}${stage === undefined ? "" : `, stage ${JSON.stringify(stage)}`} has no ${missing.join(", ")}. ` +
|
|
153
|
+
"The provider requires a non-empty name, document_id and root_component, so writing \"\" would make adoption and every plan fail.",
|
|
154
|
+
remedy: "Export fills a UI-built layout's blank document header from the layout's platform id. Pull again with the latest EDK; " +
|
|
155
|
+
"if it persists, report it to the EDK maintainers with this message.",
|
|
156
|
+
});
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
118
159
|
function scopeOf(owner) {
|
|
119
160
|
return owner.scope ?? "app";
|
|
120
161
|
}
|
|
@@ -127,7 +168,7 @@ function componentMap(values, layoutKey, owner, ctx, where) {
|
|
|
127
168
|
if (field === undefined)
|
|
128
169
|
continue;
|
|
129
170
|
if (field["fieldId"] !== undefined) {
|
|
130
|
-
field["field"] = fieldKey(field["fieldId"], owner, ctx, `${where}.components.${id}.${publicKey}`);
|
|
171
|
+
field["field"] = fieldKey(field["fieldId"], owner, ctx, `${where}.components.${id}.${publicKey}`, `${where}.components.${id}`);
|
|
131
172
|
delete field["fieldId"];
|
|
132
173
|
}
|
|
133
174
|
if (publicKey !== wireKey) {
|
|
@@ -137,8 +178,8 @@ function componentMap(values, layoutKey, owner, ctx, where) {
|
|
|
137
178
|
}
|
|
138
179
|
const update = plainUnknownObject(component["updateBlock"]);
|
|
139
180
|
if (update !== undefined && Array.isArray(update["fieldIds"])) {
|
|
140
|
-
update["fields"] = update["fieldIds"].flatMap((v) => {
|
|
141
|
-
const key = fieldKey(v, owner, ctx, `${where}.components.${id}.updateBlock`);
|
|
181
|
+
update["fields"] = update["fieldIds"].flatMap((v, index) => {
|
|
182
|
+
const key = fieldKey(v, owner, ctx, `${where}.components.${id}.updateBlock`, `${where}.components.${id}.update_block.field_ids[${index}]`);
|
|
142
183
|
return key === undefined ? [] : [key];
|
|
143
184
|
});
|
|
144
185
|
delete update["fieldIds"];
|
|
@@ -205,11 +246,11 @@ function componentMap(values, layoutKey, owner, ctx, where) {
|
|
|
205
246
|
const input = plainUnknownObject(raw);
|
|
206
247
|
if (input === undefined || !Array.isArray(input["fieldRefParams"]))
|
|
207
248
|
continue;
|
|
208
|
-
input["fieldRefParams"] = input["fieldRefParams"].flatMap((param) => {
|
|
249
|
+
input["fieldRefParams"] = input["fieldRefParams"].flatMap((param, paramIndex) => {
|
|
209
250
|
const entry = plainUnknownObject(param);
|
|
210
251
|
const field = entry === undefined
|
|
211
252
|
? undefined
|
|
212
|
-
: fieldKey(entry["fieldId"], owner, ctx, `${where}.components.${id}.automationButton.inputs[${index}]`);
|
|
253
|
+
: fieldKey(entry["fieldId"], owner, ctx, `${where}.components.${id}.automationButton.inputs[${index}]`, `${where}.components.${id}.automation_button.inputs[${index}].field_ref_params[${paramIndex}]`);
|
|
213
254
|
return field === undefined ? [] : [{ name: entry["name"], field }];
|
|
214
255
|
});
|
|
215
256
|
}
|
|
@@ -334,7 +375,7 @@ function conditionMap(values, owner, ctx, where) {
|
|
|
334
375
|
const comparison = plainUnknownObject(condition[key]);
|
|
335
376
|
if (comparison === undefined || comparison["fieldId"] === undefined)
|
|
336
377
|
continue;
|
|
337
|
-
comparison["field"] = fieldKey(comparison["fieldId"], owner, ctx, `${where}.conditions.${id}.${key}`);
|
|
378
|
+
comparison["field"] = fieldKey(comparison["fieldId"], owner, ctx, `${where}.conditions.${id}.${key}`, `${where}.conditions.${id}`);
|
|
338
379
|
delete comparison["fieldId"];
|
|
339
380
|
const value = plainUnknownObject(comparison["value"]);
|
|
340
381
|
const stringValue = value?.["string"];
|
|
@@ -361,14 +402,14 @@ function saveGroupMap(values, owner, ctx, where) {
|
|
|
361
402
|
for (const [id, raw] of Object.entries(values)) {
|
|
362
403
|
const group = camelObject(plainObject(raw) ?? {});
|
|
363
404
|
if (Array.isArray(group["fieldIds"])) {
|
|
364
|
-
group["fields"] = group["fieldIds"].flatMap((v) => {
|
|
365
|
-
const key = fieldKey(v, owner, ctx, `${where}.saveGroups.${id}`);
|
|
405
|
+
group["fields"] = group["fieldIds"].flatMap((v, index) => {
|
|
406
|
+
const key = fieldKey(v, owner, ctx, `${where}.saveGroups.${id}`, `${where}.save_groups.${id}.field_ids[${index}]`);
|
|
366
407
|
return key === undefined ? [] : [key];
|
|
367
408
|
});
|
|
368
409
|
delete group["fieldIds"];
|
|
369
410
|
}
|
|
370
411
|
if (Array.isArray(group["validations"])) {
|
|
371
|
-
group["validations"] = group["validations"].map((v, i) => fieldValidation(plainUnknownObject(v) ?? {}, owner, ctx, `${where}.
|
|
412
|
+
group["validations"] = group["validations"].map((v, i) => fieldValidation(plainUnknownObject(v) ?? {}, owner, ctx, `${where}.save_groups.${id}.validations[${i}]`));
|
|
372
413
|
}
|
|
373
414
|
out[id] = group;
|
|
374
415
|
}
|
|
@@ -391,8 +432,13 @@ function dependency(value, owner, ctx, where) {
|
|
|
391
432
|
delete out["targetFieldId"];
|
|
392
433
|
return out;
|
|
393
434
|
}
|
|
394
|
-
|
|
395
|
-
|
|
435
|
+
/** `site` names the whole entry a field with no id fails the pull for (#1978); it defaults to `where`. */
|
|
436
|
+
function fieldKey(value, owner, ctx, where, site = where) {
|
|
437
|
+
const resolved = fieldKeyFromTfValue(value, owner.ownerRefName, owner.ownerTfLabel, scopeOf(owner), ctx);
|
|
438
|
+
// A field pull did not extract keeps its platform id: its key would print
|
|
439
|
+
// as nothing and build would drop the entry (#1966). With no id the pull
|
|
440
|
+
// fails, naming the entry (#1978).
|
|
441
|
+
const key = owner.unextracted === undefined ? resolved : unextractedFieldRefId(value, resolved, owner.unextracted, ctx, site);
|
|
396
442
|
if (key === undefined) {
|
|
397
443
|
ctx.diagnostics.push(`${where}: field reference ${JSON.stringify(value)} is not resolvable; dropped`);
|
|
398
444
|
}
|
|
@@ -416,7 +462,7 @@ function lostStageRefs(block, owner, where) {
|
|
|
416
462
|
continue;
|
|
417
463
|
const pulled = pulledStageHandle(index, owner.stageHandles);
|
|
418
464
|
if (pulled.kind === "lost")
|
|
419
|
-
lost.push({ where: ref.where, index, handle: pulled.handle, owner: pulled.owner });
|
|
465
|
+
lost.push({ where: ref.where, index, handle: pulled.handle, owner: pulled.owner, ...(pulled.fallback === true && { fallback: true }) });
|
|
420
466
|
}
|
|
421
467
|
return lost;
|
|
422
468
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { restoreLayoutConditionKeys } from "./condition-keys.js";
|
|
1
2
|
import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE } from "../../graph/types.js";
|
|
2
3
|
export const DYNAMIC_LAYOUT_RESOURCE_TYPE = "elementum_dynamic_layout";
|
|
3
4
|
export const dynamicLayoutModule = {
|
|
@@ -8,7 +9,7 @@ export const dynamicLayoutModule = {
|
|
|
8
9
|
{ parent: "app", child: "dynamic-layout" },
|
|
9
10
|
{ parent: "element", child: "dynamic-layout" },
|
|
10
11
|
],
|
|
11
|
-
resource: { shape: "single", resourceType: DYNAMIC_LAYOUT_RESOURCE_TYPE, adoptable: true },
|
|
12
|
+
resource: { shape: "single", resourceType: DYNAMIC_LAYOUT_RESOURCE_TYPE, adoptable: true, alignWithState: restoreLayoutConditionKeys },
|
|
12
13
|
data: NO_DATA,
|
|
13
14
|
lifecycle: NO_LIFECYCLE,
|
|
14
15
|
canvas: NO_CANVAS,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { OrgRefLookup, WorkspaceAspect } from "../../engine/build/context.js";
|
|
2
2
|
import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
3
|
+
import { type UnsafePlatformId } from "../../core/platform-id.js";
|
|
4
|
+
import { type BuiltWidgets } from "../widget/to-tf.js";
|
|
3
5
|
export interface DynamicLayoutWire {
|
|
4
6
|
readonly name?: string;
|
|
5
7
|
readonly description?: string;
|
|
6
8
|
readonly active?: boolean;
|
|
7
|
-
readonly stage?: string;
|
|
9
|
+
readonly stage?: string | UnsafePlatformId;
|
|
8
10
|
readonly documentId?: string;
|
|
9
11
|
readonly documentVersion?: string;
|
|
10
12
|
readonly rootComponent?: string;
|
|
@@ -27,7 +29,7 @@ export interface DynamicLayoutToTfOptions {
|
|
|
27
29
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
28
30
|
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
29
31
|
/** Widget keys the owner declares, for buttons that run through an authored widget. */
|
|
30
|
-
readonly
|
|
32
|
+
readonly widgets?: BuiltWidgets;
|
|
31
33
|
/** Stage handle tfLabel → real `stage_ids_by_key` key, when they differ (#1136). */
|
|
32
34
|
readonly stageKeyByTfLabel?: ReadonlyMap<string, string>;
|
|
33
35
|
}
|