@elementumai/edk 0.13.4 → 0.14.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/dist-sdk/src/catalog/factories.d.ts +4 -2
- package/dist-sdk/src/catalog/factories.js +3 -1
- package/dist-sdk/src/catalog/from-authoring.d.ts +8 -3
- package/dist-sdk/src/catalog/from-authoring.js +21 -8
- package/dist-sdk/src/engine/build/context.d.ts +17 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +10 -0
- package/dist-sdk/src/engine/coverage-gaps.js +16 -0
- package/dist-sdk/src/engine/pull/context.d.ts +56 -0
- package/dist-sdk/src/engine/pull/context.js +8 -0
- package/dist-sdk/src/engine/pull/pulled-roots.d.ts +14 -1
- package/dist-sdk/src/engine/pull/pulled-roots.js +23 -3
- package/dist-sdk/src/engine/pull/ref-only.d.ts +6 -1
- package/dist-sdk/src/engine/pull/ref-only.js +4 -1
- package/dist-sdk/src/engine/pull/stream-root.d.ts +13 -1
- package/dist-sdk/src/engine/pull/stream-root.js +54 -4
- package/dist-sdk/src/engine/validation.d.ts +36 -1
- package/dist-sdk/src/engine/validation.js +56 -2
- package/dist-sdk/src/engine/workspace/loader.d.ts +6 -0
- package/dist-sdk/src/engine/workspace/loader.js +87 -2
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +58 -17
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +3 -1
- package/dist-sdk/src/entities/access-policy/to-tf.js +1 -1
- package/dist-sdk/src/entities/agent/build.d.ts +15 -0
- package/dist-sdk/src/entities/agent/build.js +139 -16
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +39 -25
- package/dist-sdk/src/entities/agent/module.js +95 -3
- package/dist-sdk/src/entities/agent/to-tf.js +6 -4
- package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/agent-evaluation/from-tf.js +14 -5
- package/dist-sdk/src/entities/agent-evaluation/module.js +4 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +11 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.js +38 -40
- package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -5
- package/dist-sdk/src/entities/app/build.d.ts +1 -1
- package/dist-sdk/src/entities/automation/build.d.ts +75 -42
- package/dist-sdk/src/entities/automation/build.js +17 -7
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +14 -2
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +9 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +57 -12
- package/dist-sdk/src/entities/automation/from-tf.d.ts +51 -0
- package/dist-sdk/src/entities/automation/from-tf.js +476 -93
- 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.js +90 -9
- package/dist-sdk/src/entities/automation/operators.d.ts +6 -2
- package/dist-sdk/src/entities/automation/operators.js +0 -2
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +8 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +11 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +37 -2
- package/dist-sdk/src/entities/automation/tasks.js +38 -1
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/automation/to-tf.js +413 -47
- package/dist-sdk/src/entities/chart/to-tf.js +18 -5
- package/dist-sdk/src/entities/dashboard/from-tf.js +45 -11
- package/dist-sdk/src/entities/dashboard-widget-order/order.d.ts +5 -3
- package/dist-sdk/src/entities/dashboard-widget-order/order.js +6 -4
- package/dist-sdk/src/entities/datamine/from-tf.js +10 -3
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +9 -2
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +35 -7
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +63 -7
- package/dist-sdk/src/entities/element/build.d.ts +4 -1
- package/dist-sdk/src/entities/element/build.js +3 -4
- package/dist-sdk/src/entities/field/from-tf.js +8 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +29 -2
- package/dist-sdk/src/entities/field/to-tf.js +106 -7
- package/dist-sdk/src/entities/phone-service/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/phone-service/from-tf.js +15 -7
- package/dist-sdk/src/entities/phone-service/module.js +4 -2
- package/dist-sdk/src/entities/portal/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/portal/to-tf.js +61 -2
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +34 -4
- package/dist-sdk/src/entities/relationship/to-tf.js +24 -6
- package/dist-sdk/src/entities/role/from-tf.js +3 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -3
- package/dist-sdk/src/entities/search-table/module.js +18 -2
- package/dist-sdk/src/entities/search-table/to-tf.js +10 -16
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +6 -1
- package/dist-sdk/src/entities/shared/filters/index.d.ts +6 -1
- package/dist-sdk/src/entities/shared/filters/index.js +8 -2
- package/dist-sdk/src/entities/shared/filters/print.js +18 -7
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +11 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +24 -2
- package/dist-sdk/src/entities/shared/run-automation-requirement.d.ts +15 -0
- package/dist-sdk/src/entities/shared/run-automation-requirement.js +28 -0
- package/dist-sdk/src/entities/shared/search-table-address.d.ts +17 -0
- package/dist-sdk/src/entities/shared/search-table-address.js +24 -0
- package/dist-sdk/src/entities/shared/skip-release.d.ts +49 -0
- package/dist-sdk/src/entities/shared/skip-release.js +74 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +11 -5
- package/dist-sdk/src/entities/skill/module.js +3 -25
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.js +28 -27
- package/dist-sdk/src/entities/skill-tool/to-tf.js +12 -5
- package/dist-sdk/src/entities/skill-tool/types.d.ts +1 -0
- package/dist-sdk/src/entities/skill-tool/types.js +2 -1
- package/dist-sdk/src/entities/table/catalog.d.ts +16 -0
- package/dist-sdk/src/entities/table/catalog.js +44 -2
- package/dist-sdk/src/entities/table/from-tf.js +30 -4
- package/dist-sdk/src/entities/table/keys.d.ts +27 -0
- package/dist-sdk/src/entities/table/keys.js +46 -0
- package/dist-sdk/src/entities/table/to-tf.js +2 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +12 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +9 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +215 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +10 -4
- package/dist-sdk/src/entities/view/custom-view-runtime-rules.d.ts +43 -0
- package/dist-sdk/src/entities/view/custom-view-runtime-rules.js +285 -0
- package/dist-sdk/src/entities/view/custom-view-validate.d.ts +3 -1
- package/dist-sdk/src/entities/view/custom-view-validate.js +24 -5
- package/dist-sdk/src/entities/view/from-tf.js +14 -1
- package/dist-sdk/src/entities/widget/from-tf.js +14 -7
- package/dist-sdk/src/entities/widget/to-tf.js +7 -5
- package/dist-sdk/src/graph/index.d.ts +14 -1
- package/dist-sdk/src/graph/index.js +2 -0
- package/dist-sdk/src/graph/resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/resource-types.js +3 -0
- package/dist-sdk/src/graph/types.d.ts +82 -0
- package/package.json +1 -1
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
import { DATA_FACET_BY_TYPE, ENTITY_KIND_BY_ID, ownFileChildrenOf, } from "../../graph/index.js";
|
|
16
16
|
import { isTfExpr } from "../tf/index.js";
|
|
17
17
|
import { typedCoverageGap } from "../coverage-gaps.js";
|
|
18
|
-
import { authoringBlockedMessage } from "./context.js";
|
|
18
|
+
import { authoringBlockedMessage, ownFileArchiveConsequence } from "./context.js";
|
|
19
19
|
import { partitionStream } from "./partition.js";
|
|
20
|
+
import { readRefOnlyMetadata } from "./ref-only.js";
|
|
20
21
|
import { resourcesInSource } from "./source-resources.js";
|
|
21
22
|
/**
|
|
22
23
|
* EDK-only export local listing live bindings the EDK cannot represent, keyed
|
|
@@ -192,6 +193,20 @@ export function importIdsFromDocument(doc) {
|
|
|
192
193
|
}
|
|
193
194
|
return importIds;
|
|
194
195
|
}
|
|
196
|
+
/** The ref-only task roots of `doc`, by display name and by namespace (edk#3146). */
|
|
197
|
+
function refOnlyTaskIdentities(doc) {
|
|
198
|
+
const names = new Map();
|
|
199
|
+
const namespaces = new Map();
|
|
200
|
+
for (const root of readRefOnlyMetadata(doc).roots) {
|
|
201
|
+
if (root.kind !== "task")
|
|
202
|
+
continue;
|
|
203
|
+
if (!names.has(root.name))
|
|
204
|
+
names.set(root.name, root.refName);
|
|
205
|
+
if (root.namespace !== undefined && root.namespace !== "" && !namespaces.has(root.namespace))
|
|
206
|
+
namespaces.set(root.namespace, root.refName);
|
|
207
|
+
}
|
|
208
|
+
return names.size === 0 ? {} : { refOnlyTaskRefNames: names, refOnlyTaskRefNamespaces: namespaces };
|
|
209
|
+
}
|
|
195
210
|
export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
196
211
|
const skipped = [];
|
|
197
212
|
const releaseIfManaged = [];
|
|
@@ -391,6 +406,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
391
406
|
foreignAppRefNamespaces: opts.appRefNamespaces,
|
|
392
407
|
foreignElementRefNamespaces: opts.elementRefNamespaces,
|
|
393
408
|
foreignTaskRefNamespaces: opts.taskRefNamespaces,
|
|
409
|
+
...refOnlyTaskIdentities(doc),
|
|
394
410
|
...(opts.selfAspectRef !== undefined ? { selfAspectRef: opts.selfAspectRef } : {}),
|
|
395
411
|
...(opts.cloning !== undefined ? { cloning: opts.cloning } : {}),
|
|
396
412
|
foreignFieldRefsById: opts.foreignFieldRefsById,
|
|
@@ -399,11 +415,14 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
399
415
|
foreignSkillRefsByOwnerName: opts.foreignSkillRefsByOwnerName,
|
|
400
416
|
foreignSkillRefsByOwnerNamespace: opts.foreignSkillRefsByOwnerNamespace,
|
|
401
417
|
fieldNamesByOwnerRefName: opts.fieldNamesByOwnerRefName,
|
|
418
|
+
...(opts.renamedSystemFieldKeysByOwnerRefName !== undefined && { renamedSystemFieldKeysByOwnerRefName: opts.renamedSystemFieldKeysByOwnerRefName }),
|
|
402
419
|
// Root and own-file extractors both print group refs (edk#1412).
|
|
403
420
|
groupKeysByName: opts.groupKeysByName,
|
|
404
421
|
...(opts.serviceAccountsById !== undefined && { serviceAccountsById: opts.serviceAccountsById }),
|
|
405
422
|
...(opts.omittedAutomationsById !== undefined && { omittedAutomationsById: opts.omittedAutomationsById }),
|
|
423
|
+
...(opts.workspaceAutomationKeys !== undefined && { workspaceAutomationKeys: opts.workspaceAutomationKeys }),
|
|
406
424
|
...(opts.platformCreatorPolicyIds !== undefined && { platformCreatorPolicyIds: opts.platformCreatorPolicyIds }),
|
|
425
|
+
...(opts.unloadableOwnFiles !== undefined && { unloadableOwnFiles: opts.unloadableOwnFiles }),
|
|
407
426
|
unresolvedForeignRefs: { apps: unresolvedForeignApps, elements: unresolvedForeignElements },
|
|
408
427
|
importedResource: (id) => {
|
|
409
428
|
// Clone dropped the import blocks; the source export's still name the id (#1991).
|
|
@@ -448,6 +467,8 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
448
467
|
const adoptionAddressAliases = [];
|
|
449
468
|
const unmanagedLookups = [];
|
|
450
469
|
const skippedReports = [];
|
|
470
|
+
const triggerReferenceRepairs = [];
|
|
471
|
+
const reimportForLive = [];
|
|
451
472
|
const quarantineOwnFiles = [];
|
|
452
473
|
const validationFailures = [];
|
|
453
474
|
const settles = [];
|
|
@@ -466,6 +487,8 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
466
487
|
adoptionAddressAliases.push(...(result.adoptionAddressAliases ?? []));
|
|
467
488
|
unmanagedLookups.push(...(result.unmanagedLookups ?? []));
|
|
468
489
|
skippedReports.push(...(result.skippedReports ?? []).map((report) => ({ ...report, kind: child.kind })));
|
|
490
|
+
triggerReferenceRepairs.push(...(result.triggerReferenceRepairs ?? []));
|
|
491
|
+
reimportForLive.push(...(result.reimportForLive ?? []));
|
|
469
492
|
quarantineOwnFiles.push(...(result.quarantineOwnFiles ?? []));
|
|
470
493
|
if (result.settleAfterExtract !== undefined)
|
|
471
494
|
settles.push(result.settleAfterExtract);
|
|
@@ -474,7 +497,8 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
474
497
|
skippedOwners.set(address, { kind: child.kind, refName });
|
|
475
498
|
}
|
|
476
499
|
}
|
|
477
|
-
|
|
500
|
+
const trimmedLists = [];
|
|
501
|
+
rootInstance = dropDependentsOfSkipped(rootInstance, ownFileByKind, requiresExtracted, new Set(resources.keys()), skipped, releaseIfManaged, diagnostics, reports, opts.keptOwnFile, quarantineOwnFiles, trimmedLists);
|
|
478
502
|
if (settles.length > 0) {
|
|
479
503
|
const settledRoot = rootInstance;
|
|
480
504
|
const inSource = resourcesInSource({
|
|
@@ -488,6 +512,9 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
488
512
|
}
|
|
489
513
|
}
|
|
490
514
|
const taskAddresses = taskAddressByLabel(resources, automationTaskResourceTypes);
|
|
515
|
+
// A resource skipped after extraction is neither in source nor adopted, so the plan leaves it alone.
|
|
516
|
+
const skippedSet = new Set(skipped);
|
|
517
|
+
const plannedRepairs = triggerReferenceRepairs.filter((repair) => !skippedSet.has(repair.automationAddress) && !skippedSet.has(repair.address));
|
|
491
518
|
return {
|
|
492
519
|
root: rootInstance,
|
|
493
520
|
ownFileByKind,
|
|
@@ -502,7 +529,10 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
502
529
|
importIds,
|
|
503
530
|
adoptionAddressAliases,
|
|
504
531
|
...(unmanagedLookups.length > 0 && { unmanagedLookups }),
|
|
532
|
+
...(trimmedLists.length > 0 && { trimmedLists }),
|
|
533
|
+
...(reimportForLive.length > 0 && { reimportForLive: [...new Set(reimportForLive)].sort() }),
|
|
505
534
|
...(skippedReports.length > 0 && { skippedReports }),
|
|
535
|
+
...(plannedRepairs.length > 0 && { triggerReferenceRepairs: plannedRepairs }),
|
|
506
536
|
dependsOn,
|
|
507
537
|
unresolvedForeignRefs: { apps: [...unresolvedForeignApps], elements: [...unresolvedForeignElements] },
|
|
508
538
|
authoringBlockers: [
|
|
@@ -530,11 +560,13 @@ export function extractApp(doc, opts = {}) {
|
|
|
530
560
|
* adoption keeps managing it (SF3). That outcome is reported on the
|
|
531
561
|
* informational `reports` channel, not as a coverage gap: nothing is lost.
|
|
532
562
|
*/
|
|
533
|
-
function dropDependentsOfSkipped(root, ownFileByKind, requirements, streamAddresses, skipped, releaseIfManaged, diagnostics, reports, keptOwnFile, quarantineOwnFiles = []) {
|
|
563
|
+
function dropDependentsOfSkipped(root, ownFileByKind, requirements, streamAddresses, skipped, releaseIfManaged, diagnostics, reports, keptOwnFile, quarantineOwnFiles = [], trimmedLists = []) {
|
|
534
564
|
const skippedSet = new Set(skipped);
|
|
535
565
|
// A released requirement's authored file is archived after adoption, so it
|
|
536
566
|
// can't keep its dependent buildable (#2892).
|
|
537
567
|
const releasedSet = new Set(releaseIfManaged);
|
|
568
|
+
// List entries left out so far, by dependent (see ExtractRequirement.listEntry).
|
|
569
|
+
const leftOutEntries = new Map();
|
|
538
570
|
let pruned = root;
|
|
539
571
|
for (const requirement of requirements) {
|
|
540
572
|
if (skippedSet.has(requirement.address))
|
|
@@ -542,6 +574,15 @@ function dropDependentsOfSkipped(root, ownFileByKind, requirements, streamAddres
|
|
|
542
574
|
const reason = unbuildableReason(requirement, root, streamAddresses, skippedSet, releasedSet, keptOwnFile, reports);
|
|
543
575
|
if (reason === undefined)
|
|
544
576
|
continue;
|
|
577
|
+
if (requirement.listEntry !== undefined) {
|
|
578
|
+
const entry = leftOutEntries.get(requirement.address) ?? { listEntry: requirement.listEntry, leftOut: new Set() };
|
|
579
|
+
entry.leftOut.add(requirement.requires);
|
|
580
|
+
leftOutEntries.set(requirement.address, entry);
|
|
581
|
+
if (requirement.listEntry.trackedWithout(entry.leftOut) !== undefined)
|
|
582
|
+
continue;
|
|
583
|
+
// No entry is left: build emits no such resource, so it is skipped below.
|
|
584
|
+
leftOutEntries.delete(requirement.address);
|
|
585
|
+
}
|
|
545
586
|
pruned = requirement.prune(pruned);
|
|
546
587
|
const ownFile = requirement.pruneOwnFile;
|
|
547
588
|
if (ownFile !== undefined) {
|
|
@@ -560,10 +601,19 @@ function dropDependentsOfSkipped(root, ownFileByKind, requirements, streamAddres
|
|
|
560
601
|
detail: `left out of the pull, skipped: ${reason}`,
|
|
561
602
|
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" +
|
|
562
603
|
(requirement.pruneOwnFile?.archiveRefName !== undefined
|
|
563
|
-
?
|
|
604
|
+
? ownFileArchiveConsequence(requirement.pruneOwnFile.kind, requirement.pruneOwnFile.archiveRefName)
|
|
564
605
|
: ""),
|
|
565
606
|
}));
|
|
566
607
|
}
|
|
608
|
+
for (const [address, { listEntry, leftOut }] of leftOutEntries) {
|
|
609
|
+
if (skippedSet.has(address))
|
|
610
|
+
continue;
|
|
611
|
+
const tracked = listEntry.trackedWithout(leftOut);
|
|
612
|
+
if (tracked === undefined)
|
|
613
|
+
continue;
|
|
614
|
+
trimmedLists.push({ address, leftOut: [...leftOut].sort(), importId: tracked.importId, attribute: listEntry.attribute, keptIds: tracked.keptIds });
|
|
615
|
+
reports.push(`${address}: kept in source and adoption without ${[...leftOut].sort().join(", ")}, which this pull left out; it tracks only the entries source holds`);
|
|
616
|
+
}
|
|
567
617
|
return pruned;
|
|
568
618
|
}
|
|
569
619
|
/** Why build will not emit `requirement`'s dependent, or undefined when it will. */
|
|
@@ -11,12 +11,31 @@ export interface ValidationFailure {
|
|
|
11
11
|
/**
|
|
12
12
|
* A reference the live config no longer satisfies (for example a run-automation
|
|
13
13
|
* tool that does not map a newly required trigger parameter). Pull downgrades
|
|
14
|
-
* these to warnings; build/plan/apply keep them fatal
|
|
14
|
+
* these to warnings; build/plan/apply keep them fatal unless `stateCheck`
|
|
15
|
+
* finds the resource unchanged in state.
|
|
15
16
|
*/
|
|
16
17
|
readonly staleReference?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* For a stale reference: decides from state whether the resource is
|
|
20
|
+
* unchanged since adoption. The owning entity defines "unchanged"; the
|
|
21
|
+
* engine only supplies the lookup. Not serialized (a function).
|
|
22
|
+
*/
|
|
23
|
+
readonly stateCheck?: StaleReferenceStateCheck;
|
|
17
24
|
/** What kind of finding this is, when a caller has to treat it specially. */
|
|
18
25
|
readonly code?: "unresolved-task-filter-ref";
|
|
19
26
|
}
|
|
27
|
+
/** A managed root-module resource's state attributes, by `type.label` address. */
|
|
28
|
+
export type StateAttributesLookup = (address: string) => Readonly<Record<string, unknown>> | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The answer of a stale reference's state check: `unchanged` keeps it a
|
|
31
|
+
* warning, otherwise it stays fatal. `note` says why, in the user's terms,
|
|
32
|
+
* and is appended to the message either way.
|
|
33
|
+
*/
|
|
34
|
+
export interface StaleReferenceStateVerdict {
|
|
35
|
+
readonly unchanged: boolean;
|
|
36
|
+
readonly note: string;
|
|
37
|
+
}
|
|
38
|
+
export type StaleReferenceStateCheck = (lookup: StateAttributesLookup) => StaleReferenceStateVerdict;
|
|
20
39
|
export declare function formatValidationFailure(failure: ValidationFailure): string;
|
|
21
40
|
export declare class ValidationFailureError extends Error {
|
|
22
41
|
readonly failures: readonly ValidationFailure[];
|
|
@@ -43,4 +62,20 @@ export declare function setValidationScope(scope: {
|
|
|
43
62
|
export declare function sessionValidationFailures(): readonly ValidationFailure[];
|
|
44
63
|
/** Record failures into the active session. No-op when nothing is collecting. */
|
|
45
64
|
export declare function recordValidations(incoming: readonly ValidationFailure[]): void;
|
|
65
|
+
/** True when the session holds a fatal stale reference that state could settle. */
|
|
66
|
+
export declare function hasStateCheckedStaleReferences(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Settle the session's fatal stale references against state (edk#3230,
|
|
69
|
+
* #3231). A finding whose check reports its resource unchanged since
|
|
70
|
+
* adoption becomes a warning, so a freshly pulled workspace plans; any other
|
|
71
|
+
* stays fatal. Each message gains the check's note. With no state (`lookup`
|
|
72
|
+
* undefined), every such finding stays fatal with `unreadable` as its note.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveStaleReferences(lookup: StateAttributesLookup | undefined, unreadable: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* Keep the session's fatal stale references as warnings without reading
|
|
77
|
+
* state, for a build whose state is in transit (a backend or provider-source
|
|
78
|
+
* migration). `note` says when they are checked.
|
|
79
|
+
*/
|
|
80
|
+
export declare function deferStaleReferences(note: string): void;
|
|
46
81
|
export declare function hasFatalValidation(failures: readonly ValidationFailure[]): boolean;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Collects validation failures across a pull or build instead of stopping at
|
|
3
|
-
* the first one. A stale reference is
|
|
4
|
-
*
|
|
3
|
+
* the first one. A stale reference is a warning on pull, which is a read of
|
|
4
|
+
* live configuration. On build/plan/apply it is fatal, unless the finding
|
|
5
|
+
* carries a state check and the state shows the resource unchanged since it
|
|
6
|
+
* was adopted (edk#3230, #3231): see {@link resolveStaleReferences}.
|
|
5
7
|
*/
|
|
6
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
9
|
export function formatValidationFailure(failure) {
|
|
@@ -90,6 +92,58 @@ export function recordValidations(incoming) {
|
|
|
90
92
|
session.failures.push(recorded);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
95
|
+
/** True when the session holds a fatal stale reference that state could settle. */
|
|
96
|
+
export function hasStateCheckedStaleReferences() {
|
|
97
|
+
return (storage().getStore()?.failures ?? []).some(isStateCheckedStaleFatal);
|
|
98
|
+
}
|
|
99
|
+
function isStateCheckedStaleFatal(failure) {
|
|
100
|
+
return failure.severity === "fatal" && failure.staleReference === true && failure.stateCheck !== undefined;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Settle the session's fatal stale references against state (edk#3230,
|
|
104
|
+
* #3231). A finding whose check reports its resource unchanged since
|
|
105
|
+
* adoption becomes a warning, so a freshly pulled workspace plans; any other
|
|
106
|
+
* stays fatal. Each message gains the check's note. With no state (`lookup`
|
|
107
|
+
* undefined), every such finding stays fatal with `unreadable` as its note.
|
|
108
|
+
*/
|
|
109
|
+
export function resolveStaleReferences(lookup, unreadable) {
|
|
110
|
+
const session = storage().getStore();
|
|
111
|
+
if (session === undefined || session.mode === "pull")
|
|
112
|
+
return;
|
|
113
|
+
for (const [index, failure] of session.failures.entries()) {
|
|
114
|
+
if (!isStateCheckedStaleFatal(failure))
|
|
115
|
+
continue;
|
|
116
|
+
const verdict = lookup === undefined
|
|
117
|
+
? { unchanged: false, note: unreadable }
|
|
118
|
+
: failure.stateCheck(lookup);
|
|
119
|
+
const resolved = {
|
|
120
|
+
...failure,
|
|
121
|
+
severity: verdict.unchanged ? "warning" : "fatal",
|
|
122
|
+
message: `${failure.message} (${verdict.note})`,
|
|
123
|
+
};
|
|
124
|
+
session.seen.delete(`${failure.severity}\0${failure.address}\0${failure.message}`);
|
|
125
|
+
session.seen.add(`${resolved.severity}\0${resolved.address}\0${resolved.message}`);
|
|
126
|
+
session.failures[index] = resolved;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Keep the session's fatal stale references as warnings without reading
|
|
131
|
+
* state, for a build whose state is in transit (a backend or provider-source
|
|
132
|
+
* migration). `note` says when they are checked.
|
|
133
|
+
*/
|
|
134
|
+
export function deferStaleReferences(note) {
|
|
135
|
+
const session = storage().getStore();
|
|
136
|
+
if (session === undefined || session.mode === "pull")
|
|
137
|
+
return;
|
|
138
|
+
for (const [index, failure] of session.failures.entries()) {
|
|
139
|
+
if (!isStateCheckedStaleFatal(failure))
|
|
140
|
+
continue;
|
|
141
|
+
const resolved = { ...failure, severity: "warning", message: `${failure.message} (${note})` };
|
|
142
|
+
session.seen.delete(`${failure.severity}\0${failure.address}\0${failure.message}`);
|
|
143
|
+
session.seen.add(`${resolved.severity}\0${resolved.address}\0${resolved.message}`);
|
|
144
|
+
session.failures[index] = resolved;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
93
147
|
export function hasFatalValidation(failures) {
|
|
94
148
|
return failures.some((failure) => failure.severity === "fatal");
|
|
95
149
|
}
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* CommonJS export to the SDK.
|
|
12
12
|
*/
|
|
13
13
|
export declare function findInstalledSdkSubpath(root: string, subpath: string): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* An import of an `@elementumai/edk/<subpath>` the package doesn't export
|
|
16
|
+
* (e.g. `/portal` for `/portals`, edk#3210): add the closest exported subpath
|
|
17
|
+
* to the error, or the list of subpaths when none is close.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withSdkSubpathHint(err: unknown, root: string): unknown;
|
|
14
20
|
/**
|
|
15
21
|
* Upgrade the short-lived #730 barrel shape before Bun/jiti evaluates it.
|
|
16
22
|
* Generated catalogs are CLI-owned, and this writes exactly the lazy-require
|
|
@@ -159,6 +159,81 @@ export function findInstalledSdkSubpath(root, subpath) {
|
|
|
159
159
|
current = parent;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* The nearest installed `@elementumai/edk` package's root and `exports` map,
|
|
164
|
+
* for the subpath hint only. {@link findInstalledSdkSubpath} keeps its own
|
|
165
|
+
* walk, which goes on past a nearer package that doesn't export the subpath.
|
|
166
|
+
*/
|
|
167
|
+
function installedSdkExports(root) {
|
|
168
|
+
let current = root;
|
|
169
|
+
while (true) {
|
|
170
|
+
const packageRoot = join(current, "node_modules", "@elementumai", "edk");
|
|
171
|
+
const packageJson = join(packageRoot, "package.json");
|
|
172
|
+
if (existsSync(packageJson)) {
|
|
173
|
+
try {
|
|
174
|
+
const parsed = JSON.parse(readFileSync(packageJson, "utf8"));
|
|
175
|
+
if (parsed.exports !== null && typeof parsed.exports === "object") {
|
|
176
|
+
return { packageRoot, exports: parsed.exports };
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// Keep looking higher up.
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const parent = dirname(current);
|
|
184
|
+
if (parent === current)
|
|
185
|
+
return undefined;
|
|
186
|
+
current = parent;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/** The `@elementumai/edk` subpaths the nearest installed package exports. */
|
|
190
|
+
function installedSdkSubpaths(root) {
|
|
191
|
+
return Object.keys(installedSdkExports(root)?.exports ?? {})
|
|
192
|
+
.filter((key) => key.startsWith("./") && !key.includes("*") && key !== "./package.json")
|
|
193
|
+
.map((key) => key.slice(2));
|
|
194
|
+
}
|
|
195
|
+
function editDistance(a, b) {
|
|
196
|
+
const row = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
197
|
+
for (let i = 1; i <= a.length; i++) {
|
|
198
|
+
let diagonal = row[0];
|
|
199
|
+
row[0] = i;
|
|
200
|
+
for (let j = 1; j <= b.length; j++) {
|
|
201
|
+
const above = row[j];
|
|
202
|
+
row[j] = Math.min(above + 1, row[j - 1] + 1, diagonal + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
203
|
+
diagonal = above;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return row[b.length];
|
|
207
|
+
}
|
|
208
|
+
const UNEXPORTED_SDK_SUBPATH = /(?:Package subpath '\.\/([^']+)' is not defined by "exports" in [^\n]*@elementumai[\\/]edk[\\/]package\.json|Cannot find module '@elementumai\/edk\/([^']+)')/;
|
|
209
|
+
/**
|
|
210
|
+
* An import of an `@elementumai/edk/<subpath>` the package doesn't export
|
|
211
|
+
* (e.g. `/portal` for `/portals`, edk#3210): add the closest exported subpath
|
|
212
|
+
* to the error, or the list of subpaths when none is close.
|
|
213
|
+
*/
|
|
214
|
+
export function withSdkSubpathHint(err, root) {
|
|
215
|
+
// Bun's resolve error (the compiled binary's jiti path) is not an Error
|
|
216
|
+
// instance, and String() ignores a changed message, so read any object's
|
|
217
|
+
// message and return a new Error that keeps the original as its cause.
|
|
218
|
+
const message = typeof err === "object" && err !== null && typeof err.message === "string"
|
|
219
|
+
? err.message
|
|
220
|
+
: undefined;
|
|
221
|
+
if (message === undefined)
|
|
222
|
+
return err;
|
|
223
|
+
const match = UNEXPORTED_SDK_SUBPATH.exec(message);
|
|
224
|
+
const subpath = match?.[1] ?? match?.[2];
|
|
225
|
+
if (subpath === undefined)
|
|
226
|
+
return err;
|
|
227
|
+
const exported = installedSdkSubpaths(root);
|
|
228
|
+
// An exported subpath that failed to resolve for another reason gets no hint.
|
|
229
|
+
if (exported.length === 0 || exported.includes(subpath))
|
|
230
|
+
return err;
|
|
231
|
+
const [closest] = [...exported].sort((a, b) => editDistance(subpath, a) - editDistance(subpath, b));
|
|
232
|
+
const hint = closest !== undefined && editDistance(subpath, closest) <= Math.max(2, Math.floor(subpath.length / 3))
|
|
233
|
+
? `did you mean "@elementumai/edk/${closest}"?`
|
|
234
|
+
: `the package exports ${exported.map((name) => `"@elementumai/edk/${name}"`).join(", ")}`;
|
|
235
|
+
return new Error(`${message} (${hint})`, { cause: err });
|
|
236
|
+
}
|
|
162
237
|
/**
|
|
163
238
|
* Upgrade the short-lived #730 barrel shape before Bun/jiti evaluates it.
|
|
164
239
|
* Generated catalogs are CLI-owned, and this writes exactly the lazy-require
|
|
@@ -348,7 +423,12 @@ function createJitiLoader(root) {
|
|
|
348
423
|
});
|
|
349
424
|
});
|
|
350
425
|
const jiti = await pending;
|
|
351
|
-
|
|
426
|
+
try {
|
|
427
|
+
return (await withImportingFile(resolve(file), () => jiti.import(resolve(file))));
|
|
428
|
+
}
|
|
429
|
+
catch (err) {
|
|
430
|
+
throw withSdkSubpathHint(err, root);
|
|
431
|
+
}
|
|
352
432
|
},
|
|
353
433
|
};
|
|
354
434
|
}
|
|
@@ -399,7 +479,12 @@ export function createWorkspaceLoader(orgRoot) {
|
|
|
399
479
|
const url = pathToFileURL(resolve(file)).href;
|
|
400
480
|
// Set inside the serialized section so overlapping imports cannot
|
|
401
481
|
// see each other's file.
|
|
402
|
-
|
|
482
|
+
try {
|
|
483
|
+
return await withImportingFile(resolve(file), () => nativeImport(`${url}?${GENERATION_KEY}=${generation}`));
|
|
484
|
+
}
|
|
485
|
+
catch (err) {
|
|
486
|
+
throw withSdkSubpathHint(err, root);
|
|
487
|
+
}
|
|
403
488
|
});
|
|
404
489
|
},
|
|
405
490
|
};
|
|
@@ -54,6 +54,13 @@ export interface FilterFromTfOptions {
|
|
|
54
54
|
}
|
|
55
55
|
/** Decode one `filter` attribute through the shared exhaustive codec. */
|
|
56
56
|
export declare function filterFromTf(value: TfValue, owner: AccessPolicyOwner, where: string, ctx?: FromTfContext, options?: FilterFromTfOptions): Filter<RefExpr, RefExpr>;
|
|
57
|
+
/**
|
|
58
|
+
* Decode a filter whose fields may belong to any of `owners`, each field and
|
|
59
|
+
* option lookup taken as the first owner's it belongs to: a relationship
|
|
60
|
+
* condition comparing a field of one side with a field of the other (#3144).
|
|
61
|
+
* With one owner it is {@link filterFromTf}.
|
|
62
|
+
*/
|
|
63
|
+
export declare function filterFromTfOfOwners(value: TfValue, owners: readonly [AccessPolicyOwner, ...AccessPolicyOwner[]], where: string, ctx?: FromTfContext, options?: FilterFromTfOptions): Filter<RefExpr, RefExpr>;
|
|
57
64
|
/**
|
|
58
65
|
* The EDK ref of the app that owns a service-account block, read from the
|
|
59
66
|
* block's `app_id`: the owner itself when that is the app the ref points at,
|
|
@@ -14,11 +14,27 @@ 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
16
|
import { pulledFieldBagKey } from "../field/from-tf.js";
|
|
17
|
-
import { filterFromTf as deserializeFilterFromTf } from "../shared/filters/tf-codec.js";
|
|
17
|
+
import { filterFromTf as deserializeFilterFromTf, UnauthorableFilterValueError } from "../shared/filters/tf-codec.js";
|
|
18
18
|
import { groupId, userId, } from "./principal.js";
|
|
19
19
|
import { KNOWN_ACCESS_POLICY_ATTRS } from "./types.js";
|
|
20
20
|
import { finishPulledMemberList } from "./member-list.js";
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The first of `owners` that `value` names a field of. A raw id no owner's
|
|
23
|
+
* state names stays unresolved, as for one owner; anything else no owner
|
|
24
|
+
* claims fails naming `where`.
|
|
25
|
+
*/
|
|
26
|
+
function fieldRefOfOwners(value, owners, where, ctx) {
|
|
27
|
+
for (const owner of owners) {
|
|
28
|
+
const ref = ownedFieldRef(value, owner, ctx);
|
|
29
|
+
if (ref !== undefined)
|
|
30
|
+
return ref;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === "string")
|
|
33
|
+
return { kind: "unresolved", uuid: value, hint: "field" };
|
|
34
|
+
throw new EntityTfError(`${where}: field reference cannot be reconstructed`);
|
|
35
|
+
}
|
|
36
|
+
/** `value` as a field of `owner`, or undefined when it names no field of that owner. */
|
|
37
|
+
function ownedFieldRef(value, owner, ctx) {
|
|
22
38
|
if (isTfExpr(value) && value.$expr === "resource-attr" && value.type.endsWith("_field") && value.path[0] === "id") {
|
|
23
39
|
// scopedLabelToBagKey's stripping is a documented no-op when the label
|
|
24
40
|
// isn't actually prefixed for this owner (src/engine/tf/labels.ts) - it
|
|
@@ -26,9 +42,10 @@ function fieldRef(value, owner, where, ctx) {
|
|
|
26
42
|
// appHandle for a field that belongs to a DIFFERENT aspect than `owner`
|
|
27
43
|
// (e.g. a relationship's filter referencing the TARGET's own field, not
|
|
28
44
|
// the relationship's owner - edk#650 review). Only take this branch when
|
|
29
|
-
// the label actually belongs to `owner`; otherwise
|
|
30
|
-
//
|
|
31
|
-
//
|
|
45
|
+
// the label actually belongs to `owner`; otherwise return nothing so
|
|
46
|
+
// another owner (relationship/from-tf.ts tries the owner, the target,
|
|
47
|
+
// then both, #3144) or fieldRefOfOwners's throw handles it instead of a
|
|
48
|
+
// silent wrong answer.
|
|
32
49
|
const prefix = owner.scope === "element" ? elementResourceLabelPrefix(owner.ownerTfLabel) : appResourceLabelPrefix(owner.ownerTfLabel);
|
|
33
50
|
if (value.label.startsWith(prefix)) {
|
|
34
51
|
return { kind: "field", appHandle: owner.ownerRefName, fieldKey: pulledFieldBagKey(owner.ownerTfLabel, value.label, owner.scope, ctx) };
|
|
@@ -47,16 +64,12 @@ function fieldRef(value, owner, where, ctx) {
|
|
|
47
64
|
}
|
|
48
65
|
if (typeof value === "string") {
|
|
49
66
|
const stateRef = owner.foreignFieldRefsById?.get(value);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return { kind: "unresolved", uuid: value, hint: "field" };
|
|
67
|
+
return stateRef?.ownerRefName === owner.ownerRefName
|
|
68
|
+
? { kind: "field", appHandle: owner.ownerRefName, fieldKey: stateRef.fieldKey }
|
|
69
|
+
: undefined;
|
|
54
70
|
}
|
|
55
71
|
const dataLabel = owner.dataField === undefined ? undefined : dataRefLabel(value, "elementum_field");
|
|
56
|
-
|
|
57
|
-
if (dataField !== undefined)
|
|
58
|
-
return dataField;
|
|
59
|
-
throw new EntityTfError(`${where}: field reference cannot be reconstructed`);
|
|
72
|
+
return dataLabel === undefined ? undefined : owner.dataField?.(dataLabel);
|
|
60
73
|
}
|
|
61
74
|
/**
|
|
62
75
|
* A picklist-typed literal filter value ("Open") emits as a
|
|
@@ -83,20 +96,48 @@ function picklistOptionLabel(value, owner) {
|
|
|
83
96
|
}
|
|
84
97
|
/** Decode one `filter` attribute through the shared exhaustive codec. */
|
|
85
98
|
export function filterFromTf(value, owner, where, ctx, options) {
|
|
99
|
+
return filterFromTfOfOwners(value, [owner], where, ctx, options);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Decode a filter whose fields may belong to any of `owners`, each field and
|
|
103
|
+
* option lookup taken as the first owner's it belongs to: a relationship
|
|
104
|
+
* condition comparing a field of one side with a field of the other (#3144).
|
|
105
|
+
* With one owner it is {@link filterFromTf}.
|
|
106
|
+
*/
|
|
107
|
+
export function filterFromTfOfOwners(value, owners, where, ctx, options) {
|
|
108
|
+
const optionLabel = (literal) => {
|
|
109
|
+
for (const owner of owners) {
|
|
110
|
+
const label = picklistOptionLabel(literal, owner);
|
|
111
|
+
if (label !== undefined)
|
|
112
|
+
return label;
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
115
|
+
};
|
|
116
|
+
const stage = (literal) => {
|
|
117
|
+
for (const owner of owners) {
|
|
118
|
+
const name = stageName(literal, owner, ctx);
|
|
119
|
+
if (name !== undefined)
|
|
120
|
+
return name;
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
};
|
|
86
124
|
try {
|
|
87
125
|
return deserializeFilterFromTf(value, {
|
|
88
|
-
field: (fieldValue) =>
|
|
126
|
+
field: (fieldValue) => fieldRefOfOwners(fieldValue, owners, where, ctx),
|
|
89
127
|
reference: () => { throw new EntityTfError(`${where}: access-policy reference values are not supported`); },
|
|
90
|
-
literal: (literal) =>
|
|
128
|
+
literal: (literal) => optionLabel(literal) ?? stage(literal) ?? literal,
|
|
91
129
|
...(options?.optionLookupsAreIdentities === true && { optionLookupsAreIdentities: true }),
|
|
92
130
|
...(options?.optionLookupsAsTextOption === true && {
|
|
93
|
-
optionLookupsAreIdentities: (stored) =>
|
|
131
|
+
optionLookupsAreIdentities: (stored) => optionLabel(stored) !== undefined,
|
|
94
132
|
}),
|
|
95
133
|
});
|
|
96
134
|
}
|
|
97
135
|
catch (error) {
|
|
98
136
|
if (error instanceof EntityTfError && !error.message.startsWith(where)) {
|
|
99
|
-
|
|
137
|
+
// Keep an unauthorable value's class, so a caller that drops other
|
|
138
|
+
// undecodable filters can fail on this one instead (#3144).
|
|
139
|
+
const message = `${where}: ${error.message}`;
|
|
140
|
+
throw error instanceof UnauthorableFilterValueError ? new UnauthorableFilterValueError(message) : new EntityTfError(message);
|
|
100
141
|
}
|
|
101
142
|
throw error;
|
|
102
143
|
}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import type { OrgRefLookup } from "../../engine/build/context.js";
|
|
21
21
|
import type { OptionIdIndex } from "../../engine/pull/field-refs-registry.js";
|
|
22
22
|
import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
23
|
+
import { type FieldOwnership } from "../field/to-tf.js";
|
|
23
24
|
import type { Filter } from "../shared/filters/types.js";
|
|
24
25
|
import type { AppServiceAccount } from "../service-account/build.js";
|
|
25
26
|
import type { AccessPolicyGroupRef, AccessPolicyServiceAccountRef, AccessPolicyUserRef } from "./principal.js";
|
|
@@ -41,7 +42,8 @@ export interface AccessPolicyToTfContext {
|
|
|
41
42
|
*/
|
|
42
43
|
readonly appRefName?: string;
|
|
43
44
|
readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
|
|
44
|
-
|
|
45
|
+
/** The owner's field addresses (or a sibling's, #3088), keyed by bag key. */
|
|
46
|
+
readonly fieldAddresses?: FieldOwnership;
|
|
45
47
|
/** Option ids known offline, so a raw id's warning can name its label (#1733). */
|
|
46
48
|
readonly optionIds?: OptionIdIndex;
|
|
47
49
|
/**
|
|
@@ -43,7 +43,7 @@ function fieldValueToTf(token, where, ctx) {
|
|
|
43
43
|
if (foreign !== undefined)
|
|
44
44
|
return foreign;
|
|
45
45
|
}
|
|
46
|
-
const value = fieldRefToTfValue(token.fieldType ?? "", refName, ctx.ownerTfLabel, ctx.scope, ctx.fieldAddresses, token.resourceKey);
|
|
46
|
+
const value = fieldRefToTfValue(token.fieldType ?? "", refName, ctx.ownerTfLabel, ctx.scope, ctx.fieldAddresses, token.resourceKey, token.name);
|
|
47
47
|
if (value === undefined) {
|
|
48
48
|
throw new EntityTfError(`${where}: field token "${refName}" has no terraform field resource mapping`);
|
|
49
49
|
}
|
|
@@ -177,9 +177,24 @@ export interface AgentV2Options extends EntityDeployOptions {
|
|
|
177
177
|
readonly a2aSkills?: readonly A2ASkill[];
|
|
178
178
|
readonly tools?: readonly AgentTool[];
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* def()-time validation of run-automation (executeWorkflow) tools against
|
|
182
|
+
* the embedded automation token's trigger/outputs bags (see the comment
|
|
183
|
+
* above {@link runAutomationToolAddress}).
|
|
184
|
+
*
|
|
185
|
+
* Two findings are stale references, a live shape the platform accepts and
|
|
186
|
+
* runs: a required trigger parameter the tool doesn't map (the automation
|
|
187
|
+
* refuses the run) and a mapped output the automation doesn't declare (the
|
|
188
|
+
* agent gets no value for it). Pull reports them as warnings and prints the
|
|
189
|
+
* tool as it is live. Build/plan/apply settle them against state: a warning
|
|
190
|
+
* when state shows the tool and its automation already in that mismatch,
|
|
191
|
+
* otherwise fatal ({@link runAutomationToolStateCheck}). Every other
|
|
192
|
+
* mismatch is fatal.
|
|
193
|
+
*/
|
|
180
194
|
export declare function validateAgentTools(agentName: string, tools: readonly AgentTool[], identity?: {
|
|
181
195
|
readonly appTfLabel: string;
|
|
182
196
|
readonly agentRefName: string;
|
|
197
|
+
readonly appRefName?: string;
|
|
183
198
|
}): void;
|
|
184
199
|
/**
|
|
185
200
|
* The configured result of `agent` — its reference surface (`ref()`)
|