@elementumai/edk 0.9.20 → 0.10.2
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 +19 -7
- package/dist-sdk/src/catalog/factories.d.ts +10 -2
- package/dist-sdk/src/catalog/factories.js +10 -1
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/token.js +4 -0
- package/dist-sdk/src/catalog/types.d.ts +7 -1
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -2
- package/dist-sdk/src/core/triggers/on-demand.js +7 -0
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
- package/dist-sdk/src/engine/coverage-gaps.js +156 -0
- package/dist-sdk/src/engine/ei/run.d.ts +21 -1
- package/dist-sdk/src/engine/ei/run.js +89 -2
- package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
- package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
- package/dist-sdk/src/engine/pull/context.d.ts +68 -6
- package/dist-sdk/src/engine/pull/context.js +40 -1
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
- package/dist-sdk/src/engine/pull/result-output.js +27 -1
- package/dist-sdk/src/engine/tf/index.d.ts +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -5
- package/dist-sdk/src/engine/tf/labels.js +45 -3
- package/dist-sdk/src/engine/tf/parse.js +3 -2
- package/dist-sdk/src/engine/validation.d.ts +5 -0
- package/dist-sdk/src/engine/validation.js +12 -2
- package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
- package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +42 -19
- package/dist-sdk/src/entities/agent/from-tf.js +11 -3
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.js +14 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +11 -5
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
- package/dist-sdk/src/entities/app/auto-share.js +49 -0
- package/dist-sdk/src/entities/app/build.d.ts +17 -3
- package/dist-sdk/src/entities/app/build.js +56 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
- package/dist-sdk/src/entities/app/from-tf.js +4 -0
- package/dist-sdk/src/entities/app/index.d.ts +2 -1
- package/dist-sdk/src/entities/app/index.js +1 -8
- package/dist-sdk/src/entities/app/module.js +2 -1
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +25 -2
- package/dist-sdk/src/entities/automation/build.d.ts +12 -2
- package/dist-sdk/src/entities/automation/build.js +105 -17
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +17 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +187 -27
- package/dist-sdk/src/entities/automation/from-tf.d.ts +9 -2
- package/dist-sdk/src/entities/automation/from-tf.js +397 -89
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +70 -7
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +21 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +38 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +5 -2
- package/dist-sdk/src/entities/automation/script-code.js +23 -5
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +37 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +76 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +92 -20
- package/dist-sdk/src/entities/automation/tasks.js +48 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +20 -3
- package/dist-sdk/src/entities/automation/to-tf.js +656 -65
- package/dist-sdk/src/entities/automation/triggers.d.ts +8 -4
- package/dist-sdk/src/entities/automation/types.d.ts +9 -0
- package/dist-sdk/src/entities/automation/types.js +19 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
- package/dist-sdk/src/entities/element/build.d.ts +3 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +4 -0
- package/dist-sdk/src/entities/element/module.js +2 -1
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +12 -14
- package/dist-sdk/src/entities/field/build.d.ts +3 -2
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +4 -4
- package/dist-sdk/src/entities/field/from-tf.js +255 -80
- package/dist-sdk/src/entities/field/module.d.ts +6 -0
- package/dist-sdk/src/entities/field/module.js +23 -2
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/order.d.ts +16 -0
- package/dist-sdk/src/entities/field/order.js +41 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +4 -4
- package/dist-sdk/src/entities/field/to-tf.js +7 -1
- package/dist-sdk/src/entities/field/types.d.ts +7 -0
- package/dist-sdk/src/entities/field/types.js +32 -0
- package/dist-sdk/src/entities/role/from-tf.js +3 -3
- package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/role/to-tf.js +12 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +3 -3
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +5 -0
- package/dist-sdk/src/entities/shared/filters/index.js +5 -0
- package/dist-sdk/src/entities/shared/filters/print.js +7 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +5 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +42 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -3
- package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
- package/dist-sdk/src/entities/shared/ref.js +5 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -0
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
- package/dist-sdk/src/entities/skill/access-policy.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +12 -5
- package/dist-sdk/src/entities/skill/from-tf.js +4 -2
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +41 -8
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +0 -6
- package/dist-sdk/src/entities/skill-tool/to-tf.js +22 -9
- package/dist-sdk/src/entities/task/build.d.ts +8 -0
- package/dist-sdk/src/entities/task/build.js +10 -1
- package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/task/from-tf.js +7 -2
- package/dist-sdk/src/entities/task/module.js +3 -2
- package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
- package/dist-sdk/src/entities/task/to-tf.js +32 -1
- package/dist-sdk/src/entities/view/from-tf.js +9 -1
- package/dist-sdk/src/entities/view/module.js +4 -1
- package/dist-sdk/src/entities/view/to-tf.d.ts +6 -7
- package/dist-sdk/src/entities/view/to-tf.js +30 -11
- package/dist-sdk/src/entities/view/types.d.ts +6 -0
- package/dist-sdk/src/entities/view/types.js +6 -0
- package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
- package/dist-sdk/src/entities/visual-flow/build.js +9 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +7 -6
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +133 -9
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +4 -2
- package/dist-sdk/src/graph/index.js +3 -0
- package/dist-sdk/src/graph/modules.js +2 -1
- package/dist-sdk/src/graph/types.d.ts +41 -3
- package/package.json +7 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
|
-
import { dataRefLabel } from "../../engine/pull/context.js";
|
|
3
|
-
import { expr, sanitizeName
|
|
2
|
+
import { dataRefLabel, groupCatalogKey } from "../../engine/pull/context.js";
|
|
3
|
+
import { expr, sanitizeName } from "../../engine/tf/index.js";
|
|
4
4
|
function object(value) {
|
|
5
5
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6
6
|
}
|
|
@@ -90,7 +90,7 @@ export function skillAccessPolicyFromTf(attrs, ctx) {
|
|
|
90
90
|
if (output === "users")
|
|
91
91
|
users.push({ __kind: "user", email: identity });
|
|
92
92
|
else
|
|
93
|
-
groups.push({ __kind: "group", refName:
|
|
93
|
+
groups.push({ __kind: "group", refName: groupCatalogKey(ctx, label, identity), name: identity });
|
|
94
94
|
}
|
|
95
95
|
if (output === "users")
|
|
96
96
|
policy.users = users;
|
|
@@ -44,6 +44,9 @@ export interface PrintSkillV2Options {
|
|
|
44
44
|
* `catalog.<refName>` instead of the literal stub.
|
|
45
45
|
*/
|
|
46
46
|
readonly foreignTaskRefNames?: ReadonlyMap<string, string>;
|
|
47
|
+
/** Terraform label → authored catalog ref. Field identities stay on the label. */
|
|
48
|
+
readonly foreignAppRefNamespaces?: ReadonlyMap<string, string>;
|
|
49
|
+
readonly foreignElementRefNamespaces?: ReadonlyMap<string, string>;
|
|
47
50
|
/** Raw foreign field id → typed catalog field identity, supplied by recursive pull. */
|
|
48
51
|
readonly foreignFieldRefsById?: ReadonlyMap<string, {
|
|
49
52
|
readonly ownerRefName: string;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* Unresolved field and automation platform ids print as `unsafePlatformId(...)`.
|
|
14
14
|
*/
|
|
15
15
|
import { quote } from "../../../../pull/util.js";
|
|
16
|
+
import { catalogRefForFieldOwner } from "../../../engine/pull/catalog-ref.js";
|
|
16
17
|
import { sanitizeName, tfLabelToTsLabel } from "../../../engine/tf/index.js";
|
|
17
18
|
import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
|
|
18
19
|
import { safeIdentifier } from "../../../internal/safe-identifier.js";
|
|
@@ -139,7 +140,7 @@ export function printSkillV2(skill, opts) {
|
|
|
139
140
|
if (skill.tools.length > 0) {
|
|
140
141
|
lines.push(" tools: [");
|
|
141
142
|
for (const tool of skill.tools) {
|
|
142
|
-
lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames, opts.foreignTaskRefNames, opts.foreignFieldRefsById, opts.foreignSearchTableRefsByName).map((l) => ` ${l}`));
|
|
143
|
+
lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames, opts.foreignTaskRefNames, opts.foreignFieldRefsById, opts.foreignSearchTableRefsByName, opts.foreignAppRefNamespaces, opts.foreignElementRefNamespaces).map((l) => ` ${l}`));
|
|
143
144
|
}
|
|
144
145
|
lines.push(" ],");
|
|
145
146
|
}
|
|
@@ -191,7 +192,7 @@ function fieldOwnerRef(tool, appRefName, foreignAppRefNames, foreignElementRefNa
|
|
|
191
192
|
}
|
|
192
193
|
: { kind: "raw", entityType: entityKind, name: tool.target.name, refName: tool.target.name };
|
|
193
194
|
}
|
|
194
|
-
function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames, foreignTaskRefNames, foreignFieldRefsById, foreignSearchTableRefsByName) {
|
|
195
|
+
function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames, foreignTaskRefNames, foreignFieldRefsById, foreignSearchTableRefsByName, foreignAppRefNamespaces, foreignElementRefNamespaces) {
|
|
195
196
|
const factory = TOOL_FACTORY_BY_TYPE_KEY[tool.typeKey] ?? "skillSearchRecords";
|
|
196
197
|
const lines = [`${factory}({`];
|
|
197
198
|
const targetRefName = tool.target?.kind === "self"
|
|
@@ -286,7 +287,12 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
286
287
|
: tool.target.kind === "foreignTask"
|
|
287
288
|
? foreignTaskRefNames
|
|
288
289
|
: foreignAppRefNames;
|
|
289
|
-
|
|
290
|
+
// Display-name map first: the terraform label and the authored catalog key
|
|
291
|
+
// differ (#1427). Extract-time refName is the state/namespace join for
|
|
292
|
+
// apps and elements. Task refNames are terraform labels, so they stay on
|
|
293
|
+
// the inline stub unless the map names a workspace catalog key (#1452).
|
|
294
|
+
const mapped = refNames?.get(tool.target.name);
|
|
295
|
+
const catalogRefName = mapped ?? (tool.target.kind === "foreignTask" ? undefined : tool.target.refName);
|
|
290
296
|
if (catalogRefName !== undefined) {
|
|
291
297
|
lines.push(` ${entityKind}: catalog.${catalogRefName},`);
|
|
292
298
|
}
|
|
@@ -345,7 +351,8 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
345
351
|
lines.push(` table: tableSearchTableRef({ name: ${quote(tool.searchTableName ?? "")}, parent: ${quote(owner)}${ownerName !== undefined ? `, parentName: ${quote(ownerName)}` : ""}${pinnedId} }),`);
|
|
346
352
|
}
|
|
347
353
|
else if (typedTable !== undefined) {
|
|
348
|
-
|
|
354
|
+
const tableOwner = catalogRefForFieldOwner(typedTable.ownerRefName, foreignAppRefNamespaces, foreignElementRefNamespaces);
|
|
355
|
+
lines.push(` table: catalog.${tableOwner}.searchTables${safeMember(typedTable.tableKey)},`);
|
|
349
356
|
}
|
|
350
357
|
else {
|
|
351
358
|
lines.push(` table: { __kind: "searchTable", refName: ${quote(tool.searchTableName ?? "")}, name: ${quote(tool.searchTableName ?? "")}, parent: ${quote(parent)} },`);
|
|
@@ -381,7 +388,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
381
388
|
const parts = isRaw
|
|
382
389
|
? [`fieldId: unsafePlatformId(${quote(f.rawFieldId ?? "")})`]
|
|
383
390
|
: resolvedRaw !== undefined
|
|
384
|
-
? [`field: catalog.${resolvedRaw.ownerRefName}.fields.${resolvedRaw.fieldKey}`]
|
|
391
|
+
? [`field: catalog.${catalogRefForFieldOwner(resolvedRaw.ownerRefName, foreignAppRefNamespaces, foreignElementRefNamespaces)}.fields.${resolvedRaw.fieldKey}`]
|
|
385
392
|
: owner.kind === "catalog"
|
|
386
393
|
? [`field: ${owner.expr}.fields.${f.key}`]
|
|
387
394
|
: owner.kind === "table"
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* source. Mirrors `entities/agent/from-tf.ts`.
|
|
7
7
|
*/
|
|
8
8
|
import { EntityTfError } from "../../engine/entity.js";
|
|
9
|
-
import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
9
|
+
import { optionalString, ownerMismatchBlocker, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
10
10
|
import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
11
11
|
import { skillToolFromTf } from "../skill-tool/from-tf.js";
|
|
12
12
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
@@ -128,7 +128,9 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
|
|
|
128
128
|
return { skippedReason: `${where}: owner_type ${JSON.stringify(ownerType)} has no terraform-path authoring yet; skipped` };
|
|
129
129
|
}
|
|
130
130
|
if (resourceRefLabel(attrs["owner_id"], APP_RESOURCE_TYPE) !== appLabel) {
|
|
131
|
-
|
|
131
|
+
const reason = `${where}: owner_id does not reference ${APP_RESOURCE_TYPE}.${appLabel}`;
|
|
132
|
+
reportAuthoringBlocker(ctx, ownerMismatchBlocker(`${SKILL_RESOURCE_TYPE}.${label}`, reason, "skill"));
|
|
133
|
+
return { skippedReason: `${reason}; skipped` };
|
|
132
134
|
}
|
|
133
135
|
const properties = propertiesFromTf(attrs["properties"], where, ctx);
|
|
134
136
|
const status = optionalString(attrs, "status", where, ctx);
|
|
@@ -90,6 +90,8 @@ export const skillModule = {
|
|
|
90
90
|
...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
|
|
91
91
|
...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
|
|
92
92
|
...(opts.foreignTaskRefNames !== undefined && { foreignTaskRefNames: opts.foreignTaskRefNames }),
|
|
93
|
+
...(opts.foreignAppRefNamespaces !== undefined && { foreignAppRefNamespaces: opts.foreignAppRefNamespaces }),
|
|
94
|
+
...(opts.foreignElementRefNamespaces !== undefined && { foreignElementRefNamespaces: opts.foreignElementRefNamespaces }),
|
|
93
95
|
...(opts.foreignFieldRefsById !== undefined && { foreignFieldRefsById: opts.foreignFieldRefsById }),
|
|
94
96
|
...(opts.foreignTableRefsById !== undefined && { foreignTableRefsById: opts.foreignTableRefsById }),
|
|
95
97
|
...(opts.foreignSearchTableRefsByName !== undefined && {
|
|
@@ -6,10 +6,22 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { EntityTfError } from "../../engine/entity.js";
|
|
8
8
|
import { dataRefLabel, optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
9
|
-
import { isTfExpr, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
9
|
+
import { isTfExpr, isUuid, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
10
10
|
import { dataAspectDisplayName, dataAspectRefName, resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
11
|
-
import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
|
|
11
|
+
import { droppedToolFieldDiagnostic, resolveToolFieldKey } from "../shared/tool-field-ref.js";
|
|
12
12
|
import { KNOWN_SKILL_TOOL_ATTRS, SKILL_TOOL_SUB_TYPE_BY_RESOURCE, UNAUTHORABLE_SKILL_TOOL_ATTRS, } from "./types.js";
|
|
13
|
+
/** Namespace-map key for a catalog ref, skipping UUID index entries. */
|
|
14
|
+
function stateScopeLabel(catalogRef, namespaces) {
|
|
15
|
+
if (namespaces !== undefined) {
|
|
16
|
+
for (const [key, value] of namespaces) {
|
|
17
|
+
if (value !== catalogRef || isUuid(key))
|
|
18
|
+
continue;
|
|
19
|
+
return key;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// UUID-only index: the stored ref is tfLabelToTsLabel(resource.name).
|
|
23
|
+
return tsLabelToTfLabel(catalogRef);
|
|
24
|
+
}
|
|
13
25
|
/**
|
|
14
26
|
* One tool block → its normalized shape; undefined = skipped with a
|
|
15
27
|
* diagnostic (unimplemented sub-type, wrong owner, unresolvable target).
|
|
@@ -355,11 +367,32 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
355
367
|
fieldScope = "task";
|
|
356
368
|
}
|
|
357
369
|
else if (typeof targetAttr === "string") {
|
|
358
|
-
//
|
|
359
|
-
//
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
370
|
+
// Same state join as automations (#1427 / #1452): when the element/app is
|
|
371
|
+
// already in OpenTofu state, the UUID is indexed on the namespace map.
|
|
372
|
+
const elementRefName = ctx.foreignElementRefNamespaces?.get(targetAttr);
|
|
373
|
+
if (elementRefName !== undefined) {
|
|
374
|
+
const displayName = [...(ctx.foreignElementRefNames?.entries() ?? [])]
|
|
375
|
+
.find(([, refName]) => refName === elementRefName)?.[0] ?? elementRefName;
|
|
376
|
+
target = { kind: "foreignElement", name: displayName, refName: elementRefName };
|
|
377
|
+
fieldScopeLabel = stateScopeLabel(elementRefName, ctx.foreignElementRefNamespaces);
|
|
378
|
+
fieldScope = "element";
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
const appRefName = ctx.foreignAppRefNamespaces?.get(targetAttr);
|
|
382
|
+
if (appRefName !== undefined) {
|
|
383
|
+
const displayName = [...(ctx.foreignAppRefNames?.entries() ?? [])]
|
|
384
|
+
.find(([, refName]) => refName === appRefName)?.[0] ?? appRefName;
|
|
385
|
+
target = { kind: "foreignApp", name: displayName, refName: appRefName };
|
|
386
|
+
fieldScopeLabel = stateScopeLabel(appRefName, ctx.foreignAppRefNamespaces);
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
// No portable reference was available at export time (ei fell back to
|
|
390
|
+
// the raw platform UUID) — keep the tool with an unresolved target
|
|
391
|
+
// instead of dropping it entirely (board issue #648).
|
|
392
|
+
ctx.diagnostics.push(`${where}: target_id could not be resolved to a portable reference ("${targetAttr}"); kept as unresolved`);
|
|
393
|
+
target = { kind: "unresolved", uuid: targetAttr };
|
|
394
|
+
}
|
|
395
|
+
}
|
|
363
396
|
}
|
|
364
397
|
else {
|
|
365
398
|
ctx.diagnostics.push(`${where}: target_id has an unrecognized shape (${JSON.stringify(targetAttr)}); skipped`);
|
|
@@ -382,7 +415,7 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
382
415
|
// than silently dropping the field.
|
|
383
416
|
const rawFieldId = fieldKey === undefined && typeof rec["field_id"] === "string" && rec["field_id"] !== "" ? rec["field_id"] : undefined;
|
|
384
417
|
if (fieldKey === undefined && rawFieldId === undefined) {
|
|
385
|
-
ctx.diagnostics.push(
|
|
418
|
+
ctx.diagnostics.push(droppedToolFieldDiagnostic(where, rec["field_id"], fieldScopeLabel, fieldScope));
|
|
386
419
|
continue;
|
|
387
420
|
}
|
|
388
421
|
fields.push({
|
|
@@ -26,5 +26,8 @@ export const skillToolModule = {
|
|
|
26
26
|
nestedAttribute: "field_id",
|
|
27
27
|
dataType: FIELD_DATA_RESOURCE_TYPE,
|
|
28
28
|
}],
|
|
29
|
+
// The provider reads an omitted `required` as false (edk#1429): the
|
|
30
|
+
// export leaves it out, the build may spell it out.
|
|
31
|
+
nestedOmittedDefaults: [{ attribute: "fields", defaults: { required: false } }],
|
|
29
32
|
},
|
|
30
33
|
};
|
|
@@ -54,10 +54,4 @@ export interface SkillToolToTfResult {
|
|
|
54
54
|
/** `<resourceType>.<tfLabel>` — bookkeeping for the skill catalog. */
|
|
55
55
|
readonly address: string;
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
58
|
-
* One authored tool entry (`{ createRecord: {...} }`) → its resource block;
|
|
59
|
-
* undefined = degraded with a diagnostic (unimplemented sub-type, missing
|
|
60
|
-
* target). Tool-name validity is enforced in the authoring builders
|
|
61
|
-
* (entities/skill/tools.ts), not here.
|
|
62
|
-
*/
|
|
63
57
|
export declare function skillToolToTf(entry: Record<string, unknown>, ctx: SkillToolToTfContext): SkillToolToTfResult | undefined;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* (`skill_id`) — this module never names the skill or app resource types.
|
|
7
7
|
* Mirrors `entities/agent-tool/to-tf.ts`.
|
|
8
8
|
*/
|
|
9
|
+
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
9
10
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
10
11
|
import { automationRunTargetResourceAttr } from "../automation/to-tf.js";
|
|
11
12
|
import { appScopedResourceLabel, childPartFromScopedLabel, expr, sanitizeName, scopedResourceLabel, stableIdSuffix, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
@@ -145,6 +146,18 @@ function fieldRefValue(token, where, ctx, target) {
|
|
|
145
146
|
* target). Tool-name validity is enforced in the authoring builders
|
|
146
147
|
* (entities/skill/tools.ts), not here.
|
|
147
148
|
*/
|
|
149
|
+
/**
|
|
150
|
+
* A whole skill tool the build cannot emit (edk#1480): the site states the
|
|
151
|
+
* consequence itself instead of leaving it to the generic "dropped" wording.
|
|
152
|
+
*/
|
|
153
|
+
function droppedSkillTool(entity, detail) {
|
|
154
|
+
return typedCoverageGap({
|
|
155
|
+
kind: "dropped",
|
|
156
|
+
entity,
|
|
157
|
+
detail,
|
|
158
|
+
consequence: "the skill is built without this tool, so an agent's call to it does nothing",
|
|
159
|
+
});
|
|
160
|
+
}
|
|
148
161
|
export function skillToolToTf(entry, ctx) {
|
|
149
162
|
const typeKey = Object.keys(entry)[0];
|
|
150
163
|
if (typeKey === undefined)
|
|
@@ -153,15 +166,15 @@ export function skillToolToTf(entry, ctx) {
|
|
|
153
166
|
const inner = entry[typeKey];
|
|
154
167
|
const name = inner?.name ?? "";
|
|
155
168
|
if (subType === undefined) {
|
|
156
|
-
ctx.diagnostics.push(`skill tool "${name}"
|
|
169
|
+
ctx.diagnostics.push(droppedSkillTool(`skill tool "${name}"`, `unknown tool kind "${typeKey}"; dropped`));
|
|
157
170
|
return undefined;
|
|
158
171
|
}
|
|
159
172
|
if (subType.implemented !== true) {
|
|
160
|
-
ctx.diagnostics.push(`skill tool "${name}"
|
|
173
|
+
ctx.diagnostics.push(droppedSkillTool(`skill tool "${name}"`, `tool kind "${typeKey}" is not supported on the terraform path yet; dropped`));
|
|
161
174
|
return undefined;
|
|
162
175
|
}
|
|
163
176
|
if (inner === undefined || typeof inner !== "object") {
|
|
164
|
-
ctx.diagnostics.push(`skill tool entry "${typeKey}"
|
|
177
|
+
ctx.diagnostics.push(droppedSkillTool(`skill tool entry "${typeKey}"`, "non-object body; dropped"));
|
|
165
178
|
return undefined;
|
|
166
179
|
}
|
|
167
180
|
const where = `skill tool "${name}"`;
|
|
@@ -204,7 +217,7 @@ export function skillToolToTf(entry, ctx) {
|
|
|
204
217
|
? sanitizeName(automation.name)
|
|
205
218
|
: undefined;
|
|
206
219
|
if (automationTfLabel === undefined) {
|
|
207
|
-
ctx.diagnostics.push(
|
|
220
|
+
ctx.diagnostics.push(droppedSkillTool(where, "no target automation token; dropped"));
|
|
208
221
|
return undefined;
|
|
209
222
|
}
|
|
210
223
|
if (automation?.parent !== undefined && automation.parent !== ctx.appRefName) {
|
|
@@ -218,13 +231,13 @@ export function skillToolToTf(entry, ctx) {
|
|
|
218
231
|
typeof automation.name === "string" && automation.name !== "") {
|
|
219
232
|
const lookup = ctx.foreignAutomationRef(automationTfLabel, automation.parentKind ?? "app", automation.parent, automation.parentName, automation.name);
|
|
220
233
|
if (lookup === undefined) {
|
|
221
|
-
ctx.diagnostics.push(
|
|
234
|
+
ctx.diagnostics.push(droppedSkillTool(where, "foreign automation lookup could not be materialized; dropped"));
|
|
222
235
|
return undefined;
|
|
223
236
|
}
|
|
224
237
|
attrs["automation_id"] = lookup;
|
|
225
238
|
}
|
|
226
239
|
else {
|
|
227
|
-
ctx.diagnostics.push(
|
|
240
|
+
ctx.diagnostics.push(droppedSkillTool(where, "cross-app automation targets are not supported; dropped"));
|
|
228
241
|
return undefined;
|
|
229
242
|
}
|
|
230
243
|
}
|
|
@@ -256,11 +269,11 @@ export function skillToolToTf(entry, ctx) {
|
|
|
256
269
|
if (typeKey === "runAgent") {
|
|
257
270
|
const target = inner.targetAgentId;
|
|
258
271
|
if (target?.refName === undefined || target.refName === "") {
|
|
259
|
-
ctx.diagnostics.push(
|
|
272
|
+
ctx.diagnostics.push(droppedSkillTool(where, "no target agent token; dropped"));
|
|
260
273
|
return undefined;
|
|
261
274
|
}
|
|
262
275
|
if (target.parent !== undefined && target.parent !== ctx.appRefName) {
|
|
263
|
-
ctx.diagnostics.push(
|
|
276
|
+
ctx.diagnostics.push(droppedSkillTool(where, "cross-app target agents are not supported; dropped"));
|
|
264
277
|
return undefined;
|
|
265
278
|
}
|
|
266
279
|
attrs["target_agent_id"] = expr.resourceAttr("elementum_agent", appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(target.refName)), ["id"]);
|
|
@@ -269,7 +282,7 @@ export function skillToolToTf(entry, ctx) {
|
|
|
269
282
|
return { block, address: `${subType.resourceType}.${tfLabel}` };
|
|
270
283
|
}
|
|
271
284
|
if (inner.aspectId === undefined && typeKey !== "searchTable") {
|
|
272
|
-
ctx.diagnostics.push(
|
|
285
|
+
ctx.diagnostics.push(droppedSkillTool(where, "no target aspect token; dropped"));
|
|
273
286
|
return undefined;
|
|
274
287
|
}
|
|
275
288
|
const aspectId = inner.aspectId;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CategoryRef, type CloudLinkRef } from "../../catalog/index.js";
|
|
2
2
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
|
+
import { type AppField } from "../app/build.js";
|
|
3
4
|
declare const taskStatusTagBrand: unique symbol;
|
|
4
5
|
export type TaskStatusTag = string & {
|
|
5
6
|
readonly [taskStatusTagBrand]: "TaskStatusTag";
|
|
@@ -35,6 +36,13 @@ export interface DefineTaskOptions extends EntityDeployOptions {
|
|
|
35
36
|
readonly options?: readonly TaskStatusOption[];
|
|
36
37
|
};
|
|
37
38
|
readonly commentsEnabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Custom fields, authored inline with the same field builders apps use
|
|
41
|
+
* (`textField`, `dropdownField`, …), keyed by a stable bag key that names
|
|
42
|
+
* the field's terraform address (edk#1464). The task's title, ID and status
|
|
43
|
+
* fields stay on `titleField`/`idField`/`statusField`.
|
|
44
|
+
*/
|
|
45
|
+
readonly fields?: Record<string, AppField>;
|
|
38
46
|
}
|
|
39
47
|
export interface TaskConfigured {
|
|
40
48
|
def(refName: string): DeployableEntity;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { slimTokens } from "../../catalog/index.js";
|
|
2
|
+
import { serializeField } from "../app/build.js";
|
|
2
3
|
export const taskStatusTag = { closed: "CLOSED" };
|
|
4
|
+
/** Keys the task's own system fields use; a custom field can't take one (its id local would collide). */
|
|
5
|
+
const TASK_SYSTEM_FIELD_KEYS = new Set(["title", "id", "status"]);
|
|
3
6
|
export function task(opts) {
|
|
4
7
|
if (opts.name.trim() === "")
|
|
5
8
|
throw new Error("task requires a non-empty name.");
|
|
@@ -12,6 +15,12 @@ export function task(opts) {
|
|
|
12
15
|
return { def(refName) {
|
|
13
16
|
const handle = opts.handle ?? refName.replace(/[^A-Za-z]/g, "").toUpperCase();
|
|
14
17
|
const namespace = opts.namespace ?? refName.replace(/[^A-Za-z]/g, "").toLowerCase();
|
|
15
|
-
|
|
18
|
+
const { fields: authoredFields, ...rest } = opts;
|
|
19
|
+
for (const key of Object.keys(authoredFields ?? {})) {
|
|
20
|
+
if (TASK_SYSTEM_FIELD_KEYS.has(key))
|
|
21
|
+
throw new Error(`task ${JSON.stringify(opts.name)}: fields.${key} collides with the task's ${key} system field; use ${key}Field or another key.`);
|
|
22
|
+
}
|
|
23
|
+
const fields = authoredFields === undefined ? undefined : Object.entries(authoredFields).map(([bagKey, field]) => serializeField(field, bagKey));
|
|
24
|
+
return { kind: "task", parent: "org", refName, payload: slimTokens({ ...rest, handle, namespace, ...(fields !== undefined && fields.length > 0 ? { fields } : {}) }), ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}) };
|
|
16
25
|
} };
|
|
17
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
2
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import type { NormalizedField } from "../app/deserializer/normalize.js";
|
|
3
4
|
export interface NormalizedTask {
|
|
4
5
|
readonly refName: string;
|
|
5
6
|
readonly name: string;
|
|
@@ -23,6 +24,7 @@ export interface NormalizedTask {
|
|
|
23
24
|
readonly name?: string;
|
|
24
25
|
readonly description?: string;
|
|
25
26
|
readonly options?: readonly Record<string, unknown>[];
|
|
26
|
-
};
|
|
27
|
+
}; /** Custom fields (edk#1464). */
|
|
28
|
+
readonly fields?: readonly NormalizedField[];
|
|
27
29
|
}
|
|
28
|
-
export declare function taskFromTf(block: TfBlock, ctx: FromTfContext): NormalizedTask;
|
|
30
|
+
export declare function taskFromTf(block: TfBlock, ctx: FromTfContext, fieldBlocks?: readonly TfBlock[]): NormalizedTask;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { dataRefLabel, optionalBoolean, optionalString, plainObject } from "../../engine/pull/context.js";
|
|
2
2
|
import { tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
3
|
+
import { fieldFromTf } from "../field/from-tf.js";
|
|
3
4
|
import { TASK_RESOURCE_TYPE } from "./module.js";
|
|
4
5
|
const KNOWN = new Set(["id", "name", "handle", "namespace", "category_id", "cloud_link_id", "description", "icon", "color", "title_field_name", "title_field_description", "id_field_name", "id_field_description", "status_field_name", "status_field_description", "status_options", "status_option_ids_by_label", "title_field_id", "id_field_id", "status_field_id", "comments_enabled", "comments_display_block_id"]);
|
|
5
|
-
export function taskFromTf(block, ctx) {
|
|
6
|
+
export function taskFromTf(block, ctx, fieldBlocks = []) {
|
|
6
7
|
if (block.type !== TASK_RESOURCE_TYPE || !block.label)
|
|
7
8
|
throw new Error(`expected ${TASK_RESOURCE_TYPE}`);
|
|
8
9
|
for (const key of Object.keys(block.attrs))
|
|
@@ -25,7 +26,11 @@ export function taskFromTf(block, ctx) {
|
|
|
25
26
|
const idDescription = optionalString(block.attrs, "id_field_description", `task ${block.label}`, ctx);
|
|
26
27
|
const statusName = optionalString(block.attrs, "status_field_name", `task ${block.label}`, ctx);
|
|
27
28
|
const statusDescription = optionalString(block.attrs, "status_field_description", `task ${block.label}`, ctx);
|
|
28
|
-
|
|
29
|
+
const refName = tfLabelToTsLabel(block.label);
|
|
30
|
+
const owner = { type: TASK_RESOURCE_TYPE, label: block.label, scope: "task", refName };
|
|
31
|
+
const fields = fieldBlocks.flatMap((fieldBlock) => fieldFromTf(fieldBlock, owner, ctx) ?? []);
|
|
32
|
+
return { refName, name, handle, namespace,
|
|
33
|
+
...(fields.length > 0 && { fields }),
|
|
29
34
|
...(categoryLabel !== undefined && { categoryRef: tfLabelToTsLabel(categoryLabel) }),
|
|
30
35
|
...(cloudLabel !== undefined && { cloudLinkRef: tfLabelToTsLabel(cloudLabel) }),
|
|
31
36
|
...(optionalString(block.attrs, "description", `task ${block.label}`, ctx) !== undefined && { description: optionalString(block.attrs, "description", `task ${block.label}`, ctx) }),
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { inManagedFieldOrder } from "../field/order.js";
|
|
1
2
|
import { NO_CATALOG } from "../../graph/types.js";
|
|
2
3
|
import { taskFromTf } from "./from-tf.js";
|
|
3
4
|
import { taskToTf } from "./to-tf.js";
|
|
4
5
|
export const TASK_RESOURCE_TYPE = "elementum_task";
|
|
5
6
|
function extract(stream, ctx) { const blocks = stream.byKind.get("task") ?? []; if (blocks.length !== 1)
|
|
6
|
-
throw new Error(`expected exactly one ${TASK_RESOURCE_TYPE}, found ${blocks.length}`); return { instance: taskFromTf(blocks[0], ctx) }; }
|
|
7
|
+
throw new Error(`expected exactly one ${TASK_RESOURCE_TYPE}, found ${blocks.length}`); return { instance: taskFromTf(blocks[0], ctx, inManagedFieldOrder(stream.byKind.get("field") ?? [], stream.byKind.get("managed-field-order") ?? [])) }; }
|
|
7
8
|
export const taskModule = {
|
|
8
9
|
kind: "task", stream: { role: "streamRoot", exportVerb: "tasks" }, authoring: { unit: "ownFile", bag: "tasks" }, parents: [{ parent: "org", child: "task" }],
|
|
9
10
|
resource: { shape: "single", resourceType: TASK_RESOURCE_TYPE, adoptable: true }, data: { participates: true, lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootNamespace", compatibilityFallback: "name" }] },
|
|
10
|
-
lifecycle: { participates: true, extractStreamRoot: extract, toTf: (entity, ctx) => taskToTf(entity, { orgRefs: ctx.orgRefs, diagnostics: ctx.diagnostics }) },
|
|
11
|
+
lifecycle: { participates: true, extractStreamRoot: extract, toTf: (entity, ctx) => taskToTf(entity, { orgRefs: ctx.orgRefs, diagnostics: ctx.diagnostics, workspaceAspects: ctx.workspaceAspects }) },
|
|
11
12
|
canvas: { participates: true, label: "Tasks", glyph: "☑", component: "appDetail" }, catalog: NO_CATALOG,
|
|
12
13
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type { OrgRefLookup } from "../../engine/build/context.js";
|
|
1
|
+
import type { OrgRefLookup, WorkspaceAspect } from "../../engine/build/context.js";
|
|
2
2
|
import { type DeployableEntity } from "../../engine/entity.js";
|
|
3
3
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
4
|
+
export interface TaskToTfResult {
|
|
5
|
+
readonly blocks: readonly TfBlock[];
|
|
6
|
+
/** Custom field bag key → `<resourceType>.<tfLabel>` (edk#1464). */
|
|
7
|
+
readonly fieldAddresses: ReadonlyMap<string, string>;
|
|
8
|
+
}
|
|
4
9
|
export declare function taskToTf(entity: DeployableEntity, ctx: {
|
|
5
10
|
orgRefs: OrgRefLookup;
|
|
6
11
|
diagnostics: string[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
12
|
+
workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
13
|
+
}): TaskToTfResult;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { managedFieldOrderToTf } from "../field/order.js";
|
|
2
|
+
import { authoredFieldKeysFromPayload, claimFieldDisplayName, fieldToTf } from "../field/to-tf.js";
|
|
1
3
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
4
|
import { expr } from "../../engine/tf/index.js";
|
|
3
5
|
import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
@@ -46,5 +48,34 @@ export function taskToTf(entity, ctx) {
|
|
|
46
48
|
attrs["status_field_description"] = p.statusField.description;
|
|
47
49
|
if (p.statusField?.options !== undefined)
|
|
48
50
|
attrs["status_options"] = p.statusField.options.map((option) => ({ label: option.label ?? "", ...(option.color !== undefined && { color: option.color }), tags: [...(option.tags ?? [])] }));
|
|
49
|
-
|
|
51
|
+
const blocks = [{ kind: "resource", type: TASK_RESOURCE_TYPE, label: p.namespace, attrs }];
|
|
52
|
+
// Custom fields (edk#1464): the same field resources apps emit, owned by the task.
|
|
53
|
+
const fieldAddresses = new Map();
|
|
54
|
+
const fieldOwnership = authoredFieldKeysFromPayload(p);
|
|
55
|
+
const displayNames = new Map();
|
|
56
|
+
const objectId = expr.resourceAttr(TASK_RESOURCE_TYPE, p.namespace, ["id"]);
|
|
57
|
+
for (const entry of p.fields ?? []) {
|
|
58
|
+
const typeKey = Object.keys(entry)[0];
|
|
59
|
+
if (typeKey === undefined)
|
|
60
|
+
continue;
|
|
61
|
+
const field = fieldToTf(typeKey, entry[typeKey], {
|
|
62
|
+
ownerTfLabel: p.namespace,
|
|
63
|
+
appRefName: entity.refName,
|
|
64
|
+
scope: "task",
|
|
65
|
+
objectId,
|
|
66
|
+
diagnostics: ctx.diagnostics,
|
|
67
|
+
orgRefs: ctx.orgRefs,
|
|
68
|
+
...(ctx.workspaceAspects !== undefined && { workspaceAspects: ctx.workspaceAspects }),
|
|
69
|
+
...(fieldOwnership !== undefined && { fieldOwnership }),
|
|
70
|
+
});
|
|
71
|
+
if (field === undefined)
|
|
72
|
+
continue;
|
|
73
|
+
claimFieldDisplayName(displayNames, field);
|
|
74
|
+
blocks.push(field.block);
|
|
75
|
+
fieldAddresses.set(field.bagKey, field.address);
|
|
76
|
+
}
|
|
77
|
+
const fieldOrder = managedFieldOrderToTf(p.namespace, "task", objectId, fieldAddresses);
|
|
78
|
+
if (fieldOrder !== undefined)
|
|
79
|
+
blocks.push(fieldOrder);
|
|
80
|
+
return { blocks, fieldAddresses };
|
|
50
81
|
}
|
|
@@ -459,10 +459,15 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
459
459
|
if (Array.isArray(fieldIds)) {
|
|
460
460
|
const fields = [];
|
|
461
461
|
const widgets = [];
|
|
462
|
+
const widgetAts = {};
|
|
462
463
|
for (const f of fieldIds) {
|
|
463
464
|
const widgetLabel = resourceRefLabel(f, WIDGET_RESOURCE_TYPE);
|
|
464
465
|
if (widgetLabel !== undefined) {
|
|
465
|
-
|
|
466
|
+
const key = scopedLabelToBagKey(ownerTfLabel, widgetLabel, scope);
|
|
467
|
+
widgets.push(key);
|
|
468
|
+
// `at` is an index in the field list. A widget after every field
|
|
469
|
+
// is the build default, so only an earlier index has to round-trip.
|
|
470
|
+
widgetAts[key] = fields.length;
|
|
466
471
|
continue;
|
|
467
472
|
}
|
|
468
473
|
const key = fieldRefFromTf(f, ownerLabel, ownerTfLabel, scope, ctx);
|
|
@@ -472,6 +477,9 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
472
477
|
section.fields = fields;
|
|
473
478
|
if (widgets.length > 0)
|
|
474
479
|
section.widgets = widgets;
|
|
480
|
+
const placed = Object.entries(widgetAts).filter(([, at]) => at < fields.length);
|
|
481
|
+
if (placed.length > 0)
|
|
482
|
+
section.widgetAts = Object.fromEntries(placed);
|
|
475
483
|
}
|
|
476
484
|
}
|
|
477
485
|
else if (wireType === UPDATE_SECTION_WIRE_TYPE && typeof rec["name"] === "string") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The view entity's registry entries (see src/graph/). */
|
|
2
2
|
import { asNamedRef, namedFactoryEntry } from "../../catalog/render-helpers.js";
|
|
3
3
|
import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE, } from "../../graph/types.js";
|
|
4
|
-
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, CUSTOM_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, VIEW_DATA_RESOURCE_TYPE, } from "./types.js";
|
|
4
|
+
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, CUSTOM_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, PLATFORM_DEFAULT_LIST_VIEW_NAME, VIEW_DATA_RESOURCE_TYPE, } from "./types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Layouts + list views are stream members folded into the app authoring file
|
|
7
7
|
* (inline), extracted by `appFromTf` — not own-file kinds.
|
|
@@ -77,6 +77,9 @@ export const managedViewOrderModule = {
|
|
|
77
77
|
shape: "single",
|
|
78
78
|
resourceType: MANAGED_VIEW_ORDER_RESOURCE_TYPE,
|
|
79
79
|
adoptable: true,
|
|
80
|
+
// The provider leaves the platform's default "List" view out of an order
|
|
81
|
+
// whose state doesn't list it (#1598); the export always lists it (#1658).
|
|
82
|
+
stateScopedPlatformEntries: [{ attribute: "view_ids", name: PLATFORM_DEFAULT_LIST_VIEW_NAME }],
|
|
80
83
|
},
|
|
81
84
|
data: NO_DATA,
|
|
82
85
|
lifecycle: NO_LIFECYCLE,
|
|
@@ -40,6 +40,12 @@ export interface AppLayoutSectionWire {
|
|
|
40
40
|
readonly __kind?: string;
|
|
41
41
|
readonly refName?: string;
|
|
42
42
|
readonly parent?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Index in this group's field list where the widget is inserted.
|
|
45
|
+
* Omitted widgets stay after the fields, which is where a group that
|
|
46
|
+
* only has trailing action buttons belongs.
|
|
47
|
+
*/
|
|
48
|
+
readonly at?: number;
|
|
43
49
|
}[];
|
|
44
50
|
}
|
|
45
51
|
export interface AppLayoutWire {
|
|
@@ -109,13 +115,6 @@ export interface ViewToTfOptions {
|
|
|
109
115
|
readonly ownerTfLabel: string;
|
|
110
116
|
/** App children use `apps_<ns>_`; element children use `<ns>_`. */
|
|
111
117
|
readonly scope?: ChildResourceScope;
|
|
112
|
-
/**
|
|
113
|
-
* The owning aspect's display name — `elementum_managed_view_order`'s label
|
|
114
|
-
* has no authored bag key (it's a derived aspect-wide singleton), so ei
|
|
115
|
-
* derives it from the NAME (its `SanitizeName`, not the namespace);
|
|
116
|
-
* matching that here keeps the build-vs-export address-stable across a real pull.
|
|
117
|
-
*/
|
|
118
|
-
readonly aspectName: string;
|
|
119
118
|
/** The owning aspect's id reference — computed by the caller. */
|
|
120
119
|
readonly objectId: TfValue;
|
|
121
120
|
/** App stage terraform labels declared by systemFields.stage.options. */
|