@orieljs/framework 0.1.0-alpha.3 → 0.1.0-alpha.5
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/dist/{chunk-WEGTH46M.js → chunk-A5XRLEWM.js} +3 -3
- package/dist/{chunk-3ZRPBRAE.js → chunk-BSQKOLSK.js} +5 -1
- package/dist/chunk-BSQKOLSK.js.map +1 -0
- package/dist/{chunk-IRHK7GH7.js → chunk-PM5YTG57.js} +138 -3
- package/dist/chunk-PM5YTG57.js.map +1 -0
- package/dist/{chunk-I2OMKIQZ.js → chunk-WNJP46B7.js} +2770 -204
- package/dist/chunk-WNJP46B7.js.map +1 -0
- package/dist/contracts.d.ts +197 -132
- package/dist/contracts.js +5 -1
- package/dist/index.d.ts +920 -323
- package/dist/index.js +1340 -2122
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime.js +3 -3
- package/dist/{testing--F6FODc_.d.ts → testing-BErengYY.d.ts} +290 -91
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +3 -3
- package/package.json +30 -30
- package/dist/chunk-3ZRPBRAE.js.map +0 -1
- package/dist/chunk-HU43NADT.js +0 -745
- package/dist/chunk-HU43NADT.js.map +0 -1
- package/dist/chunk-I2OMKIQZ.js.map +0 -1
- package/dist/chunk-IRHK7GH7.js.map +0 -1
- package/dist/chunk-S7YC43IH.js +0 -93
- package/dist/chunk-S7YC43IH.js.map +0 -1
- package/dist/chunk-TIE5OAMF.js +0 -474
- package/dist/chunk-TIE5OAMF.js.map +0 -1
- package/dist/chunk-UPZAML2Q.js +0 -3653
- package/dist/chunk-UPZAML2Q.js.map +0 -1
- package/dist/jsx-runtime-CZ6JqBQo.d.ts +0 -345
- /package/dist/{chunk-WEGTH46M.js.map → chunk-A5XRLEWM.js.map} +0 -0
package/dist/contracts.d.ts
CHANGED
|
@@ -35,134 +35,6 @@ interface Container {
|
|
|
35
35
|
}
|
|
36
36
|
declare const Container: Token<Container>;
|
|
37
37
|
|
|
38
|
-
interface ServiceProvider {
|
|
39
|
-
/** Bind things into the container. Synchronous. Don't resolve other services here. */
|
|
40
|
-
register?(): void;
|
|
41
|
-
/** Runs after every provider is registered. May be async (e.g. importing route files). */
|
|
42
|
-
boot?(): void | Promise<void>;
|
|
43
|
-
}
|
|
44
|
-
type ServiceProviderClass = new (app: Application) => ServiceProvider;
|
|
45
|
-
interface Application extends Container {
|
|
46
|
-
readonly version: string;
|
|
47
|
-
basePath(path?: string): string;
|
|
48
|
-
appPath(path?: string): string;
|
|
49
|
-
bootstrapPath(path?: string): string;
|
|
50
|
-
configPath(path?: string): string;
|
|
51
|
-
databasePath(path?: string): string;
|
|
52
|
-
publicPath(path?: string): string;
|
|
53
|
-
resourcePath(path?: string): string;
|
|
54
|
-
storagePath(path?: string): string;
|
|
55
|
-
/** With no args returns the environment name. With args returns whether it matches any of them. */
|
|
56
|
-
environment(): string;
|
|
57
|
-
environment(...environments: string[]): boolean;
|
|
58
|
-
isProduction(): boolean;
|
|
59
|
-
isLocal(): boolean;
|
|
60
|
-
runningInConsole(): boolean;
|
|
61
|
-
/** Mark the app as running in the console (the CLI entry point calls this). Defaults to true. */
|
|
62
|
-
setRunningInConsole(value?: boolean): void;
|
|
63
|
-
runningUnitTests(): boolean;
|
|
64
|
-
/** Registers the provider. If the app is already booted, the provider is booted immediately. */
|
|
65
|
-
register(provider: ServiceProvider | ServiceProviderClass): Promise<ServiceProvider>;
|
|
66
|
-
getProviders(): ServiceProvider[];
|
|
67
|
-
boot(): Promise<void>;
|
|
68
|
-
isBooted(): boolean;
|
|
69
|
-
booting(callback: (app: Application) => void | Promise<void>): void;
|
|
70
|
-
booted(callback: (app: Application) => void | Promise<void>): void;
|
|
71
|
-
/** Handle one HTTP request in a fresh request scope via the bound HttpKernel. */
|
|
72
|
-
handle(request: Request): Promise<Response>;
|
|
73
|
-
/** Register a callback that terminate() runs, in registration order. */
|
|
74
|
-
terminating(callback: () => void | Promise<void>): void;
|
|
75
|
-
terminate(): Promise<void>;
|
|
76
|
-
}
|
|
77
|
-
declare const Application: Token<Application>;
|
|
78
|
-
interface ExceptionHandler {
|
|
79
|
-
report(error: unknown): Promise<void>;
|
|
80
|
-
shouldReport(error: unknown): boolean;
|
|
81
|
-
/** `request` is the scoped HttpRequest (Contracts/Http) when available, else the raw Request. */
|
|
82
|
-
render(request: unknown, error: unknown): Promise<Response>;
|
|
83
|
-
}
|
|
84
|
-
declare const ExceptionHandler: Token<ExceptionHandler>;
|
|
85
|
-
/** Paths passed to Application.configure().withRouting(). Routing (Wave 1) loads them. */
|
|
86
|
-
interface RoutingPaths {
|
|
87
|
-
web?: string;
|
|
88
|
-
api?: string;
|
|
89
|
-
console?: string;
|
|
90
|
-
health?: string;
|
|
91
|
-
apiPrefix: string;
|
|
92
|
-
}
|
|
93
|
-
declare const RoutingPaths: Token<RoutingPaths>;
|
|
94
|
-
/** The object passed to Application.configure().withExceptions(e => …), like Laravel's Exceptions class. */
|
|
95
|
-
interface ExceptionsConfigurator {
|
|
96
|
-
/** Custom reporting. Return false to stop the default logging. */
|
|
97
|
-
report(callback: (error: unknown) => void | boolean | Promise<void | boolean>): this;
|
|
98
|
-
/** Custom rendering. Return undefined to fall through to the default rendering. */
|
|
99
|
-
render(callback: (error: unknown, request: unknown) => Response | undefined | Promise<Response | undefined>): this;
|
|
100
|
-
/** Never report errors of these classes. */
|
|
101
|
-
dontReport(...classes: Array<abstract new (...args: never[]) => Error>): this;
|
|
102
|
-
}
|
|
103
|
-
/** Callbacks collected by withMiddleware()/withExceptions(); invoked by Http / the exception handler (Wave 1). */
|
|
104
|
-
type ConfigCallbacks<T> = Array<(configurator: T) => void>;
|
|
105
|
-
/** Typed as unknown here because MiddlewareConfigurator lives in Contracts/Http; Http casts on use. */
|
|
106
|
-
declare const MiddlewareCallbacks: Token<ConfigCallbacks<unknown>>;
|
|
107
|
-
declare const ExceptionCallbacks: Token<ConfigCallbacks<ExceptionsConfigurator>>;
|
|
108
|
-
|
|
109
|
-
interface ConfigRepository {
|
|
110
|
-
has(key: string): boolean;
|
|
111
|
-
/** Dot notation: get('database.connections.sqlite.database'). */
|
|
112
|
-
get<T = unknown>(key: string, defaultValue?: T): T;
|
|
113
|
-
set(key: string, value: unknown): void;
|
|
114
|
-
set(values: Record<string, unknown>): void;
|
|
115
|
-
push(key: string, value: unknown): void;
|
|
116
|
-
all(): Record<string, unknown>;
|
|
117
|
-
}
|
|
118
|
-
declare const ConfigRepository: Token<ConfigRepository>;
|
|
119
|
-
|
|
120
|
-
interface Arrayable<T = unknown> {
|
|
121
|
-
toArray(): T;
|
|
122
|
-
}
|
|
123
|
-
interface Jsonable {
|
|
124
|
-
toJson(): string;
|
|
125
|
-
}
|
|
126
|
-
interface Htmlable {
|
|
127
|
-
toHtml(): string;
|
|
128
|
-
}
|
|
129
|
-
/** Anything a controller can return that knows how to become a Response. */
|
|
130
|
-
interface Responsable {
|
|
131
|
-
toResponse(request: unknown): Response | Promise<Response>;
|
|
132
|
-
}
|
|
133
|
-
/** The minimal collection surface contracts rely on (implemented by @orieljs/collections). */
|
|
134
|
-
interface Enumerable<T> extends Iterable<T>, Arrayable<unknown[]> {
|
|
135
|
-
all(): T[];
|
|
136
|
-
count(): number;
|
|
137
|
-
isEmpty(): boolean;
|
|
138
|
-
}
|
|
139
|
-
interface ClassRegistry {
|
|
140
|
-
/** Registers under `name` (default: cls.name). Throws if the name is already taken by a different class. */
|
|
141
|
-
register(cls: Class<unknown>, name?: string): string;
|
|
142
|
-
nameOf(cls: Class<unknown>): string | undefined;
|
|
143
|
-
resolve<T = unknown>(name: string): Class<T>;
|
|
144
|
-
has(name: string): boolean;
|
|
145
|
-
}
|
|
146
|
-
declare const ClassRegistry: Token<ClassRegistry>;
|
|
147
|
-
|
|
148
|
-
type PipeNext<T> = (passable: T) => Promise<unknown>;
|
|
149
|
-
type PipeClosure<T> = (passable: T, next: PipeNext<T>) => Promise<unknown> | unknown;
|
|
150
|
-
/** A class resolved from the container whose `via` method (default 'handle') is called; or a string alias 'name:param1,param2'. */
|
|
151
|
-
type Pipe<T> = PipeClosure<T> | Class<object> | string;
|
|
152
|
-
interface Pipeline<T = unknown> {
|
|
153
|
-
send(passable: T): this;
|
|
154
|
-
through(pipes: ReadonlyArray<Pipe<T>>): this;
|
|
155
|
-
pipe(...pipes: Array<Pipe<T>>): this;
|
|
156
|
-
/** Method called on class pipes. Default 'handle'. */
|
|
157
|
-
via(method: string): this;
|
|
158
|
-
then<R>(destination: (passable: T) => R | Promise<R>): Promise<R>;
|
|
159
|
-
thenReturn(): Promise<T>;
|
|
160
|
-
}
|
|
161
|
-
interface PipelineFactory {
|
|
162
|
-
make<T>(): Pipeline<T>;
|
|
163
|
-
}
|
|
164
|
-
declare const PipelineFactory: Token<PipelineFactory>;
|
|
165
|
-
|
|
166
38
|
/** The session of the current request (scoped). Loaded and saved by the StartSession middleware. */
|
|
167
39
|
interface Session {
|
|
168
40
|
getId(): string;
|
|
@@ -261,6 +133,8 @@ interface HttpRequest {
|
|
|
261
133
|
header(name: string, defaultValue: string): string;
|
|
262
134
|
bearerToken(): string | undefined;
|
|
263
135
|
ip(): string | undefined;
|
|
136
|
+
/** The raw body as text (Laravel's getContent()); '' when there is none. */
|
|
137
|
+
content(): string;
|
|
264
138
|
expectsJson(): boolean;
|
|
265
139
|
ajax(): boolean;
|
|
266
140
|
query<T = unknown>(key?: string, defaultValue?: T): T;
|
|
@@ -328,6 +202,137 @@ interface ResponseFactory {
|
|
|
328
202
|
}
|
|
329
203
|
declare const ResponseFactory: Token<ResponseFactory>;
|
|
330
204
|
|
|
205
|
+
interface ServiceProvider {
|
|
206
|
+
/** Bind things into the container. Synchronous. Don't resolve other services here. */
|
|
207
|
+
register?(): void;
|
|
208
|
+
/** Runs after every provider is registered. May be async (e.g. importing route files). */
|
|
209
|
+
boot?(): void | Promise<void>;
|
|
210
|
+
}
|
|
211
|
+
type ServiceProviderClass = new (app: Application) => ServiceProvider;
|
|
212
|
+
interface Application extends Container {
|
|
213
|
+
readonly version: string;
|
|
214
|
+
basePath(path?: string): string;
|
|
215
|
+
appPath(path?: string): string;
|
|
216
|
+
bootstrapPath(path?: string): string;
|
|
217
|
+
configPath(path?: string): string;
|
|
218
|
+
databasePath(path?: string): string;
|
|
219
|
+
publicPath(path?: string): string;
|
|
220
|
+
resourcePath(path?: string): string;
|
|
221
|
+
storagePath(path?: string): string;
|
|
222
|
+
/** With no args returns the environment name. With args returns whether it matches any of them. */
|
|
223
|
+
environment(): string;
|
|
224
|
+
environment(...environments: string[]): boolean;
|
|
225
|
+
isProduction(): boolean;
|
|
226
|
+
isLocal(): boolean;
|
|
227
|
+
runningInConsole(): boolean;
|
|
228
|
+
/** Mark the app as running in the console (the CLI entry point calls this). Defaults to true. */
|
|
229
|
+
setRunningInConsole(value?: boolean): void;
|
|
230
|
+
runningUnitTests(): boolean;
|
|
231
|
+
/** Registers the provider. If the app is already booted, the provider is booted immediately. */
|
|
232
|
+
register(provider: ServiceProvider | ServiceProviderClass): Promise<ServiceProvider>;
|
|
233
|
+
getProviders(): ServiceProvider[];
|
|
234
|
+
boot(): Promise<void>;
|
|
235
|
+
isBooted(): boolean;
|
|
236
|
+
booting(callback: (app: Application) => void | Promise<void>): void;
|
|
237
|
+
booted(callback: (app: Application) => void | Promise<void>): void;
|
|
238
|
+
/** Handle one HTTP request in a fresh request scope via the bound HttpKernel. */
|
|
239
|
+
handle(request: Request): Promise<Response>;
|
|
240
|
+
/** Register a callback that terminate() runs, in registration order. */
|
|
241
|
+
terminating(callback: () => void | Promise<void>): void;
|
|
242
|
+
terminate(): Promise<void>;
|
|
243
|
+
}
|
|
244
|
+
declare const Application: Token<Application>;
|
|
245
|
+
interface ExceptionHandler {
|
|
246
|
+
report(error: unknown): Promise<void>;
|
|
247
|
+
shouldReport(error: unknown): boolean;
|
|
248
|
+
/** `request` is the scoped HttpRequest (Contracts/Http) when available, else the raw Request. */
|
|
249
|
+
render(request: unknown, error: unknown): Promise<Response>;
|
|
250
|
+
}
|
|
251
|
+
declare const ExceptionHandler: Token<ExceptionHandler>;
|
|
252
|
+
/** Paths passed to Application.configure().withRouting(). Routing (Wave 1) loads them. */
|
|
253
|
+
interface RoutingPaths {
|
|
254
|
+
/** One route file or several, loaded in order (Laravel's `withRouting(web: [...])`). */
|
|
255
|
+
web?: string | string[];
|
|
256
|
+
api?: string | string[];
|
|
257
|
+
console?: string;
|
|
258
|
+
health?: string;
|
|
259
|
+
apiPrefix: string;
|
|
260
|
+
}
|
|
261
|
+
declare const RoutingPaths: Token<RoutingPaths>;
|
|
262
|
+
/** The object passed to Application.configure().withExceptions(e => …), like Laravel's Exceptions class. */
|
|
263
|
+
interface ExceptionsConfigurator {
|
|
264
|
+
/** Custom reporting. Return false to stop the default logging. */
|
|
265
|
+
report(callback: (error: unknown) => void | boolean | Promise<void | boolean>): this;
|
|
266
|
+
/** Custom rendering. Return undefined to fall through to the default rendering. */
|
|
267
|
+
render(callback: (error: unknown, request: unknown) => Response | undefined | Promise<Response | undefined>): this;
|
|
268
|
+
/** Never report errors of these classes. */
|
|
269
|
+
dontReport(...classes: Array<abstract new (...args: never[]) => Error>): this;
|
|
270
|
+
/** Render errors as JSON when the callback returns true, whatever the Accept header. */
|
|
271
|
+
shouldRenderJsonWhen(callback: (request: HttpRequest, error: unknown) => boolean): this;
|
|
272
|
+
}
|
|
273
|
+
/** Callbacks collected by withMiddleware()/withExceptions(); invoked by Http / the exception handler (Wave 1). */
|
|
274
|
+
type ConfigCallbacks<T> = Array<(configurator: T) => void>;
|
|
275
|
+
/** Typed as unknown here because MiddlewareConfigurator lives in Contracts/Http; Http casts on use. */
|
|
276
|
+
declare const MiddlewareCallbacks: Token<ConfigCallbacks<unknown>>;
|
|
277
|
+
declare const ExceptionCallbacks: Token<ConfigCallbacks<ExceptionsConfigurator>>;
|
|
278
|
+
|
|
279
|
+
interface ConfigRepository {
|
|
280
|
+
has(key: string): boolean;
|
|
281
|
+
/** Dot notation: get('database.connections.sqlite.database'). */
|
|
282
|
+
get<T = unknown>(key: string, defaultValue?: T): T;
|
|
283
|
+
set(key: string, value: unknown): void;
|
|
284
|
+
set(values: Record<string, unknown>): void;
|
|
285
|
+
push(key: string, value: unknown): void;
|
|
286
|
+
all(): Record<string, unknown>;
|
|
287
|
+
}
|
|
288
|
+
declare const ConfigRepository: Token<ConfigRepository>;
|
|
289
|
+
|
|
290
|
+
interface Arrayable<T = unknown> {
|
|
291
|
+
toArray(): T;
|
|
292
|
+
}
|
|
293
|
+
interface Jsonable {
|
|
294
|
+
toJson(): string;
|
|
295
|
+
}
|
|
296
|
+
interface Htmlable {
|
|
297
|
+
toHtml(): string;
|
|
298
|
+
}
|
|
299
|
+
/** Anything a controller can return that knows how to become a Response. */
|
|
300
|
+
interface Responsable {
|
|
301
|
+
toResponse(request: unknown): Response | Promise<Response>;
|
|
302
|
+
}
|
|
303
|
+
/** The minimal collection surface contracts rely on (implemented by @orieljs/collections). */
|
|
304
|
+
interface Enumerable<T> extends Iterable<T>, Arrayable<unknown[]> {
|
|
305
|
+
all(): T[];
|
|
306
|
+
count(): number;
|
|
307
|
+
isEmpty(): boolean;
|
|
308
|
+
}
|
|
309
|
+
interface ClassRegistry {
|
|
310
|
+
/** Registers under `name` (default: cls.name). Throws if the name is already taken by a different class. */
|
|
311
|
+
register(cls: Class<unknown>, name?: string): string;
|
|
312
|
+
nameOf(cls: Class<unknown>): string | undefined;
|
|
313
|
+
resolve<T = unknown>(name: string): Class<T>;
|
|
314
|
+
has(name: string): boolean;
|
|
315
|
+
}
|
|
316
|
+
declare const ClassRegistry: Token<ClassRegistry>;
|
|
317
|
+
|
|
318
|
+
type PipeNext<T> = (passable: T) => Promise<unknown>;
|
|
319
|
+
type PipeClosure<T> = (passable: T, next: PipeNext<T>) => Promise<unknown> | unknown;
|
|
320
|
+
/** A class resolved from the container whose `via` method (default 'handle') is called; or a string alias 'name:param1,param2'. */
|
|
321
|
+
type Pipe<T> = PipeClosure<T> | Class<object> | string;
|
|
322
|
+
interface Pipeline<T = unknown> {
|
|
323
|
+
send(passable: T): this;
|
|
324
|
+
through(pipes: ReadonlyArray<Pipe<T>>): this;
|
|
325
|
+
pipe(...pipes: Array<Pipe<T>>): this;
|
|
326
|
+
/** Method called on class pipes. Default 'handle'. */
|
|
327
|
+
via(method: string): this;
|
|
328
|
+
then<R>(destination: (passable: T) => R | Promise<R>): Promise<R>;
|
|
329
|
+
thenReturn(): Promise<T>;
|
|
330
|
+
}
|
|
331
|
+
interface PipelineFactory {
|
|
332
|
+
make<T>(): Pipeline<T>;
|
|
333
|
+
}
|
|
334
|
+
declare const PipelineFactory: Token<PipelineFactory>;
|
|
335
|
+
|
|
331
336
|
/** Public method names of a controller (excludes non-function members). */
|
|
332
337
|
type ActionMethods<C> = {
|
|
333
338
|
[K in keyof C]: C[K] extends (...args: any[]) => unknown ? K : never;
|
|
@@ -345,7 +350,7 @@ interface Route {
|
|
|
345
350
|
readonly uri: string;
|
|
346
351
|
getName(): string | undefined;
|
|
347
352
|
name(name: string): this;
|
|
348
|
-
middleware(...middleware: MiddlewareReference[]): this;
|
|
353
|
+
middleware(...middleware: Array<MiddlewareReference | readonly MiddlewareReference[]>): this;
|
|
349
354
|
withoutMiddleware(...middleware: MiddlewareReference[]): this;
|
|
350
355
|
where(parameter: string, pattern: string): this;
|
|
351
356
|
where(patterns: Record<string, string>): this;
|
|
@@ -353,7 +358,7 @@ interface Route {
|
|
|
353
358
|
interface RouteRegistrar {
|
|
354
359
|
prefix(prefix: string): RouteRegistrar;
|
|
355
360
|
name(prefix: string): RouteRegistrar;
|
|
356
|
-
middleware(...middleware: MiddlewareReference[]): RouteRegistrar;
|
|
361
|
+
middleware(...middleware: Array<MiddlewareReference | readonly MiddlewareReference[]>): RouteRegistrar;
|
|
357
362
|
controller(controller: Class<unknown>): RouteRegistrar;
|
|
358
363
|
group(routes: () => void | Promise<void>): Promise<void>;
|
|
359
364
|
}
|
|
@@ -390,7 +395,7 @@ interface Router {
|
|
|
390
395
|
fallback(action: RouteAction): Route;
|
|
391
396
|
prefix(prefix: string): RouteRegistrar;
|
|
392
397
|
name(prefix: string): RouteRegistrar;
|
|
393
|
-
middleware(...middleware: MiddlewareReference[]): RouteRegistrar;
|
|
398
|
+
middleware(...middleware: Array<MiddlewareReference | readonly MiddlewareReference[]>): RouteRegistrar;
|
|
394
399
|
controller(controller: Class<unknown>): RouteRegistrar;
|
|
395
400
|
/** Explicit model binding: Route.model('author', User). */
|
|
396
401
|
model(parameter: string, model: Class<unknown>): void;
|
|
@@ -436,6 +441,12 @@ interface UrlGenerator {
|
|
|
436
441
|
current(): string;
|
|
437
442
|
previous(fallback?: string): string;
|
|
438
443
|
hasRoute(name: string): boolean;
|
|
444
|
+
/** A URL to a named route with a `signature` query (HMAC-SHA256 keyed by APP_KEY); `expiration` adds `expires`. */
|
|
445
|
+
signedRoute(name: string, parameters?: unknown, expiration?: Date | number, absolute?: boolean): string;
|
|
446
|
+
/** signedRoute() that expires: a Date, or seconds from now. */
|
|
447
|
+
temporarySignedRoute(name: string, expiration: Date | number, parameters?: unknown, absolute?: boolean): string;
|
|
448
|
+
/** Whether the request URL carries a valid, unexpired signature (`absolute: false` signs the path only). */
|
|
449
|
+
hasValidSignature(request: HttpRequest, absolute?: boolean): boolean;
|
|
439
450
|
}
|
|
440
451
|
declare const UrlGenerator: Token<UrlGenerator>;
|
|
441
452
|
interface RedirectResponse extends Responsable {
|
|
@@ -629,6 +640,8 @@ interface ModelInstance {
|
|
|
629
640
|
getTable(): string;
|
|
630
641
|
getRouteKey(): unknown;
|
|
631
642
|
getRouteKeyName(): string;
|
|
643
|
+
/** The value stored in a polymorphic `*_type` column for this model: its morph map alias, else its class name. */
|
|
644
|
+
getMorphClass(): string;
|
|
632
645
|
getAttribute<T = unknown>(key: string): T;
|
|
633
646
|
setAttribute(key: string, value: unknown): this;
|
|
634
647
|
fill(attributes: Row): this;
|
|
@@ -644,6 +657,19 @@ interface ModelStatic<M extends ModelInstance = ModelInstance> {
|
|
|
644
657
|
find(id: unknown): Promise<M | undefined>;
|
|
645
658
|
findOrFail(id: unknown): Promise<M>;
|
|
646
659
|
}
|
|
660
|
+
/**
|
|
661
|
+
* What decides a paginator's page and the path of its links when the request doesn't (Laravel's
|
|
662
|
+
* Paginator::currentPageResolver and currentPathResolver, which Livewire's WithPagination replaces). Live binds one for
|
|
663
|
+
* the application, which answers while a WithPagination component mounts, runs an update's hooks and actions, or
|
|
664
|
+
* renders. Unbound, or `undefined` from a method, the paginators read the request (`?page=` and its URL).
|
|
665
|
+
*/
|
|
666
|
+
interface PaginationState {
|
|
667
|
+
/** The page to show for `pageName` ('page' by default). */
|
|
668
|
+
currentPage(pageName: string): number | undefined;
|
|
669
|
+
/** The base path of the page links. */
|
|
670
|
+
currentPath(): string | undefined;
|
|
671
|
+
}
|
|
672
|
+
declare const PaginationState: Token<PaginationState>;
|
|
647
673
|
|
|
648
674
|
interface Authenticatable {
|
|
649
675
|
getAuthIdentifierName(): string;
|
|
@@ -712,6 +738,11 @@ interface MustVerifyEmail {
|
|
|
712
738
|
|
|
713
739
|
/** Options a job class may declare as public fields. Their presence (or implementing ShouldQueue) makes things queueable. */
|
|
714
740
|
interface ShouldQueue {
|
|
741
|
+
/**
|
|
742
|
+
* Marks the class as queued at run time: `implements ShouldQueue` leaves no trace once compiled, so the interface
|
|
743
|
+
* asks for `readonly shouldQueue = true`. Jobs, listeners, mailables and notifications carrying it are queued.
|
|
744
|
+
*/
|
|
745
|
+
readonly shouldQueue: true;
|
|
715
746
|
connection?: string;
|
|
716
747
|
queue?: string;
|
|
717
748
|
/** Seconds. */
|
|
@@ -1046,6 +1077,28 @@ interface NotificationDispatcher {
|
|
|
1046
1077
|
extend(channel: string, factory: () => NotificationChannel): void;
|
|
1047
1078
|
}
|
|
1048
1079
|
declare const NotificationDispatcher: Token<NotificationDispatcher>;
|
|
1080
|
+
/**
|
|
1081
|
+
* A stored database notification (Laravel's DatabaseNotification model): one row of the `notifications` table, with
|
|
1082
|
+
* its snake_case columns. `user.notifications()`, `unreadNotifications()` and `readNotifications()` query these,
|
|
1083
|
+
* newest first.
|
|
1084
|
+
*/
|
|
1085
|
+
interface DatabaseNotification extends ModelInstance {
|
|
1086
|
+
/** A UUID. */
|
|
1087
|
+
readonly id: string;
|
|
1088
|
+
/** The notification's class name. */
|
|
1089
|
+
readonly type: string;
|
|
1090
|
+
/** What the notification's toDatabase() (or toArray()) returned. */
|
|
1091
|
+
readonly data: Record<string, unknown>;
|
|
1092
|
+
read_at: Date | null;
|
|
1093
|
+
readonly created_at: Date | null;
|
|
1094
|
+
readonly updated_at: Date | null;
|
|
1095
|
+
/** Sets read_at to now and saves, unless it is already read. */
|
|
1096
|
+
markAsRead(): Promise<void>;
|
|
1097
|
+
/** Clears read_at and saves, unless it is already unread. */
|
|
1098
|
+
markAsUnread(): Promise<void>;
|
|
1099
|
+
read(): boolean;
|
|
1100
|
+
unread(): boolean;
|
|
1101
|
+
}
|
|
1049
1102
|
|
|
1050
1103
|
interface Lock {
|
|
1051
1104
|
/** Tries once. Returns whether it was acquired. */
|
|
@@ -1085,6 +1138,18 @@ interface CacheManager extends CacheRepository {
|
|
|
1085
1138
|
extend(driver: string, factory: (config: Record<string, unknown>) => CacheRepository): void;
|
|
1086
1139
|
}
|
|
1087
1140
|
declare const CacheManager: Token<CacheManager>;
|
|
1141
|
+
/** Laravel's RateLimiter: hits per key, kept in the default cache store. */
|
|
1142
|
+
interface RateLimiter {
|
|
1143
|
+
tooManyAttempts(key: string, maxAttempts: number): Promise<boolean>;
|
|
1144
|
+
/** Adds a hit; the window starts at the first hit and lasts `decaySeconds` (default 60). Returns the hit count. */
|
|
1145
|
+
hit(key: string, decaySeconds?: number): Promise<number>;
|
|
1146
|
+
attempts(key: string): Promise<number>;
|
|
1147
|
+
remaining(key: string, maxAttempts: number): Promise<number>;
|
|
1148
|
+
/** Seconds until the key's window resets. */
|
|
1149
|
+
availableIn(key: string): Promise<number>;
|
|
1150
|
+
clear(key: string): Promise<void>;
|
|
1151
|
+
}
|
|
1152
|
+
declare const RateLimiter: Token<RateLimiter>;
|
|
1088
1153
|
|
|
1089
1154
|
type ListenerClass<E> = Class<{
|
|
1090
1155
|
handle(event: E): unknown;
|
|
@@ -1299,4 +1364,4 @@ interface LiveManager {
|
|
|
1299
1364
|
}
|
|
1300
1365
|
declare const LiveManager: Token<LiveManager>;
|
|
1301
1366
|
|
|
1302
|
-
export { type AbilityCallback, type Abstract, type ActionMethods, type Address, Application, type Arrayable, type Attachment, AuthFactory, type Authenticatable, type AuthenticationError, type Batch, BatchRepository, type BodyInit, BusDispatcher, CacheManager, type CacheRepository, type Class, ClassRegistry, type ClosureCommand, type Command, type CommandContext, type Concrete, type ConfigCallbacks, ConfigRepository, ConsoleKernel, Container, type Content, type ControllerAction, type Cookie, CookieJar, type Credentials, CurrentRoute, type DatabaseConnection, DatabaseManager, type DriverName, Encrypter, type Enumerable, type Envelope, type ErrorKind, EventDispatcher, ExceptionCallbacks, ExceptionHandler, type ExceptionsConfigurator, type Factory, type FailedJob, FailedJobProvider, type Filesystem, FilesystemManager, Gate, type Guard, Hasher, type HeadersInit, type Htmlable, HttpKernel, HttpRequest, InertiaFactory, type InertiaOnceProp, type InertiaPage, type InertiaResponse, type InertiaScrollProp, InertiaSsrGateway, type InertiaSsrResponse, type InvokableClass, type Job, type Jsonable, type Listener, type ListenerClass, type LiveEffects, LiveManager, type LiveSnapshot, type LiveUpdateRequest, type LiveUpdateResponse, type Lock, type LogLevel, LogManager, type Logger, MailManager, type MailRecipient, type MailTransport, type Mailable, type Mailer, type MessageBag, type Middleware, MiddlewareCallbacks, type MiddlewareClass, type MiddlewareConfigurator, type MiddlewareReference, type ModelInstance, type ModelNotFoundError, type ModelStatic, type MustVerifyEmail, type Next, type Notifiable, type Notification, type NotificationChannel, NotificationDispatcher, type Operator, type OptionValue, type OrielError, type OutgoingMessage, PasswordBroker, type PasswordStatus, type PendingBatch, type PendingBatchOptions, type PendingChain, type PendingMail, type Pipe, type PipeClosure, type PipeNext, type Pipeline, PipelineFactory, type PropCallback, type PutOptions, type QueryBuilder, type Queue, type QueueJob, QueueManager, type QueuePayload, type RedirectResponse, Redirector, type ResourceOptions, type Responsable, ResponseFactory, type Route, type RouteAction, type RouteClosure, type RouteList, RouteModelResolver, type RouteName, type RouteRegistrar, Router, RoutingPaths, type Row, type RuleCallback, type Rules, Schedule, type ScheduledEvent, type SentMessage, type ServiceProvider, type ServiceProviderClass, Session, type SessionHandler, type ShouldQueue, type StatefulGuard, type Token, type UploadedFile, UrlGenerator, type UserProvider, type ValidationError, ValidationFactory, type ValidationRule, type Validator, type View, ViewFactory, token };
|
|
1367
|
+
export { type AbilityCallback, type Abstract, type ActionMethods, type Address, Application, type Arrayable, type Attachment, AuthFactory, type Authenticatable, type AuthenticationError, type Batch, BatchRepository, type BodyInit, BusDispatcher, CacheManager, type CacheRepository, type Class, ClassRegistry, type ClosureCommand, type Command, type CommandContext, type Concrete, type ConfigCallbacks, ConfigRepository, ConsoleKernel, Container, type Content, type ControllerAction, type Cookie, CookieJar, type Credentials, CurrentRoute, type DatabaseConnection, DatabaseManager, type DatabaseNotification, type DriverName, Encrypter, type Enumerable, type Envelope, type ErrorKind, EventDispatcher, ExceptionCallbacks, ExceptionHandler, type ExceptionsConfigurator, type Factory, type FailedJob, FailedJobProvider, type Filesystem, FilesystemManager, Gate, type Guard, Hasher, type HeadersInit, type Htmlable, HttpKernel, HttpRequest, InertiaFactory, type InertiaOnceProp, type InertiaPage, type InertiaResponse, type InertiaScrollProp, InertiaSsrGateway, type InertiaSsrResponse, type InvokableClass, type Job, type Jsonable, type Listener, type ListenerClass, type LiveEffects, LiveManager, type LiveSnapshot, type LiveUpdateRequest, type LiveUpdateResponse, type Lock, type LogLevel, LogManager, type Logger, MailManager, type MailRecipient, type MailTransport, type Mailable, type Mailer, type MessageBag, type Middleware, MiddlewareCallbacks, type MiddlewareClass, type MiddlewareConfigurator, type MiddlewareReference, type ModelInstance, type ModelNotFoundError, type ModelStatic, type MustVerifyEmail, type Next, type Notifiable, type Notification, type NotificationChannel, NotificationDispatcher, type Operator, type OptionValue, type OrielError, type OutgoingMessage, PaginationState, PasswordBroker, type PasswordStatus, type PendingBatch, type PendingBatchOptions, type PendingChain, type PendingMail, type Pipe, type PipeClosure, type PipeNext, type Pipeline, PipelineFactory, type PropCallback, type PutOptions, type QueryBuilder, type Queue, type QueueJob, QueueManager, type QueuePayload, RateLimiter, type RedirectResponse, Redirector, type ResourceOptions, type Responsable, ResponseFactory, type Route, type RouteAction, type RouteClosure, type RouteList, RouteModelResolver, type RouteName, type RouteRegistrar, Router, RoutingPaths, type Row, type RuleCallback, type Rules, Schedule, type ScheduledEvent, type SentMessage, type ServiceProvider, type ServiceProviderClass, Session, type SessionHandler, type ShouldQueue, type StatefulGuard, type Token, type UploadedFile, UrlGenerator, type UserProvider, type ValidationError, ValidationFactory, type ValidationRule, type Validator, type View, ViewFactory, token };
|
package/dist/contracts.js
CHANGED
|
@@ -28,9 +28,11 @@ import {
|
|
|
28
28
|
MailManager,
|
|
29
29
|
MiddlewareCallbacks,
|
|
30
30
|
NotificationDispatcher,
|
|
31
|
+
PaginationState,
|
|
31
32
|
PasswordBroker,
|
|
32
33
|
PipelineFactory,
|
|
33
34
|
QueueManager,
|
|
35
|
+
RateLimiter,
|
|
34
36
|
Redirector,
|
|
35
37
|
ResponseFactory,
|
|
36
38
|
RouteModelResolver,
|
|
@@ -42,7 +44,7 @@ import {
|
|
|
42
44
|
ValidationFactory,
|
|
43
45
|
ViewFactory,
|
|
44
46
|
token
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-BSQKOLSK.js";
|
|
46
48
|
export {
|
|
47
49
|
Application,
|
|
48
50
|
AuthFactory,
|
|
@@ -73,9 +75,11 @@ export {
|
|
|
73
75
|
MailManager,
|
|
74
76
|
MiddlewareCallbacks,
|
|
75
77
|
NotificationDispatcher,
|
|
78
|
+
PaginationState,
|
|
76
79
|
PasswordBroker,
|
|
77
80
|
PipelineFactory,
|
|
78
81
|
QueueManager,
|
|
82
|
+
RateLimiter,
|
|
79
83
|
Redirector,
|
|
80
84
|
ResponseFactory,
|
|
81
85
|
RouteModelResolver,
|