@orieljs/framework 0.1.0-alpha.13 → 0.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6GMXKQ6O.js → chunk-4NCMY3ZS.js} +48 -2
- package/dist/chunk-4NCMY3ZS.js.map +1 -0
- package/dist/{chunk-CKH4KCYF.js → chunk-BKA5F3TH.js} +1 -1
- package/dist/{chunk-CKH4KCYF.js.map → chunk-BKA5F3TH.js.map} +1 -1
- package/dist/{chunk-OTCTQVDQ.js → chunk-UBSIBGXR.js} +233 -54
- package/dist/chunk-UBSIBGXR.js.map +1 -0
- package/dist/{chunk-ZRTWDJKD.js → chunk-X4N74JDO.js} +98 -4
- package/dist/chunk-X4N74JDO.js.map +1 -0
- package/dist/contracts.d.ts +4 -1
- package/dist/contracts.js +1 -1
- package/dist/{index.d-WQpfdIbG.d.ts → index.d-lffxurFs.d.ts} +10 -1
- package/dist/index.d.ts +121 -19
- package/dist/index.js +408 -183
- package/dist/index.js.map +1 -1
- package/dist/{jsx-runtime-6um4Mwfb.d.ts → jsx-runtime-Bc5KJzwb.d.ts} +1 -1
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +3 -3
- package/dist/{testing-B8NOiQC9.d.ts → testing-CVpo7aRl.d.ts} +41 -7
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +5 -3
- package/docs/authentication.md +40 -1
- package/docs/console.md +16 -5
- package/docs/database-testing.md +21 -0
- package/docs/database.md +12 -0
- package/docs/deployment.md +9 -2
- package/docs/encryption.md +2 -0
- package/docs/installation.md +2 -1
- package/docs/live-tests.md +20 -0
- package/docs/live.md +2 -0
- package/docs/pagination.md +10 -0
- package/docs/session.md +19 -2
- package/docs/starter-kits.md +4 -0
- package/docs/storage.md +21 -3
- package/docs/testing.md +9 -6
- package/docs/two-factor.md +10 -1
- package/docs/views.md +2 -0
- package/docs/vite.md +1 -1
- package/package.json +54 -38
- package/dist/chunk-6GMXKQ6O.js.map +0 -1
- package/dist/chunk-OTCTQVDQ.js.map +0 -1
- package/dist/chunk-ZRTWDJKD.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
renderToString,
|
|
23
23
|
styleString,
|
|
24
24
|
view
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-X4N74JDO.js";
|
|
26
26
|
import {
|
|
27
27
|
API_ROUTES_STUB,
|
|
28
28
|
Application as Application2,
|
|
@@ -84,6 +84,7 @@ import {
|
|
|
84
84
|
TrimStrings,
|
|
85
85
|
UPDATE_URI,
|
|
86
86
|
UPLOAD_URI,
|
|
87
|
+
UploadAlreadyStoredError,
|
|
87
88
|
UploadValidationError,
|
|
88
89
|
Vite,
|
|
89
90
|
ViteError,
|
|
@@ -149,7 +150,7 @@ import {
|
|
|
149
150
|
vite,
|
|
150
151
|
viteReactRefresh,
|
|
151
152
|
writeResponse
|
|
152
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-UBSIBGXR.js";
|
|
153
154
|
import {
|
|
154
155
|
Arr,
|
|
155
156
|
BindingResolutionError,
|
|
@@ -160,6 +161,7 @@ import {
|
|
|
160
161
|
ContainerNotAvailableError,
|
|
161
162
|
ItemNotFoundError,
|
|
162
163
|
LazyCollection,
|
|
164
|
+
MissingPackageError,
|
|
163
165
|
MultipleItemsFoundError,
|
|
164
166
|
ServiceProvider,
|
|
165
167
|
Str,
|
|
@@ -171,12 +173,13 @@ import {
|
|
|
171
173
|
currentContainer,
|
|
172
174
|
facade,
|
|
173
175
|
fileType_exports,
|
|
176
|
+
importOptional,
|
|
174
177
|
inject,
|
|
175
178
|
now,
|
|
176
179
|
retry,
|
|
177
180
|
tap,
|
|
178
181
|
value
|
|
179
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-4NCMY3ZS.js";
|
|
180
183
|
import {
|
|
181
184
|
Application,
|
|
182
185
|
AuthFactory,
|
|
@@ -218,25 +221,26 @@ import {
|
|
|
218
221
|
ValidationFactory,
|
|
219
222
|
ViewFactory,
|
|
220
223
|
token
|
|
221
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-BKA5F3TH.js";
|
|
222
225
|
|
|
223
226
|
// ../Auth/dist/index.js
|
|
224
227
|
import { createHash } from "crypto";
|
|
225
228
|
import { createHash as createHash2 } from "crypto";
|
|
226
229
|
import { timingSafeEqual } from "crypto";
|
|
227
230
|
import { createHash as createHash3 } from "crypto";
|
|
228
|
-
import { createHash as createHash4 } from "crypto";
|
|
229
231
|
import { createHmac } from "crypto";
|
|
232
|
+
import { createHash as createHash4 } from "crypto";
|
|
233
|
+
import { createHmac as createHmac2 } from "crypto";
|
|
230
234
|
import { readdir } from "fs/promises";
|
|
231
235
|
import { join } from "path";
|
|
232
236
|
import { pathToFileURL } from "url";
|
|
233
237
|
import { relative } from "path";
|
|
234
238
|
import { existsSync, mkdirSync, readdirSync, writeFileSync } from "fs";
|
|
235
239
|
import { join as join2 } from "path";
|
|
236
|
-
import { createHmac as
|
|
240
|
+
import { createHmac as createHmac4, randomBytes as randomBytes2, randomInt as randomInt2, timingSafeEqual as timingSafeEqual3 } from "crypto";
|
|
237
241
|
import { renderSVG } from "uqr";
|
|
238
242
|
import { randomInt } from "crypto";
|
|
239
|
-
import { createHmac as
|
|
243
|
+
import { createHmac as createHmac3, randomBytes, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
240
244
|
var AuthenticationError = class extends Error {
|
|
241
245
|
constructor(message = "Unauthenticated.", guards = [], redirectTo2) {
|
|
242
246
|
super(message);
|
|
@@ -249,6 +253,18 @@ var AuthenticationError = class extends Error {
|
|
|
249
253
|
status = 401;
|
|
250
254
|
name = "AuthenticationError";
|
|
251
255
|
};
|
|
256
|
+
var InvalidPasswordError = class extends Error {
|
|
257
|
+
name = "InvalidPasswordError";
|
|
258
|
+
constructor() {
|
|
259
|
+
super("The given password does not match the current password.");
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
var TwoFactorAppAlreadyEnabledError = class extends Error {
|
|
263
|
+
name = "TwoFactorAppAlreadyEnabledError";
|
|
264
|
+
constructor() {
|
|
265
|
+
super("This user's authenticator app is set up already. Call TwoFactor.disableApp(user) first to set up another.");
|
|
266
|
+
}
|
|
267
|
+
};
|
|
252
268
|
var AuthorizationError = class extends Error {
|
|
253
269
|
kind = "Authorization";
|
|
254
270
|
name = "AuthorizationError";
|
|
@@ -306,6 +322,22 @@ var Logout = class {
|
|
|
306
322
|
guard;
|
|
307
323
|
user;
|
|
308
324
|
};
|
|
325
|
+
var CurrentDeviceLogout = class {
|
|
326
|
+
constructor(guard2, user) {
|
|
327
|
+
this.guard = guard2;
|
|
328
|
+
this.user = user;
|
|
329
|
+
}
|
|
330
|
+
guard;
|
|
331
|
+
user;
|
|
332
|
+
};
|
|
333
|
+
var OtherDeviceLogout = class {
|
|
334
|
+
constructor(guard2, user) {
|
|
335
|
+
this.guard = guard2;
|
|
336
|
+
this.user = user;
|
|
337
|
+
}
|
|
338
|
+
guard;
|
|
339
|
+
user;
|
|
340
|
+
};
|
|
309
341
|
var PasswordReset = class {
|
|
310
342
|
constructor(user) {
|
|
311
343
|
this.user = user;
|
|
@@ -572,6 +604,13 @@ var EloquentUserProvider = class {
|
|
|
572
604
|
return this.model;
|
|
573
605
|
}
|
|
574
606
|
};
|
|
607
|
+
var passwordHashKey = (guard2) => `password_hash_${guard2}`;
|
|
608
|
+
function sessionPasswordHash(passwordHash, key) {
|
|
609
|
+
return createHmac("sha256", key).update(passwordHash).digest("hex");
|
|
610
|
+
}
|
|
611
|
+
function matchesSessionPasswordHash(passwordHash, stored, keys) {
|
|
612
|
+
return keys.some((key) => equals(sessionPasswordHash(passwordHash, key), stored));
|
|
613
|
+
}
|
|
575
614
|
var GUARD_HASH = createHash3("sha1").update("Oriel\\Auth\\SessionGuard").digest("hex");
|
|
576
615
|
var SessionGuard = class {
|
|
577
616
|
constructor(name, provider, container, options = {}) {
|
|
@@ -665,15 +704,74 @@ var SessionGuard = class {
|
|
|
665
704
|
/** Forgets the user, the session key and the remember cookie, and cycles the remember token. */
|
|
666
705
|
async logout() {
|
|
667
706
|
const user = await this.user();
|
|
668
|
-
this.#
|
|
669
|
-
const jar = this.#jar();
|
|
670
|
-
if (jar !== void 0 && this.#request()?.cookie(this.getRecallerName()) !== void 0) {
|
|
671
|
-
jar.queue(jar.forget(this.getRecallerName()));
|
|
672
|
-
}
|
|
707
|
+
this.#forget();
|
|
673
708
|
if (user !== void 0 && user.getRememberToken() !== void 0) await this.#cycleRememberToken(user);
|
|
674
709
|
await this.#dispatch(new Logout(this.name, user));
|
|
675
|
-
this.#
|
|
676
|
-
|
|
710
|
+
this.#signedOut();
|
|
711
|
+
}
|
|
712
|
+
/** Logs out here only: the remember token isn't cycled, so the user's other remembered devices keep working. */
|
|
713
|
+
async logoutCurrentDevice() {
|
|
714
|
+
const user = await this.user();
|
|
715
|
+
this.#forget();
|
|
716
|
+
await this.#dispatch(new CurrentDeviceLogout(this.name, user));
|
|
717
|
+
this.#signedOut();
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Ends the user's other sessions, on their next request through `auth.session`, by rehashing the password they gave.
|
|
721
|
+
* This session stays signed in, and so does this device's remember cookie. Undefined for a guest.
|
|
722
|
+
*/
|
|
723
|
+
async logoutOtherDevices(password) {
|
|
724
|
+
const user = await this.user();
|
|
725
|
+
if (user === void 0) return void 0;
|
|
726
|
+
if (!await this.container.make(Hasher).check(password, user.getAuthPassword())) throw new InvalidPasswordError();
|
|
727
|
+
const provider = this.provider;
|
|
728
|
+
if (provider.rehashPasswordIfRequired === void 0) throw new Error(`The [${this.name}] guard's user provider can't rehash a password.`);
|
|
729
|
+
await provider.rehashPasswordIfRequired(user, { password }, true);
|
|
730
|
+
this.keepPasswordHash();
|
|
731
|
+
const recaller = this.getRecallerName();
|
|
732
|
+
const mine = (value2) => value2?.split("|")[0] === String(user.getAuthIdentifier());
|
|
733
|
+
const remembered = mine(this.#request()?.cookie(recaller)) || this.#jar()?.queued().some((cookie2) => cookie2.name === recaller && mine(cookie2.value)) === true;
|
|
734
|
+
if (remembered) this.#queueRecallerCookie(user);
|
|
735
|
+
await this.#dispatch(new OtherDeviceLogout(this.name, user));
|
|
736
|
+
return user;
|
|
737
|
+
}
|
|
738
|
+
/** @internal Whether this request has a session: a cached page's route leaves StartSession out. */
|
|
739
|
+
hasStartedSession() {
|
|
740
|
+
const session2 = this.#session();
|
|
741
|
+
return session2 !== void 0 && (session2.isStarted?.() ?? true);
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* @internal For `auth.session`: whether the signed-in user's password is the one this session and this device's remember
|
|
745
|
+
* cookie were made with. A session with no stored hash stores one and carries on.
|
|
746
|
+
*/
|
|
747
|
+
passwordHashMatches() {
|
|
748
|
+
const user = this.#user;
|
|
749
|
+
if (user === void 0) return true;
|
|
750
|
+
if (this.#viaRemember) {
|
|
751
|
+
const remembered = this.#request()?.cookie(this.getRecallerName())?.split("|")[2];
|
|
752
|
+
if (remembered === void 0 || !equals(user.getAuthPassword(), remembered)) return false;
|
|
753
|
+
}
|
|
754
|
+
const stored = this.#session()?.get(passwordHashKey(this.name));
|
|
755
|
+
if (stored === void 0) {
|
|
756
|
+
this.keepPasswordHash();
|
|
757
|
+
return true;
|
|
758
|
+
}
|
|
759
|
+
return matchesSessionPasswordHash(user.getAuthPassword(), stored, this.#encryptionKeys());
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* @internal After a request: this session keeps the current password's hash, which covers a login and a new password,
|
|
763
|
+
* and `before` (the password the request began with) tells when this device's remember cookie needs the new one too.
|
|
764
|
+
*/
|
|
765
|
+
keepPasswordHash(before) {
|
|
766
|
+
const user = this.#user;
|
|
767
|
+
if (user === void 0) return;
|
|
768
|
+
const hash2 = user.getAuthPassword();
|
|
769
|
+
if (hash2 === "") return;
|
|
770
|
+
this.#session()?.put(passwordHashKey(this.name), sessionPasswordHash(hash2, this.#encryptionKeys()[0]));
|
|
771
|
+
const recaller = this.#request()?.cookie(this.getRecallerName());
|
|
772
|
+
if (before !== void 0 && before !== hash2 && recaller?.split("|")[0] === String(user.getAuthIdentifier())) {
|
|
773
|
+
this.#queueRecallerCookie(user);
|
|
774
|
+
}
|
|
677
775
|
}
|
|
678
776
|
hasUser() {
|
|
679
777
|
return this.#user !== void 0;
|
|
@@ -697,6 +795,23 @@ var SessionGuard = class {
|
|
|
697
795
|
getRecallerName() {
|
|
698
796
|
return `remember_${this.name}_${GUARD_HASH}`;
|
|
699
797
|
}
|
|
798
|
+
/** Forgets the session key and, when this request had one, the remember cookie. */
|
|
799
|
+
#forget() {
|
|
800
|
+
this.#session()?.forget(this.getName());
|
|
801
|
+
const jar = this.#jar();
|
|
802
|
+
if (jar !== void 0 && this.#request()?.cookie(this.getRecallerName()) !== void 0) {
|
|
803
|
+
jar.queue(jar.forget(this.getRecallerName()));
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
#signedOut() {
|
|
807
|
+
this.#user = void 0;
|
|
808
|
+
this.#loggedOut = true;
|
|
809
|
+
}
|
|
810
|
+
/** The app's keys, the current one first. */
|
|
811
|
+
#encryptionKeys() {
|
|
812
|
+
const encrypter = this.container.make(Encrypter);
|
|
813
|
+
return encrypter.getAllKeys?.() ?? [encrypter.getKey()];
|
|
814
|
+
}
|
|
700
815
|
async #hasValidCredentials(user, credentials) {
|
|
701
816
|
const valid = user !== void 0 && await this.provider.validateCredentials(user, credentials);
|
|
702
817
|
if (valid) await this.#dispatch(new Validated(this.name, user));
|
|
@@ -1065,6 +1180,14 @@ var AuthManager = class {
|
|
|
1065
1180
|
async logout() {
|
|
1066
1181
|
return this.#stateful().logout();
|
|
1067
1182
|
}
|
|
1183
|
+
/** Logs the default guard out on this device only (the remember token isn't cycled). */
|
|
1184
|
+
async logoutCurrentDevice() {
|
|
1185
|
+
return this.#deviceGuard().logoutCurrentDevice();
|
|
1186
|
+
}
|
|
1187
|
+
/** Ends the user's other sessions, on their next request through `auth.session`. This one stays signed in. */
|
|
1188
|
+
async logoutOtherDevices(password) {
|
|
1189
|
+
return this.#deviceGuard().logoutOtherDevices(password);
|
|
1190
|
+
}
|
|
1068
1191
|
viaRemember() {
|
|
1069
1192
|
const guard2 = this.guard();
|
|
1070
1193
|
return guard2.viaRemember?.() ?? false;
|
|
@@ -1127,6 +1250,13 @@ var AuthManager = class {
|
|
|
1127
1250
|
state.resolverInstalled = true;
|
|
1128
1251
|
container.make(HttpRequest).setUserResolver((guard2) => this.guardIn(container, guard2).user());
|
|
1129
1252
|
}
|
|
1253
|
+
#deviceGuard() {
|
|
1254
|
+
const guard2 = this.guard();
|
|
1255
|
+
if (typeof guard2.logoutOtherDevices !== "function") {
|
|
1256
|
+
throw new Error(`The [${guard2.name ?? this.#state(this.#container()).defaultGuard ?? this.getDefaultDriver()}] guard can't log out other devices.`);
|
|
1257
|
+
}
|
|
1258
|
+
return guard2;
|
|
1259
|
+
}
|
|
1130
1260
|
#stateful() {
|
|
1131
1261
|
const guard2 = this.guard();
|
|
1132
1262
|
if (typeof guard2.attempt !== "function") {
|
|
@@ -1476,7 +1606,7 @@ var DatabaseTokenRepository = class {
|
|
|
1476
1606
|
async create(user) {
|
|
1477
1607
|
const email = user.getEmailForPasswordReset();
|
|
1478
1608
|
await this.#query().where("email", email).delete();
|
|
1479
|
-
const token2 =
|
|
1609
|
+
const token2 = createHmac2("sha256", this.hashKey).update(Str.random(40)).digest("hex");
|
|
1480
1610
|
await this.#query().insert({ email, token: await this.hasher.make(token2), created_at: this.clock() });
|
|
1481
1611
|
return token2;
|
|
1482
1612
|
}
|
|
@@ -1591,6 +1721,11 @@ var PasswordBrokerManager = class {
|
|
|
1591
1721
|
return new PasswordBroker2(tokens, auth2.createUserProvider(settings.provider));
|
|
1592
1722
|
}
|
|
1593
1723
|
};
|
|
1724
|
+
function guestRedirect(request2, config2) {
|
|
1725
|
+
const target = config2.get("http.redirect_guests_to");
|
|
1726
|
+
if (typeof target === "function") return String(target(request2));
|
|
1727
|
+
return typeof target === "string" && target !== "" ? target : void 0;
|
|
1728
|
+
}
|
|
1594
1729
|
var Authenticate = class {
|
|
1595
1730
|
auth = inject(AuthFactory);
|
|
1596
1731
|
config = inject(ConfigRepository);
|
|
@@ -1612,9 +1747,25 @@ var Authenticate = class {
|
|
|
1612
1747
|
}
|
|
1613
1748
|
/** config('http.redirect_guests_to') (set by withMiddleware(m => m.redirectGuestsTo(...))); Http falls back to route('login'). */
|
|
1614
1749
|
redirectTo(request2) {
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1750
|
+
return guestRedirect(request2, this.config);
|
|
1751
|
+
}
|
|
1752
|
+
};
|
|
1753
|
+
var AuthenticateSession = class {
|
|
1754
|
+
auth = inject(AuthFactory);
|
|
1755
|
+
config = inject(ConfigRepository);
|
|
1756
|
+
async handle(request2, next) {
|
|
1757
|
+
const guard2 = this.auth.guard();
|
|
1758
|
+
if (guard2.hasStartedSession?.() !== true) return next(request2);
|
|
1759
|
+
const session2 = guard2;
|
|
1760
|
+
const before = (await session2.user())?.getAuthPassword();
|
|
1761
|
+
if (before !== void 0 && before !== "" && !session2.passwordHashMatches()) {
|
|
1762
|
+
await session2.logoutCurrentDevice();
|
|
1763
|
+
inject(Session).flush();
|
|
1764
|
+
throw new AuthenticationError("Unauthenticated.", [session2.name], request2.expectsJson() ? void 0 : guestRedirect(request2, this.config));
|
|
1765
|
+
}
|
|
1766
|
+
const response2 = await next(request2);
|
|
1767
|
+
session2.keepPasswordHash(before);
|
|
1768
|
+
return response2;
|
|
1618
1769
|
}
|
|
1619
1770
|
};
|
|
1620
1771
|
async function redirectTo(container, request2, url2, guest = false) {
|
|
@@ -1907,7 +2058,7 @@ function generateSecret() {
|
|
|
1907
2058
|
function totpCode(secret, at, step = Math.floor(at / 1e3 / STEP_SECONDS)) {
|
|
1908
2059
|
const counter = Buffer.alloc(8);
|
|
1909
2060
|
counter.writeBigUInt64BE(BigInt(step));
|
|
1910
|
-
const hmac =
|
|
2061
|
+
const hmac = createHmac3("sha1", base32Decode(secret)).update(counter).digest();
|
|
1911
2062
|
const offset = hmac[hmac.length - 1] & 15;
|
|
1912
2063
|
const binary = (hmac[offset] & 127) << 24 | hmac[offset + 1] << 16 | hmac[offset + 2] << 8 | hmac[offset + 3];
|
|
1913
2064
|
return String(binary % 1e6).padStart(6, "0");
|
|
@@ -2018,15 +2169,21 @@ var TwoFactorManager = class {
|
|
|
2018
2169
|
}
|
|
2019
2170
|
/**
|
|
2020
2171
|
* Starts setting up an authenticator app: a new secret (unconfirmed, so it doesn't count yet), the `otpauth://` URL
|
|
2021
|
-
* and a QR code of it for the app to scan.
|
|
2172
|
+
* and a QR code of it for the app to scan. A user whose app already works must disableApp() first: a new secret would
|
|
2173
|
+
* stop the old app's codes without a word.
|
|
2022
2174
|
*/
|
|
2023
2175
|
async enableApp(user) {
|
|
2176
|
+
if (this.#store().hasApp(user)) throw new TwoFactorAppAlreadyEnabledError();
|
|
2024
2177
|
const secret = generateSecret();
|
|
2025
2178
|
await this.#store().setSecret(user, secret);
|
|
2026
2179
|
const issuer = this.#config().issuer ?? inject(ConfigRepository).get("app.name", "Oriel");
|
|
2027
2180
|
const url2 = otpauthUrl({ secret, issuer, account: String(user.getAttribute("email") ?? user.getAuthIdentifier()) });
|
|
2028
2181
|
return { secret, url: url2, svg: qrSvg(url2) };
|
|
2029
2182
|
}
|
|
2183
|
+
/** Whether the user's authenticator app works: set up and confirmed. */
|
|
2184
|
+
hasApp(user) {
|
|
2185
|
+
return this.#store().hasApp(user);
|
|
2186
|
+
}
|
|
2030
2187
|
/** Confirms the app with a code from it: then it counts, becomes the user's method, and recovery codes are made. */
|
|
2031
2188
|
async confirmApp(user, code) {
|
|
2032
2189
|
const store = this.#store();
|
|
@@ -2093,7 +2250,7 @@ var TwoFactorManager = class {
|
|
|
2093
2250
|
await inject(CacheManager).forget(pendingKey(record.nonce));
|
|
2094
2251
|
}
|
|
2095
2252
|
#hash(code) {
|
|
2096
|
-
return
|
|
2253
|
+
return createHmac4("sha256", inject(Encrypter).getKey()).update(code).digest("hex");
|
|
2097
2254
|
}
|
|
2098
2255
|
async #sendCode(user) {
|
|
2099
2256
|
const config2 = this.#config();
|
|
@@ -2165,7 +2322,7 @@ var AuthServiceProvider = class extends ServiceProvider {
|
|
|
2165
2322
|
}
|
|
2166
2323
|
async boot() {
|
|
2167
2324
|
if (this.app.bound(Router)) {
|
|
2168
|
-
this.app.make(Router).aliasMiddleware("auth", Authenticate).aliasMiddleware("guest", RedirectIfAuthenticated).aliasMiddleware("can", Authorize).aliasMiddleware("verified", EnsureEmailIsVerified).aliasMiddleware("two-factor.challenge", TwoFactorChallenge);
|
|
2325
|
+
this.app.make(Router).aliasMiddleware("auth", Authenticate).aliasMiddleware("auth.session", AuthenticateSession).aliasMiddleware("guest", RedirectIfAuthenticated).aliasMiddleware("can", Authorize).aliasMiddleware("verified", EnsureEmailIsVerified).aliasMiddleware("two-factor.challenge", TwoFactorChallenge);
|
|
2169
2326
|
}
|
|
2170
2327
|
if (this.app.bound(EventDispatcher)) this.app.make(EventDispatcher).listen(Registered, SendEmailVerificationNotification);
|
|
2171
2328
|
await discoverPolicies(this.app.appPath("Policies"), this.app.make(Gate));
|
|
@@ -2445,9 +2602,9 @@ var Dispatcher = class {
|
|
|
2445
2602
|
}
|
|
2446
2603
|
#afterResponseList() {
|
|
2447
2604
|
const owner = currentContainer() ?? this.container;
|
|
2448
|
-
let
|
|
2449
|
-
if (
|
|
2450
|
-
return
|
|
2605
|
+
let list5 = this.#afterResponse.get(owner);
|
|
2606
|
+
if (list5 === void 0) this.#afterResponse.set(owner, list5 = []);
|
|
2607
|
+
return list5;
|
|
2451
2608
|
}
|
|
2452
2609
|
/** Runs the job (like dispatchSync) after the response is sent, or after the current queued job. */
|
|
2453
2610
|
dispatchAfterResponse(job) {
|
|
@@ -3488,8 +3645,8 @@ var RedisRepository = class extends Repository2 {
|
|
|
3488
3645
|
return quit;
|
|
3489
3646
|
}
|
|
3490
3647
|
tags(names) {
|
|
3491
|
-
const
|
|
3492
|
-
const taggedStore = this.redisStore.tags(
|
|
3648
|
+
const list5 = Array.isArray(names) ? names : [names];
|
|
3649
|
+
const taggedStore = this.redisStore.tags(list5);
|
|
3493
3650
|
const prefix = this.redisStore.getPrefix();
|
|
3494
3651
|
return new Repository2(taggedStore, (_store, name, seconds, owner) => new RedisLock(this.redis, prefix + name, seconds, owner));
|
|
3495
3652
|
}
|
|
@@ -3706,6 +3863,7 @@ var CacheServiceProvider = class extends ServiceProvider {
|
|
|
3706
3863
|
};
|
|
3707
3864
|
|
|
3708
3865
|
// ../Console/dist/index.js
|
|
3866
|
+
import { Writable } from "stream";
|
|
3709
3867
|
import { existsSync as existsSync2 } from "fs";
|
|
3710
3868
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
|
|
3711
3869
|
import { dirname as dirname2, join as join4, relative as relative2, sep } from "path";
|
|
@@ -3741,6 +3899,12 @@ var ScheduleNameRequiredError = class extends Error {
|
|
|
3741
3899
|
super(`A scheduled event name is required to prevent overlapping. Use the 'name' method before '${method}'.`);
|
|
3742
3900
|
}
|
|
3743
3901
|
};
|
|
3902
|
+
var ConsoleAbortedError = class extends Error {
|
|
3903
|
+
name = "ConsoleAbortedError";
|
|
3904
|
+
constructor() {
|
|
3905
|
+
super("Aborted.");
|
|
3906
|
+
}
|
|
3907
|
+
};
|
|
3744
3908
|
var NodeConsoleOutput = class {
|
|
3745
3909
|
write(text4) {
|
|
3746
3910
|
process.stdout.write(text4);
|
|
@@ -3779,18 +3943,32 @@ var NodeConsoleInput = class {
|
|
|
3779
3943
|
lines = [];
|
|
3780
3944
|
waiting = [];
|
|
3781
3945
|
ended = false;
|
|
3782
|
-
|
|
3946
|
+
muted = false;
|
|
3947
|
+
async question(prompt, options = {}) {
|
|
3783
3948
|
const rl = await this.open();
|
|
3949
|
+
const hide = options.hidden === true && this.isTerminal() && !this.ended;
|
|
3784
3950
|
if (this.ended) {
|
|
3785
3951
|
this.output.write(prompt);
|
|
3952
|
+
} else if (hide) {
|
|
3953
|
+
this.output.write(prompt);
|
|
3954
|
+
this.muted = true;
|
|
3955
|
+
rl.setPrompt("");
|
|
3956
|
+
rl.prompt();
|
|
3786
3957
|
} else {
|
|
3787
3958
|
rl.setPrompt(prompt);
|
|
3788
3959
|
rl.prompt();
|
|
3789
3960
|
}
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3961
|
+
try {
|
|
3962
|
+
const line = this.lines.shift();
|
|
3963
|
+
if (line !== void 0) return line;
|
|
3964
|
+
if (this.ended) throw new ConsoleAbortedError();
|
|
3965
|
+
return await new Promise((resolve5, reject) => this.waiting.push({ resolve: resolve5, reject }));
|
|
3966
|
+
} finally {
|
|
3967
|
+
if (hide) {
|
|
3968
|
+
this.muted = false;
|
|
3969
|
+
this.output.write("\n");
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3794
3972
|
}
|
|
3795
3973
|
close() {
|
|
3796
3974
|
const rl = this.rl;
|
|
@@ -3803,7 +3981,8 @@ var NodeConsoleInput = class {
|
|
|
3803
3981
|
if (this.rl) return this.rl;
|
|
3804
3982
|
const { createInterface } = await import("readline");
|
|
3805
3983
|
if (this.rl) return this.rl;
|
|
3806
|
-
const rl = createInterface({ input: this.input, output: this.
|
|
3984
|
+
const rl = createInterface({ input: this.input, output: this.screen(), terminal: this.isTerminal(), historySize: 0 });
|
|
3985
|
+
rl.on("SIGINT", () => rl.close());
|
|
3807
3986
|
rl.on("line", (line) => {
|
|
3808
3987
|
const next = this.waiting.shift();
|
|
3809
3988
|
if (next) next.resolve(line);
|
|
@@ -3812,18 +3991,32 @@ var NodeConsoleInput = class {
|
|
|
3812
3991
|
rl.on("close", () => {
|
|
3813
3992
|
if (this.rl !== rl) return;
|
|
3814
3993
|
this.ended = true;
|
|
3815
|
-
for (const { reject } of this.waiting.splice(0)) reject(new
|
|
3994
|
+
for (const { reject } of this.waiting.splice(0)) reject(new ConsoleAbortedError());
|
|
3816
3995
|
});
|
|
3817
3996
|
this.rl = rl;
|
|
3818
3997
|
return rl;
|
|
3819
3998
|
}
|
|
3999
|
+
isTerminal() {
|
|
4000
|
+
return this.input.isTTY === true;
|
|
4001
|
+
}
|
|
4002
|
+
/** What readline writes to: the real output, unless muted, with the width it wraps long lines at. */
|
|
4003
|
+
screen() {
|
|
4004
|
+
const screen = new Writable({
|
|
4005
|
+
write: (chunk, _encoding, done) => {
|
|
4006
|
+
if (!this.muted) this.output.write(chunk);
|
|
4007
|
+
done();
|
|
4008
|
+
}
|
|
4009
|
+
});
|
|
4010
|
+
Object.defineProperty(screen, "columns", { get: () => this.output.columns });
|
|
4011
|
+
return screen;
|
|
4012
|
+
}
|
|
3820
4013
|
};
|
|
3821
4014
|
var QueuedConsoleInput = class {
|
|
3822
4015
|
queue;
|
|
3823
4016
|
constructor(answers = []) {
|
|
3824
4017
|
this.queue = [...answers];
|
|
3825
4018
|
}
|
|
3826
|
-
async question(_prompt) {
|
|
4019
|
+
async question(_prompt, _options) {
|
|
3827
4020
|
if (this.queue.length === 0) throw new Error("QueuedConsoleInput ran out of answers.");
|
|
3828
4021
|
return this.queue.shift();
|
|
3829
4022
|
}
|
|
@@ -3892,9 +4085,9 @@ var Command = class {
|
|
|
3892
4085
|
const answer = (await this.consoleInput.question(`${question}${suffix2}: `)).trim();
|
|
3893
4086
|
return answer === "" && defaultValue !== void 0 ? defaultValue : answer;
|
|
3894
4087
|
}
|
|
3895
|
-
/**
|
|
4088
|
+
/** Asks without showing what's typed, in a terminal. Unlike ask(), the answer isn't trimmed: a secret may start or end with a space. */
|
|
3896
4089
|
async secret(question) {
|
|
3897
|
-
return this.
|
|
4090
|
+
return this.consoleInput.question(`${question}: `, { hidden: true });
|
|
3898
4091
|
}
|
|
3899
4092
|
async confirm(question, defaultValue = false) {
|
|
3900
4093
|
const hint = defaultValue ? "Y/n" : "y/N";
|
|
@@ -5263,11 +5456,13 @@ var ScheduleWorkCommand = class extends Command {
|
|
|
5263
5456
|
};
|
|
5264
5457
|
var defaultSpawner = (command, args) => spawn(command, args, { stdio: "inherit", shell: process.platform === "win32" });
|
|
5265
5458
|
var TestCommand = class extends Command {
|
|
5266
|
-
constructor(spawner = defaultSpawner) {
|
|
5459
|
+
constructor(spawner = defaultSpawner, onBun = () => typeof process.versions.bun === "string") {
|
|
5267
5460
|
super();
|
|
5268
5461
|
this.spawner = spawner;
|
|
5462
|
+
this.onBun = onBun;
|
|
5269
5463
|
}
|
|
5270
5464
|
spawner;
|
|
5465
|
+
onBun;
|
|
5271
5466
|
/** Paths are passed on to vitest; so is everything after `--` (`oriel test -- --coverage`). */
|
|
5272
5467
|
signature = "test {args?*} {--filter=}";
|
|
5273
5468
|
description = "Run the test suite";
|
|
@@ -5278,7 +5473,7 @@ var TestCommand = class extends Command {
|
|
|
5278
5473
|
const extra = this.argument("args");
|
|
5279
5474
|
if (Array.isArray(extra)) args.push(...extra);
|
|
5280
5475
|
return new Promise((resolve5) => {
|
|
5281
|
-
const child = this.spawner("npx", args);
|
|
5476
|
+
const child = this.onBun() ? this.spawner("bun", ["--bun", ...args]) : this.spawner("npx", args);
|
|
5282
5477
|
child.on("error", (error) => {
|
|
5283
5478
|
this.error(error.message);
|
|
5284
5479
|
resolve5(1);
|
|
@@ -5322,8 +5517,8 @@ async function discoverCommands(kernel, directory) {
|
|
|
5322
5517
|
if (typeof exported !== "function") continue;
|
|
5323
5518
|
const prototype = exported.prototype;
|
|
5324
5519
|
if (typeof prototype?.handle !== "function") continue;
|
|
5325
|
-
const
|
|
5326
|
-
if (typeof
|
|
5520
|
+
const commandClass = exported;
|
|
5521
|
+
if (typeof new commandClass().signature === "string") kernel.register(commandClass);
|
|
5327
5522
|
}
|
|
5328
5523
|
}
|
|
5329
5524
|
}
|
|
@@ -5404,6 +5599,8 @@ var Kernel2 = class {
|
|
|
5404
5599
|
defaultInput;
|
|
5405
5600
|
defaultOutput;
|
|
5406
5601
|
lastOutput = "";
|
|
5602
|
+
/** The classes of the commands registered as classes: each run makes a new one. */
|
|
5603
|
+
classes = /* @__PURE__ */ new Map();
|
|
5407
5604
|
running = 0;
|
|
5408
5605
|
loader;
|
|
5409
5606
|
bootstrapping;
|
|
@@ -5419,6 +5616,8 @@ var Kernel2 = class {
|
|
|
5419
5616
|
const instance = typeof entry === "function" ? new entry() : entry;
|
|
5420
5617
|
const name = parseSignature(instance.signature).name;
|
|
5421
5618
|
this.commands.set(name, instance);
|
|
5619
|
+
if (typeof entry === "function") this.classes.set(name, entry);
|
|
5620
|
+
else this.classes.delete(name);
|
|
5422
5621
|
}
|
|
5423
5622
|
}
|
|
5424
5623
|
command(signature, handler3) {
|
|
@@ -5432,9 +5631,9 @@ var Kernel2 = class {
|
|
|
5432
5631
|
output() {
|
|
5433
5632
|
return this.lastOutput;
|
|
5434
5633
|
}
|
|
5435
|
-
async call(command, parameters = {}) {
|
|
5634
|
+
async call(command, parameters = {}, options = {}) {
|
|
5436
5635
|
const output = new BufferedConsoleOutput();
|
|
5437
|
-
const code = await this.callWithIo(command, parameters, { input: new QueuedConsoleInput(), output });
|
|
5636
|
+
const code = await this.callWithIo(command, parameters, { input: new QueuedConsoleInput(options.answers), output });
|
|
5438
5637
|
this.lastOutput = output.combined;
|
|
5439
5638
|
return code;
|
|
5440
5639
|
}
|
|
@@ -5460,6 +5659,11 @@ var Kernel2 = class {
|
|
|
5460
5659
|
}
|
|
5461
5660
|
}
|
|
5462
5661
|
reportTopLevelError(error, output) {
|
|
5662
|
+
if (error instanceof ConsoleAbortedError) {
|
|
5663
|
+
output.writeError(`${error.message}
|
|
5664
|
+
`);
|
|
5665
|
+
return 130;
|
|
5666
|
+
}
|
|
5463
5667
|
if (error instanceof CommandNotFoundError) {
|
|
5464
5668
|
output.writeError(`${error.message}
|
|
5465
5669
|
`);
|
|
@@ -5498,11 +5702,12 @@ var Kernel2 = class {
|
|
|
5498
5702
|
}
|
|
5499
5703
|
async execute(instance, signature, input, io) {
|
|
5500
5704
|
validateRequiredArguments(signature, input);
|
|
5501
|
-
const run = Object.create(instance);
|
|
5502
|
-
run.bind?.(resolveArguments(signature, input), resolveOptions(signature, input), io);
|
|
5503
5705
|
const scope = this.app.createScope();
|
|
5504
5706
|
scope.instance(ConsoleKernel, this);
|
|
5505
5707
|
return scope.run(async () => {
|
|
5708
|
+
const CommandClass = this.classes.get(signature.name);
|
|
5709
|
+
const run = CommandClass === void 0 ? Object.create(instance) : new CommandClass();
|
|
5710
|
+
run.bind?.(resolveArguments(signature, input), resolveOptions(signature, input), io);
|
|
5506
5711
|
try {
|
|
5507
5712
|
const result = await run.handle();
|
|
5508
5713
|
return typeof result === "number" ? result : 0;
|
|
@@ -6065,7 +6270,7 @@ async function runConsoleAndExit(app2, argv = process.argv.slice(2), exit = (cod
|
|
|
6065
6270
|
}
|
|
6066
6271
|
|
|
6067
6272
|
// ../Cookie/dist/index.js
|
|
6068
|
-
import { createHmac as
|
|
6273
|
+
import { createHmac as createHmac5, timingSafeEqual as timingSafeEqual4 } from "crypto";
|
|
6069
6274
|
var SAME_SITE = { lax: "Lax", strict: "Strict", none: "None" };
|
|
6070
6275
|
function serializeCookie(cookie2, now5 = Date.now()) {
|
|
6071
6276
|
const parts = [];
|
|
@@ -6119,7 +6324,7 @@ function withHeaders(response2, change) {
|
|
|
6119
6324
|
}
|
|
6120
6325
|
var CookieValuePrefix = {
|
|
6121
6326
|
create(name, key) {
|
|
6122
|
-
return `${
|
|
6327
|
+
return `${createHmac5("sha1", key).update(`${name}v2`).digest("hex")}|`;
|
|
6123
6328
|
},
|
|
6124
6329
|
remove(value2) {
|
|
6125
6330
|
return value2.slice(41);
|
|
@@ -6219,7 +6424,11 @@ var EncryptCookies = class {
|
|
|
6219
6424
|
}
|
|
6220
6425
|
/** Subclasses list cookie names that are not encrypted. */
|
|
6221
6426
|
except = [];
|
|
6222
|
-
encrypter
|
|
6427
|
+
#encrypter;
|
|
6428
|
+
/** Resolved when there's a cookie to read or write, so a page that uses none works without APP_KEY. */
|
|
6429
|
+
get encrypter() {
|
|
6430
|
+
return this.#encrypter ??= inject(Encrypter);
|
|
6431
|
+
}
|
|
6223
6432
|
isDisabled(name) {
|
|
6224
6433
|
return this.except.includes(name) || neverEncrypt.has(name);
|
|
6225
6434
|
}
|
|
@@ -6228,7 +6437,6 @@ var EncryptCookies = class {
|
|
|
6228
6437
|
return this.encrypt(await next(request2));
|
|
6229
6438
|
}
|
|
6230
6439
|
decrypt(request2) {
|
|
6231
|
-
const keys = this.encrypter.getAllKeys?.() ?? [this.encrypter.getKey()];
|
|
6232
6440
|
const decrypted = {};
|
|
6233
6441
|
for (const [name, value2] of Object.entries(parseCookieHeader(request2.header("cookie")))) {
|
|
6234
6442
|
if (this.isDisabled(name)) {
|
|
@@ -6236,6 +6444,7 @@ var EncryptCookies = class {
|
|
|
6236
6444
|
continue;
|
|
6237
6445
|
}
|
|
6238
6446
|
try {
|
|
6447
|
+
const keys = this.encrypter.getAllKeys?.() ?? [this.encrypter.getKey()];
|
|
6239
6448
|
const plain2 = CookieValuePrefix.validate(name, this.encrypter.decrypt(value2, false), keys);
|
|
6240
6449
|
if (plain2 !== void 0) decrypted[name] = plain2;
|
|
6241
6450
|
} catch {
|
|
@@ -6424,9 +6633,11 @@ async function openSqlite(filename) {
|
|
|
6424
6633
|
/* @vite-ignore */
|
|
6425
6634
|
specifier
|
|
6426
6635
|
);
|
|
6427
|
-
|
|
6636
|
+
const database = new Database2(filename);
|
|
6637
|
+
database.prepare("PRAGMA busy_timeout = 5000").run();
|
|
6638
|
+
return new BunSqliteDatabase(database);
|
|
6428
6639
|
}
|
|
6429
|
-
const { default: Database } = await import("better-sqlite3");
|
|
6640
|
+
const { default: Database } = await importOptional("better-sqlite3", "The sqlite connection", () => import("better-sqlite3"));
|
|
6430
6641
|
return new Database(filename);
|
|
6431
6642
|
}
|
|
6432
6643
|
var PG_INT8 = 20;
|
|
@@ -6486,7 +6697,7 @@ function createDialect(config2) {
|
|
|
6486
6697
|
case "pgsql":
|
|
6487
6698
|
return new PostgresDialect({
|
|
6488
6699
|
pool: async () => {
|
|
6489
|
-
const { default: pg } = await import("pg");
|
|
6700
|
+
const { default: pg } = await importOptional("pg", "The pgsql connection", () => import("pg"));
|
|
6490
6701
|
return new pg.Pool({
|
|
6491
6702
|
connectionString: config2.url,
|
|
6492
6703
|
host: config2.host,
|
|
@@ -6514,7 +6725,7 @@ function createDialect(config2) {
|
|
|
6514
6725
|
case "mysql":
|
|
6515
6726
|
return new MysqlDialect({
|
|
6516
6727
|
pool: async () => {
|
|
6517
|
-
const { createPool } = await import("mysql2");
|
|
6728
|
+
const { createPool } = await importOptional("mysql2", "The mysql connection", () => import("mysql2"));
|
|
6518
6729
|
return createPool(mysqlPoolOptions(config2));
|
|
6519
6730
|
}
|
|
6520
6731
|
});
|
|
@@ -7820,15 +8031,15 @@ var Builder = class _Builder {
|
|
|
7820
8031
|
return [...this.connection.compile(this.grammar.compileSelect(this)).parameters];
|
|
7821
8032
|
}
|
|
7822
8033
|
clone() {
|
|
7823
|
-
const
|
|
7824
|
-
Object.assign(
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
return
|
|
8034
|
+
const copy = Object.create(Object.getPrototypeOf(this));
|
|
8035
|
+
Object.assign(copy, this);
|
|
8036
|
+
copy.columns = [...this.columns];
|
|
8037
|
+
copy.joins = [...this.joins];
|
|
8038
|
+
copy.wheres = [...this.wheres];
|
|
8039
|
+
copy.groups = [...this.groups];
|
|
8040
|
+
copy.havings = [...this.havings];
|
|
8041
|
+
copy.orders = [...this.orders];
|
|
8042
|
+
return copy;
|
|
7832
8043
|
}
|
|
7833
8044
|
/** A fresh builder on the same connection and table (for nested where groups). */
|
|
7834
8045
|
newQuery() {
|
|
@@ -10134,12 +10345,12 @@ var Builder2 = class extends Builder {
|
|
|
10134
10345
|
return Builder.prototype.getBindings.call(this.applyScopes());
|
|
10135
10346
|
}
|
|
10136
10347
|
clone() {
|
|
10137
|
-
const
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
return new Proxy(
|
|
10348
|
+
const copy = super.clone();
|
|
10349
|
+
copy.scopes = new Map(this.scopes);
|
|
10350
|
+
copy.removedScopes = [...this.removedScopes];
|
|
10351
|
+
copy.eagerLoad = new Map(this.eagerLoad);
|
|
10352
|
+
copy.selectCasts = { ...this.selectCasts };
|
|
10353
|
+
return new Proxy(copy, handler);
|
|
10143
10354
|
}
|
|
10144
10355
|
/** Nested where groups get a builder of the same model (without global scopes), so local scopes work inside them. */
|
|
10145
10356
|
newQuery() {
|
|
@@ -10449,11 +10660,11 @@ var EloquentCollection = class extends Collection {
|
|
|
10449
10660
|
};
|
|
10450
10661
|
async function loadMissingOn(models, paths) {
|
|
10451
10662
|
for (const path of paths) {
|
|
10452
|
-
const [
|
|
10453
|
-
const missing = models.filter((model) => !model.relationLoaded(
|
|
10663
|
+
const [head = "", ...rest] = path.split(".");
|
|
10664
|
+
const missing = models.filter((model) => !model.relationLoaded(head));
|
|
10454
10665
|
if (missing.length) await missing[0].newQueryWithoutRelationships().with(path).eagerLoadRelations(missing);
|
|
10455
10666
|
if (!rest.length) continue;
|
|
10456
|
-
const related = models.flatMap((model) => relatedModels(model.getRelations()[
|
|
10667
|
+
const related = models.flatMap((model) => relatedModels(model.getRelations()[head]));
|
|
10457
10668
|
if (related.length) await loadMissingOn(related, [rest.join(".")]);
|
|
10458
10669
|
}
|
|
10459
10670
|
}
|
|
@@ -11158,9 +11369,9 @@ var Factory2 = class _Factory {
|
|
|
11158
11369
|
return new Collection(created);
|
|
11159
11370
|
}
|
|
11160
11371
|
newInstance(changes) {
|
|
11161
|
-
const
|
|
11162
|
-
Object.assign(
|
|
11163
|
-
return
|
|
11372
|
+
const copy = Object.create(Object.getPrototypeOf(this));
|
|
11373
|
+
Object.assign(copy, this, changes);
|
|
11374
|
+
return copy;
|
|
11164
11375
|
}
|
|
11165
11376
|
async makeModels(attributes) {
|
|
11166
11377
|
const models = [];
|
|
@@ -14015,7 +14226,7 @@ var DatabaseServiceProvider = class extends ServiceProvider {
|
|
|
14015
14226
|
};
|
|
14016
14227
|
|
|
14017
14228
|
// ../Encryption/dist/index.js
|
|
14018
|
-
import { createCipheriv, createDecipheriv, createHmac as
|
|
14229
|
+
import { createCipheriv, createDecipheriv, createHmac as createHmac6, randomBytes as randomBytes3, timingSafeEqual as timingSafeEqual5 } from "crypto";
|
|
14019
14230
|
import { readFile as readFile2, writeFile as writeFile4 } from "fs/promises";
|
|
14020
14231
|
var EncryptionFailure = class extends Error {
|
|
14021
14232
|
kind = "Server";
|
|
@@ -14147,7 +14358,7 @@ var Encrypter2 = class _Encrypter {
|
|
|
14147
14358
|
return this;
|
|
14148
14359
|
}
|
|
14149
14360
|
#hash(iv, value2, key) {
|
|
14150
|
-
return
|
|
14361
|
+
return createHmac6("sha256", key).update(iv + value2).digest("hex");
|
|
14151
14362
|
}
|
|
14152
14363
|
#decryptWith(key, iv, value2, tag) {
|
|
14153
14364
|
try {
|
|
@@ -14227,8 +14438,8 @@ function decrypt(payload, unserialize = true) {
|
|
|
14227
14438
|
return inject(Encrypter).decrypt(payload, unserialize);
|
|
14228
14439
|
}
|
|
14229
14440
|
function previousKeys(value2) {
|
|
14230
|
-
const
|
|
14231
|
-
return
|
|
14441
|
+
const list5 = Array.isArray(value2) ? value2 : typeof value2 === "string" ? value2.split(",") : [];
|
|
14442
|
+
return list5.map((key) => String(key).trim()).filter((key) => key !== "");
|
|
14232
14443
|
}
|
|
14233
14444
|
var EncryptionServiceProvider = class extends ServiceProvider {
|
|
14234
14445
|
register() {
|
|
@@ -14431,9 +14642,9 @@ var Dispatcher2 = class {
|
|
|
14431
14642
|
throw new InvalidListenerError(label);
|
|
14432
14643
|
}
|
|
14433
14644
|
for (const event2 of Array.isArray(events) ? events : [events]) {
|
|
14434
|
-
const
|
|
14435
|
-
|
|
14436
|
-
this.listeners.set(event2,
|
|
14645
|
+
const list5 = this.listeners.get(event2) ?? [];
|
|
14646
|
+
list5.push(listener);
|
|
14647
|
+
this.listeners.set(event2, list5);
|
|
14437
14648
|
}
|
|
14438
14649
|
}
|
|
14439
14650
|
hasListeners(event2) {
|
|
@@ -14445,12 +14656,12 @@ var Dispatcher2 = class {
|
|
|
14445
14656
|
}
|
|
14446
14657
|
/** Laravel's getRawListeners(): each event's listeners as registered (closures, classes, [class, method]). A copy. */
|
|
14447
14658
|
getRawListeners() {
|
|
14448
|
-
return new Map([...this.listeners].map(([event2,
|
|
14659
|
+
return new Map([...this.listeners].map(([event2, list5]) => [event2, [...list5]]));
|
|
14449
14660
|
}
|
|
14450
14661
|
/** Introspection for the event:list command. Not part of the EventDispatcher contract. */
|
|
14451
14662
|
registeredEvents() {
|
|
14452
14663
|
const rows = [];
|
|
14453
|
-
for (const [key,
|
|
14664
|
+
for (const [key, list5] of this.listeners) rows.push({ event: nameOf(key), listeners: list5.length });
|
|
14454
14665
|
return rows.sort((a, b) => a.event.localeCompare(b.event));
|
|
14455
14666
|
}
|
|
14456
14667
|
subscribe(subscriber) {
|
|
@@ -14494,8 +14705,8 @@ var Dispatcher2 = class {
|
|
|
14494
14705
|
const exact = [...this.listeners.get(key) ?? []];
|
|
14495
14706
|
const wildcardLists = typeof key === "string" ? this.wildcardPatternsFor(key).map((pattern) => [...this.listeners.get(pattern) ?? []]) : [];
|
|
14496
14707
|
for (const listener of exact) yield { listener, wildcard: false };
|
|
14497
|
-
for (const
|
|
14498
|
-
for (const listener of
|
|
14708
|
+
for (const list5 of wildcardLists) {
|
|
14709
|
+
for (const listener of list5) yield { listener, wildcard: true };
|
|
14499
14710
|
}
|
|
14500
14711
|
}
|
|
14501
14712
|
wildcardPatternsFor(event2) {
|
|
@@ -14577,7 +14788,6 @@ var EventServiceProvider = class extends ServiceProvider {
|
|
|
14577
14788
|
};
|
|
14578
14789
|
|
|
14579
14790
|
// ../Filesystem/dist/index.js
|
|
14580
|
-
import { S3Client } from "@aws-sdk/client-s3";
|
|
14581
14791
|
import { createReadStream, createWriteStream } from "fs";
|
|
14582
14792
|
import { chmod, copyFile, mkdir as mkdir4, readFile as readFile3, readdir as readdir2, rename as rename2, rm as rm2, stat as stat2, writeFile as writeFile5 } from "fs/promises";
|
|
14583
14793
|
import { dirname as dirname4, extname as extname2, resolve as resolve2 } from "path";
|
|
@@ -14585,16 +14795,6 @@ import { Readable } from "stream";
|
|
|
14585
14795
|
import { pipeline } from "stream/promises";
|
|
14586
14796
|
import { resolve, sep as sep3 } from "path";
|
|
14587
14797
|
import { posix } from "path";
|
|
14588
|
-
import {
|
|
14589
|
-
CopyObjectCommand,
|
|
14590
|
-
DeleteObjectCommand,
|
|
14591
|
-
GetObjectCommand,
|
|
14592
|
-
HeadObjectCommand,
|
|
14593
|
-
ListObjectsV2Command,
|
|
14594
|
-
PutObjectCommand
|
|
14595
|
-
} from "@aws-sdk/client-s3";
|
|
14596
|
-
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|
14597
|
-
import { copy, del, head, list as list4, put } from "@vercel/blob";
|
|
14598
14798
|
import { posix as posix2 } from "path";
|
|
14599
14799
|
import { lstat, mkdir as mkdir23, symlink, unlink } from "fs/promises";
|
|
14600
14800
|
import { dirname as dirname23, relative as relative4 } from "path";
|
|
@@ -14884,6 +15084,7 @@ var LocalFilesystem = class {
|
|
|
14884
15084
|
await chmod(full, mode);
|
|
14885
15085
|
}
|
|
14886
15086
|
};
|
|
15087
|
+
var loadSdk = () => importOptional("@aws-sdk/client-s3", "The s3 disk", () => import("@aws-sdk/client-s3"));
|
|
14887
15088
|
var isNotFound = (error) => {
|
|
14888
15089
|
const name = error.name;
|
|
14889
15090
|
const status = error.$metadata?.httpStatusCode;
|
|
@@ -14911,14 +15112,24 @@ async function collectStream(stream) {
|
|
|
14911
15112
|
return result;
|
|
14912
15113
|
}
|
|
14913
15114
|
var S3Filesystem = class {
|
|
15115
|
+
/** `client` is the client, or what builds it on the first operation. */
|
|
14914
15116
|
constructor(client, config2) {
|
|
14915
15117
|
this.client = client;
|
|
14916
15118
|
this.config = config2;
|
|
14917
15119
|
}
|
|
14918
15120
|
client;
|
|
14919
15121
|
config;
|
|
15122
|
+
#client;
|
|
15123
|
+
resolveClient() {
|
|
15124
|
+
const { client } = this;
|
|
15125
|
+
return this.#client ??= typeof client === "function" ? client() : Promise.resolve(client);
|
|
15126
|
+
}
|
|
15127
|
+
async send(command, input) {
|
|
15128
|
+
const sdk = await loadSdk();
|
|
15129
|
+
return (await this.resolveClient()).send(new sdk[command](input));
|
|
15130
|
+
}
|
|
14920
15131
|
async head(key) {
|
|
14921
|
-
return await this.
|
|
15132
|
+
return await this.send("HeadObjectCommand", { Bucket: this.config.bucket, Key: key });
|
|
14922
15133
|
}
|
|
14923
15134
|
async exists(path) {
|
|
14924
15135
|
try {
|
|
@@ -14934,7 +15145,7 @@ var S3Filesystem = class {
|
|
|
14934
15145
|
}
|
|
14935
15146
|
async getObject(path) {
|
|
14936
15147
|
try {
|
|
14937
|
-
return await this.
|
|
15148
|
+
return await this.send("GetObjectCommand", { Bucket: this.config.bucket, Key: path });
|
|
14938
15149
|
} catch (error) {
|
|
14939
15150
|
if (isNotFound(error)) throw new FileNotFoundError(path);
|
|
14940
15151
|
throw error;
|
|
@@ -14973,27 +15184,23 @@ var S3Filesystem = class {
|
|
|
14973
15184
|
return path;
|
|
14974
15185
|
}
|
|
14975
15186
|
async putObject(path, body, contentType, options) {
|
|
14976
|
-
await this.
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
14983
|
-
})
|
|
14984
|
-
);
|
|
15187
|
+
await this.send("PutObjectCommand", {
|
|
15188
|
+
Bucket: this.config.bucket,
|
|
15189
|
+
Key: path,
|
|
15190
|
+
Body: body,
|
|
15191
|
+
ContentType: contentType,
|
|
15192
|
+
ACL: options?.visibility === "public" ? "public-read" : void 0
|
|
15193
|
+
});
|
|
14985
15194
|
}
|
|
14986
15195
|
async delete(paths) {
|
|
14987
15196
|
for (const path of Array.isArray(paths) ? paths : [paths]) {
|
|
14988
|
-
await this.
|
|
15197
|
+
await this.send("DeleteObjectCommand", { Bucket: this.config.bucket, Key: path });
|
|
14989
15198
|
}
|
|
14990
15199
|
return true;
|
|
14991
15200
|
}
|
|
14992
15201
|
async copy(from, to) {
|
|
14993
15202
|
try {
|
|
14994
|
-
await this.
|
|
14995
|
-
new CopyObjectCommand({ Bucket: this.config.bucket, Key: to, CopySource: `${this.config.bucket}/${encodeURIComponent(from)}` })
|
|
14996
|
-
);
|
|
15203
|
+
await this.send("CopyObjectCommand", { Bucket: this.config.bucket, Key: to, CopySource: `${this.config.bucket}/${encodeURIComponent(from)}` });
|
|
14997
15204
|
} catch (error) {
|
|
14998
15205
|
if (isNotFound(error)) throw new FileNotFoundError(from);
|
|
14999
15206
|
throw error;
|
|
@@ -15044,9 +15251,11 @@ var S3Filesystem = class {
|
|
|
15044
15251
|
return this.config.usePathStyleEndpoint ? `${endpoint}/${this.config.bucket}/${key}` : `${endpoint.replace(/^https?:\/\//, (proto) => `${proto}${this.config.bucket}.`)}/${key}`;
|
|
15045
15252
|
}
|
|
15046
15253
|
async temporaryUrl(path, expiresAt) {
|
|
15254
|
+
const { GetObjectCommand } = await loadSdk();
|
|
15255
|
+
const { getSignedUrl } = await importOptional("@aws-sdk/s3-request-presigner", "The s3 disk's temporaryUrl()", () => import("@aws-sdk/s3-request-presigner"));
|
|
15047
15256
|
const command = new GetObjectCommand({ Bucket: this.config.bucket, Key: path });
|
|
15048
15257
|
const expiresIn = Math.max(1, Math.round((expiresAt.getTime() - Date.now()) / 1e3));
|
|
15049
|
-
return getSignedUrl(this.
|
|
15258
|
+
return getSignedUrl(await this.resolveClient(), command, { expiresIn });
|
|
15050
15259
|
}
|
|
15051
15260
|
async files(directory = "", recursive = false) {
|
|
15052
15261
|
const { objects } = await this.list(directory, recursive);
|
|
@@ -15058,13 +15267,13 @@ var S3Filesystem = class {
|
|
|
15058
15267
|
}
|
|
15059
15268
|
async makeDirectory(path) {
|
|
15060
15269
|
const key = path.endsWith("/") ? path : `${path}/`;
|
|
15061
|
-
await this.
|
|
15270
|
+
await this.send("PutObjectCommand", { Bucket: this.config.bucket, Key: key, Body: new Uint8Array() });
|
|
15062
15271
|
return true;
|
|
15063
15272
|
}
|
|
15064
15273
|
async deleteDirectory(path) {
|
|
15065
15274
|
const prefix = path === "" ? "" : path.endsWith("/") ? path : `${path}/`;
|
|
15066
15275
|
const keys = await this.listAllKeys(prefix);
|
|
15067
|
-
for (const key of keys) await this.
|
|
15276
|
+
for (const key of keys) await this.send("DeleteObjectCommand", { Bucket: this.config.bucket, Key: key });
|
|
15068
15277
|
return true;
|
|
15069
15278
|
}
|
|
15070
15279
|
path(_path) {
|
|
@@ -15074,9 +15283,7 @@ var S3Filesystem = class {
|
|
|
15074
15283
|
const keys = [];
|
|
15075
15284
|
let continuationToken;
|
|
15076
15285
|
do {
|
|
15077
|
-
const page = await this.
|
|
15078
|
-
new ListObjectsV2Command({ Bucket: this.config.bucket, Prefix: prefix, ContinuationToken: continuationToken })
|
|
15079
|
-
);
|
|
15286
|
+
const page = await this.send("ListObjectsV2Command", { Bucket: this.config.bucket, Prefix: prefix, ContinuationToken: continuationToken });
|
|
15080
15287
|
for (const object of page.Contents ?? []) if (object.Key) keys.push(object.Key);
|
|
15081
15288
|
continuationToken = page.IsTruncated ? page.NextContinuationToken : void 0;
|
|
15082
15289
|
} while (continuationToken);
|
|
@@ -15093,9 +15300,7 @@ var S3Filesystem = class {
|
|
|
15093
15300
|
const prefixes = [];
|
|
15094
15301
|
let continuationToken;
|
|
15095
15302
|
do {
|
|
15096
|
-
const page = await this.
|
|
15097
|
-
new ListObjectsV2Command({ Bucket: this.config.bucket, Prefix: prefix, Delimiter: "/", ContinuationToken: continuationToken })
|
|
15098
|
-
);
|
|
15303
|
+
const page = await this.send("ListObjectsV2Command", { Bucket: this.config.bucket, Prefix: prefix, Delimiter: "/", ContinuationToken: continuationToken });
|
|
15099
15304
|
for (const key of (page.Contents ?? []).map((o) => o.Key)) if (key && key !== prefix) objects2.push(key);
|
|
15100
15305
|
for (const p of (page.CommonPrefixes ?? []).map((c) => c.Prefix)) if (p) prefixes.push(p.replace(/\/$/, ""));
|
|
15101
15306
|
continuationToken = page.IsTruncated ? page.NextContinuationToken : void 0;
|
|
@@ -15118,13 +15323,14 @@ var S3Filesystem = class {
|
|
|
15118
15323
|
}
|
|
15119
15324
|
};
|
|
15120
15325
|
var asBody = (body) => body instanceof Uint8Array && !Buffer.isBuffer(body) ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : body;
|
|
15326
|
+
var blob = () => importOptional("@vercel/blob", "The blob disk", () => import("@vercel/blob"));
|
|
15121
15327
|
function vercelBlobClient(token2) {
|
|
15122
15328
|
return {
|
|
15123
|
-
put: (pathname, body, options) => put(pathname, asBody(body), { ...options, token: token2 }),
|
|
15124
|
-
head: (pathname) => head(pathname, { token: token2 }),
|
|
15125
|
-
del: (pathnames) => del(pathnames, { token: token2 }),
|
|
15126
|
-
list: (options) =>
|
|
15127
|
-
copy: (from, to, options) => copy(from, to, { ...options, token: token2 }),
|
|
15329
|
+
put: async (pathname, body, options) => (await blob()).put(pathname, asBody(body), { ...options, token: token2 }),
|
|
15330
|
+
head: async (pathname) => (await blob()).head(pathname, { token: token2 }),
|
|
15331
|
+
del: async (pathnames) => (await blob()).del(pathnames, { token: token2 }),
|
|
15332
|
+
list: async (options) => (await blob()).list({ ...options, token: token2 }),
|
|
15333
|
+
copy: async (from, to, options) => (await blob()).copy(from, to, { ...options, token: token2 }),
|
|
15128
15334
|
fetch: (url2) => fetch(url2)
|
|
15129
15335
|
};
|
|
15130
15336
|
}
|
|
@@ -15206,8 +15412,8 @@ var VercelBlobFilesystem = class {
|
|
|
15206
15412
|
await this.client.put(this.key(path), body, { ...CREATE, ...contentType === void 0 ? {} : { contentType } });
|
|
15207
15413
|
}
|
|
15208
15414
|
async delete(paths) {
|
|
15209
|
-
const
|
|
15210
|
-
if (
|
|
15415
|
+
const list5 = Array.isArray(paths) ? paths : [paths];
|
|
15416
|
+
if (list5.length > 0) await this.client.del(list5.map((path) => this.key(path)));
|
|
15211
15417
|
return true;
|
|
15212
15418
|
}
|
|
15213
15419
|
async copy(from, to) {
|
|
@@ -15280,7 +15486,7 @@ var VercelBlobFilesystem = class {
|
|
|
15280
15486
|
let cursor;
|
|
15281
15487
|
do {
|
|
15282
15488
|
const page = await this.client.list({ prefix, cursor, mode: recursive ? "expanded" : "folded" });
|
|
15283
|
-
blobs.push(...page.blobs.map((
|
|
15489
|
+
blobs.push(...page.blobs.map((blob2) => blob2.pathname));
|
|
15284
15490
|
folders.push(...page.folders ?? []);
|
|
15285
15491
|
cursor = page.hasMore ? page.cursor : void 0;
|
|
15286
15492
|
} while (cursor !== void 0);
|
|
@@ -15298,7 +15504,7 @@ var FilesystemManager2 = class {
|
|
|
15298
15504
|
visibility: config2.visibility
|
|
15299
15505
|
})
|
|
15300
15506
|
);
|
|
15301
|
-
this.drivers.set("s3", (config2) => new S3Filesystem(this.buildS3Client(config2), this.s3Config(config2)));
|
|
15507
|
+
this.drivers.set("s3", (config2) => new S3Filesystem(() => this.buildS3Client(config2), this.s3Config(config2)));
|
|
15302
15508
|
this.drivers.set("vercel-blob", (config2) => {
|
|
15303
15509
|
const token2 = config2.token ?? process.env.BLOB_READ_WRITE_TOKEN;
|
|
15304
15510
|
return new VercelBlobFilesystem(vercelBlobClient(token2), {
|
|
@@ -15312,7 +15518,8 @@ var FilesystemManager2 = class {
|
|
|
15312
15518
|
container;
|
|
15313
15519
|
disks = /* @__PURE__ */ new Map();
|
|
15314
15520
|
drivers = /* @__PURE__ */ new Map();
|
|
15315
|
-
buildS3Client(config2) {
|
|
15521
|
+
async buildS3Client(config2) {
|
|
15522
|
+
const { S3Client } = await importOptional("@aws-sdk/client-s3", "The s3 disk", () => import("@aws-sdk/client-s3"));
|
|
15316
15523
|
const key = config2.key;
|
|
15317
15524
|
const secret = config2.secret;
|
|
15318
15525
|
return new S3Client({
|
|
@@ -16609,8 +16816,8 @@ var InertiaMiddleware = class {
|
|
|
16609
16816
|
bag,
|
|
16610
16817
|
Object.fromEntries(
|
|
16611
16818
|
Object.entries(fields ?? {}).map(([field, messages]) => {
|
|
16612
|
-
const
|
|
16613
|
-
return [field, this.withAllErrors ?
|
|
16819
|
+
const list5 = Array.isArray(messages) ? messages.map(String) : [String(messages)];
|
|
16820
|
+
return [field, this.withAllErrors ? list5 : list5[0] ?? ""];
|
|
16614
16821
|
})
|
|
16615
16822
|
)
|
|
16616
16823
|
])
|
|
@@ -17093,7 +17300,7 @@ var InertiaServiceProvider = class extends ServiceProvider {
|
|
|
17093
17300
|
import pino2 from "pino";
|
|
17094
17301
|
import { createWriteStream as createWriteStream2, mkdirSync as mkdirSync3, readdirSync as readdirSync6, rmSync } from "fs";
|
|
17095
17302
|
import { basename as basename2, dirname as dirname6, extname as extname3, join as join12 } from "path";
|
|
17096
|
-
import { Writable } from "stream";
|
|
17303
|
+
import { Writable as Writable2 } from "stream";
|
|
17097
17304
|
import "pino";
|
|
17098
17305
|
var rootKey = {};
|
|
17099
17306
|
var contexts = /* @__PURE__ */ new WeakMap();
|
|
@@ -17213,7 +17420,7 @@ function localDay(date) {
|
|
|
17213
17420
|
return `${date.getFullYear()}-${month}-${day}`;
|
|
17214
17421
|
}
|
|
17215
17422
|
var DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
17216
|
-
var DailyRotatingStream = class extends
|
|
17423
|
+
var DailyRotatingStream = class extends Writable2 {
|
|
17217
17424
|
constructor(basePath, days, now5 = () => /* @__PURE__ */ new Date()) {
|
|
17218
17425
|
super();
|
|
17219
17426
|
this.days = days;
|
|
@@ -17631,8 +17838,8 @@ function normalizeAddress(recipient) {
|
|
|
17631
17838
|
}
|
|
17632
17839
|
function normalizeAddresses(recipients) {
|
|
17633
17840
|
if (recipients === void 0) return [];
|
|
17634
|
-
const
|
|
17635
|
-
return
|
|
17841
|
+
const list5 = Array.isArray(recipients) ? recipients : [recipients];
|
|
17842
|
+
return list5.map(normalizeAddress);
|
|
17636
17843
|
}
|
|
17637
17844
|
function formatAddress(address) {
|
|
17638
17845
|
return address.name ? `${address.name} <${address.address}>` : address.address;
|
|
@@ -17933,7 +18140,7 @@ function copyShouldQueueFields(target, source) {
|
|
|
17933
18140
|
}
|
|
17934
18141
|
function recipientsHash(to = [], cc = [], bcc = []) {
|
|
17935
18142
|
if (to.length + cc.length + bcc.length === 0) return void 0;
|
|
17936
|
-
const addresses = (
|
|
18143
|
+
const addresses = (list5) => list5.map((recipient) => recipient.address);
|
|
17937
18144
|
const recipients = JSON.stringify({ to: addresses(to), cc: addresses(cc), bcc: addresses(bcc) });
|
|
17938
18145
|
return createHash8("sha1").update(recipients).digest("hex");
|
|
17939
18146
|
}
|
|
@@ -18654,9 +18861,9 @@ function isQueueableNotification(notification) {
|
|
|
18654
18861
|
}
|
|
18655
18862
|
function forNotifiable(notification) {
|
|
18656
18863
|
if (notification.id) return notification;
|
|
18657
|
-
const
|
|
18658
|
-
|
|
18659
|
-
return
|
|
18864
|
+
const copy = Object.assign(Object.create(Object.getPrototypeOf(notification)), notification);
|
|
18865
|
+
copy.id = randomUUID23();
|
|
18866
|
+
return copy;
|
|
18660
18867
|
}
|
|
18661
18868
|
function toNotifiableList(notifiables) {
|
|
18662
18869
|
if (Array.isArray(notifiables)) return notifiables;
|
|
@@ -18687,12 +18894,12 @@ var Dispatcher3 = class {
|
|
|
18687
18894
|
return channel;
|
|
18688
18895
|
}
|
|
18689
18896
|
async send(notifiables, notification) {
|
|
18690
|
-
const
|
|
18691
|
-
if (
|
|
18897
|
+
const list5 = toNotifiableList(notifiables);
|
|
18898
|
+
if (list5.length === 0) return;
|
|
18692
18899
|
if (isQueueableNotification(notification)) {
|
|
18693
18900
|
if (!this.container.bound(BusDispatcher)) throw new NotificationQueueUnavailableError();
|
|
18694
18901
|
const bus = this.container.make(BusDispatcher);
|
|
18695
|
-
for (const notifiable of
|
|
18902
|
+
for (const notifiable of list5) {
|
|
18696
18903
|
const own = forNotifiable(notification);
|
|
18697
18904
|
for (const channel of notification.via(notifiable)) {
|
|
18698
18905
|
await bus.dispatch(new SendQueuedNotifications([notifiable], own, [channel]));
|
|
@@ -18700,11 +18907,11 @@ var Dispatcher3 = class {
|
|
|
18700
18907
|
}
|
|
18701
18908
|
return;
|
|
18702
18909
|
}
|
|
18703
|
-
await this.sendNow(
|
|
18910
|
+
await this.sendNow(list5, notification);
|
|
18704
18911
|
}
|
|
18705
18912
|
async sendNow(notifiables, notification, channels) {
|
|
18706
|
-
const
|
|
18707
|
-
for (const notifiable of
|
|
18913
|
+
const list5 = toNotifiableList(notifiables);
|
|
18914
|
+
for (const notifiable of list5) {
|
|
18708
18915
|
const own = forNotifiable(notification);
|
|
18709
18916
|
const names = channels ?? notification.via(notifiable);
|
|
18710
18917
|
for (const name of names) {
|
|
@@ -20682,7 +20889,7 @@ function discoverJobs(directory, registry2) {
|
|
|
20682
20889
|
return discoverClasses(directory, registry2, isJobClass);
|
|
20683
20890
|
}
|
|
20684
20891
|
var text3 = (value2) => optionalString2(value2) || void 0;
|
|
20685
|
-
var
|
|
20892
|
+
var list4 = (value2) => Array.isArray(value2) ? value2.map(String) : text3(value2) ? [String(value2)] : [];
|
|
20686
20893
|
var number2 = (value2, fallback) => {
|
|
20687
20894
|
const parsed = Number(value2);
|
|
20688
20895
|
return value2 === void 0 || value2 === null || value2 === "" || Number.isNaN(parsed) ? fallback : parsed;
|
|
@@ -20807,7 +21014,7 @@ function registerQueueCommands(kernel, context) {
|
|
|
20807
21014
|
'queue:retry {id?* : The ID of the failed job or "all" to retry all jobs} {--queue= : Retry all of the failed jobs for the specified queue}',
|
|
20808
21015
|
"Retry a failed queue job",
|
|
20809
21016
|
async (out) => {
|
|
20810
|
-
const ids = await retryableIds(
|
|
21017
|
+
const ids = await retryableIds(list4(out.argument("id")), text3(out.option("queue")));
|
|
20811
21018
|
if (ids.length === 0) {
|
|
20812
21019
|
out.info("No retryable jobs found.");
|
|
20813
21020
|
return 0;
|
|
@@ -20920,7 +21127,7 @@ var QueueServiceProvider = class extends ServiceProvider {
|
|
|
20920
21127
|
};
|
|
20921
21128
|
|
|
20922
21129
|
// ../Routing/dist/index.js
|
|
20923
|
-
import { createHmac as
|
|
21130
|
+
import { createHmac as createHmac7, timingSafeEqual as timingSafeEqual6 } from "crypto";
|
|
20924
21131
|
import { pathToFileURL as pathToFileURL7 } from "url";
|
|
20925
21132
|
import { createHash as createHash10 } from "crypto";
|
|
20926
21133
|
import { createHash as createHash23 } from "crypto";
|
|
@@ -21685,20 +21892,20 @@ var BaseRouter = class {
|
|
|
21685
21892
|
return this;
|
|
21686
21893
|
}
|
|
21687
21894
|
pushMiddlewareToGroup(group, middleware) {
|
|
21688
|
-
const
|
|
21689
|
-
if (!
|
|
21895
|
+
const list5 = this.#groups[group] ??= [];
|
|
21896
|
+
if (!list5.includes(middleware)) list5.push(middleware);
|
|
21690
21897
|
return this;
|
|
21691
21898
|
}
|
|
21692
21899
|
prependMiddlewareToGroup(group, middleware) {
|
|
21693
|
-
const
|
|
21694
|
-
if (!
|
|
21900
|
+
const list5 = this.#groups[group] ??= [];
|
|
21901
|
+
if (!list5.includes(middleware)) list5.unshift(middleware);
|
|
21695
21902
|
return this;
|
|
21696
21903
|
}
|
|
21697
21904
|
hasMiddlewareGroup(name) {
|
|
21698
21905
|
return Object.hasOwn(this.#groups, name);
|
|
21699
21906
|
}
|
|
21700
21907
|
getMiddlewareGroups() {
|
|
21701
|
-
return Object.fromEntries(Object.entries(this.#groups).map(([name,
|
|
21908
|
+
return Object.fromEntries(Object.entries(this.#groups).map(([name, list5]) => [name, [...list5]]));
|
|
21702
21909
|
}
|
|
21703
21910
|
/** Every route, in registration order. */
|
|
21704
21911
|
getRoutes() {
|
|
@@ -21761,7 +21968,7 @@ function routeKey(value2, field) {
|
|
|
21761
21968
|
return typeof model.getRouteKey === "function" ? model.getRouteKey() : value2;
|
|
21762
21969
|
}
|
|
21763
21970
|
function sign(url2, key) {
|
|
21764
|
-
return
|
|
21971
|
+
return createHmac7("sha256", key).update(url2).digest("hex");
|
|
21765
21972
|
}
|
|
21766
21973
|
function safeEquals(expected, given) {
|
|
21767
21974
|
const a = Buffer.from(expected);
|
|
@@ -21997,9 +22204,9 @@ function withHeaders2(response2, headers) {
|
|
|
21997
22204
|
for (const [name, value2] of Object.entries(headers)) response2.headers.set(name, value2);
|
|
21998
22205
|
return response2;
|
|
21999
22206
|
} catch {
|
|
22000
|
-
const
|
|
22001
|
-
for (const [name, value2] of Object.entries(headers))
|
|
22002
|
-
return new Response(response2.body, { status: response2.status, statusText: response2.statusText, headers:
|
|
22207
|
+
const copy = new Headers(response2.headers);
|
|
22208
|
+
for (const [name, value2] of Object.entries(headers)) copy.set(name, value2);
|
|
22209
|
+
return new Response(response2.body, { status: response2.status, statusText: response2.statusText, headers: copy });
|
|
22003
22210
|
}
|
|
22004
22211
|
}
|
|
22005
22212
|
var ThrottleRequests = class {
|
|
@@ -22206,8 +22413,8 @@ var Store = class {
|
|
|
22206
22413
|
for (const [name, item] of Object.entries(values)) Arr.set(this.#attributes, name, item);
|
|
22207
22414
|
}
|
|
22208
22415
|
push(key, value2) {
|
|
22209
|
-
const
|
|
22210
|
-
this.put(key, [...Array.isArray(
|
|
22416
|
+
const list5 = this.get(key, []);
|
|
22417
|
+
this.put(key, [...Array.isArray(list5) ? list5 : [list5], value2]);
|
|
22211
22418
|
}
|
|
22212
22419
|
increment(key, amount = 1) {
|
|
22213
22420
|
const value2 = Number(this.get(key, 0)) + amount;
|
|
@@ -22405,18 +22612,20 @@ var FileSessionHandler = class {
|
|
|
22405
22612
|
}
|
|
22406
22613
|
};
|
|
22407
22614
|
var DatabaseSessionHandler = class {
|
|
22408
|
-
constructor(connection, table, minutes, container = () => void 0, clock = Date.now) {
|
|
22615
|
+
constructor(connection, table, minutes, container = () => void 0, clock = Date.now, options = {}) {
|
|
22409
22616
|
this.connection = connection;
|
|
22410
22617
|
this.table = table;
|
|
22411
22618
|
this.minutes = minutes;
|
|
22412
22619
|
this.container = container;
|
|
22413
22620
|
this.clock = clock;
|
|
22621
|
+
this.options = options;
|
|
22414
22622
|
}
|
|
22415
22623
|
connection;
|
|
22416
22624
|
table;
|
|
22417
22625
|
minutes;
|
|
22418
22626
|
container;
|
|
22419
22627
|
clock;
|
|
22628
|
+
options;
|
|
22420
22629
|
#exists = false;
|
|
22421
22630
|
async read(id) {
|
|
22422
22631
|
const session2 = await this.#query().where("id", id).first();
|
|
@@ -22458,7 +22667,10 @@ var DatabaseSessionHandler = class {
|
|
|
22458
22667
|
const payload = { payload: Buffer.from(data, "utf8").toString("base64"), last_activity: this.#now() };
|
|
22459
22668
|
const container = this.container();
|
|
22460
22669
|
if (container === void 0) return payload;
|
|
22461
|
-
if (
|
|
22670
|
+
if (this.options.clientDetails !== true) {
|
|
22671
|
+
payload.ip_address = null;
|
|
22672
|
+
payload.user_agent = null;
|
|
22673
|
+
} else if (container.bound(HttpRequest)) {
|
|
22462
22674
|
const request2 = container.make(HttpRequest);
|
|
22463
22675
|
payload.ip_address = request2.ip() ?? null;
|
|
22464
22676
|
payload.user_agent = (request2.header("user-agent") ?? "").slice(0, 500);
|
|
@@ -22590,7 +22802,9 @@ var SessionManager = class {
|
|
|
22590
22802
|
() => container.make(DatabaseManager).connection(config2.connection ?? void 0),
|
|
22591
22803
|
config2.table ?? "sessions",
|
|
22592
22804
|
lifetime,
|
|
22593
|
-
() => container
|
|
22805
|
+
() => container,
|
|
22806
|
+
void 0,
|
|
22807
|
+
{ clientDetails: config2.client_details === true }
|
|
22594
22808
|
);
|
|
22595
22809
|
case "cookie":
|
|
22596
22810
|
return new CookieSessionHandler(
|
|
@@ -22845,7 +23059,8 @@ var SessionServiceProvider = class extends ServiceProvider {
|
|
|
22845
23059
|
domain: null,
|
|
22846
23060
|
secure: null,
|
|
22847
23061
|
http_only: true,
|
|
22848
|
-
same_site: "lax"
|
|
23062
|
+
same_site: "lax",
|
|
23063
|
+
client_details: false
|
|
22849
23064
|
},
|
|
22850
23065
|
"session"
|
|
22851
23066
|
);
|
|
@@ -22881,7 +23096,7 @@ var ValidationErrorImpl = class extends Error {
|
|
|
22881
23096
|
var ValidationException = class _ValidationException extends ValidationErrorImpl {
|
|
22882
23097
|
/** Messages per field, each a string or a list. */
|
|
22883
23098
|
static withMessages(messages) {
|
|
22884
|
-
const errors2 = Object.fromEntries(Object.entries(messages).map(([field,
|
|
23099
|
+
const errors2 = Object.fromEntries(Object.entries(messages).map(([field, list5]) => [field, typeof list5 === "string" ? [list5] : [...list5]]));
|
|
22885
23100
|
return new _ValidationException(errors2);
|
|
22886
23101
|
}
|
|
22887
23102
|
constructor(errors2, errorBag = "default", redirectTo2) {
|
|
@@ -24133,11 +24348,11 @@ var urlPatterns = /* @__PURE__ */ new Map();
|
|
|
24133
24348
|
function isUrl(value2, protocols) {
|
|
24134
24349
|
if (typeof value2 !== "string") return false;
|
|
24135
24350
|
if (protocols.length === 0) return URL_RE.test(value2);
|
|
24136
|
-
const
|
|
24137
|
-
let pattern = urlPatterns.get(
|
|
24351
|
+
const list5 = protocols.join("|");
|
|
24352
|
+
let pattern = urlPatterns.get(list5);
|
|
24138
24353
|
if (pattern === void 0) {
|
|
24139
24354
|
try {
|
|
24140
|
-
pattern = urlPattern(
|
|
24355
|
+
pattern = urlPattern(list5);
|
|
24141
24356
|
} catch (error) {
|
|
24142
24357
|
throw new InvalidRuleParameterError(
|
|
24143
24358
|
"url",
|
|
@@ -24145,7 +24360,7 @@ function isUrl(value2, protocols) {
|
|
|
24145
24360
|
error instanceof Error ? error.message : String(error)
|
|
24146
24361
|
);
|
|
24147
24362
|
}
|
|
24148
|
-
urlPatterns.set(
|
|
24363
|
+
urlPatterns.set(list5, pattern);
|
|
24149
24364
|
}
|
|
24150
24365
|
return pattern.test(value2);
|
|
24151
24366
|
}
|
|
@@ -24571,11 +24786,11 @@ var sizeRules = {
|
|
|
24571
24786
|
in: { validate: (ctx) => isListed(ctx.value, ctx.parameters, ctx.ruleNames), messageKey: () => "in" },
|
|
24572
24787
|
not_in: { validate: (ctx) => !isListed(ctx.value, ctx.parameters, ctx.ruleNames), messageKey: () => "not_in" }
|
|
24573
24788
|
};
|
|
24574
|
-
function isListed(value2,
|
|
24789
|
+
function isListed(value2, list5, ruleNames) {
|
|
24575
24790
|
if (Array.isArray(value2) && ruleNames.includes("array")) {
|
|
24576
|
-
return value2.every((item) => (typeof item !== "object" || item === null) &&
|
|
24791
|
+
return value2.every((item) => (typeof item !== "object" || item === null) && list5.includes(String(item)));
|
|
24577
24792
|
}
|
|
24578
|
-
return (typeof value2 !== "object" || value2 === null) &&
|
|
24793
|
+
return (typeof value2 !== "object" || value2 === null) && list5.includes(String(value2));
|
|
24579
24794
|
}
|
|
24580
24795
|
var REGIONS = ["Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic", "Australia", "Europe", "Indian", "Pacific"];
|
|
24581
24796
|
var ZONE_RE = /^[A-Z][A-Za-z_-]*(?:\/[A-Z][A-Za-z0-9_+-]*)+$/;
|
|
@@ -24724,13 +24939,13 @@ var PasswordRule = class _PasswordRule {
|
|
|
24724
24939
|
if (this.#numbers && !/\p{N}/u.test(value2)) say("password.numbers");
|
|
24725
24940
|
}
|
|
24726
24941
|
#copy() {
|
|
24727
|
-
const
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
|
|
24731
|
-
|
|
24732
|
-
|
|
24733
|
-
return
|
|
24942
|
+
const copy = new _PasswordRule(this.#min);
|
|
24943
|
+
copy.#max = this.#max;
|
|
24944
|
+
copy.#letters = this.#letters;
|
|
24945
|
+
copy.#mixedCase = this.#mixedCase;
|
|
24946
|
+
copy.#numbers = this.#numbers;
|
|
24947
|
+
copy.#symbols = this.#symbols;
|
|
24948
|
+
return copy;
|
|
24734
24949
|
}
|
|
24735
24950
|
};
|
|
24736
24951
|
var BuiltinRuleObject = class {
|
|
@@ -25080,10 +25295,10 @@ function withoutPaths(data, paths) {
|
|
|
25080
25295
|
node = void 0;
|
|
25081
25296
|
break;
|
|
25082
25297
|
}
|
|
25083
|
-
const
|
|
25084
|
-
copies.add(
|
|
25085
|
-
node[part2] =
|
|
25086
|
-
node =
|
|
25298
|
+
const copy = copies.has(child) ? child : Array.isArray(child) ? [...child] : { ...child };
|
|
25299
|
+
copies.add(copy);
|
|
25300
|
+
node[part2] = copy;
|
|
25301
|
+
node = copy;
|
|
25087
25302
|
}
|
|
25088
25303
|
if (node === void 0 || !Object.hasOwn(node, leaf)) continue;
|
|
25089
25304
|
if (Array.isArray(node)) node[Number(leaf)] = EXCLUDED;
|
|
@@ -25818,6 +26033,7 @@ export {
|
|
|
25818
26033
|
AuthServiceProvider,
|
|
25819
26034
|
AuthenticatableModel,
|
|
25820
26035
|
Authenticate,
|
|
26036
|
+
AuthenticateSession,
|
|
25821
26037
|
AuthenticationError,
|
|
25822
26038
|
Authorizable,
|
|
25823
26039
|
AuthorizationError,
|
|
@@ -25866,6 +26082,7 @@ export {
|
|
|
25866
26082
|
Computed,
|
|
25867
26083
|
Config,
|
|
25868
26084
|
Connection,
|
|
26085
|
+
ConsoleAbortedError,
|
|
25869
26086
|
Kernel2 as ConsoleKernelImpl,
|
|
25870
26087
|
ConsoleServiceProvider,
|
|
25871
26088
|
Container2 as Container,
|
|
@@ -25880,6 +26097,7 @@ export {
|
|
|
25880
26097
|
CookieValuePrefix,
|
|
25881
26098
|
CorruptComponentPayloadError,
|
|
25882
26099
|
Crypt,
|
|
26100
|
+
CurrentDeviceLogout,
|
|
25883
26101
|
Cursor,
|
|
25884
26102
|
CursorPaginator,
|
|
25885
26103
|
DB,
|
|
@@ -25986,6 +26204,7 @@ export {
|
|
|
25986
26204
|
InvalidListenerError,
|
|
25987
26205
|
InvalidLiveRequestError,
|
|
25988
26206
|
InvalidLogLevelError,
|
|
26207
|
+
InvalidPasswordError,
|
|
25989
26208
|
InvalidRuleParameterError,
|
|
25990
26209
|
InvalidSignatureError,
|
|
25991
26210
|
InvalidUploadSignatureError,
|
|
@@ -26066,6 +26285,7 @@ export {
|
|
|
26066
26285
|
Migrator,
|
|
26067
26286
|
MissingAppKeyError,
|
|
26068
26287
|
MissingModelError,
|
|
26288
|
+
MissingPackageError,
|
|
26069
26289
|
MissingRecipientError,
|
|
26070
26290
|
Model,
|
|
26071
26291
|
ModelNotFoundError,
|
|
@@ -26095,6 +26315,7 @@ export {
|
|
|
26095
26315
|
On,
|
|
26096
26316
|
OnceProp,
|
|
26097
26317
|
OptionalProp,
|
|
26318
|
+
OtherDeviceLogout,
|
|
26098
26319
|
PERSISTENT_MIDDLEWARE,
|
|
26099
26320
|
PERSONAL_ACCESS_TOKENS_MIGRATION,
|
|
26100
26321
|
PREVIEW_URI,
|
|
@@ -26221,6 +26442,7 @@ export {
|
|
|
26221
26442
|
TrimStrings,
|
|
26222
26443
|
TsxView,
|
|
26223
26444
|
TwoFactor,
|
|
26445
|
+
TwoFactorAppAlreadyEnabledError,
|
|
26224
26446
|
TwoFactorAppDisabled,
|
|
26225
26447
|
TwoFactorAppEnabled,
|
|
26226
26448
|
TwoFactorAuthenticated,
|
|
@@ -26253,6 +26475,7 @@ export {
|
|
|
26253
26475
|
UnrenderableNotificationMailError,
|
|
26254
26476
|
UnsupportedCipherError,
|
|
26255
26477
|
UnsupportedOperationError,
|
|
26478
|
+
UploadAlreadyStoredError,
|
|
26256
26479
|
UploadValidationError,
|
|
26257
26480
|
UrlGenerationError,
|
|
26258
26481
|
VERCEL_FUNCTION_LIMIT,
|
|
@@ -26296,6 +26519,7 @@ export {
|
|
|
26296
26519
|
auth,
|
|
26297
26520
|
back,
|
|
26298
26521
|
bcrypt3 as bcrypt,
|
|
26522
|
+
blobStoreUrl,
|
|
26299
26523
|
buildVercelOutput,
|
|
26300
26524
|
builtinRules,
|
|
26301
26525
|
bunRuntime,
|
|
@@ -26500,6 +26724,7 @@ export {
|
|
|
26500
26724
|
toResponse,
|
|
26501
26725
|
toWebRequest,
|
|
26502
26726
|
tokenableType,
|
|
26727
|
+
totpCode,
|
|
26503
26728
|
transformLeaves,
|
|
26504
26729
|
url,
|
|
26505
26730
|
usePaginationResolvers,
|