@toolproof-core/lib 1.0.17 → 1.0.19
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/artifacts/artifacts.d.ts +10 -13
- package/dist/artifacts/artifacts.d.ts.map +1 -1
- package/dist/utils/bindInputRoleToResource.d.ts +1 -1
- package/dist/utils/bindInputRoleToResource.d.ts.map +1 -1
- package/dist/utils/bindInputRoleToResource.js +8 -8
- package/dist/utils/bindInputRoleToResource.js.map +1 -1
- package/dist/utils/creation/resourceCreation.d.ts +7 -7
- package/dist/utils/creation/resourceCreation.d.ts.map +1 -1
- package/dist/utils/creation/resourceCreation.js +3 -3
- package/dist/utils/creation/resourceCreation.js.map +1 -1
- package/dist/utils/creation/stepCreation.js +4 -4
- package/dist/utils/creation/stepCreation.js.map +1 -1
- package/dist/utils/extractData.js +3 -3
- package/dist/utils/extractData.js.map +1 -1
- package/dist/utils/parallelizeSteps.js +4 -4
- package/dist/utils/parallelizeSteps.js.map +1 -1
- package/dist/utils/resolveResourceChain.d.ts +4 -4
- package/dist/utils/resolveResourceChain.d.ts.map +1 -1
- package/dist/utils/resolveResourceChain.js +4 -4
- package/dist/utils/resolveResourceChain.js.map +1 -1
- package/package.json +2 -2
- package/src/utils/bindInputRoleToResource.ts +13 -13
- package/src/utils/creation/resourceCreation.ts +12 -12
- package/src/utils/creation/stepCreation.ts +4 -4
- package/src/utils/extractData.ts +3 -3
- package/src/utils/parallelizeSteps.ts +4 -4
- package/src/utils/resolveResourceChain.ts +11 -11
- package/tsconfig.tsbuildinfo +1 -1
package/src/utils/extractData.ts
CHANGED
|
@@ -77,13 +77,13 @@ export function extractRoleMapFromRawStrategy(rawStrategy: RawStrategyJson, jobM
|
|
|
77
77
|
const job = jobMap.get(jobHandle);
|
|
78
78
|
if (!job) continue;
|
|
79
79
|
|
|
80
|
-
for (const [rid, role] of Object.entries(job.
|
|
80
|
+
for (const [rid, role] of Object.entries(job.roleSpec.inputRoleValueByIdentity)) {
|
|
81
81
|
roleMap.set(rid as ResourceRoleIdentityJson, {
|
|
82
82
|
identity: rid as ResourceRoleIdentityJson,
|
|
83
83
|
...role,
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
for (const [rid, role] of Object.entries(job.
|
|
86
|
+
for (const [rid, role] of Object.entries(job.roleSpec.outputRoleValueByIdentity)) {
|
|
87
87
|
roleMap.set(rid as ResourceRoleIdentityJson, {
|
|
88
88
|
identity: rid as ResourceRoleIdentityJson,
|
|
89
89
|
...role,
|
|
@@ -96,7 +96,7 @@ export function extractRoleMapFromRawStrategy(rawStrategy: RawStrategyJson, jobM
|
|
|
96
96
|
|
|
97
97
|
export function extractSingleNonErrorOutputTypeHandle(job: JobJson): ResourceTypeIdentityJson | null {
|
|
98
98
|
const errorRoleId = CONSTANTS.Cosmos.ROLE_ErrorOutput;
|
|
99
|
-
const outputEntries = Object.entries(job.
|
|
99
|
+
const outputEntries = Object.entries(job.roleSpec.outputRoleValueByIdentity).filter(([roleId]) => roleId !== errorRoleId);
|
|
100
100
|
if (!outputEntries || !outputEntries[0] || outputEntries.length !== 1) {
|
|
101
101
|
throw new Error(`Job ${job.identity} must have exactly one non-error output role to be branchable/loopable`);
|
|
102
102
|
} // ATTENTION_PUREIFY
|
|
@@ -90,24 +90,24 @@ export function getIndependentThreads(steps: StepJson[], strategyState: Strategy
|
|
|
90
90
|
ensureOwner(ownerIndex);
|
|
91
91
|
|
|
92
92
|
const jobStep = jobStepById.get(jobStepId);
|
|
93
|
-
const inputBindings = jobStep?.
|
|
93
|
+
const inputBindings = jobStep?.roleBindingSpec?.inputBindings ?? [];
|
|
94
94
|
const bucket = strategyState?.[jobStepId] ?? ({} as any);
|
|
95
95
|
|
|
96
96
|
for (const inputRoleHandle of inputBindings) {
|
|
97
97
|
const entry = bucket?.[inputRoleHandle as ResourceRoleIdentityJson] as any;
|
|
98
|
-
if (!entry || entry.resourceShellKind !== '
|
|
98
|
+
if (!entry || entry.resourceShellKind !== 'internalInputPotential') continue;
|
|
99
99
|
|
|
100
100
|
const creatorJobStepHandle = entry?.creationContext?.jobStepHandle as JobStepIdentityJson | undefined;
|
|
101
101
|
if (!creatorJobStepHandle) {
|
|
102
102
|
throw new Error(
|
|
103
|
-
`Unresolvable
|
|
103
|
+
`Unresolvable internalInputPotential in jobStep '${jobStepId}' (${getOwnerLabel(ownerIndex)}): missing creationContext.jobStepHandle for role '${inputRoleHandle}'`
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const producerOwner = jobStepIdToOwner.get(creatorJobStepHandle);
|
|
108
108
|
if (producerOwner === undefined) {
|
|
109
109
|
throw new Error(
|
|
110
|
-
`Unresolvable
|
|
110
|
+
`Unresolvable internalInputPotential in jobStep '${jobStepId}' (${getOwnerLabel(ownerIndex)}): creator jobStepHandle '${creatorJobStepHandle}' not found in strategy steps`
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
CreationContextJson,
|
|
3
|
+
ExternalInputPotentialShellJson,
|
|
4
|
+
InternalInputPotentialShellJson,
|
|
5
|
+
OutputPotentialShellJson,
|
|
3
6
|
ResourceJson,
|
|
4
|
-
ResourceMissingJson,
|
|
5
|
-
ResourceInputPotentialJson,
|
|
6
|
-
ResourceOutputPotentialJson,
|
|
7
7
|
ResourcePotentialJson,
|
|
8
8
|
StrategyStateJson,
|
|
9
9
|
} from '@toolproof-core/schema';
|
|
@@ -11,8 +11,8 @@ import { CONSTANTS } from '../artifacts/artifacts.js';
|
|
|
11
11
|
|
|
12
12
|
export type ResolveResult =
|
|
13
13
|
| { status: typeof CONSTANTS.Enums.ResourceShellKind.materialized; entry: ResourceJson; path: CreationContextJson[] }
|
|
14
|
-
| { status: typeof CONSTANTS.Enums.ResourceShellKind.
|
|
15
|
-
| { status: typeof CONSTANTS.Enums.ResourceShellKind.outputPotential; entry:
|
|
14
|
+
| { status: typeof CONSTANTS.Enums.ResourceShellKind.externalInputPotential; entry: ExternalInputPotentialShellJson; path: CreationContextJson[] }
|
|
15
|
+
| { status: typeof CONSTANTS.Enums.ResourceShellKind.outputPotential; entry: OutputPotentialShellJson; path: CreationContextJson[] }
|
|
16
16
|
| { status: 'unresolved'; reason: 'not-found' | 'cycle' | 'depth-exceeded'; path: CreationContextJson[] };
|
|
17
17
|
|
|
18
18
|
export function resolveResourceChain(
|
|
@@ -45,16 +45,16 @@ export function resolveResourceChain(
|
|
|
45
45
|
if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.materialized) {
|
|
46
46
|
return { status: CONSTANTS.Enums.ResourceShellKind.materialized, entry: entry as ResourceJson, path };
|
|
47
47
|
}
|
|
48
|
-
if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.
|
|
49
|
-
return { status: CONSTANTS.Enums.ResourceShellKind.
|
|
48
|
+
if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.externalInputPotential) {
|
|
49
|
+
return { status: CONSTANTS.Enums.ResourceShellKind.externalInputPotential, entry: entry as ExternalInputPotentialShellJson, path };
|
|
50
50
|
}
|
|
51
51
|
if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.outputPotential) {
|
|
52
|
-
return { status: CONSTANTS.Enums.ResourceShellKind.outputPotential, entry: entry as
|
|
52
|
+
return { status: CONSTANTS.Enums.ResourceShellKind.outputPotential, entry: entry as OutputPotentialShellJson, path };
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
//
|
|
56
|
-
if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.
|
|
57
|
-
current = (entry as
|
|
55
|
+
// internalInputPotential: follow ref backwards
|
|
56
|
+
if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.internalInputPotential) {
|
|
57
|
+
current = (entry as InternalInputPotentialShellJson).creationContext;
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
60
|
|