@donkeylabs/cli 2.0.10 → 2.0.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donkeylabs/cli",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "type": "module",
5
5
  "description": "CLI for @donkeylabs/server - project scaffolding and code generation",
6
6
  "main": "./src/index.ts",
@@ -9,13 +9,13 @@
9
9
  "gen:types": "donkeylabs generate"
10
10
  },
11
11
  "dependencies": {
12
- "@donkeylabs/server": "^2.0.14",
12
+ "@donkeylabs/server": "^2.0.15",
13
13
  "kysely": "^0.27.0",
14
14
  "kysely-bun-sqlite": "^0.3.0",
15
15
  "zod": "^3.24.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@donkeylabs/cli": "^2.0.10",
18
+ "@donkeylabs/cli": "^2.0.11",
19
19
  "@types/bun": "latest"
20
20
  }
21
21
  }
@@ -7,7 +7,7 @@
7
7
  "dev": "bun --bun vite dev",
8
8
  "build": "bun run gen:types && vite build",
9
9
  "preview": "bun build/server/entry.js",
10
- "prepare": "bun --bun svelte-kit sync || echo ''",
10
+ "prepare": "bun --bun svelte-kit sync && bun run gen:types || echo ''",
11
11
  "check": "bun --bun svelte-kit sync && bun --bun svelte-check --tsconfig ./tsconfig.json",
12
12
  "gen:types": "donkeylabs generate",
13
13
  "cli": "donkeylabs"
@@ -23,9 +23,9 @@
23
23
  "vite": "^7.2.6"
24
24
  },
25
25
  "dependencies": {
26
- "@donkeylabs/cli": "^2.0.10",
27
- "@donkeylabs/adapter-sveltekit": "^2.0.11",
28
- "@donkeylabs/server": "^2.0.14",
26
+ "@donkeylabs/cli": "^2.0.12",
27
+ "@donkeylabs/adapter-sveltekit": "^2.0.13",
28
+ "@donkeylabs/server": "^2.0.15",
29
29
  "bits-ui": "^2.15.4",
30
30
  "clsx": "^2.1.1",
31
31
  "kysely": "^0.27.6",
@@ -4,5 +4,9 @@ import { defineConfig } from 'vite';
4
4
  import { donkeylabsDev } from '@donkeylabs/adapter-sveltekit/vite';
5
5
 
6
6
  export default defineConfig({
7
- plugins: [donkeylabsDev(), tailwindcss(), sveltekit()]
7
+ plugins: [donkeylabsDev(), tailwindcss(), sveltekit()],
8
+ ssr: {
9
+ // Bundle @donkeylabs packages in SSR so TypeScript files get transpiled
10
+ noExternal: ['@donkeylabs/adapter-sveltekit', '@donkeylabs/server'],
11
+ },
8
12
  });
@@ -1,453 +0,0 @@
1
- // Auto-generated by donkeylabs generate
2
- // DO NOT EDIT MANUALLY
3
-
4
- import { UnifiedApiClientBase, SSEConnection, type ClientOptions } from "@donkeylabs/adapter-sveltekit/client";
5
-
6
- // Utility type that forces TypeScript to expand types on hover
7
- type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
8
-
9
- // ============================================
10
- // Route Types
11
- // ============================================
12
-
13
- export namespace Routes {
14
- export namespace Counter {
15
- export namespace Get {
16
- export type Input = Expand<Record<string, never>>;
17
- export type Output = Expand<{
18
- count: number;
19
- }>;
20
- }
21
- export type Get = { Input: Get.Input; Output: Get.Output };
22
-
23
- export namespace Increment {
24
- export type Input = Expand<Record<string, never>>;
25
- export type Output = Expand<{
26
- count: number;
27
- }>;
28
- }
29
- export type Increment = { Input: Increment.Input; Output: Increment.Output };
30
-
31
- export namespace Decrement {
32
- export type Input = Expand<Record<string, never>>;
33
- export type Output = Expand<{
34
- count: number;
35
- }>;
36
- }
37
- export type Decrement = { Input: Decrement.Input; Output: Decrement.Output };
38
-
39
- export namespace Reset {
40
- export type Input = Expand<Record<string, never>>;
41
- export type Output = Expand<{
42
- count: number;
43
- }>;
44
- }
45
- export type Reset = { Input: Reset.Input; Output: Reset.Output };
46
- }
47
-
48
- export namespace Cache {
49
- export namespace Set {
50
- export type Input = Expand<{
51
- key: string;
52
- value: any;
53
- ttl?: number;
54
- }>;
55
- export type Output = Expand<{
56
- success: boolean;
57
- }>;
58
- }
59
- export type Set = { Input: Set.Input; Output: Set.Output };
60
-
61
- export namespace Get {
62
- export type Input = Expand<{
63
- key: string;
64
- }>;
65
- export type Output = Expand<{
66
- value?: any;
67
- exists: boolean;
68
- }>;
69
- }
70
- export type Get = { Input: Get.Input; Output: Get.Output };
71
-
72
- export namespace Delete {
73
- export type Input = Expand<{
74
- key: string;
75
- }>;
76
- export type Output = Expand<{
77
- success: boolean;
78
- }>;
79
- }
80
- export type Delete = { Input: Delete.Input; Output: Delete.Output };
81
-
82
- export namespace Keys {
83
- export type Input = Expand<Record<string, never>>;
84
- export type Output = Expand<{
85
- keys: string[];
86
- size: number;
87
- }>;
88
- }
89
- export type Keys = { Input: Keys.Input; Output: Keys.Output };
90
- }
91
-
92
- export namespace Sse {
93
- export namespace Broadcast {
94
- export type Input = Expand<{
95
- channel: string;
96
- event: string;
97
- data: any;
98
- }>;
99
- export type Output = Expand<{
100
- success: boolean;
101
- }>;
102
- }
103
- export type Broadcast = { Input: Broadcast.Input; Output: Broadcast.Output };
104
-
105
- export namespace Clients {
106
- export type Input = Expand<Record<string, never>>;
107
- export type Output = Expand<{
108
- total: number;
109
- byChannel: number;
110
- }>;
111
- }
112
- export type Clients = { Input: Clients.Input; Output: Clients.Output };
113
- }
114
-
115
- export namespace Jobs {
116
- export namespace Enqueue {
117
- export type Input = Expand<{
118
- name: string;
119
- data?: Record<string, any>;
120
- delay?: number;
121
- }>;
122
- export type Output = Expand<{
123
- jobId: string;
124
- }>;
125
- }
126
- export type Enqueue = { Input: Enqueue.Input; Output: Enqueue.Output };
127
-
128
- export namespace Stats {
129
- export type Input = Expand<Record<string, never>>;
130
- export type Output = Expand<{
131
- pending: number;
132
- running: number;
133
- completed: number;
134
- }>;
135
- }
136
- export type Stats = { Input: Stats.Input; Output: Stats.Output };
137
- }
138
-
139
- export namespace Events {
140
- export namespace Emit {
141
- export type Input = Expand<{
142
- event: string;
143
- data?: Record<string, any>;
144
- }>;
145
- export type Output = Expand<{
146
- success: boolean;
147
- }>;
148
- }
149
- export type Emit = { Input: Emit.Input; Output: Emit.Output };
150
- }
151
-
152
- export namespace Ratelimit {
153
- export namespace Check {
154
- export type Input = Expand<{
155
- key: string;
156
- limit: number;
157
- window: number;
158
- }>;
159
- export type Output = Expand<{
160
- allowed: boolean;
161
- remaining: number;
162
- limit: number;
163
- resetAt: Date;
164
- }>;
165
- }
166
- export type Check = { Input: Check.Input; Output: Check.Output };
167
-
168
- export namespace Reset {
169
- export type Input = Expand<{
170
- key: string;
171
- }>;
172
- export type Output = Expand<{
173
- success: boolean;
174
- }>;
175
- }
176
- export type Reset = { Input: Reset.Input; Output: Reset.Output };
177
- }
178
-
179
- export namespace Cron {
180
- export namespace List {
181
- export type Input = Expand<Record<string, never>>;
182
- export type Output = Expand<{
183
- tasks: {
184
- id: string;
185
- name: string;
186
- expression: string;
187
- enabled: boolean;
188
- lastRun?: string;
189
- nextRun?: string;
190
- }[];
191
- }>;
192
- }
193
- export type List = { Input: List.Input; Output: List.Output };
194
- }
195
-
196
- export namespace Workflow {
197
- export namespace Start {
198
- export type Input = Expand<{
199
- orderId: string;
200
- items: {
201
- name: string;
202
- qty: number;
203
- }[];
204
- customerEmail: string;
205
- }>;
206
- export type Output = Expand<{
207
- instanceId: string;
208
- }>;
209
- }
210
- export type Start = { Input: Start.Input; Output: Start.Output };
211
-
212
- export namespace Status {
213
- export type Input = Expand<{
214
- instanceId: string;
215
- }>;
216
- export type Output = Expand<{
217
- id: string;
218
- status: string;
219
- currentStep?: string;
220
- input: any;
221
- output?: any;
222
- error?: string;
223
- stepResults: Record<string, any>;
224
- createdAt: string;
225
- startedAt?: string;
226
- completedAt?: string;
227
- } | null>;
228
- }
229
- export type Status = { Input: Status.Input; Output: Status.Output };
230
-
231
- export namespace List {
232
- export type Input = Expand<{
233
- status?: string;
234
- }>;
235
- export type Output = Expand<{
236
- instances: {
237
- id: string;
238
- status: string;
239
- currentStep?: string;
240
- createdAt: string;
241
- completedAt?: string;
242
- }[];
243
- }>;
244
- }
245
- export type List = { Input: List.Input; Output: List.Output };
246
-
247
- export namespace Cancel {
248
- export type Input = Expand<{
249
- instanceId: string;
250
- }>;
251
- export type Output = Expand<{
252
- success: boolean;
253
- }>;
254
- }
255
- export type Cancel = { Input: Cancel.Input; Output: Cancel.Output };
256
- }
257
-
258
- export namespace Audit {
259
- export namespace Log {
260
- export type Input = Expand<{
261
- action: string;
262
- resource: string;
263
- resourceId?: string;
264
- metadata?: Record<string, any>;
265
- }>;
266
- export type Output = Expand<{
267
- id: string;
268
- }>;
269
- }
270
- export type Log = { Input: Log.Input; Output: Log.Output };
271
-
272
- export namespace Query {
273
- export type Input = Expand<{
274
- action?: string;
275
- resource?: string;
276
- limit: number;
277
- }>;
278
- export type Output = Expand<{
279
- entries: {
280
- id: string;
281
- timestamp: string;
282
- action: string;
283
- actor: string;
284
- resource: string;
285
- resourceId?: string;
286
- metadata?: Record<string, any>;
287
- }[];
288
- }>;
289
- }
290
- export type Query = { Input: Query.Input; Output: Query.Output };
291
-
292
- export namespace ByResource {
293
- export type Input = Expand<{
294
- resource: string;
295
- resourceId: string;
296
- }>;
297
- export type Output = Expand<{
298
- entries: {
299
- id: string;
300
- timestamp: string;
301
- action: string;
302
- actor: string;
303
- metadata?: Record<string, any>;
304
- }[];
305
- }>;
306
- }
307
- export type ByResource = { Input: ByResource.Input; Output: ByResource.Output };
308
- }
309
-
310
- export namespace Websocket {
311
- export namespace Broadcast {
312
- export type Input = Expand<{
313
- channel: string;
314
- event: string;
315
- data: any;
316
- }>;
317
- export type Output = Expand<{
318
- success: boolean;
319
- }>;
320
- }
321
- export type Broadcast = { Input: Broadcast.Input; Output: Broadcast.Output };
322
-
323
- export namespace BroadcastAll {
324
- export type Input = Expand<{
325
- event: string;
326
- data: any;
327
- }>;
328
- export type Output = Expand<{
329
- success: boolean;
330
- }>;
331
- }
332
- export type BroadcastAll = { Input: BroadcastAll.Input; Output: BroadcastAll.Output };
333
-
334
- export namespace Clients {
335
- export type Input = Expand<{
336
- channel?: string;
337
- }>;
338
- export type Output = Expand<{
339
- count: number;
340
- clients: string[];
341
- }>;
342
- }
343
- export type Clients = { Input: Clients.Input; Output: Clients.Output };
344
-
345
- export namespace ClientCount {
346
- export type Input = Expand<{
347
- channel?: string;
348
- }>;
349
- export type Output = Expand<{
350
- count: number;
351
- }>;
352
- }
353
- export type ClientCount = { Input: ClientCount.Input; Output: ClientCount.Output };
354
- }
355
- }
356
-
357
- // ============================================
358
- // API Client
359
- // ============================================
360
-
361
- export class ApiClient extends UnifiedApiClientBase {
362
- constructor(options?: ClientOptions) {
363
- super(options);
364
- }
365
-
366
- counter = {
367
- get: (input: Routes.Counter.Get.Input): Promise<Routes.Counter.Get.Output> => this.request("api.counter.get", input),
368
- increment: (input: Routes.Counter.Increment.Input): Promise<Routes.Counter.Increment.Output> => this.request("api.counter.increment", input),
369
- decrement: (input: Routes.Counter.Decrement.Input): Promise<Routes.Counter.Decrement.Output> => this.request("api.counter.decrement", input),
370
- reset: (input: Routes.Counter.Reset.Input): Promise<Routes.Counter.Reset.Output> => this.request("api.counter.reset", input)
371
- };
372
-
373
- cache = {
374
- set: (input: Routes.Cache.Set.Input): Promise<Routes.Cache.Set.Output> => this.request("api.cache.set", input),
375
- get: (input: Routes.Cache.Get.Input): Promise<Routes.Cache.Get.Output> => this.request("api.cache.get", input),
376
- delete: (input: Routes.Cache.Delete.Input): Promise<Routes.Cache.Delete.Output> => this.request("api.cache.delete", input),
377
- keys: (input: Routes.Cache.Keys.Input): Promise<Routes.Cache.Keys.Output> => this.request("api.cache.keys", input)
378
- };
379
-
380
- sse = {
381
- broadcast: (input: Routes.Sse.Broadcast.Input): Promise<Routes.Sse.Broadcast.Output> => this.request("api.sse.broadcast", input),
382
- clients: (input: Routes.Sse.Clients.Input): Promise<Routes.Sse.Clients.Output> => this.request("api.sse.clients", input)
383
- };
384
-
385
- jobs = {
386
- enqueue: (input: Routes.Jobs.Enqueue.Input): Promise<Routes.Jobs.Enqueue.Output> => this.request("api.jobs.enqueue", input),
387
- stats: (input: Routes.Jobs.Stats.Input): Promise<Routes.Jobs.Stats.Output> => this.request("api.jobs.stats", input)
388
- };
389
-
390
- events = {
391
- emit: (input: Routes.Events.Emit.Input): Promise<Routes.Events.Emit.Output> => this.request("api.events.emit", input)
392
- };
393
-
394
- ratelimit = {
395
- check: (input: Routes.Ratelimit.Check.Input): Promise<Routes.Ratelimit.Check.Output> => this.request("api.ratelimit.check", input),
396
- reset: (input: Routes.Ratelimit.Reset.Input): Promise<Routes.Ratelimit.Reset.Output> => this.request("api.ratelimit.reset", input)
397
- };
398
-
399
- cron = {
400
- list: (input: Routes.Cron.List.Input): Promise<Routes.Cron.List.Output> => this.request("api.cron.list", input)
401
- };
402
-
403
- workflow = {
404
- start: (input: Routes.Workflow.Start.Input): Promise<Routes.Workflow.Start.Output> => this.request("api.workflow.start", input),
405
- status: (input: Routes.Workflow.Status.Input): Promise<Routes.Workflow.Status.Output> => this.request("api.workflow.status", input),
406
- list: (input: Routes.Workflow.List.Input): Promise<Routes.Workflow.List.Output> => this.request("api.workflow.list", input),
407
- cancel: (input: Routes.Workflow.Cancel.Input): Promise<Routes.Workflow.Cancel.Output> => this.request("api.workflow.cancel", input)
408
- };
409
-
410
- audit = {
411
- log: (input: Routes.Audit.Log.Input): Promise<Routes.Audit.Log.Output> => this.request("api.audit.log", input),
412
- query: (input: Routes.Audit.Query.Input): Promise<Routes.Audit.Query.Output> => this.request("api.audit.query", input),
413
- byResource: (input: Routes.Audit.ByResource.Input): Promise<Routes.Audit.ByResource.Output> => this.request("api.audit.byResource", input)
414
- };
415
-
416
- websocket = {
417
- broadcast: (input: Routes.Websocket.Broadcast.Input): Promise<Routes.Websocket.Broadcast.Output> => this.request("api.websocket.broadcast", input),
418
- broadcastAll: (input: Routes.Websocket.BroadcastAll.Input): Promise<Routes.Websocket.BroadcastAll.Output> => this.request("api.websocket.broadcastAll", input),
419
- clients: (input: Routes.Websocket.Clients.Input): Promise<Routes.Websocket.Clients.Output> => this.request("api.websocket.clients", input),
420
- clientCount: (input: Routes.Websocket.ClientCount.Input): Promise<Routes.Websocket.ClientCount.Output> => this.request("api.websocket.clientCount", input)
421
- };
422
- }
423
-
424
- /**
425
- * Create an API client instance
426
- *
427
- * @param options.locals - Pass SvelteKit locals for SSR direct calls (no HTTP overhead)
428
- * @param options.baseUrl - Override the base URL for HTTP calls
429
- *
430
- * @example SSR usage in +page.server.ts:
431
- * ```ts
432
- * export const load = async ({ locals }) => {
433
- * const api = createApi({ locals });
434
- * const data = await api.myRoute.get({}); // Direct call, no HTTP!
435
- * return { data };
436
- * };
437
- * ```
438
- *
439
- * @example Browser usage in +page.svelte:
440
- * ```svelte
441
- * <script>
442
- * import { createApi } from '$lib/api';
443
- * const api = createApi(); // HTTP calls
444
- * let data = $state(null);
445
- * async function load() {
446
- * data = await api.myRoute.get({});
447
- * }
448
- * </script>
449
- * ```
450
- */
451
- export function createApi(options?: ClientOptions) {
452
- return new ApiClient(options);
453
- }