@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.
@@ -640,6 +640,8 @@ interface ModelInstance {
640
640
  getTable(): string;
641
641
  getRouteKey(): unknown;
642
642
  getRouteKeyName(): string;
643
+ /** The value stored in a polymorphic `*_type` column for this model: its morph map alias, else its class name. */
644
+ getMorphClass(): string;
643
645
  getAttribute<T = unknown>(key: string): T;
644
646
  setAttribute(key: string, value: unknown): this;
645
647
  fill(attributes: Row): this;
@@ -655,6 +657,19 @@ interface ModelStatic<M extends ModelInstance = ModelInstance> {
655
657
  find(id: unknown): Promise<M | undefined>;
656
658
  findOrFail(id: unknown): Promise<M>;
657
659
  }
660
+ /**
661
+ * What decides a paginator's page and the path of its links when the request doesn't (Laravel's
662
+ * Paginator::currentPageResolver and currentPathResolver, which Livewire's WithPagination replaces). Live binds one for
663
+ * the application, which answers while a WithPagination component mounts, runs an update's hooks and actions, or
664
+ * renders. Unbound, or `undefined` from a method, the paginators read the request (`?page=` and its URL).
665
+ */
666
+ interface PaginationState {
667
+ /** The page to show for `pageName` ('page' by default). */
668
+ currentPage(pageName: string): number | undefined;
669
+ /** The base path of the page links. */
670
+ currentPath(): string | undefined;
671
+ }
672
+ declare const PaginationState: Token<PaginationState>;
658
673
 
659
674
  interface Authenticatable {
660
675
  getAuthIdentifierName(): string;
@@ -723,6 +738,11 @@ interface MustVerifyEmail {
723
738
 
724
739
  /** Options a job class may declare as public fields. Their presence (or implementing ShouldQueue) makes things queueable. */
725
740
  interface ShouldQueue {
741
+ /**
742
+ * Marks the class as queued at run time: `implements ShouldQueue` leaves no trace once compiled, so the interface
743
+ * asks for `readonly shouldQueue = true`. Jobs, listeners, mailables and notifications carrying it are queued.
744
+ */
745
+ readonly shouldQueue: true;
726
746
  connection?: string;
727
747
  queue?: string;
728
748
  /** Seconds. */
@@ -909,6 +929,15 @@ interface ConsoleKernel {
909
929
  declare const ConsoleKernel: Token<ConsoleKernel>;
910
930
  interface ScheduledEvent {
911
931
  readonly expression: string;
932
+ /**
933
+ * What a Schedule.command() event runs: the command and its parameters ('posts:announce --force'), without the
934
+ * runtime and `oriel` in front. Undefined for call() and job() events. Laravel's `$event->command`.
935
+ */
936
+ readonly command: string | undefined;
937
+ /** Whether withoutOverlapping() was called. Laravel's `$event->withoutOverlapping`, a method's name here. */
938
+ readonly preventsOverlapping: boolean;
939
+ /** Minutes the withoutOverlapping() lock is kept at most (1440 unless withoutOverlapping() says). Laravel's `$event->expiresAt`. */
940
+ readonly expiresAt: number;
912
941
  cron(expression: string): this;
913
942
  everyMinute(): this;
914
943
  everyFiveMinutes(): this;
@@ -937,6 +966,13 @@ interface ScheduledEvent {
937
966
  runInBackground(): this;
938
967
  name(name: string): this;
939
968
  description(description: string): this;
969
+ /** The name, else the description: the command, the job's class, or 'Closure'. schedule:list shows it. */
970
+ getSummaryForDisplay(): string;
971
+ /**
972
+ * The cache lock withoutOverlapping() holds: `framework/schedule-` and the sha1 of the expression and the command,
973
+ * or of the name for call() and job() events (Laravel's mutexName()). schedule:clear-cache deletes it.
974
+ */
975
+ mutexName(): string;
940
976
  isDue(now: Date): boolean;
941
977
  run(): Promise<void>;
942
978
  }
@@ -1015,6 +1051,8 @@ interface PendingMail {
1015
1051
  cc(recipients: MailRecipient | MailRecipient[]): this;
1016
1052
  bcc(recipients: MailRecipient | MailRecipient[]): this;
1017
1053
  send(mailable: Mailable): Promise<SentMessage | undefined>;
1054
+ /** Sends at once, even when the mailable is queueable (Laravel's sendNow()). A fake resolves undefined. */
1055
+ sendNow(mailable: Mailable): Promise<SentMessage | undefined>;
1018
1056
  queue(mailable: Mailable): Promise<void>;
1019
1057
  later(delaySeconds: number, mailable: Mailable): Promise<void>;
1020
1058
  }
@@ -1022,6 +1060,8 @@ interface Mailer {
1022
1060
  to(recipients: MailRecipient | MailRecipient[]): PendingMail;
1023
1061
  /** Sends to the recipients given in the mailable's envelope. Queues it if the mailable is queueable. */
1024
1062
  send(mailable: Mailable): Promise<SentMessage | undefined>;
1063
+ /** Sends to the envelope's recipients at once, even when the mailable is queueable (Laravel's sendNow()). */
1064
+ sendNow(mailable: Mailable): Promise<SentMessage | undefined>;
1025
1065
  queue(mailable: Mailable): Promise<void>;
1026
1066
  }
1027
1067
  interface MailManager extends Mailer {
@@ -1057,6 +1097,28 @@ interface NotificationDispatcher {
1057
1097
  extend(channel: string, factory: () => NotificationChannel): void;
1058
1098
  }
1059
1099
  declare const NotificationDispatcher: Token<NotificationDispatcher>;
1100
+ /**
1101
+ * A stored database notification (Laravel's DatabaseNotification model): one row of the `notifications` table, with
1102
+ * its snake_case columns. `user.notifications()`, `unreadNotifications()` and `readNotifications()` query these,
1103
+ * newest first.
1104
+ */
1105
+ interface DatabaseNotification extends ModelInstance {
1106
+ /** A UUID. */
1107
+ readonly id: string;
1108
+ /** The notification's class name. */
1109
+ readonly type: string;
1110
+ /** What the notification's toDatabase() (or toArray()) returned. */
1111
+ readonly data: Record<string, unknown>;
1112
+ read_at: Date | null;
1113
+ readonly created_at: Date | null;
1114
+ readonly updated_at: Date | null;
1115
+ /** Sets read_at to now and saves, unless it is already read. */
1116
+ markAsRead(): Promise<void>;
1117
+ /** Clears read_at and saves, unless it is already unread. */
1118
+ markAsUnread(): Promise<void>;
1119
+ read(): boolean;
1120
+ unread(): boolean;
1121
+ }
1060
1122
 
1061
1123
  interface Lock {
1062
1124
  /** Tries once. Returns whether it was acquired. */
@@ -1322,4 +1384,4 @@ interface LiveManager {
1322
1384
  }
1323
1385
  declare const LiveManager: Token<LiveManager>;
1324
1386
 
1325
- export { type AbilityCallback, type Abstract, type ActionMethods, type Address, Application, type Arrayable, type Attachment, AuthFactory, type Authenticatable, type AuthenticationError, type Batch, BatchRepository, type BodyInit, BusDispatcher, CacheManager, type CacheRepository, type Class, ClassRegistry, type ClosureCommand, type Command, type CommandContext, type Concrete, type ConfigCallbacks, ConfigRepository, ConsoleKernel, Container, type Content, type ControllerAction, type Cookie, CookieJar, type Credentials, CurrentRoute, type DatabaseConnection, DatabaseManager, type DriverName, Encrypter, type Enumerable, type Envelope, type ErrorKind, EventDispatcher, ExceptionCallbacks, ExceptionHandler, type ExceptionsConfigurator, type Factory, type FailedJob, FailedJobProvider, type Filesystem, FilesystemManager, Gate, type Guard, Hasher, type HeadersInit, type Htmlable, HttpKernel, HttpRequest, InertiaFactory, type InertiaOnceProp, type InertiaPage, type InertiaResponse, type InertiaScrollProp, InertiaSsrGateway, type InertiaSsrResponse, type InvokableClass, type Job, type Jsonable, type Listener, type ListenerClass, type LiveEffects, LiveManager, type LiveSnapshot, type LiveUpdateRequest, type LiveUpdateResponse, type Lock, type LogLevel, LogManager, type Logger, MailManager, type MailRecipient, type MailTransport, type Mailable, type Mailer, type MessageBag, type Middleware, MiddlewareCallbacks, type MiddlewareClass, type MiddlewareConfigurator, type MiddlewareReference, type ModelInstance, type ModelNotFoundError, type ModelStatic, type MustVerifyEmail, type Next, type Notifiable, type Notification, type NotificationChannel, NotificationDispatcher, type Operator, type OptionValue, type OrielError, type OutgoingMessage, PasswordBroker, type PasswordStatus, type PendingBatch, type PendingBatchOptions, type PendingChain, type PendingMail, type Pipe, type PipeClosure, type PipeNext, type Pipeline, PipelineFactory, type PropCallback, type PutOptions, type QueryBuilder, type Queue, type QueueJob, QueueManager, type QueuePayload, RateLimiter, type RedirectResponse, Redirector, type ResourceOptions, type Responsable, ResponseFactory, type Route, type RouteAction, type RouteClosure, type RouteList, RouteModelResolver, type RouteName, type RouteRegistrar, Router, RoutingPaths, type Row, type RuleCallback, type Rules, Schedule, type ScheduledEvent, type SentMessage, type ServiceProvider, type ServiceProviderClass, Session, type SessionHandler, type ShouldQueue, type StatefulGuard, type Token, type UploadedFile, UrlGenerator, type UserProvider, type ValidationError, ValidationFactory, type ValidationRule, type Validator, type View, ViewFactory, token };
1387
+ export { type AbilityCallback, type Abstract, type ActionMethods, type Address, Application, type Arrayable, type Attachment, AuthFactory, type Authenticatable, type AuthenticationError, type Batch, BatchRepository, type BodyInit, BusDispatcher, CacheManager, type CacheRepository, type Class, ClassRegistry, type ClosureCommand, type Command, type CommandContext, type Concrete, type ConfigCallbacks, ConfigRepository, ConsoleKernel, Container, type Content, type ControllerAction, type Cookie, CookieJar, type Credentials, CurrentRoute, type DatabaseConnection, DatabaseManager, type DatabaseNotification, type DriverName, Encrypter, type Enumerable, type Envelope, type ErrorKind, EventDispatcher, ExceptionCallbacks, ExceptionHandler, type ExceptionsConfigurator, type Factory, type FailedJob, FailedJobProvider, type Filesystem, FilesystemManager, Gate, type Guard, Hasher, type HeadersInit, type Htmlable, HttpKernel, HttpRequest, InertiaFactory, type InertiaOnceProp, type InertiaPage, type InertiaResponse, type InertiaScrollProp, InertiaSsrGateway, type InertiaSsrResponse, type InvokableClass, type Job, type Jsonable, type Listener, type ListenerClass, type LiveEffects, LiveManager, type LiveSnapshot, type LiveUpdateRequest, type LiveUpdateResponse, type Lock, type LogLevel, LogManager, type Logger, MailManager, type MailRecipient, type MailTransport, type Mailable, type Mailer, type MessageBag, type Middleware, MiddlewareCallbacks, type MiddlewareClass, type MiddlewareConfigurator, type MiddlewareReference, type ModelInstance, type ModelNotFoundError, type ModelStatic, type MustVerifyEmail, type Next, type Notifiable, type Notification, type NotificationChannel, NotificationDispatcher, type Operator, type OptionValue, type OrielError, type OutgoingMessage, PaginationState, PasswordBroker, type PasswordStatus, type PendingBatch, type PendingBatchOptions, type PendingChain, type PendingMail, type Pipe, type PipeClosure, type PipeNext, type Pipeline, PipelineFactory, type PropCallback, type PutOptions, type QueryBuilder, type Queue, type QueueJob, QueueManager, type QueuePayload, RateLimiter, type RedirectResponse, Redirector, type ResourceOptions, type Responsable, ResponseFactory, type Route, type RouteAction, type RouteClosure, type RouteList, RouteModelResolver, type RouteName, type RouteRegistrar, Router, RoutingPaths, type Row, type RuleCallback, type Rules, Schedule, type ScheduledEvent, type SentMessage, type ServiceProvider, type ServiceProviderClass, Session, type SessionHandler, type ShouldQueue, type StatefulGuard, type Token, type UploadedFile, UrlGenerator, type UserProvider, type ValidationError, ValidationFactory, type ValidationRule, type Validator, type View, ViewFactory, token };
package/dist/contracts.js CHANGED
@@ -28,6 +28,7 @@ import {
28
28
  MailManager,
29
29
  MiddlewareCallbacks,
30
30
  NotificationDispatcher,
31
+ PaginationState,
31
32
  PasswordBroker,
32
33
  PipelineFactory,
33
34
  QueueManager,
@@ -43,7 +44,7 @@ import {
43
44
  ValidationFactory,
44
45
  ViewFactory,
45
46
  token
46
- } from "./chunk-WSGWYXAO.js";
47
+ } from "./chunk-I63ZFMX6.js";
47
48
  export {
48
49
  Application,
49
50
  AuthFactory,
@@ -74,6 +75,7 @@ export {
74
75
  MailManager,
75
76
  MiddlewareCallbacks,
76
77
  NotificationDispatcher,
78
+ PaginationState,
77
79
  PasswordBroker,
78
80
  PipelineFactory,
79
81
  QueueManager,
@@ -0,0 +1,319 @@
1
+ import { Enumerable, ServiceProvider as ServiceProvider$1, Application, ClassRegistry as ClassRegistry$1, Class, Abstract, ConfigRepository } from './contracts.js';
2
+
3
+ type Operator = '=' | '==' | '===' | '!=' | '!==' | '<>' | '<' | '<=' | '>' | '>=';
4
+
5
+ type Getter<T, V = unknown> = (keyof T & string) | ((item: T) => V);
6
+ declare class Collection<T> implements Enumerable<T> {
7
+ protected readonly items: T[];
8
+ constructor(items?: Iterable<T>);
9
+ static make<T>(items?: Iterable<T>): Collection<T>;
10
+ /** Laravel semantics: callback receives 1..n. */
11
+ static times<T>(count: number, callback: (index: number) => T): Collection<T>;
12
+ [Symbol.iterator](): Iterator<T>;
13
+ all(): T[];
14
+ count(): number;
15
+ isEmpty(): boolean;
16
+ isNotEmpty(): boolean;
17
+ toArray(): unknown[];
18
+ toJSON(): T[];
19
+ toJson(): string;
20
+ map<U>(callback: (item: T, index: number) => U): Collection<U>;
21
+ flatMap<U>(callback: (item: T, index: number) => U | U[] | Collection<U>): Collection<U>;
22
+ filter(callback?: (item: T, index: number) => unknown): Collection<T>;
23
+ reject(callback: (item: T, index: number) => unknown): Collection<T>;
24
+ /** Return false from the callback to stop. */
25
+ each(callback: (item: T, index: number) => unknown): this;
26
+ reduce<U>(callback: (carry: U, item: T, index: number) => U, initial: U): U;
27
+ first(): T | undefined;
28
+ first<D = undefined>(callback: (item: T, index: number) => unknown, defaultValue?: D): T | D;
29
+ last(): T | undefined;
30
+ last<D = undefined>(callback: (item: T, index: number) => unknown, defaultValue?: D): T | D;
31
+ where(key: Getter<T>, value: unknown): Collection<T>;
32
+ where(key: Getter<T>, operator: Operator, value: unknown): Collection<T>;
33
+ firstWhere(key: Getter<T>, value: unknown): T | undefined;
34
+ firstWhere(key: Getter<T>, operator: Operator, value: unknown): T | undefined;
35
+ whereIn(key: Getter<T>, values: readonly unknown[]): Collection<T>;
36
+ whereNotIn(key: Getter<T>, values: readonly unknown[]): Collection<T>;
37
+ pluck<K extends keyof T & string>(key: K): Collection<T[K]>;
38
+ keyBy(key: Getter<T>): Record<string, T>;
39
+ groupBy(key: Getter<T>): Record<string, Collection<T>>;
40
+ mapWithKeys<V>(callback: (item: T, index: number) => readonly [string, V]): Record<string, V>;
41
+ sortBy(key: Getter<T>, direction?: 'asc' | 'desc'): Collection<T>;
42
+ sortByDesc(key: Getter<T>): Collection<T>;
43
+ sum(key?: Getter<T>): number;
44
+ avg(key?: Getter<T>): number | undefined;
45
+ min(key?: Getter<T>): number | undefined;
46
+ max(key?: Getter<T>): number | undefined;
47
+ unique(key?: Getter<T>): Collection<T>;
48
+ chunk(size: number): Collection<Collection<T>>;
49
+ /** Negative count takes from the end. */
50
+ take(count: number): Collection<T>;
51
+ skip(count: number): Collection<T>;
52
+ slice(offset: number, length?: number): Collection<T>;
53
+ values(): Collection<T>;
54
+ contains(key: keyof T & string, value: unknown): boolean;
55
+ contains(callback: (item: T) => boolean): boolean;
56
+ contains(value: unknown): boolean;
57
+ /** Mutates, like Laravel. */
58
+ push(...values: T[]): this;
59
+ concat(values: Iterable<T>): Collection<T>;
60
+ partition(callback: (item: T, index: number) => unknown): [Collection<T>, Collection<T>];
61
+ implode(glue: string): string;
62
+ implode(key: keyof T & string, glue: string): string;
63
+ when<U = this>(condition: unknown, callback: (collection: this) => U): U | this;
64
+ pipe<U>(callback: (collection: this) => U): U;
65
+ tap(callback: (collection: this) => void): this;
66
+ }
67
+ declare function collect<T>(items?: Iterable<T>): Collection<T>;
68
+
69
+ type Source<T> = () => AsyncIterable<T> | Iterable<T>;
70
+ /** Pull-based and async: for DB cursors (Model.lazy()) and large files. */
71
+ declare class LazyCollection<T> implements AsyncIterable<T> {
72
+ private readonly source;
73
+ constructor(source: Source<T>);
74
+ static make<T>(source: Source<T>): LazyCollection<T>;
75
+ [Symbol.asyncIterator](): AsyncIterator<T>;
76
+ map<U>(callback: (item: T, index: number) => U | Promise<U>): LazyCollection<U>;
77
+ filter(callback: (item: T, index: number) => unknown): LazyCollection<T>;
78
+ take(count: number): LazyCollection<T>;
79
+ chunk(size: number): LazyCollection<Collection<T>>;
80
+ /** Return false from the callback to stop. */
81
+ each(callback: (item: T, index: number) => unknown): Promise<void>;
82
+ first(callback?: (item: T) => unknown): Promise<T | undefined>;
83
+ count(): Promise<number>;
84
+ collect(): Promise<Collection<T>>;
85
+ }
86
+
87
+ /**
88
+ * Laravel's Stringable: a string with Str's helpers as chainable methods, each returning a new Stringable.
89
+ * `Str.of(' Café ').trim().slug().toString()` is 'cafe'; `request().string('q')` returns one. It prints as its string.
90
+ */
91
+ declare class Stringable {
92
+ #private;
93
+ constructor(value?: string);
94
+ after(search: string): Stringable;
95
+ afterLast(search: string): Stringable;
96
+ append(...values: string[]): Stringable;
97
+ ascii(): Stringable;
98
+ before(search: string): Stringable;
99
+ beforeLast(search: string): Stringable;
100
+ between(from: string, to: string): Stringable;
101
+ camel(): Stringable;
102
+ contains(needles: string | string[]): boolean;
103
+ endsWith(needles: string | string[]): boolean;
104
+ /** The same string as `value` (a string or another Stringable). */
105
+ exactly(value: string | Stringable): boolean;
106
+ /** The parts between the delimiters, as a Collection (PHP's explode()). */
107
+ explode(delimiter: string): Collection<string>;
108
+ finish(cap: string): Stringable;
109
+ /** Wildcard match, as Str.is(): `*` matches anything. */
110
+ is(pattern: string): boolean;
111
+ isEmpty(): boolean;
112
+ isNotEmpty(): boolean;
113
+ kebab(): Stringable;
114
+ lcfirst(): Stringable;
115
+ /** The number of characters (code points, as PHP's mb_strlen()). */
116
+ length(): number;
117
+ limit(limit?: number, end?: string): Stringable;
118
+ lower(): Stringable;
119
+ /** Strips whitespace and invisible characters from the start, or the characters given. */
120
+ ltrim(characters?: string): Stringable;
121
+ plural(count?: number): Stringable;
122
+ prepend(...values: string[]): Stringable;
123
+ /** Replaces every occurrence of the search string (or of each of several) with `replace`. */
124
+ replace(search: string | string[], replace: string): Stringable;
125
+ /** Strips whitespace and invisible characters from the end, or the characters given. */
126
+ rtrim(characters?: string): Stringable;
127
+ singular(): Stringable;
128
+ slug(separator?: string): Stringable;
129
+ snake(delimiter?: string): Stringable;
130
+ start(prefix: string): Stringable;
131
+ startsWith(needles: string | string[]): boolean;
132
+ studly(): Stringable;
133
+ title(): Stringable;
134
+ /** PHP's filter_var(FILTER_VALIDATE_BOOLEAN): '1', 'true', 'on' and 'yes' (any case, trimmed) are true. */
135
+ toBoolean(): boolean;
136
+ /** PHP's floatval(): the leading number, else 0. */
137
+ toFloat(): number;
138
+ /** PHP's intval(): the leading digits, else 0. */
139
+ toInteger(): number;
140
+ toJSON(): string;
141
+ toString(): string;
142
+ /** Strips whitespace and invisible characters from both ends (Laravel's Str::trim()), or the characters given. */
143
+ trim(characters?: string): Stringable;
144
+ ucfirst(): Stringable;
145
+ upper(): Stringable;
146
+ value(): string;
147
+ }
148
+
149
+ declare const Str: {
150
+ /** Laravel's Str::of(): the value as a Stringable, for chaining: Str.of(title).trim().slug(). */
151
+ of: (value?: unknown) => Stringable;
152
+ ucfirst: (v: string) => string;
153
+ lcfirst: (v: string) => string;
154
+ studly: (v: string) => string;
155
+ camel: (v: string) => string;
156
+ snake: (v: string, delimiter?: string) => string;
157
+ kebab: (v: string) => string;
158
+ title: (v: string) => string;
159
+ /** Laravel's Str::ascii(): the value in plain ASCII ('Café' → 'Cafe', 'Ελληνικά' → 'Ellinika'), as for English. */
160
+ ascii: (v: string) => string;
161
+ /**
162
+ * Laravel's Str::slug(): transliterated to ASCII first (unless `language` is null), '@' read as 'at', then lower-cased
163
+ * letters and digits joined by the separator: 'Café crème' → 'cafe-creme'. What has no ASCII form is dropped.
164
+ */
165
+ slug: (title: string, separator?: string, language?: "en" | null, dictionary?: Readonly<Record<string, string>>) => string;
166
+ plural: (v: string, count?: number) => string;
167
+ singular: (v: string) => string;
168
+ random: (length?: number) => string;
169
+ uuid: () => `${string}-${string}-${string}-${string}-${string}`;
170
+ /**
171
+ * A version 7 UUID (RFC 9562): the time in milliseconds first, so ids from later milliseconds sort after earlier ones
172
+ * (within one millisecond the order is random). Throws a TypeError for a time before 1970, after 10889 or invalid.
173
+ */
174
+ uuid7: (time?: Date) => string;
175
+ /**
176
+ * A ULID: 26 upper-case Crockford characters, ten for the time in milliseconds and sixteen random, so ids from later
177
+ * milliseconds sort after earlier ones. Throws a TypeError for a time before 1970, after 10889 or invalid.
178
+ */
179
+ ulid: (time?: Date) => string;
180
+ /** Laravel's Str::isUuid(): five groups of hex digits, any version. */
181
+ isUuid: (value: unknown) => value is string;
182
+ /** Laravel's Str::isUlid(): 26 Crockford characters in either case, the first at most 7. */
183
+ isUlid: (value: unknown) => value is string;
184
+ /** Wildcard match: `*` matches anything; everything else is literal. */
185
+ is: (pattern: string, value: string) => boolean;
186
+ startsWith: (v: string, needles: string | string[]) => boolean;
187
+ endsWith: (v: string, needles: string | string[]) => boolean;
188
+ contains: (v: string, needles: string | string[]) => boolean;
189
+ after: (v: string, search: string) => string;
190
+ afterLast: (v: string, search: string) => string;
191
+ before: (v: string, search: string) => string;
192
+ beforeLast: (v: string, search: string) => string;
193
+ between: (v: string, from: string, to: string) => string;
194
+ limit: (v: string, limit?: number, end?: string) => string;
195
+ start: (v: string, prefix: string) => string;
196
+ finish: (v: string, cap: string) => string;
197
+ };
198
+
199
+ type Obj = Record<string, unknown>;
200
+ declare const Arr: {
201
+ get<T = unknown>(target: unknown, key: string | undefined, defaultValue?: T): T;
202
+ has(target: unknown, key: string): boolean;
203
+ set(target: Obj, key: string, value: unknown): Obj;
204
+ forget(target: Obj, key: string): void;
205
+ dot(target: Obj, prefix?: string): Obj;
206
+ undot(flat: Obj): Obj;
207
+ only<T extends Obj>(target: T, keys: string[]): Partial<T>;
208
+ except<T extends Obj>(target: T, keys: string[]): Partial<T>;
209
+ wrap<T>(value: T | T[] | null | undefined): T[];
210
+ first<T, D = undefined>(items: readonly T[], predicate?: (item: T, index: number) => boolean, defaultValue?: D): T | D;
211
+ last<T, D = undefined>(items: readonly T[], predicate?: (item: T, index: number) => boolean, defaultValue?: D): T | D;
212
+ };
213
+
214
+ declare abstract class ServiceProvider implements ServiceProvider$1 {
215
+ protected readonly app: Application;
216
+ constructor(app: Application);
217
+ register(): void;
218
+ boot(): void | Promise<void>;
219
+ /** Package defaults under `key`; values the app already set win (shallow merge, like Laravel). */
220
+ protected mergeConfigFrom(defaults: Record<string, unknown>, key: string): void;
221
+ }
222
+
223
+ interface FacadeStatics<T> {
224
+ getFacadeRoot(): T;
225
+ /** Replace the instance in the current container (used by X.fake()). */
226
+ swap(instance: T): void;
227
+ }
228
+ type Facade<T, X = object> = T & X & FacadeStatics<T>;
229
+ declare function facade<T extends object, X extends object = object>(abstract: Abstract<T>, extras?: X): Facade<T, X>;
230
+
231
+ declare class ClassRegistry implements ClassRegistry$1 {
232
+ private readonly byName;
233
+ private readonly byClass;
234
+ register(cls: Class<unknown>, name?: string): string;
235
+ nameOf(cls: Class<unknown>): string | undefined;
236
+ resolve<T = unknown>(name: string): Class<T>;
237
+ has(name: string): boolean;
238
+ }
239
+
240
+ /**
241
+ * The application, or an abstract resolved from the current container.
242
+ * Inside a request scope, app().make()/instance()/… act on that scope, so app().make(X) sees scoped services.
243
+ */
244
+ declare function app(): Application;
245
+ declare function app<T>(abstract: Abstract<T>): T;
246
+ declare function config(): ConfigRepository;
247
+ declare function config(values: Record<string, unknown>): void;
248
+ declare function config<T = unknown>(key: string, defaultValue?: T): T;
249
+ declare const now: () => Date;
250
+ declare const value: <T>(v: T | (() => T)) => T;
251
+ declare function tap<T>(target: T, callback: (target: T) => void): T;
252
+ /** Calls fn up to `times` times (attempt numbers are 1-based). Rethrows the last error, or the first one `when` rejects. */
253
+ declare function retry<T>(times: number, fn: (attempt: number) => T | Promise<T>, sleepMs?: number | ((attempt: number) => number), when?: (error: unknown) => boolean): Promise<T>;
254
+
255
+ /**
256
+ * Laravel's __(): the line for `key` with `:placeholders` filled (`:name`, `:Name` capitalized, `:NAME` upper-cased),
257
+ * longest placeholder first. A key with no line comes back as is, so a sentence can be its own key:
258
+ * __('auth.failed'), __('auth.throttle', { seconds: 30 }), __('A reset link will be sent if the account exists.').
259
+ */
260
+ declare function __(key: string, replace?: Record<string, string | number>): string;
261
+
262
+ /**
263
+ * What a file's bytes show it to be, read from its leading bytes the way PHP's finfo reads them for Laravel (the file
264
+ * validation rules, and the extension a stored upload gets). The client's file name and MIME type are never consulted.
265
+ */
266
+ interface DetectedType {
267
+ /** 'image/png', 'text/plain', …; 'application/octet-stream' when no format matches, 'application/x-empty' for no bytes. */
268
+ readonly mime: string;
269
+ /** The extensions that name the type, the usual one first. Empty when the bytes match no format. */
270
+ readonly extensions: readonly string[];
271
+ }
272
+ declare const JPEG: DetectedType;
273
+ declare const PNG: DetectedType;
274
+ declare const GIF: DetectedType;
275
+ declare const WEBP: DetectedType;
276
+ declare const AVIF: DetectedType;
277
+ declare const BMP: DetectedType;
278
+ declare const SVG: DetectedType;
279
+ declare const PDF: DetectedType;
280
+ declare const HTML: DetectedType;
281
+ declare const XML: DetectedType;
282
+ declare const TEXT: DetectedType;
283
+ declare const UNKNOWN: DetectedType;
284
+ declare const EMPTY: DetectedType;
285
+ /** The raster formats the image rule accepts: Laravel 12's jpg, jpeg, png, gif, bmp and webp, plus AVIF. */
286
+ declare const RASTER_IMAGES: ReadonlySet<string>;
287
+ /** Every format recognised by its bytes other than plain text. */
288
+ declare const BINARY_AND_MARKUP_TYPES: readonly DetectedType[];
289
+ /**
290
+ * How much of a file is read to tell its type: the window checked for binary bytes (libmagic reads its first megabyte
291
+ * too). Uploads read this much to be named, so naming and validation see the same bytes.
292
+ */
293
+ declare const SNIFF_BYTES: number;
294
+ /** The type the bytes show. */
295
+ declare function detectFileType(bytes: Uint8Array): DetectedType;
296
+
297
+ declare const fileType_AVIF: typeof AVIF;
298
+ declare const fileType_BINARY_AND_MARKUP_TYPES: typeof BINARY_AND_MARKUP_TYPES;
299
+ declare const fileType_BMP: typeof BMP;
300
+ type fileType_DetectedType = DetectedType;
301
+ declare const fileType_EMPTY: typeof EMPTY;
302
+ declare const fileType_GIF: typeof GIF;
303
+ declare const fileType_HTML: typeof HTML;
304
+ declare const fileType_JPEG: typeof JPEG;
305
+ declare const fileType_PDF: typeof PDF;
306
+ declare const fileType_PNG: typeof PNG;
307
+ declare const fileType_RASTER_IMAGES: typeof RASTER_IMAGES;
308
+ declare const fileType_SNIFF_BYTES: typeof SNIFF_BYTES;
309
+ declare const fileType_SVG: typeof SVG;
310
+ declare const fileType_TEXT: typeof TEXT;
311
+ declare const fileType_UNKNOWN: typeof UNKNOWN;
312
+ declare const fileType_WEBP: typeof WEBP;
313
+ declare const fileType_XML: typeof XML;
314
+ declare const fileType_detectFileType: typeof detectFileType;
315
+ declare namespace fileType {
316
+ export { fileType_AVIF as AVIF, fileType_BINARY_AND_MARKUP_TYPES as BINARY_AND_MARKUP_TYPES, fileType_BMP as BMP, type fileType_DetectedType as DetectedType, fileType_EMPTY as EMPTY, fileType_GIF as GIF, fileType_HTML as HTML, fileType_JPEG as JPEG, fileType_PDF as PDF, fileType_PNG as PNG, fileType_RASTER_IMAGES as RASTER_IMAGES, fileType_SNIFF_BYTES as SNIFF_BYTES, fileType_SVG as SVG, fileType_TEXT as TEXT, fileType_UNKNOWN as UNKNOWN, fileType_WEBP as WEBP, fileType_XML as XML, fileType_detectFileType as detectFileType };
317
+ }
318
+
319
+ export { Arr as A, Collection as C, type Facade as F, LazyCollection as L, ServiceProvider as S, __ as _, Stringable as a, ClassRegistry as b, type FacadeStatics as c, Str as d, app as e, fileType as f, collect as g, config as h, facade as i, now as n, retry as r, tap as t, value as v };