@guren/server 2.15.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-C8aejmi8.js → Hash-D2DFd8xX.js} +7 -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 +11 -39
- package/dist/agent/approval.d.ts +76 -187
- package/dist/agent/audit-emitter.d.ts +16 -44
- package/dist/agent/audit.d.ts +20 -56
- package/dist/agent/derive.d.ts +32 -66
- package/dist/agent/dispatch.d.ts +38 -90
- package/dist/agent/events.d.ts +11 -19
- package/dist/agent/meta-tools.d.ts +18 -46
- package/dist/agent/public.d.ts +6 -25
- package/dist/agent/public.js +1 -1
- 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 +5 -14
- package/dist/auth/password/PasswordHasher.d.ts +5 -13
- package/dist/auth/password/hash-format.d.ts +5 -13
- 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-DkYoAPVn.js → auth-CbdPH4Cd.js} +169 -502
- 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-BwodCA4q.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 +5 -26
- 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-erOS9epZ.js → dispatch-BAwzftws.js} +32 -79
- 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-D99Vmls3.js → encryption-uwP3Di4D.js} +9 -78
- 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 +13 -31
- 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 +11 -7
- package/dist/http/request.d.ts +32 -118
- 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 +10 -20
- 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 +2 -1
- package/dist/index.js +714 -3011
- package/dist/internal/agent-preflight.d.ts +9 -21
- package/dist/internal/request.d.ts +6 -19
- package/dist/internal/request.js +1 -1
- 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 -3
- package/dist/logging/channels/FileChannel.d.ts +1 -3
- package/dist/logging/daily-file-path.d.ts +7 -16
- package/dist/logging/index.js +1 -1
- package/dist/logging/types.d.ts +13 -45
- package/dist/{logging-B-kngi3q.js → logging-zOY1XCtq.js} +52 -141
- 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 -227
- 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 +50 -92
- 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-w_RSOvQW.js → vite-manifest-CTQp-SOo.js} +34 -58
- package/package.json +2 -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-CVQwpu2J.js +0 -129
|
@@ -1,65 +1,17 @@
|
|
|
1
1
|
import type { StorageDriver, StorageDriverFactory, StorageConfig } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Storage manager for handling multiple storage disks.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* const storage = new StorageManager({
|
|
8
|
-
* default: 'local',
|
|
9
|
-
* disks: {
|
|
10
|
-
* local: { driver: 'local', root: './storage/app' },
|
|
11
|
-
* s3: { driver: 's3', bucket: 'my-bucket', region: 'ap-northeast-1' },
|
|
12
|
-
* }
|
|
13
|
-
* })
|
|
14
|
-
*
|
|
15
|
-
* // Use the default disk
|
|
16
|
-
* await storage.disk().put('avatars/user-1.jpg', imageBuffer)
|
|
17
|
-
*
|
|
18
|
-
* // Use a specific disk
|
|
19
|
-
* await storage.disk('s3').put('avatars/user-1.jpg', imageBuffer)
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
2
|
export declare class StorageManager {
|
|
23
3
|
private readonly defaultDiskName;
|
|
24
4
|
private readonly diskFactories;
|
|
25
5
|
private readonly resolvedDisks;
|
|
26
6
|
private driverFactories;
|
|
27
7
|
constructor(config?: StorageConfig);
|
|
28
|
-
/**
|
|
29
|
-
* Register built-in disk drivers.
|
|
30
|
-
*/
|
|
31
8
|
private registerBuiltinDrivers;
|
|
32
|
-
/**
|
|
33
|
-
* Register a disk from configuration.
|
|
34
|
-
*/
|
|
35
9
|
private registerDiskFromConfig;
|
|
36
|
-
/**
|
|
37
|
-
* Get a storage disk by name.
|
|
38
|
-
* Returns the default disk if no name is specified.
|
|
39
|
-
*/
|
|
40
10
|
disk(name?: string): StorageDriver;
|
|
41
|
-
/**
|
|
42
|
-
* Register a custom disk factory.
|
|
43
|
-
*/
|
|
44
11
|
registerDisk(name: string, factory: StorageDriverFactory): void;
|
|
45
|
-
/**
|
|
46
|
-
* Register a custom driver.
|
|
47
|
-
*/
|
|
48
12
|
registerDriver(name: string, factory: (options: unknown) => StorageDriver): void;
|
|
49
|
-
/**
|
|
50
|
-
* Check if a disk is registered.
|
|
51
|
-
*/
|
|
52
13
|
hasDisk(name: string): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Get the default disk name.
|
|
55
|
-
*/
|
|
56
14
|
getDefaultDiskName(): string;
|
|
57
|
-
/**
|
|
58
|
-
* Get all registered disk names.
|
|
59
|
-
*/
|
|
60
15
|
getDiskNames(): string[];
|
|
61
16
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Create a storage manager with configuration.
|
|
64
|
-
*/
|
|
65
17
|
export declare function createStorageManager(config?: StorageConfig): StorageManager;
|
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
import type { StorageDriver, LocalDriverOptions, PutOptions, FileMetadata, GetStreamOptions } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Local filesystem storage driver.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* const driver = new LocalDriver({
|
|
8
|
-
* root: './storage/app',
|
|
9
|
-
* url: '/storage',
|
|
10
|
-
* })
|
|
11
|
-
*
|
|
12
|
-
* await driver.put('avatars/user-1.jpg', imageBuffer)
|
|
13
|
-
* const url = driver.url('avatars/user-1.jpg')
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
2
|
export declare class LocalDriver implements StorageDriver {
|
|
17
3
|
private readonly root;
|
|
18
4
|
private readonly baseUrl;
|
|
19
5
|
private readonly defaultVisibility;
|
|
20
6
|
constructor(options: LocalDriverOptions);
|
|
21
|
-
/**
|
|
22
|
-
* Get the full path for a file.
|
|
23
|
-
* Rejects paths that resolve outside the storage root (e.g. via `../`).
|
|
24
|
-
*/
|
|
25
7
|
private fullPath;
|
|
26
|
-
/**
|
|
27
|
-
* Ensure the directory exists.
|
|
28
|
-
*/
|
|
29
8
|
private ensureDirectory;
|
|
30
9
|
put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
|
|
31
10
|
putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
|
|
@@ -38,7 +17,7 @@ export declare class LocalDriver implements StorageDriver {
|
|
|
38
17
|
copy(from: string, to: string): Promise<string>;
|
|
39
18
|
move(from: string, to: string): Promise<string>;
|
|
40
19
|
url(path: string): string;
|
|
41
|
-
temporaryUrl(path: string,
|
|
20
|
+
temporaryUrl(path: string, _expiration: Date): Promise<string>;
|
|
42
21
|
size(path: string): Promise<number>;
|
|
43
22
|
lastModified(path: string): Promise<Date>;
|
|
44
23
|
metadata(path: string): Promise<FileMetadata | null>;
|
|
@@ -51,8 +30,5 @@ export declare class LocalDriver implements StorageDriver {
|
|
|
51
30
|
getVisibility(path: string): Promise<'public' | 'private'>;
|
|
52
31
|
private warnIfMissing;
|
|
53
32
|
private warnUnsupportedVisibility;
|
|
54
|
-
/**
|
|
55
|
-
* Get the root directory.
|
|
56
|
-
*/
|
|
57
33
|
getRoot(): string;
|
|
58
34
|
}
|
|
@@ -1,37 +1,15 @@
|
|
|
1
1
|
import type { StorageDriver, MemoryDriverOptions, PutOptions, FileMetadata } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* In-memory storage driver for testing.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* const driver = new MemoryDriver()
|
|
8
|
-
*
|
|
9
|
-
* await driver.put('avatars/user-1.jpg', imageBuffer)
|
|
10
|
-
* const content = await driver.get('avatars/user-1.jpg')
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
2
|
+
/** In-memory storage driver for testing. */
|
|
13
3
|
export declare class MemoryDriver implements StorageDriver {
|
|
14
4
|
private readonly storage;
|
|
15
5
|
private readonly baseUrl;
|
|
16
6
|
constructor(options?: MemoryDriverOptions);
|
|
17
|
-
/**
|
|
18
|
-
* Normalize path (remove leading/trailing slashes).
|
|
19
|
-
*/
|
|
20
7
|
private normalizePath;
|
|
21
|
-
/**
|
|
22
|
-
* Get directory from path.
|
|
23
|
-
*/
|
|
24
8
|
private getDirectory;
|
|
25
|
-
/**
|
|
26
|
-
* Check if a path is in a directory.
|
|
27
|
-
*/
|
|
28
9
|
private isInDirectory;
|
|
29
|
-
/**
|
|
30
|
-
* Check if a path is under a directory (recursive).
|
|
31
|
-
*/
|
|
32
10
|
private isUnderDirectory;
|
|
33
11
|
put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
|
|
34
|
-
putFile(
|
|
12
|
+
putFile(_path: string, _localPath: string, _options?: PutOptions): Promise<string>;
|
|
35
13
|
get(path: string): Promise<Buffer | null>;
|
|
36
14
|
getAsString(path: string): Promise<string | null>;
|
|
37
15
|
exists(path: string): Promise<boolean>;
|
|
@@ -40,27 +18,19 @@ export declare class MemoryDriver implements StorageDriver {
|
|
|
40
18
|
copy(from: string, to: string): Promise<string>;
|
|
41
19
|
move(from: string, to: string): Promise<string>;
|
|
42
20
|
url(path: string): string;
|
|
43
|
-
temporaryUrl(path: string,
|
|
21
|
+
temporaryUrl(path: string, _expiration: Date): Promise<string>;
|
|
44
22
|
size(path: string): Promise<number>;
|
|
45
23
|
lastModified(path: string): Promise<Date>;
|
|
46
24
|
metadata(path: string): Promise<FileMetadata | null>;
|
|
47
25
|
files(directory: string): Promise<string[]>;
|
|
48
26
|
directories(directory: string): Promise<string[]>;
|
|
49
27
|
allFiles(directory: string): Promise<string[]>;
|
|
50
|
-
makeDirectory(
|
|
28
|
+
makeDirectory(_path: string): Promise<void>;
|
|
51
29
|
deleteDirectory(path: string): Promise<void>;
|
|
52
30
|
setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
|
|
53
31
|
getVisibility(path: string): Promise<'public' | 'private'>;
|
|
54
|
-
/**
|
|
55
|
-
* Clear all files (for testing).
|
|
56
|
-
*/
|
|
32
|
+
/** Testing only. */
|
|
57
33
|
clear(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Get the number of stored files.
|
|
60
|
-
*/
|
|
61
34
|
count(): number;
|
|
62
|
-
/**
|
|
63
|
-
* Get all stored file paths.
|
|
64
|
-
*/
|
|
65
35
|
getAllPaths(): string[];
|
|
66
36
|
}
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import type { StorageDriver, S3DriverOptions, PutOptions, FileMetadata, GetStreamOptions, TemporaryUrlOptions, StorageDriverCapabilities } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* AWS S3 storage driver.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* import { S3Client } from '@aws-sdk/client-s3'
|
|
8
|
-
*
|
|
9
|
-
* const client = new S3Client({ region: 'ap-northeast-1' })
|
|
10
|
-
* const driver = new S3Driver({
|
|
11
|
-
* client,
|
|
12
|
-
* bucket: 'my-bucket',
|
|
13
|
-
* })
|
|
14
|
-
*
|
|
15
|
-
* await driver.put('avatars/user-1.jpg', imageBuffer)
|
|
16
|
-
* const url = driver.url('avatars/user-1.jpg')
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
2
|
+
/** AWS S3 storage driver. */
|
|
19
3
|
export declare class S3Driver implements StorageDriver {
|
|
20
4
|
private readonly options;
|
|
21
5
|
readonly capabilities: StorageDriverCapabilities;
|
|
@@ -30,13 +14,7 @@ export declare class S3Driver implements StorageDriver {
|
|
|
30
14
|
private readonly defaultVisibility;
|
|
31
15
|
private readonly acl;
|
|
32
16
|
constructor(options: S3DriverOptions);
|
|
33
|
-
/**
|
|
34
|
-
* Get or create the S3 client.
|
|
35
|
-
*/
|
|
36
17
|
private getClient;
|
|
37
|
-
/**
|
|
38
|
-
* Get the prefixed key.
|
|
39
|
-
*/
|
|
40
18
|
private prefixKey;
|
|
41
19
|
put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
|
|
42
20
|
putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
|
|
@@ -56,16 +34,14 @@ export declare class S3Driver implements StorageDriver {
|
|
|
56
34
|
/** `metadata()`, but honouring the contract's not-found error. */
|
|
57
35
|
private metadataOrFail;
|
|
58
36
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* silently truncates larger listings.
|
|
37
|
+
* Follows `NextContinuationToken` to exhaustion: one request returns at most
|
|
38
|
+
* 1000 entries, so a single-page read silently truncates larger listings.
|
|
62
39
|
*/
|
|
63
40
|
private listAll;
|
|
64
41
|
/**
|
|
65
|
-
* The
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* `prefix//`, which matches nothing.
|
|
42
|
+
* The prefixed key with exactly one trailing slash, empty at the root —
|
|
43
|
+
* appending `/` to `prefixKey('')` on a prefixed disk yields `prefix//`,
|
|
44
|
+
* which matches nothing.
|
|
69
45
|
*/
|
|
70
46
|
private listingPrefix;
|
|
71
47
|
files(directory: string): Promise<string[]>;
|
|
@@ -75,12 +51,6 @@ export declare class S3Driver implements StorageDriver {
|
|
|
75
51
|
deleteDirectory(path: string): Promise<void>;
|
|
76
52
|
setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
|
|
77
53
|
getVisibility(path: string): Promise<'public' | 'private'>;
|
|
78
|
-
/**
|
|
79
|
-
* Get the bucket name.
|
|
80
|
-
*/
|
|
81
54
|
getBucket(): string;
|
|
82
|
-
/**
|
|
83
|
-
* Get the prefix.
|
|
84
|
-
*/
|
|
85
55
|
getPrefix(): string;
|
|
86
56
|
}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* for every S3-compatible endpoint without ACL support.
|
|
2
|
+
* Kept out of the driver so it can be tested without the optional
|
|
3
|
+
* `@aws-sdk/client-s3` peer installed: these functions decide what goes into a
|
|
4
|
+
* command, the part that was wrong for every endpoint without ACL support.
|
|
6
5
|
*/
|
|
7
6
|
export type Visibility = 'public' | 'private';
|
|
8
|
-
/** The canned ACL S3 uses for each visibility. */
|
|
9
7
|
export declare function cannedAcl(visibility: Visibility): string;
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* explicit `ACL: undefined`, which some S3 implementations reject outright
|
|
14
|
-
* rather than treat as absent.
|
|
9
|
+
* Spreadable so the caller never sends an explicit `ACL: undefined`, which some
|
|
10
|
+
* S3 implementations reject outright rather than treat as absent.
|
|
15
11
|
*/
|
|
16
12
|
export declare function putAclFields(acl: boolean, visibility: Visibility): {
|
|
17
13
|
ACL?: string;
|
|
18
14
|
};
|
|
19
15
|
/**
|
|
20
|
-
* Guard for a per-object visibility an ACL-less endpoint cannot honour.
|
|
21
16
|
* Throws rather than silently dropping the request: a `setVisibility(path,
|
|
22
17
|
* 'private')` that does nothing on a public bucket is a leak that looks like
|
|
23
18
|
* success.
|
package/dist/storage/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-
|
|
1
|
+
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-BB59f07j.js";
|
|
2
2
|
export { LocalDriver, MemoryDriver, S3Driver, StorageManager, createStorageManager };
|
package/dist/storage/types.d.ts
CHANGED
|
@@ -1,67 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for putting files.
|
|
3
|
-
*/
|
|
4
1
|
export interface PutOptions {
|
|
5
|
-
/**
|
|
6
|
-
* File visibility.
|
|
7
|
-
*/
|
|
8
2
|
visibility?: 'public' | 'private';
|
|
9
|
-
/**
|
|
10
|
-
* Content type (MIME type).
|
|
11
|
-
*/
|
|
12
3
|
contentType?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Custom metadata.
|
|
15
|
-
*/
|
|
16
4
|
metadata?: Record<string, string>;
|
|
17
5
|
}
|
|
18
|
-
/**
|
|
19
|
-
* File metadata.
|
|
20
|
-
*/
|
|
21
6
|
export interface FileMetadata {
|
|
22
|
-
/**
|
|
23
|
-
* File path.
|
|
24
|
-
*/
|
|
25
7
|
path: string;
|
|
26
|
-
/**
|
|
27
|
-
* File size in bytes.
|
|
28
|
-
*/
|
|
8
|
+
/** Size in bytes. */
|
|
29
9
|
size: number;
|
|
30
|
-
/**
|
|
31
|
-
* Last modified date.
|
|
32
|
-
*/
|
|
33
10
|
lastModified: Date;
|
|
34
|
-
/**
|
|
35
|
-
* Content type (if available).
|
|
36
|
-
*/
|
|
37
11
|
contentType?: string;
|
|
38
|
-
/**
|
|
39
|
-
* File visibility.
|
|
40
|
-
*/
|
|
41
12
|
visibility?: 'public' | 'private';
|
|
42
|
-
/**
|
|
43
|
-
* Custom metadata.
|
|
44
|
-
*/
|
|
45
13
|
metadata?: Record<string, string>;
|
|
46
14
|
}
|
|
47
15
|
/**
|
|
48
|
-
* Response
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* (S3: `ResponseContentDisposition` / `ResponseContentType` on the presigned
|
|
52
|
-
* `GetObjectCommand`) so Content-Disposition and Content-Type policy
|
|
53
|
-
* survives a redirect to the bucket. A driver that cannot honour them
|
|
54
|
-
* ignores them and serves its own object metadata — a caller that needs the
|
|
55
|
-
* guarantee must proxy the bytes instead.
|
|
16
|
+
* Response overrides for presigned URLs — RFC 0015 §3. A driver that cannot
|
|
17
|
+
* honour them ignores them and serves its own object metadata; a caller that
|
|
18
|
+
* needs the guarantee must proxy the bytes instead.
|
|
56
19
|
*/
|
|
57
20
|
export interface TemporaryUrlOptions {
|
|
58
21
|
responseContentDisposition?: string;
|
|
59
22
|
responseContentType?: string;
|
|
60
23
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Streaming-read options. `range` is byte-inclusive (`start`..`end`, `end`
|
|
63
|
-
* omitted = to end of file), matching HTTP Range semantics.
|
|
64
|
-
*/
|
|
24
|
+
/** `range` is byte-inclusive, `end` omitted = to end of file (HTTP Range semantics). */
|
|
65
25
|
export interface GetStreamOptions {
|
|
66
26
|
range?: {
|
|
67
27
|
start: number;
|
|
@@ -70,277 +30,89 @@ export interface GetStreamOptions {
|
|
|
70
30
|
}
|
|
71
31
|
/**
|
|
72
32
|
* Capabilities a driver positively declares — RFC 0015 §3. Absent means
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* misclassify exactly the disk that must not redirect.
|
|
33
|
+
* unavailable (fail-closed), never probed: `LocalDriver.temporaryUrl()`
|
|
34
|
+
* succeeds and returns a plain public URL, so a probe would misclassify
|
|
35
|
+
* exactly the disk that must not redirect.
|
|
77
36
|
*/
|
|
78
37
|
export interface StorageDriverCapabilities {
|
|
79
38
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* must NOT declare this: its `temporaryUrl()` is the plain public URL.
|
|
39
|
+
* URL whose signature the backend itself enforces (S3-style presign), not
|
|
40
|
+
* merely a URL. `LocalDriver` must NOT declare this.
|
|
83
41
|
*/
|
|
84
42
|
presignedGet?: boolean;
|
|
85
43
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Storage driver interface.
|
|
88
|
-
*/
|
|
89
44
|
export interface StorageDriver {
|
|
90
|
-
/**
|
|
91
|
-
* Capabilities the delivery layer may rely on. Absent ⇒ none declared.
|
|
92
|
-
*/
|
|
93
45
|
readonly capabilities?: StorageDriverCapabilities;
|
|
94
|
-
/**
|
|
95
|
-
* Put a file into storage.
|
|
96
|
-
* @param path File path
|
|
97
|
-
* @param content File content
|
|
98
|
-
* @param options Put options
|
|
99
|
-
* @returns The stored file path
|
|
100
|
-
*/
|
|
101
46
|
put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
|
|
102
|
-
/**
|
|
103
|
-
* Put a file from a local path.
|
|
104
|
-
* @param path Destination path
|
|
105
|
-
* @param localPath Local file path
|
|
106
|
-
* @param options Put options
|
|
107
|
-
* @returns The stored file path
|
|
108
|
-
*/
|
|
109
47
|
putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
|
|
110
|
-
/**
|
|
111
|
-
* Get file contents.
|
|
112
|
-
* @param path File path
|
|
113
|
-
* @returns File contents or null if not found
|
|
114
|
-
*/
|
|
115
48
|
get(path: string): Promise<Buffer | null>;
|
|
116
|
-
/**
|
|
117
|
-
* Get file contents as string.
|
|
118
|
-
* @param path File path
|
|
119
|
-
* @returns File contents as string or null if not found
|
|
120
|
-
*/
|
|
121
49
|
getAsString(path: string): Promise<string | null>;
|
|
122
|
-
/**
|
|
123
|
-
* Check if a file exists.
|
|
124
|
-
* @param path File path
|
|
125
|
-
*/
|
|
126
50
|
exists(path: string): Promise<boolean>;
|
|
127
|
-
/**
|
|
128
|
-
* Delete a file.
|
|
129
|
-
* @param path File path
|
|
130
|
-
* @returns True if deleted, false if not found
|
|
131
|
-
*/
|
|
51
|
+
/** Resolves false when the file did not exist. */
|
|
132
52
|
delete(path: string): Promise<boolean>;
|
|
133
|
-
/**
|
|
134
|
-
* Delete multiple files.
|
|
135
|
-
* @param paths File paths
|
|
136
|
-
* @returns Number of deleted files
|
|
137
|
-
*/
|
|
138
53
|
deleteMany(paths: string[]): Promise<number>;
|
|
139
|
-
/**
|
|
140
|
-
* Copy a file.
|
|
141
|
-
* @param from Source path
|
|
142
|
-
* @param to Destination path
|
|
143
|
-
* @returns The destination path
|
|
144
|
-
*/
|
|
145
54
|
copy(from: string, to: string): Promise<string>;
|
|
146
|
-
/**
|
|
147
|
-
* Move a file.
|
|
148
|
-
* @param from Source path
|
|
149
|
-
* @param to Destination path
|
|
150
|
-
* @returns The destination path
|
|
151
|
-
*/
|
|
152
55
|
move(from: string, to: string): Promise<string>;
|
|
153
|
-
/**
|
|
154
|
-
* Get the public URL for a file.
|
|
155
|
-
* @param path File path
|
|
156
|
-
*/
|
|
157
56
|
url(path: string): string;
|
|
158
|
-
/**
|
|
159
|
-
* Get a temporary (signed) URL for a file.
|
|
160
|
-
* @param path File path
|
|
161
|
-
* @param expiration Expiration date
|
|
162
|
-
* @param options Response overrides for presigning drivers (ignored by
|
|
163
|
-
* drivers that cannot honour them — see TemporaryUrlOptions)
|
|
164
|
-
*/
|
|
165
57
|
temporaryUrl(path: string, expiration: Date, options?: TemporaryUrlOptions): Promise<string>;
|
|
166
58
|
/**
|
|
167
|
-
*
|
|
168
|
-
* `
|
|
169
|
-
*
|
|
170
|
-
* Contract: resolves `null` for a missing file, verified *before* the
|
|
171
|
-
* stream is returned (a stream whose open fails after return cannot
|
|
172
|
-
* honour that), and the result is normalized to the global web
|
|
173
|
-
* `ReadableStream` at the driver's own boundary (`Readable.toWeb`,
|
|
174
|
-
* `Body.transformToWebStream()`, or a cast where the runtime's stream
|
|
175
|
-
* type is structurally compatible).
|
|
176
|
-
*
|
|
177
|
-
* @param path File path
|
|
178
|
-
* @param options Optional byte range
|
|
59
|
+
* Optional — callers fall back to buffered `get()` where absent. Resolves
|
|
60
|
+
* `null` for a missing file, verified *before* the stream is returned, and
|
|
61
|
+
* normalizes the result to the global web `ReadableStream`.
|
|
179
62
|
*/
|
|
180
63
|
getStream?(path: string, options?: GetStreamOptions): Promise<ReadableStream<Uint8Array> | null>;
|
|
181
|
-
/**
|
|
182
|
-
* Get the file size in bytes.
|
|
183
|
-
* @param path File path
|
|
184
|
-
*/
|
|
185
64
|
size(path: string): Promise<number>;
|
|
186
|
-
/**
|
|
187
|
-
* Get the last modified date.
|
|
188
|
-
* @param path File path
|
|
189
|
-
*/
|
|
190
65
|
lastModified(path: string): Promise<Date>;
|
|
191
|
-
/**
|
|
192
|
-
* Get file metadata.
|
|
193
|
-
* @param path File path
|
|
194
|
-
*/
|
|
195
66
|
metadata(path: string): Promise<FileMetadata | null>;
|
|
196
|
-
/**
|
|
197
|
-
* List files in a directory.
|
|
198
|
-
* @param directory Directory path
|
|
199
|
-
*/
|
|
200
67
|
files(directory: string): Promise<string[]>;
|
|
201
|
-
/**
|
|
202
|
-
* List subdirectories in a directory.
|
|
203
|
-
* @param directory Directory path
|
|
204
|
-
*/
|
|
205
68
|
directories(directory: string): Promise<string[]>;
|
|
206
|
-
/**
|
|
207
|
-
* List all files recursively.
|
|
208
|
-
* @param directory Directory path
|
|
209
|
-
*/
|
|
210
69
|
allFiles(directory: string): Promise<string[]>;
|
|
211
|
-
/**
|
|
212
|
-
* Create a directory.
|
|
213
|
-
* @param path Directory path
|
|
214
|
-
*/
|
|
215
70
|
makeDirectory(path: string): Promise<void>;
|
|
216
|
-
/**
|
|
217
|
-
* Delete a directory and its contents.
|
|
218
|
-
* @param path Directory path
|
|
219
|
-
*/
|
|
220
71
|
deleteDirectory(path: string): Promise<void>;
|
|
221
72
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* the disk's configured visibility and throws when asked for the other
|
|
228
|
-
* value, rather than accepting a request it cannot honour — silently
|
|
229
|
-
* doing nothing is a leak that looks like success.
|
|
230
|
-
*
|
|
231
|
-
* `LocalDriver` is such a backend: what makes a local file reachable is
|
|
232
|
-
* the disk root and whatever serves it, not a flag on one file. It has
|
|
233
|
-
* always accepted per-object requests and done nothing, so it warns
|
|
234
|
-
* instead of throwing and will throw in the next major.
|
|
235
|
-
*
|
|
236
|
-
* @param path File path
|
|
237
|
-
* @param visibility Visibility setting
|
|
73
|
+
* Throws when the file does not exist, so success is not proof the object is
|
|
74
|
+
* there. A driver with no per-object visibility reports the disk's configured
|
|
75
|
+
* value and throws when asked for the other one: silently doing nothing is a
|
|
76
|
+
* leak that looks like success. `LocalDriver` is such a backend, and warns
|
|
77
|
+
* today rather than throwing only because it has always accepted these.
|
|
238
78
|
*/
|
|
239
79
|
setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
|
|
240
80
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* Contract: throws when the file does not exist. Drivers without
|
|
244
|
-
* per-object visibility report the disk's configured value.
|
|
245
|
-
*
|
|
246
|
-
* @param path File path
|
|
81
|
+
* Throws when the file does not exist. Drivers without per-object visibility
|
|
82
|
+
* report the disk's configured value.
|
|
247
83
|
*/
|
|
248
84
|
getVisibility(path: string): Promise<'public' | 'private'>;
|
|
249
85
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Storage driver factory function.
|
|
252
|
-
*/
|
|
253
86
|
export type StorageDriverFactory = () => StorageDriver;
|
|
254
|
-
/**
|
|
255
|
-
* Local driver options.
|
|
256
|
-
*/
|
|
257
87
|
export interface LocalDriverOptions {
|
|
258
|
-
/**
|
|
259
|
-
* Root directory for file storage.
|
|
260
|
-
*/
|
|
261
88
|
root: string;
|
|
262
|
-
/**
|
|
263
|
-
* Base URL for public files.
|
|
264
|
-
*/
|
|
265
89
|
url?: string;
|
|
266
|
-
/**
|
|
267
|
-
* Default visibility for new files.
|
|
268
|
-
* @default 'private'
|
|
269
|
-
*/
|
|
90
|
+
/** @default 'private' */
|
|
270
91
|
visibility?: 'public' | 'private';
|
|
271
92
|
}
|
|
272
|
-
/**
|
|
273
|
-
* S3 driver options.
|
|
274
|
-
*/
|
|
275
93
|
export interface S3DriverOptions {
|
|
276
|
-
/**
|
|
277
|
-
* S3 client instance (@aws-sdk/client-s3).
|
|
278
|
-
*/
|
|
279
94
|
client?: unknown;
|
|
280
|
-
/**
|
|
281
|
-
* S3 bucket name.
|
|
282
|
-
*/
|
|
283
95
|
bucket: string;
|
|
284
|
-
/**
|
|
285
|
-
* AWS region.
|
|
286
|
-
*/
|
|
287
96
|
region?: string;
|
|
288
|
-
/**
|
|
289
|
-
* Custom endpoint URL.
|
|
290
|
-
*/
|
|
291
97
|
endpoint?: string;
|
|
292
|
-
/**
|
|
293
|
-
* Access key ID.
|
|
294
|
-
*/
|
|
295
98
|
accessKeyId?: string;
|
|
296
|
-
/**
|
|
297
|
-
* Secret access key.
|
|
298
|
-
*/
|
|
299
99
|
secretAccessKey?: string;
|
|
300
|
-
/**
|
|
301
|
-
* Key prefix.
|
|
302
|
-
*/
|
|
303
100
|
prefix?: string;
|
|
304
|
-
/**
|
|
305
|
-
* Base URL for public files.
|
|
306
|
-
*/
|
|
307
101
|
url?: string;
|
|
308
|
-
/**
|
|
309
|
-
* Default visibility for new files.
|
|
310
|
-
* @default 'private'
|
|
311
|
-
*/
|
|
102
|
+
/** @default 'private' */
|
|
312
103
|
visibility?: 'public' | 'private';
|
|
313
104
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
* S3-compatible endpoints do not: Cloudflare R2 documents `x-amz-acl` and
|
|
319
|
-
* the ACL operations as unsupported (access is decided per bucket), and
|
|
320
|
-
* MinIO/others vary. Set `acl: false` for those.
|
|
321
|
-
*
|
|
322
|
-
* With `acl: false` the driver stops sending the header, and visibility
|
|
323
|
-
* becomes a property of the whole disk: `getVisibility()` reports the
|
|
324
|
-
* configured `visibility`, and `put({ visibility })` / `setVisibility()`
|
|
325
|
-
* throw when asked for the other value rather than silently not applying
|
|
326
|
-
* it. Enforce per-object access in front of the disk instead.
|
|
327
|
-
*
|
|
105
|
+
* AWS S3 implements object ACLs, so every `put` carries `x-amz-acl` derived
|
|
106
|
+
* from visibility. Cloudflare R2 documents it as unsupported and MinIO/others
|
|
107
|
+
* vary: set `acl: false` there, which makes visibility a property of the whole
|
|
108
|
+
* disk and turns a mismatched `put`/`setVisibility` into a throw.
|
|
328
109
|
* @default true
|
|
329
110
|
*/
|
|
330
111
|
acl?: boolean;
|
|
331
112
|
}
|
|
332
|
-
/**
|
|
333
|
-
* Memory driver options.
|
|
334
|
-
*/
|
|
335
113
|
export interface MemoryDriverOptions {
|
|
336
|
-
/**
|
|
337
|
-
* Base URL for public files.
|
|
338
|
-
*/
|
|
339
114
|
url?: string;
|
|
340
115
|
}
|
|
341
|
-
/**
|
|
342
|
-
* Driver configuration union type.
|
|
343
|
-
*/
|
|
344
116
|
export type DriverConfig = ({
|
|
345
117
|
driver: 'local';
|
|
346
118
|
} & LocalDriverOptions) | ({
|
|
@@ -349,17 +121,7 @@ export type DriverConfig = ({
|
|
|
349
121
|
driver: 'memory';
|
|
350
122
|
} & MemoryDriverOptions);
|
|
351
123
|
export type DiskConfig = DriverConfig;
|
|
352
|
-
/**
|
|
353
|
-
* Storage configuration.
|
|
354
|
-
*/
|
|
355
124
|
export interface StorageConfig {
|
|
356
|
-
/**
|
|
357
|
-
* Default disk name.
|
|
358
|
-
* @default 'local'
|
|
359
|
-
*/
|
|
360
125
|
default?: string;
|
|
361
|
-
/**
|
|
362
|
-
* Disk configurations.
|
|
363
|
-
*/
|
|
364
126
|
disks?: Record<string, DriverConfig>;
|
|
365
127
|
}
|