@donkeylabs/cli 0.5.0 → 0.6.3

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.
@@ -100,16 +100,40 @@ export namespace Routes {
100
100
  export type Input = Expand<Record<string, never>>;
101
101
  export type Output = Expand<{
102
102
  keys: string[];
103
+ size: number;
103
104
  }>;
104
105
  }
105
106
  export type Keys = { Input: Keys.Input; Output: Keys.Output };
106
107
  }
107
108
 
109
+ export namespace Sse {
110
+ export namespace Broadcast {
111
+ export type Input = Expand<{
112
+ channel: string;
113
+ event: string;
114
+ data: any;
115
+ }>;
116
+ export type Output = Expand<{
117
+ success: boolean;
118
+ }>;
119
+ }
120
+ export type Broadcast = { Input: Broadcast.Input; Output: Broadcast.Output };
121
+
122
+ export namespace Clients {
123
+ export type Input = Expand<Record<string, never>>;
124
+ export type Output = Expand<{
125
+ total: number;
126
+ byChannel: number;
127
+ }>;
128
+ }
129
+ export type Clients = { Input: Clients.Input; Output: Clients.Output };
130
+ }
131
+
108
132
  export namespace Jobs {
109
133
  export namespace Enqueue {
110
134
  export type Input = Expand<{
111
135
  name: string;
112
- data: any;
136
+ data?: Record<string, any>;
113
137
  delay?: number;
114
138
  }>;
115
139
  export type Output = Expand<{
@@ -129,21 +153,17 @@ export namespace Routes {
129
153
  export type Stats = { Input: Stats.Input; Output: Stats.Output };
130
154
  }
131
155
 
132
- export namespace Cron {
133
- export namespace List {
134
- export type Input = Expand<Record<string, never>>;
156
+ export namespace Events {
157
+ export namespace Emit {
158
+ export type Input = Expand<{
159
+ event: string;
160
+ data?: Record<string, any>;
161
+ }>;
135
162
  export type Output = Expand<{
136
- tasks: {
137
- id: string;
138
- name: string;
139
- expression: string;
140
- enabled: boolean;
141
- lastRun?: string;
142
- nextRun?: string;
143
- }[];
163
+ success: boolean;
144
164
  }>;
145
165
  }
146
- export type List = { Input: List.Input; Output: List.Output };
166
+ export type Emit = { Input: Emit.Input; Output: Emit.Output };
147
167
  }
148
168
 
149
169
  export namespace Ratelimit {
@@ -156,6 +176,7 @@ export namespace Routes {
156
176
  export type Output = Expand<{
157
177
  allowed: boolean;
158
178
  remaining: number;
179
+ limit: number;
159
180
  resetAt: Date;
160
181
  }>;
161
182
  }
@@ -172,41 +193,83 @@ export namespace Routes {
172
193
  export type Reset = { Input: Reset.Input; Output: Reset.Output };
173
194
  }
174
195
 
175
- export namespace Events {
176
- export namespace Emit {
196
+ export namespace Cron {
197
+ export namespace List {
198
+ export type Input = Expand<Record<string, never>>;
199
+ export type Output = Expand<{
200
+ tasks: {
201
+ id: string;
202
+ name: string;
203
+ expression: string;
204
+ enabled: boolean;
205
+ lastRun?: string;
206
+ nextRun?: string;
207
+ }[];
208
+ }>;
209
+ }
210
+ export type List = { Input: List.Input; Output: List.Output };
211
+ }
212
+
213
+ export namespace Workflow {
214
+ export namespace Start {
177
215
  export type Input = Expand<{
178
- event: string;
179
- data: any;
216
+ orderId: string;
217
+ items: {
218
+ name: string;
219
+ qty: number;
220
+ }[];
221
+ customerEmail: string;
180
222
  }>;
181
223
  export type Output = Expand<{
182
- success: boolean;
224
+ instanceId: string;
183
225
  }>;
184
226
  }
185
- export type Emit = { Input: Emit.Input; Output: Emit.Output };
186
- }
227
+ export type Start = { Input: Start.Input; Output: Start.Output };
187
228
 
188
- export namespace Sse {
189
- export namespace Broadcast {
229
+ export namespace Status {
190
230
  export type Input = Expand<{
191
- channel: string;
192
- event: string;
193
- data: any;
231
+ instanceId: string;
194
232
  }>;
195
233
  export type Output = Expand<{
196
- success: boolean;
197
- recipients: number;
234
+ id: string;
235
+ status: string;
236
+ currentStep?: string;
237
+ input: any;
238
+ output?: any;
239
+ error?: string;
240
+ stepResults: Record<string, any>;
241
+ createdAt: string;
242
+ startedAt?: string;
243
+ completedAt?: string;
244
+ } | null>;
245
+ }
246
+ export type Status = { Input: Status.Input; Output: Status.Output };
247
+
248
+ export namespace List {
249
+ export type Input = Expand<{
250
+ status?: string;
251
+ }>;
252
+ export type Output = Expand<{
253
+ instances: {
254
+ id: string;
255
+ status: string;
256
+ currentStep?: string;
257
+ createdAt: string;
258
+ completedAt?: string;
259
+ }[];
198
260
  }>;
199
261
  }
200
- export type Broadcast = { Input: Broadcast.Input; Output: Broadcast.Output };
262
+ export type List = { Input: List.Input; Output: List.Output };
201
263
 
202
- export namespace Clients {
203
- export type Input = Expand<Record<string, never>>;
264
+ export namespace Cancel {
265
+ export type Input = Expand<{
266
+ instanceId: string;
267
+ }>;
204
268
  export type Output = Expand<{
205
- total: number;
206
- byChannel: number;
269
+ success: boolean;
207
270
  }>;
208
271
  }
209
- export type Clients = { Input: Clients.Input; Output: Clients.Output };
272
+ export type Cancel = { Input: Cancel.Input; Output: Cancel.Output };
210
273
  }
211
274
  }
212
275
  }
@@ -233,23 +296,29 @@ export class ApiClient extends UnifiedApiClientBase {
233
296
  delete: (input: Routes.Api.Cache.Delete.Input): Promise<Routes.Api.Cache.Delete.Output> => this.request("api.cache.delete", input),
234
297
  keys: (input: Routes.Api.Cache.Keys.Input): Promise<Routes.Api.Cache.Keys.Output> => this.request("api.cache.keys", input)
235
298
  },
299
+ sse: {
300
+ broadcast: (input: Routes.Api.Sse.Broadcast.Input): Promise<Routes.Api.Sse.Broadcast.Output> => this.request("api.sse.broadcast", input),
301
+ clients: (input: Routes.Api.Sse.Clients.Input): Promise<Routes.Api.Sse.Clients.Output> => this.request("api.sse.clients", input)
302
+ },
236
303
  jobs: {
237
304
  enqueue: (input: Routes.Api.Jobs.Enqueue.Input): Promise<Routes.Api.Jobs.Enqueue.Output> => this.request("api.jobs.enqueue", input),
238
305
  stats: (input: Routes.Api.Jobs.Stats.Input): Promise<Routes.Api.Jobs.Stats.Output> => this.request("api.jobs.stats", input)
239
306
  },
240
- cron: {
241
- list: (input: Routes.Api.Cron.List.Input): Promise<Routes.Api.Cron.List.Output> => this.request("api.cron.list", input)
307
+ events: {
308
+ emit: (input: Routes.Api.Events.Emit.Input): Promise<Routes.Api.Events.Emit.Output> => this.request("api.events.emit", input)
242
309
  },
243
310
  ratelimit: {
244
311
  check: (input: Routes.Api.Ratelimit.Check.Input): Promise<Routes.Api.Ratelimit.Check.Output> => this.request("api.ratelimit.check", input),
245
312
  reset: (input: Routes.Api.Ratelimit.Reset.Input): Promise<Routes.Api.Ratelimit.Reset.Output> => this.request("api.ratelimit.reset", input)
246
313
  },
247
- events: {
248
- emit: (input: Routes.Api.Events.Emit.Input): Promise<Routes.Api.Events.Emit.Output> => this.request("api.events.emit", input)
314
+ cron: {
315
+ list: (input: Routes.Api.Cron.List.Input): Promise<Routes.Api.Cron.List.Output> => this.request("api.cron.list", input)
249
316
  },
250
- sse: {
251
- broadcast: (input: Routes.Api.Sse.Broadcast.Input): Promise<Routes.Api.Sse.Broadcast.Output> => this.request("api.sse.broadcast", input),
252
- clients: (input: Routes.Api.Sse.Clients.Input): Promise<Routes.Api.Sse.Clients.Output> => this.request("api.sse.clients", input)
317
+ workflow: {
318
+ start: (input: Routes.Api.Workflow.Start.Input): Promise<Routes.Api.Workflow.Start.Output> => this.request("api.workflow.start", input),
319
+ status: (input: Routes.Api.Workflow.Status.Input): Promise<Routes.Api.Workflow.Status.Output> => this.request("api.workflow.status", input),
320
+ list: (input: Routes.Api.Workflow.List.Input): Promise<Routes.Api.Workflow.List.Output> => this.request("api.workflow.list", input),
321
+ cancel: (input: Routes.Api.Workflow.Cancel.Input): Promise<Routes.Api.Workflow.Cancel.Output> => this.request("api.workflow.cancel", input)
253
322
  }
254
323
  };
255
324
  }
@@ -257,9 +257,16 @@
257
257
  <p class="text-muted-foreground mt-2">
258
258
  SvelteKit Adapter — All Core Services
259
259
  </p>
260
- <Badge variant="outline" class="mt-3">
261
- SSR: {data.isSSR ? "Yes" : "No"} | Loaded: {data.loadedAt}
262
- </Badge>
260
+ <div class="flex gap-2 justify-center mt-3">
261
+ <Badge variant="outline">
262
+ SSR: {data.isSSR ? "Yes" : "No"} | Loaded: {data.loadedAt}
263
+ </Badge>
264
+ <a href="/workflows">
265
+ <Badge variant="default" class="cursor-pointer hover:bg-primary/90">
266
+ Try Workflows Demo
267
+ </Badge>
268
+ </a>
269
+ </div>
263
270
  </div>
264
271
 
265
272
  <!-- Grid of feature cards -->
@@ -0,0 +1,23 @@
1
+ // Workflow demo page - SSR load
2
+ import type { PageServerLoad } from "./$types";
3
+ import { createApi } from "$lib/api";
4
+
5
+ export const load: PageServerLoad = async ({ locals }) => {
6
+ const client = createApi({ locals });
7
+
8
+ try {
9
+ // Load initial workflow instances
10
+ const result = await client.api.workflow.list({});
11
+ return {
12
+ instances: result.instances || [],
13
+ loadedAt: new Date().toISOString(),
14
+ isSSR: true,
15
+ };
16
+ } catch (e) {
17
+ return {
18
+ instances: [],
19
+ loadedAt: new Date().toISOString(),
20
+ isSSR: true,
21
+ };
22
+ }
23
+ };