@guren/server 2.14.0 → 2.16.0
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/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
- package/dist/{Hash-CzrwKeDp.js → Hash-D2DFd8xX.js} +12 -57
- package/dist/{HttpException-BkS3euNG.js → HttpException-BlQ2yEmT.js} +2 -79
- package/dist/{Job-BVT813DO.js → Job-DxQK8h3P.js} +24 -179
- package/dist/{McpServiceProvider-BawsYjgN.js → McpServiceProvider-nNcbCIQX.js} +11 -20
- package/dist/{Random-DbIJ22KQ.js → Random-S0OvCuR8.js} +9 -106
- package/dist/agent/AgentApprovalRequested.d.ts +31 -0
- package/dist/agent/approval.d.ts +184 -0
- package/dist/agent/audit-emitter.d.ts +36 -0
- package/dist/agent/audit.d.ts +67 -0
- package/dist/agent/derive.d.ts +32 -66
- package/dist/agent/dispatch.d.ts +53 -63
- package/dist/agent/events.d.ts +11 -19
- package/dist/agent/meta-tools.d.ts +34 -0
- package/dist/agent/public.d.ts +14 -0
- package/dist/agent/public.js +2 -0
- package/dist/agent/redact.d.ts +16 -38
- package/dist/agent/scopes.d.ts +23 -69
- package/dist/auth/AuthManager.d.ts +19 -40
- package/dist/auth/AuthenticatableModel.d.ts +2 -2
- package/dist/auth/SessionGuard.d.ts +0 -1
- package/dist/auth/TokenGuard.d.ts +6 -26
- package/dist/auth/api-token.d.ts +16 -148
- package/dist/auth/context.d.ts +5 -10
- package/dist/auth/email-verification.d.ts +29 -127
- package/dist/auth/index.js +1 -1
- package/dist/auth/oauth/index.d.ts +35 -57
- package/dist/auth/password/DefaultHasher.d.ts +9 -5
- package/dist/auth/password/PasswordHasher.d.ts +7 -0
- package/dist/auth/password/hash-format.d.ts +11 -0
- package/dist/auth/password-reset.d.ts +16 -42
- package/dist/auth/providers/ModelUserProvider.d.ts +3 -4
- package/dist/auth/providers/UserProvider.d.ts +4 -4
- package/dist/auth/signed-token.d.ts +18 -0
- package/dist/auth/types.d.ts +9 -32
- package/dist/auth/utils.d.ts +6 -27
- package/dist/{auth-BSUc14CD.js → auth-CbdPH4Cd.js} +252 -496
- package/dist/authorization/Gate.d.ts +9 -145
- package/dist/authorization/Policy.d.ts +6 -53
- package/dist/authorization/index.js +1 -1
- package/dist/authorization/middleware.d.ts +16 -62
- package/dist/authorization/types.d.ts +8 -64
- package/dist/{authorization-CdfbCj8J.js → authorization-CdEWZZw3.js} +44 -309
- package/dist/broadcasting/BroadcastManager.d.ts +29 -149
- package/dist/broadcasting/channels/Channel.d.ts +1 -19
- package/dist/broadcasting/channels/PresenceChannel.d.ts +1 -55
- package/dist/broadcasting/channels/PrivateChannel.d.ts +1 -23
- package/dist/broadcasting/drivers/MemoryDriver.d.ts +18 -70
- package/dist/broadcasting/drivers/RedisDriver.d.ts +3 -80
- package/dist/broadcasting/drivers/index.d.ts +1 -1
- package/dist/broadcasting/index.d.ts +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/broadcasting/types.d.ts +7 -88
- package/dist/{broadcasting-BxU-LIfF.js → broadcasting-B5RzB0A2.js} +87 -414
- package/dist/cache/CacheManager.d.ts +8 -62
- package/dist/cache/TaggedCache.d.ts +2 -35
- package/dist/cache/index.js +1 -1
- package/dist/cache/stores/FileStore.d.ts +2 -36
- package/dist/cache/stores/MemoryStore.d.ts +2 -26
- package/dist/cache/stores/RedisStore.d.ts +1 -29
- package/dist/cache/types.d.ts +21 -128
- package/dist/{cache-BYnZf2FR.js → cache-BOOIr324.js} +19 -198
- package/dist/client-C4TEr_Dd.js +9 -0
- package/dist/console/Command.d.ts +17 -126
- package/dist/console/ConsoleKernel.d.ts +2 -74
- package/dist/console/Input.d.ts +5 -113
- package/dist/console/Output.d.ts +3 -99
- package/dist/console/types.d.ts +3 -33
- package/dist/container/Container.d.ts +12 -103
- package/dist/container/ServiceProvider.d.ts +17 -61
- package/dist/container/bindings.d.ts +10 -12
- package/dist/container/defineModule.d.ts +16 -54
- package/dist/container/definePlugin.d.ts +12 -45
- package/dist/container/types.d.ts +2 -34
- package/dist/context-CXk_umpT.js +21 -0
- package/dist/database/Factory.d.ts +4 -57
- package/dist/database/Seeder.d.ts +8 -46
- package/dist/database/SeederRunner.d.ts +3 -33
- package/dist/database/types.d.ts +3 -24
- package/dist/discovery/AutoDiscovery.d.ts +10 -82
- package/dist/dispatch-BAwzftws.js +238 -0
- package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +2 -5
- package/dist/docs-viewer/endpoint.d.ts +5 -11
- package/dist/encryption/Encrypter.d.ts +5 -71
- package/dist/encryption/Hash.d.ts +7 -57
- package/dist/encryption/Random.d.ts +6 -99
- package/dist/encryption/index.js +3 -3
- package/dist/encryption/types.d.ts +10 -72
- package/dist/{encryption-DJtkkhiw.js → encryption-uwP3Di4D.js} +13 -79
- package/dist/{endpoint-D6GIqOpe.js → endpoint-BXipU2Jj.js} +6 -12
- package/dist/endpoint-Dsw3Acvq.js +26 -0
- package/dist/errors/ExceptionHandler.d.ts +3 -90
- package/dist/errors/HttpException.d.ts +2 -79
- package/dist/errors/debug-page.d.ts +3 -17
- package/dist/errors/error-page.d.ts +1 -0
- package/dist/errors/exceptions/AuthenticationException.d.ts +2 -24
- package/dist/errors/exceptions/AuthorizationException.d.ts +1 -24
- package/dist/errors/exceptions/MethodNotAllowedException.d.ts +1 -23
- package/dist/errors/exceptions/NotFoundHttpException.d.ts +1 -27
- package/dist/errors/exceptions/ValidationException.d.ts +2 -43
- package/dist/errors/types.d.ts +1 -25
- package/dist/{errors-BgeOl_DC.js → errors-JpkcCjjn.js} +3 -41
- package/dist/events/Event.d.ts +1 -28
- package/dist/events/EventManager.d.ts +5 -107
- package/dist/events/Listener.d.ts +7 -55
- package/dist/events/builtin.d.ts +0 -24
- package/dist/events/index.js +1 -1
- package/dist/events/types.d.ts +4 -22
- package/dist/{events-aIH_bWRx.js → events-DOmAHDeP.js} +11 -191
- package/dist/facades/index.d.ts +2 -14
- package/dist/health/HealthCheck.d.ts +0 -24
- package/dist/health/HealthManager.d.ts +0 -36
- package/dist/health/checks/CacheCheck.d.ts +2 -17
- package/dist/health/checks/CustomCheck.d.ts +0 -9
- package/dist/health/checks/DatabaseCheck.d.ts +2 -17
- package/dist/health/checks/MemoryCheck.d.ts +3 -12
- package/dist/health/checks/RedisCheck.d.ts +1 -13
- package/dist/health/checks/StorageCheck.d.ts +2 -17
- package/dist/health/index.js +1 -1
- package/dist/health/types.d.ts +4 -24
- package/dist/{health-VWdWXRwh.js → health-DQSvUplL.js} +1 -76
- package/dist/hot-disposables-B5BXqaIH.js +167 -0
- package/dist/hot-reload/hot-disposables.d.ts +22 -74
- package/dist/hot-reload/testing.d.ts +4 -9
- package/dist/http/Application.d.ts +62 -208
- package/dist/http/FormRequest.d.ts +4 -55
- package/dist/http/dev-assets.d.ts +16 -18
- package/dist/http/dev-banner.d.ts +2 -5
- package/dist/http/inertia-assets.d.ts +3 -6
- package/dist/http/middleware/capabilities.d.ts +27 -50
- package/dist/http/middleware/cors.d.ts +4 -29
- package/dist/http/middleware/csp.d.ts +2 -25
- package/dist/http/middleware/csrf.d.ts +20 -95
- package/dist/http/middleware/detect-locale.d.ts +7 -27
- package/dist/http/middleware/force-https.d.ts +6 -24
- package/dist/http/middleware/host-authorization.d.ts +2 -12
- package/dist/http/middleware/loopback-guard.d.ts +15 -33
- package/dist/http/middleware/rate-limit.d.ts +29 -126
- package/dist/http/middleware/redirect-safety.d.ts +2 -20
- package/dist/http/middleware/request-id.d.ts +1 -14
- package/dist/http/middleware/request-logging.d.ts +2 -13
- package/dist/http/middleware/response-headers.d.ts +5 -13
- package/dist/http/middleware/security-headers.d.ts +2 -16
- package/dist/http/middleware/session.d.ts +15 -34
- package/dist/http/middleware/validation-errors-cookie.d.ts +7 -18
- package/dist/http/middleware/validation.d.ts +8 -63
- package/dist/http/public-assets.d.ts +14 -0
- package/dist/http/request.d.ts +49 -48
- package/dist/http/resources/CursorPaginator.d.ts +5 -64
- package/dist/http/resources/Paginator.d.ts +7 -84
- package/dist/http/resources/Resource.d.ts +9 -65
- package/dist/http/resources/ResourceCollection.d.ts +5 -39
- package/dist/http/resources/types.d.ts +10 -30
- package/dist/http/static-documents.d.ts +21 -0
- package/dist/http/validation/Validator.d.ts +25 -85
- package/dist/http/validation/rules.d.ts +48 -147
- package/dist/http/validation/types.d.ts +16 -61
- package/dist/http/vite-assets.d.ts +5 -28
- package/dist/http/vite-dev-server.d.ts +6 -9
- package/dist/http/vite-manifest.d.ts +19 -33
- package/dist/i18n/I18nManager.d.ts +12 -78
- package/dist/i18n/Translator.d.ts +3 -54
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/loaders/JsonLoader.d.ts +4 -31
- package/dist/i18n/loaders/MemoryLoader.d.ts +1 -21
- package/dist/i18n/pluralization.d.ts +4 -13
- package/dist/i18n/types.d.ts +17 -69
- package/dist/{i18n-mcWi7LCd.js → i18n-Cg1aajRP.js} +31 -225
- package/dist/index.d.ts +13 -4
- package/dist/index.js +1036 -3080
- package/dist/internal/agent-preflight.d.ts +9 -21
- package/dist/internal/request.d.ts +10 -17
- package/dist/internal/request.js +2 -2
- package/dist/internal/route-path.d.ts +9 -21
- package/dist/internal/route-path.js +9 -21
- package/dist/internal/zod-compat.d.ts +55 -122
- package/dist/internal/zod-compat.js +39 -70
- package/dist/internal/zod-json-schema.d.ts +18 -54
- package/dist/internal/zod-json-schema.js +46 -123
- package/dist/jsx-runtime.d.ts +3 -8
- package/dist/lambda/index.d.ts +17 -79
- package/dist/lambda/index.js +11 -59
- package/dist/logging/LogManager.d.ts +1 -51
- package/dist/logging/Logger.d.ts +8 -47
- package/dist/logging/channels/ConsoleChannel.d.ts +1 -3
- package/dist/logging/channels/DailyFileChannel.d.ts +1 -5
- package/dist/logging/channels/FileChannel.d.ts +1 -3
- package/dist/logging/daily-file-path.d.ts +15 -0
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +2 -2
- package/dist/logging/types.d.ts +13 -45
- package/dist/{logging-CPaRMuPP.js → logging-zOY1XCtq.js} +83 -129
- package/dist/{loopback-guard-D0Kc7-xc.js → loopback-guard-DT9gHF0F.js} +41 -92
- package/dist/mail/Mail.d.ts +10 -106
- package/dist/mail/MailManager.d.ts +2 -60
- package/dist/mail/index.js +1 -1
- package/dist/mail/transports/LogTransport.d.ts +1 -4
- package/dist/mail/transports/MemoryTransport.d.ts +1 -63
- package/dist/mail/transports/ResendTransport.d.ts +1 -23
- package/dist/mail/transports/SmtpTransport.d.ts +1 -31
- package/dist/mail/types.d.ts +28 -150
- package/dist/{mail-DfEfSQEr.js → mail-76DWy9lj.js} +31 -289
- package/dist/mcp/McpServiceProvider.d.ts +4 -10
- package/dist/mcp/create-mcp-server.d.ts +25 -57
- package/dist/mcp/endpoint.d.ts +12 -36
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Controller.d.ts +46 -253
- package/dist/mvc/Router.d.ts +50 -129
- package/dist/mvc/inertia/InertiaEngine.d.ts +18 -48
- package/dist/mvc/inertia/shared.d.ts +6 -19
- package/dist/mvc/mount-route.d.ts +2 -6
- package/dist/mvc/view.d.ts +1 -2
- package/dist/notifications/Notification.d.ts +8 -75
- package/dist/notifications/NotificationManager.d.ts +15 -88
- package/dist/notifications/channels/DatabaseChannel.d.ts +1 -41
- package/dist/notifications/channels/MailChannel.d.ts +2 -31
- package/dist/notifications/channels/MemoryChannel.d.ts +2 -62
- package/dist/notifications/channels/SlackChannel.d.ts +3 -48
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/notifiable-type.d.ts +3 -6
- package/dist/notifications/registry.d.ts +8 -27
- package/dist/notifications/types.d.ts +16 -53
- package/dist/{notifications-BGqmUNZ8.js → notifications-okWFs9ly.js} +37 -335
- package/dist/providers/AuthServiceProvider.d.ts +1 -3
- package/dist/providers/AuthorizationServiceProvider.d.ts +2 -3
- package/dist/providers/BroadcastServiceProvider.d.ts +1 -3
- package/dist/providers/CacheServiceProvider.d.ts +1 -3
- package/dist/providers/EncryptionServiceProvider.d.ts +1 -3
- package/dist/providers/ErrorServiceProvider.d.ts +1 -4
- package/dist/providers/EventServiceProvider.d.ts +1 -3
- package/dist/providers/HealthServiceProvider.d.ts +1 -3
- package/dist/providers/I18nServiceProvider.d.ts +6 -10
- package/dist/providers/InertiaServiceProvider.d.ts +1 -4
- package/dist/providers/LogServiceProvider.d.ts +1 -3
- package/dist/providers/MailServiceProvider.d.ts +1 -3
- package/dist/providers/NotificationServiceProvider.d.ts +1 -3
- package/dist/providers/OAuthServiceProvider.d.ts +1 -3
- package/dist/providers/QueueServiceProvider.d.ts +1 -3
- package/dist/providers/SchedulingServiceProvider.d.ts +1 -3
- package/dist/providers/StorageServiceProvider.d.ts +1 -3
- package/dist/queue/FailedJobReporter.d.ts +1 -24
- package/dist/queue/Job.d.ts +12 -99
- package/dist/queue/QueueManager.d.ts +6 -57
- package/dist/queue/Worker.d.ts +4 -65
- package/dist/queue/drivers/MemoryDriver.d.ts +3 -44
- package/dist/queue/drivers/RedisDriver.d.ts +7 -65
- package/dist/queue/drivers/SqsDriver.d.ts +6 -57
- package/dist/queue/drivers/SyncDriver.d.ts +10 -13
- package/dist/queue/index.js +2 -2
- package/dist/queue/types.d.ts +10 -92
- package/dist/{queue-CXrRK85G.js → queue-CcXCjuJI.js} +32 -260
- package/dist/redis/RedisApiTokenStore.d.ts +4 -56
- package/dist/redis/RedisEmailVerificationStore.d.ts +4 -37
- package/dist/redis/RedisOAuthStateStore.d.ts +2 -10
- package/dist/redis/RedisPasswordResetStore.d.ts +4 -37
- package/dist/redis/RedisRateLimitStore.d.ts +16 -49
- package/dist/redis/RedisSessionStore.d.ts +3 -44
- package/dist/redis/client.d.ts +2 -32
- package/dist/redis/index.js +47 -232
- package/dist/redis/redis-values.d.ts +6 -12
- package/dist/redis/scan-keys.d.ts +1 -4
- package/dist/request-CLOYytGP.js +68 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +108 -74
- package/dist/scheduling/CronParser.d.ts +0 -29
- package/dist/scheduling/Schedule.d.ts +1 -153
- package/dist/scheduling/ScheduledTask.d.ts +0 -31
- package/dist/scheduling/Scheduler.d.ts +0 -70
- package/dist/scheduling/index.js +1 -1
- package/dist/scheduling/types.d.ts +4 -65
- package/dist/{scheduling-CPiEdtQd.js → scheduling-C6tcOtUl.js} +2 -287
- package/dist/storage/StorageManager.d.ts +0 -48
- package/dist/storage/drivers/LocalDriver.d.ts +1 -25
- package/dist/storage/drivers/MemoryDriver.d.ts +5 -35
- package/dist/storage/drivers/S3Driver.d.ts +6 -36
- package/dist/storage/drivers/s3-acl.d.ts +5 -10
- package/dist/storage/index.js +1 -1
- package/dist/storage/types.d.ts +27 -265
- package/dist/{storage-TLD9t0Q2.js → storage-BB59f07j.js} +17 -157
- package/dist/support/contained-path.d.ts +10 -20
- package/dist/support/error-polyfill.d.ts +4 -6
- package/dist/support/expiry.d.ts +17 -33
- package/dist/support/expiry.js +17 -33
- package/dist/support/import-map.d.ts +3 -7
- package/dist/support/inertia-defaults.d.ts +5 -10
- package/dist/support/redirect-target.d.ts +4 -6
- package/dist/support/stack-frames.d.ts +11 -50
- package/dist/support/trim-slashes.d.ts +4 -7
- package/dist/support/warn-once.d.ts +2 -6
- package/dist/{trim-slashes-ZJ_VsY5s.js → trim-slashes-BLY9hKAa.js} +4 -7
- package/dist/{vite-manifest-BGfWbPYp.js → vite-manifest-CTQp-SOo.js} +34 -58
- package/package.json +6 -2
- package/dist/client-Dd7vLcqp.js +0 -27
- package/dist/context-DoD0c7J_.js +0 -26
- package/dist/endpoint-D-20PiHY.js +0 -46
- package/dist/hot-disposables-WsTX2ySN.js +0 -281
- package/dist/request-CRVuIiQr.js +0 -78
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as trimSlashes } from "./trim-slashes-
|
|
1
|
+
import { t as trimSlashes } from "./trim-slashes-BLY9hKAa.js";
|
|
2
2
|
import { copyFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, resolve, sep } from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
@@ -6,12 +6,8 @@ import { Readable } from "node:stream";
|
|
|
6
6
|
//#region src/support/warn-once.ts
|
|
7
7
|
const warned = /* @__PURE__ */ new Set();
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* Deprecation warnings have to be loud enough to be read once and quiet
|
|
12
|
-
* enough not to drown a request log, which is the same shape the OAuth
|
|
13
|
-
* warnings settled on (`auth/oauth/index.ts`) — this is that pattern with a
|
|
14
|
-
* key, so several call sites can share it.
|
|
9
|
+
* Warn the first time a key is seen in this process: loud enough to be read
|
|
10
|
+
* once, quiet enough not to drown a request log.
|
|
15
11
|
*/
|
|
16
12
|
function warnOnce(key, message) {
|
|
17
13
|
if (warned.has(key)) return;
|
|
@@ -20,20 +16,6 @@ function warnOnce(key, message) {
|
|
|
20
16
|
}
|
|
21
17
|
//#endregion
|
|
22
18
|
//#region src/storage/drivers/LocalDriver.ts
|
|
23
|
-
/**
|
|
24
|
-
* Local filesystem storage driver.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const driver = new LocalDriver({
|
|
29
|
-
* root: './storage/app',
|
|
30
|
-
* url: '/storage',
|
|
31
|
-
* })
|
|
32
|
-
*
|
|
33
|
-
* await driver.put('avatars/user-1.jpg', imageBuffer)
|
|
34
|
-
* const url = driver.url('avatars/user-1.jpg')
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
19
|
var LocalDriver = class {
|
|
38
20
|
root;
|
|
39
21
|
baseUrl;
|
|
@@ -43,19 +25,12 @@ var LocalDriver = class {
|
|
|
43
25
|
this.baseUrl = options.url ?? "";
|
|
44
26
|
this.defaultVisibility = options.visibility ?? "private";
|
|
45
27
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Get the full path for a file.
|
|
48
|
-
* Rejects paths that resolve outside the storage root (e.g. via `../`).
|
|
49
|
-
*/
|
|
50
28
|
fullPath(path) {
|
|
51
29
|
const root = resolve(this.root);
|
|
52
30
|
const candidate = resolve(root, path);
|
|
53
31
|
if (candidate !== root && !candidate.startsWith(root + sep)) throw new Error(`LocalDriver: path escapes the storage root: "${path}"`);
|
|
54
32
|
return candidate;
|
|
55
33
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Ensure the directory exists.
|
|
58
|
-
*/
|
|
59
34
|
async ensureDirectory(filePath) {
|
|
60
35
|
const dir = dirname(filePath);
|
|
61
36
|
if (!existsSync(dir)) await mkdir(dir, { recursive: true });
|
|
@@ -136,7 +111,7 @@ var LocalDriver = class {
|
|
|
136
111
|
url(path) {
|
|
137
112
|
return `${this.baseUrl}/${path}`;
|
|
138
113
|
}
|
|
139
|
-
async temporaryUrl(path,
|
|
114
|
+
async temporaryUrl(path, _expiration) {
|
|
140
115
|
return this.url(path);
|
|
141
116
|
}
|
|
142
117
|
async size(path) {
|
|
@@ -213,30 +188,23 @@ var LocalDriver = class {
|
|
|
213
188
|
if (requested === this.defaultVisibility) return;
|
|
214
189
|
warnOnce(`local-visibility-per-object:${operation}`, `[guren] LocalDriver.${operation}() was asked to make an object ${requested} on a ${this.defaultVisibility} disk, and did nothing. A local disk has no per-object visibility — what makes a file reachable is the disk root and whatever serves it — so the request was never carried out, it only looked like it was. Declare the disk's "visibility" option to match, or keep restricted files on a disk that is not served. This becomes an error in the next major.`);
|
|
215
190
|
}
|
|
216
|
-
/**
|
|
217
|
-
* Get the root directory.
|
|
218
|
-
*/
|
|
219
191
|
getRoot() {
|
|
220
192
|
return this.root;
|
|
221
193
|
}
|
|
222
194
|
};
|
|
223
195
|
//#endregion
|
|
224
196
|
//#region src/storage/drivers/s3-acl.ts
|
|
225
|
-
/** The canned ACL S3 uses for each visibility. */
|
|
226
197
|
function cannedAcl(visibility) {
|
|
227
198
|
return visibility === "public" ? "public-read" : "private";
|
|
228
199
|
}
|
|
229
200
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* explicit `ACL: undefined`, which some S3 implementations reject outright
|
|
233
|
-
* rather than treat as absent.
|
|
201
|
+
* Spreadable so the caller never sends an explicit `ACL: undefined`, which some
|
|
202
|
+
* S3 implementations reject outright rather than treat as absent.
|
|
234
203
|
*/
|
|
235
204
|
function putAclFields(acl, visibility) {
|
|
236
205
|
return acl ? { ACL: cannedAcl(visibility) } : {};
|
|
237
206
|
}
|
|
238
207
|
/**
|
|
239
|
-
* Guard for a per-object visibility an ACL-less endpoint cannot honour.
|
|
240
208
|
* Throws rather than silently dropping the request: a `setVisibility(path,
|
|
241
209
|
* 'private')` that does nothing on a public bucket is a leak that looks like
|
|
242
210
|
* success.
|
|
@@ -247,23 +215,7 @@ function assertVisibilitySupported(acl, diskVisibility, requested, operation) {
|
|
|
247
215
|
}
|
|
248
216
|
//#endregion
|
|
249
217
|
//#region src/storage/drivers/S3Driver.ts
|
|
250
|
-
/**
|
|
251
|
-
* AWS S3 storage driver.
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
* ```ts
|
|
255
|
-
* import { S3Client } from '@aws-sdk/client-s3'
|
|
256
|
-
*
|
|
257
|
-
* const client = new S3Client({ region: 'ap-northeast-1' })
|
|
258
|
-
* const driver = new S3Driver({
|
|
259
|
-
* client,
|
|
260
|
-
* bucket: 'my-bucket',
|
|
261
|
-
* })
|
|
262
|
-
*
|
|
263
|
-
* await driver.put('avatars/user-1.jpg', imageBuffer)
|
|
264
|
-
* const url = driver.url('avatars/user-1.jpg')
|
|
265
|
-
* ```
|
|
266
|
-
*/
|
|
218
|
+
/** AWS S3 storage driver. */
|
|
267
219
|
var S3Driver = class {
|
|
268
220
|
options;
|
|
269
221
|
capabilities = { presignedGet: true };
|
|
@@ -290,9 +242,6 @@ var S3Driver = class {
|
|
|
290
242
|
this.defaultVisibility = options.visibility ?? "private";
|
|
291
243
|
this.acl = options.acl ?? true;
|
|
292
244
|
}
|
|
293
|
-
/**
|
|
294
|
-
* Get or create the S3 client.
|
|
295
|
-
*/
|
|
296
245
|
async getClient() {
|
|
297
246
|
if (this.client) return this.client;
|
|
298
247
|
const { S3Client } = await importAwsModule("@aws-sdk/client-s3");
|
|
@@ -308,9 +257,6 @@ var S3Driver = class {
|
|
|
308
257
|
this.client = new S3Client(config);
|
|
309
258
|
return this.client;
|
|
310
259
|
}
|
|
311
|
-
/**
|
|
312
|
-
* Get the prefixed key.
|
|
313
|
-
*/
|
|
314
260
|
prefixKey(path) {
|
|
315
261
|
return this.prefix ? `${this.prefix}/${path}` : path;
|
|
316
262
|
}
|
|
@@ -485,9 +431,8 @@ var S3Driver = class {
|
|
|
485
431
|
return metadata;
|
|
486
432
|
}
|
|
487
433
|
/**
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
* silently truncates larger listings.
|
|
434
|
+
* Follows `NextContinuationToken` to exhaustion: one request returns at most
|
|
435
|
+
* 1000 entries, so a single-page read silently truncates larger listings.
|
|
491
436
|
*/
|
|
492
437
|
async listAll(input) {
|
|
493
438
|
const client = await this.getClient();
|
|
@@ -515,10 +460,9 @@ var S3Driver = class {
|
|
|
515
460
|
};
|
|
516
461
|
}
|
|
517
462
|
/**
|
|
518
|
-
* The
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
* `prefix//`, which matches nothing.
|
|
463
|
+
* The prefixed key with exactly one trailing slash, empty at the root —
|
|
464
|
+
* appending `/` to `prefixKey('')` on a prefixed disk yields `prefix//`,
|
|
465
|
+
* which matches nothing.
|
|
522
466
|
*/
|
|
523
467
|
listingPrefix(directory) {
|
|
524
468
|
const prefix = this.prefixKey(directory);
|
|
@@ -585,15 +529,9 @@ var S3Driver = class {
|
|
|
585
529
|
});
|
|
586
530
|
return (await client.send(command)).Grants?.some((grant) => grant.Grantee?.URI === "http://acs.amazonaws.com/groups/global/AllUsers" && grant.Permission === "READ") ? "public" : "private";
|
|
587
531
|
}
|
|
588
|
-
/**
|
|
589
|
-
* Get the bucket name.
|
|
590
|
-
*/
|
|
591
532
|
getBucket() {
|
|
592
533
|
return this.bucket;
|
|
593
534
|
}
|
|
594
|
-
/**
|
|
595
|
-
* Get the prefix.
|
|
596
|
-
*/
|
|
597
535
|
getPrefix() {
|
|
598
536
|
return this.prefix;
|
|
599
537
|
}
|
|
@@ -614,47 +552,25 @@ async function importAwsModule(moduleName) {
|
|
|
614
552
|
}
|
|
615
553
|
//#endregion
|
|
616
554
|
//#region src/storage/drivers/MemoryDriver.ts
|
|
617
|
-
/**
|
|
618
|
-
* In-memory storage driver for testing.
|
|
619
|
-
*
|
|
620
|
-
* @example
|
|
621
|
-
* ```ts
|
|
622
|
-
* const driver = new MemoryDriver()
|
|
623
|
-
*
|
|
624
|
-
* await driver.put('avatars/user-1.jpg', imageBuffer)
|
|
625
|
-
* const content = await driver.get('avatars/user-1.jpg')
|
|
626
|
-
* ```
|
|
627
|
-
*/
|
|
555
|
+
/** In-memory storage driver for testing. */
|
|
628
556
|
var MemoryDriver = class {
|
|
629
557
|
storage = /* @__PURE__ */ new Map();
|
|
630
558
|
baseUrl;
|
|
631
559
|
constructor(options = {}) {
|
|
632
560
|
this.baseUrl = options.url ?? "memory://";
|
|
633
561
|
}
|
|
634
|
-
/**
|
|
635
|
-
* Normalize path (remove leading/trailing slashes).
|
|
636
|
-
*/
|
|
637
562
|
normalizePath(path) {
|
|
638
563
|
return trimSlashes(path);
|
|
639
564
|
}
|
|
640
|
-
/**
|
|
641
|
-
* Get directory from path.
|
|
642
|
-
*/
|
|
643
565
|
getDirectory(path) {
|
|
644
566
|
return path.split("/").slice(0, -1).join("/");
|
|
645
567
|
}
|
|
646
|
-
/**
|
|
647
|
-
* Check if a path is in a directory.
|
|
648
|
-
*/
|
|
649
568
|
isInDirectory(filePath, directory) {
|
|
650
569
|
const normalized = this.normalizePath(filePath);
|
|
651
570
|
const normalizedDir = this.normalizePath(directory);
|
|
652
571
|
if (!normalizedDir) return !normalized.includes("/");
|
|
653
572
|
return normalized.startsWith(normalizedDir + "/") && !normalized.slice(normalizedDir.length + 1).includes("/");
|
|
654
573
|
}
|
|
655
|
-
/**
|
|
656
|
-
* Check if a path is under a directory (recursive).
|
|
657
|
-
*/
|
|
658
574
|
isUnderDirectory(filePath, directory) {
|
|
659
575
|
const normalized = this.normalizePath(filePath);
|
|
660
576
|
const normalizedDir = this.normalizePath(directory);
|
|
@@ -673,7 +589,7 @@ var MemoryDriver = class {
|
|
|
673
589
|
});
|
|
674
590
|
return normalized;
|
|
675
591
|
}
|
|
676
|
-
async putFile(
|
|
592
|
+
async putFile(_path, _localPath, _options) {
|
|
677
593
|
throw new Error("putFile is not supported in MemoryDriver");
|
|
678
594
|
}
|
|
679
595
|
async get(path) {
|
|
@@ -718,7 +634,7 @@ var MemoryDriver = class {
|
|
|
718
634
|
const normalized = this.normalizePath(path);
|
|
719
635
|
return `${this.baseUrl}/${normalized}`;
|
|
720
636
|
}
|
|
721
|
-
async temporaryUrl(path,
|
|
637
|
+
async temporaryUrl(path, _expiration) {
|
|
722
638
|
return this.url(path);
|
|
723
639
|
}
|
|
724
640
|
async size(path) {
|
|
@@ -768,7 +684,7 @@ var MemoryDriver = class {
|
|
|
768
684
|
for (const path of this.storage.keys()) if (this.isUnderDirectory(path, normalized)) result.push(path);
|
|
769
685
|
return result.sort();
|
|
770
686
|
}
|
|
771
|
-
async makeDirectory(
|
|
687
|
+
async makeDirectory(_path) {}
|
|
772
688
|
async deleteDirectory(path) {
|
|
773
689
|
const normalized = this.normalizePath(path);
|
|
774
690
|
const keysToDelete = [];
|
|
@@ -787,47 +703,19 @@ var MemoryDriver = class {
|
|
|
787
703
|
if (!file) throw new Error(`File not found: ${path}`);
|
|
788
704
|
return file.visibility;
|
|
789
705
|
}
|
|
790
|
-
/**
|
|
791
|
-
* Clear all files (for testing).
|
|
792
|
-
*/
|
|
706
|
+
/** Testing only. */
|
|
793
707
|
clear() {
|
|
794
708
|
this.storage.clear();
|
|
795
709
|
}
|
|
796
|
-
/**
|
|
797
|
-
* Get the number of stored files.
|
|
798
|
-
*/
|
|
799
710
|
count() {
|
|
800
711
|
return this.storage.size;
|
|
801
712
|
}
|
|
802
|
-
/**
|
|
803
|
-
* Get all stored file paths.
|
|
804
|
-
*/
|
|
805
713
|
getAllPaths() {
|
|
806
714
|
return Array.from(this.storage.keys());
|
|
807
715
|
}
|
|
808
716
|
};
|
|
809
717
|
//#endregion
|
|
810
718
|
//#region src/storage/StorageManager.ts
|
|
811
|
-
/**
|
|
812
|
-
* Storage manager for handling multiple storage disks.
|
|
813
|
-
*
|
|
814
|
-
* @example
|
|
815
|
-
* ```ts
|
|
816
|
-
* const storage = new StorageManager({
|
|
817
|
-
* default: 'local',
|
|
818
|
-
* disks: {
|
|
819
|
-
* local: { driver: 'local', root: './storage/app' },
|
|
820
|
-
* s3: { driver: 's3', bucket: 'my-bucket', region: 'ap-northeast-1' },
|
|
821
|
-
* }
|
|
822
|
-
* })
|
|
823
|
-
*
|
|
824
|
-
* // Use the default disk
|
|
825
|
-
* await storage.disk().put('avatars/user-1.jpg', imageBuffer)
|
|
826
|
-
*
|
|
827
|
-
* // Use a specific disk
|
|
828
|
-
* await storage.disk('s3').put('avatars/user-1.jpg', imageBuffer)
|
|
829
|
-
* ```
|
|
830
|
-
*/
|
|
831
719
|
var StorageManager = class {
|
|
832
720
|
defaultDiskName;
|
|
833
721
|
diskFactories = /* @__PURE__ */ new Map();
|
|
@@ -839,9 +727,6 @@ var StorageManager = class {
|
|
|
839
727
|
if (config.disks) for (const [name, diskConfig] of Object.entries(config.disks)) this.registerDiskFromConfig(name, diskConfig);
|
|
840
728
|
if (!this.diskFactories.has(this.defaultDiskName) && this.defaultDiskName === "local") this.diskFactories.set("local", () => new LocalDriver({ root: "./storage" }));
|
|
841
729
|
}
|
|
842
|
-
/**
|
|
843
|
-
* Register built-in disk drivers.
|
|
844
|
-
*/
|
|
845
730
|
registerBuiltinDrivers() {
|
|
846
731
|
this.driverFactories.set("local", (options) => {
|
|
847
732
|
return new LocalDriver(options);
|
|
@@ -853,19 +738,12 @@ var StorageManager = class {
|
|
|
853
738
|
return new MemoryDriver(options);
|
|
854
739
|
});
|
|
855
740
|
}
|
|
856
|
-
/**
|
|
857
|
-
* Register a disk from configuration.
|
|
858
|
-
*/
|
|
859
741
|
registerDiskFromConfig(name, config) {
|
|
860
742
|
const { driver, ...options } = config;
|
|
861
743
|
const factory = this.driverFactories.get(driver);
|
|
862
744
|
if (!factory) throw new Error(`Unknown storage driver: ${driver}`);
|
|
863
745
|
this.diskFactories.set(name, () => factory(options));
|
|
864
746
|
}
|
|
865
|
-
/**
|
|
866
|
-
* Get a storage disk by name.
|
|
867
|
-
* Returns the default disk if no name is specified.
|
|
868
|
-
*/
|
|
869
747
|
disk(name) {
|
|
870
748
|
const diskName = name ?? this.defaultDiskName;
|
|
871
749
|
const cached = this.resolvedDisks.get(diskName);
|
|
@@ -876,41 +754,23 @@ var StorageManager = class {
|
|
|
876
754
|
this.resolvedDisks.set(diskName, disk);
|
|
877
755
|
return disk;
|
|
878
756
|
}
|
|
879
|
-
/**
|
|
880
|
-
* Register a custom disk factory.
|
|
881
|
-
*/
|
|
882
757
|
registerDisk(name, factory) {
|
|
883
758
|
this.diskFactories.set(name, factory);
|
|
884
759
|
this.resolvedDisks.delete(name);
|
|
885
760
|
}
|
|
886
|
-
/**
|
|
887
|
-
* Register a custom driver.
|
|
888
|
-
*/
|
|
889
761
|
registerDriver(name, factory) {
|
|
890
762
|
this.driverFactories.set(name, factory);
|
|
891
763
|
}
|
|
892
|
-
/**
|
|
893
|
-
* Check if a disk is registered.
|
|
894
|
-
*/
|
|
895
764
|
hasDisk(name) {
|
|
896
765
|
return this.diskFactories.has(name);
|
|
897
766
|
}
|
|
898
|
-
/**
|
|
899
|
-
* Get the default disk name.
|
|
900
|
-
*/
|
|
901
767
|
getDefaultDiskName() {
|
|
902
768
|
return this.defaultDiskName;
|
|
903
769
|
}
|
|
904
|
-
/**
|
|
905
|
-
* Get all registered disk names.
|
|
906
|
-
*/
|
|
907
770
|
getDiskNames() {
|
|
908
771
|
return Array.from(this.diskFactories.keys());
|
|
909
772
|
}
|
|
910
773
|
};
|
|
911
|
-
/**
|
|
912
|
-
* Create a storage manager with configuration.
|
|
913
|
-
*/
|
|
914
774
|
function createStorageManager(config) {
|
|
915
775
|
return new StorageManager(config);
|
|
916
776
|
}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* doubled slash in the request path left the relative part rooted.
|
|
8
|
-
*
|
|
9
|
-
* Cheap, but not sufficient on its own: `resolve()` collapses `..` without
|
|
10
|
-
* following symlinks. Use {@link isRealPathWithin} before reading the file.
|
|
2
|
+
* Lexical containment. The trailing separator keeps out a sibling whose name
|
|
3
|
+
* merely extends the root's (`…/inertia` vs `…/inertia-secrets`) and rejects an
|
|
4
|
+
* absolute `candidate`, which `resolve()` returns verbatim. Not sufficient
|
|
5
|
+
* alone: `resolve()` collapses `..` without following symlinks, so use
|
|
6
|
+
* {@link isRealPathWithin} before reading the file.
|
|
11
7
|
*/
|
|
12
8
|
export declare function isPathWithin(root: string, candidate: string): boolean;
|
|
13
9
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* *Both* sides are canonicalized: a root reached through a symlink itself is
|
|
20
|
-
* routine (workspace and pnpm layouts, macOS `/var` → `/private/var`), and
|
|
21
|
-
* canonicalizing only the candidate would 404 every asset such an app serves.
|
|
22
|
-
*
|
|
23
|
-
* Call this on a path already known to exist — a path that does not exist
|
|
24
|
-
* cannot be read, and `realpath` rejects it, so either way this fails closed.
|
|
10
|
+
* Containment once both sides are canonicalized. Every reader downstream
|
|
11
|
+
* (`Bun.file().text()`, `new Response(file)`) follows symlinks, so a lexical
|
|
12
|
+
* check alone accepts `<root>/link/secret`. *Both* sides, because a root
|
|
13
|
+
* reached through a symlink is routine (macOS `/var` → `/private/var`) and
|
|
14
|
+
* doing only the candidate would 404 every asset such an app serves.
|
|
25
15
|
*/
|
|
26
16
|
export declare function isRealPathWithin(root: string, candidate: string): Promise<boolean>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Bun 1.x
|
|
3
|
-
* Error
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* a stack trace from a real Error onto whatever object was provided, ensuring third-party code
|
|
7
|
-
* keeps working regardless of Bun's stricter contract.
|
|
2
|
+
* Bun 1.x throws from Error.captureStackTrace unless the first argument is a
|
|
3
|
+
* real Error. Packages that pass plain objects (notably follow-redirects, which
|
|
4
|
+
* Node tolerates) then crash SSR boot before Inertia can import the SSR entry.
|
|
5
|
+
* This mirrors Node by copying a real Error's stack onto whatever it is given.
|
|
8
6
|
*/
|
|
9
7
|
export declare function ensureErrorStackTracePolyfill(): void;
|
package/dist/support/expiry.d.ts
CHANGED
|
@@ -1,47 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `@guren/server/support/expiry` subpath, so the database-backed stores and
|
|
8
|
-
* the Redis ones decide expiry with the same code. It lives in this package
|
|
9
|
-
* because `@guren/core` depends on `@guren/server` and not the other way
|
|
10
|
-
* around — core is unreachable from here without a dependency cycle.
|
|
11
|
-
*
|
|
12
|
-
* Not part of the public API: the subpath exists for that re-export, and
|
|
13
|
-
* neither package's index exposes these.
|
|
2
|
+
* The single copy of expiry coercion: `packages/core/src/store-utils.ts`
|
|
3
|
+
* re-exports these through the `@guren/server/support/expiry` subpath, so the
|
|
4
|
+
* database-backed and Redis stores decide expiry with the same code. It lives
|
|
5
|
+
* here because core depends on server and not the reverse. Not public API —
|
|
6
|
+
* neither package's index exposes it.
|
|
14
7
|
*/
|
|
15
8
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* milliseconds, and ISO strings. A Date wrapping garbage is a parse failure,
|
|
21
|
-
* not a value — `new Date(garbage)` yields an Invalid Date whose comparisons
|
|
22
|
-
* are all false, which is exactly how a corrupt expiry reads as "not past".
|
|
9
|
+
* Accepts every shape a driver or Redis value hands back: Date, number, bigint
|
|
10
|
+
* (MySQL / postgres.js BIGINT), digit-only strings as epoch milliseconds, ISO
|
|
11
|
+
* strings. An Invalid Date is a parse failure, not a value: its comparisons are
|
|
12
|
+
* all false, which is exactly how a corrupt expiry reads as "not past".
|
|
23
13
|
*/
|
|
24
14
|
export declare function toDate(value: unknown): Date | null;
|
|
25
15
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* accepted indefinitely. Use for sessions and OAuth state, whose writers always
|
|
30
|
-
* supply an expiry.
|
|
16
|
+
* For an expiry required to be present (sessions, OAuth state). Missing or
|
|
17
|
+
* unparseable counts as expired, so a malformed record is never accepted
|
|
18
|
+
* indefinitely.
|
|
31
19
|
*/
|
|
32
20
|
export declare function isExpired(value: unknown, now?: number): boolean;
|
|
33
21
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* malformed record and counts as expired — collapsing the two is the fail-open
|
|
38
|
-
* this exists to close. Use at the point of comparison, so the check holds for
|
|
39
|
-
* every store implementation including ones this package never sees.
|
|
22
|
+
* Absent means "never expires"; present-but-unparseable counts as expired.
|
|
23
|
+
* Collapsing the two is the fail-open this exists to close. Call it at the
|
|
24
|
+
* point of comparison so the rule holds for stores this package never sees.
|
|
40
25
|
*/
|
|
41
26
|
export declare function isOptionalExpiryPast(value: unknown, now?: number): boolean;
|
|
42
27
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* long-past date rather than to null, which would read as "never expires".
|
|
28
|
+
* Absent stays null; present-but-unparseable degrades to a long-past date
|
|
29
|
+
* rather than null, which would read as "never expires".
|
|
46
30
|
*/
|
|
47
31
|
export declare function toOptionalExpiry(value: unknown): Date | null;
|
package/dist/support/expiry.js
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
//#region src/support/expiry.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `@guren/server/support/expiry` subpath, so the database-backed stores and
|
|
9
|
-
* the Redis ones decide expiry with the same code. It lives in this package
|
|
10
|
-
* because `@guren/core` depends on `@guren/server` and not the other way
|
|
11
|
-
* around — core is unreachable from here without a dependency cycle.
|
|
12
|
-
*
|
|
13
|
-
* Not part of the public API: the subpath exists for that re-export, and
|
|
14
|
-
* neither package's index exposes these.
|
|
3
|
+
* The single copy of expiry coercion: `packages/core/src/store-utils.ts`
|
|
4
|
+
* re-exports these through the `@guren/server/support/expiry` subpath, so the
|
|
5
|
+
* database-backed and Redis stores decide expiry with the same code. It lives
|
|
6
|
+
* here because core depends on server and not the reverse. Not public API —
|
|
7
|
+
* neither package's index exposes it.
|
|
15
8
|
*/
|
|
16
9
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* milliseconds, and ISO strings. A Date wrapping garbage is a parse failure,
|
|
22
|
-
* not a value — `new Date(garbage)` yields an Invalid Date whose comparisons
|
|
23
|
-
* are all false, which is exactly how a corrupt expiry reads as "not past".
|
|
10
|
+
* Accepts every shape a driver or Redis value hands back: Date, number, bigint
|
|
11
|
+
* (MySQL / postgres.js BIGINT), digit-only strings as epoch milliseconds, ISO
|
|
12
|
+
* strings. An Invalid Date is a parse failure, not a value: its comparisons are
|
|
13
|
+
* all false, which is exactly how a corrupt expiry reads as "not past".
|
|
24
14
|
*/
|
|
25
15
|
function toDate(value) {
|
|
26
16
|
const date = coerceDate(value);
|
|
@@ -34,32 +24,26 @@ function coerceDate(value) {
|
|
|
34
24
|
return null;
|
|
35
25
|
}
|
|
36
26
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* accepted indefinitely. Use for sessions and OAuth state, whose writers always
|
|
41
|
-
* supply an expiry.
|
|
27
|
+
* For an expiry required to be present (sessions, OAuth state). Missing or
|
|
28
|
+
* unparseable counts as expired, so a malformed record is never accepted
|
|
29
|
+
* indefinitely.
|
|
42
30
|
*/
|
|
43
31
|
function isExpired(value, now = Date.now()) {
|
|
44
32
|
const date = toDate(value);
|
|
45
33
|
return date === null || date.getTime() <= now;
|
|
46
34
|
}
|
|
47
35
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* malformed record and counts as expired — collapsing the two is the fail-open
|
|
52
|
-
* this exists to close. Use at the point of comparison, so the check holds for
|
|
53
|
-
* every store implementation including ones this package never sees.
|
|
36
|
+
* Absent means "never expires"; present-but-unparseable counts as expired.
|
|
37
|
+
* Collapsing the two is the fail-open this exists to close. Call it at the
|
|
38
|
+
* point of comparison so the rule holds for stores this package never sees.
|
|
54
39
|
*/
|
|
55
40
|
function isOptionalExpiryPast(value, now = Date.now()) {
|
|
56
41
|
if (value == null) return false;
|
|
57
42
|
return isExpired(value, now);
|
|
58
43
|
}
|
|
59
44
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* long-past date rather than to null, which would read as "never expires".
|
|
45
|
+
* Absent stays null; present-but-unparseable degrades to a long-past date
|
|
46
|
+
* rather than null, which would read as "never expires".
|
|
63
47
|
*/
|
|
64
48
|
function toOptionalExpiry(value) {
|
|
65
49
|
if (value == null) return null;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
export interface ParseImportMapOptions {
|
|
2
|
-
/**
|
|
3
|
-
* Optional label describing the source of the import map.
|
|
4
|
-
* Used in warning logs when parsing fails.
|
|
5
|
-
*/
|
|
2
|
+
/** Label used in the parse-failure warning. */
|
|
6
3
|
context?: string;
|
|
7
4
|
}
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* merge optional overrides without additional filtering.
|
|
6
|
+
* Empty, null and undefined entries are dropped, so callers can merge optional
|
|
7
|
+
* overrides without filtering first.
|
|
12
8
|
*/
|
|
13
9
|
export declare function parseImportMap(value: string | undefined, options?: ParseImportMapOptions): Record<string, string>;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The stylesheet *source* path the dev asset configuration falls back to.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `mvc/inertia/InertiaEngine.ts` drops exactly this path again when a dev
|
|
8
|
-
* server owns the script entry (the compiled CSS then arrives through the
|
|
9
|
-
* module graph). Importing either of those modules from the other would drag
|
|
10
|
-
* runtime-specific dependencies across the Workers/Lambda boundary or create
|
|
11
|
-
* an import cycle.
|
|
2
|
+
* The stylesheet *source* path the dev asset configuration falls back to. A
|
|
3
|
+
* leaf module because two sides must agree on it: `http/inertia-assets.ts`
|
|
4
|
+
* publishes it into `GUREN_INERTIA_STYLES` and `mvc/inertia/InertiaEngine.ts`
|
|
5
|
+
* drops exactly this path when a dev server owns the script entry. Importing
|
|
6
|
+
* either from the other would cross the Workers/Lambda boundary or cycle.
|
|
12
7
|
*/
|
|
13
8
|
export declare const DEFAULT_DEV_STYLES_ENTRY = "/resources/css/app.css";
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Open-redirect classification shared by the redirect-safety middleware and the
|
|
3
|
+
* OAuth `redirectTo` sanitizer. Every hardening fix belongs here so the two
|
|
4
|
+
* layers cannot drift.
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
6
|
+
/** Defuses backslash tricks such as `/\evil.com`. */
|
|
7
7
|
export declare function normalizeRedirectTarget(value: string): string;
|
|
8
|
-
/** App-relative paths (`/path`, but not protocol-relative `//host`) are always safe. */
|
|
9
8
|
export declare function isAppRelativePath(value: string): boolean;
|
|
10
|
-
/** Match a URL's host against an allowlist supporting `*.example.com` wildcards. */
|
|
11
9
|
export declare function hostMatchesAllowlist(target: URL, allowedHosts: readonly string[]): boolean;
|