@lunora/workflow 1.0.0-alpha.84 → 1.0.0-alpha.86
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/do/index.d.mts +1 -1
- package/dist/do/index.d.ts +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/WorkflowsRestError-7vFcm7UK.mjs +1 -0
- package/dist/packem_shared/{types.d-DUrUHeVi.d.mts → types.d-zivJ8nEf.d.mts} +1 -1
- package/dist/packem_shared/{types.d-DUrUHeVi.d.ts → types.d-zivJ8nEf.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/packem_shared/WorkflowsRestError-CxLJskBZ.mjs +0 -1
package/dist/do/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:workers';
|
|
2
|
-
import { W as WorkflowDefinition } from "../packem_shared/types.d-
|
|
2
|
+
import { W as WorkflowDefinition } from "../packem_shared/types.d-zivJ8nEf.mjs";
|
|
3
3
|
import '@lunora/values';
|
|
4
4
|
/**
|
|
5
5
|
* Base class for the generated `WorkflowEntrypoint` classes. Applies a
|
package/dist/do/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:workers';
|
|
2
|
-
import { W as WorkflowDefinition } from "../packem_shared/types.d-
|
|
2
|
+
import { W as WorkflowDefinition } from "../packem_shared/types.d-zivJ8nEf.js";
|
|
3
3
|
import '@lunora/values';
|
|
4
4
|
/**
|
|
5
5
|
* Base class for the generated `WorkflowEntrypoint` classes. Applies a
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Workflows, L as LunoraWorkflowsOptions, b as WorkflowEventDefinition, S as StepArgsValidator, c as StepConfig, d as StepDefinition, e as WorkflowConfig, W as WorkflowDefinition, f as WorkflowBranch, g as WorkflowInstanceStatus, h as WorkflowEventLike, i as WorkflowStepLike, j as WorkflowRunContext, k as WorkflowLogger, l as WorkflowRunFunction, m as WorkflowRunStepFunction, n as WorkflowWaitForEventFunction } from "./packem_shared/types.d-
|
|
2
|
-
export type { A as ArgsOf, B as BranchCompensationParams, F as FunctionKind, o as FunctionReference, I as InferStepArgs, R as RunFunctionOptions, p as RunStepOptions, q as StepHandler, r as StepRollbackContext, s as StepRollbackHandler, t as StepRunContext, u as WaitForEventOptions, v as WorkflowBatchDeleteResult, w as WorkflowBindingLike, x as WorkflowBranchOutputs, y as WorkflowCreateBatchError, z as WorkflowCreateBatchOptions, C as WorkflowCreateBatchResult, D as WorkflowCreateOptions, E as WorkflowDelayFunctionLike, G as WorkflowHandle, H as WorkflowHandler, J as WorkflowInstanceEventLike, K as WorkflowInstanceLike, M as WorkflowInstanceSubscribeOptionsLike, N as WorkflowInstanceSubscriptionLike, O as WorkflowParallelFunction, P as WorkflowRetention, Q as WorkflowRollbackContextLike, T as WorkflowRollbackHandlerLike, U as WorkflowSpawnFunction, V as WorkflowSpawnOptions, X as WorkflowStatusResult, Y as WorkflowStepConfigLike, Z as WorkflowStepContextLike, _ as WorkflowStepRollbackOptionsLike } from "./packem_shared/types.d-
|
|
1
|
+
import { a as Workflows, L as LunoraWorkflowsOptions, b as WorkflowEventDefinition, S as StepArgsValidator, c as StepConfig, d as StepDefinition, e as WorkflowConfig, W as WorkflowDefinition, f as WorkflowBranch, g as WorkflowInstanceStatus, h as WorkflowEventLike, i as WorkflowStepLike, j as WorkflowRunContext, k as WorkflowLogger, l as WorkflowRunFunction, m as WorkflowRunStepFunction, n as WorkflowWaitForEventFunction } from "./packem_shared/types.d-zivJ8nEf.mjs";
|
|
2
|
+
export type { A as ArgsOf, B as BranchCompensationParams, F as FunctionKind, o as FunctionReference, I as InferStepArgs, R as RunFunctionOptions, p as RunStepOptions, q as StepHandler, r as StepRollbackContext, s as StepRollbackHandler, t as StepRunContext, u as WaitForEventOptions, v as WorkflowBatchDeleteResult, w as WorkflowBindingLike, x as WorkflowBranchOutputs, y as WorkflowCreateBatchError, z as WorkflowCreateBatchOptions, C as WorkflowCreateBatchResult, D as WorkflowCreateOptions, E as WorkflowDelayFunctionLike, G as WorkflowHandle, H as WorkflowHandler, J as WorkflowInstanceEventLike, K as WorkflowInstanceLike, M as WorkflowInstanceSubscribeOptionsLike, N as WorkflowInstanceSubscriptionLike, O as WorkflowParallelFunction, P as WorkflowRetention, Q as WorkflowRollbackContextLike, T as WorkflowRollbackHandlerLike, U as WorkflowSpawnFunction, V as WorkflowSpawnOptions, X as WorkflowStatusResult, Y as WorkflowStepConfigLike, Z as WorkflowStepContextLike, _ as WorkflowStepRollbackOptionsLike } from "./packem_shared/types.d-zivJ8nEf.mjs";
|
|
3
3
|
import { Validator } from '@lunora/values';
|
|
4
4
|
import { LunoraError } from '@lunora/errors';
|
|
5
5
|
/** Wiring info for one declared workflow, emitted by codegen into the generated shard. */
|
|
@@ -190,7 +190,7 @@ declare const branch: <Output = unknown>(workflow: string, params?: Record<strin
|
|
|
190
190
|
timeout?: number | string;
|
|
191
191
|
}) => WorkflowBranch<Output>;
|
|
192
192
|
/** The lifecycle mutations the REST API exposes via `PATCH .../instances/{id}`. */
|
|
193
|
-
type WorkflowInstanceAction = "pause" | "resume" | "terminate";
|
|
193
|
+
type WorkflowInstanceAction = "pause" | "restart" | "resume" | "terminate";
|
|
194
194
|
/** Configuration for a {@link WorkflowsRestClient}. */
|
|
195
195
|
interface WorkflowsRestConfig {
|
|
196
196
|
/** Cloudflare account id that owns the workflow. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Workflows, L as LunoraWorkflowsOptions, b as WorkflowEventDefinition, S as StepArgsValidator, c as StepConfig, d as StepDefinition, e as WorkflowConfig, W as WorkflowDefinition, f as WorkflowBranch, g as WorkflowInstanceStatus, h as WorkflowEventLike, i as WorkflowStepLike, j as WorkflowRunContext, k as WorkflowLogger, l as WorkflowRunFunction, m as WorkflowRunStepFunction, n as WorkflowWaitForEventFunction } from "./packem_shared/types.d-
|
|
2
|
-
export type { A as ArgsOf, B as BranchCompensationParams, F as FunctionKind, o as FunctionReference, I as InferStepArgs, R as RunFunctionOptions, p as RunStepOptions, q as StepHandler, r as StepRollbackContext, s as StepRollbackHandler, t as StepRunContext, u as WaitForEventOptions, v as WorkflowBatchDeleteResult, w as WorkflowBindingLike, x as WorkflowBranchOutputs, y as WorkflowCreateBatchError, z as WorkflowCreateBatchOptions, C as WorkflowCreateBatchResult, D as WorkflowCreateOptions, E as WorkflowDelayFunctionLike, G as WorkflowHandle, H as WorkflowHandler, J as WorkflowInstanceEventLike, K as WorkflowInstanceLike, M as WorkflowInstanceSubscribeOptionsLike, N as WorkflowInstanceSubscriptionLike, O as WorkflowParallelFunction, P as WorkflowRetention, Q as WorkflowRollbackContextLike, T as WorkflowRollbackHandlerLike, U as WorkflowSpawnFunction, V as WorkflowSpawnOptions, X as WorkflowStatusResult, Y as WorkflowStepConfigLike, Z as WorkflowStepContextLike, _ as WorkflowStepRollbackOptionsLike } from "./packem_shared/types.d-
|
|
1
|
+
import { a as Workflows, L as LunoraWorkflowsOptions, b as WorkflowEventDefinition, S as StepArgsValidator, c as StepConfig, d as StepDefinition, e as WorkflowConfig, W as WorkflowDefinition, f as WorkflowBranch, g as WorkflowInstanceStatus, h as WorkflowEventLike, i as WorkflowStepLike, j as WorkflowRunContext, k as WorkflowLogger, l as WorkflowRunFunction, m as WorkflowRunStepFunction, n as WorkflowWaitForEventFunction } from "./packem_shared/types.d-zivJ8nEf.js";
|
|
2
|
+
export type { A as ArgsOf, B as BranchCompensationParams, F as FunctionKind, o as FunctionReference, I as InferStepArgs, R as RunFunctionOptions, p as RunStepOptions, q as StepHandler, r as StepRollbackContext, s as StepRollbackHandler, t as StepRunContext, u as WaitForEventOptions, v as WorkflowBatchDeleteResult, w as WorkflowBindingLike, x as WorkflowBranchOutputs, y as WorkflowCreateBatchError, z as WorkflowCreateBatchOptions, C as WorkflowCreateBatchResult, D as WorkflowCreateOptions, E as WorkflowDelayFunctionLike, G as WorkflowHandle, H as WorkflowHandler, J as WorkflowInstanceEventLike, K as WorkflowInstanceLike, M as WorkflowInstanceSubscribeOptionsLike, N as WorkflowInstanceSubscriptionLike, O as WorkflowParallelFunction, P as WorkflowRetention, Q as WorkflowRollbackContextLike, T as WorkflowRollbackHandlerLike, U as WorkflowSpawnFunction, V as WorkflowSpawnOptions, X as WorkflowStatusResult, Y as WorkflowStepConfigLike, Z as WorkflowStepContextLike, _ as WorkflowStepRollbackOptionsLike } from "./packem_shared/types.d-zivJ8nEf.js";
|
|
3
3
|
import { Validator } from '@lunora/values';
|
|
4
4
|
import { LunoraError } from '@lunora/errors';
|
|
5
5
|
/** Wiring info for one declared workflow, emitted by codegen into the generated shard. */
|
|
@@ -190,7 +190,7 @@ declare const branch: <Output = unknown>(workflow: string, params?: Record<strin
|
|
|
190
190
|
timeout?: number | string;
|
|
191
191
|
}) => WorkflowBranch<Output>;
|
|
192
192
|
/** The lifecycle mutations the REST API exposes via `PATCH .../instances/{id}`. */
|
|
193
|
-
type WorkflowInstanceAction = "pause" | "resume" | "terminate";
|
|
193
|
+
type WorkflowInstanceAction = "pause" | "restart" | "resume" | "terminate";
|
|
194
194
|
/** Configuration for a {@link WorkflowsRestClient}. */
|
|
195
195
|
interface WorkflowsRestConfig {
|
|
196
196
|
/** Cloudflare account id that owns the workflow. */
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createWorkflowContext as e}from"./packem_shared/createWorkflowContext-DBUnSy0_.mjs";import{default as f}from"./packem_shared/createWorkflows-BwR_J9mp.mjs";import{defineWorkflowEvent as n,isWorkflowEventDefinition as i}from"./packem_shared/defineWorkflowEvent-suERPEEV.mjs";import{defineStep as p,isStepDefinition as s}from"./packem_shared/defineStep-D1-9eOnA.mjs";import{defineWorkflow as x,isWorkflowDefinition as w,workflowClassName as c,workflowDefaultName as k}from"./packem_shared/defineWorkflow-DynRL6LP.mjs";import{NonRetryableError as W,convertNonRetryableError as R,isNonRetryableError as N,toNativeNonRetryableError as v}from"./packem_shared/NonRetryableError-BPu01mU8.mjs";import{MAX_BRANCHES as d,branch as u}from"./packem_shared/MAX_BRANCHES-Bcw3dss9.mjs";import{WorkflowsRestError as D,createWorkflowsRestClient as S}from"./packem_shared/WorkflowsRestError-
|
|
1
|
+
import{createWorkflowContext as e}from"./packem_shared/createWorkflowContext-DBUnSy0_.mjs";import{default as f}from"./packem_shared/createWorkflows-BwR_J9mp.mjs";import{defineWorkflowEvent as n,isWorkflowEventDefinition as i}from"./packem_shared/defineWorkflowEvent-suERPEEV.mjs";import{defineStep as p,isStepDefinition as s}from"./packem_shared/defineStep-D1-9eOnA.mjs";import{defineWorkflow as x,isWorkflowDefinition as w,workflowClassName as c,workflowDefaultName as k}from"./packem_shared/defineWorkflow-DynRL6LP.mjs";import{NonRetryableError as W,convertNonRetryableError as R,isNonRetryableError as N,toNativeNonRetryableError as v}from"./packem_shared/NonRetryableError-BPu01mU8.mjs";import{MAX_BRANCHES as d,branch as u}from"./packem_shared/MAX_BRANCHES-Bcw3dss9.mjs";import{WorkflowsRestError as D,createWorkflowsRestClient as S}from"./packem_shared/WorkflowsRestError-7vFcm7UK.mjs";import{createWorkflowRunContext as A}from"./packem_shared/createWorkflowRunContext-CRTTub21.mjs";import{c as h,v as B}from"./packem_shared/run-step-DJ107J5H.mjs";import{createWaitForEvent as H}from"./packem_shared/createWaitForEvent-D5Ohn2Pz.mjs";import{isDuplicateInstanceError as M}from"./packem_shared/isDuplicateInstanceError-CecnqNAa.mjs";export{d as MAX_BRANCHES,W as NonRetryableError,D as WorkflowsRestError,u as branch,R as convertNonRetryableError,h as createRunStep,H as createWaitForEvent,e as createWorkflowContext,A as createWorkflowRunContext,f as createWorkflows,S as createWorkflowsRestClient,p as defineStep,x as defineWorkflow,n as defineWorkflowEvent,M as isDuplicateInstanceError,N as isNonRetryableError,s as isStepDefinition,w as isWorkflowDefinition,i as isWorkflowEventDefinition,v as toNativeNonRetryableError,B as validateStepArgs,c as workflowClassName,k as workflowDefaultName};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as g}from"@lunora/errors";const l=256,S=t=>t.length>l?`${t.slice(0,l)}… (truncated)`:t,h="https://api.cloudflare.com/client/v4/accounts",_=async({accountId:t,apiToken:a,fetch:e,init:n,path:r})=>{const s=await(e??globalThis.fetch.bind(globalThis))(`${h}/${encodeURIComponent(t)}${r}`,{...n,headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"}}),o=await s.text();let c;try{c=JSON.parse(o)}catch{return{ok:!1,status:s.status,text:o}}return!s.ok||typeof c!="object"||c===null||c.success===!1?{ok:!1,status:s.status,text:o}:{body:c,ok:!0}},A={complete:!0,errored:!0,paused:!0,queued:!0,rollingBack:!0,running:!0,terminated:!0,unknown:!0,waiting:!0,waitingForPause:!0},y=t=>typeof t=="string"&&Object.hasOwn(A,t)?t:"unknown",i=t=>typeof t=="string"&&t!==""?t:void 0,m=(t,a)=>typeof t=="string"?t:a,O=t=>typeof t=="boolean"?t:void 0,b=t=>Array.isArray(t)?t.length:typeof t=="number"?t:void 0,f=t=>({createdOn:i(t.created_on),endedOn:i(t.ended_on),id:m(t.id,""),startedOn:i(t.started_on),status:y(t.status)}),k=t=>({attempts:b(t.attempts),end:i(t.end),error:t.error,name:m(t.name,""),output:t.output,start:i(t.start),success:O(t.success),type:i(t.type)});class C extends g{constructor(a,e){super("WORKFLOWS_REST_ERROR",`Cloudflare Workflows REST API returned ${String(a)}: ${S(e)}`,{cause:e,name:"WorkflowsRestError",status:a})}}const I=t=>{const a=async(e,n)=>{const r=await _({accountId:t.accountId,apiToken:t.apiToken,...t.fetch===void 0?{}:{fetch:t.fetch},...n===void 0?{}:{init:n},path:`/workflows${e}`});if(!r.ok)throw new C(r.status,r.text);return r.body};return{getInstance:async({instanceId:e,workflowName:n})=>{const s=(await a(`/${encodeURIComponent(n)}/instances/${encodeURIComponent(e)}`)).result??{},o=Array.isArray(s.steps)?s.steps:[];return{...f(s),error:s.error,output:s.output,params:s.params,steps:o.map(c=>k(c))}},listInstances:async({page:e,perPage:n,status:r,workflowName:s})=>{const o=new URLSearchParams;r!==void 0&&o.set("status",r),e!==void 0&&o.set("page",String(e)),n!==void 0&&o.set("per_page",String(n));const c=o.toString()===""?"":`?${o.toString()}`,p=await a(`/${encodeURIComponent(s)}/instances${c}`),d=Array.isArray(p.result)?p.result:[],u=p.result_info??{};return{instances:d.map(R=>f(R)),page:typeof u.page=="number"?u.page:e??1,perPage:typeof u.per_page=="number"?u.per_page:n??d.length,totalCount:typeof u.total_count=="number"?u.total_count:void 0}},setInstanceStatus:async({action:e,instanceId:n,workflowName:r})=>{const o=(await a(`/${encodeURIComponent(r)}/instances/${encodeURIComponent(n)}/status`,{body:JSON.stringify({status:e}),method:"PATCH"})).result??{};return{status:y(o.status)}}}};export{C as WorkflowsRestError,I as createWorkflowsRestClient};
|
|
@@ -42,7 +42,7 @@ interface FunctionReference<Kind extends FunctionKind = FunctionKind, Args = unk
|
|
|
42
42
|
/** Extract the args type from a {@link FunctionReference}. */
|
|
43
43
|
type ArgsOf<F> = F extends FunctionReference<infer _K, infer A, infer _R> ? A : never;
|
|
44
44
|
/** A workflow instance's lifecycle status. Mirrors `WorkflowInstanceStatus`. */
|
|
45
|
-
type WorkflowInstanceStatus = "complete" | "errored" | "paused" | "queued" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
|
|
45
|
+
type WorkflowInstanceStatus = "complete" | "errored" | "paused" | "queued" | "rollingBack" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
|
|
46
46
|
/** Result of `WorkflowInstance.status()`. Mirrors Cloudflare's `InstanceStatus`. */
|
|
47
47
|
interface WorkflowStatusResult {
|
|
48
48
|
error?: {
|
|
@@ -42,7 +42,7 @@ interface FunctionReference<Kind extends FunctionKind = FunctionKind, Args = unk
|
|
|
42
42
|
/** Extract the args type from a {@link FunctionReference}. */
|
|
43
43
|
type ArgsOf<F> = F extends FunctionReference<infer _K, infer A, infer _R> ? A : never;
|
|
44
44
|
/** A workflow instance's lifecycle status. Mirrors `WorkflowInstanceStatus`. */
|
|
45
|
-
type WorkflowInstanceStatus = "complete" | "errored" | "paused" | "queued" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
|
|
45
|
+
type WorkflowInstanceStatus = "complete" | "errored" | "paused" | "queued" | "rollingBack" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
|
|
46
46
|
/** Result of `WorkflowInstance.status()`. Mirrors Cloudflare's `InstanceStatus`. */
|
|
47
47
|
interface WorkflowStatusResult {
|
|
48
48
|
error?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/workflow",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.86",
|
|
4
4
|
"description": "Durable workflows for Lunora: defineWorkflow over Cloudflare Workflows, generated WorkflowEntrypoint classes, and the ctx.workflows surface",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
52
|
-
"@lunora/values": "1.0.0-alpha.
|
|
52
|
+
"@lunora/values": "1.0.0-alpha.73",
|
|
53
53
|
"@lunora/wire": "1.0.0-alpha.1"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as g}from"@lunora/errors";const l=256,S=t=>t.length>l?`${t.slice(0,l)}… (truncated)`:t,h="https://api.cloudflare.com/client/v4/accounts",_=async({accountId:t,apiToken:a,fetch:e,init:n,path:r})=>{const s=await(e??globalThis.fetch.bind(globalThis))(`${h}/${encodeURIComponent(t)}${r}`,{...n,headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"}}),o=await s.text();let c;try{c=JSON.parse(o)}catch{return{ok:!1,status:s.status,text:o}}return!s.ok||typeof c!="object"||c===null||c.success===!1?{ok:!1,status:s.status,text:o}:{body:c,ok:!0}},A={complete:!0,errored:!0,paused:!0,queued:!0,running:!0,terminated:!0,unknown:!0,waiting:!0,waitingForPause:!0},y=t=>typeof t=="string"&&Object.hasOwn(A,t)?t:"unknown",i=t=>typeof t=="string"&&t!==""?t:void 0,m=(t,a)=>typeof t=="string"?t:a,O=t=>typeof t=="boolean"?t:void 0,b=t=>Array.isArray(t)?t.length:typeof t=="number"?t:void 0,f=t=>({createdOn:i(t.created_on),endedOn:i(t.ended_on),id:m(t.id,""),startedOn:i(t.started_on),status:y(t.status)}),C=t=>({attempts:b(t.attempts),end:i(t.end),error:t.error,name:m(t.name,""),output:t.output,start:i(t.start),success:O(t.success),type:i(t.type)});class $ extends g{constructor(a,e){super("WORKFLOWS_REST_ERROR",`Cloudflare Workflows REST API returned ${String(a)}: ${S(e)}`,{cause:e,name:"WorkflowsRestError",status:a})}}const I=t=>{const a=async(e,n)=>{const r=await _({accountId:t.accountId,apiToken:t.apiToken,...t.fetch===void 0?{}:{fetch:t.fetch},...n===void 0?{}:{init:n},path:`/workflows${e}`});if(!r.ok)throw new $(r.status,r.text);return r.body};return{getInstance:async({instanceId:e,workflowName:n})=>{const s=(await a(`/${encodeURIComponent(n)}/instances/${encodeURIComponent(e)}`)).result??{},o=Array.isArray(s.steps)?s.steps:[];return{...f(s),error:s.error,output:s.output,params:s.params,steps:o.map(c=>C(c))}},listInstances:async({page:e,perPage:n,status:r,workflowName:s})=>{const o=new URLSearchParams;r!==void 0&&o.set("status",r),e!==void 0&&o.set("page",String(e)),n!==void 0&&o.set("per_page",String(n));const c=o.toString()===""?"":`?${o.toString()}`,p=await a(`/${encodeURIComponent(s)}/instances${c}`),d=Array.isArray(p.result)?p.result:[],u=p.result_info??{};return{instances:d.map(R=>f(R)),page:typeof u.page=="number"?u.page:e??1,perPage:typeof u.per_page=="number"?u.per_page:n??d.length,totalCount:typeof u.total_count=="number"?u.total_count:void 0}},setInstanceStatus:async({action:e,instanceId:n,workflowName:r})=>{const o=(await a(`/${encodeURIComponent(r)}/instances/${encodeURIComponent(n)}/status`,{body:JSON.stringify({status:e}),method:"PATCH"})).result??{};return{status:y(o.status)}}}};export{$ as WorkflowsRestError,I as createWorkflowsRestClient};
|