The resolver, or undefined when the deployment binds no resource
other than its workflow resource.
ContractViolationError when a foreign resource is bound and client
has no withConfig.
Starts an instance whose release ref lives in a bound dataset. Assumes
client is a @sanity/client instance for the workflow resource,
deployment is an entry of the parsed config defineWorkflowConfig
returns, with its definitions deployed, and initialFields holds the
start input.
import {deploymentResourceClients, workflow} from '@sanity/workflow-engine'
const resourceClients = deploymentResourceClients({client, deployment})
await workflow.startInstance({
client,
partition: deployment.partition,
workflowResource: deployment.workflowResource,
...(resourceClients !== undefined ? {resourceClients} : {}),
definition: 'release-docs',
initialFields,
})
Builds a ResourceClientResolver that serves every resource a deployment binds in
resourceAliases, so runtime-supplied refs to those resources pass the declared-surface check and reads route to them.Each client is derived from
clientwithwithConfig, so it keeps the caller's token, API host, and request-tag prefix. The caller's credentials must be able to read and write every bound resource. Bindings to the workflow resource are skipped. A runtime-supplied ref to a resource that is neither the workflow resource nor bound is still rejected with RefResourceUndeclaredError.