@orieljs/framework 0.1.0-alpha.0 → 0.1.0-alpha.2
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/LICENSE +202 -21
- package/NOTICE +9 -0
- package/README.md +4 -0
- package/dist/{chunk-P64C7IEP.js → chunk-3ZRPBRAE.js} +7 -1
- package/dist/chunk-3ZRPBRAE.js.map +1 -0
- package/dist/chunk-IRHK7GH7.js +745 -0
- package/dist/chunk-IRHK7GH7.js.map +1 -0
- package/dist/chunk-TIE5OAMF.js +474 -0
- package/dist/chunk-TIE5OAMF.js.map +1 -0
- package/dist/chunk-UPZAML2Q.js +3653 -0
- package/dist/chunk-UPZAML2Q.js.map +1 -0
- package/dist/contracts.d.ts +218 -51
- package/dist/contracts.js +7 -1
- package/dist/index.d.ts +12201 -343
- package/dist/index.js +21975 -864
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime-CZ6JqBQo.d.ts +345 -0
- package/dist/jsx-runtime.d.ts +2 -0
- package/dist/jsx-runtime.js +13 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/testing.d.ts +1553 -0
- package/dist/testing.js +95 -0
- package/dist/testing.js.map +1 -0
- package/package.json +64 -10
- package/dist/chunk-P64C7IEP.js.map +0 -1
package/dist/contracts.d.ts
CHANGED
|
@@ -198,6 +198,38 @@ interface SessionHandler {
|
|
|
198
198
|
gc(maxLifetimeSeconds: number): Promise<void>;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
/** A rule object (Laravel's ValidationRule). Call fail() to reject the value. */
|
|
202
|
+
interface ValidationRule {
|
|
203
|
+
validate(attribute: string, value: unknown, fail: (message: string) => void, data: Record<string, unknown>): void | Promise<void>;
|
|
204
|
+
}
|
|
205
|
+
/** 'required|string|max:255', or an array mixing strings and rule objects. Keys support dot + `*` wildcards. */
|
|
206
|
+
type Rules = Record<string, string | ReadonlyArray<string | ValidationRule>>;
|
|
207
|
+
interface MessageBag {
|
|
208
|
+
has(key: string): boolean;
|
|
209
|
+
first(key?: string): string | undefined;
|
|
210
|
+
get(key: string): string[];
|
|
211
|
+
all(): string[];
|
|
212
|
+
isEmpty(): boolean;
|
|
213
|
+
count(): number;
|
|
214
|
+
toObject(): Record<string, string[]>;
|
|
215
|
+
}
|
|
216
|
+
interface Validator {
|
|
217
|
+
passes(): Promise<boolean>;
|
|
218
|
+
fails(): Promise<boolean>;
|
|
219
|
+
/** Only the keys that have rules. Throws ValidationError (Exceptions.ts) on failure. */
|
|
220
|
+
validated<T = Record<string, unknown>>(): Promise<T>;
|
|
221
|
+
/** Valid only after passes()/fails()/validated() has run. */
|
|
222
|
+
errors(): MessageBag;
|
|
223
|
+
after(callback: (validator: Validator) => void | Promise<void>): this;
|
|
224
|
+
}
|
|
225
|
+
type RuleCallback = (attribute: string, value: unknown, parameters: string[], data: Record<string, unknown>) => boolean | Promise<boolean>;
|
|
226
|
+
interface ValidationFactory {
|
|
227
|
+
make(data: Record<string, unknown>, rules: Rules, messages?: Record<string, string>, attributes?: Record<string, string>): Validator;
|
|
228
|
+
/** Registers a string rule, e.g. extend('uppercase', fn, ':attribute must be uppercase'). */
|
|
229
|
+
extend(name: string, callback: RuleCallback, message?: string): void;
|
|
230
|
+
}
|
|
231
|
+
declare const ValidationFactory: Token<ValidationFactory>;
|
|
232
|
+
|
|
201
233
|
/** Web-standard body/headers init types, derived from the runtime's global Response/Headers (no DOM lib needed). */
|
|
202
234
|
type BodyInit = ConstructorParameters<typeof Response>[0];
|
|
203
235
|
type HeadersInit = ConstructorParameters<typeof Headers>[0];
|
|
@@ -243,12 +275,16 @@ interface HttpRequest {
|
|
|
243
275
|
merge(values: Record<string, unknown>): this;
|
|
244
276
|
file(key: string): UploadedFile | undefined;
|
|
245
277
|
cookie(name: string): string | undefined;
|
|
278
|
+
/** Replace the parsed request cookies (EncryptCookies calls this after decrypting). */
|
|
279
|
+
setCookies(cookies: Record<string, string>): void;
|
|
246
280
|
/** Route parameter (after model binding), or every parameter when called with no key. */
|
|
247
281
|
route<T = unknown>(key?: string): T;
|
|
248
282
|
session(): Session;
|
|
249
283
|
/** The user resolved earlier by auth middleware. Undefined for guests. Use `await Auth.user()` to resolve lazily. */
|
|
250
284
|
user<T = unknown>(guard?: string): T | undefined;
|
|
251
285
|
setUserResolver(resolver: (guard?: string) => unknown): void;
|
|
286
|
+
/** Validates this request's input via the ValidationFactory; throws a Validation OrielError (422) on failure. */
|
|
287
|
+
validate<T = Record<string, unknown>>(rules: Rules, messages?: Record<string, string>, attributes?: Record<string, string>): Promise<T>;
|
|
252
288
|
}
|
|
253
289
|
declare const HttpRequest: Token<HttpRequest>;
|
|
254
290
|
type Next = (request: HttpRequest) => Promise<Response>;
|
|
@@ -323,17 +359,28 @@ interface ResourceOptions {
|
|
|
323
359
|
parameters?: Record<string, string>;
|
|
324
360
|
names?: Record<string, string>;
|
|
325
361
|
}
|
|
362
|
+
/** The route matched for the current request (scope-local; set by the router before route middleware runs). */
|
|
363
|
+
interface CurrentRoute {
|
|
364
|
+
readonly route: Route;
|
|
365
|
+
/** Route parameters after model binding, in URI order. */
|
|
366
|
+
readonly parameters: Record<string, unknown>;
|
|
367
|
+
/** Resolved route middleware instances, for HttpKernel.terminate(). */
|
|
368
|
+
readonly middleware: Middleware[];
|
|
369
|
+
}
|
|
370
|
+
declare const CurrentRoute: Token<CurrentRoute>;
|
|
326
371
|
interface Router {
|
|
327
|
-
get<C>(uri: string, action: ControllerAction<C> | RouteClosure): Route;
|
|
328
|
-
post<C>(uri: string, action: ControllerAction<C> | RouteClosure): Route;
|
|
329
|
-
put<C>(uri: string, action: ControllerAction<C> | RouteClosure): Route;
|
|
330
|
-
patch<C>(uri: string, action: ControllerAction<C> | RouteClosure): Route;
|
|
331
|
-
delete<C>(uri: string, action: ControllerAction<C> | RouteClosure): Route;
|
|
332
|
-
options<C>(uri: string, action: ControllerAction<C> | RouteClosure): Route;
|
|
333
|
-
any<C>(uri: string, action: ControllerAction<C> | RouteClosure): Route;
|
|
334
|
-
match<C>(methods: string[], uri: string, action: ControllerAction<C> | RouteClosure): Route;
|
|
372
|
+
get<C>(uri: string, action: ControllerAction<C> | RouteClosure | string): Route;
|
|
373
|
+
post<C>(uri: string, action: ControllerAction<C> | RouteClosure | string): Route;
|
|
374
|
+
put<C>(uri: string, action: ControllerAction<C> | RouteClosure | string): Route;
|
|
375
|
+
patch<C>(uri: string, action: ControllerAction<C> | RouteClosure | string): Route;
|
|
376
|
+
delete<C>(uri: string, action: ControllerAction<C> | RouteClosure | string): Route;
|
|
377
|
+
options<C>(uri: string, action: ControllerAction<C> | RouteClosure | string): Route;
|
|
378
|
+
any<C>(uri: string, action: ControllerAction<C> | RouteClosure | string): Route;
|
|
379
|
+
match<C>(methods: string[], uri: string, action: ControllerAction<C> | RouteClosure | string): Route;
|
|
335
380
|
redirect(from: string, to: string, status?: number): Route;
|
|
336
381
|
view(uri: string, view: string, data?: Record<string, unknown>): Route;
|
|
382
|
+
/** Route.inertia('/about', 'About', props): a GET route that renders an Inertia page (Laravel's Route::inertia). */
|
|
383
|
+
inertia(uri: string, component: string, props?: Record<string, unknown>): Route;
|
|
337
384
|
resource(name: string, controller: Class<unknown>, options?: ResourceOptions): void;
|
|
338
385
|
apiResource(name: string, controller: Class<unknown>, options?: ResourceOptions): void;
|
|
339
386
|
fallback(action: RouteAction): Route;
|
|
@@ -346,8 +393,17 @@ interface Router {
|
|
|
346
393
|
/** Custom binding resolver. */
|
|
347
394
|
bind(parameter: string, resolver: (value: string) => unknown | Promise<unknown>): void;
|
|
348
395
|
pattern(parameter: string, pattern: string): void;
|
|
396
|
+
/** Name a middleware class, e.g. aliasMiddleware('auth', Authenticate). */
|
|
397
|
+
aliasMiddleware(name: string, middleware: MiddlewareClass): this;
|
|
398
|
+
/** Define (or replace) a middleware group such as 'web' or 'api'. */
|
|
399
|
+
middlewareGroup(name: string, middleware: MiddlewareReference[]): this;
|
|
400
|
+
/** Append to a group unless it is already present. */
|
|
401
|
+
pushMiddlewareToGroup(group: string, middleware: MiddlewareReference): this;
|
|
402
|
+
getMiddlewareGroups(): Record<string, MiddlewareReference[]>;
|
|
349
403
|
getRoutes(): readonly Route[];
|
|
350
404
|
current(): Route | undefined;
|
|
405
|
+
/** Match the request, bind parameters, run the route middleware and the action. Called by the Http kernel. */
|
|
406
|
+
dispatch(request: HttpRequest): Promise<Response>;
|
|
351
407
|
}
|
|
352
408
|
declare const Router: Token<Router>;
|
|
353
409
|
/**
|
|
@@ -360,6 +416,15 @@ interface RouteModelResolver {
|
|
|
360
416
|
resolveExplicit(model: Class<unknown>, value: string, field?: string): Promise<unknown>;
|
|
361
417
|
}
|
|
362
418
|
declare const RouteModelResolver: Token<RouteModelResolver>;
|
|
419
|
+
/**
|
|
420
|
+
* Route name → parameters, for the typed route() and redirect().route() helpers. Empty until `oriel route:types`
|
|
421
|
+
* augments it (types/routes.d.ts); while it is empty any string is accepted. The contracts themselves keep taking
|
|
422
|
+
* strings: the framework builds route names at run time.
|
|
423
|
+
*/
|
|
424
|
+
interface RouteList {
|
|
425
|
+
}
|
|
426
|
+
/** A route name: the generated ones, or any string before `oriel route:types` has run. */
|
|
427
|
+
type RouteName = [keyof RouteList] extends [never] ? string : Extract<keyof RouteList, string>;
|
|
363
428
|
interface UrlGenerator {
|
|
364
429
|
to(path: string, query?: Record<string, unknown>, absolute?: boolean): string;
|
|
365
430
|
route(name: string, parameters?: unknown, absolute?: boolean): string;
|
|
@@ -461,7 +526,7 @@ interface LogManager extends Logger {
|
|
|
461
526
|
}
|
|
462
527
|
declare const LogManager: Token<LogManager>;
|
|
463
528
|
|
|
464
|
-
type ErrorKind = 'Http' | 'ModelNotFound' | 'Validation' | 'Authentication' | 'Authorization' | 'TokenMismatch' | 'BindingResolution' | 'CircularDependency' | 'ContainerNotAvailable';
|
|
529
|
+
type ErrorKind = 'Http' | 'Server' | 'ModelNotFound' | 'Validation' | 'Authentication' | 'Authorization' | 'TokenMismatch' | 'BindingResolution' | 'CircularDependency' | 'ContainerNotAvailable';
|
|
465
530
|
/** Every error thrown by the framework implements this. The exception handler switches on `kind`. */
|
|
466
531
|
interface OrielError extends Error {
|
|
467
532
|
readonly kind: ErrorKind;
|
|
@@ -513,6 +578,11 @@ interface QueryBuilder<T = Row> {
|
|
|
513
578
|
count(): Promise<number>;
|
|
514
579
|
exists(): Promise<boolean>;
|
|
515
580
|
insert(values: Row | Row[]): Promise<void>;
|
|
581
|
+
/**
|
|
582
|
+
* Inserts rows, skipping any that violate a unique key instead of failing (Laravel's insertOrIgnore). Returns the
|
|
583
|
+
* number of rows inserted. Nothing is thrown for a duplicate, so a caller's transaction stays usable on Postgres.
|
|
584
|
+
*/
|
|
585
|
+
insertOrIgnore(values: Row | Row[]): Promise<number>;
|
|
516
586
|
insertGetId(values: Row, keyName?: string): Promise<number | string>;
|
|
517
587
|
update(values: Row): Promise<number>;
|
|
518
588
|
upsert(values: Row | Row[], uniqueBy: string[], update?: string[]): Promise<number>;
|
|
@@ -529,6 +599,16 @@ interface DatabaseConnection {
|
|
|
529
599
|
statement(sql: string, bindings?: readonly unknown[]): Promise<void>;
|
|
530
600
|
/** Nested calls use savepoints. Rolls back if fn throws. */
|
|
531
601
|
transaction<R>(fn: (connection: DatabaseConnection) => Promise<R>): Promise<R>;
|
|
602
|
+
/**
|
|
603
|
+
* Start a transaction that stays open, for every caller of this connection, until commit()/rollBack().
|
|
604
|
+
* Nested calls use savepoints. Meant for test isolation (RefreshDatabase); app code uses transaction(fn).
|
|
605
|
+
*/
|
|
606
|
+
beginTransaction(): Promise<void>;
|
|
607
|
+
commit(): Promise<void>;
|
|
608
|
+
/** Rolls back the innermost level opened by beginTransaction(). Does nothing when none is open. */
|
|
609
|
+
rollBack(): Promise<void>;
|
|
610
|
+
/** 0 outside a transaction. */
|
|
611
|
+
transactionLevel(): number;
|
|
532
612
|
}
|
|
533
613
|
interface DatabaseManager extends DatabaseConnection {
|
|
534
614
|
connection(name?: string): DatabaseConnection;
|
|
@@ -559,38 +639,6 @@ interface ModelStatic<M extends ModelInstance = ModelInstance> {
|
|
|
559
639
|
findOrFail(id: unknown): Promise<M>;
|
|
560
640
|
}
|
|
561
641
|
|
|
562
|
-
/** A rule object (Laravel's ValidationRule). Call fail() to reject the value. */
|
|
563
|
-
interface ValidationRule {
|
|
564
|
-
validate(attribute: string, value: unknown, fail: (message: string) => void, data: Record<string, unknown>): void | Promise<void>;
|
|
565
|
-
}
|
|
566
|
-
/** 'required|string|max:255', or an array mixing strings and rule objects. Keys support dot + `*` wildcards. */
|
|
567
|
-
type Rules = Record<string, string | ReadonlyArray<string | ValidationRule>>;
|
|
568
|
-
interface MessageBag {
|
|
569
|
-
has(key: string): boolean;
|
|
570
|
-
first(key?: string): string | undefined;
|
|
571
|
-
get(key: string): string[];
|
|
572
|
-
all(): string[];
|
|
573
|
-
isEmpty(): boolean;
|
|
574
|
-
count(): number;
|
|
575
|
-
toObject(): Record<string, string[]>;
|
|
576
|
-
}
|
|
577
|
-
interface Validator {
|
|
578
|
-
passes(): Promise<boolean>;
|
|
579
|
-
fails(): Promise<boolean>;
|
|
580
|
-
/** Only the keys that have rules. Throws ValidationError (Exceptions.ts) on failure. */
|
|
581
|
-
validated<T = Record<string, unknown>>(): Promise<T>;
|
|
582
|
-
/** Valid only after passes()/fails()/validated() has run. */
|
|
583
|
-
errors(): MessageBag;
|
|
584
|
-
after(callback: (validator: Validator) => void | Promise<void>): this;
|
|
585
|
-
}
|
|
586
|
-
type RuleCallback = (attribute: string, value: unknown, parameters: string[], data: Record<string, unknown>) => boolean | Promise<boolean>;
|
|
587
|
-
interface ValidationFactory {
|
|
588
|
-
make(data: Record<string, unknown>, rules: Rules, messages?: Record<string, string>, attributes?: Record<string, string>): Validator;
|
|
589
|
-
/** Registers a string rule, e.g. extend('uppercase', fn, ':attribute must be uppercase'). */
|
|
590
|
-
extend(name: string, callback: RuleCallback, message?: string): void;
|
|
591
|
-
}
|
|
592
|
-
declare const ValidationFactory: Token<ValidationFactory>;
|
|
593
|
-
|
|
594
642
|
interface Authenticatable {
|
|
595
643
|
getAuthIdentifierName(): string;
|
|
596
644
|
getAuthIdentifier(): unknown;
|
|
@@ -688,6 +736,10 @@ interface QueuePayload {
|
|
|
688
736
|
pushedAt: number;
|
|
689
737
|
batchId?: string;
|
|
690
738
|
chain?: QueuePayload[];
|
|
739
|
+
/** Unix ms after which the job fails instead of retrying. */
|
|
740
|
+
retryUntil?: number;
|
|
741
|
+
/** Mark the job failed (instead of releasing it) when it times out. */
|
|
742
|
+
failOnTimeout?: boolean;
|
|
691
743
|
}
|
|
692
744
|
interface QueueJob {
|
|
693
745
|
getJobId(): string;
|
|
@@ -770,6 +822,31 @@ interface BusDispatcher {
|
|
|
770
822
|
findBatch(id: string): Promise<Batch | undefined>;
|
|
771
823
|
}
|
|
772
824
|
declare const BusDispatcher: Token<BusDispatcher>;
|
|
825
|
+
/** What PendingBatch hands to the repository. Callbacks are jobs, because closures can't be serialized. */
|
|
826
|
+
interface PendingBatchOptions {
|
|
827
|
+
name: string;
|
|
828
|
+
then: Job[];
|
|
829
|
+
catch: Job[];
|
|
830
|
+
finally: Job[];
|
|
831
|
+
allowFailures: boolean;
|
|
832
|
+
connection?: string;
|
|
833
|
+
queue?: string;
|
|
834
|
+
}
|
|
835
|
+
/** Stores batches and runs their bookkeeping (Laravel's BatchRepository). Bound by the Queue component. */
|
|
836
|
+
interface BatchRepository {
|
|
837
|
+
store(options: PendingBatchOptions): Promise<Batch>;
|
|
838
|
+
find(id: string): Promise<Batch | undefined>;
|
|
839
|
+
/** Adds `amount` to both total and pending jobs, before the jobs are pushed. */
|
|
840
|
+
incrementTotalJobs(id: string, amount: number): Promise<void>;
|
|
841
|
+
/** A batched job succeeded: decrement pending, then run then/finally callbacks when due. */
|
|
842
|
+
recordSuccessfulJob(id: string, jobUuid: string): Promise<void>;
|
|
843
|
+
/** A batched job failed for good: count it, cancel unless failures are allowed, run catch/finally when due. */
|
|
844
|
+
recordFailedJob(id: string, jobUuid: string, error: unknown): Promise<void>;
|
|
845
|
+
markAsFinished(id: string): Promise<void>;
|
|
846
|
+
cancel(id: string): Promise<void>;
|
|
847
|
+
delete(id: string): Promise<void>;
|
|
848
|
+
}
|
|
849
|
+
declare const BatchRepository: Token<BatchRepository>;
|
|
773
850
|
|
|
774
851
|
/** A CLI command. Signature uses Laravel syntax: 'mail:send {user} {--queue=default}'. */
|
|
775
852
|
interface Command {
|
|
@@ -777,6 +854,29 @@ interface Command {
|
|
|
777
854
|
readonly description: string;
|
|
778
855
|
handle(): number | void | Promise<number | void>;
|
|
779
856
|
}
|
|
857
|
+
type OptionValue = string | boolean | string[] | undefined;
|
|
858
|
+
/** `this` inside a closure command (Laravel's Command API). */
|
|
859
|
+
interface CommandContext extends Command {
|
|
860
|
+
argument(name: string): string | string[] | undefined;
|
|
861
|
+
arguments(): Record<string, string | string[]>;
|
|
862
|
+
option(name: string): OptionValue;
|
|
863
|
+
options(): Record<string, OptionValue>;
|
|
864
|
+
info(message: string): void;
|
|
865
|
+
line(message?: string): void;
|
|
866
|
+
comment(message: string): void;
|
|
867
|
+
warn(message: string): void;
|
|
868
|
+
error(message: string): void;
|
|
869
|
+
newLine(count?: number): void;
|
|
870
|
+
table(headers: string[], rows: string[][]): void;
|
|
871
|
+
ask(question: string, defaultValue?: string): Promise<string>;
|
|
872
|
+
secret(question: string): Promise<string>;
|
|
873
|
+
confirm(question: string, defaultValue?: boolean): Promise<boolean>;
|
|
874
|
+
choice(question: string, choices: string[], defaultIndex?: number): Promise<string>;
|
|
875
|
+
}
|
|
876
|
+
/** What ConsoleKernel.command() returns. */
|
|
877
|
+
interface ClosureCommand extends CommandContext {
|
|
878
|
+
purpose(description: string): this;
|
|
879
|
+
}
|
|
780
880
|
interface ConsoleKernel {
|
|
781
881
|
/** Returns the exit code. */
|
|
782
882
|
handle(argv: string[]): Promise<number>;
|
|
@@ -784,6 +884,10 @@ interface ConsoleKernel {
|
|
|
784
884
|
/** Output buffered from the last call(). */
|
|
785
885
|
output(): string;
|
|
786
886
|
all(): Record<string, Command>;
|
|
887
|
+
/** Register command classes or instances (components call this from their provider's boot()). */
|
|
888
|
+
register(...commands: Array<Command | (new () => Command)>): void;
|
|
889
|
+
/** Closure command, like Artisan::command() in routes/console.ts. `this` is the command (argument(), info(), …). */
|
|
890
|
+
command(signature: string, handler: (this: CommandContext, ...args: unknown[]) => number | void | Promise<number | void>): ClosureCommand;
|
|
787
891
|
}
|
|
788
892
|
declare const ConsoleKernel: Token<ConsoleKernel>;
|
|
789
893
|
interface ScheduledEvent {
|
|
@@ -854,6 +958,8 @@ interface Content {
|
|
|
854
958
|
text?: string;
|
|
855
959
|
/** Raw HTML (used when no view is given). */
|
|
856
960
|
htmlString?: string;
|
|
961
|
+
/** Raw plain-text body (used when no text view is given). */
|
|
962
|
+
textString?: string;
|
|
857
963
|
with?: Record<string, unknown>;
|
|
858
964
|
}
|
|
859
965
|
interface Attachment {
|
|
@@ -940,7 +1046,7 @@ interface Lock {
|
|
|
940
1046
|
get(): Promise<boolean>;
|
|
941
1047
|
/** Tries once. Runs the callback and releases if acquired, else returns false. */
|
|
942
1048
|
get<T>(callback: () => T | Promise<T>): Promise<T | false>;
|
|
943
|
-
/** Waits up to `seconds` to acquire. Throws
|
|
1049
|
+
/** Waits up to `seconds` to acquire. Throws LockTimeoutError (an OrielError, kind 'Server', status 500) on timeout. */
|
|
944
1050
|
block<T>(seconds: number, callback?: () => T | Promise<T>): Promise<T | true>;
|
|
945
1051
|
release(): Promise<boolean>;
|
|
946
1052
|
forceRelease(): Promise<void>;
|
|
@@ -1029,38 +1135,99 @@ interface FilesystemManager extends Filesystem {
|
|
|
1029
1135
|
}
|
|
1030
1136
|
declare const FilesystemManager: Token<FilesystemManager>;
|
|
1031
1137
|
|
|
1032
|
-
/**
|
|
1138
|
+
/** Infinite-scroll metadata for one prop (page.scrollProps[path]). */
|
|
1139
|
+
interface InertiaScrollProp {
|
|
1140
|
+
pageName: string;
|
|
1141
|
+
previousPage: string | number | null;
|
|
1142
|
+
nextPage: string | number | null;
|
|
1143
|
+
currentPage: string | number | null;
|
|
1144
|
+
reset: boolean;
|
|
1145
|
+
}
|
|
1146
|
+
/** A once prop the client keeps between visits (page.onceProps[key]). `expiresAt` is epoch milliseconds. */
|
|
1147
|
+
interface InertiaOnceProp {
|
|
1148
|
+
prop: string;
|
|
1149
|
+
expiresAt: number | null;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* The Inertia page object (protocol v3, @inertiajs/core 3.x). Only component, props, url and version are always
|
|
1153
|
+
* present; the other fields are left out when empty or false.
|
|
1154
|
+
*/
|
|
1033
1155
|
interface InertiaPage {
|
|
1034
1156
|
component: string;
|
|
1035
1157
|
props: Record<string, unknown>;
|
|
1158
|
+
/** Path and query, never absolute: '/posts?page=2'. */
|
|
1036
1159
|
url: string;
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1160
|
+
/** '' when the app has no asset version. */
|
|
1161
|
+
version: string;
|
|
1162
|
+
sharedProps?: string[];
|
|
1040
1163
|
mergeProps?: string[];
|
|
1164
|
+
prependProps?: string[];
|
|
1165
|
+
deepMergeProps?: string[];
|
|
1166
|
+
/** '<prop path>.<key field>', e.g. 'posts.data.id'. */
|
|
1167
|
+
matchPropsOn?: string[];
|
|
1168
|
+
/** Group name → prop paths loaded after the first render. */
|
|
1041
1169
|
deferredProps?: Record<string, string[]>;
|
|
1170
|
+
rescuedProps?: string[];
|
|
1171
|
+
scrollProps?: Record<string, InertiaScrollProp>;
|
|
1172
|
+
onceProps?: Record<string, InertiaOnceProp>;
|
|
1173
|
+
clearHistory?: true;
|
|
1174
|
+
encryptHistory?: true;
|
|
1175
|
+
flash?: Record<string, unknown>;
|
|
1176
|
+
preserveFragment?: true;
|
|
1042
1177
|
}
|
|
1043
1178
|
interface InertiaResponse extends Responsable {
|
|
1044
1179
|
with(key: string | Record<string, unknown>, value?: unknown): this;
|
|
1045
1180
|
withViewData(key: string | Record<string, unknown>, value?: unknown): this;
|
|
1181
|
+
rootView(view: string): this;
|
|
1182
|
+
/** Flash data for the next page (page.flash), stored in the session. */
|
|
1183
|
+
flash(key: string | Record<string, unknown>, value?: unknown): this;
|
|
1046
1184
|
}
|
|
1047
1185
|
type PropCallback<T = unknown> = () => T | Promise<T>;
|
|
1186
|
+
/** The SSR result spliced into the root view: the `head` tags and the rendered `body`. */
|
|
1187
|
+
interface InertiaSsrResponse {
|
|
1188
|
+
head: string;
|
|
1189
|
+
body: string;
|
|
1190
|
+
}
|
|
1191
|
+
/** Sends a page to the SSR server. Resolves to undefined when SSR is off, unreachable or failing. */
|
|
1192
|
+
interface InertiaSsrGateway {
|
|
1193
|
+
dispatch(page: InertiaPage): Promise<InertiaSsrResponse | undefined>;
|
|
1194
|
+
}
|
|
1195
|
+
declare const InertiaSsrGateway: Token<InertiaSsrGateway>;
|
|
1048
1196
|
interface InertiaFactory {
|
|
1049
1197
|
render(component: string, props?: Record<string, unknown>): InertiaResponse;
|
|
1050
1198
|
share(key: string | Record<string, unknown>, value?: unknown): void;
|
|
1199
|
+
/** A shared once prop: sent on the first visit, then kept by the client. */
|
|
1200
|
+
shareOnce(key: string, callback: PropCallback): void;
|
|
1051
1201
|
getShared(key?: string): unknown;
|
|
1052
|
-
|
|
1202
|
+
flushShared(): void;
|
|
1203
|
+
version(version: string | null | (() => string | null | Promise<string | null>)): void;
|
|
1204
|
+
getVersion(): Promise<string>;
|
|
1205
|
+
setRootView(view: string): void;
|
|
1053
1206
|
/** Only evaluated on partial reloads that ask for it. */
|
|
1054
1207
|
optional<T>(callback: PropCallback<T>): unknown;
|
|
1055
1208
|
/** Loaded in a follow-up request after the first render. */
|
|
1056
1209
|
defer<T>(callback: PropCallback<T>, group?: string): unknown;
|
|
1057
1210
|
/** Always included, even in partial reloads. */
|
|
1058
1211
|
always<T>(value: T | PropCallback<T>): unknown;
|
|
1059
|
-
/**
|
|
1212
|
+
/** Appended to the existing client-side value instead of replacing it. */
|
|
1060
1213
|
merge<T>(value: T | PropCallback<T>): unknown;
|
|
1061
|
-
/**
|
|
1214
|
+
/** Deep-merged with the existing client-side value. */
|
|
1215
|
+
deepMerge<T>(value: T | PropCallback<T>): unknown;
|
|
1216
|
+
/** Resolved once, then remembered by the client. */
|
|
1217
|
+
once<T>(callback: PropCallback<T>): unknown;
|
|
1218
|
+
/** Infinite scroll over a paginator: merged page by page, with scroll metadata. */
|
|
1219
|
+
scroll<T>(value: T | PropCallback<T>, wrapper?: string): unknown;
|
|
1220
|
+
/** Flash data for the next page (page.flash), stored in the session. */
|
|
1221
|
+
flash(key: string | Record<string, unknown>, value?: unknown): this;
|
|
1222
|
+
encryptHistory(encrypt?: boolean): void;
|
|
1223
|
+
/** The next page tells the client to clear its encrypted history. */
|
|
1224
|
+
clearHistory(): void;
|
|
1225
|
+
/** The next page keeps the URL fragment of the request that redirected to it. */
|
|
1226
|
+
preserveFragment(): void;
|
|
1227
|
+
/** 409 + X-Inertia-Location for Inertia requests, a plain 302 otherwise. */
|
|
1062
1228
|
location(url: string): Response;
|
|
1063
|
-
|
|
1229
|
+
/** Redirect back (Inertia.flash('saved', true).back()). */
|
|
1230
|
+
back(fallback?: string, status?: number): RedirectResponse;
|
|
1064
1231
|
}
|
|
1065
1232
|
declare const InertiaFactory: Token<InertiaFactory>;
|
|
1066
1233
|
|
|
@@ -1114,4 +1281,4 @@ interface LiveManager {
|
|
|
1114
1281
|
}
|
|
1115
1282
|
declare const LiveManager: Token<LiveManager>;
|
|
1116
1283
|
|
|
1117
|
-
export { type AbilityCallback, type Abstract, type ActionMethods, type Address, Application, type Arrayable, type Attachment, AuthFactory, type Authenticatable, type AuthenticationError, type Batch, type BodyInit, BusDispatcher, CacheManager, type CacheRepository, type Class, ClassRegistry, type Command, type Concrete, type ConfigCallbacks, ConfigRepository, ConsoleKernel, Container, type Content, type ControllerAction, type Cookie, CookieJar, type Credentials, 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 InertiaPage, type InertiaResponse, 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 OrielError, type OutgoingMessage, PasswordBroker, type PasswordStatus, type PendingBatch, 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, RouteModelResolver, 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 };
|
|
1284
|
+
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 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 };
|
package/dist/contracts.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Application,
|
|
3
3
|
AuthFactory,
|
|
4
|
+
BatchRepository,
|
|
4
5
|
BusDispatcher,
|
|
5
6
|
CacheManager,
|
|
6
7
|
ClassRegistry,
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
ConsoleKernel,
|
|
9
10
|
Container,
|
|
10
11
|
CookieJar,
|
|
12
|
+
CurrentRoute,
|
|
11
13
|
DatabaseManager,
|
|
12
14
|
Encrypter,
|
|
13
15
|
EventDispatcher,
|
|
@@ -20,6 +22,7 @@ import {
|
|
|
20
22
|
HttpKernel,
|
|
21
23
|
HttpRequest,
|
|
22
24
|
InertiaFactory,
|
|
25
|
+
InertiaSsrGateway,
|
|
23
26
|
LiveManager,
|
|
24
27
|
LogManager,
|
|
25
28
|
MailManager,
|
|
@@ -39,10 +42,11 @@ import {
|
|
|
39
42
|
ValidationFactory,
|
|
40
43
|
ViewFactory,
|
|
41
44
|
token
|
|
42
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-3ZRPBRAE.js";
|
|
43
46
|
export {
|
|
44
47
|
Application,
|
|
45
48
|
AuthFactory,
|
|
49
|
+
BatchRepository,
|
|
46
50
|
BusDispatcher,
|
|
47
51
|
CacheManager,
|
|
48
52
|
ClassRegistry,
|
|
@@ -50,6 +54,7 @@ export {
|
|
|
50
54
|
ConsoleKernel,
|
|
51
55
|
Container,
|
|
52
56
|
CookieJar,
|
|
57
|
+
CurrentRoute,
|
|
53
58
|
DatabaseManager,
|
|
54
59
|
Encrypter,
|
|
55
60
|
EventDispatcher,
|
|
@@ -62,6 +67,7 @@ export {
|
|
|
62
67
|
HttpKernel,
|
|
63
68
|
HttpRequest,
|
|
64
69
|
InertiaFactory,
|
|
70
|
+
InertiaSsrGateway,
|
|
65
71
|
LiveManager,
|
|
66
72
|
LogManager,
|
|
67
73
|
MailManager,
|