@elementumai/edk 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist-sdk/src/catalog/factories.js +8 -2
- package/dist-sdk/src/catalog/types.d.ts +5 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
- package/dist-sdk/src/engine/coverage-gaps.js +4 -0
- package/dist-sdk/src/engine/ei/run.d.ts +8 -0
- package/dist-sdk/src/engine/ei/run.js +46 -7
- package/dist-sdk/src/engine/pull/context.d.ts +24 -0
- package/dist-sdk/src/engine/pull/stream-root.d.ts +11 -0
- package/dist-sdk/src/engine/pull/stream-root.js +22 -6
- package/dist-sdk/src/engine/workspace/authoring-layout.js +16 -2
- package/dist-sdk/src/entities/access-policy/from-tf.js +4 -7
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -1
- package/dist-sdk/src/entities/agent/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent/from-tf.js +28 -1
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +3 -1
- package/dist-sdk/src/entities/agent/to-tf.js +21 -3
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +6 -23
- package/dist-sdk/src/entities/app/module.js +2 -0
- package/dist-sdk/src/entities/approval-chain/from-tf.js +2 -2
- package/dist-sdk/src/entities/automation/build.d.ts +10 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1 -0
- package/dist-sdk/src/entities/automation/from-tf.js +72 -11
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +12 -0
- package/dist-sdk/src/entities/automation/system-ref-name.d.ts +23 -3
- package/dist-sdk/src/entities/automation/system-ref-name.js +86 -4
- package/dist-sdk/src/entities/automation/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/automation/to-tf.js +227 -27
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +42 -2
- package/dist-sdk/src/entities/dashboard/to-tf.js +9 -1
- package/dist-sdk/src/entities/dashboard-widget-order/module.d.ts +10 -0
- package/dist-sdk/src/entities/dashboard-widget-order/module.js +25 -0
- package/dist-sdk/src/entities/dashboard-widget-order/order.d.ts +31 -0
- package/dist-sdk/src/entities/dashboard-widget-order/order.js +102 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +5 -21
- package/dist-sdk/src/entities/element/module.js +2 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +25 -2
- package/dist-sdk/src/entities/field/from-tf.js +119 -14
- package/dist-sdk/src/entities/relationship/from-tf.js +2 -2
- package/dist-sdk/src/entities/role/build.d.ts +3 -4
- package/dist-sdk/src/entities/search-table/build.d.ts +9 -3
- package/dist-sdk/src/entities/search-table/build.js +4 -4
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +20 -2
- package/dist-sdk/src/entities/shared/context.d.ts +14 -1
- package/dist-sdk/src/entities/shared/filters/index.d.ts +24 -13
- package/dist-sdk/src/entities/shared/filters/index.js +12 -1
- package/dist-sdk/src/entities/shared/filters/print.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/print.js +15 -6
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +4 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +16 -0
- package/dist-sdk/src/entities/shared/filters/types.d.ts +4 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +2 -5
- package/dist-sdk/src/entities/task/from-tf.js +3 -3
- package/dist-sdk/src/entities/view/custom-view-validate.d.ts +6 -4
- package/dist-sdk/src/entities/view/custom-view-validate.js +36 -18
- package/dist-sdk/src/entities/view/from-tf.js +9 -0
- package/dist-sdk/src/entities/view/to-tf.js +66 -47
- package/dist-sdk/src/entities/visual-flow/module.js +52 -1
- package/dist-sdk/src/entities/widget/from-tf.js +6 -6
- package/dist-sdk/src/graph/index.d.ts +4 -0
- package/dist-sdk/src/graph/index.js +1 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +36 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,10 +28,13 @@ folders:
|
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
30
|
npm install @elementumai/edk
|
|
31
|
+
npm install --save-dev typescript
|
|
31
32
|
```
|
|
32
33
|
|
|
33
|
-
Use Node 24 or newer.
|
|
34
|
-
|
|
34
|
+
Use Node 24 or newer. TypeScript is what checks your files (`npx tsc --noEmit`);
|
|
35
|
+
the SDK brings the Node type definitions the workspace's `tsconfig.json` names.
|
|
36
|
+
The npm package is the authoring SDK; the only public executable is
|
|
37
|
+
`elementum`.
|
|
35
38
|
|
|
36
39
|
### Platform support
|
|
37
40
|
|
|
@@ -103,6 +106,7 @@ mkdir elementum-workspace
|
|
|
103
106
|
cd elementum-workspace
|
|
104
107
|
npm init -y
|
|
105
108
|
npm install @elementumai/edk
|
|
109
|
+
npm install --save-dev typescript
|
|
106
110
|
elementum auth login --profile <profile>
|
|
107
111
|
elementum --profile=<profile> pull org --data-only
|
|
108
112
|
cd <instance>/<organization>
|
|
@@ -369,13 +369,19 @@ function stampOwnedRefs(bag, identity, parentKind) {
|
|
|
369
369
|
...(identity.namespace !== undefined ? { parentNamespace: identity.namespace } : {}),
|
|
370
370
|
}]));
|
|
371
371
|
}
|
|
372
|
-
/** Stamp the owning app's stable key
|
|
372
|
+
/** Stamp the owning app's stable key, display name and namespace onto each skill token. */
|
|
373
373
|
function stampSkillRefs(bag, identity) {
|
|
374
374
|
if (bag === undefined)
|
|
375
375
|
return undefined;
|
|
376
376
|
const out = {};
|
|
377
377
|
for (const [refName, ref] of Object.entries(bag)) {
|
|
378
|
-
out[refName] = {
|
|
378
|
+
out[refName] = {
|
|
379
|
+
...ref,
|
|
380
|
+
refName,
|
|
381
|
+
parent: identity.refName,
|
|
382
|
+
parentName: identity.name,
|
|
383
|
+
...(identity.namespace !== undefined ? { parentNamespace: identity.namespace } : {}),
|
|
384
|
+
};
|
|
379
385
|
}
|
|
380
386
|
return out;
|
|
381
387
|
}
|
|
@@ -78,6 +78,11 @@ export interface SkillRef extends CatalogRef<"skill"> {
|
|
|
78
78
|
* owner identity needed to resolve `app_id` without exposing a platform id.
|
|
79
79
|
*/
|
|
80
80
|
readonly parentName?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Namespace of the owning app, when its catalog records one. A build looks
|
|
83
|
+
* an owner outside the workspace up by it, as ei's export does (edk#2919).
|
|
84
|
+
*/
|
|
85
|
+
readonly parentNamespace?: string;
|
|
81
86
|
/**
|
|
82
87
|
* A raw platform id, when the export carries a `skill_ids`/
|
|
83
88
|
* `preloaded_skill_ids` entry that resolves to neither a self-app resource
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
* the task is emitted, and the caller never resumes at run time)
|
|
18
18
|
* - the custom-view non-PanesBlock root hint (check.mjs `warn`; the layout is
|
|
19
19
|
* emitted exactly as authored, edk#1771)
|
|
20
|
+
* - a custom-view binding to a path missing from spec.state (the page reads it
|
|
21
|
+
* as undefined; the layout is emitted exactly as authored, edk#2923)
|
|
20
22
|
* - the executeScript lint for an undeclared input, an output no return sets
|
|
21
23
|
* (edk#2286), or a script with no top-level return (edk#2364); the script is
|
|
22
24
|
* emitted as authored
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
* the task is emitted, and the caller never resumes at run time)
|
|
18
18
|
* - the custom-view non-PanesBlock root hint (check.mjs `warn`; the layout is
|
|
19
19
|
* emitted exactly as authored, edk#1771)
|
|
20
|
+
* - a custom-view binding to a path missing from spec.state (the page reads it
|
|
21
|
+
* as undefined; the layout is emitted exactly as authored, edk#2923)
|
|
20
22
|
* - the executeScript lint for an undeclared input, an output no return sets
|
|
21
23
|
* (edk#2286), or a script with no top-level return (edk#2364); the script is
|
|
22
24
|
* emitted as authored
|
|
@@ -34,9 +36,11 @@ const ADVISORY_DIAGNOSTICS = [
|
|
|
34
36
|
// edk#1870. The task and loop names are quoted as authored and may contain `"`, so match them with
|
|
35
37
|
// [\s\S]* and anchor on the fixed rest of the message, end included (the label is a sanitized TF label).
|
|
36
38
|
/^automation \S+: task "[\s\S]*" is a synchronous Dynamic Reference runAutomation inside forEach "[\s\S]*"; the platform never resumes the caller after the called automation finishes, so the steps after it never run and the run stays parked\. Move the call out of the forEach, or call a known automation by its catalog ref \(Select Automation\)$/,
|
|
39
|
+
/^automation \S+: field ".*" is set from .+, a (?:whole|Multi-Select)/,
|
|
37
40
|
/^automation \S+: executeScript ".*" (?:reads input|declares output|has no top-level return) /,
|
|
38
41
|
/^applied-automation-revisions\.json .*; until then no automation is checked for an edit without a revision bump$/,
|
|
39
42
|
/\.root: "[^"]*" is (?:untyped|a [A-Za-z0-9_]+); the root is usually a PanesBlock \(needed for record lists to open the details pane\)$/,
|
|
43
|
+
/: binds to "[^"]*", which is not in spec\.state, so it starts undefined\. Add an initial value there to set its default\.$/,
|
|
40
44
|
];
|
|
41
45
|
export function isAdvisoryDiagnostic(message) {
|
|
42
46
|
return ADVISORY_DIAGNOSTICS.some((pattern) => pattern.test(message));
|
|
@@ -31,6 +31,14 @@ export declare class EiRunError extends Error {
|
|
|
31
31
|
readonly stdout?: string;
|
|
32
32
|
constructor(message: string, exitCode: number | null, stderr?: string, stdout?: string);
|
|
33
33
|
}
|
|
34
|
+
/** Whether OpenTofu output reports a stale provider selection (edk#2946). */
|
|
35
|
+
export declare function mentionsStaleProviderSelection(text: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether a `runEiPassthrough` since the last take printed a stale provider
|
|
38
|
+
* selection diagnostic (edk#2946); clears it. Output handed to a terminal
|
|
39
|
+
* (`passthroughNeedsTerminal`) is not seen here.
|
|
40
|
+
*/
|
|
41
|
+
export declare function takeStaleProviderSelection(): boolean;
|
|
34
42
|
export declare function configureBridgeProfile(profile: string | undefined): void;
|
|
35
43
|
export declare function configuredBridgeProfile(): string | undefined;
|
|
36
44
|
export declare function managedElementumRoot(): string;
|
|
@@ -63,8 +63,41 @@ const LOCAL_HELP_TIMEOUT_MS = 1_500;
|
|
|
63
63
|
let bridgeProfile;
|
|
64
64
|
/** Convert the provider's default tflog text sink into EDK technical logs. */
|
|
65
65
|
const TFLOG_LINE = /^time=(\S+)\s+level=(TRACE|DEBUG|INFO|WARN|ERROR)\s+msg="((?:\\.|[^"])*)"/;
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* A resource instance address as OpenTofu prints it before a progress verb:
|
|
68
|
+
* `elementum_app.x`, `data.elementum_field.y`, `module.m["k"].elementum_app.x[0]`,
|
|
69
|
+
* or a deposed instance (`elementum_app.x (deposed object 1a2b3c4d)`). A
|
|
70
|
+
* diagnostic header such as `Warning: Creating …` or `│ Error: Modifying …`
|
|
71
|
+
* is never an address, so it is not mistaken for progress (edk#2942). The Go
|
|
72
|
+
* bridge's `progressResourceLine` (cmd/elementum/terraform/executor.go) uses
|
|
73
|
+
* the same grammar.
|
|
74
|
+
*/
|
|
75
|
+
const TOFU_ADDRESS_INDEX = String.raw `(?:\[(?:\d+|"(?:[^"\\]|\\.)*")\])?`;
|
|
76
|
+
const TOFU_RESOURCE_ADDRESS = String.raw `(?:module\.[A-Za-z_][\w-]*${TOFU_ADDRESS_INDEX}\.)*(?:data\.)?[A-Za-z_][\w-]*\.[A-Za-z_][\w-]*${TOFU_ADDRESS_INDEX}(?: \(deposed object [^)]+\))?`;
|
|
77
|
+
const TOFU_TRANSIENT_LINE = new RegExp(String.raw `^${TOFU_RESOURCE_ADDRESS}: (Reading|Still reading|Read complete after|Preparing import|Importing|Import complete|Import complete after|Refreshing state|Still refreshing|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after)(?:\.\.\.|\s)`);
|
|
67
78
|
const ANSI_SEQUENCE = /\x1b\[[0-?]*[ -/]*[@-~]/g;
|
|
79
|
+
/**
|
|
80
|
+
* OpenTofu's diagnostics for a provider selection that no longer matches
|
|
81
|
+
* providers.tf: a lock pinning another version, or a locked package that is
|
|
82
|
+
* not installed. The same test as the bridge's `isStaleProviderSelection`
|
|
83
|
+
* (cmd/elementum/terraform/executor.go).
|
|
84
|
+
*/
|
|
85
|
+
const STALE_PROVIDER_SELECTION = /Inconsistent dependency lock file|Required plugins are not installed/;
|
|
86
|
+
let staleProviderSelectionSeen = false;
|
|
87
|
+
/** Whether OpenTofu output reports a stale provider selection (edk#2946). */
|
|
88
|
+
export function mentionsStaleProviderSelection(text) {
|
|
89
|
+
return STALE_PROVIDER_SELECTION.test(withoutAnsi(text));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Whether a `runEiPassthrough` since the last take printed a stale provider
|
|
93
|
+
* selection diagnostic (edk#2946); clears it. Output handed to a terminal
|
|
94
|
+
* (`passthroughNeedsTerminal`) is not seen here.
|
|
95
|
+
*/
|
|
96
|
+
export function takeStaleProviderSelection() {
|
|
97
|
+
const seen = staleProviderSelectionSeen;
|
|
98
|
+
staleProviderSelectionSeen = false;
|
|
99
|
+
return seen;
|
|
100
|
+
}
|
|
68
101
|
function withoutAnsi(line) {
|
|
69
102
|
return line.replace(ANSI_SEQUENCE, "");
|
|
70
103
|
}
|
|
@@ -484,8 +517,14 @@ export function runEiPassthrough(args, opts) {
|
|
|
484
517
|
loggedTofuLines.add(plain);
|
|
485
518
|
writeTechnicalLog("DEBUG", "tofu", plain);
|
|
486
519
|
};
|
|
520
|
+
// edk#2946: note a stale provider selection whatever else consumes the line.
|
|
521
|
+
const observed = (consume) => (line) => {
|
|
522
|
+
if (mentionsStaleProviderSelection(line))
|
|
523
|
+
staleProviderSelectionSeen = true;
|
|
524
|
+
return consume?.(line) ?? false;
|
|
525
|
+
};
|
|
487
526
|
const output = Promise.all([
|
|
488
|
-
routeEiOutput(child.stdout, opts?.stdout ?? process.stdout, opts?.bridge === true ? (line) => {
|
|
527
|
+
routeEiOutput(child.stdout, opts?.stdout ?? process.stdout, observed(opts?.bridge === true ? (line) => {
|
|
489
528
|
const plain = withoutAnsi(line);
|
|
490
529
|
const event = parseProgressEvent(line);
|
|
491
530
|
if (event !== undefined) {
|
|
@@ -520,8 +559,8 @@ export function runEiPassthrough(args, opts) {
|
|
|
520
559
|
// A bridge-versioned ei may still emit ordinary user-facing text
|
|
521
560
|
// (for example "Using tofu") on stdout. Preserve it verbatim.
|
|
522
561
|
return false;
|
|
523
|
-
} : undefined, writeUserPayload),
|
|
524
|
-
routeEiOutput(child.stderr, opts?.stderr ?? process.stderr, opts?.bridge === true ? (line) => {
|
|
562
|
+
} : undefined), writeUserPayload),
|
|
563
|
+
routeEiOutput(child.stderr, opts?.stderr ?? process.stderr, observed(opts?.bridge === true ? (line) => {
|
|
525
564
|
const plain = withoutAnsi(line);
|
|
526
565
|
const event = parseProgressEvent(line);
|
|
527
566
|
if (event !== undefined) {
|
|
@@ -559,7 +598,7 @@ export function runEiPassthrough(args, opts) {
|
|
|
559
598
|
// Preserve unrecognized stderr through the writer callback so the
|
|
560
599
|
// caller-selected stderr destination is retained.
|
|
561
600
|
return false;
|
|
562
|
-
} : undefined, writeUserPayload),
|
|
601
|
+
} : undefined), writeUserPayload),
|
|
563
602
|
]);
|
|
564
603
|
const forwardSignal = (signal) => child.kill(signal);
|
|
565
604
|
process.once("SIGINT", forwardSignal);
|
|
@@ -1066,8 +1105,8 @@ export function parseTofuJsonEvent(line) {
|
|
|
1066
1105
|
return { type: "other" };
|
|
1067
1106
|
}
|
|
1068
1107
|
}
|
|
1069
|
-
const TOFU_PROGRESS_LINE =
|
|
1070
|
-
const TOFU_PROGRESS_EVENT_LABEL =
|
|
1108
|
+
const TOFU_PROGRESS_LINE = new RegExp(String.raw `^(${TOFU_RESOURCE_ADDRESS}): (Reading|Still reading|Preparing import|Importing|Refreshing state|Still refreshing|Read complete after|Import complete after|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after)\b`);
|
|
1109
|
+
const TOFU_PROGRESS_EVENT_LABEL = new RegExp(String.raw `^(Reading|Still reading|Preparing import|Importing|Refreshing state|Still refreshing|Read complete after|Import complete after|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after):\s+(${TOFU_RESOURCE_ADDRESS})$`);
|
|
1071
1110
|
const TOFU_PROGRESS_STARTS = new Set([
|
|
1072
1111
|
"Reading", "Preparing import", "Importing", "Refreshing state",
|
|
1073
1112
|
"Creating", "Modifying", "Destroying",
|
|
@@ -45,6 +45,15 @@ export interface FromTfContext {
|
|
|
45
45
|
readonly appRefName: string;
|
|
46
46
|
readonly skillRefName: string;
|
|
47
47
|
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Owner namespace + skill display name → materialized catalog skill ref.
|
|
50
|
+
* ei looks a skill's owner up by namespace alone, and a namespace is unique
|
|
51
|
+
* where a display name is not, so it wins when the export carries one (edk#2919).
|
|
52
|
+
*/
|
|
53
|
+
readonly foreignSkillRefsByOwnerNamespace?: ReadonlyMap<string, {
|
|
54
|
+
readonly appRefName: string;
|
|
55
|
+
readonly skillRefName: string;
|
|
56
|
+
}>;
|
|
48
57
|
readonly foreignElementRefNames?: ReadonlyMap<string, string>;
|
|
49
58
|
readonly foreignTaskRefNames?: ReadonlyMap<string, string>;
|
|
50
59
|
/** Imported platform field id -> typed owner/key, assembled by the recursive pull workspace context. */
|
|
@@ -54,6 +63,15 @@ export interface FromTfContext {
|
|
|
54
63
|
readonly fieldName?: string;
|
|
55
64
|
readonly fieldType?: string;
|
|
56
65
|
}>;
|
|
66
|
+
/**
|
|
67
|
+
* `elementum_field.<label>` → platform id, for a `data "elementum_field"`
|
|
68
|
+
* lookup of one of the pulled owner's own fields that pull does not extract
|
|
69
|
+
* (#2815: ei looks up an element's Closed at / Closed by fields this way).
|
|
70
|
+
* A layout or view that names it keeps the field by this id, as for any
|
|
71
|
+
* other unextracted field (#1978), instead of dropping it. Absent: dropped
|
|
72
|
+
* as before.
|
|
73
|
+
*/
|
|
74
|
+
readonly ownFieldIdsByDataAddress?: ReadonlyMap<string, string>;
|
|
57
75
|
/** Platform table id -> typed org catalog identity, loaded by recursive pull when table refs are present. */
|
|
58
76
|
readonly foreignTableRefsById?: ReadonlyMap<string, {
|
|
59
77
|
readonly tableRefName: string;
|
|
@@ -263,6 +281,12 @@ export interface ExtractRequirement {
|
|
|
263
281
|
readonly pruneOwnFile?: {
|
|
264
282
|
readonly kind: EntityKindId;
|
|
265
283
|
readonly prune: (items: readonly unknown[]) => readonly unknown[];
|
|
284
|
+
/**
|
|
285
|
+
* Set when `prune` removes the whole own-file item: its earlier authored
|
|
286
|
+
* file is archived once `address` is released, so the next plan doesn't
|
|
287
|
+
* create it again (#2892).
|
|
288
|
+
*/
|
|
289
|
+
readonly archiveRefName?: string;
|
|
266
290
|
};
|
|
267
291
|
}
|
|
268
292
|
/**
|
|
@@ -35,6 +35,14 @@ export interface StreamRootExtract {
|
|
|
35
35
|
readonly cloudLinkHandle?: string;
|
|
36
36
|
/** Resource addresses in the stream that aren't extracted — reported, not fatal (plan §6). */
|
|
37
37
|
readonly skipped: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Skipped address → the own-file child it belongs to (`skippedOwnFiles`,
|
|
40
|
+
* #1877), so the stale-path sweep keeps a skipped child's file (edk#2926).
|
|
41
|
+
*/
|
|
42
|
+
readonly skippedOwners?: ReadonlyMap<string, {
|
|
43
|
+
readonly kind: EntityKindId;
|
|
44
|
+
readonly refName: string;
|
|
45
|
+
}>;
|
|
38
46
|
/** Skipped addresses no authored source can ever manage; adoption releases any already in state (see OwnFileExtractResult). */
|
|
39
47
|
readonly releaseIfManaged?: readonly string[];
|
|
40
48
|
/** Own-file ref names whose authored files are archived because their state was released (#1858). */
|
|
@@ -110,10 +118,13 @@ export interface StreamRootExtractOptions {
|
|
|
110
118
|
readonly options?: readonly string[];
|
|
111
119
|
readonly systemStage?: true;
|
|
112
120
|
}>;
|
|
121
|
+
/** See `FromTfContext.ownFieldIdsByDataAddress` (#2815). */
|
|
122
|
+
readonly ownFieldIdsByDataAddress?: FromTfContext["ownFieldIdsByDataAddress"];
|
|
113
123
|
readonly foreignSkillRefsByOwnerName?: ReadonlyMap<string, {
|
|
114
124
|
readonly appRefName: string;
|
|
115
125
|
readonly skillRefName: string;
|
|
116
126
|
}>;
|
|
127
|
+
readonly foreignSkillRefsByOwnerNamespace?: FromTfContext["foreignSkillRefsByOwnerNamespace"];
|
|
117
128
|
readonly foreignTableRefsById?: ReadonlyMap<string, {
|
|
118
129
|
readonly tableRefName: string;
|
|
119
130
|
readonly name: string;
|
|
@@ -395,7 +395,9 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
395
395
|
...(opts.cloning !== undefined ? { cloning: opts.cloning } : {}),
|
|
396
396
|
foreignFieldRefsById: opts.foreignFieldRefsById,
|
|
397
397
|
foreignFieldRefsByDataAddress: opts.foreignFieldRefsByDataAddress,
|
|
398
|
+
...(opts.ownFieldIdsByDataAddress !== undefined && { ownFieldIdsByDataAddress: opts.ownFieldIdsByDataAddress }),
|
|
398
399
|
foreignSkillRefsByOwnerName: opts.foreignSkillRefsByOwnerName,
|
|
400
|
+
foreignSkillRefsByOwnerNamespace: opts.foreignSkillRefsByOwnerNamespace,
|
|
399
401
|
fieldNamesByOwnerRefName: opts.fieldNamesByOwnerRefName,
|
|
400
402
|
// Root and own-file extractors both print group refs (edk#1412).
|
|
401
403
|
groupKeysByName: opts.groupKeysByName,
|
|
@@ -468,7 +470,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
468
470
|
skippedOwners.set(address, { kind: child.kind, refName });
|
|
469
471
|
}
|
|
470
472
|
}
|
|
471
|
-
rootInstance = dropDependentsOfSkipped(rootInstance, ownFileByKind, requiresExtracted, new Set(resources.keys()), skipped, releaseIfManaged, diagnostics, reports, opts.keptOwnFile);
|
|
473
|
+
rootInstance = dropDependentsOfSkipped(rootInstance, ownFileByKind, requiresExtracted, new Set(resources.keys()), skipped, releaseIfManaged, diagnostics, reports, opts.keptOwnFile, quarantineOwnFiles);
|
|
472
474
|
if (settles.length > 0) {
|
|
473
475
|
const settledRoot = rootInstance;
|
|
474
476
|
const inSource = resourcesInSource({
|
|
@@ -487,6 +489,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
487
489
|
ownFileByKind,
|
|
488
490
|
...(root.cloudLinkHandle !== undefined && { cloudLinkHandle: root.cloudLinkHandle }),
|
|
489
491
|
skipped,
|
|
492
|
+
...(skippedOwners.size > 0 && { skippedOwners }),
|
|
490
493
|
...(releaseIfManaged.length > 0 && { releaseIfManaged }),
|
|
491
494
|
...(quarantineOwnFiles.length > 0 && { quarantineOwnFiles }),
|
|
492
495
|
diagnostics,
|
|
@@ -521,39 +524,52 @@ export function extractApp(doc, opts = {}) {
|
|
|
521
524
|
* adoption keeps managing it (SF3). That outcome is reported on the
|
|
522
525
|
* informational `reports` channel, not as a coverage gap: nothing is lost.
|
|
523
526
|
*/
|
|
524
|
-
function dropDependentsOfSkipped(root, ownFileByKind, requirements, streamAddresses, skipped, releaseIfManaged, diagnostics, reports, keptOwnFile) {
|
|
527
|
+
function dropDependentsOfSkipped(root, ownFileByKind, requirements, streamAddresses, skipped, releaseIfManaged, diagnostics, reports, keptOwnFile, quarantineOwnFiles = []) {
|
|
525
528
|
const skippedSet = new Set(skipped);
|
|
529
|
+
// A released requirement's authored file is archived after adoption, so it
|
|
530
|
+
// can't keep its dependent buildable (#2892).
|
|
531
|
+
const releasedSet = new Set(releaseIfManaged);
|
|
526
532
|
let pruned = root;
|
|
527
533
|
for (const requirement of requirements) {
|
|
528
534
|
if (skippedSet.has(requirement.address))
|
|
529
535
|
continue;
|
|
530
|
-
const reason = unbuildableReason(requirement, root, streamAddresses, skippedSet, keptOwnFile, reports);
|
|
536
|
+
const reason = unbuildableReason(requirement, root, streamAddresses, skippedSet, releasedSet, keptOwnFile, reports);
|
|
531
537
|
if (reason === undefined)
|
|
532
538
|
continue;
|
|
533
539
|
pruned = requirement.prune(pruned);
|
|
534
540
|
const ownFile = requirement.pruneOwnFile;
|
|
535
|
-
if (ownFile !== undefined)
|
|
541
|
+
if (ownFile !== undefined) {
|
|
536
542
|
ownFileByKind.set(ownFile.kind, ownFile.prune(ownFileByKind.get(ownFile.kind) ?? []));
|
|
543
|
+
if (ownFile.archiveRefName !== undefined) {
|
|
544
|
+
quarantineOwnFiles.push({ kind: ownFile.kind, refName: ownFile.archiveRefName, afterRelease: [requirement.address] });
|
|
545
|
+
}
|
|
546
|
+
}
|
|
537
547
|
skipped.push(requirement.address);
|
|
538
548
|
skippedSet.add(requirement.address);
|
|
539
549
|
releaseIfManaged.push(requirement.address);
|
|
550
|
+
releasedSet.add(requirement.address);
|
|
540
551
|
diagnostics.push(typedCoverageGap({
|
|
541
552
|
kind: "skipped",
|
|
542
553
|
entity: requirement.address,
|
|
543
554
|
detail: `left out of the pull, skipped: ${reason}`,
|
|
544
|
-
consequence: "it is not written to source or adopted, and adoption releases it if state already manages it; it keeps running on the platform unmanaged until a later pull extracts what it needs, which writes it back to source and adopts it again"
|
|
555
|
+
consequence: "it is not written to source or adopted, and adoption releases it if state already manages it; it keeps running on the platform unmanaged until a later pull extracts what it needs, which writes it back to source and adopts it again" +
|
|
556
|
+
(requirement.pruneOwnFile?.archiveRefName !== undefined
|
|
557
|
+
? `. Its file from an earlier pull (${requirement.pruneOwnFile.kind} ${requirement.pruneOwnFile.archiveRefName}) is archived once adoption releases it; with --no-adopt, or if adoption fails first, that file stays until a pull that adopts`
|
|
558
|
+
: ""),
|
|
545
559
|
}));
|
|
546
560
|
}
|
|
547
561
|
return pruned;
|
|
548
562
|
}
|
|
549
563
|
/** Why build will not emit `requirement`'s dependent, or undefined when it will. */
|
|
550
|
-
function unbuildableReason(requirement, root, streamAddresses, skipped, keptOwnFile, reports) {
|
|
564
|
+
function unbuildableReason(requirement, root, streamAddresses, skipped, released, keptOwnFile, reports) {
|
|
551
565
|
if (requirement.unresolved === true)
|
|
552
566
|
return `it needs ${requirement.requires}, which is not a resource this pull extracts`;
|
|
553
567
|
if (!streamAddresses.has(requirement.requires))
|
|
554
568
|
return `it needs ${requirement.requires}, which is not in the export`;
|
|
555
569
|
if (!skipped.has(requirement.requires))
|
|
556
570
|
return undefined;
|
|
571
|
+
if (released.has(requirement.requires))
|
|
572
|
+
return `it needs ${requirement.requires}, which this pull skipped and releases`;
|
|
557
573
|
const ownFile = requirement.requiresOwnFile;
|
|
558
574
|
if (ownFile !== undefined && keptOwnFile?.(root, ownFile.kind, ownFile.refName) === true) {
|
|
559
575
|
reports.push(`${requirement.address}: kept in source and adoption: ${requirement.requires} was not re-extracted this pull, but its authored ${ownFile.kind} file ${ownFile.refName}.ts is kept, so build still emits both`);
|
|
@@ -53,6 +53,20 @@ export function isAuthoringHelperFile(fileName) {
|
|
|
53
53
|
// `_1Foo`, `_3_1Bar` — managed entity refs, not helpers.
|
|
54
54
|
return !/^\d/.test(stem.slice(1));
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The error for a non-entity file directly in an app, element, table, task or
|
|
58
|
+
* portal folder: name the file and how to make it a helper (#2897). A name that
|
|
59
|
+
* starts with "_" and a digit is an entity ref (#751), not a helper.
|
|
60
|
+
*/
|
|
61
|
+
function helperFileMessage(rel, bag, refFolder, stem) {
|
|
62
|
+
// A "_" + letter stem is already a helper and never gets here. "_" + digit is
|
|
63
|
+
// an entity ref (#751), so a stem that starts with a digit, with or without
|
|
64
|
+
// the "_", needs a letter after the "_" to become a helper.
|
|
65
|
+
const suggestion = /^_?\d/.test(stem) ? `_helper_${stem.replace(/^_/, "")}` : `_${stem}`;
|
|
66
|
+
return (`${rel}: the only source file directly in ${bag}/${refFolder}/ is ${bag}/${refFolder}/${refFolder}.ts. ` +
|
|
67
|
+
`For a helper module that other files import, start its name with "_" and a letter (${bag}/${refFolder}/${suggestion}.ts): ` +
|
|
68
|
+
`files named that way are helpers, not ${bag}.`);
|
|
69
|
+
}
|
|
56
70
|
/** Walk up from `startDir` to the nearest directory that contains `tsconfig.json`. */
|
|
57
71
|
export function findOrgWorkspaceByTsconfig(startDir) {
|
|
58
72
|
let cur = resolve(startDir);
|
|
@@ -89,7 +103,7 @@ export function assertRelativeAuthoringPath(relPath) {
|
|
|
89
103
|
if (parts.length === 3) {
|
|
90
104
|
const refFolder = parts[1];
|
|
91
105
|
if (refFolder !== stem) {
|
|
92
|
-
throw new Error(
|
|
106
|
+
throw new Error(helperFileMessage(rel, bag, refFolder, stem));
|
|
93
107
|
}
|
|
94
108
|
return;
|
|
95
109
|
}
|
|
@@ -108,7 +122,7 @@ export function assertRelativeAuthoringPath(relPath) {
|
|
|
108
122
|
if (parts.length === 3) {
|
|
109
123
|
const refFolder = parts[1];
|
|
110
124
|
if (refFolder !== stem) {
|
|
111
|
-
throw new Error(
|
|
125
|
+
throw new Error(helperFileMessage(rel, bag, refFolder, stem));
|
|
112
126
|
}
|
|
113
127
|
return;
|
|
114
128
|
}
|
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
import { EntityTfError } from "../../engine/entity.js";
|
|
14
14
|
import { dataRefLabel, groupCatalogKey, resourceRefLabel } from "../../engine/pull/context.js";
|
|
15
15
|
import { appResourceLabelPrefix, elementResourceLabelPrefix, isTfExpr, scopedResourceLabel, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import { bagKeyForPulledCustomField } from "../field/from-tf.js";
|
|
18
|
-
import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
|
|
16
|
+
import { pulledFieldBagKey } from "../field/from-tf.js";
|
|
19
17
|
import { filterFromTf as deserializeFilterFromTf } from "../shared/filters/tf-codec.js";
|
|
20
18
|
import { groupId, userId, } from "./principal.js";
|
|
21
19
|
import { KNOWN_ACCESS_POLICY_ATTRS } from "./types.js";
|
|
22
20
|
import { finishPulledMemberList } from "./member-list.js";
|
|
23
|
-
function fieldRef(value, owner, where) {
|
|
21
|
+
function fieldRef(value, owner, where, ctx) {
|
|
24
22
|
if (isTfExpr(value) && value.$expr === "resource-attr" && value.type.endsWith("_field") && value.path[0] === "id") {
|
|
25
23
|
// scopedLabelToBagKey's stripping is a documented no-op when the label
|
|
26
24
|
// isn't actually prefixed for this owner (src/engine/tf/labels.ts) - it
|
|
@@ -33,8 +31,7 @@ function fieldRef(value, owner, where) {
|
|
|
33
31
|
// final throw below can handle it instead of a silent wrong answer.
|
|
34
32
|
const prefix = owner.scope === "element" ? elementResourceLabelPrefix(owner.ownerTfLabel) : appResourceLabelPrefix(owner.ownerTfLabel);
|
|
35
33
|
if (value.label.startsWith(prefix)) {
|
|
36
|
-
|
|
37
|
-
return { kind: "field", appHandle: owner.ownerRefName, fieldKey: bagKeyForPulledCustomField(owner.ownerTfLabel, value.label, owner.scope, reserved) };
|
|
34
|
+
return { kind: "field", appHandle: owner.ownerRefName, fieldKey: pulledFieldBagKey(owner.ownerTfLabel, value.label, owner.scope, ctx) };
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
37
|
// A system field (status/title/id/stage/…) has no own resource block — ei
|
|
@@ -88,7 +85,7 @@ function picklistOptionLabel(value, owner) {
|
|
|
88
85
|
export function filterFromTf(value, owner, where, ctx, options) {
|
|
89
86
|
try {
|
|
90
87
|
return deserializeFilterFromTf(value, {
|
|
91
|
-
field: (fieldValue) => fieldRef(fieldValue, owner, where),
|
|
88
|
+
field: (fieldValue) => fieldRef(fieldValue, owner, where, ctx),
|
|
92
89
|
reference: () => { throw new EntityTfError(`${where}: access-policy reference values are not supported`); },
|
|
93
90
|
literal: (literal) => picklistOptionLabel(literal, owner) ?? stageName(literal, owner, ctx) ?? literal,
|
|
94
91
|
...(options?.optionLookupsAreIdentities === true && { optionLookupsAreIdentities: true }),
|
|
@@ -309,7 +309,8 @@ function printSkillRefToken(ref, appRefName, crossOrg) {
|
|
|
309
309
|
const todo = crossOrg
|
|
310
310
|
? ` // TODO: cross-org clone — "${ref.name}" was resolved in the SOURCE org; verify it exists (with this name) in the destination org`
|
|
311
311
|
: "";
|
|
312
|
-
|
|
312
|
+
const namespace = ref.appNamespace !== undefined ? `, parentNamespace: ${quote(ref.appNamespace)}` : "";
|
|
313
|
+
return `{ __kind: "skill", refName: ${quote(ref.name)}, name: ${quote(ref.name)}, parent: ${quote(ref.appRefName ?? ref.appName)}, parentName: ${quote(ref.appName)}${namespace} },${todo}`;
|
|
313
314
|
}
|
|
314
315
|
function printStartingActionVariableType(type) {
|
|
315
316
|
if (type === "NUMBER")
|
|
@@ -26,6 +26,8 @@ export type NormalizedSkillRef = {
|
|
|
26
26
|
readonly kind: "foreign";
|
|
27
27
|
readonly name: string;
|
|
28
28
|
readonly appName: string;
|
|
29
|
+
/** The owner's namespace, when ei looked the owner up by it (edk#2919). */
|
|
30
|
+
readonly appNamespace?: string;
|
|
29
31
|
readonly appRefName?: string;
|
|
30
32
|
readonly key?: string;
|
|
31
33
|
} | {
|
|
@@ -14,7 +14,7 @@ import { filterFromTf } from "../access-policy/from-tf.js";
|
|
|
14
14
|
import { a2aSkillFromTf } from "../agent-a2a-skill/from-tf.js";
|
|
15
15
|
import { toolFromTf } from "../agent-tool/from-tf.js";
|
|
16
16
|
import { agentToolBareLabel } from "../agent-tool/to-tf.js";
|
|
17
|
-
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
17
|
+
import { dataAspectDisplayName, dataAspectRefName, resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
18
18
|
import { connectorIdentityFromTf } from "../shared/connector-from-tf.js";
|
|
19
19
|
import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
|
|
20
20
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
@@ -77,6 +77,33 @@ function parseSkillRef(item, where, ownerTfLabel, ctx) {
|
|
|
77
77
|
const owner = ownerId === undefined ? undefined : ctx.importedResource?.(ownerId);
|
|
78
78
|
appName = typeof owner?.attrs["name"] === "string" ? owner.attrs["name"] : undefined;
|
|
79
79
|
}
|
|
80
|
+
// ei looks another app up by namespace alone (`data "elementum_app" { namespace }`),
|
|
81
|
+
// as for a service account's owner (#2197). The namespace is unique where
|
|
82
|
+
// a display name is not, so it alone picks the owner and its catalog
|
|
83
|
+
// skill (edk#2919).
|
|
84
|
+
const appNamespace = appName === undefined && appDataLabel !== undefined
|
|
85
|
+
? ctx.dataAttrs?.(APP_RESOURCE_TYPE, appDataLabel)?.["namespace"]
|
|
86
|
+
: undefined;
|
|
87
|
+
if (typeof appNamespace === "string" && appNamespace !== "" && appDataLabel !== undefined) {
|
|
88
|
+
const catalogSkill = ctx.foreignSkillRefsByOwnerNamespace?.get(JSON.stringify([appNamespace, name]));
|
|
89
|
+
const ownerInWorkspace = ctx.foreignAppRefNamespaces?.get(appNamespace) !== undefined;
|
|
90
|
+
if (catalogSkill === undefined && !ownerInWorkspace) {
|
|
91
|
+
ctx.diagnostics.push(`${where}: data.${SKILL_RESOURCE_TYPE}.${item.label}: owner namespace "${appNamespace}" is not in the workspace or the export's ref-only catalog; ` +
|
|
92
|
+
"kept as a literal skill token looked up by that namespace — pull that app and re-pull for a catalog token");
|
|
93
|
+
}
|
|
94
|
+
// The workspace app with this namespace; else the namespace's catalog
|
|
95
|
+
// key, which is the app's refName once it is pulled.
|
|
96
|
+
const appRefName = dataAspectRefName(ctx, "app", appDataLabel);
|
|
97
|
+
return {
|
|
98
|
+
kind: "foreign",
|
|
99
|
+
name,
|
|
100
|
+
appName: dataAspectDisplayName(ctx, "app", appDataLabel) ?? appNamespace,
|
|
101
|
+
appNamespace,
|
|
102
|
+
...(catalogSkill !== undefined
|
|
103
|
+
? { appRefName: catalogSkill.appRefName, key: catalogSkill.skillRefName }
|
|
104
|
+
: appRefName !== undefined ? { appRefName } : {}),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
80
107
|
if (appName === undefined) {
|
|
81
108
|
ctx.diagnostics.push(`${where}: data.${SKILL_RESOURCE_TYPE}.${item.label} has no resolvable app_id owner; dropped`);
|
|
82
109
|
return undefined;
|
|
@@ -116,6 +116,7 @@ export const agentModule = {
|
|
|
116
116
|
appTfLabel: ctx.appTfLabel,
|
|
117
117
|
orgRefs: ctx.orgRefs,
|
|
118
118
|
workspaceAspects: ctx.workspaceAspects,
|
|
119
|
+
...(ctx.outOfScopeApps !== undefined && { outOfScopeApps: ctx.outOfScopeApps }),
|
|
119
120
|
serviceAccounts: ctx.streamRootEntity?.payload?.serviceAccounts,
|
|
120
121
|
diagnostics: ctx.diagnostics,
|
|
121
122
|
...(ctx.siblingEntities !== undefined && { siblingEntities: ctx.siblingEntities }),
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* still doesn't carry (temperature, reasoningEffort, …) degrade through
|
|
16
16
|
* `diagnostics` — reported, never silent (plan §4.3).
|
|
17
17
|
*/
|
|
18
|
-
import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
18
|
+
import { type ForeignRootIdentity, type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
19
19
|
import { type DeployableEntity } from "../../engine/entity.js";
|
|
20
20
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
21
21
|
import type { AppServiceAccount } from "../service-account/build.js";
|
|
@@ -25,6 +25,8 @@ export interface AgentToTfContext {
|
|
|
25
25
|
readonly appTfLabel: string;
|
|
26
26
|
readonly orgRefs: OrgRefLookup;
|
|
27
27
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
28
|
+
/** See `ToTfContext.outOfScopeApps`: apps authored here but left out of a scoped build. */
|
|
29
|
+
readonly outOfScopeApps?: ReadonlyMap<string, ForeignRootIdentity>;
|
|
28
30
|
/** Inline service accounts authored on the owning app, keyed by stable bag key. */
|
|
29
31
|
readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
|
|
30
32
|
/** Degradations land here — reported by the caller, never silent. */
|
|
@@ -336,21 +336,39 @@ function skillIdValue(token, ctx) {
|
|
|
336
336
|
throw new EntityTfError(`agent skillAccess: foreign skill "${name}" has no owning app identity; use the skill token from its generated app catalog`);
|
|
337
337
|
}
|
|
338
338
|
const sibling = ctx.workspaceAspects?.get(workspaceAspectKey("app", token.parent));
|
|
339
|
+
// A skill of a sibling app authored in this build: reference its resource,
|
|
340
|
+
// so a first apply creates the skill before the agent. A data lookup would
|
|
341
|
+
// be read before the skill exists and fail "Agentic Skill Not Found" (edk#2919).
|
|
342
|
+
if (sibling !== undefined && sibling.managedChildRefNames?.get("skill")?.has(refName) === true) {
|
|
343
|
+
return expr.resourceAttr(SKILL_RESOURCE_TYPE, appScopedResourceLabel(sibling.tfLabel, tsLabelToTfLabel(refName)), ["id"]);
|
|
344
|
+
}
|
|
339
345
|
let appId;
|
|
340
346
|
let ownerTfLabel;
|
|
347
|
+
// An app outside this build is looked up by its namespace, as ei's export
|
|
348
|
+
// does: `data "elementum_app" "<namespace>"` and
|
|
349
|
+
// `data "elementum_agentic_skill" "<namespace>_<skill>"` (edk#2919). That
|
|
350
|
+
// is an app authored here but left out of a scoped build (the pull's
|
|
351
|
+
// build-vs-export check builds only the pulled app), a ref-only
|
|
352
|
+
// dependency stub whose catalog records the namespace, or a pulled literal
|
|
353
|
+
// token that kept the namespace ei looked the owner up by.
|
|
354
|
+
const ownerNamespace = sibling === undefined
|
|
355
|
+
? ctx.outOfScopeApps?.get(token.parent)?.namespace ?? (token.parentNamespace !== "" ? token.parentNamespace : undefined)
|
|
356
|
+
: undefined;
|
|
341
357
|
if (sibling !== undefined) {
|
|
342
358
|
ownerTfLabel = sibling.tfLabel;
|
|
343
359
|
appId = expr.resourceAttr(APP_RESOURCE_TYPE, sibling.tfLabel, ["id"]);
|
|
344
360
|
}
|
|
345
361
|
else {
|
|
346
|
-
ownerTfLabel = sanitizeName(token.parentName);
|
|
347
|
-
ctx.orgRefs.foreignApp(ownerTfLabel, token.parentName);
|
|
362
|
+
ownerTfLabel = sanitizeName(ownerNamespace ?? token.parentName);
|
|
363
|
+
ctx.orgRefs.foreignApp(ownerTfLabel, token.parentName, ownerNamespace);
|
|
348
364
|
appId = expr.dataAttr(APP_RESOURCE_TYPE, ownerTfLabel, ["id"]);
|
|
349
365
|
}
|
|
350
366
|
// A skill name is only unique within its owning app. Scope the Terraform
|
|
351
367
|
// label too, or same-named skills from two foreign apps would collapse to
|
|
352
368
|
// one data block and both references would silently resolve to its last owner.
|
|
353
|
-
const tfLabel =
|
|
369
|
+
const tfLabel = ownerNamespace !== undefined
|
|
370
|
+
? `${ownerTfLabel}_${sanitizeName(name)}`
|
|
371
|
+
: appScopedResourceLabel(ownerTfLabel, sanitizeName(name));
|
|
354
372
|
ctx.orgRefs.foreignSkill(tfLabel, name, appId);
|
|
355
373
|
return expr.dataAttr(SKILL_RESOURCE_TYPE, tfLabel, ["id"]);
|
|
356
374
|
}
|
|
@@ -29,6 +29,7 @@ export interface AppFromTfViewBlocks {
|
|
|
29
29
|
readonly relationshipBlocks: readonly TfBlock[];
|
|
30
30
|
readonly dashboardBlocks: readonly TfBlock[];
|
|
31
31
|
readonly dashboardWidgetBlocks: readonly TfBlock[];
|
|
32
|
+
readonly dashboardWidgetOrderBlocks?: readonly TfBlock[];
|
|
32
33
|
readonly widgetBlocks: readonly TfBlock[];
|
|
33
34
|
}
|
|
34
35
|
export declare function appFromTf(appBlock: TfBlock, fieldBlocks: readonly TfBlock[], ctx: FromTfContext, viewBlocks?: AppFromTfViewBlocks, accessPolicyBlocks?: readonly TfBlock[], roleBlocks?: readonly TfBlock[], serviceAccountBlocks?: readonly TfBlock[]): AppFromTfResult;
|