@elementumai/edk 0.13.1 → 0.13.3
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/dist-sdk/src/engine/coverage-gaps.d.ts +10 -0
- package/dist-sdk/src/engine/coverage-gaps.js +19 -0
- package/dist-sdk/src/engine/progress.d.ts +1 -0
- package/dist-sdk/src/engine/progress.js +6 -0
- package/dist-sdk/src/engine/pull/context.d.ts +10 -4
- package/dist-sdk/src/engine/pull/context.js +2 -0
- 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/pull/stream-root.d.ts +3 -1
- package/dist-sdk/src/engine/pull/stream-root.js +3 -0
- package/dist-sdk/src/engine/tf/escape.d.ts +8 -3
- package/dist-sdk/src/engine/tf/escape.js +17 -4
- package/dist-sdk/src/entities/app/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +8 -0
- package/dist-sdk/src/entities/automation/module.js +29 -7
- package/dist-sdk/src/entities/automation/omitted-ref.d.ts +12 -0
- package/dist-sdk/src/entities/automation/omitted-ref.js +21 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/to-tf.js +101 -33
- package/dist-sdk/src/entities/automation/triggers.d.ts +5 -1
- package/dist-sdk/src/entities/automation/workflow-output.d.ts +7 -0
- package/dist-sdk/src/entities/automation/workflow-output.js +8 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +12 -7
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +37 -21
- package/dist-sdk/src/entities/dynamic-layout/lint.d.ts +7 -0
- package/dist-sdk/src/entities/dynamic-layout/lint.js +48 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +11 -3
- package/dist-sdk/src/entities/element/index.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +1 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +3 -3
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +6 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +6 -1
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +14 -2
- package/dist-sdk/src/entities/view/custom-view-references.d.ts +33 -0
- package/dist-sdk/src/entities/view/custom-view-references.js +140 -0
- package/dist-sdk/src/entities/view/custom-view-validate.d.ts +10 -5
- package/dist-sdk/src/entities/view/custom-view-validate.js +2 -0
- package/dist-sdk/src/entities/view/layout-lint.d.ts +26 -0
- package/dist-sdk/src/entities/view/layout-lint.js +50 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/to-tf.js +3 -0
- package/dist-sdk/src/entities/visual-flow/build.d.ts +8 -1
- package/dist-sdk/src/entities/visual-flow/from-tf.js +16 -0
- package/dist-sdk/src/entities/visual-flow/initiate.d.ts +12 -0
- package/dist-sdk/src/entities/visual-flow/initiate.js +12 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +16 -2
- package/dist-sdk/src/entities/widget/from-tf.js +8 -4
- package/dist-sdk/src/graph/index.d.ts +1 -1
- package/dist-sdk/src/graph/types.d.ts +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* check.mjs Layer 3 at build, from source (#1784 items 1-2, part of #1758):
|
|
3
|
+
*
|
|
4
|
+
* - calc names: every `"Name"` inside a block's `calc` should be a field of
|
|
5
|
+
* the app or element the block reads from. Build knows only the owner's
|
|
6
|
+
* authored fields, and pull can leave some fields unextracted (#1736/#1966),
|
|
7
|
+
* so build warns; plan fails a calc name that is not an exact live field
|
|
8
|
+
* name, including a case difference. A block that reads
|
|
9
|
+
* from another app or a raw id is checked only at plan.
|
|
10
|
+
* - tag-dependent helpers: a preset, sort option or table column that needs a
|
|
11
|
+
* tagged field the owner does not have. Warnings, as in check.mjs. App
|
|
12
|
+
* system tags (STATUS, CREATED_AT, CLOSED_AT, ...) exist on every app, so
|
|
13
|
+
* build skips them for apps; an element has only HANDLE and TITLE, plus the
|
|
14
|
+
* audit tags when it declares `systemFields.audit`. The Open/Closed toggle's
|
|
15
|
+
* STATUS option tagged CLOSED is only checked at plan.
|
|
16
|
+
*
|
|
17
|
+
* Typed field refs already fail the build when they don't resolve, and field
|
|
18
|
+
* and option ids written as unsafePlatformId(...) can only be checked against
|
|
19
|
+
* the live App, so the provider does those at plan.
|
|
20
|
+
*/
|
|
21
|
+
import type { BuildFieldMetadata } from "../../graph/types.js";
|
|
22
|
+
export interface CustomViewReferenceOptions {
|
|
23
|
+
/** The view owner's catalog key and kind; blocks reading another source are checked at plan. */
|
|
24
|
+
readonly ownerRefName?: string;
|
|
25
|
+
readonly ownerKind?: "app" | "element";
|
|
26
|
+
/** Element owners only: the element declares `systemFields.audit` (Created/Updated on/by). */
|
|
27
|
+
readonly ownerAuditFields?: boolean;
|
|
28
|
+
/** Field bag key → display name (system keys included when source names them). */
|
|
29
|
+
readonly fieldNames?: ReadonlyMap<string, string>;
|
|
30
|
+
readonly fieldMetadata?: ReadonlyMap<string, BuildFieldMetadata>;
|
|
31
|
+
}
|
|
32
|
+
/** Layer 3 from source. Everything here is a build warning; plan is authoritative against the live App. */
|
|
33
|
+
export declare function checkCustomViewReferences(elements: Readonly<Record<string, unknown>>, where: string, opts: CustomViewReferenceOptions, warn: (at: string, msg: string) => void): void;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { DEFAULT_SYSTEM_FIELD_NAME_BY_TAG, DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS, SYSTEM_FIELD_TAG_BY_KEY, } from "../../core/system-fields.js";
|
|
2
|
+
import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
|
|
3
|
+
/** check.mjs SYSTEM_KEY_TAG: system keys in sort options and table columns, and the tag each needs. */
|
|
4
|
+
const SYSTEM_KEY_TAG = {
|
|
5
|
+
handle: "HANDLE",
|
|
6
|
+
title: "TITLE",
|
|
7
|
+
status: "STATUS",
|
|
8
|
+
priority: "PRIORITY",
|
|
9
|
+
stage: "STAGE",
|
|
10
|
+
assignee: "ASSIGNEE",
|
|
11
|
+
assignmentGroup: "ASSIGNMENT_GROUP",
|
|
12
|
+
createdBy: "CREATED_BY",
|
|
13
|
+
createdTime: "CREATED_AT",
|
|
14
|
+
updatedAt: "UPDATED_AT",
|
|
15
|
+
};
|
|
16
|
+
/** Tags every app has as a system field; plan checks these against the live App. */
|
|
17
|
+
const APP_SYSTEM_TAGS = new Set(Object.values(SYSTEM_FIELD_TAG_BY_KEY));
|
|
18
|
+
/** The system fields an element has: id and title, plus the audit fields when it declares them. */
|
|
19
|
+
function elementSystemKeys(auditFields) {
|
|
20
|
+
return auditFields ? ELEMENT_SYSTEM_FIELD_KEYS : ["id", "title"];
|
|
21
|
+
}
|
|
22
|
+
function ownerSystemKeys(opts) {
|
|
23
|
+
return opts.ownerKind === "element" ? elementSystemKeys(opts.ownerAuditFields === true) : SYSTEM_FIELD_KEYS;
|
|
24
|
+
}
|
|
25
|
+
const CALC_NAME = /"([^"]+)"/g;
|
|
26
|
+
/** check.mjs PRESET_TAG. */
|
|
27
|
+
function presetTag(preset) {
|
|
28
|
+
if (preset.startsWith("created"))
|
|
29
|
+
return preset === "createdByCurrentUser" ? "CREATED_BY" : "CREATED_AT";
|
|
30
|
+
if (preset.startsWith("closed"))
|
|
31
|
+
return "CLOSED_AT";
|
|
32
|
+
return "ASSIGNEE";
|
|
33
|
+
}
|
|
34
|
+
function isObj(v) {
|
|
35
|
+
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Whether a block reads from the view's owner: no source prop, the host
|
|
39
|
+
* binding (`{ $state: "/host/aspectId" }`), or a typed ref to the owner.
|
|
40
|
+
* A raw id or another app's ref is someone else's fields.
|
|
41
|
+
*/
|
|
42
|
+
function readsOwner(props, opts) {
|
|
43
|
+
const source = props["aspectId"] ?? props["filterAspectId"];
|
|
44
|
+
if (source == null)
|
|
45
|
+
return true;
|
|
46
|
+
if (!isObj(source))
|
|
47
|
+
return false;
|
|
48
|
+
if (source["$state"] === "/host/aspectId" || source["$bindState"] === "/host/aspectId")
|
|
49
|
+
return true;
|
|
50
|
+
const kind = source["__kind"];
|
|
51
|
+
return (kind === "app" || kind === "element")
|
|
52
|
+
&& kind === (opts.ownerKind ?? "app")
|
|
53
|
+
&& opts.ownerRefName !== undefined
|
|
54
|
+
&& source["refName"] === opts.ownerRefName;
|
|
55
|
+
}
|
|
56
|
+
/** Every name a field of the owner may carry: authored names, plus defaults for the owner's system fields source leaves unnamed. */
|
|
57
|
+
function ownerFieldNames(opts) {
|
|
58
|
+
const names = new Set(opts.fieldNames?.values() ?? []);
|
|
59
|
+
for (const key of ownerSystemKeys(opts)) {
|
|
60
|
+
if (opts.fieldNames?.has(key) === true)
|
|
61
|
+
continue;
|
|
62
|
+
const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
|
|
63
|
+
// A platform-composed app and an EDK deploy name system fields differently.
|
|
64
|
+
names.add(DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key]);
|
|
65
|
+
const composed = DEFAULT_SYSTEM_FIELD_NAME_BY_TAG[tag];
|
|
66
|
+
if (composed !== undefined)
|
|
67
|
+
names.add(composed);
|
|
68
|
+
}
|
|
69
|
+
return names;
|
|
70
|
+
}
|
|
71
|
+
/** Layer 3 from source. Everything here is a build warning; plan is authoritative against the live App. */
|
|
72
|
+
export function checkCustomViewReferences(elements, where, opts, warn) {
|
|
73
|
+
if (opts.fieldNames === undefined)
|
|
74
|
+
return;
|
|
75
|
+
const owner = opts.ownerKind === "element" ? "this element" : "this app";
|
|
76
|
+
const names = ownerFieldNames(opts);
|
|
77
|
+
const lowerNames = new Map([...names].map((name) => [name.toLowerCase(), name]));
|
|
78
|
+
// Tags the owner has: authored ones, plus its system fields'. Every app has
|
|
79
|
+
// all the system tags, so for an app those are plan's to check.
|
|
80
|
+
const ownerTags = new Set(opts.ownerKind === "element" ? ownerSystemKeys(opts).map((key) => SYSTEM_FIELD_TAG_BY_KEY[key]) : APP_SYSTEM_TAGS);
|
|
81
|
+
for (const meta of opts.fieldMetadata?.values() ?? [])
|
|
82
|
+
for (const tag of meta.tags ?? [])
|
|
83
|
+
ownerTags.add(tag);
|
|
84
|
+
const grouped = new Map();
|
|
85
|
+
const need = (at, tag, what) => {
|
|
86
|
+
if (ownerTags.has(tag))
|
|
87
|
+
return;
|
|
88
|
+
const message = `${what} relies on a field tagged ${tag}, and ${owner} has none, so it will show nothing or do nothing`;
|
|
89
|
+
let places = grouped.get(message);
|
|
90
|
+
if (places === undefined)
|
|
91
|
+
grouped.set(message, (places = new Set()));
|
|
92
|
+
places.add(at);
|
|
93
|
+
};
|
|
94
|
+
for (const [id, raw] of Object.entries(elements)) {
|
|
95
|
+
if (!isObj(raw) || !isObj(raw["props"]))
|
|
96
|
+
continue;
|
|
97
|
+
const props = raw["props"];
|
|
98
|
+
if (!readsOwner(props, opts))
|
|
99
|
+
continue;
|
|
100
|
+
const elWhere = `${where}.elements.${id}`;
|
|
101
|
+
if (typeof props["calc"] === "string") {
|
|
102
|
+
for (const match of props["calc"].matchAll(CALC_NAME)) {
|
|
103
|
+
const name = match[1];
|
|
104
|
+
if (names.has(name))
|
|
105
|
+
continue;
|
|
106
|
+
const loose = lowerNames.get(name.toLowerCase());
|
|
107
|
+
// A warning, not an error: a pulled owner can have live fields pull left
|
|
108
|
+
// unextracted (#1736/#1966). Plan fails a calc name that is not an exact
|
|
109
|
+
// live field name, including a case difference.
|
|
110
|
+
warn(`${elWhere}.calc`, loose !== undefined
|
|
111
|
+
? `no field "${name}"; did you mean "${loose}"? Calc names are field display names and are case-sensitive. Plan fails a calc name that is not an exact live field name, including a case difference`
|
|
112
|
+
: `no field named "${name}" among ${owner}'s authored fields; calc names a field by its display name. Plan fails a calc name that is not an exact live field name, including a case difference`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const presets = [props["filterPreset"]].flat().filter((v) => typeof v === "string");
|
|
116
|
+
for (const preset of presets)
|
|
117
|
+
need(elWhere, presetTag(preset), `preset "${preset}"`);
|
|
118
|
+
if (Array.isArray(props["sortByOptions"])) {
|
|
119
|
+
for (const option of props["sortByOptions"]) {
|
|
120
|
+
const value = isObj(option) ? option["value"] : undefined;
|
|
121
|
+
const tag = typeof value === "string" ? SYSTEM_KEY_TAG[value] : undefined;
|
|
122
|
+
if (tag !== undefined)
|
|
123
|
+
need(elWhere, tag, `sort option "${value}"`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (raw["type"] === "DataTableBlock" && Array.isArray(props["columns"])) {
|
|
127
|
+
for (const column of props["columns"]) {
|
|
128
|
+
const key = typeof column === "string" ? column : isObj(column) ? column["key"] : undefined;
|
|
129
|
+
const tag = typeof key === "string" ? SYSTEM_KEY_TAG[key] : undefined;
|
|
130
|
+
if (tag !== undefined)
|
|
131
|
+
need(elWhere, tag, `column "${key}"`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Group identical problems so a repeated section reports once (check.mjs).
|
|
136
|
+
for (const [message, places] of grouped) {
|
|
137
|
+
const list = [...places];
|
|
138
|
+
warn(list.length > 3 ? `${list.slice(0, 3).join(", ")} and ${list.length - 3} more` : list.join(", "), message);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -8,14 +8,19 @@
|
|
|
8
8
|
* page reads a missing path as undefined). Agent views keep the softer
|
|
9
9
|
* diagnostics in checkStructure / reportStructureProblems.
|
|
10
10
|
*
|
|
11
|
-
* Layer 3
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Layer 3 from source (calc names, tag-dependent helpers) is in
|
|
12
|
+
* custom-view-references.ts (#1784); typed field refs already fail via
|
|
13
|
+
* resolveField, and raw ids are checked at plan against the live App.
|
|
14
|
+
* Syntax-only calc rules (AVG / empty COUNT) live here.
|
|
15
15
|
*/
|
|
16
16
|
import type { BuildFieldMetadata } from "../../graph/types.js";
|
|
17
17
|
export interface CustomViewValidateOptions {
|
|
18
|
-
/**
|
|
18
|
+
/** The view owner; Layer 3 checks blocks that read from it (#1784). */
|
|
19
|
+
readonly ownerRefName?: string;
|
|
20
|
+
readonly ownerKind?: "app" | "element";
|
|
21
|
+
/** Element owners only: the element declares `systemFields.audit`. */
|
|
22
|
+
readonly ownerAuditFields?: boolean;
|
|
23
|
+
/** Owner field bag key → display name, for calc names (#1784). */
|
|
19
24
|
readonly fieldNames?: ReadonlyMap<string, string>;
|
|
20
25
|
readonly fieldMetadata?: ReadonlyMap<string, BuildFieldMetadata>;
|
|
21
26
|
/** Build warnings (check.mjs `warn`); pushed, never thrown. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
|
+
import { checkCustomViewReferences } from "./custom-view-references.js";
|
|
2
3
|
const CONTAINERS = new Set(["PanesBlock", "StackBlock", "RowBlock", "CardBlock"]);
|
|
3
4
|
const LIST_BLOCKS = new Set(["ListCollectionBlock", "DataTableBlock"]);
|
|
4
5
|
const FILTER_GROUPS = new Set(["AND", "OR"]);
|
|
@@ -265,6 +266,7 @@ export function validateCustomViewLayout(spec, where, opts = {}) {
|
|
|
265
266
|
}
|
|
266
267
|
}
|
|
267
268
|
}
|
|
269
|
+
checkCustomViewReferences(elements, where, opts, warn);
|
|
268
270
|
throwIf(problems);
|
|
269
271
|
}
|
|
270
272
|
function throwIf(problems) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build checks for record details layouts that read badly (#1774).
|
|
3
|
+
*
|
|
4
|
+
* Classic `layouts` get the checks below (typed `dynamicLayouts` get theirs
|
|
5
|
+
* in `src/entities/dynamic-layout/lint.ts`), the same ones the generated
|
|
6
|
+
* layout avoids (`src/scripts/lib/record-layout-scaffold.ts`):
|
|
7
|
+
* - a group section that renders empty;
|
|
8
|
+
* - one long column of fields instead of labeled groups;
|
|
9
|
+
* - a right-panel section that shares a `displayOrder` with a main-area
|
|
10
|
+
* section, which the platform reads back in a different order, so plan
|
|
11
|
+
* replaces the layout.
|
|
12
|
+
*
|
|
13
|
+
* Those are advisories (`ADVISORY_DIAGNOSTICS` in
|
|
14
|
+
* `src/engine/coverage-gaps.ts`): the layout is built and applied exactly as
|
|
15
|
+
* authored, so they are printed but never counted as coverage gaps.
|
|
16
|
+
*
|
|
17
|
+
* `maxColumns` on a non-group section is the one real coverage gap here:
|
|
18
|
+
* `layoutToTf` emits `max_columns` only on group sections, so build drops it.
|
|
19
|
+
*/
|
|
20
|
+
import type { AppLayoutWire } from "./to-tf.js";
|
|
21
|
+
/** More fields than this in a one-column stack reads as one long column. */
|
|
22
|
+
export declare const LONG_COLUMN_FIELD_COUNT = 8;
|
|
23
|
+
/** More fields than this in one group should be split into labeled groups. */
|
|
24
|
+
export declare const LONG_GROUP_FIELD_COUNT = 12;
|
|
25
|
+
/** Checks for one stage's classic layout, pushed onto `diagnostics`. */
|
|
26
|
+
export declare function lintClassicLayout(where: string, layout: AppLayoutWire, diagnostics: string[]): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** More fields than this in a one-column stack reads as one long column. */
|
|
2
|
+
export const LONG_COLUMN_FIELD_COUNT = 8;
|
|
3
|
+
/** More fields than this in one group should be split into labeled groups. */
|
|
4
|
+
export const LONG_GROUP_FIELD_COUNT = 12;
|
|
5
|
+
/** Checks for one stage's classic layout, pushed onto `diagnostics`. */
|
|
6
|
+
export function lintClassicLayout(where, layout, diagnostics) {
|
|
7
|
+
const at = (index) => {
|
|
8
|
+
const name = layout.sections[index]?.name;
|
|
9
|
+
return `${where}.sections[${index}]${name ? ` ("${name}")` : ""}`;
|
|
10
|
+
};
|
|
11
|
+
for (const [index, section] of layout.sections.entries()) {
|
|
12
|
+
const type = section.type ?? "group";
|
|
13
|
+
if (type !== "group") {
|
|
14
|
+
if (section.maxColumns !== undefined) {
|
|
15
|
+
diagnostics.push(`${at(index)}: maxColumns only applies to group sections, so build dropped it from this ${type} section; remove it`);
|
|
16
|
+
}
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const fields = section.fields?.length ?? 0;
|
|
20
|
+
const widgets = section.widgets?.length ?? 0;
|
|
21
|
+
if (fields === 0 && widgets === 0 && section.agent === undefined) {
|
|
22
|
+
diagnostics.push(`${at(index)}: group section has no fields, widgets or agent, so the record page shows an empty section; add fields or remove it`);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (fields > LONG_GROUP_FIELD_COUNT) {
|
|
26
|
+
diagnostics.push(`${at(index)}: group section holds ${fields} fields; split them into labeled groups (key fields first) so the record page doesn't read as one long list`);
|
|
27
|
+
}
|
|
28
|
+
else if (fields > LONG_COLUMN_FIELD_COUNT && section.maxColumns === 1) {
|
|
29
|
+
diagnostics.push(`${at(index)}: group section stacks ${fields} fields in one column (maxColumns: 1); use maxColumns: 2 or split it into labeled groups`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// displayOrder ranks sections across both locations (the provider writes
|
|
33
|
+
// the omitted values as CENTER and 0), and the platform reads the layout
|
|
34
|
+
// back sorted by it, so a tie between the panels can come back reordered.
|
|
35
|
+
const centerByOrder = new Map();
|
|
36
|
+
for (const [index, section] of layout.sections.entries()) {
|
|
37
|
+
const order = section.displayOrder ?? 0;
|
|
38
|
+
if ((section.displayLocation ?? "CENTER") !== "RIGHT" && !centerByOrder.has(order))
|
|
39
|
+
centerByOrder.set(order, index);
|
|
40
|
+
}
|
|
41
|
+
for (const [index, section] of layout.sections.entries()) {
|
|
42
|
+
if (section.displayLocation !== "RIGHT")
|
|
43
|
+
continue;
|
|
44
|
+
const order = section.displayOrder ?? 0;
|
|
45
|
+
const center = centerByOrder.get(order);
|
|
46
|
+
if (center === undefined)
|
|
47
|
+
continue;
|
|
48
|
+
diagnostics.push(`${at(index)}: right-panel section shares displayOrder ${order} with main-area ${at(center)}; the platform reads sections back by displayOrder, so plan replaces this layout on every run. Give each section its own displayOrder, counted across both panels`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -131,6 +131,8 @@ export interface ViewToTfOptions {
|
|
|
131
131
|
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
132
132
|
/** Field bag key → display name (custom-view calc checks). */
|
|
133
133
|
readonly fieldNames?: ReadonlyMap<string, string>;
|
|
134
|
+
/** Element owners only: the element declares `systemFields.audit` (custom-view calc and tag checks). */
|
|
135
|
+
readonly ownerAuditFields?: boolean;
|
|
134
136
|
/** Field bag key → metadata (custom-view tag / calc checks). */
|
|
135
137
|
readonly fieldMetadata?: ReadonlyMap<string, import("../../graph/types.js").BuildFieldMetadata>;
|
|
136
138
|
/** Declared sibling widget keys, for typed classic-layout placement. */
|
|
@@ -15,6 +15,7 @@ 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 { EntityTfError } from "../../engine/entity.js";
|
|
18
|
+
import { lintClassicLayout } from "./layout-lint.js";
|
|
18
19
|
import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
|
|
19
20
|
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
20
21
|
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
@@ -56,6 +57,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
56
57
|
if (opts.stageTfLabels !== undefined && !opts.stageTfLabels.has(stageTfLabel)) {
|
|
57
58
|
throw new EntityTfError(`${ownerRefName}: layouts.${stageKey} matches none of its stages.${validLayoutKeys()}`);
|
|
58
59
|
}
|
|
60
|
+
lintClassicLayout(`layouts.${stageKey}`, layout, diagnostics);
|
|
59
61
|
blocks.push(layoutToTf(stageKey, layout, ownerRefName, ownerTfLabel, scope, objectId, diagnostics, fieldAddresses, opts.widgets, opts.stageKeyByTfLabel?.get(stageTfLabel)));
|
|
60
62
|
}
|
|
61
63
|
if (opts.deleteDefaultListView === true) {
|
|
@@ -281,6 +283,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
281
283
|
attrs["layout"] = expr.jsonencode(viewBlocksToTf(view.layout, `${where}.layout`, {
|
|
282
284
|
ownerRefName,
|
|
283
285
|
ownerKind: scope === "element" ? "element" : "app",
|
|
286
|
+
...(opts.ownerAuditFields !== undefined ? { ownerAuditFields: opts.ownerAuditFields } : {}),
|
|
284
287
|
ownerTfLabel,
|
|
285
288
|
scope,
|
|
286
289
|
objectId,
|
|
@@ -91,7 +91,14 @@ export interface VisualFlowStage {
|
|
|
91
91
|
export type DefineVisualFlowOptions = EntityDeployOptions & {
|
|
92
92
|
/** The app whose stages host this flow. Elements do not expose stages. */
|
|
93
93
|
readonly app: AppCatalogRef;
|
|
94
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Stable stage keys map directly to the owner's authored stage keys. The key
|
|
96
|
+
* `initiate` is the app's Initiate stage (the first stage the platform
|
|
97
|
+
* creates with every app, which is not one of its authored stages), unless
|
|
98
|
+
* the app authors its own stage keyed `initiate` (or whose name slugs to it).
|
|
99
|
+
* Build always sends the Initiate stage first, as the platform lists it, so
|
|
100
|
+
* it may appear anywhere in this record.
|
|
101
|
+
*/
|
|
95
102
|
readonly stages: Readonly<Record<string, VisualFlowStage>>;
|
|
96
103
|
};
|
|
97
104
|
export interface VisualFlowConfigured {
|
|
@@ -7,6 +7,7 @@ import { DATAMINE_RESOURCE_TYPE } from "../datamine/module.js";
|
|
|
7
7
|
import { RELATIONSHIP_RESOURCE_TYPE } from "../relationship/module.js";
|
|
8
8
|
import { TABLE_RESOURCE_TYPE } from "../table/module.js";
|
|
9
9
|
import { VISUAL_FLOW_RESOURCE_TYPE } from "./module.js";
|
|
10
|
+
import { INITIATE_STAGE_ID_ATTR, INITIATE_STAGE_KEY } from "./initiate.js";
|
|
10
11
|
const KNOWN = new Set(["id", "object_id", "stages"]);
|
|
11
12
|
const symbols = new Set(["SQUARE", "DIAMOND", "CIRCLE"]);
|
|
12
13
|
const positions = new Set(["TOP", "RIGHT", "BOTTOM", "LEFT"]);
|
|
@@ -165,6 +166,21 @@ export function visualFlowFromTf(block, ownerType, ownerLabel, scope, ctx, stage
|
|
|
165
166
|
if (!isTfExpr(stageId) || stageId.$expr !== "resource-attr" || stageId.type !== ownerType || stageId.label !== ownerLabel) {
|
|
166
167
|
throw new EntityTfError(`${block.type}.${block.label}.stages[${index}]: stage_id must reference the owning ${scope} stage map`);
|
|
167
168
|
}
|
|
169
|
+
const rawNodes0 = stage["nodes"];
|
|
170
|
+
// The platform's Initiate stage is named by its own attribute (#2987).
|
|
171
|
+
if (stageId.path.length === 1 && stageId.path[0] === INITIATE_STAGE_ID_ATTR) {
|
|
172
|
+
// Build sends the `initiate` handle to an authored stage that holds it
|
|
173
|
+
// (its key, or a name that slugs to it), so writing these blocks under
|
|
174
|
+
// `initiate` would move them to that stage, or print the key twice.
|
|
175
|
+
// Leave the flow unmanaged instead, like a lost stage handle (#1136).
|
|
176
|
+
const owner = stageHandles?.byHandle.get(INITIATE_STAGE_KEY);
|
|
177
|
+
if (owner !== undefined) {
|
|
178
|
+
throw new LostStageHandleError(`${block.type}.${block.label}.stages[${index}]: the app's Initiate stage has no handle of its own (its handle "${INITIATE_STAGE_KEY}" belongs to the app's stage "${owner}"); the flow is left unmanaged instead of binding it to "${owner}". Rename that stage so neither its key nor its name produces the handle "${INITIATE_STAGE_KEY}", then pull again (#2987)`);
|
|
179
|
+
}
|
|
180
|
+
if (!Array.isArray(rawNodes0))
|
|
181
|
+
throw new EntityTfError(`${block.type}.${block.label}.stages[${index}]: nodes must be a list`);
|
|
182
|
+
return { stage: INITIATE_STAGE_KEY, nodes: Object.fromEntries(rawNodes0.map((node, nodeIndex) => nodeFromTf(node, ownerLabel, scope, ctx, `${block.type}.${block.label}.stages[${index}].nodes[${nodeIndex}]`))) };
|
|
183
|
+
}
|
|
168
184
|
const entry = stageId.path.find((part) => typeof part === "object" && "index" in part);
|
|
169
185
|
if (entry === undefined || typeof entry !== "object")
|
|
170
186
|
throw new EntityTfError(`${block.type}.${block.label}.stages[${index}]: stage_id has no stable key`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The platform's Initiate stage (#2987). Every app gets one when it is
|
|
3
|
+
* created; it is not one of the app's authored `stages`, so it has no
|
|
4
|
+
* `stage_ids_by_key` entry. A process map names it with this stage key, and
|
|
5
|
+
* build points it at `elementum_app.<app>.initiate_stage_id`, unless the app
|
|
6
|
+
* authors its own stage keyed `initiate`, which then wins.
|
|
7
|
+
*/
|
|
8
|
+
export declare const INITIATE_STAGE_KEY = "initiate";
|
|
9
|
+
/** The platform's display name for the Initiate stage. */
|
|
10
|
+
export declare const INITIATE_STAGE_NAME = "Initiate";
|
|
11
|
+
/** Computed `elementum_app` attribute holding the Initiate stage's id. */
|
|
12
|
+
export declare const INITIATE_STAGE_ID_ATTR = "initiate_stage_id";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The platform's Initiate stage (#2987). Every app gets one when it is
|
|
3
|
+
* created; it is not one of the app's authored `stages`, so it has no
|
|
4
|
+
* `stage_ids_by_key` entry. A process map names it with this stage key, and
|
|
5
|
+
* build points it at `elementum_app.<app>.initiate_stage_id`, unless the app
|
|
6
|
+
* authors its own stage keyed `initiate`, which then wins.
|
|
7
|
+
*/
|
|
8
|
+
export const INITIATE_STAGE_KEY = "initiate";
|
|
9
|
+
/** The platform's display name for the Initiate stage. */
|
|
10
|
+
export const INITIATE_STAGE_NAME = "Initiate";
|
|
11
|
+
/** Computed `elementum_app` attribute holding the Initiate stage's id. */
|
|
12
|
+
export const INITIATE_STAGE_ID_ATTR = "initiate_stage_id";
|
|
@@ -8,6 +8,7 @@ import { DATAMINE_RESOURCE_TYPE } from "../datamine/module.js";
|
|
|
8
8
|
import { RELATIONSHIP_RESOURCE_TYPE } from "../relationship/module.js";
|
|
9
9
|
import { TABLE_RESOURCE_TYPE } from "../table/module.js";
|
|
10
10
|
import { VISUAL_FLOW_RESOURCE_TYPE } from "./module.js";
|
|
11
|
+
import { INITIATE_STAGE_ID_ATTR, INITIATE_STAGE_KEY } from "./initiate.js";
|
|
11
12
|
function ownedResourceRef(ref, expected, ctx) {
|
|
12
13
|
if (ref.__kind !== expected || !ref.refName || ref.parent !== ctx.appRefName) {
|
|
13
14
|
throw new EntityTfError(`visual flow ${expected} must be a typed reference owned by ${ctx.appRefName}`);
|
|
@@ -157,11 +158,24 @@ export function visualFlowToTf(entity, ctx) {
|
|
|
157
158
|
const ownerType = APP_RESOURCE_TYPE;
|
|
158
159
|
const label = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName));
|
|
159
160
|
const dataBlocks = new Map();
|
|
160
|
-
const
|
|
161
|
+
const resolved = (payload.stages ?? []).map((stage) => {
|
|
161
162
|
if (!stage.stage)
|
|
162
163
|
throw new EntityTfError(`visual flow ${entity.refName}: every stage requires a stable key`);
|
|
164
|
+
const stageHandle = tsLabelToTfLabel(stage.stage);
|
|
165
|
+
const appStageKey = ctx.stageKeyByTfLabel?.get(stageHandle);
|
|
166
|
+
// `initiate` names the platform's Initiate stage unless the app authors
|
|
167
|
+
// its own stage with that key (#2987).
|
|
168
|
+
return { stage, stageHandle, appStageKey, onInitiate: appStageKey === undefined && stageHandle === INITIATE_STAGE_KEY };
|
|
169
|
+
});
|
|
170
|
+
// The platform lists the Initiate stage first, and elementum_flow Read keeps
|
|
171
|
+
// platform order with stage_id RequiresReplace: emit it first wherever the
|
|
172
|
+
// source lists it, or every plan after the first apply replaces the flow.
|
|
173
|
+
const ordered = [...resolved.filter((entry) => entry.onInitiate), ...resolved.filter((entry) => !entry.onInitiate)];
|
|
174
|
+
const stages = ordered.map(({ stage, stageHandle, appStageKey, onInitiate }) => {
|
|
163
175
|
return {
|
|
164
|
-
stage_id:
|
|
176
|
+
stage_id: onInitiate
|
|
177
|
+
? expr.resourceAttr(ownerType, ctx.appTfLabel, [INITIATE_STAGE_ID_ATTR])
|
|
178
|
+
: expr.resourceAttr(ownerType, ctx.appTfLabel, ["stage_ids_by_key", { index: appStageKey ?? stageHandle }]),
|
|
165
179
|
nodes: Object.entries(stage.nodes ?? {}).map(([key, node]) => ({
|
|
166
180
|
key,
|
|
167
181
|
...(node.description !== undefined && { description: node.description }),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
2
2
|
import { dataRefLabel, optionalBoolean, optionalString, plainObject, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
3
3
|
import { bareChildResourceLabel, isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
4
|
+
import { omittedAutomationKey } from "../automation/omitted-ref.js";
|
|
4
5
|
import { AUTOMATION_RESOURCE_TYPE } from "../automation/types.js";
|
|
5
6
|
import { decodeForeignDataField, fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
6
7
|
import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
@@ -286,8 +287,9 @@ function recordIdentityTarget(resourceType, target) {
|
|
|
286
287
|
* A run-automation widget keeps a raw automation id as is. Pull warns, naming
|
|
287
288
|
* the widget and the automation, and continues (#1877) only when the
|
|
288
289
|
* automation is known to be dropped: the export listed it in
|
|
289
|
-
* omitted-automations.json
|
|
290
|
-
*
|
|
290
|
+
* omitted-automations.json and pull could not give it a key (a DISABLED
|
|
291
|
+
* automation, which is how the platform marks a deleted one; see
|
|
292
|
+
* {@link omittedAutomationKey}), or wrote no id at all. Any other raw id is a valid reference to an automation this
|
|
291
293
|
* pull does not export, such as another app's, which build emits as is, so
|
|
292
294
|
* it stays silent. Unlike an unextracted field reference (#1978), a dropped
|
|
293
295
|
* automation does not fail the pull.
|
|
@@ -313,8 +315,10 @@ function droppedAutomationGap(widgetKey, automationId, owner, ctx) {
|
|
|
313
315
|
});
|
|
314
316
|
}
|
|
315
317
|
function automationRef(value, owner, ctx) {
|
|
316
|
-
if (typeof value === "string")
|
|
317
|
-
|
|
318
|
+
if (typeof value === "string") {
|
|
319
|
+
const omitted = omittedAutomationKey(value, owner.ownerTfLabel, ctx);
|
|
320
|
+
return omitted === undefined ? value : { kind: "automation", key: omitted.key, name: omitted.name, parent: owner.ownerRefName };
|
|
321
|
+
}
|
|
318
322
|
const label = resourceRefLabel(value, AUTOMATION_RESOURCE_TYPE);
|
|
319
323
|
if (label === undefined)
|
|
320
324
|
return undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Public graph barrel: KIND_MODULES + derived views for pull/build/canvas.
|
|
3
3
|
*/
|
|
4
4
|
import { type CatalogRenderArgs, type CatalogRenderResult, type EntityKindModule, type KindId, type ParentEdge, type PortableEmptiedList, type PortableLeaveOut, type PortablePrincipals, type StateAlignment, type StateScopedPlatformEntry, type TaskOutputReference, matchType } from "./types.js";
|
|
5
|
-
export type { AdoptionAddressAlias, AuthoringFacet, CanvasComponentId, CanvasFacet, CanvasView, CatalogAuthoringArgs, CatalogFacet, CatalogRenderArgs, CatalogRenderResult, CatalogRoot, DataFacet, DataFacetCatalogKind, EntityKindId, EntityKindModule, KindId, LifecycleFacet, OrgIdentityBag, ParentEdge, ParentageFacet, ResourceFacet, StateAlignment, StateReferenceResolver, StateScopedPlatformEntry, StreamFacet, StreamMatch, StreamPartition, StreamRootExtractResult, TaskOutputReference, ToTfResult, } from "./types.js";
|
|
5
|
+
export type { AdoptionAddressAlias, AuthoringFacet, CanvasComponentId, CanvasFacet, CanvasView, CatalogAuthoringArgs, CatalogFacet, CatalogRenderArgs, CatalogRenderResult, CatalogRoot, DataFacet, DataFacetCatalogKind, EntityKindId, EntityKindModule, KindId, LifecycleFacet, OrgIdentityBag, ParentEdge, ParentageFacet, ResourceFacet, StateAlignment, StateReferenceResolver, StateScopedPlatformEntry, StreamFacet, StreamMatch, StreamPartition, StreamRootExtractResult, TaskOutputReference, ToTfResult, UnmanagedLookup, } from "./types.js";
|
|
6
6
|
export type { ReferenceLookupStrategy } from "./types.js";
|
|
7
7
|
export { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE, defaultMatchResourceType, implementedResourceTypes, isResourceAdoptable, isTfLive, knownResourceTypes, matchType, singleResourceType, } from "./types.js";
|
|
8
8
|
export { KIND_MODULES } from "./modules.js";
|
|
@@ -346,6 +346,8 @@ export interface OwnFileExtractResult {
|
|
|
346
346
|
readonly validations?: readonly ValidationFailure[];
|
|
347
347
|
/** Export address → canonical address rebuilt by the printed current API. */
|
|
348
348
|
readonly adoptionAddressAliases?: readonly AdoptionAddressAlias[];
|
|
349
|
+
/** Lookups for skipped resources that other resources in the stream reference (see {@link UnmanagedLookup}). */
|
|
350
|
+
readonly unmanagedLookups?: readonly UnmanagedLookup[];
|
|
349
351
|
/**
|
|
350
352
|
* Own-file ref names released from state on this pull. Their authored files
|
|
351
353
|
* are archived so the next plan does not recreate the live resource (#1858).
|
|
@@ -385,6 +387,17 @@ export interface AdoptionAddressAlias {
|
|
|
385
387
|
readonly from: string;
|
|
386
388
|
readonly to: string;
|
|
387
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* A data lookup that stands in for skipped resources in the export adoption
|
|
392
|
+
* plans (#3023). Adoption replaces each `.id` reference to a skipped resource
|
|
393
|
+
* with its platform id, but has no literal for any other attribute. A
|
|
394
|
+
* reference to another attribute of one of `addresses` reads the attribute of
|
|
395
|
+
* the same name from `lookup` instead, so it stays declared.
|
|
396
|
+
*/
|
|
397
|
+
export interface UnmanagedLookup {
|
|
398
|
+
readonly lookup: TfBlock;
|
|
399
|
+
readonly addresses: readonly string[];
|
|
400
|
+
}
|
|
388
401
|
export interface PrintedOwnFile {
|
|
389
402
|
readonly refName: string;
|
|
390
403
|
readonly source: string;
|
package/package.json
CHANGED