zerotal 1.8.1 → 1.10.0
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/api-surface.md +375 -868
- package/package.json +14 -12
- package/src/runtime.ts +1 -0
- package/src/shared.ts +1 -0
package/api-surface.md
CHANGED
|
@@ -394,6 +394,7 @@ class LimiterDefinition = {
|
|
|
394
394
|
register: () => LimiterDefinition
|
|
395
395
|
toMiddleware: () => ThrottleMiddleware
|
|
396
396
|
toMiddlewareClass: () => new () => ThrottleMiddleware
|
|
397
|
+
trustedProxies: (count: number) => LimiterDefinition
|
|
397
398
|
}
|
|
398
399
|
|
|
399
400
|
class MarkdownBuilder = {
|
|
@@ -512,20 +513,6 @@ class ResponseBuilder = {
|
|
|
512
513
|
withWarning: (message: string) => ResponseBuilder
|
|
513
514
|
}
|
|
514
515
|
|
|
515
|
-
class RouterState = {
|
|
516
|
-
new (): RouterState
|
|
517
|
-
domain: string | undefined
|
|
518
|
-
groupMiddleware: MiddlewareClass[]
|
|
519
|
-
implicitModelResolver: ((paramName: string) => ModelBindingResolver | undefined) | null
|
|
520
|
-
markdownDirs: MarkdownDir[]
|
|
521
|
-
middlewareGroups: Map<string, MiddlewareClass[]>
|
|
522
|
-
namedRoutes: Map<string, string>
|
|
523
|
-
prefix: string
|
|
524
|
-
rawRoutes: Map<string, (req: Request) => Response | Promise<Response>>
|
|
525
|
-
routes: Map<string, RouteDefinition>
|
|
526
|
-
staticDirs: StaticDir[]
|
|
527
|
-
}
|
|
528
|
-
|
|
529
516
|
class ScopedResolver = {
|
|
530
517
|
new (_container?: Container | undefined): ScopedResolver
|
|
531
518
|
acquire: () => void
|
|
@@ -576,13 +563,6 @@ class ServiceUnavailableError = {
|
|
|
576
563
|
readonly status: number
|
|
577
564
|
}
|
|
578
565
|
|
|
579
|
-
class TerminalWriter = {
|
|
580
|
-
new (): TerminalWriter
|
|
581
|
-
write: (message: string) => void
|
|
582
|
-
writeError: (message: string) => void
|
|
583
|
-
writeLine: (message: string) => void
|
|
584
|
-
}
|
|
585
|
-
|
|
586
566
|
class ThrottleMiddleware = {
|
|
587
567
|
new (options?: Partial<ThrottleOptions>): ThrottleMiddleware
|
|
588
568
|
static with: <T extends new (...args: any[]) => BaseMiddleware<any>, Opts = T extends new (...args: any[]) => BaseMiddleware<infer U> ? U : object>(this: T, options: DeepPartial<NoInfer<Opts>>) => new () => InstanceType<T>
|
|
@@ -648,8 +628,6 @@ const App = { readonly container: Container; readonly instance: () => Appl
|
|
|
648
628
|
|
|
649
629
|
const Artisan = { call(commandName: string, parameters?: Record<string, string | boolean | number>): Promise<ArtisanResult>;}
|
|
650
630
|
|
|
651
|
-
const builtinDoctorChecks = DoctorCheck[]
|
|
652
|
-
|
|
653
631
|
const Config = ConfigManager
|
|
654
632
|
|
|
655
633
|
const Events = Emitter
|
|
@@ -668,8 +646,6 @@ function app = { (): Application; <T>(token: BindingToken<T>): Promise<T>;
|
|
|
668
646
|
|
|
669
647
|
function basePath = (...segments: string[]) => string
|
|
670
648
|
|
|
671
|
-
function buildCookie = (options: CookieOptions) => string
|
|
672
|
-
|
|
673
649
|
function camelCase = (value: string) => string
|
|
674
650
|
|
|
675
651
|
function collect = <T>(items: T[]) => Collection<T>
|
|
@@ -708,10 +684,6 @@ function make = <T>(token: BindingToken<T>) => Promise<T>
|
|
|
708
684
|
|
|
709
685
|
function markdown = (content: string, options?: BunMarkdownOptions & { title?: string;}, status?: number) => MarkdownBuilder
|
|
710
686
|
|
|
711
|
-
function pageElements = (current: number, last: number, each?: number) => (number | '...')[]
|
|
712
|
-
|
|
713
|
-
function parseCookieHeader = (header: string, name: string) => string | undefined
|
|
714
|
-
|
|
715
687
|
function pipe = <T, R>(value: T, fn: (val: T) => R) => R
|
|
716
688
|
|
|
717
689
|
function pipeAsync = <T, R>(value: T, fn: (val: T) => Promise<R>) => Promise<R>
|
|
@@ -726,8 +698,6 @@ function redirectTo = <N extends RouteTarget>(name: N, params?: RouteParamsArg<N
|
|
|
726
698
|
|
|
727
699
|
function registerErrorDiagnoser = (diagnoser: ErrorDiagnoser) => void
|
|
728
700
|
|
|
729
|
-
function registerFileRouteResolver = (resolver: FileRouteResolver) => void
|
|
730
|
-
|
|
731
701
|
function request = { (): HttpContext; <T = string>(key: string, fallback?: T): T | undefined;}
|
|
732
702
|
|
|
733
703
|
function requireEnv = (key: string) => string
|
|
@@ -740,14 +710,8 @@ function runDoctor = (app: Application, extraChecks?: DoctorCheck[]) => Promise<
|
|
|
740
710
|
|
|
741
711
|
function safeEqual = (a: string, b: string) => boolean
|
|
742
712
|
|
|
743
|
-
function safeRedirectPath = (url: string | null | undefined, origin: string) => string | undefined
|
|
744
|
-
|
|
745
|
-
function scanFileRoutes = (baseDir: string, reloadId?: string) => Promise<number>
|
|
746
|
-
|
|
747
713
|
function setAppEnv = (command?: string) => void
|
|
748
714
|
|
|
749
|
-
function setCurrentPageResolver = (resolver: CurrentPageResolver) => void
|
|
750
|
-
|
|
751
715
|
function sha256Hex = (input: string | Uint8Array) => string
|
|
752
716
|
|
|
753
717
|
function singularize = (value: string) => string
|
|
@@ -762,12 +726,8 @@ function tap = <T>(value: T, callback: (val: T) => void) => T
|
|
|
762
726
|
|
|
763
727
|
function tapAsync = <T>(value: T, callback: (val: T) => Promise<void>) => Promise<T>
|
|
764
728
|
|
|
765
|
-
function tryCurrentApp = () => Application | undefined
|
|
766
|
-
|
|
767
729
|
function view = { (markup: string | { toString(): string; }, status?: number): void; <P extends Record<string, unknown> = Record<string, never>>(component: (ctx: HttpContext, props: P) => ViewMarkup | Promise<ViewMarkup>, props?: P, status?: number): void | Promise<void>;}
|
|
768
730
|
|
|
769
|
-
function withApp = <T>(app: Application, fn: () => T) => T
|
|
770
|
-
|
|
771
731
|
function withHeaders = (res: Response, headers: Record<string, string>) => Response
|
|
772
732
|
|
|
773
733
|
interface ArtisanResult = {
|
|
@@ -777,18 +737,6 @@ interface ArtisanResult = {
|
|
|
777
737
|
|
|
778
738
|
interface AuthenticatedUser = {}
|
|
779
739
|
|
|
780
|
-
interface CompiledDomain = {
|
|
781
|
-
params: string[]
|
|
782
|
-
regex: RegExp
|
|
783
|
-
source: string
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
interface ConcernContext = {
|
|
787
|
-
app: Application
|
|
788
|
-
env: AppEnvironment
|
|
789
|
-
resolve: <T = unknown>(token: string) => T | undefined
|
|
790
|
-
}
|
|
791
|
-
|
|
792
740
|
interface ConcernDescriptor = {
|
|
793
741
|
dir?: string
|
|
794
742
|
envs?: AppEnvironment[]
|
|
@@ -860,31 +808,24 @@ interface ContainerBindings = {
|
|
|
860
808
|
two_factor: TwoFactorService
|
|
861
809
|
}
|
|
862
810
|
|
|
863
|
-
interface ContextRegistry = {}
|
|
864
|
-
|
|
865
811
|
interface CookieOptions = {
|
|
866
|
-
domain?: string
|
|
867
|
-
httpOnly?: boolean
|
|
868
|
-
maxAge?: number
|
|
812
|
+
domain?: string | undefined
|
|
813
|
+
httpOnly?: boolean | undefined
|
|
814
|
+
maxAge?: number | undefined
|
|
869
815
|
name: string
|
|
870
|
-
path?: string
|
|
871
|
-
sameSite?: SameSite
|
|
872
|
-
secure?: boolean
|
|
816
|
+
path?: string | undefined
|
|
817
|
+
sameSite?: SameSite | undefined
|
|
818
|
+
secure?: boolean | undefined
|
|
873
819
|
value: string
|
|
874
820
|
}
|
|
875
821
|
|
|
876
822
|
interface CorsOptions = {
|
|
877
|
-
allowedHeaders?: string[]
|
|
878
|
-
credentials?: boolean
|
|
879
|
-
exposedHeaders?: string[]
|
|
880
|
-
maxAge?: number
|
|
881
|
-
methods?: string[]
|
|
882
|
-
origin?: string | string[] | ((origin: string) => boolean)
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
interface DevConfigShape = {
|
|
886
|
-
disable?: string[]
|
|
887
|
-
processes?: DevProcessDefinition[]
|
|
823
|
+
allowedHeaders?: string[] | undefined
|
|
824
|
+
credentials?: boolean | undefined
|
|
825
|
+
exposedHeaders?: string[] | undefined
|
|
826
|
+
maxAge?: number | undefined
|
|
827
|
+
methods?: string[] | undefined
|
|
828
|
+
origin?: string | string[] | ((origin: string) => boolean) | undefined
|
|
888
829
|
}
|
|
889
830
|
|
|
890
831
|
interface DevProcessDefinition = {
|
|
@@ -929,28 +870,10 @@ interface ErrorDiagnosis = {
|
|
|
929
870
|
title: string
|
|
930
871
|
}
|
|
931
872
|
|
|
932
|
-
interface FileRouteContext = {
|
|
933
|
-
filePath: string
|
|
934
|
-
isIndex: boolean
|
|
935
|
-
layout?: ViewComponent | undefined
|
|
936
|
-
middleware: MiddlewareClass[]
|
|
937
|
-
module: Record<string, unknown>
|
|
938
|
-
name: string
|
|
939
|
-
urlPath: string
|
|
940
|
-
}
|
|
941
|
-
|
|
942
873
|
interface GroupOptions = {
|
|
943
|
-
domain?: string
|
|
944
|
-
middleware?: string | string[] | MiddlewareClass | MiddlewareClass[]
|
|
945
|
-
prefix?: string
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
interface HasResponse = {
|
|
949
|
-
response: Response | undefined
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
interface MiddlewareModule = {
|
|
953
|
-
middleware: MiddlewareClass[]
|
|
874
|
+
domain?: string | undefined
|
|
875
|
+
middleware?: string | string[] | MiddlewareClass | MiddlewareClass[] | undefined
|
|
876
|
+
prefix?: string | undefined
|
|
954
877
|
}
|
|
955
878
|
|
|
956
879
|
interface ModelClass = {
|
|
@@ -973,28 +896,6 @@ interface ProviderReport = {
|
|
|
973
896
|
name: string
|
|
974
897
|
}
|
|
975
898
|
|
|
976
|
-
interface QueuedListener = {
|
|
977
|
-
handle: (event: T) => Promise<void> | void
|
|
978
|
-
maxAttempts?: number
|
|
979
|
-
queue: string | boolean
|
|
980
|
-
retryDelay?: number
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
interface RequestIPProvider = {
|
|
984
|
-
requestIP: (req: Request) => { address: string; family: string; port: number;} | null
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
interface ResolvedDevProcess = {
|
|
988
|
-
after: 'server' | 'none'
|
|
989
|
-
argv?: string[]
|
|
990
|
-
color: DevProcessColor
|
|
991
|
-
label: string
|
|
992
|
-
name: string
|
|
993
|
-
registrant: string
|
|
994
|
-
restart: 'always' | 'on-failure' | 'never'
|
|
995
|
-
run?: (signal: AbortSignal) => Promise<void>
|
|
996
|
-
}
|
|
997
|
-
|
|
998
899
|
interface RouteBuilder = {
|
|
999
900
|
<N extends RouteTarget>(name: N, params?: RouteParamValues | undefined, query?: RouteQuery | undefined): string
|
|
1000
901
|
dynamic: (name: string, params?: RouteParamValues, query?: RouteQuery) => string
|
|
@@ -1011,34 +912,6 @@ interface RouteDefinition = {
|
|
|
1011
912
|
path: string
|
|
1012
913
|
}
|
|
1013
914
|
|
|
1014
|
-
interface RouteFileMeta = {
|
|
1015
|
-
DELETE?: { name?: string;}
|
|
1016
|
-
GET?: { name?: string;}
|
|
1017
|
-
PATCH?: { name?: string;}
|
|
1018
|
-
POST?: { name?: string;}
|
|
1019
|
-
PUT?: { name?: string;}
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
interface RouteMethodMiddleware = {
|
|
1023
|
-
ALL?: MiddlewareClass[]
|
|
1024
|
-
DELETE?: MiddlewareClass[]
|
|
1025
|
-
GET?: MiddlewareClass[]
|
|
1026
|
-
PATCH?: MiddlewareClass[]
|
|
1027
|
-
POST?: MiddlewareClass[]
|
|
1028
|
-
PUT?: MiddlewareClass[]
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
interface RouteModule = {
|
|
1032
|
-
DELETE?: FileHandler
|
|
1033
|
-
GET?: FileHandler
|
|
1034
|
-
PATCH?: FileHandler
|
|
1035
|
-
POST?: FileHandler
|
|
1036
|
-
PUT?: FileHandler
|
|
1037
|
-
default?: ViewComponent | FileHandler
|
|
1038
|
-
layout?: ViewComponent | null
|
|
1039
|
-
middleware?: RouteMiddleware
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
915
|
interface RouteRegistration = {
|
|
1043
916
|
bind: (paramName: string, model: ModelClass | ModelBindingResolver) => RouteRegistration
|
|
1044
917
|
name: (routeName: string) => RouteRegistration
|
|
@@ -1053,25 +926,25 @@ interface RouterMacros = {
|
|
|
1053
926
|
}
|
|
1054
927
|
|
|
1055
928
|
interface SecureHeadersOptions = {
|
|
1056
|
-
contentSecurityPolicy?: string
|
|
1057
|
-
frameOptions?: false | 'DENY' | 'SAMEORIGIN'
|
|
1058
|
-
hstsIncludeSubDomains?: boolean
|
|
1059
|
-
hstsMaxAge?: number
|
|
1060
|
-
hstsPreload?: boolean
|
|
1061
|
-
permissionsPolicy?: string | false
|
|
1062
|
-
referrerPolicy?: string
|
|
1063
|
-
secure?: boolean
|
|
929
|
+
contentSecurityPolicy?: string | undefined
|
|
930
|
+
frameOptions?: false | 'DENY' | 'SAMEORIGIN' | undefined
|
|
931
|
+
hstsIncludeSubDomains?: boolean | undefined
|
|
932
|
+
hstsMaxAge?: number | undefined
|
|
933
|
+
hstsPreload?: boolean | undefined
|
|
934
|
+
permissionsPolicy?: string | false | undefined
|
|
935
|
+
referrerPolicy?: string | undefined
|
|
936
|
+
secure?: boolean | undefined
|
|
1064
937
|
}
|
|
1065
938
|
|
|
1066
939
|
interface StartZerotalOptions = {
|
|
1067
|
-
configDir?: string
|
|
940
|
+
configDir?: string | undefined
|
|
1068
941
|
}
|
|
1069
942
|
|
|
1070
943
|
interface ThrottleOptions = {
|
|
1071
|
-
keyResolver?: (ctx: HttpContext) => string
|
|
944
|
+
keyResolver?: ((ctx: HttpContext) => string) | undefined
|
|
1072
945
|
maxAttempts: number
|
|
1073
|
-
trustedProxies?: number
|
|
1074
|
-
windowSeconds?: number
|
|
946
|
+
trustedProxies?: number | undefined
|
|
947
|
+
windowSeconds?: number | undefined
|
|
1075
948
|
}
|
|
1076
949
|
|
|
1077
950
|
interface ViewRegistration = {
|
|
@@ -1080,14 +953,14 @@ interface ViewRegistration = {
|
|
|
1080
953
|
}
|
|
1081
954
|
|
|
1082
955
|
interface WebhookOptions = {
|
|
1083
|
-
algorithm?: 'sha256' | 'sha1' | 'sha512'
|
|
1084
|
-
format?: 'raw' | 'stripe'
|
|
1085
|
-
header?: string
|
|
1086
|
-
prefix?: string
|
|
956
|
+
algorithm?: 'sha256' | 'sha1' | 'sha512' | undefined
|
|
957
|
+
format?: 'raw' | 'stripe' | undefined
|
|
958
|
+
header?: string | undefined
|
|
959
|
+
prefix?: string | undefined
|
|
1087
960
|
secret: string
|
|
1088
|
-
timestampHeader?: string
|
|
1089
|
-
timestampSeparator?: string
|
|
1090
|
-
tolerance?: number
|
|
961
|
+
timestampHeader?: string | undefined
|
|
962
|
+
timestampSeparator?: string | undefined
|
|
963
|
+
tolerance?: number | undefined
|
|
1091
964
|
}
|
|
1092
965
|
|
|
1093
966
|
interface WebSocketHandlers = {
|
|
@@ -1100,38 +973,20 @@ interface WebSocketHandlers = {
|
|
|
1100
973
|
|
|
1101
974
|
type AppEnvironment = 'web' | 'console' | 'worker' | 'test' | 'repl'
|
|
1102
975
|
|
|
1103
|
-
type AppScopeInstaller = () => () => void
|
|
1104
|
-
|
|
1105
976
|
type ArgDef = { name: string; required?: boolean; default?: string;}
|
|
1106
977
|
|
|
1107
978
|
type BindingToken = ClassToken<T> | AbstractToken<T> | keyof ContainerBindings
|
|
1108
979
|
|
|
1109
|
-
type ContextKey = never
|
|
1110
|
-
|
|
1111
|
-
type ContextValue = ContextRegistry[K]
|
|
1112
|
-
|
|
1113
980
|
type ControllerResponse = void | ResponseBuilder | MarkdownBuilder
|
|
1114
981
|
|
|
1115
|
-
type CurrentPageResolver = (pageName: string) => number | undefined
|
|
1116
|
-
|
|
1117
982
|
type DeepPartial = { [K in keyof T]?: (NonNullable<T[K]> extends _Atomic ? T[K] : NonNullable<T[K]> extends object ? DeepPartial<NonNullable<T[K]>> : T[K]) | undefined; }
|
|
1118
983
|
|
|
1119
|
-
type DevProcessColor = 'cyan' | 'magenta' | 'yellow' | 'green' | 'blue' | 'red'
|
|
1120
|
-
|
|
1121
984
|
type ErrorDiagnoser = (error: Error, ctx?: HttpContext) => ErrorDiagnosis | null | Promise<ErrorDiagnosis | null>
|
|
1122
985
|
|
|
1123
986
|
type Factory = (container: Container) => T | Promise<T>
|
|
1124
987
|
|
|
1125
|
-
type FileHandler = (ctx: HttpContext) => void | Response | Promise<void | Response>
|
|
1126
|
-
|
|
1127
|
-
type FileRouteHandler = (ctx: HttpContext) => void | Response | Promise<void | Response>
|
|
1128
|
-
|
|
1129
|
-
type FileRouteResolver = (ctx: FileRouteContext) => boolean
|
|
1130
|
-
|
|
1131
988
|
type FileRoutingConfig = { [x: string]: FileRoutingEntry;}
|
|
1132
989
|
|
|
1133
|
-
type FileRoutingEntry = string | { dir: string; prefix?: string; middleware?: MiddlewareInput }
|
|
1134
|
-
|
|
1135
990
|
type FlagDef = { name: string; short?: string; type: 'string' | 'boolean' | 'number'; description?: string; default?: unknown;}
|
|
1136
991
|
|
|
1137
992
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
|
|
@@ -1140,12 +995,12 @@ type HttpResponse = Promise<void>
|
|
|
1140
995
|
|
|
1141
996
|
type MiddlewareClass = new (...args: any[]) => Pipe<HttpContext>
|
|
1142
997
|
|
|
1143
|
-
type ModelBindingResolver = (value: string, ctx: HttpContext) => Promise<unknown>
|
|
1144
|
-
|
|
1145
998
|
type NextFn = () => Promise<Response | void>
|
|
1146
999
|
|
|
1147
1000
|
type ParamsOf = P extends `${string}:${infer Name}/${infer Rest}` ? { [K in Name]: RouteParamValue; } & ParamsOf<`/${Rest}`> : P extends `${string}:${infer Name}` ? { [K in Name]: RouteParamValue; } : P extends `${string}*${string}` ? { "*": RouteParamValue | readonly RouteParamValue[];} : Record<never, never>
|
|
1148
1001
|
|
|
1002
|
+
type Resolved = { [K in keyof T]-?: Exclude<T[K], undefined>; }
|
|
1003
|
+
|
|
1149
1004
|
type RouteArgs = [params?: RouteParamValues, query?: RouteQuery]
|
|
1150
1005
|
|
|
1151
1006
|
type RouteMiddleware = MiddlewareClass[] | RouteMethodMiddleware
|
|
@@ -1154,22 +1009,14 @@ type RouteName = never
|
|
|
1154
1009
|
|
|
1155
1010
|
type RouteParams = { [K in keyof ParamsOf<RoutePattern<N>>]: ParamsOf<RoutePattern<N>>[K]; }
|
|
1156
1011
|
|
|
1157
|
-
type RouteParamsArg = { [x: string]: RouteParamValue | readonly RouteParamValue[];}
|
|
1158
|
-
|
|
1159
|
-
type RouteParamValue = string | number
|
|
1160
|
-
|
|
1161
1012
|
type RouteParamValues = { [x: string]: RouteParamValue | readonly RouteParamValue[];}
|
|
1162
1013
|
|
|
1163
|
-
type RoutePattern = N extends never ? RouteRegistry[N] extends string ? RouteRegistry[N] : string : string
|
|
1164
|
-
|
|
1165
1014
|
type RouteQuery = { [x: string]: string | number | boolean | readonly (string | number | boolean)[] | null | undefined;}
|
|
1166
1015
|
|
|
1167
1016
|
type RouteTarget = string
|
|
1168
1017
|
|
|
1169
1018
|
type RoutingConfig = { [x: string]: RoutingEntry;}
|
|
1170
1019
|
|
|
1171
|
-
type RoutingEntry = string | { file: string; prefix?: string; middleware?: MiddlewareInput }
|
|
1172
|
-
|
|
1173
1020
|
type SameSite = 'Strict' | 'Lax' | 'None'
|
|
1174
1021
|
|
|
1175
1022
|
type ViewComponent = (ctx: HttpContext, props: P) => unknown
|
|
@@ -1802,15 +1649,6 @@ class RememberMeMiddleware = {
|
|
|
1802
1649
|
onError?: (ctx: HttpContext, error: Error) => Promise<void>
|
|
1803
1650
|
}
|
|
1804
1651
|
|
|
1805
|
-
class RequestGuard = {
|
|
1806
|
-
new (_name: string, _resolver: RequestGuardResolver): RequestGuard
|
|
1807
|
-
check: () => Promise<boolean>
|
|
1808
|
-
guest: () => Promise<boolean>
|
|
1809
|
-
id: () => Promise<number | string | undefined>
|
|
1810
|
-
user: () => Promise<unknown>
|
|
1811
|
-
userOrNull: () => Promise<unknown>
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
1652
|
class RequirePermissionMiddleware = {
|
|
1815
1653
|
new (...abilities: string[]): RequirePermissionMiddleware
|
|
1816
1654
|
static for: (...abilities: string[]) => RequirePermissionMiddleware
|
|
@@ -2038,14 +1876,6 @@ class ValidateSignatureMiddleware = {
|
|
|
2038
1876
|
|
|
2039
1877
|
const Auth = { user(): UserModel; userOrNull(): UserModel | undefined; id(): number; check(): boolean; guest(): boolean; viaRemember(): boolean; confirmPassword(password: string): Promise<boolean>; markPasswordConfirmed(): void; hasRecentlyConfirmedPassword(timeoutSeconds?: number): boolean; hasRole(role: string): boolean; hasAnyRole(roles: string[]): boolean; hasAllRoles(roles: string[]): boolean; can(ability: string): boolean; hasPermission(ability: string): boolean; authorize(ability: string): void; roles(): string[]; attempt(credentials: Credentials, remember?: boolean): Promise<boolean>; attemptWhen(credentials: Credentials, callback: (user: UserModel) => boolean | Promise<boolean>, remember?: boolean): Promise<boolean>; validate(credentials: Credentials): Promise<boolean>; once(credentials: Credentials): Promise<boolean>; loginUsingId(id: number, remember?: boolean): Promise<UserModel | null>; login(user: UserModel, options?: LoginOptions): Promise<void>; twoFactorPending(): boolean; pendingTwoFactorUser(): UserModel | undefined; completeTwoFactor(): Promise<UserModel | null>; logout(): Promise<void>; logoutOtherDevices(password: string): Promise<boolean>; viaRequest(name: string, resolver: RequestGuardResolver): void; guard(name?: string): Guard;}
|
|
2040
1878
|
|
|
2041
|
-
const AUTH_PASSWORD_HASH_KEY = 'auth_password_hash'
|
|
2042
|
-
|
|
2043
|
-
const AUTHENTICATABLE = typeof AUTHENTICATABLE
|
|
2044
|
-
|
|
2045
|
-
const DEFAULT_PASSWORD_TIMEOUT = number
|
|
2046
|
-
|
|
2047
|
-
const EMAIL_VERIFICATION = typeof EMAIL_VERIFICATION
|
|
2048
|
-
|
|
2049
1879
|
const Gate = GateService
|
|
2050
1880
|
|
|
2051
1881
|
const Hash = HashService
|
|
@@ -2056,30 +1886,10 @@ const loginThrottle = LoginRateLimiter
|
|
|
2056
1886
|
|
|
2057
1887
|
const MAGIC = { readonly SENT: 'magic.sent'; readonly USER_NOT_FOUND: 'magic.user_not_found'; readonly OK: 'magic.ok'; readonly INVALID: 'magic.invalid';}
|
|
2058
1888
|
|
|
2059
|
-
const PASSWORD_CONFIRMED_AT_KEY = 'auth_password_confirmed_at'
|
|
2060
|
-
|
|
2061
|
-
const PASSWORD_RESET = typeof PASSWORD_RESET
|
|
2062
|
-
|
|
2063
1889
|
const PASSWORDS = { readonly SENT: 'passwords.sent'; readonly TOKEN: 'passwords.token'; readonly RESET: 'passwords.reset';}
|
|
2064
1890
|
|
|
2065
|
-
const PermissionRegistry = { define: (...names: (string | string[])[]) => void; all: () => string[];}
|
|
2066
|
-
|
|
2067
|
-
const PERMISSIONS_MIXIN = typeof PERMISSIONS_MIXIN
|
|
2068
|
-
|
|
2069
|
-
const RECOVERY_CODE_BITS = 160
|
|
2070
|
-
|
|
2071
|
-
const REMEMBER_COOKIE = 'remember_web'
|
|
2072
|
-
|
|
2073
|
-
const REMEMBER_MAX_AGE = number
|
|
2074
|
-
|
|
2075
|
-
const ROLES_MIXIN = typeof ROLES_MIXIN
|
|
2076
|
-
|
|
2077
1891
|
const Social = SocialManager
|
|
2078
1892
|
|
|
2079
|
-
const TWO_FACTOR_PENDING_KEY = 'two_factor_pending'
|
|
2080
|
-
|
|
2081
|
-
const TWO_FACTOR_REMEMBER_KEY = 'two_factor_pending_remember'
|
|
2082
|
-
|
|
2083
1893
|
const TWO_FACTOR_SESSION_KEY = 'two_factor_confirmed'
|
|
2084
1894
|
|
|
2085
1895
|
const TwoFactor = TwoFactorService
|
|
@@ -2098,36 +1908,18 @@ function encodeQr = (text: string) => QrMatrix
|
|
|
2098
1908
|
|
|
2099
1909
|
function fakeSocialUser = (overrides?: Partial<SocialUser>) => SocialUser
|
|
2100
1910
|
|
|
2101
|
-
function hasEmailVerification = (model: unknown) => boolean
|
|
2102
|
-
|
|
2103
|
-
function hashRememberToken = (raw: string) => string
|
|
2104
|
-
|
|
2105
1911
|
function hashToken = (plaintext: string) => Promise<string>
|
|
2106
1912
|
|
|
2107
|
-
function hasPasswordReset = (model: unknown) => boolean
|
|
2108
|
-
|
|
2109
|
-
function hasPermissionsMixin = (model: unknown) => boolean
|
|
2110
|
-
|
|
2111
|
-
function hasRolesMixin = (model: unknown) => boolean
|
|
2112
|
-
|
|
2113
|
-
function isAuthenticatable = (model: unknown) => boolean
|
|
2114
|
-
|
|
2115
1913
|
function isPasswordCompromised = (password: string, opts?: CompromisedCheckOptions) => Promise<boolean>
|
|
2116
1914
|
|
|
2117
1915
|
function maxPayloadBytes = (version?: number) => number
|
|
2118
1916
|
|
|
2119
|
-
function mintRememberToken = () => string
|
|
2120
|
-
|
|
2121
1917
|
function PasswordReset = <TBase extends Constructor>(Base: TBase) => { new (...args: any[]): PasswordReset; prototype: PasswordReset<any>.PasswordReset; passwordResetExpireMinutes: number; resetPassword(token: string, newPassword: string): Promise<PasswordReset | null>;} & TBase
|
|
2122
1918
|
|
|
2123
1919
|
function Permissions = <TBase extends Constructor>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Permissions<any>.(Anonymous class); withPermissions: boolean;} & TBase
|
|
2124
1920
|
|
|
2125
1921
|
function qrSvg = (matrix: QrMatrix, options?: QrSvgOptions) => string
|
|
2126
1922
|
|
|
2127
|
-
function registeredPermissions = () => string[]
|
|
2128
|
-
|
|
2129
|
-
function rememberTokenMatches = (rawFromCookie: string, storedHash: string) => boolean
|
|
2130
|
-
|
|
2131
1923
|
function Roles = <TBase extends Constructor>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Roles<any>.(Anonymous class); withRoles: boolean;} & TBase
|
|
2132
1924
|
|
|
2133
1925
|
function SocialConfig = (config?: DeepPartial<SocialConfigShape>) => SocialConfigShape
|
|
@@ -2136,50 +1928,50 @@ function tokenCan = (row: TokenRow, ability: string) => boolean
|
|
|
2136
1928
|
|
|
2137
1929
|
interface AppleOAuth2Config = {
|
|
2138
1930
|
clientId: string
|
|
2139
|
-
clientSecret?: string
|
|
2140
|
-
keyId?: string
|
|
2141
|
-
privateKey?: string
|
|
1931
|
+
clientSecret?: string | undefined
|
|
1932
|
+
keyId?: string | undefined
|
|
1933
|
+
privateKey?: string | undefined
|
|
2142
1934
|
redirectUrl: string
|
|
2143
|
-
scopes?: string[]
|
|
2144
|
-
teamId?: string
|
|
1935
|
+
scopes?: string[] | undefined
|
|
1936
|
+
teamId?: string | undefined
|
|
2145
1937
|
}
|
|
2146
1938
|
|
|
2147
1939
|
interface AuthConfigShape = {
|
|
2148
1940
|
algorithm: 'bcrypt' | 'argon2id'
|
|
2149
|
-
twoFactor?: TwoFactorOptions
|
|
1941
|
+
twoFactor?: TwoFactorOptions | undefined
|
|
2150
1942
|
}
|
|
2151
1943
|
|
|
2152
1944
|
interface AuthenticateSessionOptions = {
|
|
2153
|
-
redirectTo?: string
|
|
1945
|
+
redirectTo?: string | undefined
|
|
2154
1946
|
}
|
|
2155
1947
|
|
|
2156
1948
|
interface AuthOptions = {
|
|
2157
|
-
mustVerifyEmail?: boolean
|
|
2158
|
-
redirectTo?: string
|
|
2159
|
-
verifyRedirectTo?: string
|
|
1949
|
+
mustVerifyEmail?: boolean | undefined
|
|
1950
|
+
redirectTo?: string | undefined
|
|
1951
|
+
verifyRedirectTo?: string | undefined
|
|
2160
1952
|
}
|
|
2161
1953
|
|
|
2162
1954
|
interface BasicAuthOptions = {
|
|
2163
|
-
field?: string
|
|
2164
|
-
realm?: string
|
|
1955
|
+
field?: string | undefined
|
|
1956
|
+
realm?: string | undefined
|
|
2165
1957
|
}
|
|
2166
1958
|
|
|
2167
1959
|
interface CompromisedCheckOptions = {
|
|
2168
|
-
endpoint?: string
|
|
2169
|
-
threshold?: number
|
|
1960
|
+
endpoint?: string | undefined
|
|
1961
|
+
threshold?: number | undefined
|
|
2170
1962
|
}
|
|
2171
1963
|
|
|
2172
1964
|
interface ConfirmPasswordOptions = {
|
|
2173
|
-
redirectTo?: string
|
|
2174
|
-
timeoutSeconds?: number
|
|
1965
|
+
redirectTo?: string | undefined
|
|
1966
|
+
timeoutSeconds?: number | undefined
|
|
2175
1967
|
}
|
|
2176
1968
|
|
|
2177
1969
|
interface EmailOtpOptions = {
|
|
2178
1970
|
deleteCode: (email: string) => Promise<void>
|
|
2179
|
-
expireMinutes?: number
|
|
1971
|
+
expireMinutes?: number | undefined
|
|
2180
1972
|
findCode: (email: string) => Promise<{ code: string; createdAt: Date;} | null>
|
|
2181
|
-
length?: number
|
|
2182
|
-
maxAttempts?: number
|
|
1973
|
+
length?: number | undefined
|
|
1974
|
+
maxAttempts?: number | undefined
|
|
2183
1975
|
sendCode: (email: string, code: string) => Promise<void>
|
|
2184
1976
|
storeCode: (email: string, hash: string, expiresAt: Date) => Promise<void>
|
|
2185
1977
|
}
|
|
@@ -2193,31 +1985,31 @@ interface Guard = {
|
|
|
2193
1985
|
}
|
|
2194
1986
|
|
|
2195
1987
|
interface GuestOptions = {
|
|
2196
|
-
redirectTo?: string
|
|
1988
|
+
redirectTo?: string | undefined
|
|
2197
1989
|
}
|
|
2198
1990
|
|
|
2199
1991
|
interface JwtGuardOptions = {
|
|
2200
|
-
header?: string
|
|
2201
|
-
resolve?: (claims: JwtPayload) => Promise<unknown> | unknown
|
|
2202
|
-
secret?: string
|
|
1992
|
+
header?: string | undefined
|
|
1993
|
+
resolve?: ((claims: JwtPayload) => Promise<unknown> | unknown) | undefined
|
|
1994
|
+
secret?: string | undefined
|
|
2203
1995
|
}
|
|
2204
1996
|
|
|
2205
1997
|
interface JwtSignOptions = {
|
|
2206
|
-
expiresIn?: number
|
|
2207
|
-
issuedAt?: number
|
|
1998
|
+
expiresIn?: number | undefined
|
|
1999
|
+
issuedAt?: number | undefined
|
|
2208
2000
|
}
|
|
2209
2001
|
|
|
2210
2002
|
interface LoginOptions = {
|
|
2211
|
-
remember?: boolean
|
|
2003
|
+
remember?: boolean | undefined
|
|
2212
2004
|
}
|
|
2213
2005
|
|
|
2214
2006
|
interface LoginThrottleOptions = {
|
|
2215
|
-
decaySeconds?: number
|
|
2216
|
-
maxAttempts?: number
|
|
2007
|
+
decaySeconds?: number | undefined
|
|
2008
|
+
maxAttempts?: number | undefined
|
|
2217
2009
|
}
|
|
2218
2010
|
|
|
2219
2011
|
interface MagicLinkBrokerOptions = {
|
|
2220
|
-
expiresInMinutes?: number
|
|
2012
|
+
expiresInMinutes?: number | undefined
|
|
2221
2013
|
findUser: (email: string) => Promise<U | null | undefined>
|
|
2222
2014
|
secret: string
|
|
2223
2015
|
sendLink: (email: string, signedUrl: string) => Promise<void>
|
|
@@ -2235,9 +2027,9 @@ interface NewToken = {
|
|
|
2235
2027
|
|
|
2236
2028
|
interface OAuth2Config = {
|
|
2237
2029
|
clientId: string
|
|
2238
|
-
clientSecret?: string
|
|
2030
|
+
clientSecret?: string | undefined
|
|
2239
2031
|
redirectUrl: string
|
|
2240
|
-
scopes?: string[]
|
|
2032
|
+
scopes?: string[] | undefined
|
|
2241
2033
|
}
|
|
2242
2034
|
|
|
2243
2035
|
interface PasskeyCredential = {
|
|
@@ -2256,11 +2048,11 @@ interface PasskeysOptions = {
|
|
|
2256
2048
|
findCredential: (credentialId: string) => Promise<PasskeyCredential | null | undefined>
|
|
2257
2049
|
findUserCredentials: (userId: number) => Promise<PasskeyCredential[]>
|
|
2258
2050
|
origin: string | string[]
|
|
2259
|
-
requireUserVerification?: boolean
|
|
2051
|
+
requireUserVerification?: boolean | undefined
|
|
2260
2052
|
rpId: string
|
|
2261
2053
|
rpName: string
|
|
2262
2054
|
saveCredential: (credential: Omit<PasskeyCredential, 'id'>) => Promise<void>
|
|
2263
|
-
timeoutSeconds?: number
|
|
2055
|
+
timeoutSeconds?: number | undefined
|
|
2264
2056
|
updateCounter: (id: number, newCounter: number) => Promise<void>
|
|
2265
2057
|
}
|
|
2266
2058
|
|
|
@@ -2272,7 +2064,7 @@ interface PasskeyUser = {
|
|
|
2272
2064
|
|
|
2273
2065
|
interface PasswordBrokerOptions = {
|
|
2274
2066
|
deleteToken: (email: string) => Promise<void>
|
|
2275
|
-
expireMinutes?: number
|
|
2067
|
+
expireMinutes?: number | undefined
|
|
2276
2068
|
findToken: (email: string) => Promise<{ token: string; createdAt: Date;} | null>
|
|
2277
2069
|
pruneTokens: (cutoff: Date) => Promise<void>
|
|
2278
2070
|
resetPassword: (email: string, newPassword: string) => Promise<void>
|
|
@@ -2289,16 +2081,16 @@ interface QrMatrix = {
|
|
|
2289
2081
|
}
|
|
2290
2082
|
|
|
2291
2083
|
interface QrSvgOptions = {
|
|
2292
|
-
alt?: string
|
|
2293
|
-
class?: string
|
|
2294
|
-
dark?: string
|
|
2295
|
-
light?: string | null
|
|
2296
|
-
quietZone?: number
|
|
2297
|
-
size?: number
|
|
2084
|
+
alt?: string | undefined
|
|
2085
|
+
class?: string | undefined
|
|
2086
|
+
dark?: string | undefined
|
|
2087
|
+
light?: string | null | undefined
|
|
2088
|
+
quietZone?: number | undefined
|
|
2089
|
+
size?: number | undefined
|
|
2298
2090
|
}
|
|
2299
2091
|
|
|
2300
2092
|
interface RememberMeOptions = {
|
|
2301
|
-
secure?: boolean
|
|
2093
|
+
secure?: boolean | undefined
|
|
2302
2094
|
}
|
|
2303
2095
|
|
|
2304
2096
|
interface SocialSession = {
|
|
@@ -2340,19 +2132,19 @@ interface TokenRow = {
|
|
|
2340
2132
|
}
|
|
2341
2133
|
|
|
2342
2134
|
interface TwoFactorOptions = {
|
|
2343
|
-
issuer?: string
|
|
2344
|
-
recoveryCodeCount?: number
|
|
2345
|
-
window?: number
|
|
2135
|
+
issuer?: string | undefined
|
|
2136
|
+
recoveryCodeCount?: number | undefined
|
|
2137
|
+
window?: number | undefined
|
|
2346
2138
|
}
|
|
2347
2139
|
|
|
2348
2140
|
interface TwoFactorQrOptions = {
|
|
2349
|
-
alt?: string
|
|
2350
|
-
class?: string
|
|
2351
|
-
dark?: string
|
|
2352
|
-
issuer?: string
|
|
2353
|
-
light?: string | null
|
|
2354
|
-
quietZone?: number
|
|
2355
|
-
size?: number
|
|
2141
|
+
alt?: string | undefined
|
|
2142
|
+
class?: string | undefined
|
|
2143
|
+
dark?: string | undefined
|
|
2144
|
+
issuer?: string | undefined
|
|
2145
|
+
light?: string | null | undefined
|
|
2146
|
+
quietZone?: number | undefined
|
|
2147
|
+
size?: number | undefined
|
|
2356
2148
|
}
|
|
2357
2149
|
|
|
2358
2150
|
interface UserModel = {
|
|
@@ -2403,9 +2195,7 @@ type MagicLinkBrokerResult = 'magic.sent' | 'magic.user_not_found' | 'magic.ok'
|
|
|
2403
2195
|
|
|
2404
2196
|
type PasswordBrokerResult = 'passwords.sent' | 'passwords.token' | 'passwords.reset'
|
|
2405
2197
|
|
|
2406
|
-
type
|
|
2407
|
-
|
|
2408
|
-
type SocialConfigShape = { [driver: string]: (OAuth2Config & Record<string, unknown>) | undefined; github?: OAuth2Config & Record<string, unknown>; google?: OAuth2Config & Record<string, unknown>; apple?: AppleOAuth2Config & Record<string, unknown>; discord?: (OAuth2Config & Record<string, unknown>) | undefined; microsoft?: (OAuth2Config & Record<string, unknown>) | undefined; facebook?: (OAuth2Config & Record<string, unknown>) | undefined; twitter?: (OAuth2Config & Record<string, unknown>) | undefined; linkedin?: (OAuth2Config & Record<string, unknown>) | undefined; gitlab?: (OAuth2Config & Record<string, unknown>) | undefined;}
|
|
2198
|
+
type SocialConfigShape = { [driver: string]: (OAuth2Config & Record<string, unknown>) | undefined; github?: (OAuth2Config & Record<string, unknown>) | undefined; google?: (OAuth2Config & Record<string, unknown>) | undefined; apple?: (AppleOAuth2Config & Record<string, unknown>) | undefined; discord?: (OAuth2Config & Record<string, unknown>) | undefined; microsoft?: (OAuth2Config & Record<string, unknown>) | undefined; facebook?: (OAuth2Config & Record<string, unknown>) | undefined; twitter?: (OAuth2Config & Record<string, unknown>) | undefined; linkedin?: (OAuth2Config & Record<string, unknown>) | undefined; gitlab?: (OAuth2Config & Record<string, unknown>) | undefined;}
|
|
2409
2199
|
|
|
2410
2200
|
## ./build `(./src/build.ts)`
|
|
2411
2201
|
|
|
@@ -2416,7 +2206,7 @@ function addToDefaultArrayExport = (source: string, identifier: string) => strin
|
|
|
2416
2206
|
function registerProvider = (options: RegisterProviderOptions) => Promise<RegisterResult>
|
|
2417
2207
|
|
|
2418
2208
|
interface RegisterProviderOptions = {
|
|
2419
|
-
bootstrapPath?: string
|
|
2209
|
+
bootstrapPath?: string | undefined
|
|
2420
2210
|
className: string
|
|
2421
2211
|
importPath: string
|
|
2422
2212
|
}
|
|
@@ -2570,7 +2360,7 @@ interface CacheDriver = {
|
|
|
2570
2360
|
interface IdempotencyOptions = {
|
|
2571
2361
|
cache: CacheManager | undefined
|
|
2572
2362
|
header: string
|
|
2573
|
-
lock?: LockManager
|
|
2363
|
+
lock?: LockManager | undefined
|
|
2574
2364
|
methods: string[]
|
|
2575
2365
|
ttl: number
|
|
2576
2366
|
useLock: boolean
|
|
@@ -2931,64 +2721,64 @@ function ClientConfig = (options?: Partial<ClientConfigShape>) => Partial<Client
|
|
|
2931
2721
|
function createApiClient = <Routes extends ApiRouteMap>(config?: ApiClientConfig) => ApiClient<Routes>
|
|
2932
2722
|
|
|
2933
2723
|
interface ApiClientConfig = {
|
|
2934
|
-
baseUrl?: string
|
|
2935
|
-
circuitBreaker?: CircuitBreaker | CircuitBreakerOptions
|
|
2936
|
-
csrf?: boolean | { cookie?: string; header?: string;}
|
|
2937
|
-
headers?: Record<string, string>
|
|
2938
|
-
onError?: (error: ApiClientError) => void | Promise<void>
|
|
2939
|
-
onForbidden?: (error: ApiClientError) => void | Promise<void>
|
|
2940
|
-
onRequest?: RequestInterceptor | RequestInterceptor[]
|
|
2941
|
-
onResponse?: ResponseInterceptor | ResponseInterceptor[]
|
|
2942
|
-
onUnauthorized?: (error: ApiClientError, retry: (headerOverrides?: Record<string, string>) => Promise<unknown>) => Promise<unknown> | void
|
|
2943
|
-
retry?: number | RetryOptions
|
|
2944
|
-
timeout?: number
|
|
2945
|
-
token?: TokenSource
|
|
2946
|
-
withCredentials?: boolean
|
|
2724
|
+
baseUrl?: string | undefined
|
|
2725
|
+
circuitBreaker?: CircuitBreaker | CircuitBreakerOptions | undefined
|
|
2726
|
+
csrf?: boolean | { cookie?: string; header?: string;} | undefined
|
|
2727
|
+
headers?: Record<string, string> | undefined
|
|
2728
|
+
onError?: ((error: ApiClientError) => void | Promise<void>) | undefined
|
|
2729
|
+
onForbidden?: ((error: ApiClientError) => void | Promise<void>) | undefined
|
|
2730
|
+
onRequest?: RequestInterceptor | RequestInterceptor[] | undefined
|
|
2731
|
+
onResponse?: ResponseInterceptor | ResponseInterceptor[] | undefined
|
|
2732
|
+
onUnauthorized?: ((error: ApiClientError, retry: (headerOverrides?: Record<string, string>) => Promise<unknown>) => Promise<unknown> | void) | undefined
|
|
2733
|
+
retry?: number | RetryOptions | undefined
|
|
2734
|
+
timeout?: number | undefined
|
|
2735
|
+
token?: TokenSource | undefined
|
|
2736
|
+
withCredentials?: boolean | undefined
|
|
2947
2737
|
}
|
|
2948
2738
|
|
|
2949
2739
|
interface CircuitBreakerOptions = {
|
|
2950
|
-
isFailure?: (error: unknown) => boolean
|
|
2951
|
-
resetTimeout?: number
|
|
2952
|
-
threshold?: number
|
|
2740
|
+
isFailure?: ((error: unknown) => boolean) | undefined
|
|
2741
|
+
resetTimeout?: number | undefined
|
|
2742
|
+
threshold?: number | undefined
|
|
2953
2743
|
}
|
|
2954
2744
|
|
|
2955
2745
|
interface ClientConfigShape = {
|
|
2956
|
-
baseUrl?: string
|
|
2957
|
-
circuitBreaker?: CircuitBreaker | CircuitBreakerOptions
|
|
2958
|
-
csrf?: boolean | { cookie?: string; header?: string;}
|
|
2959
|
-
headers?: Record<string, string>
|
|
2960
|
-
onError?: (error: ApiClientError) => void | Promise<void>
|
|
2961
|
-
onForbidden?: (error: ApiClientError) => void | Promise<void>
|
|
2962
|
-
onRequest?: RequestInterceptor | RequestInterceptor[]
|
|
2963
|
-
onResponse?: ResponseInterceptor | ResponseInterceptor[]
|
|
2964
|
-
onUnauthorized?: (error: ApiClientError, retry: (headerOverrides?: Record<string, string>) => Promise<unknown>) => Promise<unknown> | void
|
|
2965
|
-
retry?: number | RetryOptions
|
|
2966
|
-
timeout?: number
|
|
2967
|
-
token?: TokenSource
|
|
2968
|
-
withCredentials?: boolean
|
|
2746
|
+
baseUrl?: string | undefined
|
|
2747
|
+
circuitBreaker?: CircuitBreaker | CircuitBreakerOptions | undefined
|
|
2748
|
+
csrf?: boolean | { cookie?: string; header?: string;} | undefined
|
|
2749
|
+
headers?: Record<string, string> | undefined
|
|
2750
|
+
onError?: ((error: ApiClientError) => void | Promise<void>) | undefined
|
|
2751
|
+
onForbidden?: ((error: ApiClientError) => void | Promise<void>) | undefined
|
|
2752
|
+
onRequest?: RequestInterceptor | RequestInterceptor[] | undefined
|
|
2753
|
+
onResponse?: ResponseInterceptor | ResponseInterceptor[] | undefined
|
|
2754
|
+
onUnauthorized?: ((error: ApiClientError, retry: (headerOverrides?: Record<string, string>) => Promise<unknown>) => Promise<unknown> | void) | undefined
|
|
2755
|
+
retry?: number | RetryOptions | undefined
|
|
2756
|
+
timeout?: number | undefined
|
|
2757
|
+
token?: TokenSource | undefined
|
|
2758
|
+
withCredentials?: boolean | undefined
|
|
2969
2759
|
}
|
|
2970
2760
|
|
|
2971
2761
|
interface GetOptions = {
|
|
2972
|
-
headers?: Record<string, string>
|
|
2973
|
-
init?: Omit<RequestInit, 'method' | 'headers' | 'body'>
|
|
2974
|
-
meta?: (meta: ResponseMeta) => void
|
|
2975
|
-
query?: Q
|
|
2976
|
-
responseType?: 'text' | 'json' | 'auto' | 'blob' | 'arrayBuffer'
|
|
2977
|
-
retry?: number | false | RetryOptions
|
|
2978
|
-
signal?: AbortSignal
|
|
2979
|
-
timeout?: number
|
|
2762
|
+
headers?: Record<string, string> | undefined
|
|
2763
|
+
init?: Omit<RequestInit, 'method' | 'headers' | 'body'> | undefined
|
|
2764
|
+
meta?: ((meta: ResponseMeta) => void) | undefined
|
|
2765
|
+
query?: Q | undefined
|
|
2766
|
+
responseType?: 'text' | 'json' | 'auto' | 'blob' | 'arrayBuffer' | undefined
|
|
2767
|
+
retry?: number | false | RetryOptions | undefined
|
|
2768
|
+
signal?: AbortSignal | undefined
|
|
2769
|
+
timeout?: number | undefined
|
|
2980
2770
|
}
|
|
2981
2771
|
|
|
2982
2772
|
interface MutationOptions = {
|
|
2983
|
-
headers?: Record<string, string>
|
|
2984
|
-
init?: Omit<RequestInit, 'method' | 'headers' | 'body'>
|
|
2985
|
-
meta?: (meta: ResponseMeta) => void
|
|
2986
|
-
params?: Record<string, string | number>
|
|
2987
|
-
query?: Q
|
|
2988
|
-
responseType?: 'text' | 'json' | 'auto' | 'blob' | 'arrayBuffer'
|
|
2989
|
-
retry?: number | false | RetryOptions
|
|
2990
|
-
signal?: AbortSignal
|
|
2991
|
-
timeout?: number
|
|
2773
|
+
headers?: Record<string, string> | undefined
|
|
2774
|
+
init?: Omit<RequestInit, 'method' | 'headers' | 'body'> | undefined
|
|
2775
|
+
meta?: ((meta: ResponseMeta) => void) | undefined
|
|
2776
|
+
params?: Record<string, string | number> | undefined
|
|
2777
|
+
query?: Q | undefined
|
|
2778
|
+
responseType?: 'text' | 'json' | 'auto' | 'blob' | 'arrayBuffer' | undefined
|
|
2779
|
+
retry?: number | false | RetryOptions | undefined
|
|
2780
|
+
signal?: AbortSignal | undefined
|
|
2781
|
+
timeout?: number | undefined
|
|
2992
2782
|
}
|
|
2993
2783
|
|
|
2994
2784
|
interface PresenceMember = {
|
|
@@ -3004,13 +2794,13 @@ interface RequestConfig = {
|
|
|
3004
2794
|
}
|
|
3005
2795
|
|
|
3006
2796
|
interface RequestOptions = {
|
|
3007
|
-
headers?: Record<string, string>
|
|
3008
|
-
init?: Omit<RequestInit, 'method' | 'headers' | 'body'>
|
|
3009
|
-
meta?: (meta: ResponseMeta) => void
|
|
3010
|
-
responseType?: 'text' | 'json' | 'auto' | 'blob' | 'arrayBuffer'
|
|
3011
|
-
retry?: number | false | RetryOptions
|
|
3012
|
-
signal?: AbortSignal
|
|
3013
|
-
timeout?: number
|
|
2797
|
+
headers?: Record<string, string> | undefined
|
|
2798
|
+
init?: Omit<RequestInit, 'method' | 'headers' | 'body'> | undefined
|
|
2799
|
+
meta?: ((meta: ResponseMeta) => void) | undefined
|
|
2800
|
+
responseType?: 'text' | 'json' | 'auto' | 'blob' | 'arrayBuffer' | undefined
|
|
2801
|
+
retry?: number | false | RetryOptions | undefined
|
|
2802
|
+
signal?: AbortSignal | undefined
|
|
2803
|
+
timeout?: number | undefined
|
|
3014
2804
|
}
|
|
3015
2805
|
|
|
3016
2806
|
interface ResponseContext = {
|
|
@@ -3026,11 +2816,11 @@ interface ResponseMeta = {
|
|
|
3026
2816
|
}
|
|
3027
2817
|
|
|
3028
2818
|
interface RetryOptions = {
|
|
3029
|
-
attempts?: number
|
|
3030
|
-
backoff?: (attempt: number, retryAfterMs: number | null) => number
|
|
3031
|
-
methods?: string[]
|
|
3032
|
-
respectRetryAfter?: boolean
|
|
3033
|
-
statuses?: number[]
|
|
2819
|
+
attempts?: number | undefined
|
|
2820
|
+
backoff?: ((attempt: number, retryAfterMs: number | null) => number) | undefined
|
|
2821
|
+
methods?: string[] | undefined
|
|
2822
|
+
respectRetryAfter?: boolean | undefined
|
|
2823
|
+
statuses?: number[] | undefined
|
|
3034
2824
|
}
|
|
3035
2825
|
|
|
3036
2826
|
interface RouteShape = {
|
|
@@ -3051,20 +2841,20 @@ interface SocketLike = {
|
|
|
3051
2841
|
}
|
|
3052
2842
|
|
|
3053
2843
|
interface SocketOptions = {
|
|
3054
|
-
WebSocket?: new (url: string) => SocketLike
|
|
3055
|
-
auth?: { params?: Record<string, string>; headers?: Record<string, string>;}
|
|
3056
|
-
authEndpoint?: string | false
|
|
3057
|
-
autoConnect?: boolean
|
|
3058
|
-
fetch?: typeof fetch
|
|
3059
|
-
host?: string
|
|
3060
|
-
maxReconnectDelay?: number
|
|
3061
|
-
path?: string
|
|
3062
|
-
pingInterval?: number
|
|
3063
|
-
port?: string | number
|
|
3064
|
-
reconnect?: boolean
|
|
3065
|
-
reconnectDelay?: number
|
|
3066
|
-
scheme?: 'ws' | 'wss'
|
|
3067
|
-
url?: string
|
|
2844
|
+
WebSocket?: (new (url: string) => SocketLike) | undefined
|
|
2845
|
+
auth?: { params?: Record<string, string>; headers?: Record<string, string>;} | undefined
|
|
2846
|
+
authEndpoint?: string | false | undefined
|
|
2847
|
+
autoConnect?: boolean | undefined
|
|
2848
|
+
fetch?: typeof fetch | undefined
|
|
2849
|
+
host?: string | undefined
|
|
2850
|
+
maxReconnectDelay?: number | undefined
|
|
2851
|
+
path?: string | undefined
|
|
2852
|
+
pingInterval?: number | undefined
|
|
2853
|
+
port?: string | number | undefined
|
|
2854
|
+
reconnect?: boolean | undefined
|
|
2855
|
+
reconnectDelay?: number | undefined
|
|
2856
|
+
scheme?: 'ws' | 'wss' | undefined
|
|
2857
|
+
url?: string | undefined
|
|
3068
2858
|
}
|
|
3069
2859
|
|
|
3070
2860
|
type ApiRouteMap = { [x: `GET ${string}`]: RouteShape | undefined; [x: `POST ${string}`]: RouteShape | undefined; [x: `PUT ${string}`]: RouteShape | undefined; [x: `PATCH ${string}`]: RouteShape | undefined; [x: `DELETE ${string}`]: RouteShape | undefined;}
|
|
@@ -3123,6 +2913,34 @@ class AssetsBuildCommand = {
|
|
|
3123
2913
|
write: (msg: string) => void
|
|
3124
2914
|
}
|
|
3125
2915
|
|
|
2916
|
+
class AssetsPruneCommand = {
|
|
2917
|
+
new (): AssetsPruneCommand
|
|
2918
|
+
static args: ArgDef[]
|
|
2919
|
+
static commandName: string
|
|
2920
|
+
static description: string
|
|
2921
|
+
static flags: ({ name: string; type: 'string'; description: string; default?: never;} | { name: string; type: 'boolean'; description: string; default: boolean;})[]
|
|
2922
|
+
static needsApp: boolean
|
|
2923
|
+
_readLine: () => Promise<string>
|
|
2924
|
+
_writer: OutputWriter
|
|
2925
|
+
app: unknown
|
|
2926
|
+
args: Record<string, string>
|
|
2927
|
+
ask: (question: string, defaultValue?: string) => Promise<string>
|
|
2928
|
+
choice: (question: string, options: string[]) => Promise<string>
|
|
2929
|
+
confirm: (question: string, defaultValue?: boolean) => Promise<boolean>
|
|
2930
|
+
dim: (msg: string) => void
|
|
2931
|
+
error: (msg: string) => void
|
|
2932
|
+
flags: Record<string, string | number | boolean>
|
|
2933
|
+
info: (msg: string) => void
|
|
2934
|
+
line: (msg: string) => void
|
|
2935
|
+
newLine: () => void
|
|
2936
|
+
run: () => Promise<void>
|
|
2937
|
+
secret: (question: string) => Promise<string>
|
|
2938
|
+
section: (title: string) => void
|
|
2939
|
+
table: (rows: [string, string][], indent?: number) => void
|
|
2940
|
+
warn: (msg: string) => void
|
|
2941
|
+
write: (msg: string) => void
|
|
2942
|
+
}
|
|
2943
|
+
|
|
3126
2944
|
class CompileCommand = {
|
|
3127
2945
|
new (): CompileCommand
|
|
3128
2946
|
static args: ArgDef[]
|
|
@@ -3996,6 +3814,8 @@ class ConfigValidationError = {
|
|
|
3996
3814
|
readonly status: number
|
|
3997
3815
|
}
|
|
3998
3816
|
|
|
3817
|
+
const CONVENTIONAL_PREFLIGHT_COMMAND = 'release:check'
|
|
3818
|
+
|
|
3999
3819
|
const DEFAULT_DEPLOY_STEPS = readonly string[]
|
|
4000
3820
|
|
|
4001
3821
|
const DEFAULT_DEPLOY_TARGETS = Record<string, DeployTarget>
|
|
@@ -4008,7 +3828,7 @@ function DeployConfig = (options?: Partial<DeployConfigShape>) => DeployConfigSh
|
|
|
4008
3828
|
|
|
4009
3829
|
interface AppAssetsConfig = {
|
|
4010
3830
|
entrypoint: string | string[]
|
|
4011
|
-
loader?: Record<string, AssetLoaderKind>
|
|
3831
|
+
loader?: Record<string, AssetLoaderKind> | undefined
|
|
4012
3832
|
minify: boolean
|
|
4013
3833
|
outDir: string
|
|
4014
3834
|
prefix: string
|
|
@@ -4016,11 +3836,11 @@ interface AppAssetsConfig = {
|
|
|
4016
3836
|
|
|
4017
3837
|
interface AppConfigShape = {
|
|
4018
3838
|
allowedOrigins: string[]
|
|
4019
|
-
assets?: AppAssetsConfig
|
|
3839
|
+
assets?: AppAssetsConfig | undefined
|
|
4020
3840
|
conventions: ConventionsConfig
|
|
4021
3841
|
cors: AppCorsConfig
|
|
4022
3842
|
debug: boolean
|
|
4023
|
-
dev?: DevConfigShape
|
|
3843
|
+
dev?: DevConfigShape | undefined
|
|
4024
3844
|
env: string
|
|
4025
3845
|
health: boolean | HealthConfigShape
|
|
4026
3846
|
http3: boolean
|
|
@@ -4032,7 +3852,7 @@ interface AppConfigShape = {
|
|
|
4032
3852
|
secureHeaders: AppSecureHeadersConfig
|
|
4033
3853
|
throttle: AppThrottleConfig
|
|
4034
3854
|
timezone: string
|
|
4035
|
-
tls?: AppTlsConfig
|
|
3855
|
+
tls?: AppTlsConfig | undefined
|
|
4036
3856
|
url: string
|
|
4037
3857
|
}
|
|
4038
3858
|
|
|
@@ -4054,12 +3874,6 @@ interface ConfigRegistry = {
|
|
|
4054
3874
|
logging: LoggingConfigShape
|
|
4055
3875
|
}
|
|
4056
3876
|
|
|
4057
|
-
interface ConfigValidationContext = {
|
|
4058
|
-
config: ConfigManager
|
|
4059
|
-
isProduction: boolean
|
|
4060
|
-
namespace: string
|
|
4061
|
-
}
|
|
4062
|
-
|
|
4063
3877
|
interface ConventionsConfig = {
|
|
4064
3878
|
enabled: boolean
|
|
4065
3879
|
paths: { providers: string; middleware: string; models: string; observers: string; policies: string; listeners: string; events: string; jobs: string; schedules: string; validators: string; commands: string;}
|
|
@@ -4070,23 +3884,15 @@ interface DeployConfigShape = {
|
|
|
4070
3884
|
}
|
|
4071
3885
|
|
|
4072
3886
|
interface DeployTarget = {
|
|
3887
|
+
preflight?: readonly string[]
|
|
4073
3888
|
steps?: readonly string[]
|
|
4074
3889
|
url?: string
|
|
4075
3890
|
}
|
|
4076
3891
|
|
|
4077
|
-
interface RegisteredConfigValidator = {
|
|
4078
|
-
namespace: string
|
|
4079
|
-
validate: ConfigValidator
|
|
4080
|
-
}
|
|
4081
|
-
|
|
4082
3892
|
type AssetLoaderKind = 'file' | 'dataurl' | 'base64' | 'text' | 'json' | 'toml'
|
|
4083
3893
|
|
|
4084
3894
|
type ConfigIssueLevel = 'error' | 'warning'
|
|
4085
3895
|
|
|
4086
|
-
type ConfigMap = { [x: string]: Record<string, unknown>;}
|
|
4087
|
-
|
|
4088
|
-
type ConfigPath = 'lock' | 'app' | 'deploy' | 'health' | 'logging' | 'lock.driver' | 'lock.sqlite' | 'lock.prefix' | 'lock.sqlite.path' | 'app.url' | 'app.name' | 'app.dev' | 'app.port' | 'app.health' | 'app.env' | 'app.key' | 'app.debug' | 'app.locale' | 'app.timezone' | 'app.http3' | 'app.tls' | 'app.maxRequestBodySize' | 'app.allowedOrigins' | 'app.cors' | 'app.throttle' | 'app.secureHeaders' | 'app.assets' | 'app.conventions' | 'app.cors.credentials' | 'app.cors.origin' | 'app.throttle.maxAttempts' | 'app.throttle.windowSeconds' | 'app.secureHeaders.referrerPolicy' | 'app.secureHeaders.frameOptions' | 'app.secureHeaders.secure' | 'app.secureHeaders.hstsMaxAge' | 'app.secureHeaders.hstsIncludeSubDomains' | 'app.secureHeaders.hstsPreload' | 'app.secureHeaders.contentSecurityPolicy' | 'app.conventions.paths' | 'app.conventions.enabled' | 'app.conventions.paths.events' | 'app.conventions.paths.commands' | 'app.conventions.paths.providers' | 'app.conventions.paths.middleware' | 'app.conventions.paths.models' | 'app.conventions.paths.observers' | 'app.conventions.paths.policies' | 'app.conventions.paths.listeners' | 'app.conventions.paths.jobs' | 'app.conventions.paths.schedules' | 'app.conventions.paths.validators' | 'deploy.targets' | `deploy.targets.${string}` | 'health.path' | 'health.enabled' | 'health.secret' | 'health.showDetails' | 'logging.default' | 'logging.file' | 'logging.console' | 'logging.channels' | 'logging.slowQueryMs' | 'logging.requests' | `logging.channels.${string}`
|
|
4089
|
-
|
|
4090
3896
|
type ConfigValidator = (value: unknown, ctx: ConfigValidationContext) => ConfigIssue[] | void
|
|
4091
3897
|
|
|
4092
3898
|
type ConfigValue = P extends `${infer Head}.${infer Rest}` ? Head extends keyof ConfigRegistry ? ValueAt<ConfigRegistry[Head], Rest> : unknown : P extends keyof ConfigRegistry ? ConfigRegistry[P] : unknown
|
|
@@ -4128,75 +3934,6 @@ class DevReloadMiddleware = {
|
|
|
4128
3934
|
onError?: (ctx: HttpContext, error: Error) => Promise<void>
|
|
4129
3935
|
}
|
|
4130
3936
|
|
|
4131
|
-
class DevSupervisor = {
|
|
4132
|
-
new (options: DevSupervisorOptions): DevSupervisor
|
|
4133
|
-
definitions: () => ResolvedDevProcess[]
|
|
4134
|
-
restart: (name: string) => Promise<void>
|
|
4135
|
-
start: (definitions: ResolvedDevProcess[]) => void
|
|
4136
|
-
statuses: () => DevProcessStatus[]
|
|
4137
|
-
stopAll: () => Promise<void>
|
|
4138
|
-
}
|
|
4139
|
-
|
|
4140
|
-
class StreamDeck = {
|
|
4141
|
-
new (_writer: OutputWriter, _color: boolean): StreamDeck
|
|
4142
|
-
line: (name: string, text: string, stream: 'stdout' | 'stderr') => void
|
|
4143
|
-
notice: (text: string) => void
|
|
4144
|
-
start: (statuses: DevProcessStatus[]) => void
|
|
4145
|
-
state: (status: DevProcessStatus) => void
|
|
4146
|
-
stop: () => void
|
|
4147
|
-
}
|
|
4148
|
-
|
|
4149
|
-
class TabsDeck = {
|
|
4150
|
-
new (_options: DeckOptions, _stdout: DeckStdout, _stdin: DeckStdin): TabsDeck
|
|
4151
|
-
line: (name: string, text: string, stream: 'stdout' | 'stderr') => void
|
|
4152
|
-
notice: (text: string) => void
|
|
4153
|
-
start: (statuses: DevProcessStatus[]) => void
|
|
4154
|
-
state: (status: DevProcessStatus) => void
|
|
4155
|
-
stop: () => void
|
|
4156
|
-
}
|
|
4157
|
-
|
|
4158
|
-
const DEV_RELOAD_CLIENT = string
|
|
4159
|
-
|
|
4160
|
-
const SERVER_PROCESS_NAME = 'server'
|
|
4161
|
-
|
|
4162
|
-
function bootBuildDecision = (outDirs: string[], env: string | undefined) => Promise<BootBuildDecision>
|
|
4163
|
-
|
|
4164
|
-
function buildCssBundle = (input: string, outdir: string, minify?: boolean, loader?: Record<string, string>) => Promise<BundleResult>
|
|
4165
|
-
|
|
4166
|
-
function buildJsBundle = (input: string, outdir: string, minify?: boolean) => Promise<BundleResult>
|
|
4167
|
-
|
|
4168
|
-
function collectDevProcesses = (app: ProviderHost, config?: ConfigReader) => Promise<ResolvedDevProcess[]>
|
|
4169
|
-
|
|
4170
|
-
function createDeck = (options: DeckOptions) => Deck
|
|
4171
|
-
|
|
4172
|
-
function detectCssPlugins = (cwd: string) => Promise<BunPlugin[]>
|
|
4173
|
-
|
|
4174
|
-
function isWritableDir = (dir: string) => Promise<boolean>
|
|
4175
|
-
|
|
4176
|
-
function registerDevHtmlSnippet = (name: string, fn: DevHtmlSnippet) => void
|
|
4177
|
-
|
|
4178
|
-
function startDevMode = (options: StartDevModeOptions) => Promise<void>
|
|
4179
|
-
|
|
4180
|
-
interface AssetBuildConfig = {
|
|
4181
|
-
clean?: boolean
|
|
4182
|
-
entrypoint: string | string[]
|
|
4183
|
-
loader?: Record<string, string>
|
|
4184
|
-
minify: boolean
|
|
4185
|
-
outDir: string
|
|
4186
|
-
prefix: string
|
|
4187
|
-
}
|
|
4188
|
-
|
|
4189
|
-
interface BootBuildDecision = {
|
|
4190
|
-
build: boolean
|
|
4191
|
-
reason?: string
|
|
4192
|
-
}
|
|
4193
|
-
|
|
4194
|
-
interface BuildResult = {
|
|
4195
|
-
logs?: unknown[]
|
|
4196
|
-
skipped?: boolean
|
|
4197
|
-
success: boolean
|
|
4198
|
-
}
|
|
4199
|
-
|
|
4200
3937
|
interface Deck = {
|
|
4201
3938
|
line: (name: string, text: string, stream: 'stdout' | 'stderr') => void
|
|
4202
3939
|
notice: (text: string) => void
|
|
@@ -4205,57 +3942,6 @@ interface Deck = {
|
|
|
4205
3942
|
stop: () => void
|
|
4206
3943
|
}
|
|
4207
3944
|
|
|
4208
|
-
interface DeckOptions = {
|
|
4209
|
-
mode?: 'tabs' | 'stream'
|
|
4210
|
-
onQuit: () => void
|
|
4211
|
-
onRestart: (name: string) => void
|
|
4212
|
-
stdin?: DeckStdin
|
|
4213
|
-
stdout?: DeckStdout
|
|
4214
|
-
writer: OutputWriter
|
|
4215
|
-
}
|
|
4216
|
-
|
|
4217
|
-
interface DevChild = {
|
|
4218
|
-
kill: (signal?: number | NodeJS.Signals) => void
|
|
4219
|
-
readonly exited: Promise<number>
|
|
4220
|
-
readonly stderr: ReadableStream<Uint8Array<ArrayBufferLike>> | null
|
|
4221
|
-
readonly stdout: ReadableStream<Uint8Array<ArrayBufferLike>> | null
|
|
4222
|
-
}
|
|
4223
|
-
|
|
4224
|
-
interface DevOrchestratorHooks = {
|
|
4225
|
-
onCleanup?: () => void | Promise<void>
|
|
4226
|
-
onNotice?: (text: string, level: 'info' | 'warn' | 'error') => void
|
|
4227
|
-
onServerLine?: (line: string, stream: 'stdout' | 'stderr') => void
|
|
4228
|
-
onServerReady?: () => void | Promise<void>
|
|
4229
|
-
onServerState?: (state: 'starting' | 'running' | 'restarting' | 'parked') => void
|
|
4230
|
-
}
|
|
4231
|
-
|
|
4232
|
-
interface DevProcessStatus = {
|
|
4233
|
-
attempts: number
|
|
4234
|
-
color: DevProcessColor
|
|
4235
|
-
exitCode?: number
|
|
4236
|
-
label: string
|
|
4237
|
-
name: string
|
|
4238
|
-
state: DevProcessState
|
|
4239
|
-
}
|
|
4240
|
-
|
|
4241
|
-
interface DevSupervisorOptions = {
|
|
4242
|
-
backoffMs?: number[]
|
|
4243
|
-
cwd: string
|
|
4244
|
-
env?: Record<string, string | undefined>
|
|
4245
|
-
healthyAfterMs?: number
|
|
4246
|
-
onLine?: (name: string, line: string, stream: 'stdout' | 'stderr') => void
|
|
4247
|
-
onState?: (status: DevProcessStatus) => void
|
|
4248
|
-
spawn?: DevSpawnFn
|
|
4249
|
-
}
|
|
4250
|
-
|
|
4251
|
-
type BuildHookFn = () => Promise<BuildResult>
|
|
4252
|
-
|
|
4253
|
-
type DevHtmlSnippet = (ctx: HttpContext) => string
|
|
4254
|
-
|
|
4255
|
-
type DevProcessState = 'starting' | 'running' | 'restarting' | 'exited' | 'parked'
|
|
4256
|
-
|
|
4257
|
-
type DevSpawnFn = (argv: string[], options: { cwd: string; env: Record<string, string | undefined>;}) => DevChild
|
|
4258
|
-
|
|
4259
3945
|
## ./env `(./src/env.ts)`
|
|
4260
3946
|
|
|
4261
3947
|
class Def = {
|
|
@@ -4321,10 +4007,10 @@ interface HealthCheckReport = {
|
|
|
4321
4007
|
}
|
|
4322
4008
|
|
|
4323
4009
|
interface HealthConfigShape = {
|
|
4324
|
-
enabled?: boolean
|
|
4325
|
-
path?: string
|
|
4326
|
-
secret?: string
|
|
4327
|
-
showDetails?: boolean
|
|
4010
|
+
enabled?: boolean | undefined
|
|
4011
|
+
path?: string | undefined
|
|
4012
|
+
secret?: string | undefined
|
|
4013
|
+
showDetails?: boolean | undefined
|
|
4328
4014
|
}
|
|
4329
4015
|
|
|
4330
4016
|
interface HealthReport = {
|
|
@@ -4344,7 +4030,7 @@ interface HealthResult = {
|
|
|
4344
4030
|
interface ResolvedHealthConfig = {
|
|
4345
4031
|
enabled: boolean
|
|
4346
4032
|
path: string
|
|
4347
|
-
secret?: string
|
|
4033
|
+
secret?: string | undefined
|
|
4348
4034
|
showDetails: boolean
|
|
4349
4035
|
}
|
|
4350
4036
|
|
|
@@ -4362,13 +4048,9 @@ function data_get = (target: unknown, key: string, defaultValue?: unknown) => un
|
|
|
4362
4048
|
|
|
4363
4049
|
function deepMerge = <T extends object>(base: T, override: DeepPartial<T>) => T
|
|
4364
4050
|
|
|
4365
|
-
function
|
|
4366
|
-
|
|
4367
|
-
function escapeHtml = (value: string) => string
|
|
4051
|
+
function definedOnly = <T extends object>(value: T) => { [K in keyof T]?: Exclude<T[K], undefined>; }
|
|
4368
4052
|
|
|
4369
|
-
function
|
|
4370
|
-
|
|
4371
|
-
function parseCookieHeader = (header: string, name: string) => string | undefined
|
|
4053
|
+
function env = { (key: string): string | undefined; (key: string, fallback: string): string; (key: string, fallback: boolean): boolean; (key: string, fallback: number): number;}
|
|
4372
4054
|
|
|
4373
4055
|
function pipe = <T, R>(value: T, fn: (val: T) => R) => R
|
|
4374
4056
|
|
|
@@ -4392,23 +4074,7 @@ function tap = <T>(value: T, callback: (val: T) => void) => T
|
|
|
4392
4074
|
|
|
4393
4075
|
function tapAsync = <T>(value: T, callback: (val: T) => Promise<void>) => Promise<T>
|
|
4394
4076
|
|
|
4395
|
-
|
|
4396
|
-
autolinks?: boolean | { url?: boolean; www?: boolean; email?: boolean;}
|
|
4397
|
-
collapseWhitespace?: boolean
|
|
4398
|
-
hardSoftBreaks?: boolean
|
|
4399
|
-
headings?: boolean | { ids?: boolean;}
|
|
4400
|
-
latexMath?: boolean
|
|
4401
|
-
noHtmlBlocks?: boolean
|
|
4402
|
-
noHtmlSpans?: boolean
|
|
4403
|
-
noIndentedCodeBlocks?: boolean
|
|
4404
|
-
permissiveAtxHeaders?: boolean
|
|
4405
|
-
strikethrough?: boolean
|
|
4406
|
-
tables?: boolean
|
|
4407
|
-
tagFilter?: boolean
|
|
4408
|
-
tasklists?: boolean
|
|
4409
|
-
underline?: boolean
|
|
4410
|
-
wikiLinks?: boolean
|
|
4411
|
-
}
|
|
4077
|
+
type Resolved = { [K in keyof T]-?: Exclude<T[K], undefined>; }
|
|
4412
4078
|
|
|
4413
4079
|
## ./http `(./src/http.ts)`
|
|
4414
4080
|
|
|
@@ -4543,12 +4209,8 @@ class UrlKeyMissingError = {
|
|
|
4543
4209
|
|
|
4544
4210
|
const Url = UrlGenerator
|
|
4545
4211
|
|
|
4546
|
-
function isAllowedOrigin = (request: Request, allowedOrigins?: string[]) => boolean
|
|
4547
|
-
|
|
4548
4212
|
function negotiate = (ctx: HttpContext) => <TWeb = void, TJson = void, TCli = void>(map: NegotiateMap<TWeb, TJson, TCli>) => Promise<TWeb | TJson | TCli | void>
|
|
4549
4213
|
|
|
4550
|
-
function sniffContentType = (bytes: Uint8Array) => SniffedType
|
|
4551
|
-
|
|
4552
4214
|
function uri = (value?: string | Uri) => Uri
|
|
4553
4215
|
|
|
4554
4216
|
function url = { (): UrlGenerator; (path: string, extra?: (string | number)[], secure?: boolean): string;}
|
|
@@ -4571,16 +4233,9 @@ interface CliContext = {
|
|
|
4571
4233
|
writeln: (content: string) => void
|
|
4572
4234
|
}
|
|
4573
4235
|
|
|
4574
|
-
interface FakeStub = {
|
|
4575
|
-
body?: unknown
|
|
4576
|
-
headers?: Record<string, string>
|
|
4577
|
-
status?: number
|
|
4578
|
-
url: string
|
|
4579
|
-
}
|
|
4580
|
-
|
|
4581
4236
|
interface FileValidationOptions = {
|
|
4582
|
-
maxSize?: number
|
|
4583
|
-
mimes?: string[]
|
|
4237
|
+
maxSize?: number | undefined
|
|
4238
|
+
mimes?: string[] | undefined
|
|
4584
4239
|
}
|
|
4585
4240
|
|
|
4586
4241
|
interface NegotiateMap = {
|
|
@@ -4599,20 +4254,6 @@ interface PaginatedData = {
|
|
|
4599
4254
|
total: number
|
|
4600
4255
|
}
|
|
4601
4256
|
|
|
4602
|
-
interface SniffedType = {
|
|
4603
|
-
contentType: string
|
|
4604
|
-
extension: string
|
|
4605
|
-
recognised: boolean
|
|
4606
|
-
}
|
|
4607
|
-
|
|
4608
|
-
interface UriQueryString = {
|
|
4609
|
-
all: () => Record<string, QueryValue>
|
|
4610
|
-
get: (key: string) => string | undefined
|
|
4611
|
-
getAll: (key: string) => string[]
|
|
4612
|
-
has: (key: string) => boolean
|
|
4613
|
-
toString: () => string
|
|
4614
|
-
}
|
|
4615
|
-
|
|
4616
4257
|
interface UrlGenerator = {
|
|
4617
4258
|
current: () => string
|
|
4618
4259
|
full: () => string
|
|
@@ -4639,8 +4280,6 @@ interface WebContext = {
|
|
|
4639
4280
|
view: (markup: string | { toString(): string;}, status?: number) => void
|
|
4640
4281
|
}
|
|
4641
4282
|
|
|
4642
|
-
type AnsiColor = 'red' | 'green' | 'yellow' | 'blue' | 'cyan' | 'dim'
|
|
4643
|
-
|
|
4644
4283
|
type Channel = 'web' | 'json' | 'cli'
|
|
4645
4284
|
|
|
4646
4285
|
type QueryInput = { [x: string]: string | number | boolean | string[];}
|
|
@@ -4748,10 +4387,10 @@ class SqliteLockDriver = {
|
|
|
4748
4387
|
function LockConfig = (options?: Partial<LockConfigShape>) => LockConfigShape
|
|
4749
4388
|
|
|
4750
4389
|
interface BlockOptions = {
|
|
4751
|
-
refresh?: boolean
|
|
4752
|
-
refreshEvery?: number
|
|
4753
|
-
retryDelay?: number
|
|
4754
|
-
timeout?: number
|
|
4390
|
+
refresh?: boolean | undefined
|
|
4391
|
+
refreshEvery?: number | undefined
|
|
4392
|
+
retryDelay?: number | undefined
|
|
4393
|
+
timeout?: number | undefined
|
|
4755
4394
|
}
|
|
4756
4395
|
|
|
4757
4396
|
interface LockConfigShape = {
|
|
@@ -4770,8 +4409,8 @@ interface LockDriver = {
|
|
|
4770
4409
|
}
|
|
4771
4410
|
|
|
4772
4411
|
interface RefreshOptions = {
|
|
4773
|
-
refresh?: boolean
|
|
4774
|
-
refreshEvery?: number
|
|
4412
|
+
refresh?: boolean | undefined
|
|
4413
|
+
refreshEvery?: number | undefined
|
|
4775
4414
|
}
|
|
4776
4415
|
|
|
4777
4416
|
type LockedCallback = (lock: ManagedLock, signal: AbortSignal) => Promise<T> | T
|
|
@@ -4886,16 +4525,16 @@ interface LogEntry = {
|
|
|
4886
4525
|
}
|
|
4887
4526
|
|
|
4888
4527
|
interface LoggerOptions = {
|
|
4889
|
-
format?: 'text' | 'json'
|
|
4528
|
+
format?: 'text' | 'json' | undefined
|
|
4890
4529
|
}
|
|
4891
4530
|
|
|
4892
4531
|
interface LoggingConfigShape = {
|
|
4893
4532
|
channels: Record<string, ChannelConfig>
|
|
4894
|
-
console?: ConsoleSinkConfig
|
|
4533
|
+
console?: ConsoleSinkConfig | undefined
|
|
4895
4534
|
default: string
|
|
4896
|
-
file?: FileSinkConfig
|
|
4897
|
-
requests?: boolean
|
|
4898
|
-
slowQueryMs?: number
|
|
4535
|
+
file?: FileSinkConfig | undefined
|
|
4536
|
+
requests?: boolean | undefined
|
|
4537
|
+
slowQueryMs?: number | undefined
|
|
4899
4538
|
}
|
|
4900
4539
|
|
|
4901
4540
|
type ChannelConfig = { driver: 'console'; level?: LogLevel; format?: 'json' | 'pretty' } | { driver: 'single'; level?: LogLevel; path: string } | { driver: 'daily'; level?: LogLevel; path: string; days?: number } | { driver: 'stack'; level?: LogLevel; channels: string[] } | { driver: 'null' }
|
|
@@ -5318,10 +4957,6 @@ type SafeConversionFormat = 'jpeg' | 'png' | 'webp'
|
|
|
5318
4957
|
|
|
5319
4958
|
## ./metrics `(./src/metrics.ts)`
|
|
5320
4959
|
|
|
5321
|
-
function beginHttp = () => void
|
|
5322
|
-
|
|
5323
|
-
function endHttp = () => void
|
|
5324
|
-
|
|
5325
4960
|
function httpMetrics = () => HttpMetricsSnapshot
|
|
5326
4961
|
|
|
5327
4962
|
function recordHttp = (status: number, ms: number) => void
|
|
@@ -5891,22 +5526,6 @@ class ModelQueryBuilder = {
|
|
|
5891
5526
|
withoutTenancy: () => ModelQueryBuilder<M>
|
|
5892
5527
|
}
|
|
5893
5528
|
|
|
5894
|
-
class MysqlDialect = {
|
|
5895
|
-
new (): MysqlDialect
|
|
5896
|
-
advisoryLockSql: (key: number) => DialectQuery
|
|
5897
|
-
advisoryUnlockSql: (key: number) => DialectQuery
|
|
5898
|
-
autoIncrementColumn: (column: string) => string
|
|
5899
|
-
booleanLiteral: (value: boolean) => string
|
|
5900
|
-
dateExpr: (part: DatePart, column: string) => string
|
|
5901
|
-
hasColumnSql: (table: string, column: string) => DialectQuery
|
|
5902
|
-
hasTableSql: (table: string) => DialectQuery
|
|
5903
|
-
readonly booleanType: 'INTEGER'
|
|
5904
|
-
readonly name: 'mysql'
|
|
5905
|
-
readonly supportsAdvisoryLocks: true
|
|
5906
|
-
readonly supportsTransactionalDdl: false
|
|
5907
|
-
stringType: (length: number) => string
|
|
5908
|
-
}
|
|
5909
|
-
|
|
5910
5529
|
class NPlusOneDetected = {
|
|
5911
5530
|
new (fingerprint: string, count: number, ctx: object | undefined): NPlusOneDetected
|
|
5912
5531
|
readonly count: number
|
|
@@ -5924,31 +5543,6 @@ class NPlusOneError = {
|
|
|
5924
5543
|
readonly status: number
|
|
5925
5544
|
}
|
|
5926
5545
|
|
|
5927
|
-
class OrmContext = {
|
|
5928
|
-
new (): OrmContext
|
|
5929
|
-
globalScopes: Map<ClassRef, Map<string, unknown>>
|
|
5930
|
-
hooks: Map<ClassRef, Map<string, unknown[]>>
|
|
5931
|
-
namedConnections: Map<string, SQLInstance>
|
|
5932
|
-
overrideConnection: SQLInstance | null
|
|
5933
|
-
transitionCallbacks: Map<ClassRef, Map<string, unknown[]>>
|
|
5934
|
-
}
|
|
5935
|
-
|
|
5936
|
-
class PostgresDialect = {
|
|
5937
|
-
new (): PostgresDialect
|
|
5938
|
-
advisoryLockSql: (key: number) => DialectQuery
|
|
5939
|
-
advisoryUnlockSql: (key: number) => DialectQuery
|
|
5940
|
-
autoIncrementColumn: (column: string) => string
|
|
5941
|
-
booleanLiteral: (value: boolean) => string
|
|
5942
|
-
dateExpr: (part: DatePart, column: string) => string
|
|
5943
|
-
hasColumnSql: (table: string, column: string) => DialectQuery
|
|
5944
|
-
hasTableSql: (table: string) => DialectQuery
|
|
5945
|
-
readonly booleanType: 'BOOLEAN'
|
|
5946
|
-
readonly name: 'postgres'
|
|
5947
|
-
readonly supportsAdvisoryLocks: true
|
|
5948
|
-
readonly supportsTransactionalDdl: true
|
|
5949
|
-
stringType: () => string
|
|
5950
|
-
}
|
|
5951
|
-
|
|
5952
5546
|
class QueryBuilder = {
|
|
5953
5547
|
new (table: string, sql: SQLInstance): QueryBuilder
|
|
5954
5548
|
_markUserWhereStart: () => void
|
|
@@ -6073,22 +5667,6 @@ class Seeder = {
|
|
|
6073
5667
|
run: () => Promise<void>
|
|
6074
5668
|
}
|
|
6075
5669
|
|
|
6076
|
-
class SqliteDialect = {
|
|
6077
|
-
new (): SqliteDialect
|
|
6078
|
-
advisoryLockSql: () => DialectQuery | null
|
|
6079
|
-
advisoryUnlockSql: () => DialectQuery | null
|
|
6080
|
-
autoIncrementColumn: (column: string) => string
|
|
6081
|
-
booleanLiteral: (value: boolean) => string
|
|
6082
|
-
dateExpr: (part: DatePart, column: string) => string
|
|
6083
|
-
hasColumnSql: (table: string, column: string) => DialectQuery
|
|
6084
|
-
hasTableSql: (table: string) => DialectQuery
|
|
6085
|
-
readonly booleanType: 'INTEGER'
|
|
6086
|
-
readonly name: 'sqlite'
|
|
6087
|
-
readonly supportsAdvisoryLocks: false
|
|
6088
|
-
readonly supportsTransactionalDdl: true
|
|
6089
|
-
stringType: () => string
|
|
6090
|
-
}
|
|
6091
|
-
|
|
6092
5670
|
class StateError = {
|
|
6093
5671
|
new (model: string, from: string, to: string, detail?: string): StateError
|
|
6094
5672
|
readonly code: string
|
|
@@ -6133,30 +5711,12 @@ class UnsupportedDialectError = {
|
|
|
6133
5711
|
|
|
6134
5712
|
const DB = { table(tableName: string): QueryBuilder; raw<T = Record<string, unknown>>(sql: TemplateStringsArray | string, ...rest: unknown[]): Promise<T[]>; transaction<T>(callback: (tx?: SQLInstance) => Promise<T>, attempts?: number): Promise<T>; beginTransaction(): Promise<ManualTransaction>; onPrimary(): { table(name: string): QueryBuilder; }; currentTx(): unknown | undefined; advisoryLock<T>(key: number, callback: () => Promise<T>): Promise<T>; preventNPlusOne(options?: NPlusOneOptions): void; allowNPlusOne(pattern: string, options?: { once?: boolean; }): void;}
|
|
6135
5713
|
|
|
6136
|
-
const ModelInspector = { load(pattern: string, cwd?: string): Promise<void>; all(): ModelSchema[]; fromClass(ctor: ClassRef): ModelSchema | null;}
|
|
6137
|
-
|
|
6138
5714
|
const relationRegistry = Map<ClassRef, Map<string, RelationMetadata>>
|
|
6139
5715
|
|
|
6140
5716
|
const Schema = { create(table: string, callback: (bp: Blueprint) => void): Promise<void>; createIfNotExists(table: string, callback: (bp: Blueprint) => void): Promise<void>; table(name: string, callback: (bp: Blueprint) => void): Promise<void>; alter(name: string, callback: (bp: Blueprint) => void): Promise<void>; drop(table: string): Promise<void>; dropIfExists(table: string): Promise<void>; rename(from: string, to: string): Promise<void>; hasTable(table: string): Promise<boolean>; hasColumn(table: string, column: string): Promise<boolean>;}
|
|
6141
5717
|
|
|
6142
|
-
const SchemaDiffer = { diff(schemas: ModelSchema[]): Promise<DiffResult>; isEmpty(diff: DiffResult): boolean;}
|
|
6143
|
-
|
|
6144
|
-
const SchemaInspector = { tables(): Promise<string[]>; columns(table: string): Promise<LiveColumn[] | null>; describe(table: string): Promise<LiveTable | null>;}
|
|
6145
|
-
|
|
6146
5718
|
const TransactionContext = AsyncLocalStorage<SQLInstance>
|
|
6147
5719
|
|
|
6148
|
-
function _getConnection = () => SQLInstance
|
|
6149
|
-
|
|
6150
|
-
function _getDbConnectionOverride = () => SQLInstance | null
|
|
6151
|
-
|
|
6152
|
-
function _globalScopeRegistry = () => Map<ClassRef, Map<string, GlobalScopeCallback>>
|
|
6153
|
-
|
|
6154
|
-
function _setDbConnection = (conn: SQLInstance | null) => void
|
|
6155
|
-
|
|
6156
|
-
function _setReadReplicas = (primary: SQLInstance, replicas: SQLInstance[]) => void
|
|
6157
|
-
|
|
6158
|
-
function _suppressHooks = <T>(fn: () => Promise<T>) => Promise<T>
|
|
6159
|
-
|
|
6160
5720
|
function allowNPlusOne = (pattern: string, options?: { once?: boolean;}, ctx?: object | null) => void
|
|
6161
5721
|
|
|
6162
5722
|
function arrayOf = <T = unknown>(mapper?: CastMapper<T>) => ArrayCast<T>
|
|
@@ -6165,16 +5725,8 @@ function belongsTo = (related: () => unknown, options: BelongsToOptions) => (_va
|
|
|
6165
5725
|
|
|
6166
5726
|
function column = { (): ColumnDecorator; (type: ColumnShorthand): ColumnDecorator; (options: ColumnOptions): ColumnDecorator; (type: ColumnShorthand, options: Omit<ColumnOptions, 'type'>): ColumnDecorator;}
|
|
6167
5727
|
|
|
6168
|
-
function createReadWriteRouter = (primary: SQLInstance, replicas: SQLInstance[]) => SQLInstance
|
|
6169
|
-
|
|
6170
|
-
function currentOrmContext = () => OrmContext
|
|
6171
|
-
|
|
6172
5728
|
function DatabaseConfig = (options?: Partial<DatabaseConfigShape>) => DatabaseConfigShape
|
|
6173
5729
|
|
|
6174
|
-
function generateMigrationContent = (className: string, diff: DiffResult) => string
|
|
6175
|
-
|
|
6176
|
-
function getDialect = (name: DialectName) => SqlDialect
|
|
6177
|
-
|
|
6178
5730
|
function hasMany = (related: () => unknown, options: HasManyOptions) => (_value: unknown, context: ClassFieldDecoratorContext) => void
|
|
6179
5731
|
|
|
6180
5732
|
function hasManyThrough = (related: () => unknown, through: () => unknown, options: HasManyThroughOptions) => (_value: unknown, context: ClassFieldDecoratorContext) => void
|
|
@@ -6183,8 +5735,6 @@ function hasOne = (related: () => unknown, options: HasOneOptions) => (_value: u
|
|
|
6183
5735
|
|
|
6184
5736
|
function hasOneThrough = (related: () => unknown, through: () => unknown, options: HasManyThroughOptions) => (_value: unknown, context: ClassFieldDecoratorContext) => void
|
|
6185
5737
|
|
|
6186
|
-
function installOrmObservability = (app: Application) => () => void
|
|
6187
|
-
|
|
6188
5738
|
function isEncryptedCast = (cast: unknown) => cast is EncryptedCastName
|
|
6189
5739
|
|
|
6190
5740
|
function json = <T = unknown>(mapper?: CastMapper<T>) => JsonCast<T>
|
|
@@ -6205,30 +5755,12 @@ function objectOf = <T = unknown>(mapper?: CastMapper<T>) => JsonCast<T>
|
|
|
6205
5755
|
|
|
6206
5756
|
function preventNPlusOne = (options?: NPlusOneOptions) => void
|
|
6207
5757
|
|
|
6208
|
-
function registerConnectionResolver = (fn: ContextConnectionResolver | null) => void
|
|
6209
|
-
|
|
6210
|
-
function registerImplicitBinding = () => void
|
|
6211
|
-
|
|
6212
|
-
function registerModelConnection = (name: string, conn: SQLInstance, dialect?: Dialect) => void
|
|
6213
|
-
|
|
6214
|
-
function resetOrmContext = () => void
|
|
6215
|
-
|
|
6216
|
-
function resolveContainerConnection = () => SQLInstance | undefined
|
|
6217
|
-
|
|
6218
|
-
function resolveSyncOptions = (raw: unknown) => ResolvedSyncOptions
|
|
6219
|
-
|
|
6220
|
-
function setConnectionResolver = (fn: ConnectionResolver | null) => void
|
|
6221
|
-
|
|
6222
5758
|
function SoftDeletes = <TBase extends Constructor>(Base: TBase) => { new (...args: any[]): SoftDeletes; prototype: SoftDeletes<any>.SoftDeletes; softDeletes: boolean; withTrashed<T extends BaseModel>(this: SoftDeleteModelClass<T>): ModelQueryBuilder<T>; onlyTrashed<T extends BaseModel>(this: SoftDeleteModelClass<T>): ModelQueryBuilder<T>;} & TBase
|
|
6223
5759
|
|
|
6224
5760
|
function State = <TBase extends Constructor>(Base: TBase) => { new (...args: any[]): State; prototype: State<any>.State; stateField: string; states?: Record<string, StateDefinition<string, any>>; onTransition<T>(this: { new (...args: any[]): T; }, toState: string, callback: TransitionCallback<T>): void;} & TBase
|
|
6225
5761
|
|
|
6226
|
-
function synchronizeSchema = (options?: SynchronizeOptions) => Promise<DiffResult>
|
|
6227
|
-
|
|
6228
5762
|
function table = (tableName: string, options?: TableOptions) => TableDecoratorBuilder
|
|
6229
5763
|
|
|
6230
|
-
function useOrmContext = (ctx?: OrmContext) => OrmContext
|
|
6231
|
-
|
|
6232
5764
|
interface BelongsTo = {
|
|
6233
5765
|
__@___relation__: 'belongsTo'
|
|
6234
5766
|
__type__: T
|
|
@@ -6246,14 +5778,14 @@ interface CastField = {
|
|
|
6246
5778
|
}
|
|
6247
5779
|
|
|
6248
5780
|
interface ColumnOptions = {
|
|
6249
|
-
cast?: 'boolean' | 'date' | 'datetime' | 'array' | 'integer' | 'json' | 'float' | 'enum' | 'immutable_datetime' | 'encrypted' | 'encrypted:json' | `decimal:${number}` | { get?: (dbValue: unknown) => unknown; set?: (jsValue: unknown) => unknown;} | CastContract<unknown>
|
|
5781
|
+
cast?: 'boolean' | 'date' | 'datetime' | 'array' | 'integer' | 'json' | 'float' | 'enum' | 'immutable_datetime' | 'encrypted' | 'encrypted:json' | `decimal:${number}` | { get?: (dbValue: unknown) => unknown; set?: (jsValue: unknown) => unknown;} | CastContract<unknown> | undefined
|
|
6250
5782
|
default?: unknown
|
|
6251
|
-
enumValues?: Record<string, string | number>
|
|
6252
|
-
index?: boolean
|
|
6253
|
-
nullable?: boolean
|
|
6254
|
-
primary?: boolean
|
|
6255
|
-
type?: 'string' | 'number' | 'boolean' | 'text' | 'datetime' | 'json'
|
|
6256
|
-
unique?: boolean
|
|
5783
|
+
enumValues?: Record<string, string | number> | undefined
|
|
5784
|
+
index?: boolean | undefined
|
|
5785
|
+
nullable?: boolean | undefined
|
|
5786
|
+
primary?: boolean | undefined
|
|
5787
|
+
type?: 'string' | 'number' | 'boolean' | 'text' | 'datetime' | 'json' | undefined
|
|
5788
|
+
unique?: boolean | undefined
|
|
6257
5789
|
}
|
|
6258
5790
|
|
|
6259
5791
|
interface Compose = {
|
|
@@ -6276,29 +5808,13 @@ interface CursorPaginateResult = {
|
|
|
6276
5808
|
|
|
6277
5809
|
interface DatabaseConfigShape = {
|
|
6278
5810
|
driver: 'sqlite' | 'postgres' | 'mysql'
|
|
6279
|
-
pool?: { max?: number; idleTimeout?: number;}
|
|
6280
|
-
replicas?: string[]
|
|
5811
|
+
pool?: { max?: number; idleTimeout?: number;} | undefined
|
|
5812
|
+
replicas?: string[] | undefined
|
|
6281
5813
|
sqlite: { path: string;}
|
|
6282
|
-
synchronize?: boolean | { enabled: boolean; disruptive?: boolean;}
|
|
5814
|
+
synchronize?: boolean | { enabled: boolean; disruptive?: boolean;} | undefined
|
|
6283
5815
|
url: string
|
|
6284
5816
|
}
|
|
6285
5817
|
|
|
6286
|
-
interface DialectQuery = {
|
|
6287
|
-
params: unknown[]
|
|
6288
|
-
sql: string
|
|
6289
|
-
}
|
|
6290
|
-
|
|
6291
|
-
interface DiffResult = {
|
|
6292
|
-
droppedColumns: DroppedColumn[]
|
|
6293
|
-
newColumns: NewColumn[]
|
|
6294
|
-
newTables: NewTable[]
|
|
6295
|
-
}
|
|
6296
|
-
|
|
6297
|
-
interface DroppedColumn = {
|
|
6298
|
-
column: string
|
|
6299
|
-
table: string
|
|
6300
|
-
}
|
|
6301
|
-
|
|
6302
5818
|
interface HasMany = {
|
|
6303
5819
|
__@___relation__: 'hasMany'
|
|
6304
5820
|
__type__: T
|
|
@@ -6306,9 +5822,9 @@ interface HasMany = {
|
|
|
6306
5822
|
|
|
6307
5823
|
interface HasManyThroughOptions = {
|
|
6308
5824
|
firstKey: string
|
|
6309
|
-
localKey?: string
|
|
5825
|
+
localKey?: string | undefined
|
|
6310
5826
|
secondKey: string
|
|
6311
|
-
throughLocalKey?: string
|
|
5827
|
+
throughLocalKey?: string | undefined
|
|
6312
5828
|
}
|
|
6313
5829
|
|
|
6314
5830
|
interface HasOne = {
|
|
@@ -6317,10 +5833,10 @@ interface HasOne = {
|
|
|
6317
5833
|
}
|
|
6318
5834
|
|
|
6319
5835
|
interface KeysetOptions = {
|
|
6320
|
-
column?: string
|
|
6321
|
-
cursor?: string | null
|
|
6322
|
-
direction?: 'asc' | 'desc'
|
|
6323
|
-
limit?: number
|
|
5836
|
+
column?: string | undefined
|
|
5837
|
+
cursor?: string | null | undefined
|
|
5838
|
+
direction?: 'asc' | 'desc' | undefined
|
|
5839
|
+
limit?: number | undefined
|
|
6324
5840
|
}
|
|
6325
5841
|
|
|
6326
5842
|
interface KeysetPaginateResult = {
|
|
@@ -6328,18 +5844,6 @@ interface KeysetPaginateResult = {
|
|
|
6328
5844
|
nextCursor: string | null
|
|
6329
5845
|
}
|
|
6330
5846
|
|
|
6331
|
-
interface LiveColumn = {
|
|
6332
|
-
name: string
|
|
6333
|
-
nullable: boolean
|
|
6334
|
-
primary: boolean
|
|
6335
|
-
rawType: string
|
|
6336
|
-
}
|
|
6337
|
-
|
|
6338
|
-
interface LiveTable = {
|
|
6339
|
-
columns: LiveColumn[]
|
|
6340
|
-
name: string
|
|
6341
|
-
}
|
|
6342
|
-
|
|
6343
5847
|
interface ManualTransaction = {
|
|
6344
5848
|
commit: () => Promise<void>
|
|
6345
5849
|
readonly sql: SQLInstance
|
|
@@ -6358,13 +5862,13 @@ interface ManyToMany = {
|
|
|
6358
5862
|
}
|
|
6359
5863
|
|
|
6360
5864
|
interface ManyToManyOptions = {
|
|
6361
|
-
localKey?: string
|
|
5865
|
+
localKey?: string | undefined
|
|
6362
5866
|
pivotForeignKey: string
|
|
6363
5867
|
pivotRelatedKey: string
|
|
6364
5868
|
pivotTable: string
|
|
6365
|
-
relatedKey?: string
|
|
6366
|
-
withPivot?: string[]
|
|
6367
|
-
withTimestamps?: boolean
|
|
5869
|
+
relatedKey?: string | undefined
|
|
5870
|
+
withPivot?: string[] | undefined
|
|
5871
|
+
withTimestamps?: boolean | undefined
|
|
6368
5872
|
}
|
|
6369
5873
|
|
|
6370
5874
|
interface MigrationEntry = {
|
|
@@ -6384,16 +5888,6 @@ interface MigrationStatus = {
|
|
|
6384
5888
|
ranAt?: Date
|
|
6385
5889
|
}
|
|
6386
5890
|
|
|
6387
|
-
interface ModelColumn = {
|
|
6388
|
-
default: unknown
|
|
6389
|
-
index?: boolean
|
|
6390
|
-
name: string
|
|
6391
|
-
nullable: boolean
|
|
6392
|
-
primary: boolean
|
|
6393
|
-
type: 'string' | 'number' | 'boolean' | 'text' | 'datetime' | 'json' | undefined
|
|
6394
|
-
unique?: boolean
|
|
6395
|
-
}
|
|
6396
|
-
|
|
6397
5891
|
interface ModelObserver = {
|
|
6398
5892
|
created?: (model: T) => Promise<void> | void
|
|
6399
5893
|
creating?: (model: T) => Promise<void> | void
|
|
@@ -6406,20 +5900,12 @@ interface ModelObserver = {
|
|
|
6406
5900
|
updating?: (model: T) => Promise<void> | void
|
|
6407
5901
|
}
|
|
6408
5902
|
|
|
6409
|
-
interface ModelSchema = {
|
|
6410
|
-
columns: ModelColumn[]
|
|
6411
|
-
primaryKey: string
|
|
6412
|
-
softDeletes: boolean
|
|
6413
|
-
table: string
|
|
6414
|
-
timestamps: boolean
|
|
6415
|
-
}
|
|
6416
|
-
|
|
6417
5903
|
interface MorphedByManyOptions = {
|
|
6418
5904
|
morphName: string
|
|
6419
5905
|
parentPivotKey: string
|
|
6420
|
-
pivotTable?: string
|
|
6421
|
-
withPivot?: string[]
|
|
6422
|
-
withTimestamps?: boolean
|
|
5906
|
+
pivotTable?: string | undefined
|
|
5907
|
+
withPivot?: string[] | undefined
|
|
5908
|
+
withTimestamps?: boolean | undefined
|
|
6423
5909
|
}
|
|
6424
5910
|
|
|
6425
5911
|
interface MorphMany = {
|
|
@@ -6428,7 +5914,7 @@ interface MorphMany = {
|
|
|
6428
5914
|
}
|
|
6429
5915
|
|
|
6430
5916
|
interface MorphManyOptions = {
|
|
6431
|
-
localKey?: string
|
|
5917
|
+
localKey?: string | undefined
|
|
6432
5918
|
morphName: string
|
|
6433
5919
|
}
|
|
6434
5920
|
|
|
@@ -6438,7 +5924,7 @@ interface MorphOne = {
|
|
|
6438
5924
|
}
|
|
6439
5925
|
|
|
6440
5926
|
interface MorphOneOptions = {
|
|
6441
|
-
localKey?: string
|
|
5927
|
+
localKey?: string | undefined
|
|
6442
5928
|
morphName: string
|
|
6443
5929
|
}
|
|
6444
5930
|
|
|
@@ -6449,30 +5935,21 @@ interface MorphTo = {
|
|
|
6449
5935
|
|
|
6450
5936
|
interface MorphToManyOptions = {
|
|
6451
5937
|
morphName: string
|
|
6452
|
-
pivotTable?: string
|
|
5938
|
+
pivotTable?: string | undefined
|
|
6453
5939
|
relatedPivotKey: string
|
|
6454
|
-
withPivot?: string[]
|
|
6455
|
-
withTimestamps?: boolean
|
|
5940
|
+
withPivot?: string[] | undefined
|
|
5941
|
+
withTimestamps?: boolean | undefined
|
|
6456
5942
|
}
|
|
6457
5943
|
|
|
6458
5944
|
interface MorphToOptions = {
|
|
6459
|
-
morphForeignKey?: string
|
|
5945
|
+
morphForeignKey?: string | undefined
|
|
6460
5946
|
morphMap: Record<string, () => unknown>
|
|
6461
|
-
morphTypeColumn?: string
|
|
6462
|
-
}
|
|
6463
|
-
|
|
6464
|
-
interface NewColumn = {
|
|
6465
|
-
column: ModelColumn
|
|
6466
|
-
table: string
|
|
6467
|
-
}
|
|
6468
|
-
|
|
6469
|
-
interface NewTable = {
|
|
6470
|
-
schema: ModelSchema
|
|
5947
|
+
morphTypeColumn?: string | undefined
|
|
6471
5948
|
}
|
|
6472
5949
|
|
|
6473
5950
|
interface NPlusOneOptions = {
|
|
6474
|
-
mode?: 'warn' | 'throw'
|
|
6475
|
-
threshold?: number
|
|
5951
|
+
mode?: 'warn' | 'throw' | undefined
|
|
5952
|
+
threshold?: number | undefined
|
|
6476
5953
|
}
|
|
6477
5954
|
|
|
6478
5955
|
interface PaginateMeta = {
|
|
@@ -6526,11 +6003,6 @@ interface RelationMetadata = {
|
|
|
6526
6003
|
withDefault?: boolean | Record<string, unknown> | ((model: unknown) => void)
|
|
6527
6004
|
}
|
|
6528
6005
|
|
|
6529
|
-
interface ResolvedSyncOptions = {
|
|
6530
|
-
disruptive: boolean
|
|
6531
|
-
enabled: boolean
|
|
6532
|
-
}
|
|
6533
|
-
|
|
6534
6006
|
interface ScopeApplicator = {
|
|
6535
6007
|
apply: (query: QueryBuilder) => void
|
|
6536
6008
|
}
|
|
@@ -6548,21 +6020,6 @@ interface SimplePaginateResult = {
|
|
|
6548
6020
|
url: (page: number, baseUrl?: string, query?: Record<string, string>) => string
|
|
6549
6021
|
}
|
|
6550
6022
|
|
|
6551
|
-
interface SqlDialect = {
|
|
6552
|
-
advisoryLockSql: (key: number) => DialectQuery | null
|
|
6553
|
-
advisoryUnlockSql: (key: number) => DialectQuery | null
|
|
6554
|
-
autoIncrementColumn: (column: string) => string
|
|
6555
|
-
booleanLiteral: (value: boolean) => string
|
|
6556
|
-
dateExpr: (part: DatePart, column: string) => string
|
|
6557
|
-
hasColumnSql: (table: string, column: string) => DialectQuery
|
|
6558
|
-
hasTableSql: (table: string) => DialectQuery
|
|
6559
|
-
readonly booleanType: string
|
|
6560
|
-
readonly name: DialectName
|
|
6561
|
-
readonly supportsAdvisoryLocks: boolean
|
|
6562
|
-
readonly supportsTransactionalDdl: boolean
|
|
6563
|
-
stringType: (length: number) => string
|
|
6564
|
-
}
|
|
6565
|
-
|
|
6566
6023
|
interface SQLInstance = {
|
|
6567
6024
|
<T = Record<string, unknown>>(strings: TemplateStringsArray, ...values: unknown[]): Promise<T[]>
|
|
6568
6025
|
begin: <T>(fn: (tx: SQLInstance) => Promise<T>) => Promise<T>
|
|
@@ -6574,10 +6031,6 @@ interface StateDefinition = {
|
|
|
6574
6031
|
guard?: StateGuard<T>
|
|
6575
6032
|
}
|
|
6576
6033
|
|
|
6577
|
-
interface SynchronizeOptions = {
|
|
6578
|
-
disruptive?: boolean
|
|
6579
|
-
}
|
|
6580
|
-
|
|
6581
6034
|
interface TableDecoratorBuilder = {
|
|
6582
6035
|
(target: ClassRef, context?: unknown): void
|
|
6583
6036
|
primaryKey: (key: string) => TableDecoratorBuilder
|
|
@@ -6586,8 +6039,8 @@ interface TableDecoratorBuilder = {
|
|
|
6586
6039
|
}
|
|
6587
6040
|
|
|
6588
6041
|
interface TableOptions = {
|
|
6589
|
-
primaryKey?: string
|
|
6590
|
-
timestamps?: boolean
|
|
6042
|
+
primaryKey?: string | undefined
|
|
6043
|
+
timestamps?: boolean | undefined
|
|
6591
6044
|
}
|
|
6592
6045
|
|
|
6593
6046
|
interface TransitionContext = {
|
|
@@ -6604,12 +6057,8 @@ type ColumnShorthand = 'string' | 'text' | 'integer' | 'number' | 'float' | 'boo
|
|
|
6604
6057
|
|
|
6605
6058
|
type Constructor = new (...args: any[]) => T
|
|
6606
6059
|
|
|
6607
|
-
type ContextConnectionResolver = (ModelClass?: typeof BaseModel) => SQLInstance | null
|
|
6608
|
-
|
|
6609
6060
|
type DatePart = 'date' | 'time' | 'day' | 'month' | 'year'
|
|
6610
6061
|
|
|
6611
|
-
type DialectName = 'sqlite' | 'postgres' | 'mysql'
|
|
6612
|
-
|
|
6613
6062
|
type EncryptedCastName = 'encrypted' | 'encrypted:json'
|
|
6614
6063
|
|
|
6615
6064
|
type FKAction = 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION'
|
|
@@ -6903,7 +6352,7 @@ interface QueueConfigShape = {
|
|
|
6903
6352
|
driver: 'sqlite' | 'redis' | 'sync'
|
|
6904
6353
|
pollInterval: number
|
|
6905
6354
|
queues: string[]
|
|
6906
|
-
workerBootstrap?: string
|
|
6355
|
+
workerBootstrap?: string | undefined
|
|
6907
6356
|
workers: number
|
|
6908
6357
|
}
|
|
6909
6358
|
|
|
@@ -6978,6 +6427,38 @@ type RouteTable = Readonly<Record<string, string>> | ReadonlyMap<string, string>
|
|
|
6978
6427
|
|
|
6979
6428
|
type RouteTarget = string
|
|
6980
6429
|
|
|
6430
|
+
## ./runtime `(./src/runtime.ts)`
|
|
6431
|
+
|
|
6432
|
+
const RUNTIME_MISMATCH_ESCAPE = 'ZT_ALLOW_RUNTIME_MISMATCH'
|
|
6433
|
+
|
|
6434
|
+
function bunBinary = () => string
|
|
6435
|
+
|
|
6436
|
+
function declaredBunFloor = (cwd: string) => { range: string; manifest: string;} | null
|
|
6437
|
+
|
|
6438
|
+
function installedBunVersion = (cwd: string) => { version: string; manifest: string;} | null
|
|
6439
|
+
|
|
6440
|
+
function runtimeBelowFloor = (cwd?: string) => RuntimeFloor | null
|
|
6441
|
+
|
|
6442
|
+
function runtimeBelowFloorMessage = (floor: RuntimeFloor) => string
|
|
6443
|
+
|
|
6444
|
+
function runtimeMismatch = (cwd?: string) => RuntimeMismatch | null
|
|
6445
|
+
|
|
6446
|
+
function runtimeMismatchAllowed = () => boolean
|
|
6447
|
+
|
|
6448
|
+
function runtimeMismatchMessage = (mismatch: RuntimeMismatch) => string
|
|
6449
|
+
|
|
6450
|
+
interface RuntimeFloor = {
|
|
6451
|
+
manifest: string
|
|
6452
|
+
required: string
|
|
6453
|
+
running: string
|
|
6454
|
+
}
|
|
6455
|
+
|
|
6456
|
+
interface RuntimeMismatch = {
|
|
6457
|
+
installed: string
|
|
6458
|
+
manifest: string
|
|
6459
|
+
running: string
|
|
6460
|
+
}
|
|
6461
|
+
|
|
6981
6462
|
## ./scheduler `(./src/scheduler.ts)`
|
|
6982
6463
|
|
|
6983
6464
|
class CronExpression = {
|
|
@@ -6985,10 +6466,12 @@ class CronExpression = {
|
|
|
6985
6466
|
static describe: (expression: string) => string
|
|
6986
6467
|
static isValid: (expression: string) => boolean
|
|
6987
6468
|
static nextRunAfter: (expression: string, from?: Date) => Date | null
|
|
6469
|
+
static nextRunAfterIn: (expression: string, from: Date, timeZone: string) => Date | null
|
|
6988
6470
|
static readonly SEARCH_HORIZON_DAYS: number
|
|
6989
6471
|
dayOfMonth: (v: number | string) => CronExpression
|
|
6990
6472
|
hour: (v: number | string) => CronExpression
|
|
6991
6473
|
matches: (date?: Date) => boolean
|
|
6474
|
+
matchesIn: (date: Date, timeZone: string) => boolean
|
|
6992
6475
|
minute: (v: number | string) => CronExpression
|
|
6993
6476
|
month: (v: number | string) => CronExpression
|
|
6994
6477
|
nextRun: (from?: Date) => Date | null
|
|
@@ -6996,13 +6479,6 @@ class CronExpression = {
|
|
|
6996
6479
|
weekday: (v: number | string) => CronExpression
|
|
6997
6480
|
}
|
|
6998
6481
|
|
|
6999
|
-
class FileScheduleRunStore = {
|
|
7000
|
-
new (_path: string, _keep?: number): FileScheduleRunStore
|
|
7001
|
-
lastFor: (name: string) => ScheduleRunRecord | undefined
|
|
7002
|
-
recent: (limit?: number, name?: string) => ScheduleRunRecord[]
|
|
7003
|
-
record: (run: ScheduleRunRecord) => void
|
|
7004
|
-
}
|
|
7005
|
-
|
|
7006
6482
|
class Schedule = {
|
|
7007
6483
|
new (): Schedule
|
|
7008
6484
|
appendOutputTo?: string
|
|
@@ -7103,6 +6579,13 @@ class SchedulerBuilder = {
|
|
|
7103
6579
|
yearlyOn: (month?: number, dayOfMonth?: number, time?: string) => ScheduledTask
|
|
7104
6580
|
}
|
|
7105
6581
|
|
|
6582
|
+
class SchedulerError = {
|
|
6583
|
+
new (message: string, code?: string, status?: number, context?: Record<string, unknown>): SchedulerError
|
|
6584
|
+
readonly code: string
|
|
6585
|
+
readonly context?: Record<string, unknown> | undefined
|
|
6586
|
+
readonly status: number
|
|
6587
|
+
}
|
|
6588
|
+
|
|
7106
6589
|
class SchedulerManager = {
|
|
7107
6590
|
new (): SchedulerManager
|
|
7108
6591
|
add: (name: string, cronExpression: string, callback: TaskCallback) => ScheduledTask
|
|
@@ -7154,26 +6637,25 @@ class TaskSkipped = {
|
|
|
7154
6637
|
readonly reason: 'lock' | 'window' | 'env' | 'when' | 'skip' | 'overlap'
|
|
7155
6638
|
}
|
|
7156
6639
|
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
6640
|
+
class UnknownTimeZoneError = {
|
|
6641
|
+
new (task: string, timezone: string): UnknownTimeZoneError
|
|
6642
|
+
readonly code: string
|
|
6643
|
+
readonly context?: Record<string, unknown> | undefined
|
|
6644
|
+
readonly status: number
|
|
6645
|
+
}
|
|
7160
6646
|
|
|
7161
6647
|
const Scheduler = SchedulerManager
|
|
7162
6648
|
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
function installScheduleRunLog = (app: Application) => (() => void) | undefined
|
|
7166
|
-
|
|
7167
|
-
function registerSchedule = (manager: SchedulerManager, schedule: Schedule, fallbackName: string) => ScheduledTask | undefined
|
|
7168
|
-
|
|
7169
|
-
function resolveRunLogConfig = (app: Application) => RunLogConfig
|
|
6649
|
+
function isValidTimeZone = (timeZone: string) => boolean
|
|
7170
6650
|
|
|
7171
6651
|
function SchedulerConfig = (options?: Partial<SchedulerConfigShape>) => SchedulerConfigShape
|
|
7172
6652
|
|
|
6653
|
+
function wallClockIn = (date: Date, timeZone: string) => Date
|
|
6654
|
+
|
|
7173
6655
|
interface OverlapLockOptions = {
|
|
7174
|
-
crossProcess?: boolean
|
|
7175
|
-
expiresAfterMinutes?: number
|
|
7176
|
-
refresh?: boolean
|
|
6656
|
+
crossProcess?: boolean | undefined
|
|
6657
|
+
expiresAfterMinutes?: number | undefined
|
|
6658
|
+
refresh?: boolean | undefined
|
|
7177
6659
|
}
|
|
7178
6660
|
|
|
7179
6661
|
interface RunLogConfig = {
|
|
@@ -7240,7 +6722,7 @@ function redactGraph = (value: unknown, options: RedactGraphOptions) => unknown
|
|
|
7240
6722
|
|
|
7241
6723
|
interface RedactGraphOptions = {
|
|
7242
6724
|
circular: string
|
|
7243
|
-
flatten?: (value: unknown) => string | undefined
|
|
6725
|
+
flatten?: ((value: unknown) => string | undefined) | undefined
|
|
7244
6726
|
mask: string
|
|
7245
6727
|
maxDepth: number
|
|
7246
6728
|
sensitive: (key: string) => boolean
|
|
@@ -7376,12 +6858,10 @@ class SessionSecretMissingError = {
|
|
|
7376
6858
|
|
|
7377
6859
|
const Session = SessionAccessor
|
|
7378
6860
|
|
|
7379
|
-
const SESSION_ISSUED_AT_KEY = '_iat'
|
|
7380
|
-
|
|
7381
6861
|
function SessionConfig = (options?: Partial<SessionConfigShape>) => SessionConfigShape
|
|
7382
6862
|
|
|
7383
6863
|
interface CsrfOptions = {
|
|
7384
|
-
secure?: boolean
|
|
6864
|
+
secure?: boolean | undefined
|
|
7385
6865
|
}
|
|
7386
6866
|
|
|
7387
6867
|
interface SessionConfigShape = {
|
|
@@ -7401,7 +6881,7 @@ interface SessionDriver = {
|
|
|
7401
6881
|
}
|
|
7402
6882
|
|
|
7403
6883
|
interface SessionOptions = {
|
|
7404
|
-
driver?: SessionDriver
|
|
6884
|
+
driver?: SessionDriver | undefined
|
|
7405
6885
|
}
|
|
7406
6886
|
|
|
7407
6887
|
interface SessionPayload = {
|
|
@@ -7409,6 +6889,50 @@ interface SessionPayload = {
|
|
|
7409
6889
|
id: string
|
|
7410
6890
|
}
|
|
7411
6891
|
|
|
6892
|
+
## ./shared `(./src/shared.ts)`
|
|
6893
|
+
|
|
6894
|
+
const Str = { camelCase(value: string): string; snakeCase(value: string): string; slugify(value: string): string; titleCase(value: string): string; pascalCase(value: string): string; capitalize(value: string): string; lcfirst(value: string): string; truncate(value: string, maxLength: number, suffix?: string): string; isAlphanumeric(value: string): boolean; padLeft(value: string, length: number, char?: string): string; kebab(value: string): string; squish(value: string): string; finish(value: string, cap: string): string; start(value: string, prefix: string): string; after(value: string, needle: string): string; before(value: string, needle: string): string; afterLast(value: string, needle: string): string; beforeLast(value: string, needle: string): string; contains(value: string, substring: string): boolean; random(length?: number): string; replaceFirst(value: string, search: string, replace: string): string; replaceLast(value: string, search: string, replace: string): string; reverse(value: string): string; words(value: string, maxWords: number, suffix?: string): string; macro(name: string, fn: (...args: unknown[]) => unknown): void;}
|
|
6895
|
+
|
|
6896
|
+
function camelCase = (value: string) => string
|
|
6897
|
+
|
|
6898
|
+
function formatDate = (value: Date | number | string, options?: DateOptions) => string
|
|
6899
|
+
|
|
6900
|
+
function formatMoney = (amount: number, options: MoneyOptions) => string
|
|
6901
|
+
|
|
6902
|
+
function formatNumber = (value: number, options?: NumberOptions) => string
|
|
6903
|
+
|
|
6904
|
+
function pluralize = (value: string) => string
|
|
6905
|
+
|
|
6906
|
+
function singularize = (value: string) => string
|
|
6907
|
+
|
|
6908
|
+
function snakeCase = (value: string) => string
|
|
6909
|
+
|
|
6910
|
+
function tableNameFor = (className: string) => string
|
|
6911
|
+
|
|
6912
|
+
interface DateOptions = {
|
|
6913
|
+
dateStyle?: 'medium' | 'short' | 'full' | 'long' | undefined
|
|
6914
|
+
locale?: string | undefined
|
|
6915
|
+
timeStyle?: 'medium' | 'short' | 'full' | 'long' | undefined
|
|
6916
|
+
timeZone?: string | undefined
|
|
6917
|
+
}
|
|
6918
|
+
|
|
6919
|
+
interface FormatOptions = {
|
|
6920
|
+
locale?: string | undefined
|
|
6921
|
+
}
|
|
6922
|
+
|
|
6923
|
+
interface MoneyOptions = {
|
|
6924
|
+
currency: string
|
|
6925
|
+
fractionDigits?: number | undefined
|
|
6926
|
+
locale?: string | undefined
|
|
6927
|
+
minorUnits?: boolean | undefined
|
|
6928
|
+
}
|
|
6929
|
+
|
|
6930
|
+
interface NumberOptions = {
|
|
6931
|
+
locale?: string | undefined
|
|
6932
|
+
maximumFractionDigits?: number | undefined
|
|
6933
|
+
minimumFractionDigits?: number | undefined
|
|
6934
|
+
}
|
|
6935
|
+
|
|
7412
6936
|
## ./storage `(./src/storage.ts)`
|
|
7413
6937
|
|
|
7414
6938
|
class DiskNotConfiguredError = {
|
|
@@ -7570,15 +7094,13 @@ class UnsupportedOperationError = {
|
|
|
7570
7094
|
|
|
7571
7095
|
const Storage = StorageManager
|
|
7572
7096
|
|
|
7573
|
-
function mountsFrom = (config: StorageConfigShape) => Mount[]
|
|
7574
|
-
|
|
7575
7097
|
function StorageConfig = (options?: Partial<StorageConfigShape>) => StorageConfigShape
|
|
7576
7098
|
|
|
7577
7099
|
interface DiskServeConfig = {
|
|
7578
|
-
expiresIn?: number
|
|
7579
|
-
headers?: Record<string, string>
|
|
7100
|
+
expiresIn?: number | undefined
|
|
7101
|
+
headers?: Record<string, string> | undefined
|
|
7580
7102
|
path: string
|
|
7581
|
-
signed?: boolean
|
|
7103
|
+
signed?: boolean | undefined
|
|
7582
7104
|
}
|
|
7583
7105
|
|
|
7584
7106
|
interface FakeStoredFile = {
|
|
@@ -7592,24 +7114,24 @@ interface FakeStoredFile = {
|
|
|
7592
7114
|
interface LocalDiskConfig = {
|
|
7593
7115
|
driver: 'local'
|
|
7594
7116
|
root: string
|
|
7595
|
-
serve?: DiskServeConfig
|
|
7596
|
-
url?: string
|
|
7117
|
+
serve?: DiskServeConfig | undefined
|
|
7118
|
+
url?: string | undefined
|
|
7597
7119
|
}
|
|
7598
7120
|
|
|
7599
7121
|
interface PutOptions = {
|
|
7600
|
-
contentType?: string
|
|
7601
|
-
visibility?: 'public' | 'private'
|
|
7122
|
+
contentType?: string | undefined
|
|
7123
|
+
visibility?: 'public' | 'private' | undefined
|
|
7602
7124
|
}
|
|
7603
7125
|
|
|
7604
7126
|
interface S3DiskConfig = {
|
|
7605
7127
|
bucket: string
|
|
7606
7128
|
driver: 's3'
|
|
7607
|
-
endpoint?: string
|
|
7129
|
+
endpoint?: string | undefined
|
|
7608
7130
|
key: string
|
|
7609
7131
|
region: string
|
|
7610
7132
|
secret: string
|
|
7611
|
-
serve?: DiskServeConfig
|
|
7612
|
-
url?: string
|
|
7133
|
+
serve?: DiskServeConfig | undefined
|
|
7134
|
+
url?: string | undefined
|
|
7613
7135
|
}
|
|
7614
7136
|
|
|
7615
7137
|
interface StorageConfigShape = {
|
|
@@ -7634,8 +7156,8 @@ interface StorageDriver = {
|
|
|
7634
7156
|
}
|
|
7635
7157
|
|
|
7636
7158
|
interface StorageFilesOptions = {
|
|
7637
|
-
mounts?: Mount[]
|
|
7638
|
-
storage?: StorageManager
|
|
7159
|
+
mounts?: Mount[] | undefined
|
|
7160
|
+
storage?: StorageManager | undefined
|
|
7639
7161
|
}
|
|
7640
7162
|
|
|
7641
7163
|
type DiskConfig = LocalDiskConfig | S3DiskConfig
|
|
@@ -7824,6 +7346,7 @@ class TestResponse = {
|
|
|
7824
7346
|
assertHeaderMissing: (name: string) => TestResponse
|
|
7825
7347
|
assertInertia: (component?: string, props?: Record<string, unknown>) => TestResponse
|
|
7826
7348
|
assertInertiaProp: (key: string, value?: unknown) => TestResponse
|
|
7349
|
+
assertInertiaRedirect: (url: string, status?: number) => TestResponse
|
|
7827
7350
|
assertInvalid: (fields?: string | string[] | Record<string, string>) => TestResponse
|
|
7828
7351
|
assertJson: (expected: Record<string, unknown>) => TestResponse
|
|
7829
7352
|
assertJsonCount: (count: number, key?: string) => TestResponse
|
|
@@ -7898,16 +7421,16 @@ interface InertiaPage = {
|
|
|
7898
7421
|
}
|
|
7899
7422
|
|
|
7900
7423
|
interface MigrateDatabaseOptions = {
|
|
7901
|
-
connection?: SQLInstance
|
|
7902
|
-
path?: string
|
|
7903
|
-
table?: string
|
|
7424
|
+
connection?: SQLInstance | undefined
|
|
7425
|
+
path?: string | undefined
|
|
7426
|
+
table?: string | undefined
|
|
7904
7427
|
}
|
|
7905
7428
|
|
|
7906
7429
|
interface RefreshDatabaseOptions = {
|
|
7907
|
-
connection?: SQLInstance
|
|
7908
|
-
migrate?: string | boolean
|
|
7909
|
-
setup?: (db: SQLInstance) => void | Promise<void>
|
|
7910
|
-
teardown?: (db: SQLInstance) => void | Promise<void>
|
|
7430
|
+
connection?: SQLInstance | undefined
|
|
7431
|
+
migrate?: string | boolean | undefined
|
|
7432
|
+
setup?: ((db: SQLInstance) => void | Promise<void>) | undefined
|
|
7433
|
+
teardown?: ((db: SQLInstance) => void | Promise<void>) | undefined
|
|
7911
7434
|
}
|
|
7912
7435
|
|
|
7913
7436
|
interface TestFileInput = {
|
|
@@ -8241,14 +7764,6 @@ const Validator = { check<S extends Record<string, FieldRule>>(data: Record<s
|
|
|
8241
7764
|
|
|
8242
7765
|
function registerDbRuleRunner = (runner: DbRuleRunner) => void
|
|
8243
7766
|
|
|
8244
|
-
function runStringRules = (data: Record<string, unknown>, rules: StringRules) => Record<string, string[]>
|
|
8245
|
-
|
|
8246
|
-
function runStringRulesAsync = (data: Record<string, unknown>, rules: StringRules) => Promise<Record<string, string[]>>
|
|
8247
|
-
|
|
8248
|
-
function runValidation = <S extends Schema>(schema: S, input: Record<string, unknown>) => ValidationOutcome<unknown>
|
|
8249
|
-
|
|
8250
|
-
function runValidationAsync = <S extends Schema>(schema: S, input: Record<string, unknown>) => Promise<ValidationOutcome<unknown>>
|
|
8251
|
-
|
|
8252
7767
|
function validate = <S extends Record<string, FieldRule>>(ctx: HttpContext, factory: (rules: RuleBuilder) => S) => Promise<Infer<ExtractDefs<S>>>
|
|
8253
7768
|
|
|
8254
7769
|
function ValidatorConfig = (options?: Partial<ValidatorConfigShape>) => ValidatorConfigShape
|
|
@@ -8275,7 +7790,7 @@ interface FieldRuleDefinition = {
|
|
|
8275
7790
|
}
|
|
8276
7791
|
|
|
8277
7792
|
interface UniqueOptions = {
|
|
8278
|
-
ignoreId?: string | number
|
|
7793
|
+
ignoreId?: string | number | undefined
|
|
8279
7794
|
}
|
|
8280
7795
|
|
|
8281
7796
|
interface ValidatorConfigShape = {
|
|
@@ -8289,8 +7804,6 @@ type InferFieldType = F['type'] extends 'string' ? string : F['type'] extends 'n
|
|
|
8289
7804
|
|
|
8290
7805
|
type Schema = { [x: string]: FieldRuleDefinition;}
|
|
8291
7806
|
|
|
8292
|
-
type StringRules = { [x: string]: string | string[];}
|
|
8293
|
-
|
|
8294
7807
|
type ValidationErrors = { [x: string]: string;}
|
|
8295
7808
|
|
|
8296
7809
|
type ValidationOutcome = ValidationResult<T> | ValidationFailure
|
|
@@ -8309,10 +7822,6 @@ class SafeHtml = {
|
|
|
8309
7822
|
toString: () => string
|
|
8310
7823
|
}
|
|
8311
7824
|
|
|
8312
|
-
const VIEW_COMPONENT_PROP = '__zerotalViewComponent'
|
|
8313
|
-
|
|
8314
|
-
const VIEW_COMPONENT_SYMBOL = typeof VIEW_COMPONENT_SYMBOL
|
|
8315
|
-
|
|
8316
7825
|
function defineLayout = <LP extends Record<string, unknown>>(Layout: (props: LP & { children?: unknown;}) => SafeHtml) => <PP extends Record<string, unknown> = Record<string, never>>(Page: (props: PP & { children?: unknown;}) => SafeHtml) => (props: LP & PP) => SafeHtml
|
|
8317
7826
|
|
|
8318
7827
|
function definePage = <P extends Record<string, unknown> = Record<string, unknown>>(component: (ctx: HttpContext, params: P) => SafeHtml | string | Promise<SafeHtml | string>) => typeof component
|
|
@@ -8323,8 +7832,6 @@ function Fragment = ({ children }: { children?: unknown;}) => SafeHtml
|
|
|
8323
7832
|
|
|
8324
7833
|
function Raw = ({ html }: { html: string;}) => SafeHtml
|
|
8325
7834
|
|
|
8326
|
-
function registerViewFileRouteResolver = () => void
|
|
8327
|
-
|
|
8328
7835
|
function safe = (html: string) => SafeHtml
|
|
8329
7836
|
|
|
8330
7837
|
type Children = unknown
|