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

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.
Files changed (86) hide show
  1. package/NOTICE +4 -0
  2. package/README.md +10 -1
  3. package/TRADEMARKS.md +33 -0
  4. package/dist/{chunk-ZOEPKBVF.js → chunk-4MWG3B7G.js} +1347 -428
  5. package/dist/chunk-4MWG3B7G.js.map +1 -0
  6. package/dist/{chunk-POEP4B2M.js → chunk-7ZQZYDOC.js} +745 -105
  7. package/dist/chunk-7ZQZYDOC.js.map +1 -0
  8. package/dist/{chunk-I63ZFMX6.js → chunk-GVNLZZTN.js} +1 -1
  9. package/dist/chunk-GVNLZZTN.js.map +1 -0
  10. package/dist/{chunk-MFTZQMZM.js → chunk-VOYW3R5J.js} +4 -4
  11. package/dist/chunk-VOYW3R5J.js.map +1 -0
  12. package/dist/contracts.d.ts +515 -17
  13. package/dist/contracts.js +1 -1
  14. package/dist/index.d-WQpfdIbG.d.ts +630 -0
  15. package/dist/index.d.ts +964 -152
  16. package/dist/index.js +4279 -866
  17. package/dist/index.js.map +1 -1
  18. package/dist/{jsx-runtime-CBZQYYDS.d.ts → jsx-runtime-6um4Mwfb.d.ts} +96 -5
  19. package/dist/jsx-runtime.d.ts +2 -2
  20. package/dist/jsx-runtime.js +3 -3
  21. package/dist/{testing-BM481Hdz.d.ts → testing-CKwfWJGn.d.ts} +180 -15
  22. package/dist/testing.d.ts +2 -2
  23. package/dist/testing.js +3 -3
  24. package/docs/authentication.md +487 -0
  25. package/docs/authorization.md +435 -0
  26. package/docs/cache.md +647 -0
  27. package/docs/collections.md +2270 -0
  28. package/docs/configuration.md +334 -0
  29. package/docs/console.md +651 -0
  30. package/docs/container.md +430 -0
  31. package/docs/controllers.md +406 -0
  32. package/docs/csrf.md +126 -0
  33. package/docs/database-testing.md +144 -0
  34. package/docs/database.md +236 -0
  35. package/docs/deployment.md +276 -0
  36. package/docs/eloquent-collections.md +218 -0
  37. package/docs/eloquent-factories.md +255 -0
  38. package/docs/eloquent-mutators.md +254 -0
  39. package/docs/eloquent-observers.md +145 -0
  40. package/docs/eloquent-relationships.md +557 -0
  41. package/docs/eloquent.md +494 -0
  42. package/docs/encryption.md +104 -0
  43. package/docs/errors.md +318 -0
  44. package/docs/events.md +336 -0
  45. package/docs/facades.md +278 -0
  46. package/docs/hashing.md +118 -0
  47. package/docs/helpers.md +1281 -0
  48. package/docs/http-tests.md +386 -0
  49. package/docs/inertia.md +485 -0
  50. package/docs/installation.md +209 -0
  51. package/docs/lifecycle.md +234 -0
  52. package/docs/live-tests.md +226 -0
  53. package/docs/live.md +910 -0
  54. package/docs/logging.md +255 -0
  55. package/docs/mail.md +619 -0
  56. package/docs/middleware.md +384 -0
  57. package/docs/migrations.md +416 -0
  58. package/docs/mocking.md +264 -0
  59. package/docs/navigation.json +273 -0
  60. package/docs/notifications.md +225 -0
  61. package/docs/pagination.md +247 -0
  62. package/docs/passwords.md +207 -0
  63. package/docs/providers.md +187 -0
  64. package/docs/queries.md +600 -0
  65. package/docs/queues.md +330 -0
  66. package/docs/requests.md +533 -0
  67. package/docs/responses.md +444 -0
  68. package/docs/routing.md +738 -0
  69. package/docs/scheduling.md +277 -0
  70. package/docs/seeding.md +122 -0
  71. package/docs/session.md +409 -0
  72. package/docs/starter-kits.md +396 -0
  73. package/docs/storage.md +192 -0
  74. package/docs/structure.md +264 -0
  75. package/docs/testing.md +165 -0
  76. package/docs/time-travel.md +138 -0
  77. package/docs/validation.md +1792 -0
  78. package/docs/verification.md +152 -0
  79. package/docs/views.md +566 -0
  80. package/docs/vite.md +322 -0
  81. package/package.json +34 -32
  82. package/dist/chunk-I63ZFMX6.js.map +0 -1
  83. package/dist/chunk-MFTZQMZM.js.map +0 -1
  84. package/dist/chunk-POEP4B2M.js.map +0 -1
  85. package/dist/chunk-ZOEPKBVF.js.map +0 -1
  86. package/dist/index.d-BJyJx6U1.d.ts +0 -319
package/dist/contracts.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  ValidationFactory,
45
45
  ViewFactory,
46
46
  token
47
- } from "./chunk-I63ZFMX6.js";
47
+ } from "./chunk-GVNLZZTN.js";
48
48
  export {
49
49
  Application,
50
50
  AuthFactory,
@@ -0,0 +1,630 @@
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 Source<T> = () => AsyncIterable<T> | Iterable<T>;
6
+ /** Pull-based and async: for DB cursors (Model.lazy()) and large files. */
7
+ declare class LazyCollection<T> implements AsyncIterable<T> {
8
+ private readonly source;
9
+ constructor(source: Source<T>);
10
+ static make<T>(source: Source<T>): LazyCollection<T>;
11
+ [Symbol.asyncIterator](): AsyncIterator<T>;
12
+ map<U>(callback: (item: T, index: number) => U | Promise<U>): LazyCollection<U>;
13
+ filter(callback: (item: T, index: number) => unknown): LazyCollection<T>;
14
+ take(count: number): LazyCollection<T>;
15
+ chunk(size: number): LazyCollection<Collection<T>>;
16
+ /** Return false from the callback to stop. */
17
+ each(callback: (item: T, index: number) => unknown): Promise<void>;
18
+ first(callback?: (item: T) => unknown): Promise<T | undefined>;
19
+ count(): Promise<number>;
20
+ collect(): Promise<Collection<T>>;
21
+ }
22
+
23
+ type Getter<T, V = unknown> = (keyof T & string) | ((item: T) => V);
24
+ type Predicate<T> = (item: T, index: number) => unknown;
25
+ /** A class whose instances whereInstanceOf() keeps. */
26
+ type ClassOf<I = unknown> = abstract new (...args: never) => I;
27
+ /** One step of sortBy([...]): a key, [key, direction], or a comparator. */
28
+ type SortStep<T> = (keyof T & string) | readonly [Getter<T>, ('asc' | 'desc')?] | ((a: T, b: T) => number);
29
+ /** One level of flatten(1): arrays and collections give their items, anything else stays. */
30
+ type Flat1<T> = T extends Collection<infer U> ? U : T extends readonly (infer U)[] ? U : T;
31
+ /** flatten(): the leaves of nested arrays and collections. */
32
+ type Flat<T> = T extends Collection<infer U> ? Flat<U> : T extends readonly (infer U)[] ? Flat<U> : T;
33
+ /**
34
+ * The item type of a collection type. Methods whose result type depends on the item type through a conditional type
35
+ * (collapse(), flatten()) take it from their `this` type instead of T, so Collection<T> stays covariant in T.
36
+ */
37
+ type ItemOf<C> = C extends Collection<infer U> ? U : never;
38
+ /**
39
+ * The arguments mapSpread()/eachSpread() pass: a tuple's items, then the index; an array's or a collection's items
40
+ * (the index is still passed last, but isn't in the type, which can't place it after a list of unknown length).
41
+ */
42
+ type SpreadArgs<I> = I extends Collection<infer V> ? V[] : I extends readonly unknown[] ? (number extends I['length'] ? I : [...I, number]) : never;
43
+ /** What when()/unless() return: the callback's result, or the collection when it returns nothing. */
44
+ type Outcome<U> = Exclude<U, void | undefined | null>;
45
+ /** The type names ensure() accepts besides classes: typeof's, plus 'null' and 'array'. */
46
+ type TypeName = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'function' | 'object' | 'null' | 'array';
47
+ type TypeOfName<N> = N extends 'string' ? string : N extends 'number' ? number : N extends 'bigint' ? bigint : N extends 'boolean' ? boolean : N extends 'symbol' ? symbol : N extends 'undefined' ? undefined : N extends 'function' ? (...args: never[]) => unknown : N extends 'object' ? object : N extends 'null' ? null : N extends 'array' ? unknown[] : never;
48
+ type Ensured<E> = E extends TypeName ? TypeOfName<E> : E extends ClassOf<infer I> ? I : never;
49
+ /** The item types of crossJoin()'s lists. */
50
+ type ItemsOf<L extends readonly Iterable<unknown>[]> = {
51
+ [K in keyof L]: L[K] extends Iterable<infer U> ? U : never;
52
+ };
53
+ /**
54
+ * Laravel's Collection over a list. Methods that return the same items return the receiver's class (a subclass keeps
55
+ * its class); methods that change the items return a base Collection. `out T`: a Collection<Dog> is a
56
+ * Collection<Animal>, so no member may use T contravariantly (callbacks of T are checked as method parameters).
57
+ */
58
+ declare class Collection<out T> implements Enumerable<T> {
59
+ protected readonly items: T[];
60
+ constructor(items?: Iterable<T>);
61
+ static make<T>(items?: Iterable<T>): Collection<T>;
62
+ /** Laravel semantics: callback receives 1..n. */
63
+ static times<T>(count: number, callback: (index: number) => T): Collection<T>;
64
+ /** The numbers from `from` to `to`, inclusive, counting up or down by `step` (PHP's range()). */
65
+ static range(from: number, to: number, step?: number): Collection<number>;
66
+ /** A collection of the value: an array's or collection's items, nothing for null or undefined, else [value]. */
67
+ static wrap<T>(value: Collection<T>): Collection<T>;
68
+ static wrap<T>(value: readonly T[]): Collection<T>;
69
+ static wrap<T>(value: T | null | undefined): Collection<NonNullable<T>>;
70
+ /** A collection's items as an array; anything else as it is. */
71
+ static unwrap<T>(value: Collection<T>): T[];
72
+ static unwrap<V>(value: V): V;
73
+ static empty<T = never>(): Collection<T>;
74
+ /** The decoded JSON: an array's items, nothing for null, else the one value. */
75
+ static fromJson<T = unknown>(json: string): Collection<T>;
76
+ /** A new collection of the receiver's class (a subclass keeps its class through filter(), sortBy(), …). */
77
+ protected newInstance(items?: Iterable<T>): this;
78
+ [Symbol.iterator](): Iterator<T>;
79
+ all(): T[];
80
+ count(): number;
81
+ isEmpty(): boolean;
82
+ isNotEmpty(): boolean;
83
+ toArray(): unknown[];
84
+ toJSON(): T[];
85
+ toJson(): string;
86
+ /** The item at an index, or the default (a function default is called). */
87
+ get(index: number): T | undefined;
88
+ get<D>(index: number, defaultValue: D | (() => D)): T | D;
89
+ /** Whether every given index exists. */
90
+ has(...indexes: Array<number | readonly number[]>): boolean;
91
+ /** Whether any of the given indexes exists. */
92
+ hasAny(...indexes: Array<number | readonly number[]>): boolean;
93
+ /** The index of the first item equal to the value (loosely, unless strict) or passing the callback; false when none. */
94
+ search(callback: Predicate<T>): number | false;
95
+ search(value: T, strict?: boolean): number | false;
96
+ /** The item before the first match of search(). */
97
+ before(callback: Predicate<T>): T | undefined;
98
+ before(value: T, strict?: boolean): T | undefined;
99
+ /** The item after the first match of search(). */
100
+ after(callback: Predicate<T>): T | undefined;
101
+ after(value: T, strict?: boolean): T | undefined;
102
+ /** The key's value on the first item where it is truthy, or the default. */
103
+ value<K extends keyof T & string>(key: K): NonNullable<T[K]> | undefined;
104
+ value<K extends keyof T & string, D>(key: K, defaultValue: D | (() => D)): NonNullable<T[K]> | D;
105
+ /** Whether every item passes the callback, has a truthy key, or meets a where condition. Empty is true. */
106
+ every(callback: Predicate<T>): boolean;
107
+ every(key: keyof T & string): boolean;
108
+ every(key: Getter<T>, value: unknown): boolean;
109
+ every(key: Getter<T>, operator: Operator, value: unknown): boolean;
110
+ /**
111
+ * Whether an item is the value (strictly), passes the callback, has the key's value (strictly), or meets a where
112
+ * condition (key, operator, value).
113
+ */
114
+ contains(key: keyof T & string, value: unknown): boolean;
115
+ contains(key: Getter<T>, operator: Operator, value: unknown): boolean;
116
+ contains(callback: (item: T) => boolean): boolean;
117
+ contains(value: unknown): boolean;
118
+ /** contains() under Laravel's other name. */
119
+ some(key: keyof T & string, value: unknown): boolean;
120
+ some(key: Getter<T>, operator: Operator, value: unknown): boolean;
121
+ some(callback: (item: T) => boolean): boolean;
122
+ some(value: unknown): boolean;
123
+ /** contains() with strict comparison (contains() already compares values strictly). */
124
+ containsStrict(key: keyof T & string, value: unknown): boolean;
125
+ containsStrict(callback: (item: T) => boolean): boolean;
126
+ containsStrict(value: unknown): boolean;
127
+ doesntContain(key: keyof T & string, value: unknown): boolean;
128
+ doesntContain(key: Getter<T>, operator: Operator, value: unknown): boolean;
129
+ doesntContain(callback: (item: T) => boolean): boolean;
130
+ doesntContain(value: unknown): boolean;
131
+ doesntContainStrict(key: keyof T & string, value: unknown): boolean;
132
+ doesntContainStrict(callback: (item: T) => boolean): boolean;
133
+ doesntContainStrict(value: unknown): boolean;
134
+ /** Whether there is exactly one item (that passes the callback). */
135
+ containsOneItem(callback?: Predicate<T>): boolean;
136
+ /** The only item (that matches), or ItemNotFoundError / MultipleItemsFoundError. */
137
+ sole(callback?: Predicate<T>): T;
138
+ sole(key: Getter<T>, value: unknown): T;
139
+ sole(key: Getter<T>, operator: Operator, value: unknown): T;
140
+ /** The first item (that matches), or ItemNotFoundError. */
141
+ firstOrFail(callback?: Predicate<T>): T;
142
+ firstOrFail(key: Getter<T>, value: unknown): T;
143
+ firstOrFail(key: Getter<T>, operator: Operator, value: unknown): T;
144
+ /** The items a callback or a where condition (sole(), firstOrFail()) selects; every item without arguments. */
145
+ private matching;
146
+ map<U>(callback: (item: T, index: number) => U): Collection<U>;
147
+ flatMap<U>(callback: (item: T, index: number) => U | U[] | Collection<U>): Collection<U>;
148
+ filter(callback?: (item: T, index: number) => unknown): this;
149
+ reject(callback: (item: T, index: number) => unknown): this;
150
+ /** Return false from the callback to stop. */
151
+ each(callback: (item: T, index: number) => unknown): this;
152
+ reduce<U>(callback: (carry: U, item: T, index: number) => U, initial: U): U;
153
+ first(): T | undefined;
154
+ first<D = undefined>(callback: (item: T, index: number) => unknown, defaultValue?: D): T | D;
155
+ last(): T | undefined;
156
+ last<D = undefined>(callback: (item: T, index: number) => unknown, defaultValue?: D): T | D;
157
+ /** where('active') keeps truthy values; where('role', 'admin') compares with `=` (loosely); or key, operator, value. */
158
+ where(key: Getter<T>): this;
159
+ where(key: Getter<T>, value: unknown): this;
160
+ where(key: Getter<T>, operator: Operator, value: unknown): this;
161
+ /** where() with strict comparison (===). */
162
+ whereStrict(key: Getter<T>, value: unknown): this;
163
+ firstWhere(key: Getter<T>): T | undefined;
164
+ firstWhere(key: Getter<T>, value: unknown): T | undefined;
165
+ firstWhere(key: Getter<T>, operator: Operator, value: unknown): T | undefined;
166
+ whereIn(key: Getter<T>, values: readonly unknown[]): this;
167
+ /** whereIn() under Laravel's strict name (whereIn() already compares strictly). */
168
+ whereInStrict(key: Getter<T>, values: readonly unknown[]): this;
169
+ whereNotIn(key: Getter<T>, values: readonly unknown[]): this;
170
+ whereNotInStrict(key: Getter<T>, values: readonly unknown[]): this;
171
+ /** Items whose key (or the item itself) is null or undefined (a missing key counts as null). */
172
+ whereNull(key?: Getter<T>): this;
173
+ whereNotNull(key?: Getter<T>): this;
174
+ /** Items whose key is within the first and last values, inclusive. */
175
+ whereBetween(key: Getter<T>, values: readonly unknown[]): this;
176
+ whereNotBetween(key: Getter<T>, values: readonly unknown[]): this;
177
+ /** Items that are instances of the class (or of any of the classes). */
178
+ whereInstanceOf<C extends ClassOf>(type: C | readonly C[]): Collection<InstanceType<C>>;
179
+ pluck<K extends keyof T & string>(key: K): Collection<T[K]>;
180
+ keyBy(key: Getter<T>): Record<string, T>;
181
+ groupBy(key: Getter<T>): Record<string, this>;
182
+ mapWithKeys<V>(callback: (item: T, index: number) => readonly [string, V]): Record<string, V>;
183
+ /** The repeated values (loosely compared), or of a key or a callback: ['a', 'b', 'a'] → ['a']. */
184
+ duplicates(): Collection<T>;
185
+ duplicates<K extends keyof T & string>(key: K): Collection<T[K]>;
186
+ duplicates<V>(callback: (item: T) => V): Collection<V>;
187
+ /** duplicates() with strict comparison. */
188
+ duplicatesStrict(): Collection<T>;
189
+ duplicatesStrict<K extends keyof T & string>(key: K): Collection<T[K]>;
190
+ duplicatesStrict<V>(callback: (item: T) => V): Collection<V>;
191
+ /** Laravel's duplicates(): each value after the first of its kind. */
192
+ private repeated;
193
+ /** The items that aren't in the given items (strict comparison). */
194
+ diff(items: Iterable<T>): this;
195
+ /** diff() with a comparator that returns 0 for equal items. */
196
+ diffUsing(items: Iterable<T>, callback: (a: T, b: T) => number): this;
197
+ /** The items that are also in the given items (strict comparison). */
198
+ intersect(items: Iterable<T>): this;
199
+ intersectUsing(items: Iterable<T>, callback: (a: T, b: T) => number): this;
200
+ /** Sorted with the default ascending order (numbers, dates, then strings), or by a comparator. */
201
+ sort(callback?: (a: T, b: T) => number): this;
202
+ sortDesc(): this;
203
+ /**
204
+ * Stable sort by a key or a callback value, nulls last both ways; or by several steps:
205
+ * sortBy([['name', 'asc'], ['age', 'desc']]), sortBy(['name', (a, b) => b.age - a.age]).
206
+ */
207
+ sortBy(key: Getter<T>, direction?: 'asc' | 'desc'): this;
208
+ sortBy(steps: ReadonlyArray<SortStep<T>>): this;
209
+ sortByDesc(key: Getter<T>): this;
210
+ sum(key?: Getter<T>): number;
211
+ avg(key?: Getter<T>): number | undefined;
212
+ min(key?: Getter<T>): number | undefined;
213
+ max(key?: Getter<T>): number | undefined;
214
+ /** avg() under Laravel's other name. */
215
+ average(key?: Getter<T>): number | undefined;
216
+ /** The middle number (the mean of the two middle ones for an even count), ignoring null and non-numbers. */
217
+ median(key?: Getter<T>): number | undefined;
218
+ /** The most frequent values (strict comparison), in the order they first appear; undefined when empty. */
219
+ mode(): T[] | undefined;
220
+ mode<K extends keyof T & string>(key: K): Array<T[K]> | undefined;
221
+ /** The share of items that pass the callback, as a percentage rounded to `precision` places; undefined when empty. */
222
+ percentage(callback: Predicate<T>, precision?: number): number | undefined;
223
+ /** How many items have each value, key value or callback result: [1, 2, 2].countBy() → { 1: 1, 2: 2 }. */
224
+ countBy(key?: Getter<T>): Record<string, number>;
225
+ /** Groups the callback's [key, value] pairs: values under the same key are collected in arrays. */
226
+ mapToDictionary<V>(callback: (item: T, index: number) => readonly [PropertyKey, V]): Record<string, V[]>;
227
+ /** mapToDictionary() with each group as a collection. */
228
+ mapToGroups<V>(callback: (item: T, index: number) => readonly [PropertyKey, V]): Record<string, Collection<V>>;
229
+ /** A new instance of the class for each item: new cls(item, index). */
230
+ mapInto<C>(cls: new (item: T, index: number) => C): Collection<C>;
231
+ /** Maps nested arrays (or collections) with their items as the arguments, then the index. */
232
+ mapSpread<U, C extends Collection<unknown>>(this: C, callback: (...args: SpreadArgs<ItemOf<C>>) => U): Collection<U>;
233
+ /** each() with the nested items as the arguments, then the index. Return false to stop. */
234
+ eachSpread<C extends Collection<unknown>>(this: C, callback: (...args: SpreadArgs<ItemOf<C>>) => unknown): C;
235
+ /** reduce() with several carried values: the reducer gets them, then the item and index, and returns them as an array. */
236
+ reduceSpread<A extends unknown[]>(callback: (...args: [...A, T, number]) => [...NoInfer<A>], ...initial: A): A;
237
+ /** The first item of each value (strict comparison), or of each key or callback value. */
238
+ unique(key?: Getter<T>): this;
239
+ /** unique() under Laravel's strict name (unique() already compares strictly). */
240
+ uniqueStrict(key?: Getter<T>): this;
241
+ chunk(size: number): Collection<this>;
242
+ /** Negative count takes from the end. */
243
+ take(count: number): this;
244
+ skip(count: number): this;
245
+ /** PHP's array_slice(): a negative offset counts from the end; a negative length leaves that many off the end. */
246
+ slice(offset: number, length?: number): this;
247
+ values(): this;
248
+ /** Mutates, like Laravel. */
249
+ push(...values: T[]): this;
250
+ concat(values: Iterable<T>): this;
251
+ partition(callback: (item: T, index: number) => unknown): [this, this];
252
+ reverse(): this;
253
+ shuffle(): this;
254
+ /** One random item, or `count` of them (a number or a function of the collection) in their original order. */
255
+ random(): T;
256
+ random(count: number | ((collection: this) => number)): this;
257
+ /** Every step-th item, starting at offset. */
258
+ nth(step: number, offset?: number): this;
259
+ /** Pads to `size` items with the value; a negative size pads at the start (PHP's array_pad()). */
260
+ pad<V>(size: number, value: V): Collection<T | V>;
261
+ /** The items of one page: forPage(2, 15). */
262
+ forPage(page: number, perPage: number): this;
263
+ /** `count` groups of nearly equal size, the first ones larger. */
264
+ split(count: number): Collection<this>;
265
+ /** `count` groups, every group full except the last. */
266
+ splitIn(count: number): Collection<this>;
267
+ /** Overlapping windows of `size` items, `step` apart: [1, 2, 3].sliding(2) → [[1, 2], [2, 3]]. */
268
+ sliding(size?: number, step?: number): Collection<this>;
269
+ /** Chunks that grow while the callback (value, index, the current chunk) returns true. */
270
+ chunkWhile(callback: (value: T, index: number, chunk: this) => unknown): Collection<this>;
271
+ /** The items before the first one that is the value (strictly) or passes the callback. */
272
+ takeUntil(callback: Predicate<T>): this;
273
+ takeUntil(value: T): this;
274
+ /** The items up to the first one that isn't the value or fails the callback. */
275
+ takeWhile(callback: Predicate<T>): this;
276
+ takeWhile(value: T): this;
277
+ /** The items from the first one that is the value or passes the callback. */
278
+ skipUntil(callback: Predicate<T>): this;
279
+ skipUntil(value: T): this;
280
+ /** The items from the first one that isn't the value or fails the callback. */
281
+ skipWhile(callback: Predicate<T>): this;
282
+ skipWhile(value: T): this;
283
+ /** The items at the given indexes, in collection order. */
284
+ only(...indexes: Array<number | readonly number[]>): this;
285
+ /** The items except those at the given indexes. */
286
+ except(...indexes: Array<number | readonly number[]>): this;
287
+ /** The indexes: 0, 1, 2, … */
288
+ keys(): Collection<number>;
289
+ /** Removes and returns the last item; with a count, a collection of the last `count` items, last first. */
290
+ pop(): T | undefined;
291
+ pop(count: number): this;
292
+ /** Removes and returns the first item; with a count, a collection of the first `count` items. */
293
+ shift(): T | undefined;
294
+ shift(count: number): this;
295
+ /** Adds an item at the start (mutates). */
296
+ prepend(value: T): this;
297
+ /** Adds items at the start, in the given order (mutates). */
298
+ unshift(...values: T[]): this;
299
+ /** Adds one item at the end (mutates). */
300
+ add(item: T): this;
301
+ /** Sets the item at an index (mutates); an index at or past the end appends. */
302
+ put(index: number, value: T): this;
303
+ /** Removes and returns the item at an index (mutates), or the default. */
304
+ pull(index: number): T | undefined;
305
+ pull<D>(index: number, defaultValue: D | (() => D)): T | D;
306
+ /** Removes the items at the given indexes (mutates); the later items move up. */
307
+ forget(...indexes: Array<number | readonly number[]>): this;
308
+ /**
309
+ * Removes `length` items from `offset` (mutates), inserting the replacement there, and returns the removed items
310
+ * (PHP's array_splice(): a negative offset counts from the end; a negative length leaves that many at the end).
311
+ */
312
+ splice(offset: number, length?: number, replacement?: Iterable<T>): this;
313
+ /** Replaces every item with the callback's result (mutates) and returns this collection, typed with the new items. */
314
+ transform<U>(callback: (item: T, index: number) => U): Collection<U>;
315
+ /**
316
+ * A copy with items replaced by index: an array from index 0, or { index: value }; past the end appends, and a
317
+ * negative or fractional index throws a RangeError, as put() does.
318
+ */
319
+ replace(items: Iterable<T> | Readonly<Record<number, T>>): this;
320
+ /** One level of nested arrays and collections, merged (other items are dropped). */
321
+ collapse<U>(this: Collection<readonly U[] | Collection<U>>): Collection<U>;
322
+ /** Nested arrays and collections opened up (all levels, or `depth`); plain objects are kept whole. */
323
+ flatten<C extends Collection<unknown>>(this: C): Collection<Flat<ItemOf<C>>>;
324
+ flatten<C extends Collection<unknown>>(this: C, depth: 1): Collection<Flat1<ItemOf<C>>>;
325
+ flatten(depth: number): Collection<unknown>;
326
+ /** Every combination of the items with the lists' items: [1, 2] × ['a'] → [[1, 'a'], [2, 'a']]. */
327
+ crossJoin<L extends readonly Iterable<unknown>[]>(...lists: L): Collection<[T, ...ItemsOf<L>]>;
328
+ /** Pairs items by index with the lists' items, as collections; the shorter lists give undefined. */
329
+ zip<U>(...lists: Array<Iterable<U>>): Collection<Collection<T | U | undefined>>;
330
+ /** The items as keys for the values: ['name', 'age'].combine(['George', 29]) → { name: 'George', age: 29 }. */
331
+ combine<V>(values: Iterable<V>): Record<string, V>;
332
+ /** Each item as a key for its index: ['a', 'b'] → { a: 0, b: 1 }. */
333
+ flip(): Record<string, number>;
334
+ /** The items followed by the given ones (a list merges by appending). */
335
+ merge(items: Iterable<T>): this;
336
+ /** The items repeated `multiplier` times. */
337
+ multiply(multiplier: number): this;
338
+ /**
339
+ * Each item reduced to the given keys it has: select(['name', 'role']). An item has a key when `key in item` or
340
+ * reading it gives a value, so a model's attributes, which its proxy serves on read, are kept.
341
+ */
342
+ select<K extends keyof T & string>(...keys: Array<K | readonly K[]>): Collection<Pick<T, K>>;
343
+ /** A LazyCollection over a copy of the items: later changes to this collection don't reach it. */
344
+ lazy(): LazyCollection<T>;
345
+ /** A base collection with the same items. */
346
+ collect(): Collection<T>;
347
+ implode(glue: string): string;
348
+ implode(key: keyof T & string, glue: string): string;
349
+ implode(callback: (item: T, index: number) => unknown, glue: string): string;
350
+ /** implode() with a different glue before the last item: join(', ', ' and ') → 'a, b and c'. */
351
+ join(glue: string, finalGlue?: string): string;
352
+ /**
353
+ * Runs the callback (collection, value) when the value is truthy, else the default; a function value is called with
354
+ * the collection first. Returns what the callback returns, or the collection when it returns nothing.
355
+ */
356
+ when<V, U = this, D = this>(value: V | ((collection: this) => V), callback: (collection: this, value: V) => U, otherwise?: (collection: this, value: V) => D): this | Outcome<U> | Outcome<D>;
357
+ /** when() with the condition reversed. */
358
+ unless<V, U = this, D = this>(value: V | ((collection: this) => V), callback: (collection: this, value: V) => U, otherwise?: (collection: this, value: V) => D): this | Outcome<U> | Outcome<D>;
359
+ whenEmpty<U = this, D = this>(callback: (collection: this) => U, otherwise?: (collection: this) => D): this | Outcome<U> | Outcome<D>;
360
+ whenNotEmpty<U = this, D = this>(callback: (collection: this) => U, otherwise?: (collection: this) => D): this | Outcome<U> | Outcome<D>;
361
+ /** whenNotEmpty() under Laravel's other name. */
362
+ unlessEmpty<U = this, D = this>(callback: (collection: this) => U, otherwise?: (collection: this) => D): this | Outcome<U> | Outcome<D>;
363
+ /** whenEmpty() under Laravel's other name. */
364
+ unlessNotEmpty<U = this, D = this>(callback: (collection: this) => U, otherwise?: (collection: this) => D): this | Outcome<U> | Outcome<D>;
365
+ pipe<U>(callback: (collection: this) => U): U;
366
+ /** new cls(collection). */
367
+ pipeInto<C>(cls: new (collection: this) => C): C;
368
+ /** Passes the collection through the callbacks in order, each getting the previous result. */
369
+ pipeThrough<A>(callbacks: readonly [(collection: this) => A]): A;
370
+ pipeThrough<A, B>(callbacks: readonly [(collection: this) => A, (value: A) => B]): B;
371
+ pipeThrough<A, B, C>(callbacks: readonly [(collection: this) => A, (value: A) => B, (value: B) => C]): C;
372
+ pipeThrough(callbacks: ReadonlyArray<(value: never) => unknown>): unknown;
373
+ tap(callback: (collection: this) => void): this;
374
+ /**
375
+ * Throws a TypeError unless every item is an instance of one of the classes or of one of the type names (typeof's,
376
+ * plus 'null' and 'array'), with Laravel's message. Returns the collection, typed with the checked items.
377
+ */
378
+ ensure<E extends ClassOf | TypeName>(type: E | readonly E[]): Collection<Ensured<E>>;
379
+ /** Logs the items (and any extra values) with console.log and returns the collection. */
380
+ dump(...values: unknown[]): this;
381
+ /** JSON with four-space indentation (PHP's JSON_PRETTY_PRINT). */
382
+ toPrettyJson(): string;
383
+ }
384
+ declare function collect<T>(items?: Iterable<T>): Collection<T>;
385
+
386
+ /** Thrown by sole() and firstOrFail() when no item matches (Laravel's ItemNotFoundException). */
387
+ declare class ItemNotFoundError extends Error {
388
+ readonly name = "ItemNotFoundError";
389
+ constructor();
390
+ }
391
+ /** Thrown by sole() when more than one item matches (Laravel's MultipleItemsFoundException). */
392
+ declare class MultipleItemsFoundError extends Error {
393
+ readonly count: number;
394
+ readonly name = "MultipleItemsFoundError";
395
+ constructor(count: number);
396
+ }
397
+
398
+ /**
399
+ * Laravel's Stringable: a string with Str's helpers as chainable methods, each returning a new Stringable.
400
+ * `Str.of(' Café ').trim().slug().toString()` is 'cafe'; `request().string('q')` returns one. It prints as its string.
401
+ */
402
+ declare class Stringable {
403
+ #private;
404
+ constructor(value?: string);
405
+ after(search: string): Stringable;
406
+ afterLast(search: string): Stringable;
407
+ append(...values: string[]): Stringable;
408
+ ascii(): Stringable;
409
+ before(search: string): Stringable;
410
+ beforeLast(search: string): Stringable;
411
+ between(from: string, to: string): Stringable;
412
+ camel(): Stringable;
413
+ contains(needles: string | string[]): boolean;
414
+ endsWith(needles: string | string[]): boolean;
415
+ /** The same string as `value` (a string or another Stringable). */
416
+ exactly(value: string | Stringable): boolean;
417
+ /** The parts between the delimiters, as a Collection (PHP's explode()). */
418
+ explode(delimiter: string): Collection<string>;
419
+ finish(cap: string): Stringable;
420
+ /** Wildcard match, as Str.is(): `*` matches anything. */
421
+ is(pattern: string): boolean;
422
+ isEmpty(): boolean;
423
+ isNotEmpty(): boolean;
424
+ kebab(): Stringable;
425
+ lcfirst(): Stringable;
426
+ /** The number of characters (code points, as PHP's mb_strlen()). */
427
+ length(): number;
428
+ limit(limit?: number, end?: string): Stringable;
429
+ lower(): Stringable;
430
+ /** Strips whitespace and invisible characters from the start, or the characters given. */
431
+ ltrim(characters?: string): Stringable;
432
+ plural(count?: number): Stringable;
433
+ prepend(...values: string[]): Stringable;
434
+ /** Replaces every occurrence of the search string (or of each of several) with `replace`. */
435
+ replace(search: string | string[], replace: string): Stringable;
436
+ /** Strips whitespace and invisible characters from the end, or the characters given. */
437
+ rtrim(characters?: string): Stringable;
438
+ singular(): Stringable;
439
+ slug(separator?: string): Stringable;
440
+ snake(delimiter?: string): Stringable;
441
+ start(prefix: string): Stringable;
442
+ startsWith(needles: string | string[]): boolean;
443
+ studly(): Stringable;
444
+ title(): Stringable;
445
+ /** PHP's filter_var(FILTER_VALIDATE_BOOLEAN): '1', 'true', 'on' and 'yes' (any case, trimmed) are true. */
446
+ toBoolean(): boolean;
447
+ /** PHP's floatval(): the leading number, else 0. */
448
+ toFloat(): number;
449
+ /** PHP's intval(): the leading digits, else 0. */
450
+ toInteger(): number;
451
+ toJSON(): string;
452
+ toString(): string;
453
+ /** Strips whitespace and invisible characters from both ends (Laravel's Str::trim()), or the characters given. */
454
+ trim(characters?: string): Stringable;
455
+ ucfirst(): Stringable;
456
+ upper(): Stringable;
457
+ value(): string;
458
+ }
459
+
460
+ declare const Str: {
461
+ /** Laravel's Str::of(): the value as a Stringable, for chaining: Str.of(title).trim().slug(). */
462
+ of: (value?: unknown) => Stringable;
463
+ ucfirst: (v: string) => string;
464
+ lcfirst: (v: string) => string;
465
+ studly: (v: string) => string;
466
+ camel: (v: string) => string;
467
+ snake: (v: string, delimiter?: string) => string;
468
+ kebab: (v: string) => string;
469
+ title: (v: string) => string;
470
+ /** Laravel's Str::ascii(): the value in plain ASCII ('Café' → 'Cafe', 'Ελληνικά' → 'Ellinika'), as for English. */
471
+ ascii: (v: string) => string;
472
+ /**
473
+ * Laravel's Str::slug(): transliterated to ASCII first (unless `language` is null), '@' read as 'at', then lower-cased
474
+ * letters and digits joined by the separator: 'Café crème' → 'cafe-creme'. What has no ASCII form is dropped.
475
+ */
476
+ slug: (title: string, separator?: string, language?: "en" | null, dictionary?: Readonly<Record<string, string>>) => string;
477
+ plural: (v: string, count?: number) => string;
478
+ singular: (v: string) => string;
479
+ random: (length?: number) => string;
480
+ uuid: () => `${string}-${string}-${string}-${string}-${string}`;
481
+ /**
482
+ * A version 7 UUID (RFC 9562): the time in milliseconds first, so ids from later milliseconds sort after earlier ones
483
+ * (within one millisecond the order is random). Throws a TypeError for a time before 1970, after 10889 or invalid.
484
+ */
485
+ uuid7: (time?: Date) => string;
486
+ /**
487
+ * A ULID: 26 upper-case Crockford characters, ten for the time in milliseconds and sixteen random, so ids from later
488
+ * milliseconds sort after earlier ones. Throws a TypeError for a time before 1970, after 10889 or invalid.
489
+ */
490
+ ulid: (time?: Date) => string;
491
+ /** Laravel's Str::isUuid(): five groups of hex digits, any version. */
492
+ isUuid: (value: unknown) => value is string;
493
+ /** Laravel's Str::isUlid(): 26 Crockford characters in either case, the first at most 7. */
494
+ isUlid: (value: unknown) => value is string;
495
+ /** Wildcard match: `*` matches anything; everything else is literal. */
496
+ is: (pattern: string, value: string) => boolean;
497
+ startsWith: (v: string, needles: string | string[]) => boolean;
498
+ endsWith: (v: string, needles: string | string[]) => boolean;
499
+ contains: (v: string, needles: string | string[]) => boolean;
500
+ after: (v: string, search: string) => string;
501
+ afterLast: (v: string, search: string) => string;
502
+ before: (v: string, search: string) => string;
503
+ beforeLast: (v: string, search: string) => string;
504
+ between: (v: string, from: string, to: string) => string;
505
+ limit: (v: string, limit?: number, end?: string) => string;
506
+ start: (v: string, prefix: string) => string;
507
+ finish: (v: string, cap: string) => string;
508
+ };
509
+
510
+ type Obj = Record<string, unknown>;
511
+ declare const Arr: {
512
+ get<T = unknown>(target: unknown, key: string | undefined, defaultValue?: T): T;
513
+ has(target: unknown, key: string): boolean;
514
+ set(target: Obj, key: string, value: unknown): Obj;
515
+ forget(target: Obj, key: string): void;
516
+ dot(target: Obj, prefix?: string): Obj;
517
+ undot(flat: Obj): Obj;
518
+ only<T extends Obj>(target: T, keys: string[]): Partial<T>;
519
+ except<T extends Obj>(target: T, keys: string[]): Partial<T>;
520
+ wrap<T>(value: T | T[] | null | undefined): T[];
521
+ first<T, D = undefined>(items: readonly T[], predicate?: (item: T, index: number) => boolean, defaultValue?: D): T | D;
522
+ last<T, D = undefined>(items: readonly T[], predicate?: (item: T, index: number) => boolean, defaultValue?: D): T | D;
523
+ };
524
+
525
+ declare abstract class ServiceProvider implements ServiceProvider$1 {
526
+ protected readonly app: Application;
527
+ constructor(app: Application);
528
+ register(): void;
529
+ boot(): void | Promise<void>;
530
+ /** Package defaults under `key`; values the app already set win (shallow merge, like Laravel). */
531
+ protected mergeConfigFrom(defaults: Record<string, unknown>, key: string): void;
532
+ }
533
+
534
+ interface FacadeStatics<T> {
535
+ getFacadeRoot(): T;
536
+ /** Replace the instance in the current container (used by X.fake()). */
537
+ swap(instance: T): void;
538
+ }
539
+ type Facade<T, X = object> = T & X & FacadeStatics<T>;
540
+ declare function facade<T extends object, X extends object = object>(abstract: Abstract<T>, extras?: X): Facade<T, X>;
541
+
542
+ declare class ClassRegistry implements ClassRegistry$1 {
543
+ private readonly byName;
544
+ private readonly byClass;
545
+ register(cls: Class<unknown>, name?: string): string;
546
+ nameOf(cls: Class<unknown>): string | undefined;
547
+ resolve<T = unknown>(name: string): Class<T>;
548
+ has(name: string): boolean;
549
+ }
550
+
551
+ /**
552
+ * The application, or an abstract resolved from the current container.
553
+ * Inside a request scope, app().make()/instance()/… act on that scope, so app().make(X) sees scoped services.
554
+ */
555
+ declare function app(): Application;
556
+ declare function app<T>(abstract: Abstract<T>): T;
557
+ declare function config(): ConfigRepository;
558
+ declare function config(values: Record<string, unknown>): void;
559
+ declare function config<T = unknown>(key: string, defaultValue?: T): T;
560
+ declare const now: () => Date;
561
+ declare const value: <T>(v: T | (() => T)) => T;
562
+ declare function tap<T>(target: T, callback: (target: T) => void): T;
563
+ /** Calls fn up to `times` times (attempt numbers are 1-based). Rethrows the last error, or the first one `when` rejects. */
564
+ declare function retry<T>(times: number, fn: (attempt: number) => T | Promise<T>, sleepMs?: number | ((attempt: number) => number), when?: (error: unknown) => boolean): Promise<T>;
565
+
566
+ /**
567
+ * Laravel's __(): the line for `key` with `:placeholders` filled (`:name`, `:Name` capitalized, `:NAME` upper-cased),
568
+ * longest placeholder first. A key with no line comes back as is, so a sentence can be its own key:
569
+ * __('auth.failed'), __('auth.throttle', { seconds: 30 }), __('A reset link will be sent if the account exists.').
570
+ */
571
+ declare function __(key: string, replace?: Record<string, string | number>): string;
572
+
573
+ /**
574
+ * 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
575
+ * validation rules, and the extension a stored upload gets). The client's file name and MIME type are never consulted.
576
+ */
577
+ interface DetectedType {
578
+ /** 'image/png', 'text/plain', …; 'application/octet-stream' when no format matches, 'application/x-empty' for no bytes. */
579
+ readonly mime: string;
580
+ /** The extensions that name the type, the usual one first. Empty when the bytes match no format. */
581
+ readonly extensions: readonly string[];
582
+ }
583
+ declare const JPEG: DetectedType;
584
+ declare const PNG: DetectedType;
585
+ declare const GIF: DetectedType;
586
+ declare const WEBP: DetectedType;
587
+ declare const AVIF: DetectedType;
588
+ declare const BMP: DetectedType;
589
+ declare const SVG: DetectedType;
590
+ declare const PDF: DetectedType;
591
+ declare const HTML: DetectedType;
592
+ declare const XML: DetectedType;
593
+ declare const TEXT: DetectedType;
594
+ declare const UNKNOWN: DetectedType;
595
+ declare const EMPTY: DetectedType;
596
+ /** The raster formats the image rule accepts: Laravel 12's jpg, jpeg, png, gif, bmp and webp, plus AVIF. */
597
+ declare const RASTER_IMAGES: ReadonlySet<string>;
598
+ /** Every format recognised by its bytes other than plain text. */
599
+ declare const BINARY_AND_MARKUP_TYPES: readonly DetectedType[];
600
+ /**
601
+ * How much of a file is read to tell its type: the window checked for binary bytes (libmagic reads its first megabyte
602
+ * too). Uploads read this much to be named, so naming and validation see the same bytes.
603
+ */
604
+ declare const SNIFF_BYTES: number;
605
+ /** The type the bytes show. */
606
+ declare function detectFileType(bytes: Uint8Array): DetectedType;
607
+
608
+ declare const fileType_AVIF: typeof AVIF;
609
+ declare const fileType_BINARY_AND_MARKUP_TYPES: typeof BINARY_AND_MARKUP_TYPES;
610
+ declare const fileType_BMP: typeof BMP;
611
+ type fileType_DetectedType = DetectedType;
612
+ declare const fileType_EMPTY: typeof EMPTY;
613
+ declare const fileType_GIF: typeof GIF;
614
+ declare const fileType_HTML: typeof HTML;
615
+ declare const fileType_JPEG: typeof JPEG;
616
+ declare const fileType_PDF: typeof PDF;
617
+ declare const fileType_PNG: typeof PNG;
618
+ declare const fileType_RASTER_IMAGES: typeof RASTER_IMAGES;
619
+ declare const fileType_SNIFF_BYTES: typeof SNIFF_BYTES;
620
+ declare const fileType_SVG: typeof SVG;
621
+ declare const fileType_TEXT: typeof TEXT;
622
+ declare const fileType_UNKNOWN: typeof UNKNOWN;
623
+ declare const fileType_WEBP: typeof WEBP;
624
+ declare const fileType_XML: typeof XML;
625
+ declare const fileType_detectFileType: typeof detectFileType;
626
+ declare namespace fileType {
627
+ 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 };
628
+ }
629
+
630
+ export { Arr as A, Collection as C, type Facade as F, ItemNotFoundError as I, LazyCollection as L, MultipleItemsFoundError as M, type Operator as O, 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 };