@elementumai/edk 0.10.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/dist-sdk/src/catalog/token.js +2 -1
- package/dist-sdk/src/core/wire/ref-serializer.js +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +4 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
- package/dist-sdk/src/engine/coverage-gaps.js +3 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.d.ts +43 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.js +234 -0
- package/dist-sdk/src/engine/ei/run.d.ts +22 -0
- package/dist-sdk/src/engine/ei/run.js +99 -18
- package/dist-sdk/src/engine/ei/saved-plan.d.ts +16 -0
- package/dist-sdk/src/engine/ei/saved-plan.js +19 -0
- package/dist-sdk/src/engine/ei/state.d.ts +1 -1
- package/dist-sdk/src/engine/ei/state.js +17 -4
- package/dist-sdk/src/engine/progress.d.ts +3 -1
- package/dist-sdk/src/engine/progress.js +7 -3
- package/dist-sdk/src/engine/pull/authored-address.d.ts +15 -1
- package/dist-sdk/src/engine/pull/authored-address.js +180 -29
- package/dist-sdk/src/engine/pull/context.d.ts +37 -2
- package/dist-sdk/src/engine/pull/context.js +7 -4
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -0
- package/dist-sdk/src/engine/tf/labels.js +50 -0
- package/dist-sdk/src/engine/tf/model.d.ts +2 -0
- package/dist-sdk/src/engine/tf/model.js +26 -0
- package/dist-sdk/src/engine/validation.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +52 -24
- package/dist-sdk/src/entities/access-policy/member-list.d.ts +32 -0
- package/dist-sdk/src/entities/access-policy/member-list.js +57 -0
- package/dist-sdk/src/entities/access-policy/module.js +5 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +4 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +21 -12
- package/dist-sdk/src/entities/agent/build.js +7 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -0
- package/dist-sdk/src/entities/agent/from-tf.js +13 -3
- package/dist-sdk/src/entities/agent/to-tf.js +11 -5
- package/dist-sdk/src/entities/agent/tools.d.ts +8 -0
- package/dist-sdk/src/entities/agent/tools.js +6 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +29 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +56 -3
- package/dist-sdk/src/entities/agent-tool/types.d.ts +12 -8
- package/dist-sdk/src/entities/agent-tool/types.js +13 -9
- package/dist-sdk/src/entities/app/build.d.ts +11 -0
- package/dist-sdk/src/entities/app/build.js +1 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -7
- package/dist-sdk/src/entities/app/from-tf.js +16 -10
- package/dist-sdk/src/entities/app/to-tf.js +6 -4
- package/dist-sdk/src/entities/automation/build.d.ts +2 -7
- package/dist-sdk/src/entities/automation/build.js +43 -14
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +7 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +7 -11
- package/dist-sdk/src/entities/automation/from-tf.d.ts +23 -1
- package/dist-sdk/src/entities/automation/from-tf.js +456 -34
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +22 -2
- package/dist-sdk/src/entities/automation/module.js +244 -57
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +22 -2
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +54 -3
- package/dist-sdk/src/entities/automation/run-target.d.ts +59 -0
- package/dist-sdk/src/entities/automation/run-target.js +99 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +9 -0
- package/dist-sdk/src/entities/automation/script-code.js +24 -3
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +16 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +49 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +20 -8
- package/dist-sdk/src/entities/automation/to-tf.d.ts +1 -3
- package/dist-sdk/src/entities/automation/to-tf.js +102 -40
- package/dist-sdk/src/entities/automation/triggers.d.ts +22 -3
- package/dist-sdk/src/entities/automation/triggers.js +40 -0
- package/dist-sdk/src/entities/automation/types.d.ts +21 -0
- package/dist-sdk/src/entities/automation/types.js +26 -0
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +57 -7
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +7 -2
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +65 -19
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +341 -32
- package/dist-sdk/src/entities/element/build.d.ts +10 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +14 -9
- package/dist-sdk/src/entities/element/to-tf.js +6 -4
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +79 -1
- package/dist-sdk/src/entities/field/module.js +7 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +30 -1
- package/dist-sdk/src/entities/field/to-tf.js +51 -0
- package/dist-sdk/src/entities/file-reader/module.js +3 -3
- package/dist-sdk/src/entities/file-reader/to-tf.js +3 -3
- package/dist-sdk/src/entities/file-reader/types.d.ts +4 -16
- package/dist-sdk/src/entities/file-reader/types.js +7 -0
- package/dist-sdk/src/entities/org/group.d.ts +1 -0
- package/dist-sdk/src/entities/org/group.js +2 -1
- package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +10 -2
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +14 -2
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +88 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +79 -8
- package/dist-sdk/src/entities/role/from-tf.js +24 -7
- package/dist-sdk/src/entities/role/to-tf.js +25 -7
- package/dist-sdk/src/entities/service-account/from-tf.js +2 -1
- package/dist-sdk/src/entities/service-account/module.js +15 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +12 -4
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +12 -7
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +8 -1
- package/dist-sdk/src/entities/skill/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill/module.js +16 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +8 -1
- package/dist-sdk/src/entities/skill/to-tf.js +23 -14
- package/dist-sdk/src/entities/skill/tools.d.ts +8 -0
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +8 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +20 -10
- package/dist-sdk/src/entities/view/from-tf.d.ts +60 -0
- package/dist-sdk/src/entities/view/from-tf.js +391 -17
- package/dist-sdk/src/entities/view/module.js +15 -0
- package/dist-sdk/src/entities/view/portable.d.ts +11 -0
- package/dist-sdk/src/entities/view/portable.js +47 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/view/to-tf.js +25 -7
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +4 -3
- package/dist-sdk/src/entities/widget/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/widget/from-tf.js +100 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +16 -1
- package/dist-sdk/src/entities/widget/to-tf.js +77 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +27 -8
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/field-resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/field-resource-types.js +11 -0
- package/dist-sdk/src/graph/index.d.ts +28 -3
- package/dist-sdk/src/graph/index.js +12 -2
- package/dist-sdk/src/graph/types.d.ts +157 -5
- package/package.json +1 -1
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
16
16
|
import { EntityTfError } from "../../engine/entity.js";
|
|
17
|
-
import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
17
|
+
import { appScopedResourceLabel, collisionLabelSuffixes, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
18
18
|
import { resolveForeignRef } from "../shared/foreign-ref.js";
|
|
19
|
+
import { assertUniqueToolAddresses, toolName } from "../agent-tool/to-tf.js";
|
|
19
20
|
import { skillToolToTf } from "../skill-tool/to-tf.js";
|
|
21
|
+
import { SKILL_TOOL_SUB_TYPE_BY_TYPE_KEY } from "../skill-tool/types.js";
|
|
20
22
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
21
23
|
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "../service-account/module.js";
|
|
22
24
|
import { analyzeSkillInputCoverage, coverageToolsFromWire, skillCoverageGapDiagnostics, skillCoverageReportLines, } from "./input-coverage.js";
|
|
@@ -47,22 +49,25 @@ function toSortableSkills(entities) {
|
|
|
47
49
|
}
|
|
48
50
|
return out;
|
|
49
51
|
}
|
|
50
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* `_N` suffixes for each skill's tools whose labels collide, keyed
|
|
54
|
+
* `<refName>#<index>`, one counter per skill across tool kinds, as ei's
|
|
55
|
+
* export (`generateAppSkillImportBlocks`) counts known tool kinds. A tool with
|
|
56
|
+
* `labelSuffix` keeps that `_N`; the others take the lowest free count in tool
|
|
57
|
+
* order (`collisionLabelSuffixes`). Pull pins every tool ei suffixed
|
|
58
|
+
* (skillFromTf), so a pulled skill rebuilds its exported labels.
|
|
59
|
+
*/
|
|
51
60
|
export function computeToolLabelSuffixes(siblingSkills) {
|
|
52
|
-
const counts = new Map();
|
|
53
61
|
const suffixes = new Map();
|
|
54
62
|
for (const skill of toSortableSkills(siblingSkills)) {
|
|
55
|
-
skill.tools.
|
|
63
|
+
const perTool = collisionLabelSuffixes(skill.tools.map((entry) => {
|
|
56
64
|
const typeKey = Object.keys(entry)[0];
|
|
57
|
-
if (typeKey === undefined)
|
|
58
|
-
return;
|
|
65
|
+
if (typeKey === undefined || !SKILL_TOOL_SUB_TYPE_BY_TYPE_KEY.has(typeKey))
|
|
66
|
+
return undefined;
|
|
59
67
|
const inner = entry[typeKey];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
counts.set(key, count + 1);
|
|
64
|
-
suffixes.set(`${skill.refName}#${index}`, count > 0 ? `_${count}` : "");
|
|
65
|
-
});
|
|
68
|
+
return { base: sanitizeName(inner?.name ?? ""), ...(inner?.labelSuffix !== undefined && { pinned: inner.labelSuffix }) };
|
|
69
|
+
}));
|
|
70
|
+
perTool.forEach((suffix, index) => suffixes.set(`${skill.refName}#${index}`, suffix));
|
|
66
71
|
}
|
|
67
72
|
return suffixes;
|
|
68
73
|
}
|
|
@@ -115,6 +120,7 @@ export function skillToTf(entity, ctx) {
|
|
|
115
120
|
if (discovery?.negativeKeywords !== undefined)
|
|
116
121
|
attrs["negative_keywords"] = [...discovery.negativeKeywords];
|
|
117
122
|
const toolLabelSuffixes = computeToolLabelSuffixes(ctx.siblingEntities ?? [entity]);
|
|
123
|
+
const toolAddresses = [];
|
|
118
124
|
const blocks = [{ kind: "resource", type: SKILL_RESOURCE_TYPE, label: tfLabel, attrs }];
|
|
119
125
|
(payload.tools ?? []).forEach((entry, index) => {
|
|
120
126
|
const tool = skillToolToTf(entry, {
|
|
@@ -173,8 +179,11 @@ export function skillToTf(entity, ctx) {
|
|
|
173
179
|
},
|
|
174
180
|
diagnostics: ctx.diagnostics,
|
|
175
181
|
});
|
|
176
|
-
if (tool
|
|
177
|
-
|
|
182
|
+
if (tool === undefined)
|
|
183
|
+
return;
|
|
184
|
+
toolAddresses.push({ name: toolName(entry), address: tool.address });
|
|
185
|
+
blocks.push(tool.block);
|
|
178
186
|
});
|
|
187
|
+
assertUniqueToolAddresses(`skill "${name}" (${SKILL_RESOURCE_TYPE}.${tfLabel})`, toolAddresses);
|
|
179
188
|
return { blocks, address: `${SKILL_RESOURCE_TYPE}.${tfLabel}` };
|
|
180
189
|
}
|
|
@@ -92,6 +92,14 @@ interface CommonToolOptions {
|
|
|
92
92
|
readonly status?: SkillToolStatus;
|
|
93
93
|
readonly startMessage?: string;
|
|
94
94
|
readonly runAs?: AgentToolRunAs;
|
|
95
|
+
/**
|
|
96
|
+
* Pins the `_N` on this tool's terraform label, for a tool whose name shares
|
|
97
|
+
* a label with others (`a-b`, `a_b`, `aB`). Pull writes it when ei's export
|
|
98
|
+
* gave the tool a suffix; keep it, or the tool's address changes. Without
|
|
99
|
+
* it, a colliding tool takes the lowest free `_N` in tool order. Never sent
|
|
100
|
+
* to the platform. A whole number from 1 to `Number.MAX_SAFE_INTEGER`.
|
|
101
|
+
*/
|
|
102
|
+
readonly labelSuffix?: number;
|
|
95
103
|
}
|
|
96
104
|
export type SkillAutomationInputs<T> = [keyof T] extends [never] ? {
|
|
97
105
|
readonly [key: string]: never;
|
|
@@ -27,11 +27,15 @@ function common(opts) {
|
|
|
27
27
|
// every tool factory routes through here, so this is the single
|
|
28
28
|
// enforcement point; the tf passes never re-check.
|
|
29
29
|
if (!isValidToolName(opts.name)) {
|
|
30
|
-
throw new Error(`skill tool name "${opts.name}" must be 1–64 characters of letters, digits,
|
|
31
|
-
`
|
|
30
|
+
throw new Error(`skill tool name "${opts.name}" must be 1–64 characters of letters, digits, underscores, ` +
|
|
31
|
+
`and hyphens (A–Z, a–z, 0–9, _, -) with no consecutive underscores — no spaces.`);
|
|
32
|
+
}
|
|
33
|
+
if (opts.labelSuffix !== undefined && (!Number.isSafeInteger(opts.labelSuffix) || opts.labelSuffix < 1)) {
|
|
34
|
+
throw new Error(`skill tool "${opts.name}" labelSuffix must be a whole number from 1 to Number.MAX_SAFE_INTEGER; got ${String(opts.labelSuffix)}.`);
|
|
32
35
|
}
|
|
33
36
|
return {
|
|
34
37
|
name: opts.name,
|
|
38
|
+
...(opts.labelSuffix !== undefined ? { labelSuffix: opts.labelSuffix } : {}),
|
|
35
39
|
description: opts.description,
|
|
36
40
|
status: opts.status ?? "ACTIVE",
|
|
37
41
|
...(opts.startMessage !== undefined ? { startMessage: opts.startMessage } : {}),
|
|
@@ -70,6 +70,8 @@ export interface NormalizedSkillTool {
|
|
|
70
70
|
/** Present only when it differs from the default ("ACTIVE"). */
|
|
71
71
|
readonly status?: "INACTIVE";
|
|
72
72
|
readonly startMessage?: string;
|
|
73
|
+
/** The `_N` ei gave this tool's label (edk#1987); see the builders' `labelSuffix`. */
|
|
74
|
+
readonly labelSuffix?: number;
|
|
73
75
|
readonly target?: NormalizedSkillToolTarget;
|
|
74
76
|
readonly fields?: readonly NormalizedSkillToolField[];
|
|
75
77
|
readonly filterVariables?: readonly NormalizedFilterVariable[];
|
|
@@ -59,4 +59,12 @@ export interface SkillToolToTfResult {
|
|
|
59
59
|
/** `<resourceType>.<tfLabel>` — bookkeeping for the skill catalog. */
|
|
60
60
|
readonly address: string;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* One authored tool entry (`{ createRecord: {...} }`) → its resource block;
|
|
64
|
+
* undefined = degraded with a diagnostic (unimplemented sub-type, missing
|
|
65
|
+
* target). Tool-name validity is enforced in the authoring builders
|
|
66
|
+
* (entities/skill/tools.ts), not here.
|
|
67
|
+
*/
|
|
68
|
+
/** A skill tool's bare label: `<skill>_<sanitizeName(tool name)>` plus its collision suffix. */
|
|
69
|
+
export declare function skillToolBareLabel(skillBareTfLabel: string, toolName: string, labelSuffix: string): string;
|
|
62
70
|
export declare function skillToolToTf(entry: Record<string, unknown>, ctx: SkillToolToTfContext): SkillToolToTfResult | undefined;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
10
10
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
11
|
-
import { automationRunTargetResourceAttr } from "../automation/
|
|
11
|
+
import { automationRunTargetResourceAttr } from "../automation/run-target.js";
|
|
12
12
|
import { appScopedResourceLabel, childPartFromScopedLabel, expr, sanitizeName, scopedResourceLabel, stableIdSuffix, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
13
13
|
import { authoredFieldKeysFromPayload, fieldRefToTfValue, } from "../field/to-tf.js";
|
|
14
14
|
import { foreignFieldDataLabel } from "../shared/foreign-ref.js";
|
|
@@ -146,6 +146,10 @@ function fieldRefValue(token, where, ctx, target) {
|
|
|
146
146
|
* target). Tool-name validity is enforced in the authoring builders
|
|
147
147
|
* (entities/skill/tools.ts), not here.
|
|
148
148
|
*/
|
|
149
|
+
/** A skill tool's bare label: `<skill>_<sanitizeName(tool name)>` plus its collision suffix. */
|
|
150
|
+
export function skillToolBareLabel(skillBareTfLabel, toolName, labelSuffix) {
|
|
151
|
+
return `${skillBareTfLabel}_${sanitizeName(toolName)}${labelSuffix}`;
|
|
152
|
+
}
|
|
149
153
|
/**
|
|
150
154
|
* A whole skill tool the build cannot emit (edk#1480): the site states the
|
|
151
155
|
* consequence itself instead of leaving it to the generic "dropped" wording.
|
|
@@ -179,7 +183,7 @@ export function skillToolToTf(entry, ctx) {
|
|
|
179
183
|
}
|
|
180
184
|
const where = `skill tool "${name}"`;
|
|
181
185
|
const skillBareTfLabel = ctx.skillBareTfLabel ?? childPartFromScopedLabel(ctx.appTfLabel, ctx.skillTfLabel, "app");
|
|
182
|
-
const tfLabel = appScopedResourceLabel(ctx.appTfLabel,
|
|
186
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, skillToolBareLabel(skillBareTfLabel, name, ctx.labelSuffix ?? ""));
|
|
183
187
|
const attrs = {
|
|
184
188
|
skill_id: expr.resourceAttr("elementum_agentic_skill", ctx.skillTfLabel, ["id"]),
|
|
185
189
|
app_id: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]),
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* `elementum_agent_view.layout` → `agentViews.<key>.layout`;
|
|
4
4
|
* `elementum_custom_view.layout` → `customViews.<key>.layout` (see
|
|
5
5
|
* `viewBlocksFromTf`). References become typed markers at the per-block id
|
|
6
|
-
* positions, inside nested filters and inside actions; raw platform
|
|
7
|
-
*
|
|
6
|
+
* positions, inside nested filters and inside actions; a raw platform id there
|
|
7
|
+
* becomes the owner's field ref when it names one of its fields (#2155), else
|
|
8
|
+
* `unsafePlatformId(...)`. A layout this cannot represent makes the
|
|
8
9
|
* whole view unmanaged (skipped), never silently dropped: the code owns the
|
|
9
10
|
* layout, so a dropped detail would be cleared on the next apply.
|
|
10
11
|
*/
|
|
@@ -61,6 +62,11 @@ export interface AgentViewLayoutFromTfOptions {
|
|
|
61
62
|
readonly isOwnApp: (value: TfValue) => boolean;
|
|
62
63
|
/** Resolves a field reference to its bag key, a system field key, or a raw id. */
|
|
63
64
|
readonly fieldKey: (value: TfValue) => string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The key of the owner's own extracted field (or, with `systemKeys`, system
|
|
67
|
+
* field) a raw platform id names (#2155). Undefined for any other id.
|
|
68
|
+
*/
|
|
69
|
+
readonly ownFieldKey?: (id: string, systemKeys: boolean) => string | undefined;
|
|
64
70
|
/** Sees a raw platform id in a field position, which pulls as is (#1736 records the ones naming unextracted fields). */
|
|
65
71
|
readonly noteRawFieldId?: (id: string) => void;
|
|
66
72
|
/** Resolves another app's or element's data lookup. */
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* `elementum_agent_view.layout` → `agentViews.<key>.layout`;
|
|
4
4
|
* `elementum_custom_view.layout` → `customViews.<key>.layout` (see
|
|
5
5
|
* `viewBlocksFromTf`). References become typed markers at the per-block id
|
|
6
|
-
* positions, inside nested filters and inside actions; raw platform
|
|
7
|
-
*
|
|
6
|
+
* positions, inside nested filters and inside actions; a raw platform id there
|
|
7
|
+
* becomes the owner's field ref when it names one of its fields (#2155), else
|
|
8
|
+
* `unsafePlatformId(...)`. A layout this cannot represent makes the
|
|
8
9
|
* whole view unmanaged (skipped), never silently dropped: the code owns the
|
|
9
10
|
* layout, so a dropped detail would be cleared on the next apply.
|
|
10
11
|
*/
|
|
@@ -152,10 +153,9 @@ function deepRefs(value, where, opts) {
|
|
|
152
153
|
if (isTfExpr(value)) {
|
|
153
154
|
return sourceRef(value, opts) ?? fieldMarker(value, where, opts);
|
|
154
155
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return
|
|
158
|
-
}
|
|
156
|
+
// A system key here would build as a plain string, not the field's id.
|
|
157
|
+
if (isPlatformId(value))
|
|
158
|
+
return rawFieldIdMarker(value, false, opts);
|
|
159
159
|
if (Array.isArray(value))
|
|
160
160
|
return value.map((item, i) => deepRefs(item, `${where}[${i}]`, opts));
|
|
161
161
|
const rec = plain(value);
|
|
@@ -203,10 +203,8 @@ function sourceRef(value, opts) {
|
|
|
203
203
|
return opts.foreignSource?.(value);
|
|
204
204
|
}
|
|
205
205
|
function fieldMarker(value, where, opts) {
|
|
206
|
-
if (typeof value === "string")
|
|
207
|
-
|
|
208
|
-
return unsafe(value);
|
|
209
|
-
}
|
|
206
|
+
if (typeof value === "string")
|
|
207
|
+
return rawFieldIdMarker(value, true, opts);
|
|
210
208
|
// Checked first: the owner's resolver reports a foreign lookup as unknown.
|
|
211
209
|
const foreign = opts.foreignField?.(value);
|
|
212
210
|
if (foreign !== undefined)
|
|
@@ -216,6 +214,18 @@ function fieldMarker(value, where, opts) {
|
|
|
216
214
|
throw new Unrepresentable(`${where} references a field the EDK cannot represent here`);
|
|
217
215
|
return PLATFORM_ID.test(key) ? unsafe(key) : { __specRef: "field", key };
|
|
218
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* A raw id at a field position: the owner's own field's ref when the id names
|
|
219
|
+
* one (#2155), else unsafePlatformId(...). The export keeps a system field's
|
|
220
|
+
* id raw, and an own field's whenever it can't name its resource.
|
|
221
|
+
*/
|
|
222
|
+
function rawFieldIdMarker(id, systemKeys, opts) {
|
|
223
|
+
const key = opts.ownFieldKey?.(id, systemKeys);
|
|
224
|
+
if (key !== undefined)
|
|
225
|
+
return { __specRef: "field", key };
|
|
226
|
+
opts.noteRawFieldId?.(id);
|
|
227
|
+
return unsafe(id);
|
|
228
|
+
}
|
|
219
229
|
/** Plain JSON outside the id positions: any reference here is unrepresentable. */
|
|
220
230
|
function literal(value, where) {
|
|
221
231
|
if (isTfExpr(value))
|
|
@@ -29,9 +29,21 @@ export interface ViewOwner {
|
|
|
29
29
|
* builds as nothing (#1736). Undefined when the caller does not know.
|
|
30
30
|
*/
|
|
31
31
|
readonly fieldKeys?: ReadonlySet<string>;
|
|
32
|
+
/**
|
|
33
|
+
* The extracted fields' keys by display name (lower case); null for a name
|
|
34
|
+
* two fields share. A data source names its field by display name, so
|
|
35
|
+
* this is how an own-app `data.elementum_field` resolves (#1991).
|
|
36
|
+
*/
|
|
37
|
+
readonly fieldKeysByName?: ReadonlyMap<string, string | null>;
|
|
32
38
|
/** Collects the platform ids kept for unextracted fields, so print can say they are intentional. */
|
|
33
39
|
readonly unextractedFieldIds?: Set<string>;
|
|
34
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* What the #1736 unextracted-field fallback reads from an owner. Record create
|
|
43
|
+
* forms, relationships, dynamic layouts and widgets pass one of these too, so
|
|
44
|
+
* their field references keep the same platform id (#1966).
|
|
45
|
+
*/
|
|
46
|
+
export type UnextractedFieldOwner = Pick<ViewOwner, "type" | "label" | "ownerTfLabel" | "scope" | "fieldKeys" | "fieldKeysByName" | "unextractedFieldIds">;
|
|
35
47
|
export interface ViewsFromTfResult {
|
|
36
48
|
readonly layouts: readonly NormalizedLayout[];
|
|
37
49
|
readonly listViews: readonly NormalizedListView[];
|
|
@@ -41,7 +53,55 @@ export interface ViewsFromTfResult {
|
|
|
41
53
|
readonly agentViews: readonly NormalizedAgentView[];
|
|
42
54
|
readonly customViews: readonly NormalizedCustomView[];
|
|
43
55
|
readonly viewOrder?: readonly string[];
|
|
56
|
+
readonly deleteDefaultListView?: boolean;
|
|
44
57
|
}
|
|
45
58
|
/** All three view resource kinds → the normalized shapes the app printer consumes. */
|
|
46
59
|
export declare function viewsFromTf(layoutBlocks: readonly TfBlock[], listViewBlocks: readonly TfBlock[], calendarViewBlocks: readonly TfBlock[], kanbanViewBlocks: readonly TfBlock[], dashboardViewBlocks: readonly TfBlock[], agentViewBlocks: readonly TfBlock[], managedViewOrderBlocks: readonly TfBlock[], owner: ViewOwner, ctx: FromTfContext, customViewBlocks?: readonly TfBlock[]): ViewsFromTfResult;
|
|
60
|
+
/**
|
|
61
|
+
* `ViewOwner.fieldKeysByName` from the extracted fields: lower-cased display
|
|
62
|
+
* name → key, or null for a name two fields share (it names neither).
|
|
63
|
+
*/
|
|
64
|
+
export declare function fieldKeysByDisplayName(fields: readonly {
|
|
65
|
+
readonly key: string;
|
|
66
|
+
readonly field: {
|
|
67
|
+
readonly name: string;
|
|
68
|
+
};
|
|
69
|
+
}[]): ReadonlyMap<string, string | null>;
|
|
70
|
+
/**
|
|
71
|
+
* `ownDataFieldRef` for a caller outside this module (a widget column, a
|
|
72
|
+
* relationship's related field on its own app): the key to author, or
|
|
73
|
+
* "failedClosed" once the blocker naming `site` is recorded. Undefined when
|
|
74
|
+
* `v` is not an own-app data source lookup; the caller's handling stands.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveOwnDataFieldRef(v: TfValue | undefined, owner: UnextractedFieldOwner, ctx: FromTfContext, site: string): {
|
|
77
|
+
readonly key: string;
|
|
78
|
+
} | "failedClosed" | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The value to author for a field reference outside views (#1966):
|
|
81
|
+
* `fieldKey` is what the caller resolved the reference to, if anything. A
|
|
82
|
+
* field pull did not extract keeps its platform id; otherwise the caller's
|
|
83
|
+
* key stands. Undefined when nothing resolves, or when this reference failed
|
|
84
|
+
* closed: no id is known, which fails the pull with an authoring blocker
|
|
85
|
+
* naming `site`, which must start with the holding resource's address (#1978).
|
|
86
|
+
* The result never depends on another reference's blocker at the same site.
|
|
87
|
+
* Clone drops import blocks, so it keeps the export's dropped id only for
|
|
88
|
+
* another owner's field and fails the same way for any other (#1990). A kept
|
|
89
|
+
* id is reported once per field, naming every site.
|
|
90
|
+
*/
|
|
91
|
+
export declare function unextractedFieldRefId(v: TfValue, fieldKey: string | undefined, owner: UnextractedFieldOwner, ctx: FromTfContext, site: string): string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* A bare platform-id field reference on another owner's side: a widget column
|
|
94
|
+
* whose target is another app or element, or a relationship's related field
|
|
95
|
+
* (#1991). `foreignOwner` names that owner when it is not this one, so the id
|
|
96
|
+
* is its field and keeps its platform id (Dax, 11:45). An id the export
|
|
97
|
+
* imports is checked through its field block instead: in a clone, a field of
|
|
98
|
+
* the source app fails and another owner's keeps its id (#1990); in pull, it
|
|
99
|
+
* is the platform's own and stays as is. With no foreign owner and no import,
|
|
100
|
+
* it fails like `bareFieldIdRef`, naming `site` and the id.
|
|
101
|
+
*/
|
|
102
|
+
export declare function bareForeignFieldIdRef(v: string, owner: UnextractedFieldOwner, ctx: FromTfContext, site: string, foreignOwner: string | undefined): string | undefined;
|
|
103
|
+
/** Whether `v` is a bare platform id, the shape an export writes for a field it can't name (#1991). */
|
|
104
|
+
export declare function isBarePlatformId(v: string): boolean;
|
|
105
|
+
/** Whether `fieldKey` names a field of this owner that pull did not extract (system keys never count). */
|
|
106
|
+
export declare function isUnextractedFieldKey(fieldKey: string, owner: UnextractedFieldOwner): boolean;
|
|
47
107
|
export declare function managedViewSortFromTf(value: TfValue | undefined, owner: ViewOwner, where: string, ctx: FromTfContext): NormalizedManagedViewSort | undefined;
|