@digo-labs/backend 0.2.2 → 0.2.6

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 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` for the fal proxy) — 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) — 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
@@ -109,12 +109,14 @@ declare const databaseRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
109
109
  table: string;
110
110
  limit?: number | undefined;
111
111
  offset?: number | undefined;
112
+ after?: string | number | null | undefined;
112
113
  };
113
114
  };
114
115
  output: {
115
116
  rows: {
116
117
  [x: string]: hono_utils_types.JSONValue;
117
118
  }[];
119
+ next: string | number | null;
118
120
  };
119
121
  outputFormat: "json";
120
122
  status: hono_utils_http_status.ContentfulStatusCode;
@@ -149,12 +151,14 @@ declare const databaseRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
149
151
  value: string | number | boolean | null;
150
152
  limit?: number | undefined;
151
153
  offset?: number | undefined;
154
+ after?: string | number | null | undefined;
152
155
  };
153
156
  };
154
157
  output: {
155
158
  rows: {
156
159
  [x: string]: hono_utils_types.JSONValue;
157
160
  }[];
161
+ next: string | number | null;
158
162
  };
159
163
  outputFormat: "json";
160
164
  status: hono_utils_http_status.ContentfulStatusCode;
@@ -346,7 +350,7 @@ declare const devicesRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
346
350
  };
347
351
  }, "/", "devices-me">;
348
352
 
349
- declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
353
+ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, ((({
350
354
  "jobs-get": {
351
355
  $post: {
352
356
  input: {
@@ -366,10 +370,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
366
370
  verdict: "reject" | "review" | "pass";
367
371
  labels: string[];
368
372
  reason: string | null;
373
+ isFallback?: boolean | undefined;
369
374
  }[];
370
375
  tasks: {
371
376
  key: string;
372
- endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "fake:echo";
377
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
373
378
  status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
374
379
  attempt: number;
375
380
  outputPath: string;
@@ -380,9 +385,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
380
385
  verdict: "reject" | "review" | "pass";
381
386
  labels: string[];
382
387
  reason: string | null;
388
+ isFallback?: boolean | undefined;
383
389
  }[];
384
390
  error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
385
391
  estimatedUsd: number;
392
+ servedBy?: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo" | null | undefined;
386
393
  }[];
387
394
  createdAt: string;
388
395
  updatedAt: string;
@@ -400,12 +407,17 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
400
407
  key: string;
401
408
  tasks: {
402
409
  key: string;
403
- endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "fake:echo";
410
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
404
411
  input: Record<string, unknown>;
405
412
  output: {
406
413
  path: string;
407
414
  };
408
415
  priority?: number | undefined;
416
+ fallbacks?: {
417
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
418
+ input?: Record<string, unknown> | undefined;
419
+ }[] | undefined;
420
+ fallbackAfter?: number | undefined;
409
421
  }[];
410
422
  inputs?: Record<string, string> | undefined;
411
423
  checks?: ({
@@ -414,6 +426,15 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
414
426
  reject?: string[] | undefined;
415
427
  review?: string[] | undefined;
416
428
  minConfidence?: number | undefined;
429
+ fallback?: {
430
+ type: "bedrock";
431
+ prompt: string;
432
+ model?: string | undefined;
433
+ guardrail?: {
434
+ id: string;
435
+ version: string;
436
+ } | undefined;
437
+ } | undefined;
417
438
  } | {
418
439
  type: "bedrock";
419
440
  prompt: string;
@@ -423,6 +444,15 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
423
444
  version: string;
424
445
  } | undefined;
425
446
  model?: string | undefined;
447
+ fallback?: {
448
+ type: "bedrock";
449
+ prompt: string;
450
+ model?: string | undefined;
451
+ guardrail?: {
452
+ id: string;
453
+ version: string;
454
+ } | undefined;
455
+ } | undefined;
426
456
  })[] | undefined;
427
457
  onReview?: "reject" | "continue" | undefined;
428
458
  outputChecks?: ({
@@ -431,6 +461,15 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
431
461
  reject?: string[] | undefined;
432
462
  review?: string[] | undefined;
433
463
  minConfidence?: number | undefined;
464
+ fallback?: {
465
+ type: "bedrock";
466
+ prompt: string;
467
+ model?: string | undefined;
468
+ guardrail?: {
469
+ id: string;
470
+ version: string;
471
+ } | undefined;
472
+ } | undefined;
434
473
  } | {
435
474
  type: "bedrock";
436
475
  prompt: string;
@@ -440,6 +479,15 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
440
479
  version: string;
441
480
  } | undefined;
442
481
  model?: string | undefined;
482
+ fallback?: {
483
+ type: "bedrock";
484
+ prompt: string;
485
+ model?: string | undefined;
486
+ guardrail?: {
487
+ id: string;
488
+ version: string;
489
+ } | undefined;
490
+ } | undefined;
443
491
  })[] | undefined;
444
492
  };
445
493
  };
@@ -455,10 +503,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
455
503
  verdict: "reject" | "review" | "pass";
456
504
  labels: string[];
457
505
  reason: string | null;
506
+ isFallback?: boolean | undefined;
458
507
  }[];
459
508
  tasks: {
460
509
  key: string;
461
- endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "fake:echo";
510
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
462
511
  status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
463
512
  attempt: number;
464
513
  outputPath: string;
@@ -469,9 +518,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
469
518
  verdict: "reject" | "review" | "pass";
470
519
  labels: string[];
471
520
  reason: string | null;
521
+ isFallback?: boolean | undefined;
472
522
  }[];
473
523
  error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
474
524
  estimatedUsd: number;
525
+ servedBy?: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo" | null | undefined;
475
526
  }[];
476
527
  createdAt: string;
477
528
  updatedAt: string;
@@ -489,12 +540,17 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
489
540
  id: string;
490
541
  tasks: {
491
542
  key: string;
492
- endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "fake:echo";
543
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
493
544
  input: Record<string, unknown>;
494
545
  output: {
495
546
  path: string;
496
547
  };
497
548
  priority?: number | undefined;
549
+ fallbacks?: {
550
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
551
+ input?: Record<string, unknown> | undefined;
552
+ }[] | undefined;
553
+ fallbackAfter?: number | undefined;
498
554
  }[];
499
555
  };
500
556
  };
@@ -510,10 +566,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
510
566
  verdict: "reject" | "review" | "pass";
511
567
  labels: string[];
512
568
  reason: string | null;
569
+ isFallback?: boolean | undefined;
513
570
  }[];
514
571
  tasks: {
515
572
  key: string;
516
- endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "fake:echo";
573
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
517
574
  status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
518
575
  attempt: number;
519
576
  outputPath: string;
@@ -524,9 +581,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
524
581
  verdict: "reject" | "review" | "pass";
525
582
  labels: string[];
526
583
  reason: string | null;
584
+ isFallback?: boolean | undefined;
527
585
  }[];
528
586
  error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
529
587
  estimatedUsd: number;
588
+ servedBy?: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo" | null | undefined;
530
589
  }[];
531
590
  createdAt: string;
532
591
  updatedAt: string;
@@ -549,6 +608,15 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
549
608
  reject?: string[] | undefined;
550
609
  review?: string[] | undefined;
551
610
  minConfidence?: number | undefined;
611
+ fallback?: {
612
+ type: "bedrock";
613
+ prompt: string;
614
+ model?: string | undefined;
615
+ guardrail?: {
616
+ id: string;
617
+ version: string;
618
+ } | undefined;
619
+ } | undefined;
552
620
  } | {
553
621
  type: "bedrock";
554
622
  prompt: string;
@@ -558,6 +626,15 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
558
626
  version: string;
559
627
  } | undefined;
560
628
  model?: string | undefined;
629
+ fallback?: {
630
+ type: "bedrock";
631
+ prompt: string;
632
+ model?: string | undefined;
633
+ guardrail?: {
634
+ id: string;
635
+ version: string;
636
+ } | undefined;
637
+ } | undefined;
561
638
  })[];
562
639
  };
563
640
  };
@@ -569,6 +646,7 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
569
646
  verdict: "reject" | "review" | "pass";
570
647
  labels: string[];
571
648
  reason: string | null;
649
+ isFallback?: boolean | undefined;
572
650
  }[];
573
651
  };
574
652
  outputFormat: "json";
@@ -595,10 +673,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
595
673
  verdict: "reject" | "review" | "pass";
596
674
  labels: string[];
597
675
  reason: string | null;
676
+ isFallback?: boolean | undefined;
598
677
  }[];
599
678
  tasks: {
600
679
  key: string;
601
- endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "fake:echo";
680
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
602
681
  status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
603
682
  attempt: number;
604
683
  outputPath: string;
@@ -609,9 +688,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
609
688
  verdict: "reject" | "review" | "pass";
610
689
  labels: string[];
611
690
  reason: string | null;
691
+ isFallback?: boolean | undefined;
612
692
  }[];
613
693
  error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
614
694
  estimatedUsd: number;
695
+ servedBy?: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo" | null | undefined;
615
696
  }[];
616
697
  createdAt: string;
617
698
  updatedAt: string;
@@ -641,10 +722,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
641
722
  verdict: "reject" | "review" | "pass";
642
723
  labels: string[];
643
724
  reason: string | null;
725
+ isFallback?: boolean | undefined;
644
726
  }[];
645
727
  tasks: {
646
728
  key: string;
647
- endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "fake:echo";
729
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
648
730
  status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
649
731
  attempt: number;
650
732
  outputPath: string;
@@ -655,9 +737,11 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
655
737
  verdict: "reject" | "review" | "pass";
656
738
  labels: string[];
657
739
  reason: string | null;
740
+ isFallback?: boolean | undefined;
658
741
  }[];
659
742
  error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
660
743
  estimatedUsd: number;
744
+ servedBy?: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo" | null | undefined;
661
745
  }[];
662
746
  createdAt: string;
663
747
  updatedAt: string;
@@ -668,6 +752,60 @@ declare const aiJobsRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, (({
668
752
  };
669
753
  };
670
754
  })) & {
755
+ "jobs-list": {
756
+ $post: {
757
+ input: {
758
+ json: {
759
+ from?: string | undefined;
760
+ to?: string | undefined;
761
+ statuses?: ("checking" | "running" | "done" | "rejected" | "failed" | "cancelled")[] | undefined;
762
+ cursor?: string | undefined;
763
+ limit?: number | undefined;
764
+ };
765
+ };
766
+ output: {
767
+ jobs: {
768
+ id: string;
769
+ key: string;
770
+ status: "checking" | "running" | "done" | "rejected" | "failed" | "cancelled";
771
+ verdict: "reject" | "review" | "pass" | null;
772
+ checks: {
773
+ type: "rekognition" | "bedrock";
774
+ target: string;
775
+ verdict: "reject" | "review" | "pass";
776
+ labels: string[];
777
+ reason: string | null;
778
+ isFallback?: boolean | undefined;
779
+ }[];
780
+ tasks: {
781
+ key: string;
782
+ endpoint: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo";
783
+ status: "done" | "rejected" | "failed" | "cancelled" | "pending" | "submitted" | "saving";
784
+ attempt: number;
785
+ outputPath: string;
786
+ verdict: "reject" | "review" | "pass" | null;
787
+ checks: {
788
+ type: "rekognition" | "bedrock";
789
+ target: string;
790
+ verdict: "reject" | "review" | "pass";
791
+ labels: string[];
792
+ reason: string | null;
793
+ isFallback?: boolean | undefined;
794
+ }[];
795
+ error: "submit failed" | "provider error" | "provider timed out" | "save failed" | null;
796
+ estimatedUsd: number;
797
+ servedBy?: "fal:openai/gpt-image-2.5/flare/edit" | "fal:openai/gpt-image-2.5/sunburst/edit" | "openai:gpt-image-2.5-flare" | "openai:gpt-image-2.5-sunburst" | "replicate:openai/gpt-image-2" | "replicate:google/nano-banana-pro" | "fake:echo" | null | undefined;
798
+ }[];
799
+ createdAt: string;
800
+ updatedAt: string;
801
+ }[];
802
+ next: string | null;
803
+ };
804
+ outputFormat: "json";
805
+ status: hono_utils_http_status.ContentfulStatusCode;
806
+ };
807
+ };
808
+ }) & {
671
809
  "ai-budget-get": {
672
810
  $post: {
673
811
  input: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digo-labs/backend",
3
- "version": "0.2.2",
3
+ "version": "0.2.6",
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.11"
41
+ "@digo-labs/common": "^0.2.14"
42
42
  },
43
43
  "dependencies": {
44
44
  "@aws-sdk/client-bedrock-runtime": "^3.1035.0",