@spfn/core 0.2.0-beta.2 → 0.2.0-beta.20
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 +262 -1092
- package/dist/{boss-D-fGtVgM.d.ts → boss-DI1r4kTS.d.ts} +68 -11
- package/dist/codegen/index.d.ts +55 -8
- package/dist/codegen/index.js +179 -5
- package/dist/codegen/index.js.map +1 -1
- package/dist/config/index.d.ts +204 -6
- package/dist/config/index.js +44 -11
- package/dist/config/index.js.map +1 -1
- package/dist/db/index.d.ts +13 -0
- package/dist/db/index.js +92 -33
- package/dist/db/index.js.map +1 -1
- package/dist/env/index.d.ts +83 -3
- package/dist/env/index.js +83 -15
- package/dist/env/index.js.map +1 -1
- package/dist/env/loader.d.ts +95 -0
- package/dist/env/loader.js +78 -0
- package/dist/env/loader.js.map +1 -0
- package/dist/event/index.d.ts +3 -70
- package/dist/event/index.js +10 -1
- package/dist/event/index.js.map +1 -1
- package/dist/event/sse/client.d.ts +131 -0
- package/dist/event/sse/client.js +150 -0
- package/dist/event/sse/client.js.map +1 -0
- package/dist/event/sse/index.d.ts +46 -0
- package/dist/event/sse/index.js +205 -0
- package/dist/event/sse/index.js.map +1 -0
- package/dist/job/index.d.ts +54 -8
- package/dist/job/index.js +61 -12
- package/dist/job/index.js.map +1 -1
- package/dist/middleware/index.d.ts +124 -11
- package/dist/middleware/index.js +41 -7
- package/dist/middleware/index.js.map +1 -1
- package/dist/nextjs/index.d.ts +2 -2
- package/dist/nextjs/index.js +37 -5
- package/dist/nextjs/index.js.map +1 -1
- package/dist/nextjs/server.d.ts +70 -17
- package/dist/nextjs/server.js +107 -36
- package/dist/nextjs/server.js.map +1 -1
- package/dist/route/index.d.ts +207 -14
- package/dist/route/index.js +304 -31
- package/dist/route/index.js.map +1 -1
- package/dist/route/types.d.ts +2 -31
- package/dist/router-Di7ENoah.d.ts +151 -0
- package/dist/server/index.d.ts +321 -10
- package/dist/server/index.js +798 -189
- package/dist/server/index.js.map +1 -1
- package/dist/{types-DRG2XMTR.d.ts → types-7Mhoxnnt.d.ts} +97 -4
- package/dist/types-B-lVqv6b.d.ts +298 -0
- package/docs/cache.md +133 -0
- package/docs/codegen.md +74 -0
- package/docs/database.md +346 -0
- package/docs/entity.md +539 -0
- package/docs/env.md +499 -0
- package/docs/errors.md +319 -0
- package/docs/event.md +423 -0
- package/docs/file-upload.md +717 -0
- package/docs/job.md +131 -0
- package/docs/logger.md +108 -0
- package/docs/middleware.md +337 -0
- package/docs/nextjs.md +241 -0
- package/docs/repository.md +496 -0
- package/docs/route.md +497 -0
- package/docs/server.md +377 -0
- package/package.json +19 -3
package/dist/config/index.d.ts
CHANGED
|
@@ -20,9 +20,9 @@ import { parsePostgresUrl, parseRedisUrl } from '@spfn/core/env';
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
declare const coreEnvSchema: {
|
|
23
|
-
NODE_ENV: Omit<_spfn_core_env.EnvVarSchema<"production" | "local" | "development" | "test">, "key" | "type" | "validator"> & {
|
|
23
|
+
NODE_ENV: Omit<_spfn_core_env.EnvVarSchema<"production" | "local" | "development" | "staging" | "test">, "key" | "type" | "validator"> & {
|
|
24
24
|
type: "enum";
|
|
25
|
-
validator: (val: string) => "production" | "local" | "development" | "test";
|
|
25
|
+
validator: (val: string) => "production" | "local" | "development" | "staging" | "test";
|
|
26
26
|
} & {
|
|
27
27
|
key: "NODE_ENV";
|
|
28
28
|
};
|
|
@@ -34,6 +34,7 @@ declare const coreEnvSchema: {
|
|
|
34
34
|
examples: string[];
|
|
35
35
|
} & {
|
|
36
36
|
type: "string";
|
|
37
|
+
validator: (value: string) => string;
|
|
37
38
|
} & {
|
|
38
39
|
key: "DATABASE_URL";
|
|
39
40
|
};
|
|
@@ -45,6 +46,7 @@ declare const coreEnvSchema: {
|
|
|
45
46
|
examples: string[];
|
|
46
47
|
} & {
|
|
47
48
|
type: "string";
|
|
49
|
+
validator: (value: string) => string;
|
|
48
50
|
} & {
|
|
49
51
|
key: "DATABASE_WRITE_URL";
|
|
50
52
|
};
|
|
@@ -56,6 +58,7 @@ declare const coreEnvSchema: {
|
|
|
56
58
|
examples: string[];
|
|
57
59
|
} & {
|
|
58
60
|
type: "string";
|
|
61
|
+
validator: (value: string) => string;
|
|
59
62
|
} & {
|
|
60
63
|
key: "DATABASE_READ_URL";
|
|
61
64
|
};
|
|
@@ -226,6 +229,7 @@ declare const coreEnvSchema: {
|
|
|
226
229
|
examples: string[];
|
|
227
230
|
} & {
|
|
228
231
|
type: "string";
|
|
232
|
+
validator: (value: string) => string;
|
|
229
233
|
} & {
|
|
230
234
|
key: "DRIZZLE_SCHEMA_PATH";
|
|
231
235
|
};
|
|
@@ -236,6 +240,7 @@ declare const coreEnvSchema: {
|
|
|
236
240
|
examples: string[];
|
|
237
241
|
} & {
|
|
238
242
|
type: "string";
|
|
243
|
+
validator: (value: string) => string;
|
|
239
244
|
} & {
|
|
240
245
|
key: "DRIZZLE_OUT_DIR";
|
|
241
246
|
};
|
|
@@ -253,6 +258,7 @@ declare const coreEnvSchema: {
|
|
|
253
258
|
examples: string[];
|
|
254
259
|
} & {
|
|
255
260
|
type: "string";
|
|
261
|
+
validator: (value: string) => string;
|
|
256
262
|
} & {
|
|
257
263
|
key: "CACHE_URL";
|
|
258
264
|
};
|
|
@@ -264,6 +270,7 @@ declare const coreEnvSchema: {
|
|
|
264
270
|
examples: string[];
|
|
265
271
|
} & {
|
|
266
272
|
type: "string";
|
|
273
|
+
validator: (value: string) => string;
|
|
267
274
|
} & {
|
|
268
275
|
key: "CACHE_WRITE_URL";
|
|
269
276
|
};
|
|
@@ -275,6 +282,7 @@ declare const coreEnvSchema: {
|
|
|
275
282
|
examples: string[];
|
|
276
283
|
} & {
|
|
277
284
|
type: "string";
|
|
285
|
+
validator: (value: string) => string;
|
|
278
286
|
} & {
|
|
279
287
|
key: "CACHE_READ_URL";
|
|
280
288
|
};
|
|
@@ -284,6 +292,7 @@ declare const coreEnvSchema: {
|
|
|
284
292
|
examples: string[];
|
|
285
293
|
} & {
|
|
286
294
|
type: "string";
|
|
295
|
+
validator: (value: string) => string;
|
|
287
296
|
} & {
|
|
288
297
|
key: "CACHE_SENTINEL_HOSTS";
|
|
289
298
|
};
|
|
@@ -293,6 +302,7 @@ declare const coreEnvSchema: {
|
|
|
293
302
|
examples: string[];
|
|
294
303
|
} & {
|
|
295
304
|
type: "string";
|
|
305
|
+
validator: (value: string) => string;
|
|
296
306
|
} & {
|
|
297
307
|
key: "CACHE_CLUSTER_NODES";
|
|
298
308
|
};
|
|
@@ -302,6 +312,7 @@ declare const coreEnvSchema: {
|
|
|
302
312
|
examples: string[];
|
|
303
313
|
} & {
|
|
304
314
|
type: "string";
|
|
315
|
+
validator: (value: string) => string;
|
|
305
316
|
} & {
|
|
306
317
|
key: "CACHE_MASTER_NAME";
|
|
307
318
|
};
|
|
@@ -312,6 +323,7 @@ declare const coreEnvSchema: {
|
|
|
312
323
|
examples: string[];
|
|
313
324
|
} & {
|
|
314
325
|
type: "string";
|
|
326
|
+
validator: (value: string) => string;
|
|
315
327
|
} & {
|
|
316
328
|
key: "CACHE_PASSWORD";
|
|
317
329
|
};
|
|
@@ -342,6 +354,7 @@ declare const coreEnvSchema: {
|
|
|
342
354
|
examples: string[];
|
|
343
355
|
} & {
|
|
344
356
|
type: "string";
|
|
357
|
+
validator: (value: string) => string;
|
|
345
358
|
} & {
|
|
346
359
|
key: "HOST";
|
|
347
360
|
};
|
|
@@ -385,24 +398,77 @@ declare const coreEnvSchema: {
|
|
|
385
398
|
} & {
|
|
386
399
|
key: "SHUTDOWN_TIMEOUT";
|
|
387
400
|
};
|
|
401
|
+
FETCH_CONNECT_TIMEOUT: {
|
|
402
|
+
description: string;
|
|
403
|
+
default: number;
|
|
404
|
+
examples: number[];
|
|
405
|
+
} & {
|
|
406
|
+
type: "number";
|
|
407
|
+
validator: (value: string) => number;
|
|
408
|
+
} & {
|
|
409
|
+
key: "FETCH_CONNECT_TIMEOUT";
|
|
410
|
+
};
|
|
411
|
+
FETCH_HEADERS_TIMEOUT: {
|
|
412
|
+
description: string;
|
|
413
|
+
default: number;
|
|
414
|
+
examples: number[];
|
|
415
|
+
} & {
|
|
416
|
+
type: "number";
|
|
417
|
+
validator: (value: string) => number;
|
|
418
|
+
} & {
|
|
419
|
+
key: "FETCH_HEADERS_TIMEOUT";
|
|
420
|
+
};
|
|
421
|
+
FETCH_BODY_TIMEOUT: {
|
|
422
|
+
description: string;
|
|
423
|
+
default: number;
|
|
424
|
+
examples: number[];
|
|
425
|
+
} & {
|
|
426
|
+
type: "number";
|
|
427
|
+
validator: (value: string) => number;
|
|
428
|
+
} & {
|
|
429
|
+
key: "FETCH_BODY_TIMEOUT";
|
|
430
|
+
};
|
|
388
431
|
SPFN_API_URL: {
|
|
389
432
|
description: string;
|
|
390
433
|
required: boolean;
|
|
434
|
+
nextjs: boolean;
|
|
391
435
|
examples: string[];
|
|
392
436
|
} & {
|
|
393
437
|
type: "url";
|
|
394
438
|
} & {
|
|
395
439
|
key: "SPFN_API_URL";
|
|
396
440
|
};
|
|
441
|
+
NEXT_PUBLIC_SPFN_API_URL: {
|
|
442
|
+
description: string;
|
|
443
|
+
required: boolean;
|
|
444
|
+
nextjs: boolean;
|
|
445
|
+
examples: string[];
|
|
446
|
+
} & {
|
|
447
|
+
type: "url";
|
|
448
|
+
} & {
|
|
449
|
+
key: "NEXT_PUBLIC_SPFN_API_URL";
|
|
450
|
+
};
|
|
397
451
|
SPFN_APP_URL: {
|
|
398
452
|
description: string;
|
|
399
453
|
required: boolean;
|
|
454
|
+
nextjs: boolean;
|
|
400
455
|
examples: string[];
|
|
401
456
|
} & {
|
|
402
457
|
type: "url";
|
|
403
458
|
} & {
|
|
404
459
|
key: "SPFN_APP_URL";
|
|
405
460
|
};
|
|
461
|
+
RPC_PROXY_TIMEOUT: {
|
|
462
|
+
description: string;
|
|
463
|
+
default: number;
|
|
464
|
+
nextjs: boolean;
|
|
465
|
+
examples: number[];
|
|
466
|
+
} & {
|
|
467
|
+
type: "number";
|
|
468
|
+
validator: (value: string) => number;
|
|
469
|
+
} & {
|
|
470
|
+
key: "RPC_PROXY_TIMEOUT";
|
|
471
|
+
};
|
|
406
472
|
};
|
|
407
473
|
|
|
408
474
|
/**
|
|
@@ -415,9 +481,9 @@ declare const coreEnvSchema: {
|
|
|
415
481
|
* ```
|
|
416
482
|
*/
|
|
417
483
|
declare const registry: _spfn_core_env.EnvRegistry<{
|
|
418
|
-
NODE_ENV: Omit<_spfn_core_env.EnvVarSchema<"production" | "local" | "development" | "test">, "key" | "type" | "validator"> & {
|
|
484
|
+
NODE_ENV: Omit<_spfn_core_env.EnvVarSchema<"production" | "local" | "development" | "staging" | "test">, "key" | "type" | "validator"> & {
|
|
419
485
|
type: "enum";
|
|
420
|
-
validator: (val: string) => "production" | "local" | "development" | "test";
|
|
486
|
+
validator: (val: string) => "production" | "local" | "development" | "staging" | "test";
|
|
421
487
|
} & {
|
|
422
488
|
key: "NODE_ENV";
|
|
423
489
|
};
|
|
@@ -429,6 +495,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
429
495
|
examples: string[];
|
|
430
496
|
} & {
|
|
431
497
|
type: "string";
|
|
498
|
+
validator: (value: string) => string;
|
|
432
499
|
} & {
|
|
433
500
|
key: "DATABASE_URL";
|
|
434
501
|
};
|
|
@@ -440,6 +507,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
440
507
|
examples: string[];
|
|
441
508
|
} & {
|
|
442
509
|
type: "string";
|
|
510
|
+
validator: (value: string) => string;
|
|
443
511
|
} & {
|
|
444
512
|
key: "DATABASE_WRITE_URL";
|
|
445
513
|
};
|
|
@@ -451,6 +519,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
451
519
|
examples: string[];
|
|
452
520
|
} & {
|
|
453
521
|
type: "string";
|
|
522
|
+
validator: (value: string) => string;
|
|
454
523
|
} & {
|
|
455
524
|
key: "DATABASE_READ_URL";
|
|
456
525
|
};
|
|
@@ -621,6 +690,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
621
690
|
examples: string[];
|
|
622
691
|
} & {
|
|
623
692
|
type: "string";
|
|
693
|
+
validator: (value: string) => string;
|
|
624
694
|
} & {
|
|
625
695
|
key: "DRIZZLE_SCHEMA_PATH";
|
|
626
696
|
};
|
|
@@ -631,6 +701,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
631
701
|
examples: string[];
|
|
632
702
|
} & {
|
|
633
703
|
type: "string";
|
|
704
|
+
validator: (value: string) => string;
|
|
634
705
|
} & {
|
|
635
706
|
key: "DRIZZLE_OUT_DIR";
|
|
636
707
|
};
|
|
@@ -648,6 +719,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
648
719
|
examples: string[];
|
|
649
720
|
} & {
|
|
650
721
|
type: "string";
|
|
722
|
+
validator: (value: string) => string;
|
|
651
723
|
} & {
|
|
652
724
|
key: "CACHE_URL";
|
|
653
725
|
};
|
|
@@ -659,6 +731,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
659
731
|
examples: string[];
|
|
660
732
|
} & {
|
|
661
733
|
type: "string";
|
|
734
|
+
validator: (value: string) => string;
|
|
662
735
|
} & {
|
|
663
736
|
key: "CACHE_WRITE_URL";
|
|
664
737
|
};
|
|
@@ -670,6 +743,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
670
743
|
examples: string[];
|
|
671
744
|
} & {
|
|
672
745
|
type: "string";
|
|
746
|
+
validator: (value: string) => string;
|
|
673
747
|
} & {
|
|
674
748
|
key: "CACHE_READ_URL";
|
|
675
749
|
};
|
|
@@ -679,6 +753,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
679
753
|
examples: string[];
|
|
680
754
|
} & {
|
|
681
755
|
type: "string";
|
|
756
|
+
validator: (value: string) => string;
|
|
682
757
|
} & {
|
|
683
758
|
key: "CACHE_SENTINEL_HOSTS";
|
|
684
759
|
};
|
|
@@ -688,6 +763,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
688
763
|
examples: string[];
|
|
689
764
|
} & {
|
|
690
765
|
type: "string";
|
|
766
|
+
validator: (value: string) => string;
|
|
691
767
|
} & {
|
|
692
768
|
key: "CACHE_CLUSTER_NODES";
|
|
693
769
|
};
|
|
@@ -697,6 +773,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
697
773
|
examples: string[];
|
|
698
774
|
} & {
|
|
699
775
|
type: "string";
|
|
776
|
+
validator: (value: string) => string;
|
|
700
777
|
} & {
|
|
701
778
|
key: "CACHE_MASTER_NAME";
|
|
702
779
|
};
|
|
@@ -707,6 +784,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
707
784
|
examples: string[];
|
|
708
785
|
} & {
|
|
709
786
|
type: "string";
|
|
787
|
+
validator: (value: string) => string;
|
|
710
788
|
} & {
|
|
711
789
|
key: "CACHE_PASSWORD";
|
|
712
790
|
};
|
|
@@ -737,6 +815,7 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
737
815
|
examples: string[];
|
|
738
816
|
} & {
|
|
739
817
|
type: "string";
|
|
818
|
+
validator: (value: string) => string;
|
|
740
819
|
} & {
|
|
741
820
|
key: "HOST";
|
|
742
821
|
};
|
|
@@ -780,32 +859,85 @@ declare const registry: _spfn_core_env.EnvRegistry<{
|
|
|
780
859
|
} & {
|
|
781
860
|
key: "SHUTDOWN_TIMEOUT";
|
|
782
861
|
};
|
|
862
|
+
FETCH_CONNECT_TIMEOUT: {
|
|
863
|
+
description: string;
|
|
864
|
+
default: number;
|
|
865
|
+
examples: number[];
|
|
866
|
+
} & {
|
|
867
|
+
type: "number";
|
|
868
|
+
validator: (value: string) => number;
|
|
869
|
+
} & {
|
|
870
|
+
key: "FETCH_CONNECT_TIMEOUT";
|
|
871
|
+
};
|
|
872
|
+
FETCH_HEADERS_TIMEOUT: {
|
|
873
|
+
description: string;
|
|
874
|
+
default: number;
|
|
875
|
+
examples: number[];
|
|
876
|
+
} & {
|
|
877
|
+
type: "number";
|
|
878
|
+
validator: (value: string) => number;
|
|
879
|
+
} & {
|
|
880
|
+
key: "FETCH_HEADERS_TIMEOUT";
|
|
881
|
+
};
|
|
882
|
+
FETCH_BODY_TIMEOUT: {
|
|
883
|
+
description: string;
|
|
884
|
+
default: number;
|
|
885
|
+
examples: number[];
|
|
886
|
+
} & {
|
|
887
|
+
type: "number";
|
|
888
|
+
validator: (value: string) => number;
|
|
889
|
+
} & {
|
|
890
|
+
key: "FETCH_BODY_TIMEOUT";
|
|
891
|
+
};
|
|
783
892
|
SPFN_API_URL: {
|
|
784
893
|
description: string;
|
|
785
894
|
required: boolean;
|
|
895
|
+
nextjs: boolean;
|
|
786
896
|
examples: string[];
|
|
787
897
|
} & {
|
|
788
898
|
type: "url";
|
|
789
899
|
} & {
|
|
790
900
|
key: "SPFN_API_URL";
|
|
791
901
|
};
|
|
902
|
+
NEXT_PUBLIC_SPFN_API_URL: {
|
|
903
|
+
description: string;
|
|
904
|
+
required: boolean;
|
|
905
|
+
nextjs: boolean;
|
|
906
|
+
examples: string[];
|
|
907
|
+
} & {
|
|
908
|
+
type: "url";
|
|
909
|
+
} & {
|
|
910
|
+
key: "NEXT_PUBLIC_SPFN_API_URL";
|
|
911
|
+
};
|
|
792
912
|
SPFN_APP_URL: {
|
|
793
913
|
description: string;
|
|
794
914
|
required: boolean;
|
|
915
|
+
nextjs: boolean;
|
|
795
916
|
examples: string[];
|
|
796
917
|
} & {
|
|
797
918
|
type: "url";
|
|
798
919
|
} & {
|
|
799
920
|
key: "SPFN_APP_URL";
|
|
800
921
|
};
|
|
922
|
+
RPC_PROXY_TIMEOUT: {
|
|
923
|
+
description: string;
|
|
924
|
+
default: number;
|
|
925
|
+
nextjs: boolean;
|
|
926
|
+
examples: number[];
|
|
927
|
+
} & {
|
|
928
|
+
type: "number";
|
|
929
|
+
validator: (value: string) => number;
|
|
930
|
+
} & {
|
|
931
|
+
key: "RPC_PROXY_TIMEOUT";
|
|
932
|
+
};
|
|
801
933
|
}>;
|
|
802
934
|
/**
|
|
803
935
|
* Validated environment configuration
|
|
804
936
|
*/
|
|
805
937
|
declare const env: _spfn_core_env.InferEnvType<{
|
|
806
|
-
NODE_ENV: Omit<_spfn_core_env.EnvVarSchema<"production" | "local" | "development" | "test">, "key" | "type" | "validator"> & {
|
|
938
|
+
NODE_ENV: Omit<_spfn_core_env.EnvVarSchema<"production" | "local" | "development" | "staging" | "test">, "key" | "type" | "validator"> & {
|
|
807
939
|
type: "enum";
|
|
808
|
-
validator: (val: string) => "production" | "local" | "development" | "test";
|
|
940
|
+
validator: (val: string) => "production" | "local" | "development" | "staging" | "test";
|
|
809
941
|
} & {
|
|
810
942
|
key: "NODE_ENV";
|
|
811
943
|
};
|
|
@@ -817,6 +949,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
817
949
|
examples: string[];
|
|
818
950
|
} & {
|
|
819
951
|
type: "string";
|
|
952
|
+
validator: (value: string) => string;
|
|
820
953
|
} & {
|
|
821
954
|
key: "DATABASE_URL";
|
|
822
955
|
};
|
|
@@ -828,6 +961,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
828
961
|
examples: string[];
|
|
829
962
|
} & {
|
|
830
963
|
type: "string";
|
|
964
|
+
validator: (value: string) => string;
|
|
831
965
|
} & {
|
|
832
966
|
key: "DATABASE_WRITE_URL";
|
|
833
967
|
};
|
|
@@ -839,6 +973,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
839
973
|
examples: string[];
|
|
840
974
|
} & {
|
|
841
975
|
type: "string";
|
|
976
|
+
validator: (value: string) => string;
|
|
842
977
|
} & {
|
|
843
978
|
key: "DATABASE_READ_URL";
|
|
844
979
|
};
|
|
@@ -1009,6 +1144,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1009
1144
|
examples: string[];
|
|
1010
1145
|
} & {
|
|
1011
1146
|
type: "string";
|
|
1147
|
+
validator: (value: string) => string;
|
|
1012
1148
|
} & {
|
|
1013
1149
|
key: "DRIZZLE_SCHEMA_PATH";
|
|
1014
1150
|
};
|
|
@@ -1019,6 +1155,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1019
1155
|
examples: string[];
|
|
1020
1156
|
} & {
|
|
1021
1157
|
type: "string";
|
|
1158
|
+
validator: (value: string) => string;
|
|
1022
1159
|
} & {
|
|
1023
1160
|
key: "DRIZZLE_OUT_DIR";
|
|
1024
1161
|
};
|
|
@@ -1036,6 +1173,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1036
1173
|
examples: string[];
|
|
1037
1174
|
} & {
|
|
1038
1175
|
type: "string";
|
|
1176
|
+
validator: (value: string) => string;
|
|
1039
1177
|
} & {
|
|
1040
1178
|
key: "CACHE_URL";
|
|
1041
1179
|
};
|
|
@@ -1047,6 +1185,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1047
1185
|
examples: string[];
|
|
1048
1186
|
} & {
|
|
1049
1187
|
type: "string";
|
|
1188
|
+
validator: (value: string) => string;
|
|
1050
1189
|
} & {
|
|
1051
1190
|
key: "CACHE_WRITE_URL";
|
|
1052
1191
|
};
|
|
@@ -1058,6 +1197,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1058
1197
|
examples: string[];
|
|
1059
1198
|
} & {
|
|
1060
1199
|
type: "string";
|
|
1200
|
+
validator: (value: string) => string;
|
|
1061
1201
|
} & {
|
|
1062
1202
|
key: "CACHE_READ_URL";
|
|
1063
1203
|
};
|
|
@@ -1067,6 +1207,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1067
1207
|
examples: string[];
|
|
1068
1208
|
} & {
|
|
1069
1209
|
type: "string";
|
|
1210
|
+
validator: (value: string) => string;
|
|
1070
1211
|
} & {
|
|
1071
1212
|
key: "CACHE_SENTINEL_HOSTS";
|
|
1072
1213
|
};
|
|
@@ -1076,6 +1217,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1076
1217
|
examples: string[];
|
|
1077
1218
|
} & {
|
|
1078
1219
|
type: "string";
|
|
1220
|
+
validator: (value: string) => string;
|
|
1079
1221
|
} & {
|
|
1080
1222
|
key: "CACHE_CLUSTER_NODES";
|
|
1081
1223
|
};
|
|
@@ -1085,6 +1227,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1085
1227
|
examples: string[];
|
|
1086
1228
|
} & {
|
|
1087
1229
|
type: "string";
|
|
1230
|
+
validator: (value: string) => string;
|
|
1088
1231
|
} & {
|
|
1089
1232
|
key: "CACHE_MASTER_NAME";
|
|
1090
1233
|
};
|
|
@@ -1095,6 +1238,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1095
1238
|
examples: string[];
|
|
1096
1239
|
} & {
|
|
1097
1240
|
type: "string";
|
|
1241
|
+
validator: (value: string) => string;
|
|
1098
1242
|
} & {
|
|
1099
1243
|
key: "CACHE_PASSWORD";
|
|
1100
1244
|
};
|
|
@@ -1125,6 +1269,7 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1125
1269
|
examples: string[];
|
|
1126
1270
|
} & {
|
|
1127
1271
|
type: "string";
|
|
1272
|
+
validator: (value: string) => string;
|
|
1128
1273
|
} & {
|
|
1129
1274
|
key: "HOST";
|
|
1130
1275
|
};
|
|
@@ -1168,24 +1313,77 @@ declare const env: _spfn_core_env.InferEnvType<{
|
|
|
1168
1313
|
} & {
|
|
1169
1314
|
key: "SHUTDOWN_TIMEOUT";
|
|
1170
1315
|
};
|
|
1316
|
+
FETCH_CONNECT_TIMEOUT: {
|
|
1317
|
+
description: string;
|
|
1318
|
+
default: number;
|
|
1319
|
+
examples: number[];
|
|
1320
|
+
} & {
|
|
1321
|
+
type: "number";
|
|
1322
|
+
validator: (value: string) => number;
|
|
1323
|
+
} & {
|
|
1324
|
+
key: "FETCH_CONNECT_TIMEOUT";
|
|
1325
|
+
};
|
|
1326
|
+
FETCH_HEADERS_TIMEOUT: {
|
|
1327
|
+
description: string;
|
|
1328
|
+
default: number;
|
|
1329
|
+
examples: number[];
|
|
1330
|
+
} & {
|
|
1331
|
+
type: "number";
|
|
1332
|
+
validator: (value: string) => number;
|
|
1333
|
+
} & {
|
|
1334
|
+
key: "FETCH_HEADERS_TIMEOUT";
|
|
1335
|
+
};
|
|
1336
|
+
FETCH_BODY_TIMEOUT: {
|
|
1337
|
+
description: string;
|
|
1338
|
+
default: number;
|
|
1339
|
+
examples: number[];
|
|
1340
|
+
} & {
|
|
1341
|
+
type: "number";
|
|
1342
|
+
validator: (value: string) => number;
|
|
1343
|
+
} & {
|
|
1344
|
+
key: "FETCH_BODY_TIMEOUT";
|
|
1345
|
+
};
|
|
1171
1346
|
SPFN_API_URL: {
|
|
1172
1347
|
description: string;
|
|
1173
1348
|
required: boolean;
|
|
1349
|
+
nextjs: boolean;
|
|
1174
1350
|
examples: string[];
|
|
1175
1351
|
} & {
|
|
1176
1352
|
type: "url";
|
|
1177
1353
|
} & {
|
|
1178
1354
|
key: "SPFN_API_URL";
|
|
1179
1355
|
};
|
|
1356
|
+
NEXT_PUBLIC_SPFN_API_URL: {
|
|
1357
|
+
description: string;
|
|
1358
|
+
required: boolean;
|
|
1359
|
+
nextjs: boolean;
|
|
1360
|
+
examples: string[];
|
|
1361
|
+
} & {
|
|
1362
|
+
type: "url";
|
|
1363
|
+
} & {
|
|
1364
|
+
key: "NEXT_PUBLIC_SPFN_API_URL";
|
|
1365
|
+
};
|
|
1180
1366
|
SPFN_APP_URL: {
|
|
1181
1367
|
description: string;
|
|
1182
1368
|
required: boolean;
|
|
1369
|
+
nextjs: boolean;
|
|
1183
1370
|
examples: string[];
|
|
1184
1371
|
} & {
|
|
1185
1372
|
type: "url";
|
|
1186
1373
|
} & {
|
|
1187
1374
|
key: "SPFN_APP_URL";
|
|
1188
1375
|
};
|
|
1376
|
+
RPC_PROXY_TIMEOUT: {
|
|
1377
|
+
description: string;
|
|
1378
|
+
default: number;
|
|
1379
|
+
nextjs: boolean;
|
|
1380
|
+
examples: number[];
|
|
1381
|
+
} & {
|
|
1382
|
+
type: "number";
|
|
1383
|
+
validator: (value: string) => number;
|
|
1384
|
+
} & {
|
|
1385
|
+
key: "RPC_PROXY_TIMEOUT";
|
|
1386
|
+
};
|
|
1189
1387
|
}>;
|
|
1190
1388
|
|
|
1191
1389
|
export { env, coreEnvSchema as envSchema, registry };
|
package/dist/config/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defineEnvSchema,
|
|
1
|
+
import { defineEnvSchema, envNumber, envUrl, envString, envBoolean, envEnum, parseRedisUrl, parsePostgresUrl, createEnvRegistry } from '@spfn/core/env';
|
|
2
2
|
|
|
3
3
|
// src/config/index.ts
|
|
4
4
|
var coreEnvSchema = defineEnvSchema({
|
|
5
5
|
// ========================================================================
|
|
6
6
|
// Core Environment
|
|
7
7
|
// ========================================================================
|
|
8
|
-
NODE_ENV: envEnum(["local", "development", "production", "test"], {
|
|
8
|
+
NODE_ENV: envEnum(["local", "development", "staging", "production", "test"], {
|
|
9
9
|
description: "Node.js runtime environment",
|
|
10
|
-
default: "local"
|
|
10
|
+
default: "local",
|
|
11
|
+
nextjs: true
|
|
11
12
|
}),
|
|
12
13
|
// ========================================================================
|
|
13
14
|
// Database - Connection
|
|
@@ -236,22 +237,54 @@ var coreEnvSchema = defineEnvSchema({
|
|
|
236
237
|
examples: [3e4, 6e4, 12e4]
|
|
237
238
|
}),
|
|
238
239
|
SHUTDOWN_TIMEOUT: envNumber({
|
|
239
|
-
description: "Graceful shutdown timeout in milliseconds",
|
|
240
|
-
default:
|
|
241
|
-
examples: [
|
|
240
|
+
description: "Graceful shutdown timeout in milliseconds (must be less than k8s terminationGracePeriodSeconds minus preStop sleep, with safety margin)",
|
|
241
|
+
default: 28e4,
|
|
242
|
+
examples: [3e4, 12e4, 28e4]
|
|
242
243
|
}),
|
|
243
244
|
// ========================================================================
|
|
244
|
-
//
|
|
245
|
+
// Fetch (Node.js undici) - outbound HTTP request timeout
|
|
246
|
+
// ========================================================================
|
|
247
|
+
FETCH_CONNECT_TIMEOUT: envNumber({
|
|
248
|
+
description: "Fetch TCP connection timeout in milliseconds (time to establish socket connection to upstream server)",
|
|
249
|
+
default: 1e4,
|
|
250
|
+
examples: [5e3, 1e4, 3e4]
|
|
251
|
+
}),
|
|
252
|
+
FETCH_HEADERS_TIMEOUT: envNumber({
|
|
253
|
+
description: "Fetch headers timeout in milliseconds (time to receive response headers after request sent)",
|
|
254
|
+
default: 3e5,
|
|
255
|
+
examples: [12e4, 3e5, 6e5]
|
|
256
|
+
}),
|
|
257
|
+
FETCH_BODY_TIMEOUT: envNumber({
|
|
258
|
+
description: "Fetch body timeout in milliseconds (time between body data chunks from upstream server)",
|
|
259
|
+
default: 3e5,
|
|
260
|
+
examples: [12e4, 3e5, 6e5]
|
|
261
|
+
}),
|
|
262
|
+
// ========================================================================
|
|
263
|
+
// Next.js Integration
|
|
245
264
|
// ========================================================================
|
|
246
265
|
SPFN_API_URL: envUrl({
|
|
247
|
-
description: "
|
|
266
|
+
description: "SPFN API URL (used by Next.js to call backend)",
|
|
267
|
+
required: true,
|
|
268
|
+
nextjs: true,
|
|
269
|
+
examples: ["http://localhost:8790", "https://api.your-app.com"]
|
|
270
|
+
}),
|
|
271
|
+
NEXT_PUBLIC_SPFN_API_URL: envUrl({
|
|
272
|
+
description: "SPFN API URL (used by Next.js to call backend)",
|
|
248
273
|
required: true,
|
|
249
|
-
|
|
274
|
+
nextjs: true,
|
|
275
|
+
examples: ["http://localhost:8790", "https://api.your-app.com"]
|
|
250
276
|
}),
|
|
251
277
|
SPFN_APP_URL: envUrl({
|
|
252
|
-
description: "Next.js application URL (
|
|
278
|
+
description: "Next.js application URL (used by SPFN server)",
|
|
253
279
|
required: false,
|
|
254
|
-
|
|
280
|
+
nextjs: true,
|
|
281
|
+
examples: ["http://localhost:3790", "https://your-app.com"]
|
|
282
|
+
}),
|
|
283
|
+
RPC_PROXY_TIMEOUT: envNumber({
|
|
284
|
+
description: "RPC proxy request timeout in milliseconds (AbortController timeout for proxied requests to backend, should be shorter than FETCH_HEADERS_TIMEOUT)",
|
|
285
|
+
default: 12e4,
|
|
286
|
+
nextjs: true,
|
|
287
|
+
examples: [6e4, 12e4, 28e4]
|
|
255
288
|
})
|
|
256
289
|
});
|
|
257
290
|
|