@toolproof-npm/shared 0.1.103 → 0.1.105
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,16 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function bindInputRes(statefulStrategy: StatefulStrategyJson, target:
|
|
3
|
-
|
|
4
|
-
|
|
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: {
|
|
14
|
-
executionRef: ExecutionIdentityJson;
|
|
15
|
-
resourceRoleRef: ResourceRoleIdentityJson;
|
|
16
|
-
}): StatefulStrategyJson;
|
|
1
|
+
import type { ResourceJson, StatefulStrategyJson, CreationContextJson } from '@toolproof-npm/schema';
|
|
2
|
+
export declare function bindInputRes(statefulStrategy: StatefulStrategyJson, target: CreationContextJson, resource: ResourceJson): StatefulStrategyJson;
|
|
3
|
+
export declare function bindInputRef(statefulStrategy: StatefulStrategyJson, target: CreationContextJson, source: CreationContextJson): StatefulStrategyJson;
|
|
4
|
+
export declare function clearInputBinding(statefulStrategy: StatefulStrategyJson, target: CreationContextJson): StatefulStrategyJson;
|
|
@@ -6,3 +6,4 @@ export declare const createBranchStepFromJobPairs: (cases: {
|
|
|
6
6
|
whenJob: JobJson;
|
|
7
7
|
}[]) => Promise<BranchStepJson>;
|
|
8
8
|
export declare const cloneForStep: (forStep: ForStepJson) => Promise<ForStepJson>;
|
|
9
|
+
export declare const cloneWhileStep: (whileStep: WhileStepJson) => Promise<WhileStepJson>;
|
|
@@ -124,3 +124,51 @@ export const cloneForStep = async (forStep) => {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
};
|
|
127
|
+
// DOC: Helper function to clone a WhileStep with new identities for steps and executions, preserving job references and bindings
|
|
128
|
+
export const cloneWhileStep = async (whileStep) => {
|
|
129
|
+
// Generate new WhileStep identity
|
|
130
|
+
const newWhileStepIdentity = await getNewIdentity(CONSTANTS.STEPS.while);
|
|
131
|
+
// Clone the "what" WorkStep
|
|
132
|
+
const originalWhatWorkStep = whileStep.case.what;
|
|
133
|
+
const newWhatWorkStepIdentity = await getNewIdentity(CONSTANTS.STEPS.work);
|
|
134
|
+
const newWhatExecutionIdentity = newWhatWorkStepIdentity.replace(CONSTANTS.STEPS.work.toUpperCase(), 'execution'.toUpperCase());
|
|
135
|
+
const newWhatExecution = {
|
|
136
|
+
identity: newWhatExecutionIdentity,
|
|
137
|
+
jobRef: originalWhatWorkStep.execution.jobRef,
|
|
138
|
+
roleBindings: {
|
|
139
|
+
inputBindingMap: { ...originalWhatWorkStep.execution.roleBindings.inputBindingMap },
|
|
140
|
+
outputBindingMap: { ...originalWhatWorkStep.execution.roleBindings.outputBindingMap }
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const newWhatWorkStep = {
|
|
144
|
+
identity: newWhatWorkStepIdentity,
|
|
145
|
+
kind: CONSTANTS.STEPS.work,
|
|
146
|
+
execution: newWhatExecution
|
|
147
|
+
};
|
|
148
|
+
// Clone the "when" WorkStep
|
|
149
|
+
const originalWhenWorkStep = whileStep.case.when;
|
|
150
|
+
const newWhenWorkStepIdentity = await getNewIdentity(CONSTANTS.STEPS.work);
|
|
151
|
+
const newWhenExecutionIdentity = newWhenWorkStepIdentity.replace(CONSTANTS.STEPS.work.toUpperCase(), 'execution'.toUpperCase());
|
|
152
|
+
const newWhenExecution = {
|
|
153
|
+
identity: newWhenExecutionIdentity,
|
|
154
|
+
jobRef: originalWhenWorkStep.execution.jobRef,
|
|
155
|
+
roleBindings: {
|
|
156
|
+
inputBindingMap: { ...originalWhenWorkStep.execution.roleBindings.inputBindingMap },
|
|
157
|
+
outputBindingMap: { ...originalWhenWorkStep.execution.roleBindings.outputBindingMap }
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const newWhenWorkStep = {
|
|
161
|
+
identity: newWhenWorkStepIdentity,
|
|
162
|
+
kind: CONSTANTS.STEPS.work,
|
|
163
|
+
execution: newWhenExecution
|
|
164
|
+
};
|
|
165
|
+
// Assemble the cloned WhileStep
|
|
166
|
+
return {
|
|
167
|
+
identity: newWhileStepIdentity,
|
|
168
|
+
kind: CONSTANTS.STEPS.while,
|
|
169
|
+
case: {
|
|
170
|
+
what: newWhatWorkStep,
|
|
171
|
+
when: newWhenWorkStep
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toolproof-npm/shared",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.105",
|
|
4
4
|
"description": "Core library utilities for ToolProof",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"toolproof",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"typescript": "^5.9.3"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@toolproof-npm/schema": "^0.1.
|
|
59
|
+
"@toolproof-npm/schema": "^0.1.70",
|
|
60
60
|
"firebase-admin": "^13.6.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|