@elementumai/edk 0.9.17 → 0.9.19
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 +8 -3
- package/dist-sdk/src/catalog/factories.d.ts +11 -0
- package/dist-sdk/src/catalog/factories.js +6 -0
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.d.ts +39 -1
- package/dist-sdk/src/catalog/org.js +460 -50
- package/dist-sdk/src/catalog/types.d.ts +12 -2
- package/dist-sdk/src/catalog/types.js +2 -0
- package/dist-sdk/src/engine/pull/ref-only.js +54 -20
- package/dist-sdk/src/engine/pull/result-output.d.ts +2 -0
- package/dist-sdk/src/engine/pull/result-output.js +1 -1
- package/dist-sdk/src/engine/tf/expr.js +38 -13
- 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 +2 -0
- package/dist-sdk/src/engine/tf/labels.js +4 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
- package/dist-sdk/src/engine/tf/parse.js +105 -6
- package/dist-sdk/src/engine/workspace/loader.js +49 -12
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +11 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -1
- package/dist-sdk/src/entities/app/build.d.ts +10 -0
- package/dist-sdk/src/entities/app/build.js +0 -13
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
- package/dist-sdk/src/entities/app/from-tf.js +4 -3
- package/dist-sdk/src/entities/app/index.d.ts +2 -0
- package/dist-sdk/src/entities/app/index.js +1 -0
- package/dist-sdk/src/entities/app/module.js +13 -0
- package/dist-sdk/src/entities/app/to-tf.js +2 -0
- package/dist-sdk/src/entities/automation/build.d.ts +2 -1
- package/dist-sdk/src/entities/automation/build.js +27 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +6 -0
- package/dist-sdk/src/entities/automation/from-tf.js +156 -26
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +2 -0
- package/dist-sdk/src/entities/automation/module.js +56 -0
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +5 -4
- package/dist-sdk/src/entities/automation/output-field-types.js +23 -5
- package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
- package/dist-sdk/src/entities/automation/system-ref-name.js +44 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +15 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +38 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +37 -5
- package/dist-sdk/src/entities/automation/tasks.js +23 -1
- package/dist-sdk/src/entities/automation/to-tf.js +158 -84
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.js +33 -17
- package/dist-sdk/src/entities/chart/module.js +3 -1
- package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
- package/dist-sdk/src/entities/chart/printer.js +26 -16
- package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
- package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
- package/dist-sdk/src/entities/chart/to-tf.js +12 -10
- package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +51 -2
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
- package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
- package/dist-sdk/src/entities/element/build.d.ts +8 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +6 -2
- package/dist-sdk/src/entities/element/index.d.ts +1 -0
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +2 -0
- package/dist-sdk/src/entities/element/to-tf.js +12 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/field/from-tf.js +11 -0
- package/dist-sdk/src/entities/field/to-tf.js +13 -9
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +19 -10
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +23 -2
- package/dist-sdk/src/entities/shared/filters/index.js +24 -1
- package/dist-sdk/src/entities/shared/filters/print.js +22 -4
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +23 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +60 -18
- package/dist-sdk/src/entities/shared/filters/types.d.ts +13 -4
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
- package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
- package/dist-sdk/src/entities/skill/access-policy.js +101 -0
- package/dist-sdk/src/entities/skill/build.d.ts +3 -0
- package/dist-sdk/src/entities/skill/build.js +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +21 -0
- package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill/from-tf.js +4 -9
- package/dist-sdk/src/entities/skill/index.d.ts +2 -0
- package/dist-sdk/src/entities/skill/index.js +1 -0
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill/to-tf.js +5 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +3 -3
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +224 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +36 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +288 -0
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +121 -0
- package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/view/from-tf.js +42 -7
- package/dist-sdk/src/entities/view/ragnarok.d.ts +7 -0
- package/dist-sdk/src/entities/view/ragnarok.js +1 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +10 -1
- package/dist-sdk/src/entities/view/to-tf.js +30 -1
- package/dist-sdk/src/entities/view/types.js +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +2 -2
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +815 -0
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +5 -0
- package/dist-sdk/src/graph/index.d.ts +43 -0
- package/dist-sdk/src/graph/index.js +9 -0
- package/dist-sdk/src/graph/types.d.ts +78 -0
- package/package.json +11 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Rebind self references only; foreign roots can share the export owner's key. */
|
|
2
|
+
export function rebindChartOwner(chart, from, to) {
|
|
3
|
+
if (from === to)
|
|
4
|
+
return chart;
|
|
5
|
+
const isSelf = (datasource) => datasource.local && datasource.kind === "app" && datasource.refName === from;
|
|
6
|
+
const datasource = (value) => isSelf(value) ? { ...value, refName: to } : value;
|
|
7
|
+
const field = (value, owner) => isSelf(owner) && value.parentKind === "app" && value.parentRefName === from
|
|
8
|
+
? { ...value, parentRefName: to } : value;
|
|
9
|
+
// Filters can nest fields in composite children, leftValue, or FIELD values.
|
|
10
|
+
// Transform typed field nodes rather than arbitrary names/strings in the AST.
|
|
11
|
+
const filterFields = (value, owner) => {
|
|
12
|
+
if (Array.isArray(value))
|
|
13
|
+
return value.map((item) => filterFields(item, owner));
|
|
14
|
+
if (value === null || typeof value !== "object")
|
|
15
|
+
return value;
|
|
16
|
+
const node = value;
|
|
17
|
+
if (node["kind"] === "field" && node["parentKind"] === "app" && node["parentRefName"] === from) {
|
|
18
|
+
return field(value, owner);
|
|
19
|
+
}
|
|
20
|
+
return Object.fromEntries(Object.entries(node).map(([key, item]) => [key, filterFields(item, owner)]));
|
|
21
|
+
};
|
|
22
|
+
return { ...chart, subscriptions: chart.subscriptions.map((subscription) => {
|
|
23
|
+
if (subscription.kind === "opaque")
|
|
24
|
+
return subscription;
|
|
25
|
+
return {
|
|
26
|
+
...subscription,
|
|
27
|
+
datasource: datasource(subscription.datasource),
|
|
28
|
+
columns: subscription.columns.map((column) => column.field === undefined ? column
|
|
29
|
+
: { ...column, field: field(column.field, subscription.datasource) }),
|
|
30
|
+
...(subscription.groupBy !== undefined && { groupBy: subscription.groupBy.map((group) => ({
|
|
31
|
+
...group, field: field(group.field, subscription.datasource),
|
|
32
|
+
})) }),
|
|
33
|
+
...(subscription.filter !== undefined && { filter: filterFields(subscription.filter, subscription.datasource) }),
|
|
34
|
+
...(subscription.joins !== undefined && { joins: subscription.joins.map((join) => ({
|
|
35
|
+
...join,
|
|
36
|
+
datasource: datasource(join.datasource),
|
|
37
|
+
leftField: field(join.leftField, subscription.datasource),
|
|
38
|
+
rightField: field(join.rightField, join.datasource),
|
|
39
|
+
})) }),
|
|
40
|
+
};
|
|
41
|
+
}) };
|
|
42
|
+
}
|
|
@@ -5,6 +5,7 @@ import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
|
5
5
|
import { filterToTf as serializeFilterToTf } from "../shared/filters/tf-codec.js";
|
|
6
6
|
import { isUnsafePlatformId } from "../../core/platform-id.js";
|
|
7
7
|
import { CHART_RESOURCE_TYPE } from "./types.js";
|
|
8
|
+
import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
|
|
8
9
|
const APP_RESOURCE_TYPE = "elementum_app";
|
|
9
10
|
const TABLE_RESOURCE_TYPE = "elementum_table";
|
|
10
11
|
function datasourceId(ref, opts, where) {
|
|
@@ -14,23 +15,24 @@ function datasourceId(ref, opts, where) {
|
|
|
14
15
|
if (ref.__kind !== "app" && ref.__kind !== "element" && ref.__kind !== "table" && ref.__kind !== "task") {
|
|
15
16
|
throw new EntityTfError(`${where}: unsupported datasource kind ${JSON.stringify(ref.__kind)}`);
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
+
const kind = ref.__kind;
|
|
19
|
+
const local = opts.workspaceAspects?.get(workspaceAspectKey(kind, ref.refName));
|
|
18
20
|
if (local !== undefined) {
|
|
19
21
|
const type = ref.__kind === "app" ? APP_RESOURCE_TYPE : ref.__kind === "element" ? "elementum_element" : ref.__kind === "task" ? "elementum_task" : TABLE_RESOURCE_TYPE;
|
|
20
|
-
return { ref, id: expr.resourceAttr(type, local.tfLabel, ["id"]), tfLabel: local.tfLabel, local: true };
|
|
22
|
+
return { ref, kind, id: expr.resourceAttr(type, local.tfLabel, ["id"]), tfLabel: local.tfLabel, local: true };
|
|
21
23
|
}
|
|
22
24
|
const name = ref.name ?? ref.refName;
|
|
25
|
+
if (ref.__kind === "app" || ref.__kind === "element") {
|
|
26
|
+
const foreign = resolveForeignRef(ref.__kind, { name, namespace: ref.namespace }, opts.orgRefs, opts.diagnostics, where);
|
|
27
|
+
return { ref, kind, id: foreign.value, tfLabel: foreign.tfLabel, local: false };
|
|
28
|
+
}
|
|
23
29
|
const label = sanitizeName(name);
|
|
24
|
-
if (ref.__kind === "
|
|
25
|
-
opts.orgRefs.foreignApp(label, name);
|
|
26
|
-
else if (ref.__kind === "element")
|
|
27
|
-
opts.orgRefs.foreignElement(label, name);
|
|
28
|
-
else if (ref.__kind === "task")
|
|
30
|
+
if (ref.__kind === "task")
|
|
29
31
|
opts.orgRefs.rawLookup("elementum_task", label, name);
|
|
30
32
|
else
|
|
31
33
|
opts.orgRefs.rawLookup(TABLE_RESOURCE_TYPE, label, name);
|
|
32
|
-
const type = ref.__kind === "
|
|
33
|
-
return { ref, id: expr.dataAttr(type, label, ["id"]), tfLabel: label, local: false };
|
|
34
|
+
const type = ref.__kind === "task" ? "elementum_task" : TABLE_RESOURCE_TYPE;
|
|
35
|
+
return { ref, kind, id: expr.dataAttr(type, label, ["id"]), tfLabel: label, local: false };
|
|
34
36
|
}
|
|
35
37
|
function fieldId(ref, datasource, opts, where) {
|
|
36
38
|
if (ref?.refName === undefined || ref.refName === "")
|
|
@@ -54,7 +56,7 @@ function fieldId(ref, datasource, opts, where) {
|
|
|
54
56
|
if (direct !== undefined)
|
|
55
57
|
return direct;
|
|
56
58
|
}
|
|
57
|
-
const label =
|
|
59
|
+
const label = foreignFieldDataLabel(datasource.kind, datasource.tfLabel, ref.name ?? ref.refName);
|
|
58
60
|
opts.orgRefs.foreignField("elementum_field", label, datasource.id, ref.name ?? ref.refName);
|
|
59
61
|
return expr.dataAttr("elementum_field", label, ["id"]);
|
|
60
62
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AppCatalogRef, AppOrElementRef, ChartRef, FieldRef } from "../../catalog/index.js";
|
|
2
2
|
import type { Filter } from "../shared/filters/types.js";
|
|
3
|
+
import type { ManagedViewSort } from "../view/build.js";
|
|
3
4
|
declare const dashboardWidgetSizeBrand: unique symbol;
|
|
4
5
|
declare const dashboardWidgetBrand: unique symbol;
|
|
5
6
|
type DashboardWidgetSizeValue = "EXTRA_SMALL" | "SMALL" | "MEDIUM" | "LARGE" | "EXTRA_LARGE";
|
|
@@ -24,6 +25,7 @@ export interface DashboardRecordsWidget<Target extends AppOrElementRef = AppOrEl
|
|
|
24
25
|
readonly type: "records";
|
|
25
26
|
readonly target: Target;
|
|
26
27
|
readonly filter?: Filter<FieldRef<Target["refName"]>, never>;
|
|
28
|
+
readonly sort?: ManagedViewSort;
|
|
27
29
|
}
|
|
28
30
|
export interface DashboardChartWidget<Parent extends string = string> extends DashboardWidgetBase {
|
|
29
31
|
readonly [dashboardWidgetBrand]: "chart";
|
|
@@ -34,6 +36,8 @@ export interface DashboardChartWidget<Parent extends string = string> extends Da
|
|
|
34
36
|
export declare function dashboardRecordsWidget<const Target extends AppOrElementRef>(opts: DashboardWidgetBase & {
|
|
35
37
|
readonly target: Target;
|
|
36
38
|
readonly filter?: Filter<FieldRef<NoInfer<Target>["refName"]>, never>;
|
|
39
|
+
/** Record order. Fields resolve against the dashboard's own app, so a non-empty sort requires `target` to be that app. */
|
|
40
|
+
readonly sort?: ManagedViewSort;
|
|
37
41
|
}): DashboardRecordsWidget<Target>;
|
|
38
42
|
/** Build a chart widget and enforce that chart and dashboard share an app owner. */
|
|
39
43
|
export declare function dashboardChartWidget<const Parent extends string>(opts: DashboardWidgetBase & {
|
|
@@ -8,6 +8,7 @@ import { DASHBOARD_RESOURCE_TYPE } from "./module.js";
|
|
|
8
8
|
import { CHART_RESOURCE_TYPE } from "../chart/types.js";
|
|
9
9
|
import { dashboardWidgetSize } from "./build.js";
|
|
10
10
|
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
11
|
+
import { managedViewSortFromTf } from "../view/from-tf.js";
|
|
11
12
|
const KNOWN_DASHBOARD_ATTRS = new Set(["name", "owner_id", "owner_type", "favorite", "tags"]);
|
|
12
13
|
export function dashboardsFromTf(blocks, widgetBlocks, owner, ctx) {
|
|
13
14
|
const dashboards = [];
|
|
@@ -68,16 +69,26 @@ function dashboardWidgetsFromTf(blocks, dashboardLabel, owner, ctx) {
|
|
|
68
69
|
ctx.diagnostics.push(`${where}: expected an aspect_widget or chart_widget; skipped`);
|
|
69
70
|
return [];
|
|
70
71
|
}
|
|
71
|
-
if (aspect["sort"] !== undefined) {
|
|
72
|
-
ctx.diagnostics.push(`${where}.aspect_widget.sort: dashboard record sort has no typed public contract; skipped`);
|
|
73
|
-
return [];
|
|
74
|
-
}
|
|
75
72
|
const target = aspectRef(aspect["aspect_id"], owner, ctx);
|
|
76
73
|
if (target === undefined) {
|
|
77
74
|
ctx.diagnostics.push(`${where}.aspect_widget.aspect_id: unresolved; skipped`);
|
|
78
75
|
return [];
|
|
79
76
|
}
|
|
77
|
+
// An unsupported sort is dropped on its own: skipping the widget would
|
|
78
|
+
// make the next apply destroy it.
|
|
79
|
+
let sort;
|
|
80
|
+
if (aspect["sort"] !== undefined) {
|
|
81
|
+
const targetsOwner = resourceRefLabel(aspect["aspect_id"], owner.type) === owner.label;
|
|
82
|
+
const decoded = managedViewSortFromTf(aspect["sort"], owner, `${where}.aspect_widget.sort`, ctx);
|
|
83
|
+
if (decoded !== undefined && !targetsOwner && decoded.orders.length > 0) {
|
|
84
|
+
ctx.diagnostics.push(`${where}.aspect_widget.sort: ordering a foreign target's records has no typed public contract; sort dropped, widget kept`);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
sort = decoded;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
80
90
|
return [{ ...style, type: "records", target,
|
|
91
|
+
...(sort !== undefined && { sort }),
|
|
81
92
|
...(aspect["filter"] !== undefined && {
|
|
82
93
|
filter: filterFromTf(filterWireToTf(decodeJson(aspect["filter"])), { ...owner, ownerRefName: owner.ownerRefName ?? owner.ownerTfLabel, foreignFieldRefsById: ctx.foreignFieldRefsById }, `${where}.aspect_widget.filter`, ctx),
|
|
83
94
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
2
2
|
import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
3
3
|
import type { Filter } from "../shared/filters/types.js";
|
|
4
|
+
import type { ManagedViewSort } from "../view/build.js";
|
|
4
5
|
export interface AppDashboardWire {
|
|
5
6
|
readonly name?: string;
|
|
6
7
|
readonly favorite?: boolean;
|
|
@@ -24,6 +25,7 @@ type DashboardWidgetWire = (DashboardWidgetWireBase & {
|
|
|
24
25
|
readonly type: "records";
|
|
25
26
|
readonly target?: RefWire | string;
|
|
26
27
|
readonly filter?: Filter;
|
|
28
|
+
readonly sort?: ManagedViewSort;
|
|
27
29
|
}) | (DashboardWidgetWireBase & {
|
|
28
30
|
readonly type: "chart";
|
|
29
31
|
readonly chart?: RefWire | string;
|
|
@@ -6,6 +6,7 @@ import { DASHBOARD_WIDGET_RESOURCE_TYPE } from "../dashboard-widget/module.js";
|
|
|
6
6
|
import { resolveForeignRef } from "../shared/foreign-ref.js";
|
|
7
7
|
import { DASHBOARD_RESOURCE_TYPE } from "./module.js";
|
|
8
8
|
import { CHART_RESOURCE_TYPE } from "../chart/types.js";
|
|
9
|
+
import { managedViewSortToTf } from "../view/to-tf.js";
|
|
9
10
|
export function dashboardsToTf(dashboards, opts) {
|
|
10
11
|
const blocks = [];
|
|
11
12
|
for (const [key, dashboard] of Object.entries(dashboards ?? {})) {
|
|
@@ -60,6 +61,12 @@ export function dashboardsToTf(dashboards, opts) {
|
|
|
60
61
|
});
|
|
61
62
|
body["filter"] = expr.jsonencode(filterTfToWire(hclFilter));
|
|
62
63
|
}
|
|
64
|
+
if (widget.sort !== undefined && widget.sort.orders.length > 0 && !targetsOwner(widget.target, opts)) {
|
|
65
|
+
opts.diagnostics.push(`${where}.sort: sort fields resolve against the dashboard's own app; a foreign target cannot be ordered; sort dropped, widget kept`);
|
|
66
|
+
}
|
|
67
|
+
else if (widget.sort !== undefined) {
|
|
68
|
+
body["sort"] = managedViewSortToTf(widget.sort, opts.ownerTfLabel, opts.scope, `${where}.sort`, opts.diagnostics);
|
|
69
|
+
}
|
|
63
70
|
widgetAttrs["aspect_widget"] = body;
|
|
64
71
|
}
|
|
65
72
|
else if (widget.type === "chart") {
|
|
@@ -105,6 +112,12 @@ function resolveChart(value, where, opts) {
|
|
|
105
112
|
}
|
|
106
113
|
return expr.resourceAttr(CHART_RESOURCE_TYPE, scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(refName), opts.scope), ["id"]);
|
|
107
114
|
}
|
|
115
|
+
function targetsOwner(value, opts) {
|
|
116
|
+
if (typeof value === "string" || value === undefined)
|
|
117
|
+
return false;
|
|
118
|
+
const kind = value.__kind === "element" ? "element" : "app";
|
|
119
|
+
return kind === opts.scope && value.refName === (opts.ownerRefName ?? opts.ownerTfLabel);
|
|
120
|
+
}
|
|
108
121
|
function resolveAspect(value, where, opts) {
|
|
109
122
|
if (typeof value === "string") {
|
|
110
123
|
opts.diagnostics.push(`${where}: raw aspect ids are not supported in public authoring; dropped`);
|
|
@@ -7,4 +7,8 @@ export const dashboardWidgetModule = {
|
|
|
7
7
|
parents: [{ parent: "dashboard", child: "dashboard-widget" }],
|
|
8
8
|
resource: { shape: "single", resourceType: DASHBOARD_WIDGET_RESOURCE_TYPE, adoptable: true },
|
|
9
9
|
data: NO_DATA, lifecycle: NO_LIFECYCLE, canvas: NO_CANVAS, catalog: NO_CATALOG,
|
|
10
|
+
roundtrip: {
|
|
11
|
+
referenceAliases: [],
|
|
12
|
+
nestedOmittedDefaults: [{ attribute: "aspect_widget", defaults: { not: false, semantic: false } }],
|
|
13
|
+
},
|
|
10
14
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AgentRef, AppOrElementRef, AutomationRef } from "../../catalog/index.js";
|
|
1
|
+
import type { AgentRef, AppOrElementRef, AutomationRef, FieldRef, WidgetRef } from "../../catalog/index.js";
|
|
2
2
|
import type { AppViewFieldRef } from "../app/build.js";
|
|
3
|
+
import type { Filter } from "../shared/filters/types.js";
|
|
3
4
|
export type DynamicLayoutTypedValue = {
|
|
4
5
|
readonly string: string;
|
|
5
6
|
} | {
|
|
@@ -51,6 +52,24 @@ export interface DynamicLayoutFieldComponent {
|
|
|
51
52
|
readonly fullWidth?: boolean;
|
|
52
53
|
readonly dependsOn?: readonly string[];
|
|
53
54
|
}
|
|
55
|
+
/** One automation trigger parameter an automation button supplies. */
|
|
56
|
+
export interface DynamicLayoutAutomationButtonInput {
|
|
57
|
+
/** On-demand trigger parameter of the button's automation (or of `automation`). */
|
|
58
|
+
readonly parameterName: string;
|
|
59
|
+
/** Automation whose on-demand trigger declares the parameter, when it is not the button's own. */
|
|
60
|
+
readonly automation?: AutomationRef;
|
|
61
|
+
/** Platform parameter id, only for a parameter the automation's trigger does not declare by name in this source. */
|
|
62
|
+
readonly parameterId?: string;
|
|
63
|
+
readonly fieldType?: string;
|
|
64
|
+
readonly multiple?: boolean;
|
|
65
|
+
readonly required?: boolean;
|
|
66
|
+
/** Value template; `{{name}}` placeholders are filled from `fieldRefParams`. */
|
|
67
|
+
readonly value?: string;
|
|
68
|
+
readonly fieldRefParams?: readonly {
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly field: AppViewFieldRef;
|
|
71
|
+
}[];
|
|
72
|
+
}
|
|
54
73
|
interface DynamicLayoutComponentCommon<ComponentKey extends string = string, ConditionKey extends string = string, SaveGroupKey extends string = string> {
|
|
55
74
|
readonly children?: readonly ComponentKey[];
|
|
56
75
|
readonly style?: DynamicLayoutStyle;
|
|
@@ -122,6 +141,16 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
122
141
|
readonly variant?: "default" | "outline" | "ghost" | "destructive";
|
|
123
142
|
readonly icon?: string;
|
|
124
143
|
readonly confirmMessage?: string;
|
|
144
|
+
/** App or element that owns the automation, as the layout editor records it. */
|
|
145
|
+
readonly automationApp?: AppOrElementRef;
|
|
146
|
+
readonly color?: string;
|
|
147
|
+
/** Column count of the parent grid the button sits in (1-12). */
|
|
148
|
+
readonly columns?: number;
|
|
149
|
+
/** Grid columns the button spans (1-12). */
|
|
150
|
+
readonly span?: number;
|
|
151
|
+
readonly inputs?: readonly DynamicLayoutAutomationButtonInput[];
|
|
152
|
+
/** Run-automation widget the button executes through; omit to have build derive one. */
|
|
153
|
+
readonly widget?: WidgetRef;
|
|
125
154
|
};
|
|
126
155
|
readonly createButton: {
|
|
127
156
|
readonly target: AppOrElementRef;
|
|
@@ -167,12 +196,14 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
167
196
|
};
|
|
168
197
|
readonly activityLogBlock: {
|
|
169
198
|
readonly label?: string;
|
|
199
|
+
readonly title?: string;
|
|
170
200
|
};
|
|
171
201
|
readonly approvalsBlock: {
|
|
172
202
|
readonly label?: string;
|
|
173
203
|
};
|
|
174
204
|
readonly attachmentsBlock: {
|
|
175
205
|
readonly label?: string;
|
|
206
|
+
readonly title?: string;
|
|
176
207
|
};
|
|
177
208
|
readonly relatedTasksBlock: {
|
|
178
209
|
readonly label?: string;
|
|
@@ -182,6 +213,14 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
182
213
|
};
|
|
183
214
|
readonly relatedItemsBlock: {
|
|
184
215
|
readonly label?: string;
|
|
216
|
+
readonly title?: string;
|
|
217
|
+
readonly fieldName?: string;
|
|
218
|
+
readonly color?: string;
|
|
219
|
+
readonly fullWidth?: boolean;
|
|
220
|
+
/** App or element whose related records the block lists. */
|
|
221
|
+
readonly related?: AppOrElementRef;
|
|
222
|
+
/** Record filter over the related app's or element's fields. */
|
|
223
|
+
readonly filter?: Filter<FieldRef, never>;
|
|
185
224
|
};
|
|
186
225
|
readonly surveysBlock: {
|
|
187
226
|
readonly label?: string;
|
|
@@ -290,6 +329,10 @@ export interface AppDynamicLayout {
|
|
|
290
329
|
readonly description?: string;
|
|
291
330
|
};
|
|
292
331
|
}
|
|
332
|
+
/** Element-owned DASHBOARD layout. Elements have no stages, so it is always the element's default layout. */
|
|
333
|
+
export type ElementDynamicLayout = Omit<AppDynamicLayout, "stage"> & {
|
|
334
|
+
readonly stage?: never;
|
|
335
|
+
};
|
|
293
336
|
type DynamicLayoutInput<Components extends Readonly<Record<string, DynamicLayoutComponent>>, Conditions extends Readonly<Record<string, DynamicLayoutCondition>>, SaveGroups extends Readonly<Record<string, DynamicLayoutSaveGroup>>> = Omit<AppDynamicLayout, "rootComponent" | "components" | "conditions" | "saveGroups"> & {
|
|
294
337
|
readonly rootComponent: Extract<keyof Components, string>;
|
|
295
338
|
readonly components: {
|
|
@@ -300,6 +343,12 @@ type DynamicLayoutInput<Components extends Readonly<Record<string, DynamicLayout
|
|
|
300
343
|
};
|
|
301
344
|
readonly saveGroups?: SaveGroups;
|
|
302
345
|
};
|
|
346
|
+
/** A stage-free layout fits both owners; a staged one is app-only. */
|
|
347
|
+
type DynamicLayoutResult<Stage extends string | undefined> = [
|
|
348
|
+
Stage
|
|
349
|
+
] extends [undefined] ? ElementDynamicLayout : AppDynamicLayout;
|
|
303
350
|
/** Preserve graph keys so child, condition, save-group, and root references are checked. */
|
|
304
|
-
export declare function dynamicLayout<const Components extends Readonly<Record<string, DynamicLayoutComponent>>, const Conditions extends Readonly<Record<string, DynamicLayoutCondition>> = Record<never, never>, const SaveGroups extends Readonly<Record<string, DynamicLayoutSaveGroup>> = Record<never, never
|
|
351
|
+
export declare function dynamicLayout<const Components extends Readonly<Record<string, DynamicLayoutComponent>>, const Conditions extends Readonly<Record<string, DynamicLayoutCondition>> = Record<never, never>, const SaveGroups extends Readonly<Record<string, DynamicLayoutSaveGroup>> = Record<never, never>, const Stage extends string | undefined = undefined>(layout: DynamicLayoutInput<Components, Conditions, SaveGroups> & {
|
|
352
|
+
readonly stage?: Stage;
|
|
353
|
+
}): DynamicLayoutResult<Stage>;
|
|
305
354
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ChildResourceScope } from "../../engine/tf/index.js";
|
|
1
2
|
export declare const DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY: ReadonlyMap<string, string>;
|
|
2
3
|
export declare const DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS: ReadonlySet<string>;
|
|
3
4
|
export declare function dynamicLayoutFieldComponentWireKey(publicKey: string): string;
|
|
@@ -10,3 +11,5 @@ export declare const DYNAMIC_LAYOUT_COMPARISON_KEYS: ReadonlySet<string>;
|
|
|
10
11
|
*/
|
|
11
12
|
export declare const DYNAMIC_LAYOUT_ACTION_WIDGET_NAME_PREFIX = "EDK dynamic layout action ";
|
|
12
13
|
export declare function dynamicLayoutActionWidgetName(layoutKey: string, componentId: string): string;
|
|
14
|
+
/** Terraform label of the companion widget build derives for one automation button. */
|
|
15
|
+
export declare function dynamicLayoutCompanionWidgetLabel(ownerTfLabel: string, layoutKey: string, componentId: string, scope: ChildResourceScope): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sanitizeName, scopedResourceLabel } from "../../engine/tf/index.js";
|
|
1
2
|
import { splitCamelCase } from "../../engine/tf/labels.js";
|
|
2
3
|
/**
|
|
3
4
|
* Public field-component keys are listed exhaustively against the authoring
|
|
@@ -57,3 +58,7 @@ export function dynamicLayoutActionWidgetName(layoutKey, componentId) {
|
|
|
57
58
|
const words = (value) => splitCamelCase(value.replace(/[_-]+/g, " ")).toLowerCase();
|
|
58
59
|
return `${DYNAMIC_LAYOUT_ACTION_WIDGET_NAME_PREFIX}${words(layoutKey)} ${words(componentId)}`;
|
|
59
60
|
}
|
|
61
|
+
/** Terraform label of the companion widget build derives for one automation button. */
|
|
62
|
+
export function dynamicLayoutCompanionWidgetLabel(ownerTfLabel, layoutKey, componentId, scope) {
|
|
63
|
+
return scopedResourceLabel(ownerTfLabel, sanitizeName(dynamicLayoutActionWidgetName(layoutKey, componentId)), scope);
|
|
64
|
+
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
-
import { type TfBlock } from "../../engine/tf/index.js";
|
|
2
|
+
import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
|
|
3
3
|
import type { NormalizedDynamicLayout } from "../app/deserializer/normalize.js";
|
|
4
4
|
export interface DynamicLayoutOwner {
|
|
5
5
|
readonly type: string;
|
|
6
6
|
readonly label: string;
|
|
7
7
|
readonly ownerRefName: string;
|
|
8
8
|
readonly ownerTfLabel: string;
|
|
9
|
+
/** Owning stream root kind; defaults to `"app"`. */
|
|
10
|
+
readonly scope?: ChildResourceScope;
|
|
9
11
|
}
|
|
10
12
|
export declare function dynamicLayoutsFromTf(blocks: readonly TfBlock[], owner: DynamicLayoutOwner, ctx: FromTfContext): NormalizedDynamicLayout[];
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
13
|
-
* The label is the companion
|
|
14
|
-
* name is mutable and cannot safely
|
|
15
|
-
* widgets during pull.
|
|
14
|
+
* Labels of the companion widgets build derives for dynamic-layout automation
|
|
15
|
+
* buttons, among those the buttons reference. The label is the companion's
|
|
16
|
+
* stable Terraform identity; its display name is mutable and cannot safely
|
|
17
|
+
* distinguish generated from authored widgets during pull. A button bound to
|
|
18
|
+
* any other widget keeps that widget as authored source.
|
|
16
19
|
*/
|
|
17
|
-
export declare function dynamicLayoutCompanionWidgetLabels(blocks: readonly TfBlock[]): ReadonlySet<string>;
|
|
20
|
+
export declare function dynamicLayoutCompanionWidgetLabels(blocks: readonly TfBlock[], owner: DynamicLayoutOwner): ReadonlySet<string>;
|