@dimah-s3/server 1.7.0 → 2.0.0-beta.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/README.md +72 -16
- package/dist/adapters/express.d.ts +7 -7
- package/dist/adapters/express.d.ts.map +1 -1
- package/dist/adapters/express.js +73 -96
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/fastify.d.ts +11 -5
- package/dist/adapters/fastify.d.ts.map +1 -1
- package/dist/adapters/fastify.js +73 -96
- package/dist/adapters/fastify.js.map +1 -1
- package/dist/adapters/node.d.ts +20 -3
- package/dist/adapters/node.d.ts.map +1 -1
- package/dist/adapters/node.js +71 -94
- package/dist/adapters/node.js.map +1 -1
- package/dist/api/context.d.ts +8 -4
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/{routes/index.d.ts → core-endpoints.d.ts} +43 -68
- package/dist/api/core-endpoints.d.ts.map +1 -0
- package/dist/api/create-s3-endpoint.d.ts +70 -48
- package/dist/api/create-s3-endpoint.d.ts.map +1 -1
- package/dist/api/create-s3-middleware.d.ts +19 -16
- package/dist/api/create-s3-middleware.d.ts.map +1 -1
- package/dist/api/router-context.d.ts +23 -0
- package/dist/api/router-context.d.ts.map +1 -0
- package/dist/api/router.d.ts +15 -5
- package/dist/api/router.d.ts.map +1 -1
- package/dist/config/feature-toggle.d.ts +16 -0
- package/dist/config/feature-toggle.d.ts.map +1 -0
- package/dist/config/resolve-config.d.ts +9 -0
- package/dist/config/resolve-config.d.ts.map +1 -0
- package/dist/config/resolve-routes.d.ts +37 -0
- package/dist/config/resolve-routes.d.ts.map +1 -0
- package/dist/dimah-s3.d.ts +22 -32
- package/dist/dimah-s3.d.ts.map +1 -1
- package/dist/helpers/authorize-download.d.ts +25 -0
- package/dist/helpers/authorize-download.d.ts.map +1 -0
- package/dist/helpers/aws-errors.d.ts +16 -0
- package/dist/helpers/aws-errors.d.ts.map +1 -0
- package/dist/helpers/best-effort.d.ts +22 -3
- package/dist/helpers/best-effort.d.ts.map +1 -1
- package/dist/helpers/checksum-config.d.ts +13 -0
- package/dist/helpers/checksum-config.d.ts.map +1 -0
- package/dist/helpers/constraints.d.ts +17 -12
- package/dist/helpers/constraints.d.ts.map +1 -1
- package/dist/helpers/error-boundary.d.ts +28 -0
- package/dist/helpers/error-boundary.d.ts.map +1 -0
- package/dist/helpers/finalize-confirmed.d.ts +42 -13
- package/dist/helpers/finalize-confirmed.d.ts.map +1 -1
- package/dist/helpers/head-object.d.ts +6 -9
- package/dist/helpers/head-object.d.ts.map +1 -1
- package/dist/helpers/hooks.d.ts +29 -15
- package/dist/helpers/hooks.d.ts.map +1 -1
- package/dist/helpers/inline-types.d.ts +24 -7
- package/dist/helpers/inline-types.d.ts.map +1 -1
- package/dist/helpers/list-parts.d.ts +4 -6
- package/dist/helpers/list-parts.d.ts.map +1 -1
- package/dist/helpers/metadata-encoding.d.ts +15 -0
- package/dist/helpers/metadata-encoding.d.ts.map +1 -0
- package/dist/helpers/object-meta.d.ts +39 -0
- package/dist/helpers/object-meta.d.ts.map +1 -0
- package/dist/helpers/object-s3.d.ts +5 -2
- package/dist/helpers/object-s3.d.ts.map +1 -1
- package/dist/helpers/open-target.d.ts +89 -0
- package/dist/helpers/open-target.d.ts.map +1 -0
- package/dist/helpers/part-layout.d.ts +19 -0
- package/dist/helpers/part-layout.d.ts.map +1 -0
- package/dist/helpers/presign.d.ts +54 -0
- package/dist/helpers/presign.d.ts.map +1 -0
- package/dist/helpers/request.d.ts +6 -11
- package/dist/helpers/request.d.ts.map +1 -1
- package/dist/helpers/resolve-target.d.ts +28 -20
- package/dist/helpers/resolve-target.d.ts.map +1 -1
- package/dist/helpers/sniff-object.d.ts +22 -0
- package/dist/helpers/sniff-object.d.ts.map +1 -0
- package/dist/helpers/ticket.d.ts +75 -0
- package/dist/helpers/ticket.d.ts.map +1 -0
- package/dist/index.d.ts +4 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2647 -1579
- package/dist/index.js.map +1 -1
- package/dist/operations/catalog.d.ts +16 -0
- package/dist/operations/catalog.d.ts.map +1 -0
- package/dist/operations/confirm.d.ts +19 -0
- package/dist/operations/confirm.d.ts.map +1 -0
- package/dist/operations/delete-many.d.ts +18 -0
- package/dist/operations/delete-many.d.ts.map +1 -0
- package/dist/operations/delete.d.ts +14 -0
- package/dist/operations/delete.d.ts.map +1 -0
- package/dist/operations/download.d.ts +20 -0
- package/dist/operations/download.d.ts.map +1 -0
- package/dist/operations/file.d.ts +38 -0
- package/dist/operations/file.d.ts.map +1 -0
- package/dist/operations/multipart/abort.d.ts +20 -0
- package/dist/operations/multipart/abort.d.ts.map +1 -0
- package/dist/operations/multipart/complete.d.ts +21 -0
- package/dist/operations/multipart/complete.d.ts.map +1 -0
- package/dist/operations/multipart/init.d.ts +19 -0
- package/dist/operations/multipart/init.d.ts.map +1 -0
- package/dist/operations/multipart/list-parts.d.ts +11 -0
- package/dist/operations/multipart/list-parts.d.ts.map +1 -0
- package/dist/operations/multipart/open-multipart.d.ts +25 -0
- package/dist/operations/multipart/open-multipart.d.ts.map +1 -0
- package/dist/operations/multipart/sign-part.d.ts +20 -0
- package/dist/operations/multipart/sign-part.d.ts.map +1 -0
- package/dist/operations/put.d.ts +18 -0
- package/dist/operations/put.d.ts.map +1 -0
- package/dist/operations/run-operation.d.ts +18 -0
- package/dist/operations/run-operation.d.ts.map +1 -0
- package/dist/operations/s3-api.d.ts +12 -0
- package/dist/operations/s3-api.d.ts.map +1 -0
- package/dist/operations/upload.d.ts +19 -0
- package/dist/operations/upload.d.ts.map +1 -0
- package/dist/plugin/apply-plugins.d.ts +9 -11
- package/dist/plugin/apply-plugins.d.ts.map +1 -1
- package/dist/plugin/chain-hooks.d.ts +12 -9
- package/dist/plugin/chain-hooks.d.ts.map +1 -1
- package/dist/plugin/define-plugin.d.ts +11 -4
- package/dist/plugin/define-plugin.d.ts.map +1 -1
- package/dist/plugin/index.d.ts +1 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +52 -56
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugins.d.ts +10 -8
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +325 -1627
- package/dist/plugins.js.map +1 -1
- package/dist/route.d.ts +0 -1
- package/dist/route.d.ts.map +1 -1
- package/dist/types/config.d.ts +171 -172
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/hook-contexts.d.ts +139 -147
- package/dist/types/hook-contexts.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/locals.d.ts +37 -0
- package/dist/types/locals.d.ts.map +1 -0
- package/dist/types/resolved.d.ts +118 -0
- package/dist/types/resolved.d.ts.map +1 -0
- package/package.json +9 -13
- package/dist/api/bind-endpoints.d.ts +0 -12
- package/dist/api/bind-endpoints.d.ts.map +0 -1
- package/dist/api/index.d.ts +0 -6
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -1353
- package/dist/api/index.js.map +0 -1
- package/dist/api/routes/catalog.d.ts +0 -9
- package/dist/api/routes/catalog.d.ts.map +0 -1
- package/dist/api/routes/confirm.d.ts +0 -13
- package/dist/api/routes/confirm.d.ts.map +0 -1
- package/dist/api/routes/delete-batch.d.ts +0 -14
- package/dist/api/routes/delete-batch.d.ts.map +0 -1
- package/dist/api/routes/delete.d.ts +0 -26
- package/dist/api/routes/delete.d.ts.map +0 -1
- package/dist/api/routes/download.d.ts +0 -21
- package/dist/api/routes/download.d.ts.map +0 -1
- package/dist/api/routes/file.d.ts +0 -20
- package/dist/api/routes/file.d.ts.map +0 -1
- package/dist/api/routes/index.d.ts.map +0 -1
- package/dist/api/routes/multipart/abort.d.ts +0 -16
- package/dist/api/routes/multipart/abort.d.ts.map +0 -1
- package/dist/api/routes/multipart/complete.d.ts +0 -22
- package/dist/api/routes/multipart/complete.d.ts.map +0 -1
- package/dist/api/routes/multipart/init.d.ts +0 -22
- package/dist/api/routes/multipart/init.d.ts.map +0 -1
- package/dist/api/routes/multipart/list-parts.d.ts +0 -17
- package/dist/api/routes/multipart/list-parts.d.ts.map +0 -1
- package/dist/api/routes/multipart/part.d.ts +0 -20
- package/dist/api/routes/multipart/part.d.ts.map +0 -1
- package/dist/api/routes/upload.d.ts +0 -22
- package/dist/api/routes/upload.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -23
- package/dist/errors.d.ts.map +0 -1
- package/dist/helpers/expires.d.ts +0 -21
- package/dist/helpers/expires.d.ts.map +0 -1
- package/dist/helpers/features.d.ts +0 -17
- package/dist/helpers/features.d.ts.map +0 -1
- package/dist/helpers/index.d.ts +0 -19
- package/dist/helpers/index.d.ts.map +0 -1
- package/dist/helpers/is-aws-not-found.d.ts +0 -5
- package/dist/helpers/is-aws-not-found.d.ts.map +0 -1
- package/dist/helpers/previous-key.d.ts +0 -5
- package/dist/helpers/previous-key.d.ts.map +0 -1
- package/dist/helpers/resolve-route.d.ts +0 -33
- package/dist/helpers/resolve-route.d.ts.map +0 -1
- package/dist/plugin/hook-registry.d.ts +0 -21
- package/dist/plugin/hook-registry.d.ts.map +0 -1
- package/dist/put.d.ts +0 -15
- package/dist/put.d.ts.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type UploadObject } from "./resolve-target.js";
|
|
2
|
+
import { type TicketEnv, type UploadTicket } from "./ticket.js";
|
|
3
|
+
import type { GuardContext, ObjectContext, RouteGuardContext, UploadFile, UploadGuardContext, UploadKind } from "../types/hook-contexts.js";
|
|
4
|
+
import type { OpenedRoute, ResolvedConfig, ResolvedRoute, RouteFeature } from "../types/resolved.js";
|
|
5
|
+
type RouteConfig = Pick<ResolvedConfig, "routes">;
|
|
6
|
+
export type OpenedRouteContext<F extends RouteFeature> = {
|
|
7
|
+
route: OpenedRoute<F>;
|
|
8
|
+
context: RouteGuardContext;
|
|
9
|
+
};
|
|
10
|
+
export type OpenedObject<F extends RouteFeature> = {
|
|
11
|
+
route: OpenedRoute<F>;
|
|
12
|
+
context: ObjectContext;
|
|
13
|
+
};
|
|
14
|
+
/** The named route. Fails with `UNKNOWN_ROUTE`. */
|
|
15
|
+
export declare function getRoute(config: RouteConfig, name: string): ResolvedRoute;
|
|
16
|
+
/** Fails with `FEATURE_DISABLED` unless `feature` is on for the route. */
|
|
17
|
+
export declare function assertFeature<F extends RouteFeature>(route: ResolvedRoute, feature: F): asserts route is OpenedRoute<F>;
|
|
18
|
+
/** Looks up the route, checks the feature and runs the route guard. */
|
|
19
|
+
export declare function openRoute<F extends RouteFeature>(config: RouteConfig, context: GuardContext, name: string, feature: F): Promise<OpenedRouteContext<F>>;
|
|
20
|
+
/**
|
|
21
|
+
* {@link openRoute} for a stored object (download, `/file`, delete): the key
|
|
22
|
+
* must be inside the route namespace (`KEY_INVALID`).
|
|
23
|
+
*/
|
|
24
|
+
export declare function openObject<F extends RouteFeature>(config: RouteConfig, context: GuardContext, input: {
|
|
25
|
+
route: string;
|
|
26
|
+
key: string;
|
|
27
|
+
}, feature: F): Promise<OpenedObject<F>>;
|
|
28
|
+
export type UploadTargetInput = {
|
|
29
|
+
route: string;
|
|
30
|
+
file: UploadFile;
|
|
31
|
+
/** Client extras. Never written to S3 automatically. */
|
|
32
|
+
clientMetadata?: Record<string, string>;
|
|
33
|
+
/** SHA-256 the client sent. A presign needs one when the route requires it. */
|
|
34
|
+
checksum?: string;
|
|
35
|
+
/** S3 metadata written over `upload.object().metadata` (`s3.put`). */
|
|
36
|
+
metadata?: Record<string, string>;
|
|
37
|
+
};
|
|
38
|
+
export type OpenedUploadTarget<F extends "upload" | "multipart"> = {
|
|
39
|
+
route: OpenedRoute<F>;
|
|
40
|
+
/** Context `upload.guard` ran with, and the base of `onStart`. */
|
|
41
|
+
context: UploadGuardContext;
|
|
42
|
+
object: UploadObject;
|
|
43
|
+
/** New upload token: the marker value and the ticket id. */
|
|
44
|
+
uploadToken: string;
|
|
45
|
+
/**
|
|
46
|
+
* Subject to bind the ticket to, resolved after the instance and route
|
|
47
|
+
* guards, the same point at which {@link openTicket} checks it. `s3.put`
|
|
48
|
+
* has no ticket, so it never has one.
|
|
49
|
+
*/
|
|
50
|
+
ticketSubject?: string;
|
|
51
|
+
/** S3 user metadata to write: encoded, with the marker and previous key. */
|
|
52
|
+
s3Metadata: Record<string, string>;
|
|
53
|
+
/** `Content-Type` to write: the declared type, else `application/octet-stream`. */
|
|
54
|
+
contentType: string;
|
|
55
|
+
/** `Content-Disposition` to write, with the declared name. */
|
|
56
|
+
contentDisposition: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Opens a new upload (presign, multipart init or `s3.put`), in this order:
|
|
60
|
+
*
|
|
61
|
+
* 1. The route, with `upload` on (`upload.multipart` for multipart), and
|
|
62
|
+
* the route guard.
|
|
63
|
+
* 2. The ticket subject (none for `s3.put`).
|
|
64
|
+
* 3. The declared file against `fileTypes`, `maxFileSize` and, for a
|
|
65
|
+
* single PUT, POST or `s3.put`, S3's 5 GiB cap. A presign must send a
|
|
66
|
+
* checksum when the route requires one (`CHECKSUM_REQUIRED`).
|
|
67
|
+
* 4. `upload.object()` and the S3 metadata, whose size is checked here.
|
|
68
|
+
* 5. `upload.guard`, with the key that will be written.
|
|
69
|
+
*
|
|
70
|
+
* The cheap checks come first, so a bad request never reaches your
|
|
71
|
+
* `upload.object()` or guard. The caller then writes or presigns, and runs
|
|
72
|
+
* `upload.onStart`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function openUploadTarget<K extends UploadKind>(config: RouteConfig & Pick<TicketEnv, "ticketSubject">, context: GuardContext, input: UploadTargetInput, kind: K): Promise<OpenedUploadTarget<K extends "multipart" ? "multipart" : "upload">>;
|
|
75
|
+
export type OpenedTicket<F extends "upload" | "multipart"> = {
|
|
76
|
+
route: OpenedRoute<F>;
|
|
77
|
+
ticket: UploadTicket<F extends "multipart" ? "multipart" : "single">;
|
|
78
|
+
context: ObjectContext;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Opens a call that carries an upload ticket: confirm (`upload`) or a
|
|
82
|
+
* multipart call (`multipart`). The ticket is verified first, then its route
|
|
83
|
+
* must exist with the feature on and its key must be inside the route
|
|
84
|
+
* namespace, else `UPLOAD_TICKET_INVALID`. The route guard runs next, and a
|
|
85
|
+
* bound ticket must then match the subject of this call.
|
|
86
|
+
*/
|
|
87
|
+
export declare function openTicket<F extends "upload" | "multipart">(config: RouteConfig & TicketEnv, context: GuardContext, token: string, feature: F): Promise<OpenedTicket<F>>;
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=open-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-target.d.ts","sourceRoot":"","sources":["../../src/helpers/open-target.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,EACb,MAAM,kBAAkB,CAAC;AAQ1B,KAAK,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAElD,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,YAAY,IAAI;IACvD,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,YAAY,IAAI;IACjD,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,mDAAmD;AACnD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,EA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AE,MAAM,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,mFAAmF;IACnF,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAKF;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EACzD,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,EACtD,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,CAAC,GACN,OAAO,CAAC,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,GAAG,QAAQ,CAAC,CAAC,CA2D7E;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,QAAQ,GAAG,WAAW,IAAI;IAC3D,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,GAAG,QAAQ,CAAC,CAAC;IACrE,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,QAAQ,GAAG,WAAW,EAC/D,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,GACT,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CA4B1B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** How a multipart upload is split. Every part but the last has `partSize` bytes. */
|
|
2
|
+
export type PartLayout = {
|
|
3
|
+
/** Total object size in bytes. */
|
|
4
|
+
size: number;
|
|
5
|
+
partSize: number;
|
|
6
|
+
partCount: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The server-chosen part layout for an object of `size` bytes. The part size
|
|
10
|
+
* starts at `preferred` (8 MiB by default), grows so the upload needs at most
|
|
11
|
+
* 10,000 parts, is rounded up to a whole MiB, and stays within S3's part
|
|
12
|
+
* limits. Over 5 TiB fails with `FILE_TOO_LARGE`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function partLayout(size: number, preferred?: number): PartLayout;
|
|
15
|
+
/** Byte size of part `partNumber` (1-based). The last part holds the rest. */
|
|
16
|
+
export declare function partByteSize(layout: PartLayout, partNumber: number): number;
|
|
17
|
+
/** Fails with `MULTIPART_PART_INVALID` unless `1 ≤ partNumber ≤ partCount`. */
|
|
18
|
+
export declare function assertPartNumber(layout: PartLayout, partNumber: number): void;
|
|
19
|
+
//# sourceMappingURL=part-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part-layout.d.ts","sourceRoot":"","sources":["../../src/helpers/part-layout.ts"],"names":[],"mappings":"AAWA,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG;IACvB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAgBvE;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAW7E"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type S3Client } from "@aws-sdk/client-s3";
|
|
2
|
+
import { type PresignedPost } from "@aws-sdk/s3-presigned-post";
|
|
3
|
+
import { type S3ObjectAcl } from "@dimah-s3/core";
|
|
4
|
+
import type { ObjectS3Headers } from "../types/hook-contexts.js";
|
|
5
|
+
/** A presigned request. Send exactly `headers` with it. */
|
|
6
|
+
export type PresignedRequest = {
|
|
7
|
+
url: string;
|
|
8
|
+
headers: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
export type PresignPutInput = ObjectS3Headers & {
|
|
11
|
+
bucket: string;
|
|
12
|
+
key: string;
|
|
13
|
+
/** Exact body size. It is signed. */
|
|
14
|
+
size: number;
|
|
15
|
+
contentType: string;
|
|
16
|
+
contentDisposition: string;
|
|
17
|
+
/** S3 user metadata, already encoded. */
|
|
18
|
+
metadata: Record<string, string>;
|
|
19
|
+
acl: S3ObjectAcl;
|
|
20
|
+
/** Base64 SHA-256 of the body. S3 rejects any other body. */
|
|
21
|
+
checksum?: string;
|
|
22
|
+
expiresIn: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Presigns PutObject. Every header the upload needs is signed, including
|
|
26
|
+
* `x-amz-meta-*`, the ACL, tagging, storage class and checksum, so the URL
|
|
27
|
+
* cannot be used to write anything else.
|
|
28
|
+
*/
|
|
29
|
+
export declare function presignPut(client: S3Client, input: PresignPutInput): Promise<PresignedRequest>;
|
|
30
|
+
export type PresignUploadPartInput = {
|
|
31
|
+
bucket: string;
|
|
32
|
+
key: string;
|
|
33
|
+
uploadId: string;
|
|
34
|
+
partNumber: number;
|
|
35
|
+
/** Exact part size from the part layout. It is signed. */
|
|
36
|
+
size: number;
|
|
37
|
+
/** Base64 SHA-256 of the part. */
|
|
38
|
+
checksum?: string;
|
|
39
|
+
expiresIn: number;
|
|
40
|
+
};
|
|
41
|
+
/** Presigns UploadPart with its size and checksum signed. */
|
|
42
|
+
export declare function presignUploadPart(client: S3Client, input: PresignUploadPartInput): Promise<PresignedRequest>;
|
|
43
|
+
/**
|
|
44
|
+
* Presigns a POST form upload. Every field is an exact-match policy
|
|
45
|
+
* condition, the key is pinned with an `eq` condition, the size is pinned
|
|
46
|
+
* with `content-length-range`, and a checksum adds the `x-amz-checksum-*`
|
|
47
|
+
* fields with explicit `eq` conditions.
|
|
48
|
+
*
|
|
49
|
+
* A key that contains the `${filename}` placeholder fails with
|
|
50
|
+
* `KEY_INVALID`: the SDK would sign it as a `starts-with` condition, and the
|
|
51
|
+
* client would pick the object key.
|
|
52
|
+
*/
|
|
53
|
+
export declare function presignPost(client: S3Client, input: PresignPutInput): Promise<PresignedPost>;
|
|
54
|
+
//# sourceMappingURL=presign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presign.d.ts","sourceRoot":"","sources":["../../src/helpers/presign.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAqB7D,2DAA2D;AAC3D,MAAM,MAAM,gBAAgB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,GAAG,EAAE,WAAW,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAiC3B;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAe3B;AAoDD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,aAAa,CAAC,CAuCxB"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function requestFromHeaders(headers?: HeadersInit): Request;
|
|
1
|
+
import type { ResolvedConfig } from "../types/resolved.js";
|
|
3
2
|
/**
|
|
4
|
-
* Request for
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* invocation passes `body` / `query` as objects and leaves `request` to us.
|
|
3
|
+
* Request for an in-process call that did not pass one: a GET to the API
|
|
4
|
+
* base URL (`baseURL`, else `http://localhost` plus `basePath`) carrying the
|
|
5
|
+
* call headers and signal.
|
|
8
6
|
*/
|
|
9
|
-
export declare function
|
|
10
|
-
method: string;
|
|
11
|
-
pathname: string;
|
|
7
|
+
export declare function syntheticRequest(config: Pick<ResolvedConfig, "basePath" | "baseURL">, init?: {
|
|
12
8
|
headers?: HeadersInit;
|
|
13
|
-
|
|
14
|
-
body?: unknown;
|
|
9
|
+
signal?: AbortSignal;
|
|
15
10
|
}): Request;
|
|
16
11
|
//# sourceMappingURL=request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/helpers/request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/helpers/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,SAAS,CAAC,EACpD,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACzD,OAAO,CAKT"}
|
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ObjectS3Headers,
|
|
3
|
-
|
|
1
|
+
import { type S3ObjectAcl } from "@dimah-s3/core";
|
|
2
|
+
import type { ObjectS3Headers, UploadObjectContext } from "../types/hook-contexts.js";
|
|
3
|
+
import type { ResolvedRoute, ResolvedUpload } from "../types/resolved.js";
|
|
4
|
+
type RouteKeyPrefix = ResolvedRoute["keyPrefix"];
|
|
5
|
+
/** Object identity for a new upload, from `upload.object()` and the route. */
|
|
6
|
+
export type UploadObject = ObjectS3Headers & {
|
|
4
7
|
key: string;
|
|
5
8
|
bucket: string;
|
|
6
|
-
metadata?: Record<string, string>;
|
|
7
9
|
acl: S3ObjectAcl;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
export { normalizeObjectKey };
|
|
10
|
+
/** User metadata from `upload.object()`, not yet encoded. */
|
|
11
|
+
metadata?: Record<string, string>;
|
|
12
|
+
/** Safe key under the route `keyPrefix` to delete after confirm. */
|
|
13
|
+
previousKey?: string;
|
|
14
|
+
};
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Normalizes an object key: strips surrounding slashes and rejects empty,
|
|
17
|
+
* `.` and `..` segments, NUL and backslashes with `KEY_INVALID`.
|
|
18
18
|
*/
|
|
19
19
|
export declare function assertSafeObjectKey(key: string): string;
|
|
20
20
|
/** Nest `key` under `keyPrefix`. `false` leaves a safe key unchanged. */
|
|
21
21
|
export declare function nestKeyUnderPrefix(keyPrefix: RouteKeyPrefix, key: string): string;
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* A stored key for confirm, download, delete and multipart calls: safe, and
|
|
24
|
+
* inside the route namespace. Fails with `KEY_INVALID`.
|
|
25
|
+
*/
|
|
23
26
|
export declare function assertStoredKey(key: string, keyPrefix: RouteKeyPrefix): string;
|
|
24
|
-
/** `{folder}/{uuid}/{sanitizedName}
|
|
27
|
+
/** `{folder}/{uuid}/{sanitizedName}`. A `false` folder gives `{uuid}/{name}`. */
|
|
25
28
|
export declare function generateObjectKey(folder: string | false, fileName: string): string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Runs `upload.object()` and resolves the object it describes. `key` wins
|
|
31
|
+
* over `keyFolder`, and both nest under the route `keyPrefix`. Without
|
|
32
|
+
* either, the key is `{keyPrefix}/{uuid}/{name}`. Errors from `object()`
|
|
33
|
+
* propagate unchanged.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveUploadObject(route: Pick<ResolvedRoute, "keyPrefix"> & {
|
|
36
|
+
upload: ResolvedUpload;
|
|
37
|
+
}, context: UploadObjectContext): Promise<UploadObject>;
|
|
38
|
+
export {};
|
|
31
39
|
//# sourceMappingURL=resolve-target.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-target.d.ts","sourceRoot":"","sources":["../../src/helpers/resolve-target.ts"],"names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AAC,YAAY,CAAC,CAwBvB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type S3Client } from "@aws-sdk/client-s3";
|
|
2
|
+
export type ObjectContentInput = {
|
|
3
|
+
bucket: string;
|
|
4
|
+
key: string;
|
|
5
|
+
/** Content type as HeadObject reports it. */
|
|
6
|
+
type?: string;
|
|
7
|
+
/** Stored file name. Gives the type of an untyped object. */
|
|
8
|
+
name?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* `verifyContent`: reads the first {@link SNIFF_BYTE_LENGTH} bytes with a
|
|
12
|
+
* ranged GetObject and checks them against the type's magic bytes. A
|
|
13
|
+
* mismatch fails with `FILE_CONTENT_MISMATCH`; the caller deletes the object.
|
|
14
|
+
*
|
|
15
|
+
* An untyped object (no type, or `application/octet-stream`) is checked
|
|
16
|
+
* against the type downloads infer from its name, since `/file` and the
|
|
17
|
+
* presigned GET serve it inline as that type. Types without a known
|
|
18
|
+
* signature, such as `text/plain`, and untyped objects whose name gives no
|
|
19
|
+
* type cannot be verified this way and pass without a read.
|
|
20
|
+
*/
|
|
21
|
+
export declare function assertObjectContent(client: S3Client, input: ObjectContentInput): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=sniff-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sniff-object.d.ts","sourceRoot":"","sources":["../../src/helpers/sniff-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAc5B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,IAAI,CAAC,CAWf"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type S3ObjectAcl } from "@dimah-s3/core";
|
|
2
|
+
import type { RouteGuardContext, S3Operation, UploadFile } from "../types/hook-contexts.js";
|
|
3
|
+
import type { ResolvedConfig } from "../types/resolved.js";
|
|
4
|
+
/** Ticket fields and how a ticket call reads secrets and the subject. */
|
|
5
|
+
export type TicketEnv = Pick<ResolvedConfig, "secret" | "ticketSubject" | "logger">;
|
|
6
|
+
export type TicketMode = "single" | "multipart";
|
|
7
|
+
type TicketBase = {
|
|
8
|
+
/** Upload token: the marker value, and `uploadToken` in hooks. */
|
|
9
|
+
id: string;
|
|
10
|
+
route: string;
|
|
11
|
+
key: string;
|
|
12
|
+
/** File declared at presign or init. */
|
|
13
|
+
file: UploadFile;
|
|
14
|
+
/** ACL signed at presign or written at init, after `upload.object()`. */
|
|
15
|
+
acl: S3ObjectAcl;
|
|
16
|
+
/** Whether every upload request must carry a SHA-256 checksum. */
|
|
17
|
+
checksum: boolean;
|
|
18
|
+
expiresAt: Date;
|
|
19
|
+
};
|
|
20
|
+
export type SingleTicket = TicketBase & {
|
|
21
|
+
mode: "single";
|
|
22
|
+
/** How the URL was presigned, so confirm reports the kind that was signed. */
|
|
23
|
+
kind: "post" | "put";
|
|
24
|
+
};
|
|
25
|
+
export type MultipartTicket = TicketBase & {
|
|
26
|
+
mode: "multipart";
|
|
27
|
+
uploadId: string;
|
|
28
|
+
partSize: number;
|
|
29
|
+
partCount: number;
|
|
30
|
+
};
|
|
31
|
+
/** What a ticket carries, as {@link issueTicket} takes it. */
|
|
32
|
+
export type UploadTicketInput = SingleTicket | MultipartTicket;
|
|
33
|
+
/** A verified ticket, as {@link readTicket} returns it. */
|
|
34
|
+
export type UploadTicket<M extends TicketMode = TicketMode> = Extract<UploadTicketInput, {
|
|
35
|
+
mode: M;
|
|
36
|
+
}> & {
|
|
37
|
+
issuedAt: Date;
|
|
38
|
+
/** Keyed hash of the subject the ticket is bound to. */
|
|
39
|
+
subjectHash?: string;
|
|
40
|
+
};
|
|
41
|
+
/** A new upload token: 16 random bytes in base64url. */
|
|
42
|
+
export declare function createUploadToken(): string;
|
|
43
|
+
/**
|
|
44
|
+
* Checks the `secret` option when `dimahS3()` runs. Every value must have
|
|
45
|
+
* at least 32 characters. Returns `undefined` when it is not set, so the
|
|
46
|
+
* environment is read on first use.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseSecretOption(secret: string | readonly string[] | undefined): readonly string[] | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Signs a ticket. With a `subject`, the ticket is bound to it. Returns the
|
|
51
|
+
* ticket and its expiry, rounded down to the second as the ticket stores it.
|
|
52
|
+
*/
|
|
53
|
+
export declare function issueTicket(env: TicketEnv, input: UploadTicketInput, subject?: string): Promise<{
|
|
54
|
+
ticket: string;
|
|
55
|
+
expiresAt: Date;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Verifies a ticket for one operation. The signature is checked against
|
|
59
|
+
* every rotation key, then the payload, the mode and the expiry. `abort`
|
|
60
|
+
* accepts a ticket for 7 days after it expires.
|
|
61
|
+
*
|
|
62
|
+
* Fails with `UPLOAD_TICKET_INVALID` or `UPLOAD_TICKET_EXPIRED`. The route,
|
|
63
|
+
* the key and the subject are checked by the caller.
|
|
64
|
+
*/
|
|
65
|
+
export declare function readTicket<M extends TicketMode>(env: TicketEnv, ticket: string, options: {
|
|
66
|
+
mode: M;
|
|
67
|
+
operation: S3Operation;
|
|
68
|
+
}): Promise<UploadTicket<M>>;
|
|
69
|
+
/**
|
|
70
|
+
* Checks that a bound ticket is used by the same subject. The subject is
|
|
71
|
+
* recomputed for `context`; a ticket without a subject passes.
|
|
72
|
+
*/
|
|
73
|
+
export declare function assertTicketSubject(env: TicketEnv, ticket: UploadTicket, context: RouteGuardContext): Promise<void>;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=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C,SAAS,UAAU,GAAG,UAAU,IAAI,OAAO,CACnE,iBAAiB,EACjB;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CACZ,GAAG;IACF,QAAQ,EAAE,IAAI,CAAC;IACf,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAkCF,wDAAwD;AACxD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,GAC7C,SAAS,MAAM,EAAE,GAAG,SAAS,CAY/B;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,iBAAiB,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAE,CAAC,CAkC9C;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,UAAU,EACnD,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,SAAS,EAAE,WAAW,CAAA;CAAE,GAC3C,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAW1B;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CASf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
export { dimahS3 } from "./dimah-s3";
|
|
2
|
-
export {
|
|
3
|
-
export type { PutObjectInput } from "./put";
|
|
4
|
-
export type { DimahS3, DimahS3Api, MultipartAliasApi } from "./dimah-s3";
|
|
2
|
+
export type { DimahS3 } from "./dimah-s3";
|
|
5
3
|
export { route } from "./route";
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
9
|
-
export type { S3EndpointContext } from "./api";
|
|
10
|
-
export { chainHooks, definePlugin } from "./plugin";
|
|
11
|
-
export type { DimahS3Plugin, DimahS3PluginHooks, PluginContextMap, PluginEndpointMap, PluginInitEnv, } from "./plugin";
|
|
12
|
-
export { ROUTE_FEATURES, ROUTE_OPERATIONS } from "./types";
|
|
13
|
-
export { isFeatureOn } from "./helpers";
|
|
14
|
-
export type { DeleteConfig, DeleteGuardContext, DeleteOnDeletedContext, DimahS3Config, DimahS3Logger, DimahS3RouteConfig, DisabledFeature, DownloadConfig, DownloadGuardContext, DownloadOnPresignedContext, DownloadResolveInfo, EnabledFeature, EnabledUploadConfig, FeatureToggle, GuardContext, MultipartConfig, MultipartOnAbortContext, MultipartOnInitContext, MultipartOnListContext, MultipartGuardContext, MultipartUploadContext, ObjectFile, ObjectS3Headers, OpenedRoute, ResolvedDimahS3Config, ResolvedFeature, ResolvedRoute, ResolvedUploadConfig, RouteFeature, RouteGuardContext, RouteOperation, StoredObjectContext, UploadConfig, UploadConfirmGuardContext, UploadGuardContext, UploadObjectContext, UploadObjectInfo, UploadOnConfirmedContext, UploadOnPresignedContext, } from "./types";
|
|
4
|
+
export { chainHooks } from "./plugin";
|
|
5
|
+
export { APIError, isAPIError, isS3ErrorCode, s3Error, S3_ERROR_CODES, } from "@dimah-s3/core";
|
|
6
|
+
export type { DeleteConfig, DeleteGuardContext, DeleteOnDeletedContext, DimahS3Api, DimahS3Config, DimahS3Locals, DimahS3Logger, DimahS3RouteConfig, DimahS3RoutePluginOptions, DownloadConfig, DownloadGuardContext, DownloadOnPresignedContext, DownloadResolveContext, DownloadResolveInfo, FeatureToggle, Guard, GuardContext, GuardResult, LifecycleHook, MultipartConfig, MultipartGuardContext, MultipartOnAbortContext, MultipartUploadContext, ObjectContext, ObjectS3Headers, PutInput, RouteGuardContext, S3Operation, S3ServerCallOptions, TicketSubject, UploadConfig, UploadConfirmGuardContext, UploadFile, UploadGuardContext, UploadKind, UploadObjectContext, UploadObjectInfo, UploadOnConfirmedContext, UploadOnStartContext, VerifiedObject, } from "./types";
|
|
15
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EACb,OAAO,EACP,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,KAAK,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,GACf,MAAM,SAAS,CAAC"}
|