@orieljs/framework 0.1.0-alpha.4 → 0.1.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,604 +1,67 @@
1
- import { Token as Token$2 } from './contracts.js';
2
- import { S as ServiceProvider$3, A as Application$2 } from './index.d-DOlTeG-8.js';
1
+ import { BusDispatcher, Job, PendingBatchOptions, Class, PendingChain, PendingBatch, Batch, EventDispatcher, Listener, MailManager, Mailable, Address, MailRecipient, Mailer, PendingMail, SentMessage, MailTransport, NotificationDispatcher, Notifiable, Notification, NotificationChannel, QueueManager, QueuePayload, Queue, QueueJob, FilesystemManager, Filesystem, PutOptions, UploadedFile, Application, Session, View, Authenticatable, Container, AuthFactory, InertiaPage, ServiceProvider, ServiceProviderClass, DatabaseManager, ModelInstance, Row, Encrypter, Token, ExceptionHandler, ViewFactory, Rules, MessageBag, LiveSnapshot, LiveEffects, OrielError, ErrorKind, Htmlable, LiveManager, HttpRequest, LiveUpdateRequest, LiveUpdateResponse, MiddlewareClass, Router } from './contracts.js';
2
+ import { S as ServiceProvider$1 } from './index.d-BJyJx6U1.js';
3
3
 
4
- /** A typed, runtime-unique key for container bindings. */
5
- interface Token$1<T> {
6
- readonly id: symbol;
7
- readonly description: string;
8
- /** Phantom field: only carries T at the type level. Never set at runtime. */
9
- readonly __type?: T;
10
- }
11
- type Class$1<T> = abstract new (...args: any[]) => T;
12
- type Abstract$1<T> = Token$1<T> | Class$1<T>;
13
- type Factory$1<T> = (container: Container$1) => T;
14
- type Concrete$1<T> = Factory$1<T> | (new () => T);
15
- interface Container$1 {
16
- /** New instance on every make(). A class with no concrete binds to itself (constructed with no args). Root only; throws on a scope. */
17
- bind<T>(abstract: Abstract$1<T>, concrete?: Concrete$1<T>): void;
18
- /** One instance for the life of this container and its scopes. Root only; throws on a scope. */
19
- singleton<T>(abstract: Abstract$1<T>, concrete?: Concrete$1<T>): void;
20
- /** One instance per scope (e.g. per HTTP request or queue job). Root only; throws on a scope. */
21
- scoped<T>(abstract: Abstract$1<T>, concrete?: Concrete$1<T>): void;
22
- /** Register an existing object as a shared instance. Returns it. On a scope it stays local to that scope. */
23
- instance<T>(abstract: Abstract$1<T>, instance: T): T;
24
- /** Resolve. Unbound classes are constructed with `new Class()`. Unbound tokens throw BindingResolutionError. */
25
- make<T>(abstract: Abstract$1<T>): T;
26
- bound(abstract: Abstract$1<unknown>): boolean;
27
- resolved(abstract: Abstract$1<unknown>): boolean;
28
- /** Decorate or replace an instance each time it's resolved (applied before resolving callbacks). Root only; throws on a scope. */
29
- extend<T>(abstract: Abstract$1<T>, extender: (instance: T, container: Container$1) => T): void;
30
- /** Called after each resolution of the abstract. Root only; throws on a scope. */
31
- resolving<T>(abstract: Abstract$1<T>, callback: (instance: T, container: Container$1) => void): void;
32
- forgetInstance(abstract: Abstract$1<unknown>): void;
33
- /** A child container: shares bindings and singletons with its parent, and has its own scoped instances. Bindings can't be registered on it. */
34
- createScope(): Container$1;
35
- /** Run fn with this container as the "current" one for inject(), helpers and facades (AsyncLocalStorage). */
36
- run<R>(fn: () => R): R;
37
- }
38
- declare const Container$1: Token$1<Container$1>;
39
-
40
- /** The session of the current request (scoped). Loaded and saved by the StartSession middleware. */
41
- interface Session$1 {
42
- getId(): string;
43
- start(): Promise<void>;
44
- save(): Promise<void>;
45
- all(): Record<string, unknown>;
46
- has(key: string): boolean;
47
- get<T = unknown>(key: string, defaultValue?: T): T;
48
- put(key: string | Record<string, unknown>, value?: unknown): void;
49
- push(key: string, value: unknown): void;
50
- pull<T = unknown>(key: string, defaultValue?: T): T;
51
- forget(...keys: string[]): void;
52
- flush(): void;
53
- flash(key: string, value: unknown): void;
54
- now(key: string, value: unknown): void;
55
- reflash(): void;
56
- keep(...keys: string[]): void;
57
- getOldInput<T = unknown>(key?: string, defaultValue?: T): T;
58
- flashInput(input: Record<string, unknown>): void;
59
- token(): string;
60
- regenerateToken(): void;
61
- regenerate(destroy?: boolean): Promise<void>;
62
- invalidate(): Promise<void>;
63
- previousUrl(): string | undefined;
64
- setPreviousUrl(url: string): void;
65
- }
66
- declare const Session$1: Token$2<Session$1>;
67
- interface UploadedFile$1 {
68
- readonly clientName: string;
69
- readonly mimeType: string;
70
- readonly size: number;
71
- extension(): string;
72
- arrayBuffer(): Promise<ArrayBuffer>;
73
- /** Stores on a Filesystem disk. Returns the stored path. */
74
- store(directory: string, disk?: string): Promise<string>;
75
- storeAs(directory: string, name: string, disk?: string): Promise<string>;
76
- }
77
-
78
- interface ServiceProvider$2 {
79
- /** Bind things into the container. Synchronous. Don't resolve other services here. */
80
- register?(): void;
81
- /** Runs after every provider is registered. May be async (e.g. importing route files). */
82
- boot?(): void | Promise<void>;
83
- }
84
- type ServiceProviderClass$1 = new (app: Application$1) => ServiceProvider$2;
85
- interface Application$1 extends Container$1 {
86
- readonly version: string;
87
- basePath(path?: string): string;
88
- appPath(path?: string): string;
89
- bootstrapPath(path?: string): string;
90
- configPath(path?: string): string;
91
- databasePath(path?: string): string;
92
- publicPath(path?: string): string;
93
- resourcePath(path?: string): string;
94
- storagePath(path?: string): string;
95
- /** With no args returns the environment name. With args returns whether it matches any of them. */
96
- environment(): string;
97
- environment(...environments: string[]): boolean;
98
- isProduction(): boolean;
99
- isLocal(): boolean;
100
- runningInConsole(): boolean;
101
- /** Mark the app as running in the console (the CLI entry point calls this). Defaults to true. */
102
- setRunningInConsole(value?: boolean): void;
103
- runningUnitTests(): boolean;
104
- /** Registers the provider. If the app is already booted, the provider is booted immediately. */
105
- register(provider: ServiceProvider$2 | ServiceProviderClass$1): Promise<ServiceProvider$2>;
106
- getProviders(): ServiceProvider$2[];
107
- boot(): Promise<void>;
108
- isBooted(): boolean;
109
- booting(callback: (app: Application$1) => void | Promise<void>): void;
110
- booted(callback: (app: Application$1) => void | Promise<void>): void;
111
- /** Handle one HTTP request in a fresh request scope via the bound HttpKernel. */
112
- handle(request: Request): Promise<Response>;
113
- /** Register a callback that terminate() runs, in registration order. */
114
- terminating(callback: () => void | Promise<void>): void;
115
- terminate(): Promise<void>;
116
- }
117
- declare const Application$1: Token$2<Application$1>;
118
- interface ExceptionHandler {
119
- report(error: unknown): Promise<void>;
120
- shouldReport(error: unknown): boolean;
121
- /** `request` is the scoped HttpRequest (Contracts/Http) when available, else the raw Request. */
122
- render(request: unknown, error: unknown): Promise<Response>;
123
- }
124
- declare const ExceptionHandler: Token$2<ExceptionHandler>;
125
-
126
- interface Arrayable<T = unknown> {
127
- toArray(): T;
128
- }
129
- interface Htmlable$1 {
130
- toHtml(): string;
131
- }
132
- /** The minimal collection surface contracts rely on (implemented by @orieljs/collections). */
133
- interface Enumerable<T> extends Iterable<T>, Arrayable<unknown[]> {
134
- all(): T[];
135
- count(): number;
136
- isEmpty(): boolean;
137
- }
138
-
139
- interface Encrypter {
140
- /** JSON-serializes unless serialize=false (then value must be a string). AES-256-GCM, keyed by APP_KEY. */
141
- encrypt(value: unknown, serialize?: boolean): string;
142
- decrypt<T = unknown>(payload: string, unserialize?: boolean): T;
143
- encryptString(value: string): string;
144
- decryptString(payload: string): string;
145
- getKey(): Uint8Array;
146
- }
147
- declare const Encrypter: Token$2<Encrypter>;
148
-
149
- interface View extends Htmlable$1 {
150
- readonly name: string;
151
- with(key: string | Record<string, unknown>, value?: unknown): this;
152
- render(): Promise<string>;
153
- }
154
- /** Resolves 'posts.index' → resources/views/posts/index.tsx and renders it to HTML on the server. */
155
- interface ViewFactory {
156
- make(name: string, data?: Record<string, unknown>): View;
157
- exists(name: string): boolean;
158
- share(key: string | Record<string, unknown>, value?: unknown): void;
159
- composer(views: string | string[], composer: (view: View) => void | Promise<void>): void;
160
- /** Renders TSX (an element, a string, an Htmlable, a View, promises of them) to HTML, like Blade::render(). */
161
- renderToString(node: unknown): Promise<string>;
162
- }
163
- declare const ViewFactory: Token$2<ViewFactory>;
164
-
165
- type Operator = '=' | '!=' | '<>' | '<' | '<=' | '>' | '>=' | 'like' | 'not like' | 'ilike' | 'in' | 'not in';
166
- type Row = Record<string, unknown>;
167
- /** The minimal query surface other components rely on (Queue, Cache, Session, Validation, Notifications). */
168
- interface QueryBuilder<T = Row> {
169
- select(...columns: string[]): this;
170
- where(column: string, value: unknown): this;
171
- where(column: string, operator: Operator, value: unknown): this;
172
- where(conditions: Row): this;
173
- orWhere(column: string, value: unknown): this;
174
- orWhere(column: string, operator: Operator, value: unknown): this;
175
- whereIn(column: string, values: readonly unknown[]): this;
176
- whereNotIn(column: string, values: readonly unknown[]): this;
177
- whereNull(column: string): this;
178
- whereNotNull(column: string): this;
179
- orderBy(column: string, direction?: 'asc' | 'desc'): this;
180
- limit(count: number): this;
181
- offset(count: number): this;
182
- lockForUpdate(): this;
183
- get(): Promise<Enumerable<T>>;
184
- first(): Promise<T | undefined>;
185
- find(id: unknown): Promise<T | undefined>;
186
- value<V = unknown>(column: string): Promise<V | undefined>;
187
- pluck<V = unknown>(column: string): Promise<Enumerable<V>>;
188
- count(): Promise<number>;
189
- exists(): Promise<boolean>;
190
- insert(values: Row | Row[]): Promise<void>;
191
- /**
192
- * Inserts rows, skipping any that violate a unique key instead of failing (Laravel's insertOrIgnore). Returns the
193
- * number of rows inserted. Nothing is thrown for a duplicate, so a caller's transaction stays usable on Postgres.
194
- */
195
- insertOrIgnore(values: Row | Row[]): Promise<number>;
196
- insertGetId(values: Row, keyName?: string): Promise<number | string>;
197
- update(values: Row): Promise<number>;
198
- upsert(values: Row | Row[], uniqueBy: string[], update?: string[]): Promise<number>;
199
- increment(column: string, amount?: number, extra?: Row): Promise<number>;
200
- decrement(column: string, amount?: number, extra?: Row): Promise<number>;
201
- delete(): Promise<number>;
202
- }
203
- type DriverName = 'pgsql' | 'mysql' | 'sqlite';
204
- interface DatabaseConnection {
205
- getName(): string;
206
- getDriverName(): DriverName;
207
- table<T = Row>(table: string): QueryBuilder<T>;
208
- select<T = Row>(sql: string, bindings?: readonly unknown[]): Promise<T[]>;
209
- statement(sql: string, bindings?: readonly unknown[]): Promise<void>;
210
- /** Nested calls use savepoints. Rolls back if fn throws. */
211
- transaction<R>(fn: (connection: DatabaseConnection) => Promise<R>): Promise<R>;
212
- /**
213
- * Start a transaction that stays open, for every caller of this connection, until commit()/rollBack().
214
- * Nested calls use savepoints. Meant for test isolation (RefreshDatabase); app code uses transaction(fn).
215
- */
216
- beginTransaction(): Promise<void>;
217
- commit(): Promise<void>;
218
- /** Rolls back the innermost level opened by beginTransaction(). Does nothing when none is open. */
219
- rollBack(): Promise<void>;
220
- /** 0 outside a transaction. */
221
- transactionLevel(): number;
222
- }
223
- interface DatabaseManager extends DatabaseConnection {
224
- connection(name?: string): DatabaseConnection;
225
- disconnect(name?: string): Promise<void>;
226
- }
227
- declare const DatabaseManager: Token$2<DatabaseManager>;
228
- /** What non-Database components may rely on from a model instance. */
229
- interface ModelInstance {
230
- exists: boolean;
231
- getKey(): unknown;
232
- getKeyName(): string;
233
- getTable(): string;
234
- getRouteKey(): unknown;
235
- getRouteKeyName(): string;
236
- getAttribute<T = unknown>(key: string): T;
237
- setAttribute(key: string, value: unknown): this;
238
- fill(attributes: Row): this;
239
- save(): Promise<boolean>;
240
- delete(): Promise<boolean>;
241
- refresh(): Promise<this>;
242
- toArray(): Row;
243
- toJSON(): Row;
244
- }
245
-
246
- interface Authenticatable {
247
- getAuthIdentifierName(): string;
248
- getAuthIdentifier(): unknown;
249
- getAuthPassword(): string;
250
- getRememberToken(): string | undefined;
251
- setRememberToken(value: string): void;
252
- getRememberTokenName(): string;
253
- }
254
- type Credentials = Record<string, unknown>;
255
- interface UserProvider {
256
- retrieveById(id: unknown): Promise<Authenticatable | undefined>;
257
- retrieveByToken(id: unknown, token: string): Promise<Authenticatable | undefined>;
258
- updateRememberToken(user: Authenticatable, token: string): Promise<void>;
259
- retrieveByCredentials(credentials: Credentials): Promise<Authenticatable | undefined>;
260
- validateCredentials(user: Authenticatable, credentials: Credentials): Promise<boolean>;
261
- }
262
- interface Guard {
263
- check(): Promise<boolean>;
264
- guest(): Promise<boolean>;
265
- user<T extends Authenticatable = Authenticatable>(): Promise<T | undefined>;
266
- id(): Promise<unknown>;
267
- validate(credentials: Credentials): Promise<boolean>;
268
- hasUser(): boolean;
269
- setUser(user: Authenticatable): void;
270
- }
271
- interface StatefulGuard extends Guard {
272
- attempt(credentials: Credentials, remember?: boolean): Promise<boolean>;
273
- once(credentials: Credentials): Promise<boolean>;
274
- login(user: Authenticatable, remember?: boolean): Promise<void>;
275
- loginUsingId(id: unknown, remember?: boolean): Promise<Authenticatable | false>;
276
- logout(): Promise<void>;
277
- }
278
- interface AuthFactory {
279
- guard(name?: string): StatefulGuard | Guard;
280
- shouldUse(name: string): void;
281
- extend(driver: string, factory: (name: string, config: Record<string, unknown>) => Guard): void;
282
- provider(driver: string, factory: (config: Record<string, unknown>) => UserProvider): void;
283
- }
284
- declare const AuthFactory: Token$2<AuthFactory>;
285
-
286
- /** Options a job class may declare as public fields. Their presence (or implementing ShouldQueue) makes things queueable. */
287
- interface ShouldQueue {
288
- connection?: string;
289
- queue?: string;
290
- /** Seconds. */
291
- delay?: number;
292
- tries?: number;
293
- /** Seconds, or a per-attempt list. */
294
- backoff?: number | number[];
295
- /** Seconds. */
296
- timeout?: number;
297
- uniqueId?(): string;
298
- }
299
- /** A job: public fields are its serialized data; handle() runs on the worker (inject() works inside it). */
300
- interface Job extends Partial<ShouldQueue> {
301
- handle(): unknown | Promise<unknown>;
302
- failed?(error: unknown): void | Promise<void>;
303
- }
304
- interface QueuePayload {
305
- uuid: string;
306
- /** ClassRegistry name. */
307
- job: string;
308
- displayName: string;
309
- data: Record<string, unknown>;
310
- attempts: number;
311
- maxTries?: number;
312
- backoff?: number[];
313
- timeout?: number;
314
- /** Unix ms. */
315
- pushedAt: number;
316
- batchId?: string;
317
- chain?: QueuePayload[];
318
- /** Unix ms after which the job fails instead of retrying. */
319
- retryUntil?: number;
320
- /** Mark the job failed (instead of releasing it) when it times out. */
321
- failOnTimeout?: boolean;
322
- }
323
- interface QueueJob {
324
- getJobId(): string;
325
- getQueue(): string;
326
- payload(): QueuePayload;
327
- attempts(): number;
328
- delete(): Promise<void>;
329
- release(delaySeconds?: number): Promise<void>;
330
- /** Marks as failed: stores it via FailedJobProvider and calls job.failed(). */
331
- fail(error: unknown): Promise<void>;
332
- isDeleted(): boolean;
333
- isReleased(): boolean;
334
- }
335
- interface Queue {
336
- push(job: Job, queue?: string): Promise<string>;
337
- later(delaySeconds: number, job: Job, queue?: string): Promise<string>;
338
- pushRaw(payload: QueuePayload, queue?: string, delaySeconds?: number): Promise<string>;
339
- pop(queue?: string): Promise<QueueJob | undefined>;
340
- size(queue?: string): Promise<number>;
341
- clear(queue?: string): Promise<number>;
342
- }
343
- interface QueueManager extends Queue {
344
- connection(name?: string): Queue;
345
- extend(driver: string, factory: (config: Record<string, unknown>) => Queue): void;
346
- }
347
- declare const QueueManager: Token$2<QueueManager>;
348
-
349
- interface Batch {
350
- readonly id: string;
351
- readonly name: string;
352
- readonly totalJobs: number;
353
- readonly pendingJobs: number;
354
- readonly failedJobs: number;
355
- progress(): number;
356
- finished(): boolean;
357
- cancelled(): boolean;
358
- cancel(): Promise<void>;
359
- }
360
- interface PendingChain {
361
- onConnection(connection: string): this;
362
- onQueue(queue: string): this;
363
- /** Runs as a job if any job in the chain fails. Callbacks are jobs, because closures can't be serialized. */
364
- catch(job: Job): this;
365
- dispatch(): Promise<void>;
366
- }
367
- interface PendingBatch {
368
- name(name: string): this;
369
- onConnection(connection: string): this;
370
- onQueue(queue: string): this;
371
- allowFailures(allow?: boolean): this;
372
- then(job: Job): this;
373
- catch(job: Job): this;
374
- finally(job: Job): this;
375
- dispatch(): Promise<Batch>;
376
- }
377
- interface BusDispatcher {
378
- /** Queues it when the job is queueable (implements ShouldQueue / declares queue options), otherwise runs it now. */
379
- dispatch(job: Job): Promise<unknown>;
380
- dispatchSync(job: Job): Promise<unknown>;
381
- /** Runs after the current response is sent (or the current job finishes). */
382
- dispatchAfterResponse(job: Job): void;
383
- chain(jobs: Job[]): PendingChain;
384
- batch(jobs: Job[]): PendingBatch;
385
- findBatch(id: string): Promise<Batch | undefined>;
386
- }
387
- declare const BusDispatcher: Token$2<BusDispatcher>;
388
- /** What PendingBatch hands to the repository. Callbacks are jobs, because closures can't be serialized. */
389
- interface PendingBatchOptions {
390
- name: string;
391
- then: Job[];
392
- catch: Job[];
393
- finally: Job[];
394
- allowFailures: boolean;
395
- connection?: string;
396
- queue?: string;
397
- }
398
-
399
- interface Address {
400
- address: string;
401
- name?: string;
402
- }
403
- /** A plain email string, an Address, or anything with email (+ optional name), such as a User model. */
404
- type MailRecipient = string | Address | {
405
- email: string;
406
- name?: string;
407
- };
408
- interface Envelope {
409
- from?: MailRecipient;
410
- to?: MailRecipient[];
411
- cc?: MailRecipient[];
412
- bcc?: MailRecipient[];
413
- replyTo?: MailRecipient[];
414
- subject?: string;
415
- tags?: string[];
416
- metadata?: Record<string, string>;
417
- }
418
- interface Content {
419
- /** A View name, rendered by ViewFactory (TSX). */
420
- view?: string;
421
- /** A plain-text view name. */
422
- text?: string;
423
- /** Raw HTML (used when no view is given). */
424
- htmlString?: string;
425
- /** Raw plain-text body (used when no text view is given). */
426
- textString?: string;
427
- with?: Record<string, unknown>;
428
- }
429
- interface Attachment {
430
- name: string;
431
- path?: string;
432
- data?: Uint8Array | string;
433
- mime?: string;
434
- }
435
- /** Laravel 10+ style mailable: envelope() + content() + attachments(). */
436
- interface Mailable {
437
- envelope(): Envelope | Promise<Envelope>;
438
- content(): Content | Promise<Content>;
439
- attachments?(): Attachment[] | Promise<Attachment[]>;
440
- }
441
- /** Fully rendered message handed to a transport. */
442
- interface OutgoingMessage {
443
- from: Address;
444
- to: Address[];
445
- cc: Address[];
446
- bcc: Address[];
447
- replyTo: Address[];
448
- subject: string;
449
- html?: string;
450
- text?: string;
451
- attachments: Attachment[];
452
- headers: Record<string, string>;
453
- }
454
- interface SentMessage {
455
- messageId: string;
456
- message: OutgoingMessage;
457
- }
458
- interface MailTransport {
459
- send(message: OutgoingMessage): Promise<SentMessage>;
460
- }
461
- interface PendingMail {
462
- cc(recipients: MailRecipient | MailRecipient[]): this;
463
- bcc(recipients: MailRecipient | MailRecipient[]): this;
464
- send(mailable: Mailable): Promise<SentMessage | undefined>;
465
- queue(mailable: Mailable): Promise<void>;
466
- later(delaySeconds: number, mailable: Mailable): Promise<void>;
467
- }
468
- interface Mailer {
469
- to(recipients: MailRecipient | MailRecipient[]): PendingMail;
470
- /** Sends to the recipients given in the mailable's envelope. Queues it if the mailable is queueable. */
471
- send(mailable: Mailable): Promise<SentMessage | undefined>;
472
- queue(mailable: Mailable): Promise<void>;
473
- }
474
- interface MailManager extends Mailer {
475
- mailer(name?: string): Mailer;
476
- extend(transport: string, factory: (config: Record<string, unknown>) => MailTransport): void;
477
- }
478
- declare const MailManager: Token$2<MailManager>;
479
-
480
- interface Notifiable {
481
- /** e.g. 'mail' → email address, 'database' → the model itself. */
482
- routeNotificationFor(channel: string, notification: Notification): unknown;
483
- }
484
- interface Notification {
485
- /** Optional id; set by the dispatcher when missing. */
486
- id?: string;
487
- via(notifiable: Notifiable): string[];
488
- /** Returns a Mailable (Contracts/Mail) or the Notifications MailMessage builder. */
489
- toMail?(notifiable: Notifiable): unknown;
490
- toDatabase?(notifiable: Notifiable): Record<string, unknown>;
491
- toArray?(notifiable: Notifiable): Record<string, unknown>;
492
- }
493
- interface NotificationChannel {
494
- send(notifiable: Notifiable, notification: Notification): Promise<void>;
495
- }
496
- interface NotificationDispatcher {
497
- /** Queues it when the notification is queueable, otherwise sends immediately. */
498
- send(notifiables: Notifiable | Notifiable[], notification: Notification): Promise<void>;
499
- sendNow(notifiables: Notifiable | Notifiable[], notification: Notification, channels?: string[]): Promise<void>;
500
- /** On-demand: Notification.route('mail', 'a@b.c').notify(n). */
501
- route(channel: string, route: unknown): Notifiable & {
502
- notify(notification: Notification): Promise<void>;
503
- };
504
- extend(channel: string, factory: () => NotificationChannel): void;
505
- }
506
- declare const NotificationDispatcher: Token$2<NotificationDispatcher>;
507
-
508
- type ListenerClass<E> = Class$1<{
509
- handle(event: E): unknown;
510
- }>;
511
- type Listener<E> = ((event: E) => unknown) | ListenerClass<E>;
512
- interface EventDispatcher {
513
- /** Class events (recommended) or string events like 'eloquent.created: Post'. */
514
- listen<E>(events: Class$1<E> | string | Array<Class$1<E> | string>, listener: Listener<E>): void;
515
- hasListeners(event: Class$1<unknown> | string): boolean;
516
- /** Runs listeners in registration order. Listener classes that are queueable are queued. Returns results. */
517
- dispatch(event: object | string, payload?: unknown[]): Promise<unknown[]>;
518
- /** Stops at the first listener that returns something other than undefined. Returns that value. */
519
- until(event: object | string, payload?: unknown[]): Promise<unknown>;
520
- subscribe(subscriber: Class$1<{
521
- subscribe(events: EventDispatcher): void;
522
- }>): void;
523
- forget(event: Class$1<unknown> | string): void;
524
- }
525
- declare const EventDispatcher: Token$2<EventDispatcher>;
526
-
527
- interface PutOptions {
528
- visibility?: 'public' | 'private';
529
- mimeType?: string;
530
- }
531
- /** Paths are relative to the disk root. Throws on paths that escape it ('../'). */
532
- interface Filesystem {
533
- exists(path: string): Promise<boolean>;
534
- missing(path: string): Promise<boolean>;
535
- get(path: string): Promise<string>;
536
- getBytes(path: string): Promise<Uint8Array>;
537
- readStream(path: string): Promise<ReadableStream<Uint8Array>>;
538
- put(path: string, contents: string | Uint8Array | ReadableStream<Uint8Array>, options?: PutOptions): Promise<boolean>;
539
- /** Stores under a generated unique name. Returns the stored path. */
540
- putFile(directory: string, file: UploadedFile$1, options?: PutOptions): Promise<string>;
541
- putFileAs(directory: string, file: UploadedFile$1, name: string, options?: PutOptions): Promise<string>;
542
- delete(paths: string | string[]): Promise<boolean>;
543
- copy(from: string, to: string): Promise<boolean>;
544
- move(from: string, to: string): Promise<boolean>;
545
- size(path: string): Promise<number>;
546
- lastModified(path: string): Promise<Date>;
547
- mimeType(path: string): Promise<string | undefined>;
548
- url(path: string): string;
549
- temporaryUrl(path: string, expiresAt: Date): Promise<string>;
550
- files(directory?: string, recursive?: boolean): Promise<string[]>;
551
- directories(directory?: string, recursive?: boolean): Promise<string[]>;
552
- makeDirectory(path: string): Promise<boolean>;
553
- deleteDirectory(path: string): Promise<boolean>;
554
- /** Absolute local path (local disks only). */
555
- path(path: string): string;
556
- }
557
- interface FilesystemManager extends Filesystem {
558
- disk(name?: string): Filesystem;
559
- extend(driver: string, factory: (config: Record<string, unknown>) => Filesystem): void;
560
- }
561
- declare const FilesystemManager: Token$2<FilesystemManager>;
562
-
563
- /** Infinite-scroll metadata for one prop (page.scrollProps[path]). */
564
- interface InertiaScrollProp {
565
- pageName: string;
566
- previousPage: string | number | null;
567
- nextPage: string | number | null;
568
- currentPage: string | number | null;
569
- reset: boolean;
570
- }
571
- /** A once prop the client keeps between visits (page.onceProps[key]). `expiresAt` is epoch milliseconds. */
572
- interface InertiaOnceProp {
573
- prop: string;
574
- expiresAt: number | null;
575
- }
4
+ /** A date the tests travel to: a Date, an ISO string or milliseconds since the epoch. */
5
+ type TravelDate = Date | string | number;
576
6
  /**
577
- * The Inertia page object (protocol v3, @inertiajs/core 3.x). Only component, props, url and version are always
578
- * present; the other fields are left out when empty or false.
7
+ * Laravel's travelTo(): the clock stands at `date` (new Date(), Date.now() and now() all read it) until travelBack().
8
+ * With a callback, it runs there and the clock travels back after it; its result is returned.
579
9
  */
580
- interface InertiaPage {
581
- component: string;
582
- props: Record<string, unknown>;
583
- /** Path and query, never absolute: '/posts?page=2'. */
584
- url: string;
585
- /** '' when the app has no asset version. */
586
- version: string;
587
- sharedProps?: string[];
588
- mergeProps?: string[];
589
- prependProps?: string[];
590
- deepMergeProps?: string[];
591
- /** '<prop path>.<key field>', e.g. 'posts.data.id'. */
592
- matchPropsOn?: string[];
593
- /** Group name → prop paths loaded after the first render. */
594
- deferredProps?: Record<string, string[]>;
595
- rescuedProps?: string[];
596
- scrollProps?: Record<string, InertiaScrollProp>;
597
- onceProps?: Record<string, InertiaOnceProp>;
598
- clearHistory?: true;
599
- encryptHistory?: true;
600
- flash?: Record<string, unknown>;
601
- preserveFragment?: true;
10
+ declare function travelTo(date: TravelDate): void;
11
+ declare function travelTo<R>(date: TravelDate, callback: (date: Date) => R): R;
12
+ /** Laravel's travelBack(): the real clock again. Returns the real time. */
13
+ declare function travelBack(): Date;
14
+ /** Laravel's freezeTime(): holds the clock where it is now. Returns that time, or the callback's result. */
15
+ declare function freezeTime(): Date;
16
+ declare function freezeTime<R>(callback: (date: Date) => R): R;
17
+ /** Laravel's freezeSecond(): freezeTime() at the start of the current second. */
18
+ declare function freezeSecond(): Date;
19
+ declare function freezeSecond<R>(callback: (date: Date) => R): R;
20
+ /** Laravel's travel(5).minutes(): moves the clock on (a negative value moves it back) from where it stands. */
21
+ declare function travel(value: number): Wormhole;
22
+ /**
23
+ * Laravel's Wormhole: each unit moves the clock by `value` of it (months and years overflow as Carbon's do: 31 January
24
+ * plus a month is 3 March), in UTC. With a callback, it runs there, the clock travels back after it, and its result is
25
+ * returned. JavaScript dates hold milliseconds, so there are no microseconds.
26
+ */
27
+ declare class Wormhole {
28
+ #private;
29
+ readonly value: number;
30
+ constructor(value: number);
31
+ millisecond(): void;
32
+ millisecond<R>(callback: () => R): R;
33
+ milliseconds(): void;
34
+ milliseconds<R>(callback: () => R): R;
35
+ second(): void;
36
+ second<R>(callback: () => R): R;
37
+ seconds(): void;
38
+ seconds<R>(callback: () => R): R;
39
+ minute(): void;
40
+ minute<R>(callback: () => R): R;
41
+ minutes(): void;
42
+ minutes<R>(callback: () => R): R;
43
+ hour(): void;
44
+ hour<R>(callback: () => R): R;
45
+ hours(): void;
46
+ hours<R>(callback: () => R): R;
47
+ day(): void;
48
+ day<R>(callback: () => R): R;
49
+ days(): void;
50
+ days<R>(callback: () => R): R;
51
+ week(): void;
52
+ week<R>(callback: () => R): R;
53
+ weeks(): void;
54
+ weeks<R>(callback: () => R): R;
55
+ month(): void;
56
+ month<R>(callback: () => R): R;
57
+ months(): void;
58
+ months<R>(callback: () => R): R;
59
+ year(): void;
60
+ year<R>(callback: () => R): R;
61
+ years(): void;
62
+ years<R>(callback: () => R): R;
63
+ /** Laravel's Wormhole::back(). */
64
+ static back(): Date;
602
65
  }
603
66
 
604
67
  /**
@@ -616,7 +79,7 @@ declare class PendingCommand implements PromiseLike<number> {
616
79
  readonly parameters: Record<string, unknown>;
617
80
  private readonly checks;
618
81
  private result;
619
- constructor(app: Application$1, command: string, parameters?: Record<string, unknown>);
82
+ constructor(app: Application, command: string, parameters?: Record<string, unknown>);
620
83
  /** A line of output equals `line` exactly; with no argument, the command printed something. */
621
84
  expectsOutput(line?: string): this;
622
85
  /** No line equals `line`; with no argument, the command printed nothing at all. */
@@ -760,9 +223,9 @@ interface ResponseContext {
760
223
  /** The raw request sent to the kernel (redirect URLs are resolved against it). */
761
224
  request?: Request;
762
225
  /** The application that handled it. */
763
- app?: Application$1;
226
+ app?: Application;
764
227
  /** The request's session after the response. */
765
- session?: Session$1;
228
+ session?: Session;
766
229
  /** Views made while handling the request, in order. */
767
230
  views?: View[];
768
231
  /** The last error the exception handler rendered. */
@@ -874,7 +337,7 @@ declare class TestResponse {
874
337
  /** Validation errors for these keys (message fragments match with "contains"): JSON body or session. */
875
338
  assertInvalid(errors: ExpectedErrors, errorBag?: string, responseKey?: string): this;
876
339
  /** The request's session after the response (flashed data is still there). */
877
- session(): Session$1;
340
+ session(): Session;
878
341
  /** A key (with an optional value or predicate), several keys, or a { key: value } record. */
879
342
  assertSessionHas(key: string | string[] | Record<string, unknown>, value?: unknown): this;
880
343
  assertSessionHasAll(bindings: Record<string, unknown>): this;
@@ -939,7 +402,7 @@ interface RequestOptions {
939
402
  * requests, actingAs users and options, plus the dispatch itself.
940
403
  */
941
404
  declare class HttpClient {
942
- protected readonly app: Application$1;
405
+ protected readonly app: Application;
943
406
  readonly headers: Record<string, string>;
944
407
  /** Cookies to encrypt on send (withCookie) and to send as-is (withUnencryptedCookie, or captured from responses). */
945
408
  readonly cookies: Map<string, {
@@ -958,10 +421,10 @@ declare class HttpClient {
958
421
  previousUrl: string | undefined;
959
422
  /** Requests whose actingAs users reached the guards (the AuthFactory they went through). */
960
423
  private readonly actingAsApplied;
961
- constructor(app: Application$1);
424
+ constructor(app: Application);
962
425
  request(method: string, uri: string, options?: RequestOptions): Promise<TestResponse>;
963
426
  /** Runs `fn` in a scope prepared like a request's (carried session, actingAs users), e.g. for assertAuthenticated(). */
964
- inScope<T>(fn: (scope: Container$1) => T | Promise<T>): Promise<T>;
427
+ inScope<T>(fn: (scope: Container) => T | Promise<T>): Promise<T>;
965
428
  /**
966
429
  * Runs `run` in a request scope like this client's requests have (a request for `method uri` bound, the carried
967
430
  * session, actingAs users), then carries the session and the users on, as after a request. Live.test() runs its
@@ -971,16 +434,16 @@ declare class HttpClient {
971
434
  /** Runs the request through the app's real HttpKernel, in a request scope this client owns. */
972
435
  protected send(request: Request): Promise<TestResponse>;
973
436
  /** Prepares the request scope: recorders, the carried session and actingAs users. */
974
- protected beforeRequest(scope: Container$1, context: ResponseContext): void;
437
+ protected beforeRequest(scope: Container, context: ResponseContext): void;
975
438
  /** Keeps the session for the next request, like Laravel's per-test session store, and the guards' users. */
976
- protected afterRequest(_scope: Container$1, context: ResponseContext): Promise<void>;
439
+ protected afterRequest(_scope: Container, context: ResponseContext): Promise<void>;
977
440
  /**
978
441
  * Laravel's actingAs() sets the user on the guard once, so a logout (or a login as someone else) in the
979
442
  * request sticks. Reads each actingAs guard back and forgets or replaces its user to match.
980
443
  */
981
444
  protected syncActingAs(auth: AuthFactory): Promise<void>;
982
445
  /** The request's (scoped) Session, created now so the carried attributes are in place before StartSession. */
983
- protected scopeSession(scope: Container$1): Session$1 | undefined;
446
+ protected scopeSession(scope: Container): Session | undefined;
984
447
  buildRequest(method: string, uri: string, options: RequestOptions): Request;
985
448
  protected baseUrl(): string;
986
449
  protected cookieHeader(): string;
@@ -1025,20 +488,20 @@ declare abstract class InteractsWithApplication {
1025
488
  hooks?: TestHooks;
1026
489
  }, options?: BootOptions): T;
1027
490
  /** The current test's application. */
1028
- get app(): Application$1;
491
+ get app(): Application;
1029
492
  /**
1030
493
  * A fresh application for one test. tests/TestCase.ts overrides this to call bootstrap/app's factory.
1031
494
  * The default builds one at basePath() with providers(), for package tests with no skeleton.
1032
495
  */
1033
- createApplication(): Promise<Application$1>;
496
+ createApplication(): Promise<Application>;
1034
497
  /** Used by the default createApplication(). */
1035
498
  protected basePath(): string;
1036
499
  /** Used by the default createApplication(). */
1037
- protected providers(): Array<ServiceProvider$2 | ServiceProviderClass$1>;
500
+ protected providers(): Array<ServiceProvider | ServiceProviderClass>;
1038
501
  /** The variables applied (unless already set) before each application is created. */
1039
502
  protected environment(): Record<string, string>;
1040
503
  /** Adjust the fresh app before it boots, e.g. `app.make(ConfigRepository).set('mail.default', 'array')`. */
1041
- protected defineEnvironment(_app: Application$1): void | Promise<void>;
504
+ protected defineEnvironment(_app: Application): void | Promise<void>;
1042
505
  setUp(): Promise<void>;
1043
506
  tearDown(): Promise<void>;
1044
507
  /**
@@ -1136,11 +599,28 @@ declare abstract class InteractsWithConsole extends InteractsWithDatabase {
1136
599
  artisan(command: string, parameters?: Record<string, unknown>): PendingCommand;
1137
600
  }
1138
601
 
602
+ /**
603
+ * Laravel's InteractsWithTime: `t.travelTo(date)`, `t.travel(5).minutes()`, `t.freezeTime()`, `t.travelBack()`.
604
+ * The functions of the same names do the same outside a test case. A test case's tearDown travels back, so each of its
605
+ * tests ends in the real time; with the plain functions, call `travelBack()` in your own `afterEach()` or pass a callback.
606
+ */
607
+ declare abstract class InteractsWithTime extends InteractsWithConsole {
608
+ travelTo(date: TravelDate): void;
609
+ travelTo<R>(date: TravelDate, callback: (date: Date) => R): R;
610
+ travel(value: number): Wormhole;
611
+ travelBack(): Date;
612
+ freezeTime(): Date;
613
+ freezeTime<R>(callback: (date: Date) => R): R;
614
+ freezeSecond(): Date;
615
+ freezeSecond<R>(callback: (date: Date) => R): R;
616
+ tearDown(): Promise<void>;
617
+ }
618
+
1139
619
  /**
1140
620
  * Laravel's TestCase. Extend it in tests/TestCase.ts (override createApplication() and set `static hooks`),
1141
621
  * then in each file: `const t = TestCase.boot()`, or `TestCase.boot({ uses: [RefreshDatabase] })`.
1142
622
  */
1143
- declare abstract class TestCase extends InteractsWithConsole {
623
+ declare abstract class TestCase extends InteractsWithTime {
1144
624
  }
1145
625
 
1146
626
  /**
@@ -1181,9 +661,9 @@ declare const RefreshDatabaseState: {
1181
661
  migrated: boolean;
1182
662
  };
1183
663
  /** Runs a console command through the ConsoleKernel contract; a non-zero exit fails the test with its output. */
1184
- declare function runCommand(app: Application$1, command: string, parameters?: Record<string, unknown>): Promise<void>;
664
+ declare function runCommand(app: Application, command: string, parameters?: Record<string, unknown>): Promise<void>;
1185
665
  /** Laravel's usingInMemoryDatabase(): the default connection's database is ':memory:'. */
1186
- declare function usingInMemoryDatabase(app: Application$1): boolean;
666
+ declare function usingInMemoryDatabase(app: Application): boolean;
1187
667
  /**
1188
668
  * Laravel's RefreshDatabase.
1189
669
  * - In-memory SQLite: every test's new application has an empty database, so it just runs `migrate`.
@@ -1197,11 +677,11 @@ declare const DatabaseMigrations: TestTrait;
1197
677
  declare const DatabaseTransactions: TestTrait;
1198
678
 
1199
679
  /** What an assertion targets: a class (exact constructor), or a name (a string event, a class name or a registry name). */
1200
- type Target<T = unknown> = Class$1<T> | string;
680
+ type Target<T = unknown> = Class<T> | string;
1201
681
  /** A count, or a filter over the recorded items. */
1202
682
  type CountOrFilter<A extends unknown[]> = number | ((...args: A) => boolean);
1203
683
  /** Swaps the fake in through the facade machinery (`facade(token).swap(fake)`: an instance on the current container). */
1204
- declare function install<T extends object, F extends T>(token: Token$1<T>, fake: F): F;
684
+ declare function install<T extends object, F extends T>(token: Token<T>, fake: F): F;
1205
685
  declare function nameOf(target: Target | object): string;
1206
686
  /** A recorded object (or string event) matches a target: same constructor, or the same (class) name. */
1207
687
  declare function matches(item: unknown, target: Target): boolean;
@@ -1212,6 +692,8 @@ interface DispatchedEvent {
1212
692
  payload: unknown[];
1213
693
  }
1214
694
  type EventFilter<E> = (event: E, payload: unknown[]) => boolean;
695
+ /** A listener as assertListening() expects it: a class, a [class, method] pair, a closure, or Function for any closure. */
696
+ type ExpectedListener = Listener<never> | readonly [Class<object>, string] | FunctionConstructor;
1215
697
  /**
1216
698
  * Laravel's Event::fake(): records dispatched events instead of running listeners. With a list, only those
1217
699
  * events are faked and everything else reaches the original dispatcher (so model events keep working).
@@ -1228,25 +710,31 @@ declare class EventFake implements EventDispatcher {
1228
710
  static fakeExcept(eventsToDispatch: Target | Target[]): EventFake;
1229
711
  private static original;
1230
712
  except(events: Target | Target[]): this;
1231
- listen<E>(events: Class$1<E> | string | Array<Class$1<E> | string>, listener: Listener<E>): void;
1232
- hasListeners(event: Class$1<unknown> | string): boolean;
713
+ listen<E>(events: Class<E> | string | Array<Class<E> | string>, listener: Listener<E>): void;
714
+ hasListeners(event: Class<unknown> | string): boolean;
1233
715
  dispatch(event: object | string, payload?: unknown[]): Promise<unknown[]>;
1234
716
  /** Faked events return undefined (never false), so halting model events such as `saving` still proceed. */
1235
717
  until(event: object | string, payload?: unknown[]): Promise<unknown>;
1236
- subscribe(subscriber: Class$1<{
718
+ subscribe(subscriber: Class<{
1237
719
  subscribe(events: EventDispatcher): void;
1238
720
  }>): void;
1239
- forget(event: Class$1<unknown> | string): void;
721
+ forget(event: Class<unknown> | string): void;
1240
722
  /** Dispatched at least once; a number asserts the exact count; a function filters (event, payload). */
1241
- assertDispatched<E>(event: Class$1<E> | string, callback?: CountOrFilter<[E, unknown[]]>): void;
1242
- assertDispatchedTimes<E>(event: Class$1<E> | string, times?: number): void;
1243
- assertNotDispatched<E>(event: Class$1<E> | string, callback?: EventFilter<E>): void;
723
+ assertDispatched<E>(event: Class<E> | string, callback?: CountOrFilter<[E, unknown[]]>): void;
724
+ assertDispatchedTimes<E>(event: Class<E> | string, times?: number): void;
725
+ assertNotDispatched<E>(event: Class<E> | string, callback?: EventFilter<E>): void;
1244
726
  assertNothingDispatched(): void;
1245
- /** The original dispatcher has a listener for the event. */
1246
- assertListening(event: Class$1<unknown> | string): void;
727
+ /**
728
+ * Laravel's assertListening(event, listener): the original dispatcher has that listener for the event (a class, a
729
+ * [class, method] pair, the same closure, or Function for any closure; wildcard listeners count for a string event).
730
+ * With only the event, any listener will do.
731
+ */
732
+ assertListening(event: Class<unknown> | string, listener?: ExpectedListener): void;
1247
733
  /** The recorded events (objects, or names for string events) that match. */
1248
- dispatched<E>(event: Class$1<E> | string, callback?: EventFilter<E>): E[];
1249
- hasDispatched(event: Class$1<unknown> | string): boolean;
734
+ dispatched<E>(event: Class<E> | string, callback?: EventFilter<E>): E[];
735
+ hasDispatched(event: Class<unknown> | string): boolean;
736
+ /** The original dispatcher's listeners for the event, as registered, wildcard ones included for a string event. */
737
+ private listenersFor;
1250
738
  private shouldFake;
1251
739
  }
1252
740
 
@@ -1400,6 +888,8 @@ declare class MailFake implements MailManager {
1400
888
  mailer(name?: string): Mailer;
1401
889
  to(recipients: MailRecipient | MailRecipient[]): PendingMail;
1402
890
  send(mailable: Mailable): Promise<SentMessage | undefined>;
891
+ /** Recorded as sent, never queued, like the real sendNow(). */
892
+ sendNow(mailable: Mailable): Promise<SentMessage | undefined>;
1403
893
  queue(mailable: Mailable): Promise<void>;
1404
894
  extend(_transport: string, _factory: (config: Record<string, unknown>) => MailTransport): void;
1405
895
  /** Sent (not queued) at least once; a number asserts the count; a filter gets (mailable, record). */
@@ -1421,6 +911,7 @@ declare class MailFake implements MailManager {
1421
911
  hasQueued(mailable: Target<Mailable>): boolean;
1422
912
  private pending;
1423
913
  private sendVia;
914
+ private sendNowVia;
1424
915
  private queueVia;
1425
916
  private record;
1426
917
  private matching;
@@ -1469,7 +960,7 @@ declare class NotificationFake implements NotificationDispatcher {
1469
960
  /** Sent this many times in total, to anyone. */
1470
961
  assertSentTimes(notification: Target<Notification>, times: number): void;
1471
962
  assertCount(expected: number): void;
1472
- sent<N extends Notification>(notifiable: Notifiable, notification: Target<N> | Class$1<N>, callback?: Filter<N>): N[];
963
+ sent<N extends Notification>(notifiable: Notifiable, notification: Target<N> | Class<N>, callback?: Filter<N>): N[];
1473
964
  hasSent(notifiable: Notifiable, notification: Target<Notification>): boolean;
1474
965
  private record;
1475
966
  }
@@ -1480,6 +971,7 @@ interface StoredFile {
1480
971
  mimeType: string | undefined;
1481
972
  modified: Date;
1482
973
  }
974
+ /** By the extension as PHP's pathinfo() reads it: after the last dot of the base name ('.pdf' is a PDF, 'pdf' isn't). */
1483
975
  declare function guessMimeType(path: string): string | undefined;
1484
976
  /**
1485
977
  * An in-memory disk implementing the Filesystem contract, with Laravel's fake-disk assertions. (Laravel's fake
@@ -1499,8 +991,13 @@ declare class FakeDisk implements Filesystem {
1499
991
  getBytes(path: string): Promise<Uint8Array>;
1500
992
  readStream(path: string): Promise<ReadableStream<Uint8Array>>;
1501
993
  put(path: string, contents: string | Uint8Array | ReadableStream<Uint8Array>, options?: PutOptions): Promise<boolean>;
1502
- putFile(directory: string, file: UploadedFile$1, options?: PutOptions): Promise<string>;
1503
- putFileAs(directory: string, file: UploadedFile$1, name: string, options?: PutOptions): Promise<string>;
994
+ putFile(directory: string, file: UploadedFile, options?: PutOptions): Promise<string>;
995
+ /**
996
+ * The upload's own type, as the S3 disk sends it: its extension(), never the MIME type the client sent as such nor
997
+ * the stored name's type.
998
+ */
999
+ putFileAs(directory: string, file: UploadedFile, name: string, options?: PutOptions): Promise<string>;
1000
+ private write;
1504
1001
  delete(paths: string | string[]): Promise<boolean>;
1505
1002
  copy(from: string, to: string): Promise<boolean>;
1506
1003
  move(from: string, to: string): Promise<boolean>;
@@ -1541,8 +1038,8 @@ declare class StorageFake implements FilesystemManager {
1541
1038
  getBytes(path: string): Promise<Uint8Array<ArrayBufferLike>>;
1542
1039
  readStream(path: string): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
1543
1040
  put(path: string, contents: string | Uint8Array | ReadableStream<Uint8Array>, options?: PutOptions): Promise<boolean>;
1544
- putFile(directory: string, file: UploadedFile$1, options?: PutOptions): Promise<string>;
1545
- putFileAs(directory: string, file: UploadedFile$1, name: string, options?: PutOptions): Promise<string>;
1041
+ putFile(directory: string, file: UploadedFile, options?: PutOptions): Promise<string>;
1042
+ putFileAs(directory: string, file: UploadedFile, name: string, options?: PutOptions): Promise<string>;
1546
1043
  delete(paths: string | string[]): Promise<boolean>;
1547
1044
  copy(from: string, to: string): Promise<boolean>;
1548
1045
  move(from: string, to: string): Promise<boolean>;
@@ -1560,351 +1057,19 @@ declare class StorageFake implements FilesystemManager {
1560
1057
 
1561
1058
  /** Laravel's UploadedFile::fake(): File objects to post as multipart uploads (t.post(uri, { avatar: file })). */
1562
1059
  declare const FakeFile: {
1563
- /** A file of `kilobytes` KiB (zero bytes), typed by `mimeType` or the extension. */
1060
+ /**
1061
+ * A file of `kilobytes` KiB typed by `mimeType` or the name's extension. Validation reads a file's bytes, so the
1062
+ * file starts like its type (a PDF's `%PDF-`, a PNG's signature, text for text types) and passes `mimes` for its
1063
+ * name, as Laravel's fakes do. It is at least its type's leading bytes and never empty, whatever the size asked for.
1064
+ * An image made this way has no readable size: use image() for `dimensions`.
1065
+ */
1564
1066
  create(name: string, kilobytes?: number, mimeType?: string): File;
1565
- /** A real PNG image of the given size (typed by the name's extension, like Laravel's image()). */
1566
- image(name: string, width?: number, height?: number): File;
1567
- };
1568
-
1569
- /** A typed, runtime-unique key for container bindings. */
1570
- interface Token<T> {
1571
- readonly id: symbol;
1572
- readonly description: string;
1573
- /** Phantom field: only carries T at the type level. Never set at runtime. */
1574
- readonly __type?: T;
1575
- }
1576
- type Class<T> = abstract new (...args: any[]) => T;
1577
- type Abstract<T> = Token<T> | Class<T>;
1578
- type Factory<T> = (container: Container) => T;
1579
- type Concrete<T> = Factory<T> | (new () => T);
1580
- interface Container {
1581
- /** New instance on every make(). A class with no concrete binds to itself (constructed with no args). Root only; throws on a scope. */
1582
- bind<T>(abstract: Abstract<T>, concrete?: Concrete<T>): void;
1583
- /** One instance for the life of this container and its scopes. Root only; throws on a scope. */
1584
- singleton<T>(abstract: Abstract<T>, concrete?: Concrete<T>): void;
1585
- /** One instance per scope (e.g. per HTTP request or queue job). Root only; throws on a scope. */
1586
- scoped<T>(abstract: Abstract<T>, concrete?: Concrete<T>): void;
1587
- /** Register an existing object as a shared instance. Returns it. On a scope it stays local to that scope. */
1588
- instance<T>(abstract: Abstract<T>, instance: T): T;
1589
- /** Resolve. Unbound classes are constructed with `new Class()`. Unbound tokens throw BindingResolutionError. */
1590
- make<T>(abstract: Abstract<T>): T;
1591
- bound(abstract: Abstract<unknown>): boolean;
1592
- resolved(abstract: Abstract<unknown>): boolean;
1593
- /** Decorate or replace an instance each time it's resolved (applied before resolving callbacks). Root only; throws on a scope. */
1594
- extend<T>(abstract: Abstract<T>, extender: (instance: T, container: Container) => T): void;
1595
- /** Called after each resolution of the abstract. Root only; throws on a scope. */
1596
- resolving<T>(abstract: Abstract<T>, callback: (instance: T, container: Container) => void): void;
1597
- forgetInstance(abstract: Abstract<unknown>): void;
1598
- /** A child container: shares bindings and singletons with its parent, and has its own scoped instances. Bindings can't be registered on it. */
1599
- createScope(): Container;
1600
- /** Run fn with this container as the "current" one for inject(), helpers and facades (AsyncLocalStorage). */
1601
- run<R>(fn: () => R): R;
1602
- }
1603
- declare const Container: Token<Container>;
1604
-
1605
- /** The session of the current request (scoped). Loaded and saved by the StartSession middleware. */
1606
- interface Session {
1607
- getId(): string;
1608
- start(): Promise<void>;
1609
- save(): Promise<void>;
1610
- all(): Record<string, unknown>;
1611
- has(key: string): boolean;
1612
- get<T = unknown>(key: string, defaultValue?: T): T;
1613
- put(key: string | Record<string, unknown>, value?: unknown): void;
1614
- push(key: string, value: unknown): void;
1615
- pull<T = unknown>(key: string, defaultValue?: T): T;
1616
- forget(...keys: string[]): void;
1617
- flush(): void;
1618
- flash(key: string, value: unknown): void;
1619
- now(key: string, value: unknown): void;
1620
- reflash(): void;
1621
- keep(...keys: string[]): void;
1622
- getOldInput<T = unknown>(key?: string, defaultValue?: T): T;
1623
- flashInput(input: Record<string, unknown>): void;
1624
- token(): string;
1625
- regenerateToken(): void;
1626
- regenerate(destroy?: boolean): Promise<void>;
1627
- invalidate(): Promise<void>;
1628
- previousUrl(): string | undefined;
1629
- setPreviousUrl(url: string): void;
1630
- }
1631
- declare const Session: Token$2<Session>;
1632
-
1633
- /** A rule object (Laravel's ValidationRule). Call fail() to reject the value. */
1634
- interface ValidationRule {
1635
- validate(attribute: string, value: unknown, fail: (message: string) => void, data: Record<string, unknown>): void | Promise<void>;
1636
- }
1637
- /** 'required|string|max:255', or an array mixing strings and rule objects. Keys support dot + `*` wildcards. */
1638
- type Rules = Record<string, string | ReadonlyArray<string | ValidationRule>>;
1639
- interface MessageBag {
1640
- has(key: string): boolean;
1641
- first(key?: string): string | undefined;
1642
- get(key: string): string[];
1643
- all(): string[];
1644
- isEmpty(): boolean;
1645
- count(): number;
1646
- toObject(): Record<string, string[]>;
1647
- }
1648
- interface UploadedFile {
1649
- readonly clientName: string;
1650
- readonly mimeType: string;
1651
- readonly size: number;
1652
- extension(): string;
1653
- arrayBuffer(): Promise<ArrayBuffer>;
1654
- /** Stores on a Filesystem disk. Returns the stored path. */
1655
- store(directory: string, disk?: string): Promise<string>;
1656
- storeAs(directory: string, name: string, disk?: string): Promise<string>;
1657
- }
1658
- /**
1659
- * Oriel's request wrapper (one per request, scoped).
1660
- * The Http kernel awaits `load()` before any middleware runs, so every input accessor below is synchronous.
1661
- */
1662
- interface HttpRequest {
1663
- readonly raw: Request;
1664
- load(): Promise<this>;
1665
- method(): string;
1666
- isMethod(method: string): boolean;
1667
- url(): string;
1668
- fullUrl(): string;
1669
- path(): string;
1670
- is(...patterns: string[]): boolean;
1671
- routeIs(...names: string[]): boolean;
1672
- header(name: string): string | undefined;
1673
- header(name: string, defaultValue: string): string;
1674
- bearerToken(): string | undefined;
1675
- ip(): string | undefined;
1676
- /** The raw body as text (Laravel's getContent()); '' when there is none. */
1677
- content(): string;
1678
- expectsJson(): boolean;
1679
- ajax(): boolean;
1680
- query<T = unknown>(key?: string, defaultValue?: T): T;
1681
- input<T = unknown>(key?: string, defaultValue?: T): T;
1682
- all(): Record<string, unknown>;
1683
- only(...keys: string[]): Record<string, unknown>;
1684
- except(...keys: string[]): Record<string, unknown>;
1685
- has(...keys: string[]): boolean;
1686
- filled(key: string): boolean;
1687
- boolean(key: string, defaultValue?: boolean): boolean;
1688
- integer(key: string, defaultValue?: number): number;
1689
- merge(values: Record<string, unknown>): this;
1690
- file(key: string): UploadedFile | undefined;
1691
- cookie(name: string): string | undefined;
1692
- /** Replace the parsed request cookies (EncryptCookies calls this after decrypting). */
1693
- setCookies(cookies: Record<string, string>): void;
1694
- /** Route parameter (after model binding), or every parameter when called with no key. */
1695
- route<T = unknown>(key?: string): T;
1696
- session(): Session;
1697
- /** The user resolved earlier by auth middleware. Undefined for guests. Use `await Auth.user()` to resolve lazily. */
1698
- user<T = unknown>(guard?: string): T | undefined;
1699
- setUserResolver(resolver: (guard?: string) => unknown): void;
1700
- /** Validates this request's input via the ValidationFactory; throws a Validation OrielError (422) on failure. */
1701
- validate<T = Record<string, unknown>>(rules: Rules, messages?: Record<string, string>, attributes?: Record<string, string>): Promise<T>;
1702
- }
1703
- declare const HttpRequest: Token$2<HttpRequest>;
1704
- type Next = (request: HttpRequest) => Promise<Response>;
1705
- interface Middleware {
1706
- handle(request: HttpRequest, next: Next, ...parameters: string[]): Promise<Response>;
1707
- terminate?(request: HttpRequest, response: Response): Promise<void>;
1708
- }
1709
- type MiddlewareClass = new (...args: any[]) => Middleware;
1710
-
1711
- interface ServiceProvider$1 {
1712
- /** Bind things into the container. Synchronous. Don't resolve other services here. */
1713
- register?(): void;
1714
- /** Runs after every provider is registered. May be async (e.g. importing route files). */
1715
- boot?(): void | Promise<void>;
1716
- }
1717
- type ServiceProviderClass = new (app: Application) => ServiceProvider$1;
1718
- interface Application extends Container {
1719
- readonly version: string;
1720
- basePath(path?: string): string;
1721
- appPath(path?: string): string;
1722
- bootstrapPath(path?: string): string;
1723
- configPath(path?: string): string;
1724
- databasePath(path?: string): string;
1725
- publicPath(path?: string): string;
1726
- resourcePath(path?: string): string;
1727
- storagePath(path?: string): string;
1728
- /** With no args returns the environment name. With args returns whether it matches any of them. */
1729
- environment(): string;
1730
- environment(...environments: string[]): boolean;
1731
- isProduction(): boolean;
1732
- isLocal(): boolean;
1733
- runningInConsole(): boolean;
1734
- /** Mark the app as running in the console (the CLI entry point calls this). Defaults to true. */
1735
- setRunningInConsole(value?: boolean): void;
1736
- runningUnitTests(): boolean;
1737
- /** Registers the provider. If the app is already booted, the provider is booted immediately. */
1738
- register(provider: ServiceProvider$1 | ServiceProviderClass): Promise<ServiceProvider$1>;
1739
- getProviders(): ServiceProvider$1[];
1740
- boot(): Promise<void>;
1741
- isBooted(): boolean;
1742
- booting(callback: (app: Application) => void | Promise<void>): void;
1743
- booted(callback: (app: Application) => void | Promise<void>): void;
1744
- /** Handle one HTTP request in a fresh request scope via the bound HttpKernel. */
1745
- handle(request: Request): Promise<Response>;
1746
- /** Register a callback that terminate() runs, in registration order. */
1747
- terminating(callback: () => void | Promise<void>): void;
1748
- terminate(): Promise<void>;
1749
- }
1750
- declare const Application: Token$2<Application>;
1751
- interface Htmlable {
1752
- toHtml(): string;
1753
- }
1754
-
1755
- /** Public method names of a controller (excludes non-function members). */
1756
- type ActionMethods<C> = {
1757
- [K in keyof C]: C[K] extends (...args: any[]) => unknown ? K : never;
1758
- }[keyof C] & string;
1759
- type ControllerAction<C> = readonly [Class<C>, ActionMethods<C>];
1760
- type RouteClosure = (...args: any[]) => unknown;
1761
- /** A class with __invoke(): Route.get('/counter', Counter) (single-action controllers, full-page Live components). */
1762
- type InvokableClass = Class<{
1763
- __invoke(...args: any[]): unknown;
1764
- }>;
1765
- type RouteAction = RouteClosure | ControllerAction<any> | InvokableClass;
1766
- type MiddlewareReference = string | MiddlewareClass;
1767
- interface Route {
1768
- readonly methods: readonly string[];
1769
- readonly uri: string;
1770
- getName(): string | undefined;
1771
- name(name: string): this;
1772
- middleware(...middleware: Array<MiddlewareReference | readonly MiddlewareReference[]>): this;
1773
- withoutMiddleware(...middleware: MiddlewareReference[]): this;
1774
- where(parameter: string, pattern: string): this;
1775
- where(patterns: Record<string, string>): this;
1776
- }
1777
- interface RouteRegistrar {
1778
- prefix(prefix: string): RouteRegistrar;
1779
- name(prefix: string): RouteRegistrar;
1780
- middleware(...middleware: Array<MiddlewareReference | readonly MiddlewareReference[]>): RouteRegistrar;
1781
- controller(controller: Class<unknown>): RouteRegistrar;
1782
- group(routes: () => void | Promise<void>): Promise<void>;
1783
- }
1784
- interface ResourceOptions {
1785
- only?: string[];
1786
- except?: string[];
1787
- parameters?: Record<string, string>;
1788
- names?: Record<string, string>;
1789
- }
1790
- interface Router {
1791
- get<C>(uri: string, action: ControllerAction<C> | RouteClosure | InvokableClass | string): Route;
1792
- post<C>(uri: string, action: ControllerAction<C> | RouteClosure | InvokableClass | string): Route;
1793
- put<C>(uri: string, action: ControllerAction<C> | RouteClosure | InvokableClass | string): Route;
1794
- patch<C>(uri: string, action: ControllerAction<C> | RouteClosure | InvokableClass | string): Route;
1795
- delete<C>(uri: string, action: ControllerAction<C> | RouteClosure | InvokableClass | string): Route;
1796
- options<C>(uri: string, action: ControllerAction<C> | RouteClosure | InvokableClass | string): Route;
1797
- any<C>(uri: string, action: ControllerAction<C> | RouteClosure | InvokableClass | string): Route;
1798
- match<C>(methods: string[], uri: string, action: ControllerAction<C> | RouteClosure | InvokableClass | string): Route;
1799
- redirect(from: string, to: string, status?: number): Route;
1800
- view(uri: string, view: string, data?: Record<string, unknown>): Route;
1801
- /** Route.inertia('/about', 'About', props): a GET route that renders an Inertia page (Laravel's Route::inertia). */
1802
- inertia(uri: string, component: string, props?: Record<string, unknown>): Route;
1803
- resource(name: string, controller: Class<unknown>, options?: ResourceOptions): void;
1804
- apiResource(name: string, controller: Class<unknown>, options?: ResourceOptions): void;
1805
- fallback(action: RouteAction): Route;
1806
- prefix(prefix: string): RouteRegistrar;
1807
- name(prefix: string): RouteRegistrar;
1808
- middleware(...middleware: Array<MiddlewareReference | readonly MiddlewareReference[]>): RouteRegistrar;
1809
- controller(controller: Class<unknown>): RouteRegistrar;
1810
- /** Explicit model binding: Route.model('author', User). */
1811
- model(parameter: string, model: Class<unknown>): void;
1812
- /** Custom binding resolver. */
1813
- bind(parameter: string, resolver: (value: string) => unknown | Promise<unknown>): void;
1814
- pattern(parameter: string, pattern: string): void;
1815
- /** Name a middleware class, e.g. aliasMiddleware('auth', Authenticate). */
1816
- aliasMiddleware(name: string, middleware: MiddlewareClass): this;
1817
- /** Define (or replace) a middleware group such as 'web' or 'api'. */
1818
- middlewareGroup(name: string, middleware: MiddlewareReference[]): this;
1819
- /** Append to a group unless it is already present. */
1820
- pushMiddlewareToGroup(group: string, middleware: MiddlewareReference): this;
1821
- getMiddlewareGroups(): Record<string, MiddlewareReference[]>;
1822
- getRoutes(): readonly Route[];
1823
- current(): Route | undefined;
1824
- /** Match the request, bind parameters, run the route middleware and the action. Called by the Http kernel. */
1825
- dispatch(request: HttpRequest): Promise<Response>;
1826
- }
1827
- declare const Router: Token$2<Router>;
1828
-
1829
- type ErrorKind = 'Http' | 'Server' | 'ModelNotFound' | 'Validation' | 'Authentication' | 'Authorization' | 'TokenMismatch' | 'BindingResolution' | 'CircularDependency' | 'ContainerNotAvailable';
1830
- /** Every error thrown by the framework implements this. The exception handler switches on `kind`. */
1831
- interface OrielError extends Error {
1832
- readonly kind: ErrorKind;
1833
- /** HTTP status the error should render as, when relevant. */
1834
- readonly status?: number;
1835
- readonly headers?: Record<string, string>;
1836
- }
1837
-
1838
- interface LiveSnapshot {
1839
- data: Record<string, unknown>;
1840
- memo: {
1841
- id: string;
1842
- /** ClassRegistry name of the component. */
1843
- name: string;
1844
- path: string;
1845
- method: string;
1846
- children: Record<string, [tag: string, id: string]>;
1847
- errors: Record<string, string[]>;
1848
- };
1849
- /** HMAC-SHA256 of JSON(data + memo), keyed by APP_KEY. */
1850
- checksum: string;
1851
- }
1852
- interface LiveEffects {
1853
- html?: string;
1854
- /** Browser events from this.dispatch(); `self` keeps one on this component, `to` sends it to one component name. */
1855
- dispatches?: Array<{
1856
- name: string;
1857
- params: Record<string, unknown>;
1858
- self?: true;
1859
- to?: string;
1860
- }>;
1861
- /** Events this component listens to (@On, static listeners); sent with the first render. */
1862
- listeners?: string[];
1863
- redirect?: string;
1864
- /** Follow `redirect` with o:navigate instead of a full page load. */
1865
- redirectUsingNavigate?: true;
1866
- returns?: unknown[];
1867
- }
1868
- interface LiveUpdateRequest {
1869
- components: Array<{
1870
- /** JSON-encoded LiveSnapshot. */
1871
- snapshot: string;
1872
- updates: Record<string, unknown>;
1873
- calls: Array<{
1874
- method: string;
1875
- params: unknown[];
1876
- }>;
1877
- }>;
1878
- }
1879
- interface LiveUpdateResponse {
1880
- components: Array<{
1881
- snapshot: string;
1882
- effects: LiveEffects;
1883
- }>;
1884
- }
1885
- interface LiveManager {
1886
- register(component: Class<unknown>, name?: string): void;
1887
- /** Server-renders the first HTML (snapshot embedded). `key` identifies a child inside its parent (o:key). */
1888
- mount(component: string | Class<unknown>, params?: Record<string, unknown>, key?: string): Promise<string>;
1889
- /** Checks checksums and CSRF, then applies updates and calls, re-renders and returns new snapshots. */
1890
- update(request: LiveUpdateRequest): Promise<LiveUpdateResponse>;
1891
1067
  /**
1892
- * A full-page component (Route.get('/counter', Counter)): mounts `component` (a component instance) with the current route's parameters and
1893
- * returns the response, its layout view or a redirect.
1068
+ * A real white image of the given size in the format the name's extension asks for: png, jpg/jpeg, gif, webp or
1069
+ * bmp (any other name gets a JPEG, as Laravel's fakes do), so image, mimes and dimensions pass on it.
1894
1070
  */
1895
- page(component: object): Promise<unknown>;
1896
- isLiveRequest(request: HttpRequest): boolean;
1897
- }
1898
- declare const LiveManager: Token$2<LiveManager>;
1899
-
1900
- declare abstract class ServiceProvider implements ServiceProvider$3 {
1901
- protected readonly app: Application$2;
1902
- constructor(app: Application$2);
1903
- register(): void;
1904
- boot(): void | Promise<void>;
1905
- /** Package defaults under `key`; values the app already set win (shallow merge, like Laravel). */
1906
- protected mergeConfigFrom(defaults: Record<string, unknown>, key: string): void;
1907
- }
1071
+ image(name: string, width?: number, height?: number): File;
1072
+ };
1908
1073
 
1909
1074
  /** Marks Live component classes (Symbol.for, so two copies of the package agree). */
1910
1075
  declare const COMPONENT: unique symbol;
@@ -1978,6 +1143,13 @@ declare abstract class Component {
1978
1143
  reset(...properties: string[]): void;
1979
1144
  /** Keeps the current HTML: the response carries the new state but no `html` effect. */
1980
1145
  skipRender(): void;
1146
+ /**
1147
+ * An action for an `o:` directive, typed against its method: `o:click={this.$action(this.delete, tag.id)}` writes
1148
+ * `delete(5)`, and a string where `delete` takes a number is a type error. The arguments are written as JSON, the
1149
+ * trailing `undefined` ones left out so the method's defaults apply. The method must be one of this component's
1150
+ * actions (a public method of its class, not a hook and not @Locked); anything else throws while rendering.
1151
+ */
1152
+ $action<P extends unknown[]>(method: (...params: P) => unknown, ...params: NoInfer<P>): string;
1981
1153
  /** A full-page component as a route action: Route.get('/counter', Counter). Route parameters go to mount(). */
1982
1154
  __invoke(): Promise<unknown>;
1983
1155
  }
@@ -2029,6 +1201,9 @@ declare class Testable<C extends Component = Component> {
2029
1201
  assertDontSee(...values: string[]): this;
2030
1202
  /** Each value appears in the rendered HTML as written (not escaped). */
2031
1203
  assertSeeHtml(...values: string[]): this;
1204
+ /** Each value, HTML-escaped, appears in the rendered text: the HTML with its tags stripped (Livewire's assertSeeText). */
1205
+ assertSeeText(...values: string[]): this;
1206
+ assertDontSeeText(...values: string[]): this;
2032
1207
  assertDispatched(name: string, params?: Record<string, unknown>): this;
2033
1208
  assertNotDispatched(name: string): this;
2034
1209
  /** The error bag has errors for every key given (or any error at all with no keys). */
@@ -2093,9 +1268,11 @@ declare class LiveComponentManager implements LiveManager {
2093
1268
  update(request: LiveUpdateRequest): Promise<LiveUpdateResponse>;
2094
1269
  updateComponent(snapshotJson: string, updates: Record<string, unknown>, calls: Call[]): Promise<ComponentResult>;
2095
1270
  /**
2096
- * The route action of POST /oriel/live/update. Each component's update runs behind the auth middleware of the route
2097
- * that rendered its page (Livewire's persistent middleware): a signed-out tab gets a 401, never the action. When a
2098
- * middleware answers instead (a redirect), that is the response.
1271
+ * The route action of POST /oriel/live/update. Each component's update runs behind the persistent middleware of the
1272
+ * route that rendered its page (Livewire's): `auth`, `verified`, `guest` and `can`, with the page route's parameters
1273
+ * bound again. A signed-out tab gets a 401, a revoked ability a 403 and a deleted model a 404, before the component
1274
+ * hydrates. When a middleware answers instead (a redirect), that is the response. A key first flashed during the
1275
+ * update shows in this response only, unless the update redirects.
2099
1276
  */
2100
1277
  handle(request: HttpRequest): Promise<LiveUpdateResponse | Response>;
2101
1278
  /** A full-page component (Route.get('/counter', Counter)): mounted with the route parameters, inside the layout. */
@@ -2110,8 +1287,14 @@ declare class LiveComponentManager implements LiveManager {
2110
1287
  private applyUpdate;
2111
1288
  /** Runs one call from the browser: a magic action, an event, or a public method. Returns its return value. */
2112
1289
  private call;
2113
- /** Renders the component (rendering/rendered hooks, nested children tracked) and checks for a single root. */
1290
+ /**
1291
+ * Renders the component (rendering/rendered hooks, nested children tracked) and checks for a single root. A
1292
+ * WithPagination component's page and page URL are what paginate() reads while it renders, as in its mount() and in
1293
+ * its update's hooks and actions.
1294
+ */
2114
1295
  private render;
1296
+ /** The absolute URL of the page a memo path belongs to, on the current request's origin ('/' + path without one). */
1297
+ private pageUrl;
2115
1298
  /** Dispatches, redirects: the effects every response carries. */
2116
1299
  private effects;
2117
1300
  /** dehydrate() hook, then the state as snapshot data, the error bag, and the checksum over both. */
@@ -2121,10 +1304,11 @@ declare class LiveComponentManager implements LiveManager {
2121
1304
  /** The URI the client runtime posts updates to. */
2122
1305
  declare const UPDATE_URI = "/oriel/live/update";
2123
1306
  /**
2124
- * Binds the LiveManager, merges the `live` config, registers POST /oriel/live/update (named `live.update`, in the `web`
2125
- * group: sessions and CSRF apply), the make:live command, and the components under app/Live.
1307
+ * Binds the LiveManager and the PaginationState that WithPagination components answer, merges the `live` config,
1308
+ * registers POST /oriel/live/update (named `live.update`, in the `web` group: sessions and CSRF apply), the make:live
1309
+ * command, and the components under app/Live.
2126
1310
  */
2127
- declare class LiveServiceProvider extends ServiceProvider {
1311
+ declare class LiveServiceProvider extends ServiceProvider$1 {
2128
1312
  register(): void;
2129
1313
  boot(): Promise<void>;
2130
1314
  }
@@ -2181,10 +1365,57 @@ interface PersistentMiddleware {
2181
1365
  readonly parameters: readonly string[];
2182
1366
  }
2183
1367
  /**
2184
- * Livewire's persistent middleware: the route that rendered the page (the component's memo path and method) is
2185
- * matched again, and the middleware among `persistent` (aliases) that it ran are returned, to run before an update.
2186
- * A path no route matches has none.
1368
+ * Livewire's persistent middleware: the middleware among `persistent` (aliases) that the page route (the component's
1369
+ * memo path and method) ran, in the order an update runs them. A path no route matches has none.
2187
1370
  */
2188
1371
  declare function persistentMiddleware(router: Router, persistent: readonly string[], method: string, path: string): PersistentMiddleware[];
2189
1372
 
2190
- export { RefreshDatabase as $, AnonymousNotifiable as A, BusFake as B, Component as C, DatabaseMigrations as D, EventFake as E, FakeDisk as F, type DispatchedEvent as G, type ExpectedErrors as H, InvalidLiveRequestError as I, FakeFile as J, HttpClient as K, Live as L, MailFake as M, NotificationFake as N, On as O, PERSISTENT_MIDDLEWARE as P, QueueFake as Q, InteractsWithApplication as R, InteractsWithConsole as S, type Target as T, UPDATE_URI as U, InteractsWithDatabase as V, type JsonStructure as W, MailRecord as X, MakesHttpRequests as Y, PendingCommand as Z, type PushedJob as _, type ComponentResult as a, RefreshDatabaseState as a0, type RequestData as a1, type RequestOptions as a2, type ResponseContext as a3, type ResponseCookie as a4, type SentNotification as a5, StorageFake as a6, TESTING_ENVIRONMENT as a7, type TableOrModel as a8, TestCase as a9, type TestHooks as aa, TestResponse as ab, type TestTrait as ac, actingAsAuthFactory as ad, addresses as ae, applyEnvironment as af, cookieHeader as ag, cookiePrefix as ah, decryptCookie as ai, encryptCookie as aj, flatten as ak, guessMimeType as al, inertiaPageOf as am, install as an, isExpired as ao, matches as ap, nameOf as aq, recordingExceptionHandler as ar, recordingViewFactory as as, responseCookies as at, runCommand as au, usingInMemoryDatabase as av, Computed as b, CorruptComponentPayloadError as c, ErrorBag as d, LiveComponentManager as e, LiveComponentNotFoundError as f, LiveError as g, type LiveProps as h, LiveServiceProvider as i, Locked as j, MethodNotCallableError as k, PendingEvent as l, type PersistentMiddleware as m, PropertyNotUpdatableError as n, TestRequestScope as o, Testable as p, componentName as q, live as r, persistentMiddleware as s, AssertableInertia as t, AssertableJson as u, type BatchRecord as v, type BootOptions as w, type CountOrFilter as x, type DatabaseTestOptions as y, DatabaseTransactions as z };
1373
+ type ComponentConstructor = abstract new (...args: any[]) => Component;
1374
+ /** What WithPagination() adds to a component: its page and the actions that move it. */
1375
+ interface Paginated {
1376
+ /** The current page. The browser may set it; Live reads it as a page number. */
1377
+ page: number;
1378
+ nextPage(): Promise<void>;
1379
+ previousPage(): Promise<void>;
1380
+ gotoPage(page: number | string): Promise<void>;
1381
+ resetPage(): Promise<void>;
1382
+ setPage(page: number | string): Promise<void>;
1383
+ }
1384
+ /**
1385
+ * Livewire's WithPagination: `class Posts extends WithPagination(Component)`. The public `page` (1 to start; there
1386
+ * is no address-bar sync) is what `paginate()` shows in the component (in `render()`, `mount()`, `hydrate()`, the
1387
+ * update hooks and actions, or in a `@Computed` getter any of them reads), and its page links are built on the
1388
+ * page's URL. The actions move it: `o:click="nextPage"`, `previousPage`, `gotoPage(3)`, `setPage(3)`,
1389
+ * `resetPage` (call it from `updatedSearch()` so a new search starts on page 1). `updatingPage(page)` and
1390
+ * `updatedPage(page)` run around every change. One paginator per component: other page names read the request.
1391
+ */
1392
+ declare function WithPagination<TBase extends ComponentConstructor>(Base: TBase): TBase & (abstract new (...args: any[]) => Paginated);
1393
+
1394
+ /**
1395
+ * What <Pagination> reads from a paginator. Structural, since Live can't import Database: paginate()'s
1396
+ * LengthAwarePaginator (with lastPage(), so page buttons) and simplePaginate()'s Paginator (Previous and Next only).
1397
+ */
1398
+ interface PaginationSource {
1399
+ currentPage(): number;
1400
+ lastPage?(): number;
1401
+ hasMorePages(): boolean;
1402
+ onFirstPage(): boolean;
1403
+ /** Page buttons on each side of the current one (the paginator's onEachSide(), 3 by default). */
1404
+ readonly onEachSideCount?: number;
1405
+ /** Not cursorPaginate(): its pages are cursors, which a component's page number can't follow. */
1406
+ readonly nextCursor?: never;
1407
+ }
1408
+ interface PaginationProps {
1409
+ paginator: PaginationSource;
1410
+ /** Classes for the <nav>, such as its layout ("flex gap-2"); in your file, so Tailwind generates them. */
1411
+ class?: string;
1412
+ }
1413
+ /**
1414
+ * Livewire's pagination links for a WithPagination component: `<Pagination paginator={posts} />` in render(). A
1415
+ * <nav aria-label="Pagination"> with « Previous, the page buttons and Next » as Live actions (previousPage,
1416
+ * gotoPage(n), nextPage), the current page marked aria-current="page", the ends disabled, the kits' theme classes
1417
+ * (btn, btn-secondary). Nothing when everything fits on one page. The address bar is left alone.
1418
+ */
1419
+ declare function Pagination({ paginator, class: className }: PaginationProps): Htmlable;
1420
+
1421
+ export { InteractsWithDatabase as $, AnonymousNotifiable as A, BusFake as B, Component as C, type CountOrFilter as D, EventFake as E, DatabaseMigrations as F, type DatabaseTestOptions as G, DatabaseTransactions as H, InvalidLiveRequestError as I, type DispatchedEvent as J, type ExpectedErrors as K, Live as L, MailFake as M, NotificationFake as N, On as O, PERSISTENT_MIDDLEWARE as P, QueueFake as Q, type ExpectedListener as R, StorageFake as S, TestRequestScope as T, UPDATE_URI as U, FakeDisk as V, WithPagination as W, FakeFile as X, HttpClient as Y, InteractsWithApplication as Z, InteractsWithConsole as _, type ComponentResult as a, InteractsWithTime as a0, type JsonStructure as a1, MailRecord as a2, MakesHttpRequests as a3, PendingCommand as a4, type PushedJob as a5, RefreshDatabase as a6, RefreshDatabaseState as a7, type RequestData as a8, type RequestOptions as a9, matches as aA, nameOf as aB, recordingExceptionHandler as aC, recordingViewFactory as aD, responseCookies as aE, runCommand as aF, travel as aG, travelBack as aH, travelTo as aI, usingInMemoryDatabase as aJ, type ResponseContext as aa, type ResponseCookie as ab, type SentNotification as ac, TESTING_ENVIRONMENT as ad, type TableOrModel as ae, type Target as af, TestCase as ag, type TestHooks as ah, TestResponse as ai, type TestTrait as aj, type TravelDate as ak, Wormhole as al, actingAsAuthFactory as am, addresses as an, applyEnvironment as ao, cookieHeader as ap, cookiePrefix as aq, decryptCookie as ar, encryptCookie as as, flatten as at, freezeSecond as au, freezeTime as av, guessMimeType as aw, inertiaPageOf as ax, install as ay, isExpired as az, Computed as b, CorruptComponentPayloadError as c, ErrorBag as d, LiveComponentManager as e, LiveComponentNotFoundError as f, LiveError as g, type LiveProps as h, LiveServiceProvider as i, Locked as j, MethodNotCallableError as k, type Paginated as l, Pagination as m, type PaginationProps as n, type PaginationSource as o, PendingEvent as p, type PersistentMiddleware as q, PropertyNotUpdatableError as r, Testable as s, componentName as t, live as u, persistentMiddleware as v, AssertableInertia as w, AssertableJson as x, type BatchRecord as y, type BootOptions as z };