@toolproof-npm/shared 0.1.101 → 0.1.103
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.
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { ExecutionIdentityJson, ResourceJson, ResourceRoleIdentityJson, StatefulStrategyJson } from '@toolproof-npm/schema';
|
|
2
|
-
export declare function bindInputRes(statefulStrategy: StatefulStrategyJson,
|
|
3
|
-
|
|
2
|
+
export declare function bindInputRes(statefulStrategy: StatefulStrategyJson, target: {
|
|
3
|
+
executionRef: ExecutionIdentityJson;
|
|
4
|
+
resourceRoleRef: ResourceRoleIdentityJson;
|
|
5
|
+
}, resource: ResourceJson): StatefulStrategyJson;
|
|
6
|
+
export declare function bindInputRef(statefulStrategy: StatefulStrategyJson, target: {
|
|
7
|
+
executionRef: ExecutionIdentityJson;
|
|
8
|
+
resourceRoleRef: ResourceRoleIdentityJson;
|
|
9
|
+
}, source: {
|
|
10
|
+
executionRef: ExecutionIdentityJson;
|
|
11
|
+
resourceRoleRef: ResourceRoleIdentityJson;
|
|
12
|
+
}): StatefulStrategyJson;
|
|
13
|
+
export declare function clearInputBinding(statefulStrategy: StatefulStrategyJson, target: {
|
|
4
14
|
executionRef: ExecutionIdentityJson;
|
|
5
15
|
resourceRoleRef: ResourceRoleIdentityJson;
|
|
6
16
|
}): StatefulStrategyJson;
|
|
7
|
-
export declare function clearInputBinding(statefulStrategy: StatefulStrategyJson, execRef: ExecutionIdentityJson, resourceRoleRef: ResourceRoleIdentityJson): StatefulStrategyJson;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { resolveResourceChain } from './resourceChain.js';
|
|
2
|
-
export function bindInputRes(statefulStrategy,
|
|
2
|
+
export function bindInputRes(statefulStrategy, target, resource) {
|
|
3
3
|
const strategyState = statefulStrategy.strategyState;
|
|
4
|
-
const bucket = strategyState[executionRef] ?? {};
|
|
4
|
+
const bucket = strategyState[target.executionRef] ?? {};
|
|
5
5
|
return {
|
|
6
6
|
...statefulStrategy,
|
|
7
7
|
strategyState: {
|
|
8
8
|
...strategyState,
|
|
9
|
-
[executionRef]: {
|
|
9
|
+
[target.executionRef]: {
|
|
10
10
|
...bucket,
|
|
11
|
-
[
|
|
11
|
+
[target.resourceRoleRef]: resource,
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
export function bindInputRef(statefulStrategy,
|
|
16
|
+
export function bindInputRef(statefulStrategy, target, source) {
|
|
17
17
|
const strategyState = statefulStrategy.strategyState;
|
|
18
18
|
const sourceEntry = strategyState?.[source.executionRef]?.[source.resourceRoleRef];
|
|
19
19
|
if (!sourceEntry)
|
|
20
20
|
throw new Error(`resourceEntry not found for source (${source.executionRef}, ${source.resourceRoleRef})`);
|
|
21
|
-
const bucket = strategyState[
|
|
21
|
+
const bucket = strategyState[target.executionRef] ?? {};
|
|
22
22
|
const result = resolveResourceChain(strategyState, { executionRef: source.executionRef, resourceRoleRef: source.resourceRoleRef });
|
|
23
23
|
if (result.status === 'materialized') {
|
|
24
24
|
return {
|
|
25
25
|
...statefulStrategy,
|
|
26
26
|
strategyState: {
|
|
27
27
|
...strategyState,
|
|
28
|
-
[
|
|
28
|
+
[target.executionRef]: {
|
|
29
29
|
...bucket,
|
|
30
|
-
[
|
|
30
|
+
[target.resourceRoleRef]: result.entry,
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
};
|
|
@@ -43,9 +43,9 @@ export function bindInputRef(statefulStrategy, targetExecRef, resourceRoleIdenti
|
|
|
43
43
|
...statefulStrategy,
|
|
44
44
|
strategyState: {
|
|
45
45
|
...strategyState,
|
|
46
|
-
[
|
|
46
|
+
[target.executionRef]: {
|
|
47
47
|
...bucket,
|
|
48
|
-
[
|
|
48
|
+
[target.resourceRoleRef]: reusedMissing,
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
};
|
|
@@ -61,27 +61,27 @@ export function bindInputRef(statefulStrategy, targetExecRef, resourceRoleIdenti
|
|
|
61
61
|
...statefulStrategy,
|
|
62
62
|
strategyState: {
|
|
63
63
|
...strategyState,
|
|
64
|
-
[
|
|
64
|
+
[target.executionRef]: {
|
|
65
65
|
...bucket,
|
|
66
|
-
[
|
|
66
|
+
[target.resourceRoleRef]: potentialInput,
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
throw new Error(`Failed to resolve resource chain: ${result.reason}`);
|
|
72
72
|
}
|
|
73
|
-
export function clearInputBinding(statefulStrategy,
|
|
73
|
+
export function clearInputBinding(statefulStrategy, target) {
|
|
74
74
|
const strategyState = statefulStrategy.strategyState;
|
|
75
|
-
const bucket = strategyState?.[
|
|
76
|
-
if (!bucket?.[resourceRoleRef])
|
|
75
|
+
const bucket = strategyState?.[target.executionRef];
|
|
76
|
+
if (!bucket?.[target.resourceRoleRef])
|
|
77
77
|
return statefulStrategy;
|
|
78
78
|
const nextBucket = { ...bucket };
|
|
79
|
-
delete nextBucket[resourceRoleRef];
|
|
79
|
+
delete nextBucket[target.resourceRoleRef];
|
|
80
80
|
return {
|
|
81
81
|
...statefulStrategy,
|
|
82
82
|
strategyState: {
|
|
83
83
|
...strategyState,
|
|
84
|
-
[
|
|
84
|
+
[target.executionRef]: nextBucket,
|
|
85
85
|
},
|
|
86
86
|
};
|
|
87
87
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare const CONSTANTS: {
|
|
|
48
48
|
readonly TYPE_StatelessStrategy: "TYPE-StatelessStrategy";
|
|
49
49
|
readonly TYPE_StatefulStrategy: "TYPE-StatefulStrategy";
|
|
50
50
|
readonly ROLE_Manual: "ROLE-Manual";
|
|
51
|
+
readonly ROLE_Iteration: "ROLE-Iteration";
|
|
51
52
|
readonly ROLE_ErrorOutput: "ROLE-ErrorOutput";
|
|
52
53
|
readonly ROLE_DynamicSource: "ROLE-u4vW7PDlX6V9IGJoNxhl";
|
|
53
54
|
readonly ROLE_StaticTarget: "ROLE-xLaQo8L1fMxKTQUJcaJn";
|
package/dist/constants.js
CHANGED
|
@@ -48,6 +48,7 @@ export const CONSTANTS = {
|
|
|
48
48
|
TYPE_StatelessStrategy: 'TYPE-StatelessStrategy',
|
|
49
49
|
TYPE_StatefulStrategy: 'TYPE-StatefulStrategy',
|
|
50
50
|
ROLE_Manual: 'ROLE-Manual',
|
|
51
|
+
ROLE_Iteration: 'ROLE-Iteration',
|
|
51
52
|
ROLE_ErrorOutput: 'ROLE-ErrorOutput',
|
|
52
53
|
ROLE_DynamicSource: 'ROLE-u4vW7PDlX6V9IGJoNxhl',
|
|
53
54
|
ROLE_StaticTarget: 'ROLE-xLaQo8L1fMxKTQUJcaJn',
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export * as UTILS from './_lib/utils/utils.js';
|
|
|
4
4
|
export * as RESOURCE_CREATION from './_lib/utils/resourceCreation.js';
|
|
5
5
|
export * as STEP_CREATION from './_lib/utils/stepCreation.js';
|
|
6
6
|
export * as ROLE_RESOURCE_BINDINGS from './_lib/utils/roleResourceBinding.js';
|
|
7
|
+
export * as RESOURCE_CHAIN from './_lib/utils/resourceChain.js';
|
|
7
8
|
export * from './firebaseAdminHelpers.js';
|
|
8
9
|
export * from './firebaseAdminInit.js';
|
package/dist/index.js
CHANGED
|
@@ -4,5 +4,6 @@ export * as UTILS from './_lib/utils/utils.js';
|
|
|
4
4
|
export * as RESOURCE_CREATION from './_lib/utils/resourceCreation.js';
|
|
5
5
|
export * as STEP_CREATION from './_lib/utils/stepCreation.js';
|
|
6
6
|
export * as ROLE_RESOURCE_BINDINGS from './_lib/utils/roleResourceBinding.js';
|
|
7
|
+
export * as RESOURCE_CHAIN from './_lib/utils/resourceChain.js';
|
|
7
8
|
export * from './firebaseAdminHelpers.js';
|
|
8
9
|
export * from './firebaseAdminInit.js';
|