@sanity/workflow-engine-test 0.2.0 → 0.2.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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { guardsForResource, denyingGuards, MutationGuardDeniedError, workflow, validateTags } from "@sanity/workflow-engine";
1
+ import { guardsForResource, denyingGuards, MutationGuardDeniedError, workflow, WORKFLOW_INSTANCE_TYPE, tagScopeFilter, validateTags } from "@sanity/workflow-engine";
2
2
  import require$$0 from "tty";
3
3
  import require$$1 from "util";
4
4
  function escapeRegExp(string2) {
@@ -5168,16 +5168,16 @@ function createReadHelpers(scope) {
5168
5168
  // ref. The slot id is conventionally "subject" but workflows may
5169
5169
  // name it otherwise.
5170
5170
  client.fetch(
5171
- `*[_type == "workflow.instance"
5171
+ `*[_type == "${WORKFLOW_INSTANCE_TYPE}"
5172
5172
  && state[_type == "workflow.state.doc.ref" && id == $slot][0].value.id == $ref
5173
- && count(tags[@ in $engineTags]) > 0] | order(startedAt asc)`,
5173
+ && ${tagScopeFilter()}] | order(startedAt asc)`,
5174
5174
  { ref: subjectRef, slot: slotId, engineTags: tags }
5175
5175
  )
5176
5176
  ),
5177
5177
  instancesByStage: async (workflowId, stageId, queryOptions) => {
5178
5178
  const filter = queryOptions?.openOnly ? " && completedAt == null" : "";
5179
5179
  return client.fetch(
5180
- `*[_type == "workflow.instance" && workflowId == $wf && currentStageId == $stage && count(tags[@ in $engineTags]) > 0${filter}]
5180
+ `*[_type == "${WORKFLOW_INSTANCE_TYPE}" && workflowId == $wf && currentStageId == $stage && ${tagScopeFilter()}${filter}]
5181
5181
  | order(startedAt asc)`,
5182
5182
  { wf: workflowId, stage: stageId, engineTags: tags }
5183
5183
  );