@sanity/workflow-engine-test 0.3.1 → 0.4.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/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5136,10 +5136,10 @@ function createQueryHelpers(scope) {
|
|
|
5136
5136
|
};
|
|
5137
5137
|
}
|
|
5138
5138
|
function createReadHelpers(scope) {
|
|
5139
|
-
const { client,
|
|
5139
|
+
const { client, tag } = scope, getInstance = async (instanceId) => {
|
|
5140
5140
|
const doc = await client.getDocument(instanceId);
|
|
5141
5141
|
if (!doc) throw new Error(`Workflow instance ${instanceId} not found`);
|
|
5142
|
-
if (
|
|
5142
|
+
if (doc.tag !== tag)
|
|
5143
5143
|
throw new Error(`Workflow instance ${instanceId} not visible to this engine (tag mismatch)`);
|
|
5144
5144
|
return doc;
|
|
5145
5145
|
};
|
|
@@ -5168,7 +5168,7 @@ function createReadHelpers(scope) {
|
|
|
5168
5168
|
`*[_type == "${workflowEngine.WORKFLOW_INSTANCE_TYPE}"
|
|
5169
5169
|
&& state[_type == "doc.ref" && name == $entry][0].value.id == $ref
|
|
5170
5170
|
&& ${workflowEngine.tagScopeFilter()}] | order(startedAt asc)`,
|
|
5171
|
-
{ ref: subjectRef, entry: entryName,
|
|
5171
|
+
{ ref: subjectRef, entry: entryName, tag }
|
|
5172
5172
|
)
|
|
5173
5173
|
),
|
|
5174
5174
|
instancesByStage: async (workflowName, stage, queryOptions) => {
|
|
@@ -5176,16 +5176,16 @@ function createReadHelpers(scope) {
|
|
|
5176
5176
|
return client.fetch(
|
|
5177
5177
|
`*[_type == "${workflowEngine.WORKFLOW_INSTANCE_TYPE}" && definition == $wf && currentStage == $stage && ${workflowEngine.tagScopeFilter()}${filter}]
|
|
5178
5178
|
| order(startedAt asc)`,
|
|
5179
|
-
{ wf: workflowName, stage,
|
|
5179
|
+
{ wf: workflowName, stage, tag }
|
|
5180
5180
|
);
|
|
5181
5181
|
},
|
|
5182
5182
|
snapshot: () => client.snapshot()
|
|
5183
5183
|
};
|
|
5184
5184
|
}
|
|
5185
5185
|
function createBench(options = {}) {
|
|
5186
|
-
const
|
|
5187
|
-
workflowEngine.
|
|
5188
|
-
const workflowResource = options.workflowResource ?? DEFAULT_WORKFLOW_RESOURCE, client = resolveBenchClient(options), scope = { client,
|
|
5186
|
+
const tag = options.tag ?? "bench";
|
|
5187
|
+
workflowEngine.validateTag(tag);
|
|
5188
|
+
const workflowResource = options.workflowResource ?? DEFAULT_WORKFLOW_RESOURCE, client = resolveBenchClient(options), scope = { client, tag, workflowResource }, access = resolveBenchAccess(options);
|
|
5189
5189
|
let frozenNow = options.now !== void 0 ? assertIsoInstant(options.now) : void 0;
|
|
5190
5190
|
const clock = () => frozenNow ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
5191
5191
|
return {
|