@dimah-s3/core 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 +1 -1
- package/dist/create-s3-client.d.ts.map +1 -1
- package/dist/error-codes.d.ts +11 -11
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/helpers/build-content-disposition.d.ts +3 -2
- package/dist/helpers/build-content-disposition.d.ts.map +1 -1
- package/dist/helpers/checksum.d.ts +5 -0
- package/dist/helpers/checksum.d.ts.map +1 -0
- package/dist/helpers/format-file-size.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +7 -4
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/magic-bytes.d.ts +11 -0
- package/dist/helpers/magic-bytes.d.ts.map +1 -0
- package/dist/helpers/normalize-object-key.d.ts +8 -0
- package/dist/helpers/normalize-object-key.d.ts.map +1 -0
- package/dist/helpers/parse-file-name.d.ts +7 -0
- package/dist/helpers/parse-file-name.d.ts.map +1 -1
- package/dist/helpers/public-object-url.d.ts +10 -0
- package/dist/helpers/public-object-url.d.ts.map +1 -0
- package/dist/helpers/sanitize-file-name.d.ts +1 -1
- package/dist/helpers/sanitize-file-name.d.ts.map +1 -1
- package/dist/helpers/validate-file.d.ts +5 -0
- package/dist/helpers/validate-file.d.ts.map +1 -1
- package/dist/index.js +231 -86
- package/dist/index.js.map +1 -1
- package/dist/plugin/plugin-path.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +1 -1
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/routes.d.ts +3 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/schema/catalog.d.ts +105 -0
- package/dist/schema/catalog.d.ts.map +1 -0
- package/dist/schema/delete.d.ts +8 -3
- package/dist/schema/delete.d.ts.map +1 -1
- package/dist/schema/download.d.ts +9 -6
- package/dist/schema/download.d.ts.map +1 -1
- package/dist/schema/file.d.ts +12 -0
- package/dist/schema/file.d.ts.map +1 -0
- package/dist/schema/index.d.ts +6 -3
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/multipart.d.ts +23 -26
- package/dist/schema/multipart.d.ts.map +1 -1
- package/dist/schema/shared.d.ts +14 -7
- package/dist/schema/shared.d.ts.map +1 -1
- package/dist/schema/upload.d.ts +9 -14
- package/dist/schema/upload.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/requests.d.ts +23 -17
- package/dist/types/requests.d.ts.map +1 -1
- package/dist/types/responses.d.ts +62 -48
- package/dist/types/responses.d.ts.map +1 -1
- package/dist/types/routes.d.ts +23 -0
- package/dist/types/routes.d.ts.map +1 -0
- package/package.json +6 -6
- package/dist/helpers/default-object-key.d.ts +0 -6
- package/dist/helpers/default-object-key.d.ts.map +0 -1
- package/dist/helpers/get-file-extension.d.ts +0 -2
- package/dist/helpers/get-file-extension.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-s3-client.d.ts","sourceRoot":"","sources":["../src/create-s3-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"create-s3-client.d.ts","sourceRoot":"","sources":["../src/create-s3-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EASV,KAAK,EAIN,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,UAAU,CAAC;AAOlB,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,SAAS,cAAc,EAAE,GAAG,SAAS,cAAc,EAAE,IAC7D;IACF,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,OAAO,CAAC,EAAE,CAAC,CAAC;CACb,GAAG,oBAAoB,CAAC;AAuGzB,yDAAyD;AACzD,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,SAAS,cAAc,EAAE,GAAG,EAAE,IACvE,KAAK,GACH,sBAAsB,CAAC,CAAC,CAAC,GAAG;IAC1B,YAAY,EAAE,OAAO,cAAc,CAAC;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE;QAAE,OAAO,EAAE,CAAC,CAAA;KAAE,CAAC;CACxB,CAAC;AAEN;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,cAAc,EAAE,GAAG,EAAE,EAC3E,OAAO,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GACjC,oBAAoB,CAAC,CAAC,CAAC,CA2BzB"}
|
package/dist/error-codes.d.ts
CHANGED
|
@@ -45,22 +45,18 @@ export declare const S3_ERROR_CODES: {
|
|
|
45
45
|
readonly code: "INVALID_KEY";
|
|
46
46
|
readonly message: "Object key is invalid";
|
|
47
47
|
};
|
|
48
|
-
readonly
|
|
49
|
-
readonly code: "
|
|
50
|
-
readonly message: "
|
|
48
|
+
readonly UNKNOWN_ROUTE: {
|
|
49
|
+
readonly code: "UNKNOWN_ROUTE";
|
|
50
|
+
readonly message: "Unknown file route";
|
|
51
|
+
};
|
|
52
|
+
readonly FILE_TYPE_NOT_ALLOWED: {
|
|
53
|
+
readonly code: "FILE_TYPE_NOT_ALLOWED";
|
|
54
|
+
readonly message: "File type is not allowed";
|
|
51
55
|
};
|
|
52
56
|
readonly S3_NETWORK_ERROR: {
|
|
53
57
|
readonly code: "S3_NETWORK_ERROR";
|
|
54
58
|
readonly message: "S3 endpoint unreachable ({code}): check your endpoint URL and network connectivity";
|
|
55
59
|
};
|
|
56
|
-
readonly FILE_SIZE_REQUIRED_UPLOAD: {
|
|
57
|
-
readonly code: "FILE_SIZE_REQUIRED_UPLOAD";
|
|
58
|
-
readonly message: "fileSize is required when upload.requireFileSize is enabled";
|
|
59
|
-
};
|
|
60
|
-
readonly FILE_SIZE_REQUIRED_MULTIPART: {
|
|
61
|
-
readonly code: "FILE_SIZE_REQUIRED_MULTIPART";
|
|
62
|
-
readonly message: "fileSize is required when multipart.requireFileSize is enabled";
|
|
63
|
-
};
|
|
64
60
|
readonly MULTIPART_PART_MISSING: {
|
|
65
61
|
readonly code: "MULTIPART_PART_MISSING";
|
|
66
62
|
readonly message: "Uploaded part {partNumber} was not found";
|
|
@@ -69,6 +65,10 @@ export declare const S3_ERROR_CODES: {
|
|
|
69
65
|
readonly code: "PAYLOAD_TOO_LARGE";
|
|
70
66
|
readonly message: "Payload too large";
|
|
71
67
|
};
|
|
68
|
+
readonly QUOTA_EXCEEDED: {
|
|
69
|
+
readonly code: "QUOTA_EXCEEDED";
|
|
70
|
+
readonly message: "Storage quota exceeded";
|
|
71
|
+
};
|
|
72
72
|
readonly VALIDATION_ERROR: {
|
|
73
73
|
readonly code: "VALIDATION_ERROR";
|
|
74
74
|
readonly message: "Validation Error";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACrE,QAAQ,EAAE,CAAC,GACV;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE;CAAE,CAQ3E;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACrE,QAAQ,EAAE,CAAC,GACV;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE;CAAE,CAQ3E;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBzB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export type ContentDispositionType = "inline" | "attachment";
|
|
1
2
|
/**
|
|
2
|
-
* Builds a RFC 6266 `Content-Disposition` value
|
|
3
|
+
* Builds a RFC 6266 `Content-Disposition` value.
|
|
3
4
|
*
|
|
4
5
|
* Includes both the ASCII-safe `filename` fallback and the RFC 5987
|
|
5
6
|
* `filename*` parameter for full Unicode support.
|
|
6
7
|
*/
|
|
7
|
-
export declare function buildContentDisposition(fileName: string): string;
|
|
8
|
+
export declare function buildContentDisposition(fileName: string, type?: ContentDispositionType): string;
|
|
8
9
|
//# sourceMappingURL=build-content-disposition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-content-disposition.d.ts","sourceRoot":"","sources":["../../src/helpers/build-content-disposition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"build-content-disposition.d.ts","sourceRoot":"","sources":["../../src/helpers/build-content-disposition.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,sBAAqC,GAC1C,MAAM,CAIR"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** SHA-256 digest as unpadded base64 (S3 `ChecksumSHA256`). */
|
|
2
|
+
export declare function sha256Base64(data: BufferSource): Promise<string>;
|
|
3
|
+
/** SHA-256 of a `Blob` / `File` as unpadded base64. */
|
|
4
|
+
export declare function sha256File(file: Blob): Promise<string>;
|
|
5
|
+
//# sourceMappingURL=checksum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksum.d.ts","sourceRoot":"","sources":["../../src/helpers/checksum.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED,uDAAuD;AACvD,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-file-size.d.ts","sourceRoot":"","sources":["../../src/helpers/format-file-size.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"format-file-size.d.ts","sourceRoot":"","sources":["../../src/helpers/format-file-size.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD"}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
export { validateFile } from "./validate-file";
|
|
1
|
+
export { matchesFileTypes, validateFile } from "./validate-file";
|
|
2
2
|
export type { ValidateFileError, ValidateFileErrorCode } from "./validate-file";
|
|
3
3
|
export { buildObjectKey } from "./build-object-key";
|
|
4
|
-
export {
|
|
5
|
-
export { parseFileName } from "./parse-file-name";
|
|
4
|
+
export { parseFileName, fileNameFromKey, resolveStoredFileName, } from "./parse-file-name";
|
|
6
5
|
export { formatFileSize } from "./format-file-size";
|
|
7
6
|
export { buildContentDisposition } from "./build-content-disposition";
|
|
7
|
+
export type { ContentDispositionType } from "./build-content-disposition";
|
|
8
8
|
export { sanitizeFileName } from "./sanitize-file-name";
|
|
9
|
-
export { defaultObjectKey } from "./default-object-key";
|
|
10
9
|
export { truncateFileName } from "./truncate-file-name";
|
|
10
|
+
export { normalizeObjectKey, S3_MAX_OBJECT_KEY_LENGTH, } from "./normalize-object-key";
|
|
11
|
+
export { sha256Base64, sha256File } from "./checksum";
|
|
12
|
+
export { matchesMagicBytes, sniffContentType } from "./magic-bytes";
|
|
13
|
+
export { buildPublicObjectUrl } from "./public-object-url";
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACjE,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sniff a MIME type from the start of a file. Returns `undefined` when
|
|
3
|
+
* the prefix is unknown — this is not a substitute for `fileTypes`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function sniffContentType(bytes: Uint8Array): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Whether `bytes` match `expected` (exact MIME or `image/*`).
|
|
8
|
+
* Unknown prefixes return `false`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function matchesMagicBytes(bytes: Uint8Array, expected: string): boolean;
|
|
11
|
+
//# sourceMappingURL=magic-bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magic-bytes.d.ts","sourceRoot":"","sources":["../../src/helpers/magic-bytes.ts"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAUtE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAOT"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** S3 object key maximum (1024 bytes). */
|
|
2
|
+
export declare const S3_MAX_OBJECT_KEY_LENGTH = 1024;
|
|
3
|
+
/**
|
|
4
|
+
* Strip leading/trailing slashes and reject `.` / `..` / empty segments,
|
|
5
|
+
* NUL, backslashes, and oversized keys. Returns `null` when the key is unsafe.
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeObjectKey(key: string): string | null;
|
|
8
|
+
//# sourceMappingURL=normalize-object-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-object-key.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-object-key.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU7D"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export declare function parseFileName(contentDisposition: string | null | undefined): string | undefined;
|
|
2
|
+
/** Last path segment of an object key (`uploads/uuid/a.png` → `a.png`). */
|
|
3
|
+
export declare function fileNameFromKey(key: string): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Filename from `Content-Disposition`, falling back to the object key leaf.
|
|
6
|
+
* Used after HeadObject when the disposition header is missing.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveStoredFileName(contentDisposition: string | null | undefined, key: string): string | undefined;
|
|
2
9
|
//# sourceMappingURL=parse-file-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-file-name.d.ts","sourceRoot":"","sources":["../../src/helpers/parse-file-name.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAC3B,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC5C,MAAM,GAAG,SAAS,CAcpB"}
|
|
1
|
+
{"version":3,"file":"parse-file-name.d.ts","sourceRoot":"","sources":["../../src/helpers/parse-file-name.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAC3B,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC5C,MAAM,GAAG,SAAS,CAcpB;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK/D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7C,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAEpB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Join a public origin (CDN or virtual-hosted S3) with an object key.
|
|
3
|
+
* Does not sign — only for `public-read` objects or a fronting CDN.
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildPublicObjectUrl(options: {
|
|
6
|
+
/** Origin with no trailing slash, e.g. `https://cdn.example.com`. */
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
key: string;
|
|
9
|
+
}): string;
|
|
10
|
+
//# sourceMappingURL=public-object-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-object-url.d.ts","sourceRoot":"","sources":["../../src/helpers/public-object-url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,MAAM,CAQT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** Sanitizes a file name for
|
|
1
|
+
/** Sanitizes a file name for Content-Disposition, query params, and object keys. */
|
|
2
2
|
export declare function sanitizeFileName(fileName: string): string;
|
|
3
3
|
//# sourceMappingURL=sanitize-file-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize-file-name.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitize-file-name.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"sanitize-file-name.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitize-file-name.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD"}
|
|
@@ -8,6 +8,11 @@ export type ValidateFileError = {
|
|
|
8
8
|
/** Interpolation params for i18n (e.g. `{ type }`, `{ size }`). */
|
|
9
9
|
params?: Record<string, string | number>;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Whether `fileName` / `contentType` match HTML `accept` / route `fileTypes`
|
|
13
|
+
* tokens (`image/*`, `application/pdf`, `.png`).
|
|
14
|
+
*/
|
|
15
|
+
export declare function matchesFileTypes(fileName: string, contentType: string | undefined, fileTypes: readonly string[]): boolean;
|
|
11
16
|
/**
|
|
12
17
|
* Client-side accept / size / empty checks before starting an upload.
|
|
13
18
|
* Returns `null` when the file is valid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-file.d.ts","sourceRoot":"","sources":["../../src/helpers/validate-file.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,MAAM,qBAAqB,GAC/B,uBAAuB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAE5D,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,iBAAiB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"validate-file.d.ts","sourceRoot":"","sources":["../../src/helpers/validate-file.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,MAAM,qBAAqB,GAC/B,uBAAuB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAE5D,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,OAAO,CAYT;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,iBAAiB,GAAG,IAAI,CAiC1B"}
|