@digo-labs/backend 0.2.8 → 0.2.10
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/README.md +1 -1
- package/dist/index.d.cts +160 -21
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Patterns are documented in the design system: [Backend Patterns](https://design.
|
|
|
17
17
|
npm run dev # tsx watch on port 3000
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Requires env vars (`DATABASE_URL_MONOREPO` at minimum; `FAL_KEY` and `REPLICATE_API_TOKEN` for the proxy and AI jobs, `OPENAI_API_KEY` for AI jobs' OpenAI links) — the usual workflow is developing apps against the deployed backend instead, which needs nothing locally. See [Environment and Local Backend](https://design.digo-labs.com/docs/guide/environment-and-local-backend).
|
|
20
|
+
Requires env vars (`DATABASE_URL_MONOREPO` at minimum; `FAL_KEY` and `REPLICATE_API_TOKEN` for the proxy and AI jobs, `OPENAI_API_KEY` for AI jobs' OpenAI links and OpenAI text, `ANTHROPIC_API_KEY` for Anthropic text, `DEVICE_KEY_SEAL_SECRET` for revealable device keys) — the usual workflow is developing apps against the deployed backend instead, which needs nothing locally. See [Environment and Local Backend](https://design.digo-labs.com/docs/guide/environment-and-local-backend).
|
|
21
21
|
|
|
22
22
|
## Build
|
|
23
23
|
|
package/dist/index.d.cts
CHANGED
|
@@ -247,6 +247,8 @@ declare const bedrockRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono_t
|
|
|
247
247
|
id: string;
|
|
248
248
|
version: string;
|
|
249
249
|
} | undefined;
|
|
250
|
+
reasoningEffort?: "max" | "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
251
|
+
thinking?: "adaptive" | "disabled" | "between_tools" | undefined;
|
|
250
252
|
};
|
|
251
253
|
};
|
|
252
254
|
output: {};
|
|
@@ -254,6 +256,27 @@ declare const bedrockRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono_t
|
|
|
254
256
|
status: hono_utils_http_status.StatusCode;
|
|
255
257
|
};
|
|
256
258
|
};
|
|
259
|
+
} & {
|
|
260
|
+
"bedrock-guardrail": {
|
|
261
|
+
$post: {
|
|
262
|
+
input: {
|
|
263
|
+
json: {
|
|
264
|
+
guardrail: {
|
|
265
|
+
id: string;
|
|
266
|
+
version: string;
|
|
267
|
+
};
|
|
268
|
+
text: string;
|
|
269
|
+
source?: "INPUT" | "OUTPUT" | undefined;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
output: {
|
|
273
|
+
blocked: boolean;
|
|
274
|
+
policies: string[];
|
|
275
|
+
};
|
|
276
|
+
outputFormat: "json";
|
|
277
|
+
status: hono_utils_http_status.ContentfulStatusCode;
|
|
278
|
+
};
|
|
279
|
+
};
|
|
257
280
|
}, "/ai">, "/", "/">;
|
|
258
281
|
|
|
259
282
|
declare const anthropicRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono_types.BlankSchema | hono_types.MergeSchemaPath<{
|
|
@@ -283,6 +306,46 @@ declare const anthropicRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono
|
|
|
283
306
|
id: string;
|
|
284
307
|
version: string;
|
|
285
308
|
} | undefined;
|
|
309
|
+
reasoningEffort?: "max" | "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
310
|
+
thinking?: "adaptive" | "disabled" | "between_tools" | undefined;
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
output: {};
|
|
314
|
+
outputFormat: string;
|
|
315
|
+
status: hono_utils_http_status.StatusCode;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
}, "/ai">, "/", "/">;
|
|
319
|
+
|
|
320
|
+
declare const openAiRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono_types.BlankSchema | hono_types.MergeSchemaPath<{
|
|
321
|
+
"openai-text": {
|
|
322
|
+
$post: {
|
|
323
|
+
input: {
|
|
324
|
+
json: {
|
|
325
|
+
messages: ({
|
|
326
|
+
content: string | ({
|
|
327
|
+
type: "text";
|
|
328
|
+
text: string;
|
|
329
|
+
} | {
|
|
330
|
+
type: "image";
|
|
331
|
+
source: {
|
|
332
|
+
base64: string;
|
|
333
|
+
mediaType: string;
|
|
334
|
+
};
|
|
335
|
+
})[];
|
|
336
|
+
role: "user";
|
|
337
|
+
} | {
|
|
338
|
+
role: "assistant";
|
|
339
|
+
content: string | {
|
|
340
|
+
type: "text";
|
|
341
|
+
text: string;
|
|
342
|
+
}[];
|
|
343
|
+
})[];
|
|
344
|
+
systemPrompt?: string | undefined;
|
|
345
|
+
temperature?: number | undefined;
|
|
346
|
+
reasoningEffort?: "max" | "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
347
|
+
model?: "gpt-6-luna" | "gpt-6.1-terra" | "gpt-6.1-sol" | undefined;
|
|
348
|
+
maxTokens?: number | undefined;
|
|
286
349
|
};
|
|
287
350
|
};
|
|
288
351
|
output: {};
|
|
@@ -299,7 +362,8 @@ declare const devicesRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
|
|
|
299
362
|
json: {
|
|
300
363
|
name: string;
|
|
301
364
|
tier?: "user" | "org" | undefined;
|
|
302
|
-
expiresInDays?: number | undefined;
|
|
365
|
+
expiresInDays?: number | null | undefined;
|
|
366
|
+
isRevealable?: boolean | undefined;
|
|
303
367
|
};
|
|
304
368
|
};
|
|
305
369
|
output: {
|
|
@@ -312,8 +376,9 @@ declare const devicesRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
|
|
|
312
376
|
createdBy: string;
|
|
313
377
|
createdAt: string;
|
|
314
378
|
lastSeenAt: string | null;
|
|
315
|
-
expiresAt: string;
|
|
379
|
+
expiresAt: string | null;
|
|
316
380
|
revokedAt: string | null;
|
|
381
|
+
isRevealable: boolean;
|
|
317
382
|
};
|
|
318
383
|
key: string;
|
|
319
384
|
};
|
|
@@ -337,8 +402,9 @@ declare const devicesRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
|
|
|
337
402
|
createdBy: string;
|
|
338
403
|
createdAt: string;
|
|
339
404
|
lastSeenAt: string | null;
|
|
340
|
-
expiresAt: string;
|
|
405
|
+
expiresAt: string | null;
|
|
341
406
|
revokedAt: string | null;
|
|
407
|
+
isRevealable: boolean;
|
|
342
408
|
}[];
|
|
343
409
|
};
|
|
344
410
|
outputFormat: "json";
|
|
@@ -360,6 +426,77 @@ declare const devicesRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
|
|
|
360
426
|
status: hono_utils_http_status.ContentfulStatusCode;
|
|
361
427
|
};
|
|
362
428
|
};
|
|
429
|
+
} & {
|
|
430
|
+
"devices-reveal": {
|
|
431
|
+
$post: {
|
|
432
|
+
input: {
|
|
433
|
+
json: {
|
|
434
|
+
id: string;
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
output: {
|
|
438
|
+
key: string;
|
|
439
|
+
};
|
|
440
|
+
outputFormat: "json";
|
|
441
|
+
status: hono_utils_http_status.ContentfulStatusCode;
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
} & {
|
|
445
|
+
"devices-lock": {
|
|
446
|
+
$post: {
|
|
447
|
+
input: {
|
|
448
|
+
json: {
|
|
449
|
+
id: string;
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
output: {
|
|
453
|
+
success: boolean;
|
|
454
|
+
};
|
|
455
|
+
outputFormat: "json";
|
|
456
|
+
status: hono_utils_http_status.ContentfulStatusCode;
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
} & {
|
|
460
|
+
"devices-lock-all": {
|
|
461
|
+
$post: {
|
|
462
|
+
input: {
|
|
463
|
+
json: Record<string, never>;
|
|
464
|
+
};
|
|
465
|
+
output: {
|
|
466
|
+
count: number;
|
|
467
|
+
};
|
|
468
|
+
outputFormat: "json";
|
|
469
|
+
status: hono_utils_http_status.ContentfulStatusCode;
|
|
470
|
+
};
|
|
471
|
+
};
|
|
472
|
+
} & {
|
|
473
|
+
"devices-regenerate": {
|
|
474
|
+
$post: {
|
|
475
|
+
input: {
|
|
476
|
+
json: {
|
|
477
|
+
id: string;
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
output: {
|
|
481
|
+
device: {
|
|
482
|
+
id: string;
|
|
483
|
+
app: string;
|
|
484
|
+
instance: string;
|
|
485
|
+
name: string;
|
|
486
|
+
tier: "user" | "org";
|
|
487
|
+
createdBy: string;
|
|
488
|
+
createdAt: string;
|
|
489
|
+
lastSeenAt: string | null;
|
|
490
|
+
expiresAt: string | null;
|
|
491
|
+
revokedAt: string | null;
|
|
492
|
+
isRevealable: boolean;
|
|
493
|
+
};
|
|
494
|
+
key: string;
|
|
495
|
+
};
|
|
496
|
+
outputFormat: "json";
|
|
497
|
+
status: hono_utils_http_status.ContentfulStatusCode;
|
|
498
|
+
};
|
|
499
|
+
};
|
|
363
500
|
} & {
|
|
364
501
|
"devices-me": {
|
|
365
502
|
$post: {
|
|
@@ -376,8 +513,9 @@ declare const devicesRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
|
|
|
376
513
|
createdBy: string;
|
|
377
514
|
createdAt: string;
|
|
378
515
|
lastSeenAt: string | null;
|
|
379
|
-
expiresAt: string;
|
|
516
|
+
expiresAt: string | null;
|
|
380
517
|
revokedAt: string | null;
|
|
518
|
+
isRevealable: boolean;
|
|
381
519
|
};
|
|
382
520
|
};
|
|
383
521
|
outputFormat: "json";
|
|
@@ -410,7 +548,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
410
548
|
}[];
|
|
411
549
|
tasks: {
|
|
412
550
|
key: string;
|
|
413
|
-
endpoint: "fake:echo" | `
|
|
551
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
414
552
|
status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
|
|
415
553
|
attempt: number;
|
|
416
554
|
outputPath: string;
|
|
@@ -425,7 +563,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
425
563
|
}[];
|
|
426
564
|
error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
|
|
427
565
|
estimatedUsd: number;
|
|
428
|
-
servedBy?: "fake:echo" | `
|
|
566
|
+
servedBy?: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}` | null | undefined;
|
|
429
567
|
}[];
|
|
430
568
|
createdAt: string;
|
|
431
569
|
updatedAt: string;
|
|
@@ -443,14 +581,14 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
443
581
|
key: string;
|
|
444
582
|
tasks: {
|
|
445
583
|
key: string;
|
|
446
|
-
endpoint: "fake:echo" | `
|
|
584
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
447
585
|
input: Record<string, unknown>;
|
|
448
586
|
output: {
|
|
449
587
|
path: string;
|
|
450
588
|
};
|
|
451
589
|
priority?: number | undefined;
|
|
452
590
|
fallbacks?: {
|
|
453
|
-
endpoint: "fake:echo" | `
|
|
591
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
454
592
|
input?: Record<string, unknown> | undefined;
|
|
455
593
|
}[] | undefined;
|
|
456
594
|
fallbackAfter?: number | undefined;
|
|
@@ -543,7 +681,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
543
681
|
}[];
|
|
544
682
|
tasks: {
|
|
545
683
|
key: string;
|
|
546
|
-
endpoint: "fake:echo" | `
|
|
684
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
547
685
|
status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
|
|
548
686
|
attempt: number;
|
|
549
687
|
outputPath: string;
|
|
@@ -558,7 +696,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
558
696
|
}[];
|
|
559
697
|
error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
|
|
560
698
|
estimatedUsd: number;
|
|
561
|
-
servedBy?: "fake:echo" | `
|
|
699
|
+
servedBy?: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}` | null | undefined;
|
|
562
700
|
}[];
|
|
563
701
|
createdAt: string;
|
|
564
702
|
updatedAt: string;
|
|
@@ -576,14 +714,14 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
576
714
|
id: string;
|
|
577
715
|
tasks: {
|
|
578
716
|
key: string;
|
|
579
|
-
endpoint: "fake:echo" | `
|
|
717
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
580
718
|
input: Record<string, unknown>;
|
|
581
719
|
output: {
|
|
582
720
|
path: string;
|
|
583
721
|
};
|
|
584
722
|
priority?: number | undefined;
|
|
585
723
|
fallbacks?: {
|
|
586
|
-
endpoint: "fake:echo" | `
|
|
724
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
587
725
|
input?: Record<string, unknown> | undefined;
|
|
588
726
|
}[] | undefined;
|
|
589
727
|
fallbackAfter?: number | undefined;
|
|
@@ -606,7 +744,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
606
744
|
}[];
|
|
607
745
|
tasks: {
|
|
608
746
|
key: string;
|
|
609
|
-
endpoint: "fake:echo" | `
|
|
747
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
610
748
|
status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
|
|
611
749
|
attempt: number;
|
|
612
750
|
outputPath: string;
|
|
@@ -621,7 +759,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
621
759
|
}[];
|
|
622
760
|
error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
|
|
623
761
|
estimatedUsd: number;
|
|
624
|
-
servedBy?: "fake:echo" | `
|
|
762
|
+
servedBy?: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}` | null | undefined;
|
|
625
763
|
}[];
|
|
626
764
|
createdAt: string;
|
|
627
765
|
updatedAt: string;
|
|
@@ -713,7 +851,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
713
851
|
}[];
|
|
714
852
|
tasks: {
|
|
715
853
|
key: string;
|
|
716
|
-
endpoint: "fake:echo" | `
|
|
854
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
717
855
|
status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
|
|
718
856
|
attempt: number;
|
|
719
857
|
outputPath: string;
|
|
@@ -728,7 +866,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
728
866
|
}[];
|
|
729
867
|
error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
|
|
730
868
|
estimatedUsd: number;
|
|
731
|
-
servedBy?: "fake:echo" | `
|
|
869
|
+
servedBy?: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}` | null | undefined;
|
|
732
870
|
}[];
|
|
733
871
|
createdAt: string;
|
|
734
872
|
updatedAt: string;
|
|
@@ -762,7 +900,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
762
900
|
}[];
|
|
763
901
|
tasks: {
|
|
764
902
|
key: string;
|
|
765
|
-
endpoint: "fake:echo" | `
|
|
903
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
766
904
|
status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
|
|
767
905
|
attempt: number;
|
|
768
906
|
outputPath: string;
|
|
@@ -777,7 +915,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
777
915
|
}[];
|
|
778
916
|
error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
|
|
779
917
|
estimatedUsd: number;
|
|
780
|
-
servedBy?: "fake:echo" | `
|
|
918
|
+
servedBy?: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}` | null | undefined;
|
|
781
919
|
}[];
|
|
782
920
|
createdAt: string;
|
|
783
921
|
updatedAt: string;
|
|
@@ -815,7 +953,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
815
953
|
}[];
|
|
816
954
|
tasks: {
|
|
817
955
|
key: string;
|
|
818
|
-
endpoint: "fake:echo" | `
|
|
956
|
+
endpoint: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}`;
|
|
819
957
|
status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
|
|
820
958
|
attempt: number;
|
|
821
959
|
outputPath: string;
|
|
@@ -830,7 +968,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
|
|
|
830
968
|
}[];
|
|
831
969
|
error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
|
|
832
970
|
estimatedUsd: number;
|
|
833
|
-
servedBy?: "fake:echo" | `
|
|
971
|
+
servedBy?: "fake:echo" | `openai:${string}` | `fal:${string}` | `replicate:${string}` | null | undefined;
|
|
834
972
|
}[];
|
|
835
973
|
createdAt: string;
|
|
836
974
|
updatedAt: string;
|
|
@@ -1096,9 +1234,10 @@ type StorageRouter = typeof storageRouter;
|
|
|
1096
1234
|
type DatabaseRouter = typeof databaseRouter;
|
|
1097
1235
|
type BedrockRouter = typeof bedrockRouter;
|
|
1098
1236
|
type AnthropicRouter = typeof anthropicRouter;
|
|
1237
|
+
type OpenAiRouter = typeof openAiRouter;
|
|
1099
1238
|
type DevicesRouter = typeof devicesRouter;
|
|
1100
1239
|
type AiJobsRouter = typeof aiJobsRouter;
|
|
1101
1240
|
type RealtimeRouter = typeof realtimeRouter;
|
|
1102
1241
|
type InstancesRouter = typeof instancesRouter;
|
|
1103
1242
|
|
|
1104
|
-
export { type AiJobsRouter, type AnthropicRouter, type BedrockRouter, type DatabaseRouter, type DevicesRouter, type DmxRouter, type InstancesRouter, type RealtimeRouter, type StorageRouter, app as default };
|
|
1243
|
+
export { type AiJobsRouter, type AnthropicRouter, type BedrockRouter, type DatabaseRouter, type DevicesRouter, type DmxRouter, type InstancesRouter, type OpenAiRouter, type RealtimeRouter, type StorageRouter, app as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digo-labs/backend",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"types": "./dist/index.d.cts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@digo-labs/common": "^0.2.
|
|
41
|
+
"@digo-labs/common": "^0.2.18"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@anthropic-ai/sdk": "^1.6.0",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"dotenv": "^17.2.3",
|
|
56
56
|
"drizzle-orm": "^0.45.2",
|
|
57
57
|
"hono": "^4.9.8",
|
|
58
|
+
"openai": "^7.55.0",
|
|
58
59
|
"pg": "^8.20.0"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|