@dimah-s3/server 1.0.2 → 1.1.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 +7 -3
- package/dist/adapters/express.js +16 -9
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/fastify.js +16 -9
- package/dist/adapters/fastify.js.map +1 -1
- package/dist/adapters/hono.d.ts +1 -1
- package/dist/adapters/hono.js.map +1 -1
- package/dist/adapters/node.d.ts +1 -1
- package/dist/adapters/node.js +16 -9
- package/dist/adapters/node.js.map +1 -1
- package/dist/api/index.js +742 -388
- package/dist/api/index.js.map +1 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/routes/catalog.d.ts +9 -0
- package/dist/api/routes/catalog.d.ts.map +1 -0
- package/dist/api/routes/confirm.d.ts +3 -4
- package/dist/api/routes/confirm.d.ts.map +1 -1
- package/dist/api/routes/delete-batch.d.ts +14 -0
- package/dist/api/routes/delete-batch.d.ts.map +1 -0
- package/dist/api/routes/delete.d.ts +2 -2
- package/dist/api/routes/delete.d.ts.map +1 -1
- package/dist/api/routes/download.d.ts +8 -8
- package/dist/api/routes/download.d.ts.map +1 -1
- package/dist/api/routes/file.d.ts +20 -0
- package/dist/api/routes/file.d.ts.map +1 -0
- package/dist/api/routes/index.d.ts +76 -50
- package/dist/api/routes/index.d.ts.map +1 -1
- package/dist/api/routes/multipart/abort.d.ts +2 -2
- package/dist/api/routes/multipart/abort.d.ts.map +1 -1
- package/dist/api/routes/multipart/complete.d.ts +2 -2
- package/dist/api/routes/multipart/complete.d.ts.map +1 -1
- package/dist/api/routes/multipart/init.d.ts +10 -12
- package/dist/api/routes/multipart/init.d.ts.map +1 -1
- package/dist/api/routes/multipart/list-parts.d.ts +2 -2
- package/dist/api/routes/multipart/list-parts.d.ts.map +1 -1
- package/dist/api/routes/multipart/part.d.ts +4 -6
- package/dist/api/routes/multipart/part.d.ts.map +1 -1
- package/dist/api/routes/upload.d.ts +10 -14
- package/dist/api/routes/upload.d.ts.map +1 -1
- package/dist/dimah-s3.d.ts +19 -8
- package/dist/dimah-s3.d.ts.map +1 -1
- package/dist/errors.d.ts +5 -4
- package/dist/errors.d.ts.map +1 -1
- package/dist/helpers/best-effort.d.ts +6 -0
- package/dist/helpers/best-effort.d.ts.map +1 -0
- package/dist/helpers/constraints.d.ts +16 -0
- package/dist/helpers/constraints.d.ts.map +1 -0
- package/dist/helpers/expires.d.ts +2 -2
- package/dist/helpers/features.d.ts +12 -29
- package/dist/helpers/features.d.ts.map +1 -1
- package/dist/helpers/finalize-confirmed.d.ts +19 -0
- package/dist/helpers/finalize-confirmed.d.ts.map +1 -0
- package/dist/helpers/head-object.d.ts.map +1 -1
- package/dist/helpers/hooks.d.ts +7 -1
- package/dist/helpers/hooks.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +12 -9
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/list-parts.d.ts +5 -0
- package/dist/helpers/list-parts.d.ts.map +1 -1
- package/dist/helpers/logger.d.ts +4 -0
- package/dist/helpers/logger.d.ts.map +1 -0
- package/dist/helpers/previous-key.d.ts +5 -0
- package/dist/helpers/previous-key.d.ts.map +1 -0
- package/dist/helpers/resolve-route.d.ts +36 -0
- package/dist/helpers/resolve-route.d.ts.map +1 -0
- package/dist/helpers/resolve-target.d.ts +25 -14
- package/dist/helpers/resolve-target.d.ts.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1017 -477
- package/dist/index.js.map +1 -1
- package/dist/plugin/apply-plugins.d.ts +9 -4
- package/dist/plugin/apply-plugins.d.ts.map +1 -1
- package/dist/plugin/hook-registry.d.ts +13 -4
- package/dist/plugin/hook-registry.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 +12 -7
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugins.d.ts +5 -3
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +951 -475
- package/dist/plugins.js.map +1 -1
- package/dist/put.d.ts +15 -0
- package/dist/put.d.ts.map +1 -0
- package/dist/route.d.ts +13 -0
- package/dist/route.d.ts.map +1 -0
- package/dist/types/config.d.ts +190 -95
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/hook-contexts.d.ts +124 -87
- package/dist/types/hook-contexts.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/api/assert-feature-enabled.d.ts +0 -5
- package/dist/api/assert-feature-enabled.d.ts.map +0 -1
- package/dist/helpers/resolve-object-acl.d.ts +0 -10
- package/dist/helpers/resolve-object-acl.d.ts.map +0 -1
- package/dist/helpers/resolve-request-acl.d.ts +0 -10
- package/dist/helpers/resolve-request-acl.d.ts.map +0 -1
|
@@ -5,23 +5,19 @@ export declare const coreEndpoints: {
|
|
|
5
5
|
} & {
|
|
6
6
|
method: "POST";
|
|
7
7
|
body: import("better-call").StandardSchemaV1<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
fileSize
|
|
8
|
+
route: string;
|
|
9
|
+
fileName: string;
|
|
10
|
+
fileSize: number;
|
|
11
|
+
contentType?: unknown;
|
|
11
12
|
metadata?: Record<string, string> | undefined;
|
|
12
|
-
|
|
13
|
-
expiresIn?: number | undefined;
|
|
14
|
-
acl?: "private" | "public-read" | undefined;
|
|
15
|
-
fileName?: string | undefined;
|
|
13
|
+
checksum?: unknown;
|
|
16
14
|
}, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
fileSize
|
|
15
|
+
route: string;
|
|
16
|
+
fileName: string;
|
|
17
|
+
fileSize: number;
|
|
18
|
+
contentType?: unknown;
|
|
20
19
|
metadata?: Record<string, string> | undefined;
|
|
21
|
-
|
|
22
|
-
expiresIn?: number | undefined;
|
|
23
|
-
acl?: "private" | "public-read" | undefined;
|
|
24
|
-
fileName?: string | undefined;
|
|
20
|
+
checksum?: unknown;
|
|
25
21
|
}>;
|
|
26
22
|
}, import("@dimah-s3/core").UploadPresignResponse>;
|
|
27
23
|
confirm: import("better-call").StrictEndpoint<"/presign/upload/confirm", {
|
|
@@ -29,30 +25,52 @@ export declare const coreEndpoints: {
|
|
|
29
25
|
} & {
|
|
30
26
|
method: "POST";
|
|
31
27
|
body: import("better-call").StandardSchemaV1<{
|
|
28
|
+
route: string;
|
|
32
29
|
key: string;
|
|
33
|
-
bucket?: string | undefined;
|
|
34
30
|
}, {
|
|
31
|
+
route: string;
|
|
35
32
|
key: string;
|
|
36
|
-
bucket?: string | undefined;
|
|
37
33
|
}>;
|
|
38
|
-
}, import("@dimah-s3/core").
|
|
34
|
+
}, import("@dimah-s3/core").ConfirmedObjectResponse>;
|
|
39
35
|
download: import("better-call").StrictEndpoint<"/presign/download", {
|
|
40
36
|
use: import("better-call").MiddlewareHandler[];
|
|
41
37
|
} & {
|
|
42
38
|
method: "GET";
|
|
43
39
|
} & {
|
|
44
40
|
query: import("better-call").StandardSchemaV1<{
|
|
41
|
+
route: string;
|
|
42
|
+
key: string;
|
|
43
|
+
fileName?: unknown;
|
|
44
|
+
disposition?: "attachment" | "inline" | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
route: string;
|
|
47
|
+
key: string;
|
|
48
|
+
fileName?: unknown;
|
|
49
|
+
disposition?: "attachment" | "inline" | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
}, import("@dimah-s3/core").DownloadPresignResponse>;
|
|
52
|
+
catalog: import("better-call").StrictEndpoint<"/routes", {
|
|
53
|
+
use: import("better-call").MiddlewareHandler[];
|
|
54
|
+
} & {
|
|
55
|
+
method: "GET";
|
|
56
|
+
}, import("@dimah-s3/core").RouteCatalogResponse>;
|
|
57
|
+
file: import("better-call").StrictEndpoint<"/file", {
|
|
58
|
+
use: import("better-call").MiddlewareHandler[];
|
|
59
|
+
} & {
|
|
60
|
+
method: "GET";
|
|
61
|
+
} & {
|
|
62
|
+
query: import("better-call").StandardSchemaV1<{
|
|
63
|
+
route: string;
|
|
45
64
|
key: string;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
expiresIn?: unknown;
|
|
65
|
+
fileName?: unknown;
|
|
66
|
+
disposition?: "attachment" | "inline" | undefined;
|
|
49
67
|
}, {
|
|
68
|
+
route: string;
|
|
50
69
|
key: string;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
expiresIn?: unknown;
|
|
70
|
+
fileName?: unknown;
|
|
71
|
+
disposition?: "attachment" | "inline" | undefined;
|
|
54
72
|
}>;
|
|
55
|
-
},
|
|
73
|
+
}, Response>;
|
|
56
74
|
delete: import("better-call").StrictEndpoint<"/delete", {
|
|
57
75
|
use: import("better-call").MiddlewareHandler[];
|
|
58
76
|
} & {
|
|
@@ -60,33 +78,43 @@ export declare const coreEndpoints: {
|
|
|
60
78
|
body: import("better-call").StandardSchemaV1<unknown, unknown>;
|
|
61
79
|
} & {
|
|
62
80
|
query: import("better-call").StandardSchemaV1<{
|
|
81
|
+
route: string;
|
|
63
82
|
key: string;
|
|
64
|
-
bucket?: string | undefined;
|
|
65
83
|
}, {
|
|
84
|
+
route: string;
|
|
66
85
|
key: string;
|
|
67
|
-
bucket?: string | undefined;
|
|
68
86
|
}>;
|
|
69
87
|
}, import("@dimah-s3/core").DeleteResponse>;
|
|
88
|
+
deleteBatch: import("better-call").StrictEndpoint<"/delete/batch", {
|
|
89
|
+
use: import("better-call").MiddlewareHandler[];
|
|
90
|
+
} & {
|
|
91
|
+
method: "POST";
|
|
92
|
+
body: import("better-call").StandardSchemaV1<{
|
|
93
|
+
route: string;
|
|
94
|
+
keys: string[];
|
|
95
|
+
}, {
|
|
96
|
+
route: string;
|
|
97
|
+
keys: string[];
|
|
98
|
+
}>;
|
|
99
|
+
}, import("@dimah-s3/core").DeleteBatchResponse>;
|
|
70
100
|
multipartInit: import("better-call").StrictEndpoint<"/presign/multipart/init", {
|
|
71
101
|
use: import("better-call").MiddlewareHandler[];
|
|
72
102
|
} & {
|
|
73
103
|
method: "POST";
|
|
74
104
|
body: import("better-call").StandardSchemaV1<{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
fileSize
|
|
105
|
+
route: string;
|
|
106
|
+
fileName: string;
|
|
107
|
+
fileSize: number;
|
|
108
|
+
contentType?: unknown;
|
|
78
109
|
metadata?: Record<string, string> | undefined;
|
|
79
|
-
|
|
80
|
-
acl?: "private" | "public-read" | undefined;
|
|
81
|
-
fileName?: string | undefined;
|
|
110
|
+
checksum?: unknown;
|
|
82
111
|
}, {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
fileSize
|
|
112
|
+
route: string;
|
|
113
|
+
fileName: string;
|
|
114
|
+
fileSize: number;
|
|
115
|
+
contentType?: unknown;
|
|
86
116
|
metadata?: Record<string, string> | undefined;
|
|
87
|
-
|
|
88
|
-
acl?: "private" | "public-read" | undefined;
|
|
89
|
-
fileName?: string | undefined;
|
|
117
|
+
checksum?: unknown;
|
|
90
118
|
}>;
|
|
91
119
|
}, import("@dimah-s3/core").MultipartInitResponse>;
|
|
92
120
|
multipartPart: import("better-call").StrictEndpoint<"/presign/multipart/part", {
|
|
@@ -94,19 +122,17 @@ export declare const coreEndpoints: {
|
|
|
94
122
|
} & {
|
|
95
123
|
method: "POST";
|
|
96
124
|
body: import("better-call").StandardSchemaV1<{
|
|
125
|
+
route: string;
|
|
97
126
|
key: string;
|
|
98
127
|
uploadId: string;
|
|
99
128
|
partNumber: number;
|
|
100
|
-
partSize
|
|
101
|
-
bucket?: string | undefined;
|
|
102
|
-
expiresIn?: number | undefined;
|
|
129
|
+
partSize: number;
|
|
103
130
|
}, {
|
|
131
|
+
route: string;
|
|
104
132
|
key: string;
|
|
105
133
|
uploadId: string;
|
|
106
134
|
partNumber: number;
|
|
107
|
-
partSize
|
|
108
|
-
bucket?: string | undefined;
|
|
109
|
-
expiresIn?: number | undefined;
|
|
135
|
+
partSize: number;
|
|
110
136
|
}>;
|
|
111
137
|
}, import("@dimah-s3/core").MultipartPartResponse>;
|
|
112
138
|
multipartListParts: import("better-call").StrictEndpoint<"/presign/multipart/parts", {
|
|
@@ -115,13 +141,13 @@ export declare const coreEndpoints: {
|
|
|
115
141
|
method: "GET";
|
|
116
142
|
} & {
|
|
117
143
|
query: import("better-call").StandardSchemaV1<{
|
|
144
|
+
route: string;
|
|
118
145
|
key: string;
|
|
119
146
|
uploadId: string;
|
|
120
|
-
bucket?: string | undefined;
|
|
121
147
|
}, {
|
|
148
|
+
route: string;
|
|
122
149
|
key: string;
|
|
123
150
|
uploadId: string;
|
|
124
|
-
bucket?: string | undefined;
|
|
125
151
|
}>;
|
|
126
152
|
}, import("@dimah-s3/core").MultipartListPartsResponse>;
|
|
127
153
|
multipartComplete: import("better-call").StrictEndpoint<"/presign/multipart/complete", {
|
|
@@ -129,19 +155,19 @@ export declare const coreEndpoints: {
|
|
|
129
155
|
} & {
|
|
130
156
|
method: "POST";
|
|
131
157
|
body: import("better-call").StandardSchemaV1<{
|
|
158
|
+
route: string;
|
|
132
159
|
key: string;
|
|
133
160
|
uploadId: string;
|
|
134
161
|
parts: {
|
|
135
162
|
partNumber: number;
|
|
136
163
|
}[];
|
|
137
|
-
bucket?: string | undefined;
|
|
138
164
|
}, {
|
|
165
|
+
route: string;
|
|
139
166
|
key: string;
|
|
140
167
|
uploadId: string;
|
|
141
168
|
parts: {
|
|
142
169
|
partNumber: number;
|
|
143
170
|
}[];
|
|
144
|
-
bucket?: string | undefined;
|
|
145
171
|
}>;
|
|
146
172
|
}, import("@dimah-s3/core").MultipartCompleteResponse>;
|
|
147
173
|
multipartAbort: import("better-call").StrictEndpoint<"/presign/multipart/abort", {
|
|
@@ -149,13 +175,13 @@ export declare const coreEndpoints: {
|
|
|
149
175
|
} & {
|
|
150
176
|
method: "POST";
|
|
151
177
|
body: import("better-call").StandardSchemaV1<{
|
|
178
|
+
route: string;
|
|
152
179
|
key: string;
|
|
153
180
|
uploadId: string;
|
|
154
|
-
bucket?: string | undefined;
|
|
155
181
|
}, {
|
|
182
|
+
route: string;
|
|
156
183
|
key: string;
|
|
157
184
|
uploadId: string;
|
|
158
|
-
bucket?: string | undefined;
|
|
159
185
|
}>;
|
|
160
186
|
}, import("@dimah-s3/core").MultipartAbortResponse>;
|
|
161
187
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/routes/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/routes/index.ts"],"names":[],"mappings":"AAaA,2DAA2D;AAC3D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAazB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC;AAEjD,eAAO,MAAM,mBAAmB,EAE3B,CAAC,MAAM,aAAa,CAAC,EAAE,CAAC"}
|
|
@@ -4,13 +4,13 @@ export declare const multipartAbort: import("better-call").StrictEndpoint<"/pres
|
|
|
4
4
|
} & {
|
|
5
5
|
method: "POST";
|
|
6
6
|
body: import("better-call").StandardSchemaV1<{
|
|
7
|
+
route: string;
|
|
7
8
|
key: string;
|
|
8
9
|
uploadId: string;
|
|
9
|
-
bucket?: string | undefined;
|
|
10
10
|
}, {
|
|
11
|
+
route: string;
|
|
11
12
|
key: string;
|
|
12
13
|
uploadId: string;
|
|
13
|
-
bucket?: string | undefined;
|
|
14
14
|
}>;
|
|
15
15
|
}, MultipartAbortResponse>;
|
|
16
16
|
//# sourceMappingURL=abort.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/abort.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/abort.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,gBAAgB,CAAC;AAmDxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;0BAM1B,CAAC"}
|
|
@@ -4,19 +4,19 @@ export declare const multipartComplete: import("better-call").StrictEndpoint<"/p
|
|
|
4
4
|
} & {
|
|
5
5
|
method: "POST";
|
|
6
6
|
body: import("better-call").StandardSchemaV1<{
|
|
7
|
+
route: string;
|
|
7
8
|
key: string;
|
|
8
9
|
uploadId: string;
|
|
9
10
|
parts: {
|
|
10
11
|
partNumber: number;
|
|
11
12
|
}[];
|
|
12
|
-
bucket?: string | undefined;
|
|
13
13
|
}, {
|
|
14
|
+
route: string;
|
|
14
15
|
key: string;
|
|
15
16
|
uploadId: string;
|
|
16
17
|
parts: {
|
|
17
18
|
partNumber: number;
|
|
18
19
|
}[];
|
|
19
|
-
bucket?: string | undefined;
|
|
20
20
|
}>;
|
|
21
21
|
}, MultipartCompleteResponse>;
|
|
22
22
|
//# sourceMappingURL=complete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/complete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/complete.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AAmGxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;6BAM7B,CAAC"}
|
|
@@ -4,21 +4,19 @@ export declare const multipartInit: import("better-call").StrictEndpoint<"/presi
|
|
|
4
4
|
} & {
|
|
5
5
|
method: "POST";
|
|
6
6
|
body: import("better-call").StandardSchemaV1<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
fileSize
|
|
7
|
+
route: string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
fileSize: number;
|
|
10
|
+
contentType?: unknown;
|
|
10
11
|
metadata?: Record<string, string> | undefined;
|
|
11
|
-
|
|
12
|
-
acl?: "private" | "public-read" | undefined;
|
|
13
|
-
fileName?: string | undefined;
|
|
12
|
+
checksum?: unknown;
|
|
14
13
|
}, {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fileSize
|
|
14
|
+
route: string;
|
|
15
|
+
fileName: string;
|
|
16
|
+
fileSize: number;
|
|
17
|
+
contentType?: unknown;
|
|
18
18
|
metadata?: Record<string, string> | undefined;
|
|
19
|
-
|
|
20
|
-
acl?: "private" | "public-read" | undefined;
|
|
21
|
-
fileName?: string | undefined;
|
|
19
|
+
checksum?: unknown;
|
|
22
20
|
}>;
|
|
23
21
|
}, MultipartInitResponse>;
|
|
24
22
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AA2ExB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;yBAYzB,CAAC"}
|
|
@@ -5,13 +5,13 @@ export declare const multipartListParts: import("better-call").StrictEndpoint<"/
|
|
|
5
5
|
method: "GET";
|
|
6
6
|
} & {
|
|
7
7
|
query: import("better-call").StandardSchemaV1<{
|
|
8
|
+
route: string;
|
|
8
9
|
key: string;
|
|
9
10
|
uploadId: string;
|
|
10
|
-
bucket?: string | undefined;
|
|
11
11
|
}, {
|
|
12
|
+
route: string;
|
|
12
13
|
key: string;
|
|
13
14
|
uploadId: string;
|
|
14
|
-
bucket?: string | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
}, MultipartListPartsResponse>;
|
|
17
17
|
//# sourceMappingURL=list-parts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-parts.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/list-parts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-parts.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/list-parts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,gBAAgB,CAAC;AAuDxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;8BAM9B,CAAC"}
|
|
@@ -4,19 +4,17 @@ export declare const multipartPart: import("better-call").StrictEndpoint<"/presi
|
|
|
4
4
|
} & {
|
|
5
5
|
method: "POST";
|
|
6
6
|
body: import("better-call").StandardSchemaV1<{
|
|
7
|
+
route: string;
|
|
7
8
|
key: string;
|
|
8
9
|
uploadId: string;
|
|
9
10
|
partNumber: number;
|
|
10
|
-
partSize
|
|
11
|
-
bucket?: string | undefined;
|
|
12
|
-
expiresIn?: number | undefined;
|
|
11
|
+
partSize: number;
|
|
13
12
|
}, {
|
|
13
|
+
route: string;
|
|
14
14
|
key: string;
|
|
15
15
|
uploadId: string;
|
|
16
16
|
partNumber: number;
|
|
17
|
-
partSize
|
|
18
|
-
bucket?: string | undefined;
|
|
19
|
-
expiresIn?: number | undefined;
|
|
17
|
+
partSize: number;
|
|
20
18
|
}>;
|
|
21
19
|
}, MultipartPartResponse>;
|
|
22
20
|
//# sourceMappingURL=part.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/part.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../../../../src/api/routes/multipart/part.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AA0ExB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;yBAMzB,CAAC"}
|
|
@@ -4,23 +4,19 @@ export declare const upload: import("better-call").StrictEndpoint<"/presign/uplo
|
|
|
4
4
|
} & {
|
|
5
5
|
method: "POST";
|
|
6
6
|
body: import("better-call").StandardSchemaV1<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
fileSize
|
|
7
|
+
route: string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
fileSize: number;
|
|
10
|
+
contentType?: unknown;
|
|
10
11
|
metadata?: Record<string, string> | undefined;
|
|
11
|
-
|
|
12
|
-
expiresIn?: number | undefined;
|
|
13
|
-
acl?: "private" | "public-read" | undefined;
|
|
14
|
-
fileName?: string | undefined;
|
|
12
|
+
checksum?: unknown;
|
|
15
13
|
}, {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
fileSize
|
|
14
|
+
route: string;
|
|
15
|
+
fileName: string;
|
|
16
|
+
fileSize: number;
|
|
17
|
+
contentType?: unknown;
|
|
19
18
|
metadata?: Record<string, string> | undefined;
|
|
20
|
-
|
|
21
|
-
expiresIn?: number | undefined;
|
|
22
|
-
acl?: "private" | "public-read" | undefined;
|
|
23
|
-
fileName?: string | undefined;
|
|
19
|
+
checksum?: unknown;
|
|
24
20
|
}>;
|
|
25
21
|
}, UploadPresignResponse>;
|
|
26
22
|
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/api/routes/upload.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/api/routes/upload.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AAiKxB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;yBAMlB,CAAC"}
|
package/dist/dimah-s3.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { S3_ERROR_CODES } from "@dimah-s3/core";
|
|
2
|
+
import { type PutObjectInput } from "./put";
|
|
2
3
|
import { type DimahS3Plugin, type PluginContextMap, type PluginEndpointMap } from "./plugin";
|
|
3
4
|
import { type CoreEndpoints } from "./api/routes";
|
|
4
|
-
import type { DimahS3Config } from "./types";
|
|
5
|
+
import type { DimahS3Config, DimahS3RouteConfig } from "./types";
|
|
5
6
|
export type MultipartAliasApi = {
|
|
6
7
|
init: CoreEndpoints["multipartInit"];
|
|
7
8
|
signPart: CoreEndpoints["multipartPart"];
|
|
@@ -11,16 +12,17 @@ export type MultipartAliasApi = {
|
|
|
11
12
|
};
|
|
12
13
|
export type DimahS3Api<P extends readonly DimahS3Plugin[] = []> = CoreEndpoints & {
|
|
13
14
|
multipart: MultipartAliasApi;
|
|
15
|
+
deleteMany: CoreEndpoints["deleteBatch"];
|
|
14
16
|
} & PluginEndpointMap<P>;
|
|
15
|
-
export type DimahS3<P extends readonly DimahS3Plugin[] = [], C extends Record<string, unknown> = PluginContextMap<P>> = {
|
|
17
|
+
export type DimahS3<P extends readonly DimahS3Plugin[] = [], C extends Record<string, unknown> = PluginContextMap<P>, R extends Record<string, DimahS3RouteConfig> = Record<string, DimahS3RouteConfig>> = {
|
|
16
18
|
/** Framework-agnostic HTTP handler (`Request` → `Response`). */
|
|
17
19
|
handler: (request: Request) => Promise<Response>;
|
|
18
20
|
/**
|
|
19
21
|
* better-call endpoints — invoke as functions from Server Actions / RSC.
|
|
20
22
|
*
|
|
21
23
|
* ```ts
|
|
22
|
-
* await s3.api.download({ query: { key }, headers: await headers() });
|
|
23
|
-
* await s3.api.multipart.init({ body: {
|
|
24
|
+
* await s3.api.download({ query: { route, key }, headers: await headers() });
|
|
25
|
+
* await s3.api.multipart.init({ body: { route, fileName, fileSize } });
|
|
24
26
|
* ```
|
|
25
27
|
*/
|
|
26
28
|
api: DimahS3Api<P>;
|
|
@@ -37,7 +39,12 @@ export type DimahS3<P extends readonly DimahS3Plugin[] = [], C extends Record<st
|
|
|
37
39
|
$Infer: {
|
|
38
40
|
api: DimahS3Api<P>;
|
|
39
41
|
context: C;
|
|
42
|
+
routes: keyof R & string;
|
|
40
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Server-side upload through the same route policy as presign + confirm.
|
|
46
|
+
*/
|
|
47
|
+
put: (input: PutObjectInput) => Promise<import("@dimah-s3/core").ConfirmedObjectResponse>;
|
|
41
48
|
} & C;
|
|
42
49
|
/**
|
|
43
50
|
* Create a dimah-s3 server instance.
|
|
@@ -51,15 +58,19 @@ export type DimahS3<P extends readonly DimahS3Plugin[] = [], C extends Record<st
|
|
|
51
58
|
* export const s3 = dimahS3({
|
|
52
59
|
* client: awsS3,
|
|
53
60
|
* bucket: "my-bucket",
|
|
54
|
-
*
|
|
61
|
+
* routes: {
|
|
62
|
+
* uploads: route({ upload: { fileTypes: ["image/*"] } }),
|
|
63
|
+
* invoices: route({ download: true }),
|
|
64
|
+
* },
|
|
55
65
|
* });
|
|
56
66
|
*
|
|
57
67
|
* export const { GET, POST, PUT, PATCH, DELETE } = toNextJsHandler(s3);
|
|
58
68
|
*
|
|
59
|
-
* await s3.api.download({ query: { key }, headers: await headers() });
|
|
69
|
+
* await s3.api.download({ query: { route: "invoices", key }, headers: await headers() });
|
|
60
70
|
* ```
|
|
61
71
|
*/
|
|
62
|
-
export declare function dimahS3<const P extends readonly DimahS3Plugin[] = []>(config: DimahS3Config & {
|
|
72
|
+
export declare function dimahS3<const P extends readonly DimahS3Plugin[] = [], const R extends Record<string, DimahS3RouteConfig> = Record<string, DimahS3RouteConfig>>(config: DimahS3Config & {
|
|
63
73
|
plugins?: P;
|
|
64
|
-
|
|
74
|
+
routes: R;
|
|
75
|
+
}): DimahS3<P, PluginContextMap<P>, R>;
|
|
65
76
|
//# sourceMappingURL=dimah-s3.d.ts.map
|
package/dist/dimah-s3.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimah-s3.d.ts","sourceRoot":"","sources":["../src/dimah-s3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"dimah-s3.d.ts","sourceRoot":"","sources":["../src/dimah-s3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACrC,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACzC,SAAS,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAC/C,QAAQ,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC7C,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,aAAa,EAAE,GAAG,EAAE,IAC5D,aAAa,GAAG;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CAC1C,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAE3B,MAAM,MAAM,OAAO,CACjB,CAAC,SAAS,SAAS,aAAa,EAAE,GAAG,EAAE,EACvC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,EACvD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,MAAM,CACnD,MAAM,EACN,kBAAkB,CACnB,IACC;IACF,gEAAgE;IAChE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjD;;;;;;;OAOG;IACH,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACnB,0CAA0C;IAC1C,OAAO,EAAE,CAAC,CAAC;IACX,wCAAwC;IACxC,SAAS,EAAE;QACT,CAAC,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EACzB,EAAE,EAAE,EAAE,GACL,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;YAAE,EAAE,EAAE,EAAE,CAAA;SAAE,CAAC,GAAG,SAAS,CAAC;QAC9C,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;KACzC,CAAC;IACF,YAAY,EAAE,OAAO,cAAc,CAAC;IACpC,MAAM,EAAE;QACN,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QACnB,OAAO,EAAE,CAAC,CAAC;QACX,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;KAC1B,CAAC;IACF;;OAEG;IACH,GAAG,EAAE,CACH,KAAK,EAAE,cAAc,KAClB,OAAO,CAAC,OAAO,gBAAgB,EAAE,uBAAuB,CAAC,CAAC;CAChE,GAAG,CAAC,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,OAAO,CACrB,KAAK,CAAC,CAAC,SAAS,SAAS,aAAa,EAAE,GAAG,EAAE,EAC7C,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,MAAM,CACzD,MAAM,EACN,kBAAkB,CACnB,EAED,MAAM,EAAE,aAAa,GAAG;IAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,GACjD,OAAO,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAkCpC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DimahS3Error, S3_ERROR_CODES, isAPIError, isDimahS3Error, isS3ErrorCode } from "@dimah-s3/core";
|
|
2
|
+
import type { RouteOperation } from "./types/config";
|
|
2
3
|
export { DimahS3Error, S3_ERROR_CODES, isAPIError, isDimahS3Error, isS3ErrorCode, };
|
|
3
4
|
/** English API errors with stable codes for client-side localization. */
|
|
4
5
|
export declare const errors: {
|
|
@@ -8,14 +9,14 @@ export declare const errors: {
|
|
|
8
9
|
readonly conflict: () => DimahS3Error;
|
|
9
10
|
readonly internalError: () => DimahS3Error;
|
|
10
11
|
readonly objectNotFound: () => DimahS3Error;
|
|
11
|
-
readonly featureDisabled: (feature:
|
|
12
|
+
readonly featureDisabled: (feature: RouteOperation) => DimahS3Error;
|
|
12
13
|
readonly invalidKey: () => DimahS3Error;
|
|
13
|
-
readonly
|
|
14
|
+
readonly unknownRoute: (route: string) => DimahS3Error;
|
|
15
|
+
readonly fileTypeNotAllowed: (fileName: string, contentType?: string) => DimahS3Error;
|
|
14
16
|
readonly s3NetworkError: (code: string) => DimahS3Error;
|
|
15
|
-
readonly fileSizeRequiredUpload: () => DimahS3Error;
|
|
16
|
-
readonly fileSizeRequiredMultipart: () => DimahS3Error;
|
|
17
17
|
readonly multipartPartMissing: (partNumber: number) => DimahS3Error;
|
|
18
18
|
readonly payloadTooLarge: (message?: string) => DimahS3Error;
|
|
19
|
+
readonly quotaExceeded: (message?: string) => DimahS3Error;
|
|
19
20
|
readonly validationError: (message: string) => DimahS3Error;
|
|
20
21
|
};
|
|
21
22
|
export type ServerErrors = typeof errors;
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,aAAa,EACd,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,aAAa,GACd,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,MAAM;aACjB,QAAQ;aAER,YAAY;aAGZ,SAAS;aAET,QAAQ;aAER,aAAa;aAGb,cAAc;aAGd,eAAe,YAAY,cAAc;aAUzC,UAAU;aAGV,YAAY,UAAU,MAAM;aAO5B,kBAAkB,aAAa,MAAM,gBAAgB,MAAM;aAU3D,cAAc,SAAS,MAAM;aAU7B,oBAAoB,eAAe,MAAM;aAUzC,eAAe,aACJ,MAAM;aAOjB,aAAa,aAAY,MAAM;aAM/B,eAAe,YAAY,MAAM;CAKzB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type S3Client } from "@aws-sdk/client-s3";
|
|
2
|
+
/** Best-effort DeleteObject after a failed constraint check. */
|
|
3
|
+
export declare function deleteObjectBestEffort(client: S3Client, bucket: string, key: string): Promise<void>;
|
|
4
|
+
/** Best-effort AbortMultipartUpload before assembly or after a failed complete. */
|
|
5
|
+
export declare function abortMultipartBestEffort(client: S3Client, bucket: string, key: string, uploadId: string): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=best-effort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"best-effort.d.ts","sourceRoot":"","sources":["../../src/helpers/best-effort.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAE5B,gEAAgE;AAChE,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,mFAAmF;AACnF,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { UploadConfig } from "../types";
|
|
2
|
+
/** File limits from `upload` (`fileTypes` / `maxFileSize`). */
|
|
3
|
+
export type FileConstraints = Pick<UploadConfig, "fileTypes" | "maxFileSize">;
|
|
4
|
+
/** Reject when `size` is over the route cap. No-op when `maxFileSize` is unset. */
|
|
5
|
+
export declare function assertWithinMaxFileSize(maxFileSize: number | undefined, size: number): void;
|
|
6
|
+
export declare function assertDeclaredConstraints(constraints: FileConstraints | undefined, input: {
|
|
7
|
+
fileName: string;
|
|
8
|
+
fileSize: number;
|
|
9
|
+
contentType?: string;
|
|
10
|
+
}): void;
|
|
11
|
+
export declare function assertVerifiedConstraints(constraints: FileConstraints | undefined, input: {
|
|
12
|
+
fileName?: string;
|
|
13
|
+
contentType?: string;
|
|
14
|
+
contentLength: number;
|
|
15
|
+
}): void;
|
|
16
|
+
//# sourceMappingURL=constraints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../src/helpers/constraints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,aAAa,CAAC,CAAC;AAE9E,mFAAmF;AACnF,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,IAAI,EAAE,MAAM,GACX,IAAI,CAIN;AAED,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,eAAe,GAAG,SAAS,EACxC,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAClE,IAAI,CAQN;AAED,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,eAAe,GAAG,SAAS,EACxC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACxE,IAAI,CASN"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Coerce
|
|
3
|
-
* {@link maxExpiresIn} (SigV4 max by default).
|
|
2
|
+
* Coerce an upload/download `expiresIn` to a positive integer, then clamp
|
|
3
|
+
* to {@link maxExpiresIn} (SigV4 max by default).
|
|
4
4
|
*/
|
|
5
5
|
export declare function normalizeExpiresIn(value: unknown, maxExpiresIn?: number): number;
|
|
6
6
|
//# sourceMappingURL=expires.d.ts.map
|
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function
|
|
1
|
+
import type { DimahS3Config, DimahS3RouteConfig, FeatureToggle, ResolvedFeature, ResolvedRoute } from "../types";
|
|
2
|
+
export declare function isEnabled<T extends {
|
|
3
3
|
enabled: boolean;
|
|
4
|
-
})
|
|
5
|
-
|
|
6
|
-
export declare function applyMultipartDefault(config: ResolvedDimahS3Config, multipartInput: FeatureToggle<MultipartConfig> | undefined): ResolvedDimahS3Config;
|
|
7
|
-
export type NormalizedFeatures = {
|
|
8
|
-
upload?: UploadConfig & {
|
|
9
|
-
enabled: boolean;
|
|
10
|
-
};
|
|
11
|
-
download?: DownloadConfig & {
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
};
|
|
14
|
-
delete?: DeleteConfig & {
|
|
15
|
-
enabled: boolean;
|
|
16
|
-
};
|
|
17
|
-
multipart?: MultipartConfig & {
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
};
|
|
4
|
+
}>(feature: T): feature is T & {
|
|
5
|
+
enabled: true;
|
|
20
6
|
};
|
|
21
|
-
export declare function normalizeFeatures(config: {
|
|
22
|
-
upload?: FeatureToggle<UploadConfig>;
|
|
23
|
-
download?: FeatureToggle<DownloadConfig>;
|
|
24
|
-
delete?: FeatureToggle<DeleteConfig>;
|
|
25
|
-
multipart?: FeatureToggle<MultipartConfig>;
|
|
26
|
-
}): NormalizedFeatures;
|
|
27
7
|
/**
|
|
28
|
-
* `
|
|
8
|
+
* `true` / options → on; `false` → off.
|
|
9
|
+
* `undefined` uses {@link defaultOn} (false unless passed).
|
|
10
|
+
* Resolved `{ enabled }` objects (after `normalizeFeature`) use that flag.
|
|
29
11
|
*/
|
|
30
|
-
export declare function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
export declare function isFeatureOn<T extends object>(value: FeatureToggle<T> | ResolvedFeature<T> | undefined, defaultOn?: boolean): boolean;
|
|
13
|
+
/** `true` / options → enabled; omit / `false` → disabled. */
|
|
14
|
+
export declare function normalizeFeature<T extends object>(value: FeatureToggle<T> | undefined, defaultOn?: boolean): ResolvedFeature<T>;
|
|
15
|
+
export declare function normalizeRoute(name: string, route: DimahS3RouteConfig, instance: Pick<DimahS3Config, "client" | "bucket">): ResolvedRoute;
|
|
16
|
+
export declare function normalizeRoutes(config: DimahS3Config): Record<string, ResolvedRoute>;
|
|
34
17
|
//# sourceMappingURL=features.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/helpers/features.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/helpers/features.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACb,kBAAkB,EAGlB,aAAa,EAEb,eAAe,EACf,aAAa,EAGd,MAAM,SAAS,CAAC;AAIjB,wBAAgB,SAAS,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,EACtD,OAAO,EAAE,CAAC,GACT,OAAO,IAAI,CAAC,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAElC;AAgBD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,EACxD,SAAS,UAAQ,GAChB,OAAO,CAQT;AAED,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,EACnC,SAAS,UAAQ,GAChB,eAAe,CAAC,CAAC,CAAC,CAQpB;AAsBD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,QAAQ,CAAC,GACjD,aAAa,CAyDf;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,aAAa,GACpB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAW/B"}
|