@elementumai/edk 0.9.19 → 0.10.1
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 +159 -7
- package/dist-sdk/src/catalog/factories.d.ts +33 -2
- package/dist-sdk/src/catalog/factories.js +40 -1
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +11 -0
- package/dist-sdk/src/catalog/types.d.ts +40 -1
- package/dist-sdk/src/catalog/types.js +12 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +40 -4
- package/dist-sdk/src/core/triggers/on-demand.js +17 -2
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
- package/dist-sdk/src/engine/coverage-gaps.js +156 -0
- package/dist-sdk/src/engine/ei/run.d.ts +169 -0
- package/dist-sdk/src/engine/ei/run.js +1219 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
- package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
- package/dist-sdk/src/engine/pull/context.d.ts +68 -6
- package/dist-sdk/src/engine/pull/context.js +40 -1
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +10 -7
- package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
- package/dist-sdk/src/engine/pull/result-output.js +113 -3
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +28 -5
- package/dist-sdk/src/engine/tf/labels.js +54 -3
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.js +93 -4
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +44 -0
- package/dist-sdk/src/engine/validation.js +95 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
- package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +5 -2
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +46 -21
- package/dist-sdk/src/entities/agent/from-tf.js +11 -3
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.js +20 -6
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +18 -6
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
- package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
- package/dist-sdk/src/entities/app/auto-share.js +49 -0
- package/dist-sdk/src/entities/app/build.d.ts +105 -22
- package/dist-sdk/src/entities/app/build.js +107 -10
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -2
- package/dist-sdk/src/entities/app/index.d.ts +7 -6
- package/dist-sdk/src/entities/app/index.js +2 -8
- package/dist-sdk/src/entities/app/module.js +5 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +40 -13
- package/dist-sdk/src/entities/automation/build.d.ts +56 -6
- package/dist-sdk/src/entities/automation/build.js +230 -26
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +41 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +470 -58
- package/dist-sdk/src/entities/automation/from-tf.d.ts +37 -8
- package/dist-sdk/src/entities/automation/from-tf.js +791 -131
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +107 -15
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +20 -0
- package/dist-sdk/src/entities/automation/script-code.js +109 -5
- package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +39 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +85 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +116 -22
- package/dist-sdk/src/entities/automation/tasks.js +86 -24
- package/dist-sdk/src/entities/automation/to-tf.d.ts +24 -3
- package/dist-sdk/src/entities/automation/to-tf.js +1082 -132
- package/dist-sdk/src/entities/automation/triggers.d.ts +12 -6
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.d.ts +9 -0
- package/dist-sdk/src/entities/automation/types.js +19 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/chart/to-tf.js +10 -3
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
- package/dist-sdk/src/entities/element/build.d.ts +28 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/element/from-tf.js +62 -1
- package/dist-sdk/src/entities/element/index.d.ts +5 -3
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +9 -3
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +16 -16
- package/dist-sdk/src/entities/field/build.d.ts +17 -3
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -4
- package/dist-sdk/src/entities/field/from-tf.js +244 -49
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +2 -0
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +26 -5
- package/dist-sdk/src/entities/field/to-tf.js +137 -15
- package/dist-sdk/src/entities/field/types.d.ts +2 -0
- package/dist-sdk/src/entities/field/types.js +27 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
- package/dist-sdk/src/entities/role/from-tf.js +3 -3
- package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/role/to-tf.js +12 -4
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +20 -8
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +23 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +19 -4
- package/dist-sdk/src/entities/shared/filters/print.js +24 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +46 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +15 -2
- package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
- package/dist-sdk/src/entities/shared/ref.js +5 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +20 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +8 -0
- package/dist-sdk/src/entities/skill/access-policy.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +14 -6
- package/dist-sdk/src/entities/skill/from-tf.js +70 -15
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.js +14 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +49 -10
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -8
- package/dist-sdk/src/entities/skill-tool/to-tf.js +49 -14
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +2 -2
- package/dist-sdk/src/entities/task/build.d.ts +8 -0
- package/dist-sdk/src/entities/task/build.js +10 -1
- package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/task/from-tf.js +7 -2
- package/dist-sdk/src/entities/task/module.js +2 -2
- package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
- package/dist-sdk/src/entities/task/to-tf.js +28 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
- package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +133 -13
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +20 -8
- package/dist-sdk/src/entities/view/to-tf.js +86 -18
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +15 -15
- package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
- package/dist-sdk/src/entities/visual-flow/build.js +9 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +41 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +148 -13
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +12 -0
- package/dist-sdk/src/graph/index.js +21 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +83 -4
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +16 -3
|
@@ -5,16 +5,17 @@
|
|
|
5
5
|
* owning app's from-tf drives this pass and says who the owner is — this
|
|
6
6
|
* module never names the app's own resource type.
|
|
7
7
|
*/
|
|
8
|
-
import { agentViewLayoutFromTf } from "./agent-view-layout-from-tf.js";
|
|
9
|
-
import { optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
8
|
+
import { agentViewLayoutFromTf, viewBlocksFromTf, } from "./agent-view-layout-from-tf.js";
|
|
9
|
+
import { dataRefLabel, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
10
10
|
import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
|
|
11
11
|
import { isTfExpr, isTfLabel, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
12
|
-
import { fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
12
|
+
import { decodeForeignDataField, fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
13
|
+
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
13
14
|
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
14
15
|
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
15
16
|
import { filterFromTf, principalList } from "../access-policy/from-tf.js";
|
|
16
17
|
import { listViewDensity, } from "./build.js";
|
|
17
|
-
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, KNOWN_AGENT_VIEW_ATTRS, KNOWN_CALENDAR_VIEW_ATTRS, KNOWN_DASHBOARD_VIEW_ATTRS, KNOWN_KANBAN_VIEW_ATTRS, KNOWN_LAYOUT_ATTRS, KNOWN_LAYOUT_SECTION_ATTRS, KNOWN_LIST_VIEW_ATTRS, KNOWN_MANAGED_VIEW_ORDER_ATTRS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, SECTION_TYPE_FROM_WIRE, SYSTEM_FIELD_KEY_BY_ID_ATTR, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
|
|
18
|
+
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, CUSTOM_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, KNOWN_AGENT_VIEW_ATTRS, KNOWN_CALENDAR_VIEW_ATTRS, KNOWN_CUSTOM_VIEW_ATTRS, KNOWN_DASHBOARD_VIEW_ATTRS, KNOWN_KANBAN_VIEW_ATTRS, KNOWN_LAYOUT_ATTRS, KNOWN_LAYOUT_SECTION_ATTRS, KNOWN_LIST_VIEW_ATTRS, KNOWN_MANAGED_VIEW_ORDER_ATTRS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, SECTION_TYPE_FROM_WIRE, SYSTEM_FIELD_KEY_BY_ID_ATTR, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
|
|
18
19
|
function viewFilter(value, owner, where, ctx) {
|
|
19
20
|
return value === undefined ? undefined : filterFromTf(value, {
|
|
20
21
|
type: owner.type,
|
|
@@ -26,7 +27,7 @@ function viewFilter(value, owner, where, ctx) {
|
|
|
26
27
|
}, `${where}.filter`, ctx, { optionLookupsAreIdentities: true });
|
|
27
28
|
}
|
|
28
29
|
/** All three view resource kinds → the normalized shapes the app printer consumes. */
|
|
29
|
-
export function viewsFromTf(layoutBlocks, listViewBlocks, calendarViewBlocks, kanbanViewBlocks, dashboardViewBlocks, agentViewBlocks, managedViewOrderBlocks, owner, ctx) {
|
|
30
|
+
export function viewsFromTf(layoutBlocks, listViewBlocks, calendarViewBlocks, kanbanViewBlocks, dashboardViewBlocks, agentViewBlocks, managedViewOrderBlocks, owner, ctx, customViewBlocks = []) {
|
|
30
31
|
const layouts = [];
|
|
31
32
|
for (const block of layoutBlocks) {
|
|
32
33
|
const layout = layoutFromTf(block, owner, ctx);
|
|
@@ -50,6 +51,14 @@ export function viewsFromTf(layoutBlocks, listViewBlocks, calendarViewBlocks, ka
|
|
|
50
51
|
keyByAddress.set(`${AGENT_VIEW_RESOURCE_TYPE}.${block.label ?? ""}`, view.key);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
const customViews = [];
|
|
55
|
+
for (const block of customViewBlocks) {
|
|
56
|
+
const view = customViewFromTf(block, owner, ctx);
|
|
57
|
+
if (view !== undefined) {
|
|
58
|
+
customViews.push(view);
|
|
59
|
+
keyByAddress.set(`${CUSTOM_VIEW_RESOURCE_TYPE}.${block.label ?? ""}`, view.key);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
53
62
|
const calendarViews = [];
|
|
54
63
|
for (const block of calendarViewBlocks) {
|
|
55
64
|
const view = calendarViewFromTf(block, owner, ctx);
|
|
@@ -83,7 +92,68 @@ export function viewsFromTf(layoutBlocks, listViewBlocks, calendarViewBlocks, ka
|
|
|
83
92
|
}
|
|
84
93
|
viewOrder = managedViewOrderFromTf(block, owner, keyByAddress, ctx);
|
|
85
94
|
}
|
|
86
|
-
return { layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, ...(viewOrder !== undefined ? { viewOrder } : {}) };
|
|
95
|
+
return { layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, customViews, ...(viewOrder !== undefined ? { viewOrder } : {}) };
|
|
96
|
+
}
|
|
97
|
+
function customViewFromTf(block, owner, ctx) {
|
|
98
|
+
const label = block.label;
|
|
99
|
+
if (label === undefined || label === "") {
|
|
100
|
+
ctx.diagnostics.push(`${CUSTOM_VIEW_RESOURCE_TYPE} block is missing its label; skipped`);
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const attrs = block.attrs;
|
|
104
|
+
const where = `custom view "${label}"`;
|
|
105
|
+
reportUnknownAttrs(attrs, KNOWN_CUSTOM_VIEW_ATTRS, where, "customViewFromTf", ctx);
|
|
106
|
+
if (resourceRefLabel(attrs["aspect_id"], owner.type) !== owner.label) {
|
|
107
|
+
ctx.diagnostics.push(`${where}: aspect_id does not reference ${owner.type}.${owner.label}; skipped`);
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const scope = owner.scope ?? "app";
|
|
111
|
+
// An unmanaged view keeps its live layout and agent; printing a partial one
|
|
112
|
+
// would make the next apply clear them.
|
|
113
|
+
const unmanaged = (reason) => {
|
|
114
|
+
ctx.diagnostics.push(`${where}: ${reason}; the view is left unmanaged so its live layout is not cleared`);
|
|
115
|
+
ctx.skipped.push(`${CUSTOM_VIEW_RESOURCE_TYPE}.${label}`);
|
|
116
|
+
return undefined;
|
|
117
|
+
};
|
|
118
|
+
let agentKey;
|
|
119
|
+
if (attrs["agent_id"] !== undefined && attrs["agent_id"] !== null) {
|
|
120
|
+
// Agents are app-owned: an element's view cannot name its agent in source,
|
|
121
|
+
// and building it without the agent would detach it on apply.
|
|
122
|
+
if (scope === "element")
|
|
123
|
+
return unmanaged("element views cannot reference an agent in source");
|
|
124
|
+
const agentLabel = resourceRefLabel(attrs["agent_id"], "elementum_agent");
|
|
125
|
+
if (agentLabel === undefined)
|
|
126
|
+
return unmanaged("agent_id is not an elementum_agent resource reference");
|
|
127
|
+
agentKey = scopedLabelToBagKey(owner.ownerTfLabel, agentLabel, scope);
|
|
128
|
+
}
|
|
129
|
+
let layout;
|
|
130
|
+
const layoutAttr = attrs["layout"];
|
|
131
|
+
if (layoutAttr !== undefined && layoutAttr !== null) {
|
|
132
|
+
if (!isTfExpr(layoutAttr) || layoutAttr.$expr !== "jsonencode")
|
|
133
|
+
return unmanaged("layout is not a jsonencode(...) expression");
|
|
134
|
+
const decoded = viewBlocksFromTf(layoutAttr.value, layoutRefOptions(owner, ctx));
|
|
135
|
+
if (!decoded.ok)
|
|
136
|
+
return unmanaged(decoded.reason);
|
|
137
|
+
layout = decoded.layout;
|
|
138
|
+
}
|
|
139
|
+
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
140
|
+
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
141
|
+
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
142
|
+
const emptyUserIds = Array.isArray(attrs["user_ids"]) && attrs["user_ids"].length === 0;
|
|
143
|
+
const emptyGroupIds = Array.isArray(attrs["group_ids"]) && attrs["group_ids"].length === 0;
|
|
144
|
+
const filter = viewFilter(attrs["filter"], owner, where, ctx);
|
|
145
|
+
return {
|
|
146
|
+
key: scopedLabelToBagKey(owner.ownerTfLabel, label, scope),
|
|
147
|
+
name: optionalString(attrs, "name", where, ctx) ?? "",
|
|
148
|
+
...(agentKey !== undefined && { agentKey }),
|
|
149
|
+
...(layout !== undefined && { layout }),
|
|
150
|
+
...(typeof attrs["allow_record_creation"] === "boolean" && { allowRecordCreation: attrs["allow_record_creation"] }),
|
|
151
|
+
...(filter !== undefined && { filter }),
|
|
152
|
+
...(sort !== undefined && { sort }),
|
|
153
|
+
...(userIds !== undefined ? { userIds } : emptyUserIds ? { userIds: [] } : {}),
|
|
154
|
+
...(groupIds !== undefined ? { groupIds } : emptyGroupIds ? { groupIds: [] } : {}),
|
|
155
|
+
...(typeof attrs["display_order"] === "number" && { displayOrder: attrs["display_order"] }),
|
|
156
|
+
};
|
|
87
157
|
}
|
|
88
158
|
function dashboardViewFromTf(block, owner, ctx) {
|
|
89
159
|
const label = block.label;
|
|
@@ -182,6 +252,48 @@ function typedFieldViewFromTf(block, owner, resourceType, knownAttrs, includeAll
|
|
|
182
252
|
...(groupIds !== undefined ? { groupIds } : emptyGroupIds ? { groupIds: [] } : {}),
|
|
183
253
|
};
|
|
184
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* How a blocks layout's references pull: the owner and its fields, and other
|
|
257
|
+
* apps and elements and their fields through the export's data lookups.
|
|
258
|
+
*/
|
|
259
|
+
function layoutRefOptions(owner, ctx) {
|
|
260
|
+
const foreignSource = (value) => {
|
|
261
|
+
for (const [type, kind] of [["elementum_app", "app"], ["elementum_element", "element"]]) {
|
|
262
|
+
const dataLabel = dataRefLabel(value, type);
|
|
263
|
+
if (dataLabel === undefined)
|
|
264
|
+
continue;
|
|
265
|
+
const target = resolveDataAspectTarget(ctx, kind, dataLabel);
|
|
266
|
+
return { __specRef: "source", kind, key: target.key, name: target.name, ...(target.namespace !== undefined && { namespace: target.namespace }) };
|
|
267
|
+
}
|
|
268
|
+
return undefined;
|
|
269
|
+
};
|
|
270
|
+
return {
|
|
271
|
+
isOwnApp: (value) => resourceRefLabel(value, owner.type) === owner.label,
|
|
272
|
+
fieldKey: (value) => fieldRefFromTf(value, owner.label, owner.ownerTfLabel, owner.scope ?? "app", ctx),
|
|
273
|
+
foreignSource,
|
|
274
|
+
foreignField: (value) => {
|
|
275
|
+
const dataLabel = dataRefLabel(value, "elementum_field");
|
|
276
|
+
const parent = dataLabel === undefined ? undefined : foreignSource(ctx.dataAttrs?.("elementum_field", dataLabel)?.["object_id"] ?? null);
|
|
277
|
+
if (dataLabel === undefined || parent === undefined)
|
|
278
|
+
return undefined;
|
|
279
|
+
const field = decodeForeignDataField(dataLabel, { key: parent.key, name: parent.name, namespace: parent.namespace, kind: parent.kind }, ctx);
|
|
280
|
+
return {
|
|
281
|
+
__specRef: "foreignField",
|
|
282
|
+
key: field.key,
|
|
283
|
+
name: field.name,
|
|
284
|
+
// The pull's ref-only catalog normally supplies the type. Without it,
|
|
285
|
+
// fall back to TEXT like every other foreign field ref the EDK prints
|
|
286
|
+
// (widgets, relationship columns, filters): build looks a foreign
|
|
287
|
+
// field up by owner and name, never by type, so the guess is cosmetic.
|
|
288
|
+
fieldType: field.fieldType ?? "TEXT",
|
|
289
|
+
parent: ctx.foreignFieldRefsByDataAddress?.get(`elementum_field.${dataLabel}`)?.ownerRefName ?? parent.key,
|
|
290
|
+
parentKind: parent.kind,
|
|
291
|
+
parentName: parent.name,
|
|
292
|
+
...(parent.namespace !== undefined && { parentNamespace: parent.namespace }),
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
}
|
|
185
297
|
function agentViewFromTf(block, owner, ctx) {
|
|
186
298
|
const label = block.label;
|
|
187
299
|
if (label === undefined || label === "") {
|
|
@@ -209,10 +321,7 @@ function agentViewFromTf(block, owner, ctx) {
|
|
|
209
321
|
const filter = viewFilter(attrs["filter"], owner, where, ctx);
|
|
210
322
|
let layout;
|
|
211
323
|
if (attrs["layout"] !== undefined && attrs["layout"] !== null) {
|
|
212
|
-
const decoded = agentViewLayoutFromTf(attrs["layout"],
|
|
213
|
-
isOwnApp: (value) => resourceRefLabel(value, owner.type) === owner.label,
|
|
214
|
-
fieldKey: (value) => fieldRefFromTf(value, owner.label, owner.ownerTfLabel, scope, ctx),
|
|
215
|
-
});
|
|
324
|
+
const decoded = agentViewLayoutFromTf(attrs["layout"], layoutRefOptions(owner, ctx));
|
|
216
325
|
if (!decoded.ok) {
|
|
217
326
|
// The code owns the layout: printing the view without it would make the
|
|
218
327
|
// next apply clear the live customization. Leave the view unmanaged.
|
|
@@ -350,10 +459,15 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
350
459
|
if (Array.isArray(fieldIds)) {
|
|
351
460
|
const fields = [];
|
|
352
461
|
const widgets = [];
|
|
462
|
+
const widgetAts = {};
|
|
353
463
|
for (const f of fieldIds) {
|
|
354
464
|
const widgetLabel = resourceRefLabel(f, WIDGET_RESOURCE_TYPE);
|
|
355
465
|
if (widgetLabel !== undefined) {
|
|
356
|
-
|
|
466
|
+
const key = scopedLabelToBagKey(ownerTfLabel, widgetLabel, scope);
|
|
467
|
+
widgets.push(key);
|
|
468
|
+
// `at` is an index in the field list. A widget after every field
|
|
469
|
+
// is the build default, so only an earlier index has to round-trip.
|
|
470
|
+
widgetAts[key] = fields.length;
|
|
357
471
|
continue;
|
|
358
472
|
}
|
|
359
473
|
const key = fieldRefFromTf(f, ownerLabel, ownerTfLabel, scope, ctx);
|
|
@@ -363,6 +477,9 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
363
477
|
section.fields = fields;
|
|
364
478
|
if (widgets.length > 0)
|
|
365
479
|
section.widgets = widgets;
|
|
480
|
+
const placed = Object.entries(widgetAts).filter(([, at]) => at < fields.length);
|
|
481
|
+
if (placed.length > 0)
|
|
482
|
+
section.widgetAts = Object.fromEntries(placed);
|
|
366
483
|
}
|
|
367
484
|
}
|
|
368
485
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && typeof rec["name"] === "string") {
|
|
@@ -539,6 +656,7 @@ function managedViewOrderFromTf(block, owner, keyByAddress, ctx) {
|
|
|
539
656
|
const calendarLabel = resourceRefLabel(v, CALENDAR_VIEW_RESOURCE_TYPE);
|
|
540
657
|
const kanbanLabel = resourceRefLabel(v, KANBAN_VIEW_RESOURCE_TYPE);
|
|
541
658
|
const dashboardLabel = resourceRefLabel(v, DASHBOARD_VIEW_RESOURCE_TYPE);
|
|
659
|
+
const customLabel = resourceRefLabel(v, CUSTOM_VIEW_RESOURCE_TYPE);
|
|
542
660
|
const key = listLabel !== undefined
|
|
543
661
|
? keyByAddress.get(`${LIST_VIEW_RESOURCE_TYPE}.${listLabel}`)
|
|
544
662
|
: agentLabel !== undefined
|
|
@@ -549,9 +667,11 @@ function managedViewOrderFromTf(block, owner, keyByAddress, ctx) {
|
|
|
549
667
|
? keyByAddress.get(`${KANBAN_VIEW_RESOURCE_TYPE}.${kanbanLabel}`)
|
|
550
668
|
: dashboardLabel !== undefined
|
|
551
669
|
? keyByAddress.get(`${DASHBOARD_VIEW_RESOURCE_TYPE}.${dashboardLabel}`)
|
|
552
|
-
: undefined
|
|
670
|
+
: customLabel !== undefined
|
|
671
|
+
? keyByAddress.get(`${CUSTOM_VIEW_RESOURCE_TYPE}.${customLabel}`)
|
|
672
|
+
: undefined;
|
|
553
673
|
if (key === undefined) {
|
|
554
|
-
ctx.diagnostics.push(`${where}: a view_ids entry does not resolve to a known
|
|
674
|
+
ctx.diagnostics.push(`${where}: a view_ids entry does not resolve to a known managed view; dropped`);
|
|
555
675
|
continue;
|
|
556
676
|
}
|
|
557
677
|
order.push(key);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** The view entity's registry entries (see src/graph/). */
|
|
2
|
+
import { asNamedRef, namedFactoryEntry } from "../../catalog/render-helpers.js";
|
|
2
3
|
import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE, } from "../../graph/types.js";
|
|
3
|
-
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, } from "./types.js";
|
|
4
|
+
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, CUSTOM_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, VIEW_DATA_RESOURCE_TYPE, } from "./types.js";
|
|
4
5
|
/**
|
|
5
6
|
* Layouts + list views are stream members folded into the app authoring file
|
|
6
7
|
* (inline), extracted by `appFromTf` — not own-file kinds.
|
|
@@ -22,12 +23,38 @@ export const viewModule = {
|
|
|
22
23
|
{ key: "calendarView", resourceType: CALENDAR_VIEW_RESOURCE_TYPE, implemented: true },
|
|
23
24
|
{ key: "dashboardView", resourceType: DASHBOARD_VIEW_RESOURCE_TYPE, implemented: true },
|
|
24
25
|
{ key: "kanbanView", resourceType: KANBAN_VIEW_RESOURCE_TYPE, implemented: true },
|
|
26
|
+
{ key: "customView", resourceType: CUSTOM_VIEW_RESOURCE_TYPE, implemented: true },
|
|
25
27
|
],
|
|
26
28
|
},
|
|
27
|
-
|
|
29
|
+
// A portal menu names a view outside the workspace by owner and name.
|
|
30
|
+
data: { participates: true, resourceType: VIEW_DATA_RESOURCE_TYPE, lookupAttr: "name", referencedByBuild: true },
|
|
28
31
|
lifecycle: NO_LIFECYCLE,
|
|
29
32
|
canvas: NO_CANVAS,
|
|
30
|
-
|
|
33
|
+
// Inline under the app/element: generated catalogs read `views` live from
|
|
34
|
+
// the owner's `.ref()` (like fields), so other stream roots — a portal's
|
|
35
|
+
// menu — can reference a view by owner and name.
|
|
36
|
+
catalog: {
|
|
37
|
+
participates: true,
|
|
38
|
+
refKind: "view",
|
|
39
|
+
catalogBag: "views",
|
|
40
|
+
renderOrder: 51,
|
|
41
|
+
catalogRoot: "app",
|
|
42
|
+
fromOwnRef: true,
|
|
43
|
+
renderEntry: (args) => {
|
|
44
|
+
const named = asNamedRef(args.ref);
|
|
45
|
+
const viewType = args.ref.viewType;
|
|
46
|
+
return namedFactoryEntry({
|
|
47
|
+
factoryName: "viewRef",
|
|
48
|
+
keyName: args.keyName,
|
|
49
|
+
baseIndent: args.baseIndent,
|
|
50
|
+
name: named.name,
|
|
51
|
+
parent: named.parent,
|
|
52
|
+
...(viewType !== undefined ? { extraParts: [`viewType: ${JSON.stringify(viewType)}`] } : {}),
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
stubRef: (refName, parent) => ({ __kind: "view", refName, name: refName, parent }),
|
|
56
|
+
refFromAuthoring: () => undefined,
|
|
57
|
+
},
|
|
31
58
|
};
|
|
32
59
|
/**
|
|
33
60
|
* `elementum_managed_view_order` is a singleton per aspect with no identity
|
|
@@ -40,6 +40,12 @@ export interface AppLayoutSectionWire {
|
|
|
40
40
|
readonly __kind?: string;
|
|
41
41
|
readonly refName?: string;
|
|
42
42
|
readonly parent?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Index in this group's field list where the widget is inserted.
|
|
45
|
+
* Omitted widgets stay after the fields, which is where a group that
|
|
46
|
+
* only has trailing action buttons belongs.
|
|
47
|
+
*/
|
|
48
|
+
readonly at?: number;
|
|
43
49
|
}[];
|
|
44
50
|
}
|
|
45
51
|
export interface AppLayoutWire {
|
|
@@ -67,6 +73,19 @@ export interface AppAgentViewWire extends ManagedViewSharing {
|
|
|
67
73
|
readonly displayOrder?: number;
|
|
68
74
|
readonly layout?: AppAgentViewLayoutWire;
|
|
69
75
|
}
|
|
76
|
+
export interface AppCustomViewWire extends ManagedViewSharing {
|
|
77
|
+
readonly name?: string;
|
|
78
|
+
readonly agent?: {
|
|
79
|
+
readonly refName?: string;
|
|
80
|
+
readonly parent?: string;
|
|
81
|
+
};
|
|
82
|
+
readonly allowRecordCreation?: boolean;
|
|
83
|
+
readonly filter?: Filter;
|
|
84
|
+
readonly sort?: ManagedViewSort;
|
|
85
|
+
readonly displayOrder?: number;
|
|
86
|
+
/** A blocks layout (the public type, unchecked). */
|
|
87
|
+
readonly layout?: unknown;
|
|
88
|
+
}
|
|
70
89
|
export interface AppCalendarViewWire extends ManagedViewSharing {
|
|
71
90
|
readonly name?: string;
|
|
72
91
|
readonly columns?: readonly ViewFieldRefWire[];
|
|
@@ -96,13 +115,6 @@ export interface ViewToTfOptions {
|
|
|
96
115
|
readonly ownerTfLabel: string;
|
|
97
116
|
/** App children use `apps_<ns>_`; element children use `<ns>_`. */
|
|
98
117
|
readonly scope?: ChildResourceScope;
|
|
99
|
-
/**
|
|
100
|
-
* The owning aspect's display name — `elementum_managed_view_order`'s label
|
|
101
|
-
* has no authored bag key (it's a derived aspect-wide singleton), so ei
|
|
102
|
-
* derives it from the NAME (its `SanitizeName`, not the namespace);
|
|
103
|
-
* matching that here keeps the build-vs-export address-stable across a real pull.
|
|
104
|
-
*/
|
|
105
|
-
readonly aspectName: string;
|
|
106
118
|
/** The owning aspect's id reference — computed by the caller. */
|
|
107
119
|
readonly objectId: TfValue;
|
|
108
120
|
/** App stage terraform labels declared by systemFields.stage.options. */
|
|
@@ -123,5 +135,5 @@ export interface ViewToTfResult {
|
|
|
123
135
|
readonly blocks: readonly TfBlock[];
|
|
124
136
|
}
|
|
125
137
|
/** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
|
|
126
|
-
export declare function viewToTf(layouts: Readonly<Record<string, AppLayoutWire>> | undefined, listViews: Readonly<Record<string, AppListViewWire>> | undefined, calendarViews: Readonly<Record<string, AppCalendarViewWire>> | undefined, kanbanViews: Readonly<Record<string, AppKanbanViewWire>> | undefined, dashboardViews: Readonly<Record<string, AppDashboardViewWire>> | undefined, agentViews: Readonly<Record<string, AppAgentViewWire>> | undefined, viewOrder: readonly string[] | undefined, opts: ViewToTfOptions): ViewToTfResult;
|
|
138
|
+
export declare function viewToTf(layouts: Readonly<Record<string, AppLayoutWire>> | undefined, listViews: Readonly<Record<string, AppListViewWire>> | undefined, calendarViews: Readonly<Record<string, AppCalendarViewWire>> | undefined, kanbanViews: Readonly<Record<string, AppKanbanViewWire>> | undefined, dashboardViews: Readonly<Record<string, AppDashboardViewWire>> | undefined, agentViews: Readonly<Record<string, AppAgentViewWire>> | undefined, viewOrder: readonly string[] | undefined, opts: ViewToTfOptions, customViews?: Readonly<Record<string, AppCustomViewWire>>): ViewToTfResult;
|
|
127
139
|
export declare function managedViewSortToTf(sort: ManagedViewSort, ownerTfLabel: string, scope: ChildResourceScope, where: string, diagnostics: string[], fieldAddresses?: ReadonlyMap<string, string>): TfValue;
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
* reported, never silent. Invalid authored filter trees fail at build time
|
|
10
10
|
* with the same `EntityTfError` path used by access-policy row filters.
|
|
11
11
|
*/
|
|
12
|
-
import { agentViewLayoutToTf } from "./agent-view-layout-to-tf.js";
|
|
13
|
-
import { expr, isCanonicalTsLabel,
|
|
12
|
+
import { agentViewLayoutToTf, viewBlocksToTf } from "./agent-view-layout-to-tf.js";
|
|
13
|
+
import { expr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
14
14
|
import { fieldRefToTfValue as customFieldRefToTfValue } from "../field/to-tf.js";
|
|
15
15
|
import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
|
|
16
16
|
import { filterToTf, principalListToTf } from "../access-policy/to-tf.js";
|
|
17
17
|
import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
|
|
18
18
|
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
19
19
|
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
20
|
-
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE,
|
|
20
|
+
import { AGENT_VIEW_RESOURCE_TYPE, CUSTOM_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
|
|
21
21
|
function appendViewSharingAttrs(attrs, view, where, ctx) {
|
|
22
22
|
const userIds = principalListToTf(view.userIds, "elementum_user", `${where}.userIds`, ctx);
|
|
23
23
|
const groupIds = principalListToTf(view.groupIds, "elementum_group", `${where}.groupIds`, ctx);
|
|
@@ -35,8 +35,8 @@ function appendViewSharingAttrs(attrs, view, where, ctx) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
/** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
|
|
38
|
-
export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder, opts) {
|
|
39
|
-
const { ownerRefName, ownerTfLabel, scope = "app",
|
|
38
|
+
export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder, opts, customViews) {
|
|
39
|
+
const { ownerRefName, ownerTfLabel, scope = "app", objectId, diagnostics, fieldAddresses } = opts;
|
|
40
40
|
const principalCtx = { ...opts, scope, objectId };
|
|
41
41
|
const blocks = [];
|
|
42
42
|
for (const [stageKey, layout] of Object.entries(layouts ?? {})) {
|
|
@@ -225,6 +225,60 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
225
225
|
blocks.push({ kind: "resource", type: AGENT_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
|
|
226
226
|
viewAddressByKey.set(viewKey, { type: AGENT_VIEW_RESOURCE_TYPE, label: tfLabel });
|
|
227
227
|
}
|
|
228
|
+
for (const [viewKey, view] of Object.entries(customViews ?? {})) {
|
|
229
|
+
const where = `customViews.${viewKey}`;
|
|
230
|
+
if (!isCanonicalTsLabel(viewKey)) {
|
|
231
|
+
diagnostics.push(`customViews key "${viewKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (viewAddressByKey.has(viewKey)) {
|
|
235
|
+
diagnostics.push(`${where} collides with another view key; dropped`);
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
|
|
239
|
+
const attrs = {
|
|
240
|
+
aspect_id: objectId,
|
|
241
|
+
name: view.name ?? "",
|
|
242
|
+
allow_record_creation: view.allowRecordCreation ?? true,
|
|
243
|
+
};
|
|
244
|
+
if (view.agent !== undefined) {
|
|
245
|
+
const agentRefName = view.agent.refName ?? "";
|
|
246
|
+
if (agentRefName === "" || view.agent.parent !== ownerRefName) {
|
|
247
|
+
// Dropping only the agent would detach it on apply; keep the whole view out instead.
|
|
248
|
+
diagnostics.push(`${where}.agent must be an agent of this ${scope === "element" ? "element" : "app"}; dropped`);
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
attrs["agent_id"] = expr.resourceAttr("elementum_agent", scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(agentRefName), scope), ["id"]);
|
|
252
|
+
}
|
|
253
|
+
if (view.filter !== undefined)
|
|
254
|
+
attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, appRefName: ownerRefName, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
255
|
+
if (view.sort !== undefined)
|
|
256
|
+
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics, fieldAddresses);
|
|
257
|
+
appendViewSharingAttrs(attrs, view, where, principalCtx);
|
|
258
|
+
if (view.displayOrder !== undefined)
|
|
259
|
+
attrs["display_order"] = view.displayOrder;
|
|
260
|
+
if (view.layout !== undefined) {
|
|
261
|
+
attrs["layout"] = expr.jsonencode(viewBlocksToTf(view.layout, `${where}.layout`, {
|
|
262
|
+
ownerRefName,
|
|
263
|
+
ownerKind: scope === "element" ? "element" : "app",
|
|
264
|
+
ownerTfLabel,
|
|
265
|
+
scope,
|
|
266
|
+
objectId,
|
|
267
|
+
diagnostics,
|
|
268
|
+
fieldAddresses,
|
|
269
|
+
orgRefs: opts.orgRefs,
|
|
270
|
+
workspaceAspects: opts.workspaceAspects,
|
|
271
|
+
resolveField: (ref, fieldWhere) => fieldRefToTfValue(ref, ownerTfLabel, scope, fieldWhere, diagnostics, fieldAddresses),
|
|
272
|
+
}, { editorPolicy: false }));
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
// The page needs a layout document, and the platform rejects a blank
|
|
276
|
+
// one, so a view without a layout cannot be opened in the admin UI.
|
|
277
|
+
diagnostics.push(`${where} has no layout, so the admin UI cannot open this view ("This custom view could not be loaded"); add a layout`);
|
|
278
|
+
}
|
|
279
|
+
blocks.push({ kind: "resource", type: CUSTOM_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
|
|
280
|
+
viewAddressByKey.set(viewKey, { type: CUSTOM_VIEW_RESOURCE_TYPE, label: tfLabel });
|
|
281
|
+
}
|
|
228
282
|
if (viewAddressByKey.size > 0) {
|
|
229
283
|
const orderKeys = viewOrder ?? [
|
|
230
284
|
...Object.keys(listViews ?? {}),
|
|
@@ -232,6 +286,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
232
286
|
...Object.keys(kanbanViews ?? {}),
|
|
233
287
|
...Object.keys(dashboardViews ?? {}),
|
|
234
288
|
...Object.keys(agentViews ?? {}),
|
|
289
|
+
...Object.keys(customViews ?? {}),
|
|
235
290
|
];
|
|
236
291
|
const placed = new Set();
|
|
237
292
|
const viewIds = [];
|
|
@@ -257,7 +312,9 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
257
312
|
blocks.push({
|
|
258
313
|
kind: "resource",
|
|
259
314
|
type: MANAGED_VIEW_ORDER_RESOURCE_TYPE,
|
|
260
|
-
|
|
315
|
+
// No name of its own: labelled from the owner's namespace, like the record
|
|
316
|
+
// create form, so renaming the app or element keeps its address.
|
|
317
|
+
label: scopedResourceLabel(ownerTfLabel, "view_order", scope),
|
|
261
318
|
attrs: { object_id: objectId, view_ids: viewIds },
|
|
262
319
|
});
|
|
263
320
|
}
|
|
@@ -321,14 +378,17 @@ function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectI
|
|
|
321
378
|
sec.agent_id = expr.resourceAttr("elementum_agent", scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(agentRefName), "app"), ["id"]);
|
|
322
379
|
}
|
|
323
380
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
381
|
+
// System fields (ID/Title/Status included) are kept in their authored
|
|
382
|
+
// position as the owner's `local.<ns>_<key>_field_id`. A UI-placed
|
|
383
|
+
// system field is a real section member: the provider reads it back
|
|
384
|
+
// into `field_ids` and `ei export` emits it (as its platform id), so
|
|
385
|
+
// dropping it here rebuilt a shorter list, which plans a destructive
|
|
386
|
+
// replace that removes the field from the live section. The platform
|
|
387
|
+
// accepts ID/Title/Status field blocks like any field, so the
|
|
388
|
+
// provider re-places them when it recreates the layout.
|
|
389
|
+
const fields = section.fields ?? [];
|
|
331
390
|
const widgetIds = [];
|
|
391
|
+
const inserted = [];
|
|
332
392
|
for (const [index, widget] of (section.widgets ?? []).entries()) {
|
|
333
393
|
const widgetWhere = `${where}.widgets[${index}]`;
|
|
334
394
|
const key = widget.refName ?? "";
|
|
@@ -344,12 +404,20 @@ function layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectI
|
|
|
344
404
|
diagnostics.push(`${widgetWhere}: widget ${JSON.stringify(key)} is not declared in this ${scope}; dropped`);
|
|
345
405
|
continue;
|
|
346
406
|
}
|
|
347
|
-
|
|
407
|
+
const widgetId = expr.resourceAttr(WIDGET_RESOURCE_TYPE, scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(key), scope), ["id"]);
|
|
408
|
+
if (typeof widget.at === "number")
|
|
409
|
+
inserted.push({ at: widget.at, id: widgetId });
|
|
410
|
+
else
|
|
411
|
+
widgetIds.push(widgetId);
|
|
412
|
+
}
|
|
413
|
+
const fieldIds = resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics, fieldAddresses);
|
|
414
|
+
// Insert from the back so each `at` is an index in the original field
|
|
415
|
+
// list, not an index that earlier inserts have already shifted.
|
|
416
|
+
for (const widget of inserted.sort((left, right) => right.at - left.at)) {
|
|
417
|
+
const index = Math.max(0, Math.min(widget.at, fieldIds.length));
|
|
418
|
+
fieldIds.splice(index, 0, widget.id);
|
|
348
419
|
}
|
|
349
|
-
sec.field_ids = [
|
|
350
|
-
...resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics, fieldAddresses),
|
|
351
|
-
...widgetIds,
|
|
352
|
-
];
|
|
420
|
+
sec.field_ids = [...fieldIds, ...widgetIds];
|
|
353
421
|
}
|
|
354
422
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && section.name !== undefined) {
|
|
355
423
|
sec.name = section.name;
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
export declare const LAYOUT_RESOURCE_TYPE = "elementum_layout";
|
|
14
14
|
export declare const LIST_VIEW_RESOURCE_TYPE = "elementum_list_view";
|
|
15
15
|
export declare const AGENT_VIEW_RESOURCE_TYPE = "elementum_agent_view";
|
|
16
|
+
export declare const CUSTOM_VIEW_RESOURCE_TYPE = "elementum_custom_view";
|
|
16
17
|
export declare const CALENDAR_VIEW_RESOURCE_TYPE = "elementum_calendar_view";
|
|
17
18
|
export declare const KANBAN_VIEW_RESOURCE_TYPE = "elementum_kanban_view";
|
|
18
19
|
export declare const DASHBOARD_VIEW_RESOURCE_TYPE = "elementum_dashboard_view";
|
|
19
20
|
export declare const MANAGED_VIEW_ORDER_RESOURCE_TYPE = "elementum_managed_view_order";
|
|
21
|
+
/** Looks up a managed view by owner and name (a portal menu's view outside the workspace). */
|
|
22
|
+
export declare const VIEW_DATA_RESOURCE_TYPE = "elementum_view";
|
|
20
23
|
/**
|
|
21
24
|
* Layout section `type` discriminator: authoring camelCase ↔ the provider's
|
|
22
25
|
* wire value, verified against `provider/internal/provider/layout_resource.go`
|
|
@@ -30,21 +33,6 @@ export declare const SECTION_TYPE_FROM_WIRE: ReadonlyMap<string, string>;
|
|
|
30
33
|
export declare const GROUP_SECTION_WIRE_TYPE = "group";
|
|
31
34
|
/** The one other section type carrying an (optional) `name`. */
|
|
32
35
|
export declare const UPDATE_SECTION_WIRE_TYPE = "update";
|
|
33
|
-
/**
|
|
34
|
-
* System-field keys the platform refuses to accept in a layout `group`
|
|
35
|
-
* section's `field_ids` on create — confirmed live against `prestonhigh`:
|
|
36
|
-
* `elementum_layout` create errors "cannot place system fields in layout
|
|
37
|
-
* sections: ID (has HANDLE, TITLE, or STATUS tag), Title (...), Status
|
|
38
|
-
* (...)". The platform's OWN auto-provisioned default "System" section
|
|
39
|
-
* legitimately contains them (so `ei export`/`layoutFromTf` still capture
|
|
40
|
-
* them faithfully — this is a real, current fact about the app), but
|
|
41
|
-
* terraform can never re-create a section containing them: `to-tf` must
|
|
42
|
-
* drop these three specifically wherever a group section names them, or
|
|
43
|
-
* every layout recreate (any `sections` edit forces a full replace) fails.
|
|
44
|
-
* Audit fields (createdAt/createdBy/updatedAt/updatedBy/closedAt/closedBy)
|
|
45
|
-
* are NOT restricted — only HANDLE/TITLE/STATUS.
|
|
46
|
-
*/
|
|
47
|
-
export declare const LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS: ReadonlySet<string>;
|
|
48
36
|
/**
|
|
49
37
|
* System-field key → the `local.<ns>_<attr>` name `entities/app/locals.ts`
|
|
50
38
|
* emits for it (`SYSTEM_FIELD_ID_ATTRS`'s `<tfLabel>_field_id` shape there).
|
|
@@ -59,6 +47,7 @@ export declare const KNOWN_LAYOUT_SECTION_ATTRS: ReadonlySet<string>;
|
|
|
59
47
|
/** Attributes `listViewFromTf` understands. */
|
|
60
48
|
export declare const KNOWN_LIST_VIEW_ATTRS: ReadonlySet<string>;
|
|
61
49
|
export declare const KNOWN_AGENT_VIEW_ATTRS: ReadonlySet<string>;
|
|
50
|
+
export declare const KNOWN_CUSTOM_VIEW_ATTRS: ReadonlySet<string>;
|
|
62
51
|
export declare const KNOWN_CALENDAR_VIEW_ATTRS: ReadonlySet<string>;
|
|
63
52
|
export declare const KNOWN_KANBAN_VIEW_ATTRS: ReadonlySet<string>;
|
|
64
53
|
export declare const KNOWN_DASHBOARD_VIEW_ATTRS: ReadonlySet<string>;
|
|
@@ -15,10 +15,13 @@ import { tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
|
15
15
|
export const LAYOUT_RESOURCE_TYPE = "elementum_layout";
|
|
16
16
|
export const LIST_VIEW_RESOURCE_TYPE = "elementum_list_view";
|
|
17
17
|
export const AGENT_VIEW_RESOURCE_TYPE = "elementum_agent_view";
|
|
18
|
+
export const CUSTOM_VIEW_RESOURCE_TYPE = "elementum_custom_view";
|
|
18
19
|
export const CALENDAR_VIEW_RESOURCE_TYPE = "elementum_calendar_view";
|
|
19
20
|
export const KANBAN_VIEW_RESOURCE_TYPE = "elementum_kanban_view";
|
|
20
21
|
export const DASHBOARD_VIEW_RESOURCE_TYPE = "elementum_dashboard_view";
|
|
21
22
|
export const MANAGED_VIEW_ORDER_RESOURCE_TYPE = "elementum_managed_view_order";
|
|
23
|
+
/** Looks up a managed view by owner and name (a portal menu's view outside the workspace). */
|
|
24
|
+
export const VIEW_DATA_RESOURCE_TYPE = "elementum_view";
|
|
22
25
|
/**
|
|
23
26
|
* Layout section `type` discriminator: authoring camelCase ↔ the provider's
|
|
24
27
|
* wire value, verified against `provider/internal/provider/layout_resource.go`
|
|
@@ -42,21 +45,6 @@ export const SECTION_TYPE_FROM_WIRE = new Map(Object.entries(SECTION_TYPE_TO_WIR
|
|
|
42
45
|
export const GROUP_SECTION_WIRE_TYPE = "group";
|
|
43
46
|
/** The one other section type carrying an (optional) `name`. */
|
|
44
47
|
export const UPDATE_SECTION_WIRE_TYPE = "update";
|
|
45
|
-
/**
|
|
46
|
-
* System-field keys the platform refuses to accept in a layout `group`
|
|
47
|
-
* section's `field_ids` on create — confirmed live against `prestonhigh`:
|
|
48
|
-
* `elementum_layout` create errors "cannot place system fields in layout
|
|
49
|
-
* sections: ID (has HANDLE, TITLE, or STATUS tag), Title (...), Status
|
|
50
|
-
* (...)". The platform's OWN auto-provisioned default "System" section
|
|
51
|
-
* legitimately contains them (so `ei export`/`layoutFromTf` still capture
|
|
52
|
-
* them faithfully — this is a real, current fact about the app), but
|
|
53
|
-
* terraform can never re-create a section containing them: `to-tf` must
|
|
54
|
-
* drop these three specifically wherever a group section names them, or
|
|
55
|
-
* every layout recreate (any `sections` edit forces a full replace) fails.
|
|
56
|
-
* Audit fields (createdAt/createdBy/updatedAt/updatedBy/closedAt/closedBy)
|
|
57
|
-
* are NOT restricted — only HANDLE/TITLE/STATUS.
|
|
58
|
-
*/
|
|
59
|
-
export const LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS = new Set(["id", "title", "status"]);
|
|
60
48
|
/**
|
|
61
49
|
* System-field key → the `local.<ns>_<attr>` name `entities/app/locals.ts`
|
|
62
50
|
* emits for it (`SYSTEM_FIELD_ID_ATTRS`'s `<tfLabel>_field_id` shape there).
|
|
@@ -105,6 +93,18 @@ export const KNOWN_AGENT_VIEW_ATTRS = new Set([
|
|
|
105
93
|
"display_order",
|
|
106
94
|
"layout",
|
|
107
95
|
]);
|
|
96
|
+
export const KNOWN_CUSTOM_VIEW_ATTRS = new Set([
|
|
97
|
+
"aspect_id",
|
|
98
|
+
"agent_id",
|
|
99
|
+
"name",
|
|
100
|
+
"allow_record_creation",
|
|
101
|
+
"filter",
|
|
102
|
+
"sort",
|
|
103
|
+
"user_ids",
|
|
104
|
+
"group_ids",
|
|
105
|
+
"display_order",
|
|
106
|
+
"layout",
|
|
107
|
+
]);
|
|
108
108
|
const COMMON_TYPED_VIEW_ATTRS = [
|
|
109
109
|
"aspect_id",
|
|
110
110
|
"name",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentRef, type AppCatalogRef, type AppOrElementRef, type AutomationRef } from "../../catalog/index.js";
|
|
1
|
+
import { type AgentRef, type AppCatalogRef, type AppOrElementRef, type AutomationRef, type DatamineRef, type RelationshipRef, type TableRef } from "../../catalog/index.js";
|
|
2
2
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
3
|
declare const positionBrand: unique symbol;
|
|
4
4
|
declare const symbolBrand: unique symbol;
|
|
@@ -39,6 +39,18 @@ type ActionPayload = {
|
|
|
39
39
|
readonly kind: "object";
|
|
40
40
|
readonly object: AppOrElementRef;
|
|
41
41
|
readonly name?: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: "datamine";
|
|
44
|
+
readonly datamine: DatamineRef;
|
|
45
|
+
readonly name?: string;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: "table";
|
|
48
|
+
readonly table: TableRef;
|
|
49
|
+
readonly name?: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "relationship";
|
|
52
|
+
readonly relationship: RelationshipRef;
|
|
53
|
+
readonly name?: string;
|
|
42
54
|
};
|
|
43
55
|
export type VisualFlowAction = ActionPayload & {
|
|
44
56
|
readonly [actionBrand]: "VisualFlowAction";
|
|
@@ -54,6 +66,9 @@ export declare function flowAutomationAction(automation: AutomationRef, name?: s
|
|
|
54
66
|
export declare function flowUserAction(name: string): VisualFlowAction;
|
|
55
67
|
export declare function flowApiAction(name: string): VisualFlowAction;
|
|
56
68
|
export declare function flowObjectAction(object: AppOrElementRef, name?: string): VisualFlowAction;
|
|
69
|
+
export declare function flowDatamineAction(datamine: DatamineRef, name?: string): VisualFlowAction;
|
|
70
|
+
export declare function flowTableAction(table: TableRef, name?: string): VisualFlowAction;
|
|
71
|
+
export declare function flowRelationshipAction(relationship: RelationshipRef, name?: string): VisualFlowAction;
|
|
57
72
|
export declare function flowObjectTarget(object: AppOrElementRef, name?: string): VisualFlowTarget;
|
|
58
73
|
export interface VisualFlowConnection {
|
|
59
74
|
readonly target: string;
|
|
@@ -26,6 +26,15 @@ export function flowApiAction(name) {
|
|
|
26
26
|
export function flowObjectAction(object, name) {
|
|
27
27
|
return { kind: "object", object, ...(name !== undefined ? { name } : {}) };
|
|
28
28
|
}
|
|
29
|
+
export function flowDatamineAction(datamine, name) {
|
|
30
|
+
return { kind: "datamine", datamine, ...(name !== undefined ? { name } : {}) };
|
|
31
|
+
}
|
|
32
|
+
export function flowTableAction(table, name) {
|
|
33
|
+
return { kind: "table", table, ...(name !== undefined ? { name } : {}) };
|
|
34
|
+
}
|
|
35
|
+
export function flowRelationshipAction(relationship, name) {
|
|
36
|
+
return { kind: "relationship", relationship, ...(name !== undefined ? { name } : {}) };
|
|
37
|
+
}
|
|
29
38
|
export function flowObjectTarget(object, name) {
|
|
30
39
|
return { object, ...(name !== undefined ? { name } : {}) };
|
|
31
40
|
}
|