@hasna/loops 0.4.27 → 0.4.28

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.
@@ -111,6 +111,113 @@ export interface RunReceiptListResponse {
111
111
  "ok": boolean;
112
112
  "receipts": Array<RunReceipt>;
113
113
  }
114
+ export interface Workflow {
115
+ "id": string;
116
+ "name": string;
117
+ "description"?: string | null;
118
+ "version": number;
119
+ "status": string;
120
+ "steps": Array<Record<string, unknown>>;
121
+ "goal"?: Record<string, unknown>;
122
+ "createdAt"?: string;
123
+ "updatedAt"?: string;
124
+ }
125
+ export interface CreateWorkflowInput {
126
+ "name": string;
127
+ "description"?: string;
128
+ "steps": Array<Record<string, unknown>>;
129
+ "goal"?: Record<string, unknown>;
130
+ }
131
+ export interface WorkflowResponse {
132
+ "ok": boolean;
133
+ "workflow": Workflow;
134
+ }
135
+ export interface WorkflowListResponse {
136
+ "ok": boolean;
137
+ "workflows": Array<Workflow>;
138
+ }
139
+ export interface CreateWorkflowInvocationInput {
140
+ "id"?: string;
141
+ "workflowId"?: string;
142
+ "templateId"?: string;
143
+ "sourceRef": Record<string, unknown>;
144
+ "subjectRef": Record<string, unknown>;
145
+ "intent": string;
146
+ "scope"?: Record<string, unknown>;
147
+ "outputPolicy"?: Record<string, unknown>;
148
+ }
149
+ export type WorkflowInvocation = CreateWorkflowInvocationInput & {
150
+ "id": string;
151
+ "createdAt": string;
152
+ "updatedAt": string;
153
+ };
154
+ export interface WorkflowInvocationResponse {
155
+ "ok": boolean;
156
+ "invocation": WorkflowInvocation;
157
+ }
158
+ export interface WorkflowInvocationListResponse {
159
+ "ok": boolean;
160
+ "invocations": Array<WorkflowInvocation>;
161
+ }
162
+ export interface WorkflowWorkItem {
163
+ "id": string;
164
+ "routeKey": string;
165
+ "idempotencyKey": string;
166
+ "invocationId": string;
167
+ "sourceType": string;
168
+ "sourceRef": string;
169
+ "subjectRef": string;
170
+ "status": string;
171
+ "priority": number;
172
+ "createdAt"?: string;
173
+ "updatedAt"?: string;
174
+ }
175
+ export interface UpsertWorkflowWorkItemInput {
176
+ "id"?: string;
177
+ "routeKey": string;
178
+ "idempotencyKey": string;
179
+ "invocationId": string;
180
+ "sourceType": string;
181
+ "sourceRef": string;
182
+ "subjectRef": string;
183
+ "projectKey"?: string;
184
+ "projectGroup"?: string;
185
+ "machineId"?: string;
186
+ "routeScope"?: string;
187
+ "priority"?: number;
188
+ "status"?: "queued" | "deferred";
189
+ "nextAttemptAt"?: string;
190
+ "lastReason"?: string;
191
+ }
192
+ export interface WorkflowWorkItemResponse {
193
+ "ok": boolean;
194
+ "workItem": WorkflowWorkItem;
195
+ }
196
+ export interface WorkflowWorkItemListResponse {
197
+ "ok": boolean;
198
+ "workItems": Array<WorkflowWorkItem>;
199
+ }
200
+ export interface ImportInput {
201
+ "workflows"?: Array<Record<string, unknown>>;
202
+ "loops"?: Array<Record<string, unknown>>;
203
+ "runs"?: Array<Record<string, unknown>>;
204
+ "replace"?: boolean;
205
+ "preserveLoopScheduling"?: boolean;
206
+ "preserveWorkflowActivation"?: boolean;
207
+ }
208
+ export interface ImportResponse {
209
+ "ok": boolean;
210
+ "imported": {
211
+ "workflows": number;
212
+ "loops": number;
213
+ "runs": number;
214
+ };
215
+ "skippedRunning": number;
216
+ }
217
+ export interface CountResponse {
218
+ "ok": boolean;
219
+ "count": number;
220
+ }
114
221
  export interface LoopsClientOptions {
115
222
  /** Base URL, e.g. process.env.APP_API_URL. */
116
223
  baseUrl: string;
@@ -137,15 +244,30 @@ export declare class LoopsClient {
137
244
  healthCheck(init?: RequestInit): Promise<Foundation>;
138
245
  /** Readiness probe (storage reachable + migrated) */
139
246
  readyCheck(init?: RequestInit): Promise<Foundation>;
247
+ /** Bulk id-preserving import (self-hosted backfill) */
248
+ importRows(body: ImportInput, init?: RequestInit): Promise<ImportResponse>;
249
+ /** List workflow route invocations */
250
+ listWorkflowInvocations(query?: {
251
+ "limit"?: number;
252
+ }, init?: RequestInit): Promise<WorkflowInvocationListResponse>;
253
+ /** Create an id-preserving workflow route invocation */
254
+ createWorkflowInvocation(body: CreateWorkflowInvocationInput, init?: RequestInit): Promise<WorkflowInvocationResponse>;
140
255
  /** List loops */
141
256
  listLoops(query?: {
142
257
  "status"?: "active" | "paused" | "stopped" | "expired";
143
258
  "limit"?: number;
259
+ "offset"?: number;
144
260
  "includeArchived"?: boolean;
145
261
  "archived"?: boolean;
146
262
  }, init?: RequestInit): Promise<LoopListResponse>;
147
263
  /** Create a loop */
148
264
  createLoop(body: CreateLoopInput, init?: RequestInit): Promise<LoopResponse>;
265
+ /** Count loops (total-row verification) */
266
+ countLoops(query?: {
267
+ "status"?: string;
268
+ "includeArchived"?: boolean;
269
+ "archived"?: boolean;
270
+ }, init?: RequestInit): Promise<CountResponse>;
149
271
  /** Get a loop by id */
150
272
  getLoop(id: string, init?: RequestInit): Promise<LoopResponse>;
151
273
  /** Delete a loop */
@@ -174,9 +296,39 @@ export declare class LoopsClient {
174
296
  "loopId"?: string;
175
297
  "status"?: string;
176
298
  "limit"?: number;
299
+ "offset"?: number;
300
+ "showOutput"?: boolean;
177
301
  }, init?: RequestInit): Promise<RunListResponse>;
302
+ /** Count runs (total-row verification) */
303
+ countRuns(query?: {
304
+ "status"?: string;
305
+ }, init?: RequestInit): Promise<CountResponse>;
178
306
  /** Get a run by id */
179
- getRun(id: string, init?: RequestInit): Promise<RunResponse>;
307
+ getRun(id: string, query?: {
308
+ "showOutput"?: boolean;
309
+ }, init?: RequestInit): Promise<RunResponse>;
310
+ /** List workflow route work items */
311
+ listWorkflowWorkItems(query?: {
312
+ "status"?: string;
313
+ "routeKey"?: string;
314
+ "limit"?: number;
315
+ }, init?: RequestInit): Promise<WorkflowWorkItemListResponse>;
316
+ /** Upsert an id-preserving workflow route work item */
317
+ upsertWorkflowWorkItem(body: UpsertWorkflowWorkItemInput, init?: RequestInit): Promise<WorkflowWorkItemResponse>;
318
+ /** List workflow specs */
319
+ listWorkflows(query?: {
320
+ "status"?: "active" | "archived";
321
+ "limit"?: number;
322
+ "offset"?: number;
323
+ }, init?: RequestInit): Promise<WorkflowListResponse>;
324
+ /** Create a workflow spec */
325
+ createWorkflow(body: CreateWorkflowInput, init?: RequestInit): Promise<WorkflowResponse>;
326
+ /** Count workflow specs */
327
+ countWorkflows(query?: {
328
+ "status"?: string;
329
+ }, init?: RequestInit): Promise<CountResponse>;
330
+ /** Get a workflow spec by id */
331
+ getWorkflow(id: string, init?: RequestInit): Promise<WorkflowResponse>;
180
332
  /** Service version */
181
333
  getVersion(init?: RequestInit): Promise<Foundation>;
182
334
  }
package/dist/sdk/http.js CHANGED
@@ -68,6 +68,27 @@ class LoopsClient {
68
68
  init
69
69
  });
70
70
  }
71
+ async importRows(body, init) {
72
+ return this.request("POST", `/v1/import`, {
73
+ body,
74
+ query: undefined,
75
+ init
76
+ });
77
+ }
78
+ async listWorkflowInvocations(query, init) {
79
+ return this.request("GET", `/v1/invocations`, {
80
+ body: undefined,
81
+ query,
82
+ init
83
+ });
84
+ }
85
+ async createWorkflowInvocation(body, init) {
86
+ return this.request("POST", `/v1/invocations`, {
87
+ body,
88
+ query: undefined,
89
+ init
90
+ });
91
+ }
71
92
  async listLoops(query, init) {
72
93
  return this.request("GET", `/v1/loops`, {
73
94
  body: undefined,
@@ -82,6 +103,13 @@ class LoopsClient {
82
103
  init
83
104
  });
84
105
  }
106
+ async countLoops(query, init) {
107
+ return this.request("GET", `/v1/loops/count`, {
108
+ body: undefined,
109
+ query,
110
+ init
111
+ });
112
+ }
85
113
  async getLoop(id, init) {
86
114
  return this.request("GET", `/v1/loops/${encodeURIComponent(String(id))}`, {
87
115
  body: undefined,
@@ -145,8 +173,57 @@ class LoopsClient {
145
173
  init
146
174
  });
147
175
  }
148
- async getRun(id, init) {
176
+ async countRuns(query, init) {
177
+ return this.request("GET", `/v1/runs/count`, {
178
+ body: undefined,
179
+ query,
180
+ init
181
+ });
182
+ }
183
+ async getRun(id, query, init) {
149
184
  return this.request("GET", `/v1/runs/${encodeURIComponent(String(id))}`, {
185
+ body: undefined,
186
+ query,
187
+ init
188
+ });
189
+ }
190
+ async listWorkflowWorkItems(query, init) {
191
+ return this.request("GET", `/v1/work-items`, {
192
+ body: undefined,
193
+ query,
194
+ init
195
+ });
196
+ }
197
+ async upsertWorkflowWorkItem(body, init) {
198
+ return this.request("POST", `/v1/work-items`, {
199
+ body,
200
+ query: undefined,
201
+ init
202
+ });
203
+ }
204
+ async listWorkflows(query, init) {
205
+ return this.request("GET", `/v1/workflows`, {
206
+ body: undefined,
207
+ query,
208
+ init
209
+ });
210
+ }
211
+ async createWorkflow(body, init) {
212
+ return this.request("POST", `/v1/workflows`, {
213
+ body,
214
+ query: undefined,
215
+ init
216
+ });
217
+ }
218
+ async countWorkflows(query, init) {
219
+ return this.request("GET", `/v1/workflows/count`, {
220
+ body: undefined,
221
+ query,
222
+ init
223
+ });
224
+ }
225
+ async getWorkflow(id, init) {
226
+ return this.request("GET", `/v1/workflows/${encodeURIComponent(String(id))}`, {
150
227
  body: undefined,
151
228
  query: undefined,
152
229
  init