@bymax-one/nest-storage 1.0.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.
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ // src/shared/constants/error-codes.constants.ts
4
+ var STORAGE_ERROR_CODES = {
5
+ STORAGE_NOT_CONFIGURED: "STORAGE_NOT_CONFIGURED",
6
+ STORAGE_KEY_INVALID: "STORAGE_KEY_INVALID",
7
+ STORAGE_BODY_MISSING: "STORAGE_BODY_MISSING",
8
+ STORAGE_CONTENT_TYPE_REQUIRED: "STORAGE_CONTENT_TYPE_REQUIRED",
9
+ STORAGE_MIME_NOT_ALLOWED: "STORAGE_MIME_NOT_ALLOWED",
10
+ STORAGE_SIZE_EXCEEDED: "STORAGE_SIZE_EXCEEDED",
11
+ STORAGE_VALIDATION_FAILED: "STORAGE_VALIDATION_FAILED",
12
+ STORAGE_SCAN_INFECTED: "STORAGE_SCAN_INFECTED",
13
+ STORAGE_SCAN_INCONCLUSIVE: "STORAGE_SCAN_INCONCLUSIVE",
14
+ STORAGE_OBJECT_NOT_FOUND: "STORAGE_OBJECT_NOT_FOUND",
15
+ STORAGE_PROVIDER_ERROR: "STORAGE_PROVIDER_ERROR",
16
+ STORAGE_SIGNED_URL_TTL_INVALID: "STORAGE_SIGNED_URL_TTL_INVALID",
17
+ STORAGE_PART_TOO_SMALL: "STORAGE_PART_TOO_SMALL",
18
+ STORAGE_INVALID_PART_COUNT: "STORAGE_INVALID_PART_COUNT",
19
+ STORAGE_BUCKET_UNDEFINED: "STORAGE_BUCKET_UNDEFINED",
20
+ STORAGE_MULTIPART_ABORTED: "STORAGE_MULTIPART_ABORTED",
21
+ STORAGE_INVALID_CONFIG: "STORAGE_INVALID_CONFIG",
22
+ STORAGE_TIMEOUT: "STORAGE_TIMEOUT"
23
+ };
24
+
25
+ // src/shared/constants/mime-types.constants.ts
26
+ var DEFAULT_IMAGE_MIME_WHITELIST = [
27
+ "image/jpeg",
28
+ "image/png",
29
+ "image/webp",
30
+ "image/gif",
31
+ "image/svg+xml",
32
+ "image/avif"
33
+ ];
34
+ var DEFAULT_VIDEO_MIME_WHITELIST = [
35
+ "video/mp4",
36
+ "video/webm",
37
+ "video/quicktime"
38
+ ];
39
+ var DEFAULT_DOC_MIME_WHITELIST = [
40
+ "application/pdf",
41
+ "application/msword",
42
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
43
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
44
+ "text/csv",
45
+ "text/plain"
46
+ ];
47
+
48
+ // src/shared/constants/default-ttls.constants.ts
49
+ var DEFAULT_SIGNED_URL_TTL_SECONDS = 300;
50
+ var MAX_SIGNED_URL_TTL_SECONDS = 604800;
51
+ var DEFAULT_MULTIPART_THRESHOLD_BYTES = 5242880;
52
+ var DEFAULT_MULTIPART_PART_SIZE_BYTES = 5242880;
53
+ var DEFAULT_MULTIPART_QUEUE_SIZE = 4;
54
+
55
+ exports.DEFAULT_DOC_MIME_WHITELIST = DEFAULT_DOC_MIME_WHITELIST;
56
+ exports.DEFAULT_IMAGE_MIME_WHITELIST = DEFAULT_IMAGE_MIME_WHITELIST;
57
+ exports.DEFAULT_MULTIPART_PART_SIZE_BYTES = DEFAULT_MULTIPART_PART_SIZE_BYTES;
58
+ exports.DEFAULT_MULTIPART_QUEUE_SIZE = DEFAULT_MULTIPART_QUEUE_SIZE;
59
+ exports.DEFAULT_MULTIPART_THRESHOLD_BYTES = DEFAULT_MULTIPART_THRESHOLD_BYTES;
60
+ exports.DEFAULT_SIGNED_URL_TTL_SECONDS = DEFAULT_SIGNED_URL_TTL_SECONDS;
61
+ exports.DEFAULT_VIDEO_MIME_WHITELIST = DEFAULT_VIDEO_MIME_WHITELIST;
62
+ exports.MAX_SIGNED_URL_TTL_SECONDS = MAX_SIGNED_URL_TTL_SECONDS;
63
+ exports.STORAGE_ERROR_CODES = STORAGE_ERROR_CODES;
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @fileoverview Pure data shapes returned by storage operations. Zero NestJS or
3
+ * AWS SDK dependencies — safe to import in frontends, edge functions, or other
4
+ * non-Node environments.
5
+ * @layer shared/types
6
+ */
7
+ /** Outcome of an upload — returned to the caller. */
8
+ interface UploadResult {
9
+ /** Final key after normalization and the global key prefix. */
10
+ key: string;
11
+ bucket: string;
12
+ etag: string;
13
+ /** Only set on versioned buckets. */
14
+ versionId?: string;
15
+ size?: number;
16
+ contentType: string;
17
+ publicUrl: string;
18
+ /** True when the multipart pathway was used. */
19
+ multipart: boolean;
20
+ /** True when the result was returned from the idempotency cache. */
21
+ fromIdempotencyCache: boolean;
22
+ }
23
+ /** Object metadata as returned by `head()` and `download()`. */
24
+ interface ObjectMetadata {
25
+ key: string;
26
+ bucket: string;
27
+ size: number;
28
+ contentType: string;
29
+ etag: string;
30
+ lastModified: Date;
31
+ cacheControl?: string;
32
+ contentDisposition?: string;
33
+ /** `x-amz-meta-*` custom metadata. */
34
+ metadata: Record<string, string>;
35
+ /** S3 storage class (STANDARD, GLACIER, etc.). */
36
+ storageClass?: string;
37
+ versionId?: string;
38
+ }
39
+ /** Result row returned by `list()`. */
40
+ interface ListedObject {
41
+ key: string;
42
+ size: number;
43
+ etag: string;
44
+ lastModified: Date;
45
+ storageClass?: string;
46
+ }
47
+
48
+ /**
49
+ * @fileoverview Result shape of a signed-URL request. Zero NestJS or AWS SDK
50
+ * dependencies.
51
+ * @layer shared/types
52
+ */
53
+ /** Result of a signed URL request — the caller forwards `url` to a client. */
54
+ interface SignedUrlResult {
55
+ /** The presigned URL. NEVER LOG this — it is a temporary credential. */
56
+ url: string;
57
+ /** Absolute deadline after which the provider stops accepting the URL. */
58
+ expiresAt: Date;
59
+ /** HTTP method the client must use. */
60
+ method: 'GET' | 'PUT';
61
+ /**
62
+ * Headers the client MUST include verbatim — they are part of the signature.
63
+ * Example: `{ 'Content-Type': 'image/png' }`.
64
+ */
65
+ requiredHeaders: Record<string, string>;
66
+ }
67
+
68
+ /**
69
+ * @fileoverview Stable string error codes returned in error responses. Host apps
70
+ * and clients pattern-match on these — they MUST NOT change between minor
71
+ * versions. `as const` preserves the literal types in the emitted `.d.ts`.
72
+ * @layer shared/constants
73
+ */
74
+ declare const STORAGE_ERROR_CODES: {
75
+ readonly STORAGE_NOT_CONFIGURED: "STORAGE_NOT_CONFIGURED";
76
+ readonly STORAGE_KEY_INVALID: "STORAGE_KEY_INVALID";
77
+ readonly STORAGE_BODY_MISSING: "STORAGE_BODY_MISSING";
78
+ readonly STORAGE_CONTENT_TYPE_REQUIRED: "STORAGE_CONTENT_TYPE_REQUIRED";
79
+ readonly STORAGE_MIME_NOT_ALLOWED: "STORAGE_MIME_NOT_ALLOWED";
80
+ readonly STORAGE_SIZE_EXCEEDED: "STORAGE_SIZE_EXCEEDED";
81
+ readonly STORAGE_VALIDATION_FAILED: "STORAGE_VALIDATION_FAILED";
82
+ readonly STORAGE_SCAN_INFECTED: "STORAGE_SCAN_INFECTED";
83
+ readonly STORAGE_SCAN_INCONCLUSIVE: "STORAGE_SCAN_INCONCLUSIVE";
84
+ readonly STORAGE_OBJECT_NOT_FOUND: "STORAGE_OBJECT_NOT_FOUND";
85
+ readonly STORAGE_PROVIDER_ERROR: "STORAGE_PROVIDER_ERROR";
86
+ readonly STORAGE_SIGNED_URL_TTL_INVALID: "STORAGE_SIGNED_URL_TTL_INVALID";
87
+ readonly STORAGE_PART_TOO_SMALL: "STORAGE_PART_TOO_SMALL";
88
+ readonly STORAGE_INVALID_PART_COUNT: "STORAGE_INVALID_PART_COUNT";
89
+ readonly STORAGE_BUCKET_UNDEFINED: "STORAGE_BUCKET_UNDEFINED";
90
+ readonly STORAGE_MULTIPART_ABORTED: "STORAGE_MULTIPART_ABORTED";
91
+ readonly STORAGE_INVALID_CONFIG: "STORAGE_INVALID_CONFIG";
92
+ readonly STORAGE_TIMEOUT: "STORAGE_TIMEOUT";
93
+ };
94
+ /** Union of every stable storage error code. */
95
+ type StorageErrorCode = (typeof STORAGE_ERROR_CODES)[keyof typeof STORAGE_ERROR_CODES];
96
+
97
+ /**
98
+ * @fileoverview JSON error shape emitted by `StorageException`. Zero NestJS or
99
+ * AWS SDK dependencies.
100
+ * @layer shared/types
101
+ */
102
+
103
+ /**
104
+ * JSON shape emitted by `StorageException` — what the host application's HTTP
105
+ * error handler receives in `response.body`.
106
+ */
107
+ interface StorageErrorResponse {
108
+ error: {
109
+ code: keyof typeof STORAGE_ERROR_CODES;
110
+ message: string;
111
+ details?: Record<string, unknown>;
112
+ };
113
+ }
114
+
115
+ /**
116
+ * @fileoverview Curated MIME whitelists for common upload domains. Consumers may
117
+ * merge them with their own or pass them directly to `validation.mimeWhitelist`.
118
+ * Wildcards are not used here — a consumer can add `'image/*'` if it trusts any
119
+ * image subtype.
120
+ * @layer shared/constants
121
+ */
122
+ declare const DEFAULT_IMAGE_MIME_WHITELIST: readonly string[];
123
+ declare const DEFAULT_VIDEO_MIME_WHITELIST: readonly string[];
124
+ declare const DEFAULT_DOC_MIME_WHITELIST: readonly string[];
125
+
126
+ /**
127
+ * @fileoverview Default and hard-limit numeric constants for signed-URL TTLs and
128
+ * multipart uploads. Short TTLs by default — prefer issuing a new URL over
129
+ * caching long-lived ones.
130
+ * @layer shared/constants
131
+ */
132
+ /** Default TTL (seconds) for signed URLs. */
133
+ declare const DEFAULT_SIGNED_URL_TTL_SECONDS: 300;
134
+ /** Hard cap (seconds) on a signed-URL TTL — 7 days, the SigV4 limit. */
135
+ declare const MAX_SIGNED_URL_TTL_SECONDS: 604800;
136
+ /** Multipart upload threshold — files at or above this use `@aws-sdk/lib-storage`. */
137
+ declare const DEFAULT_MULTIPART_THRESHOLD_BYTES: 5242880;
138
+ /** Default size of each part in a multipart upload. The S3 minimum is 5 MB. */
139
+ declare const DEFAULT_MULTIPART_PART_SIZE_BYTES: 5242880;
140
+ /** Number of parts uploaded concurrently. */
141
+ declare const DEFAULT_MULTIPART_QUEUE_SIZE: 4;
142
+
143
+ export { DEFAULT_DOC_MIME_WHITELIST, DEFAULT_IMAGE_MIME_WHITELIST, DEFAULT_MULTIPART_PART_SIZE_BYTES, DEFAULT_MULTIPART_QUEUE_SIZE, DEFAULT_MULTIPART_THRESHOLD_BYTES, DEFAULT_SIGNED_URL_TTL_SECONDS, DEFAULT_VIDEO_MIME_WHITELIST, type ListedObject, MAX_SIGNED_URL_TTL_SECONDS, type ObjectMetadata, STORAGE_ERROR_CODES, type SignedUrlResult, type StorageErrorCode, type StorageErrorResponse, type UploadResult };
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @fileoverview Pure data shapes returned by storage operations. Zero NestJS or
3
+ * AWS SDK dependencies — safe to import in frontends, edge functions, or other
4
+ * non-Node environments.
5
+ * @layer shared/types
6
+ */
7
+ /** Outcome of an upload — returned to the caller. */
8
+ interface UploadResult {
9
+ /** Final key after normalization and the global key prefix. */
10
+ key: string;
11
+ bucket: string;
12
+ etag: string;
13
+ /** Only set on versioned buckets. */
14
+ versionId?: string;
15
+ size?: number;
16
+ contentType: string;
17
+ publicUrl: string;
18
+ /** True when the multipart pathway was used. */
19
+ multipart: boolean;
20
+ /** True when the result was returned from the idempotency cache. */
21
+ fromIdempotencyCache: boolean;
22
+ }
23
+ /** Object metadata as returned by `head()` and `download()`. */
24
+ interface ObjectMetadata {
25
+ key: string;
26
+ bucket: string;
27
+ size: number;
28
+ contentType: string;
29
+ etag: string;
30
+ lastModified: Date;
31
+ cacheControl?: string;
32
+ contentDisposition?: string;
33
+ /** `x-amz-meta-*` custom metadata. */
34
+ metadata: Record<string, string>;
35
+ /** S3 storage class (STANDARD, GLACIER, etc.). */
36
+ storageClass?: string;
37
+ versionId?: string;
38
+ }
39
+ /** Result row returned by `list()`. */
40
+ interface ListedObject {
41
+ key: string;
42
+ size: number;
43
+ etag: string;
44
+ lastModified: Date;
45
+ storageClass?: string;
46
+ }
47
+
48
+ /**
49
+ * @fileoverview Result shape of a signed-URL request. Zero NestJS or AWS SDK
50
+ * dependencies.
51
+ * @layer shared/types
52
+ */
53
+ /** Result of a signed URL request — the caller forwards `url` to a client. */
54
+ interface SignedUrlResult {
55
+ /** The presigned URL. NEVER LOG this — it is a temporary credential. */
56
+ url: string;
57
+ /** Absolute deadline after which the provider stops accepting the URL. */
58
+ expiresAt: Date;
59
+ /** HTTP method the client must use. */
60
+ method: 'GET' | 'PUT';
61
+ /**
62
+ * Headers the client MUST include verbatim — they are part of the signature.
63
+ * Example: `{ 'Content-Type': 'image/png' }`.
64
+ */
65
+ requiredHeaders: Record<string, string>;
66
+ }
67
+
68
+ /**
69
+ * @fileoverview Stable string error codes returned in error responses. Host apps
70
+ * and clients pattern-match on these — they MUST NOT change between minor
71
+ * versions. `as const` preserves the literal types in the emitted `.d.ts`.
72
+ * @layer shared/constants
73
+ */
74
+ declare const STORAGE_ERROR_CODES: {
75
+ readonly STORAGE_NOT_CONFIGURED: "STORAGE_NOT_CONFIGURED";
76
+ readonly STORAGE_KEY_INVALID: "STORAGE_KEY_INVALID";
77
+ readonly STORAGE_BODY_MISSING: "STORAGE_BODY_MISSING";
78
+ readonly STORAGE_CONTENT_TYPE_REQUIRED: "STORAGE_CONTENT_TYPE_REQUIRED";
79
+ readonly STORAGE_MIME_NOT_ALLOWED: "STORAGE_MIME_NOT_ALLOWED";
80
+ readonly STORAGE_SIZE_EXCEEDED: "STORAGE_SIZE_EXCEEDED";
81
+ readonly STORAGE_VALIDATION_FAILED: "STORAGE_VALIDATION_FAILED";
82
+ readonly STORAGE_SCAN_INFECTED: "STORAGE_SCAN_INFECTED";
83
+ readonly STORAGE_SCAN_INCONCLUSIVE: "STORAGE_SCAN_INCONCLUSIVE";
84
+ readonly STORAGE_OBJECT_NOT_FOUND: "STORAGE_OBJECT_NOT_FOUND";
85
+ readonly STORAGE_PROVIDER_ERROR: "STORAGE_PROVIDER_ERROR";
86
+ readonly STORAGE_SIGNED_URL_TTL_INVALID: "STORAGE_SIGNED_URL_TTL_INVALID";
87
+ readonly STORAGE_PART_TOO_SMALL: "STORAGE_PART_TOO_SMALL";
88
+ readonly STORAGE_INVALID_PART_COUNT: "STORAGE_INVALID_PART_COUNT";
89
+ readonly STORAGE_BUCKET_UNDEFINED: "STORAGE_BUCKET_UNDEFINED";
90
+ readonly STORAGE_MULTIPART_ABORTED: "STORAGE_MULTIPART_ABORTED";
91
+ readonly STORAGE_INVALID_CONFIG: "STORAGE_INVALID_CONFIG";
92
+ readonly STORAGE_TIMEOUT: "STORAGE_TIMEOUT";
93
+ };
94
+ /** Union of every stable storage error code. */
95
+ type StorageErrorCode = (typeof STORAGE_ERROR_CODES)[keyof typeof STORAGE_ERROR_CODES];
96
+
97
+ /**
98
+ * @fileoverview JSON error shape emitted by `StorageException`. Zero NestJS or
99
+ * AWS SDK dependencies.
100
+ * @layer shared/types
101
+ */
102
+
103
+ /**
104
+ * JSON shape emitted by `StorageException` — what the host application's HTTP
105
+ * error handler receives in `response.body`.
106
+ */
107
+ interface StorageErrorResponse {
108
+ error: {
109
+ code: keyof typeof STORAGE_ERROR_CODES;
110
+ message: string;
111
+ details?: Record<string, unknown>;
112
+ };
113
+ }
114
+
115
+ /**
116
+ * @fileoverview Curated MIME whitelists for common upload domains. Consumers may
117
+ * merge them with their own or pass them directly to `validation.mimeWhitelist`.
118
+ * Wildcards are not used here — a consumer can add `'image/*'` if it trusts any
119
+ * image subtype.
120
+ * @layer shared/constants
121
+ */
122
+ declare const DEFAULT_IMAGE_MIME_WHITELIST: readonly string[];
123
+ declare const DEFAULT_VIDEO_MIME_WHITELIST: readonly string[];
124
+ declare const DEFAULT_DOC_MIME_WHITELIST: readonly string[];
125
+
126
+ /**
127
+ * @fileoverview Default and hard-limit numeric constants for signed-URL TTLs and
128
+ * multipart uploads. Short TTLs by default — prefer issuing a new URL over
129
+ * caching long-lived ones.
130
+ * @layer shared/constants
131
+ */
132
+ /** Default TTL (seconds) for signed URLs. */
133
+ declare const DEFAULT_SIGNED_URL_TTL_SECONDS: 300;
134
+ /** Hard cap (seconds) on a signed-URL TTL — 7 days, the SigV4 limit. */
135
+ declare const MAX_SIGNED_URL_TTL_SECONDS: 604800;
136
+ /** Multipart upload threshold — files at or above this use `@aws-sdk/lib-storage`. */
137
+ declare const DEFAULT_MULTIPART_THRESHOLD_BYTES: 5242880;
138
+ /** Default size of each part in a multipart upload. The S3 minimum is 5 MB. */
139
+ declare const DEFAULT_MULTIPART_PART_SIZE_BYTES: 5242880;
140
+ /** Number of parts uploaded concurrently. */
141
+ declare const DEFAULT_MULTIPART_QUEUE_SIZE: 4;
142
+
143
+ export { DEFAULT_DOC_MIME_WHITELIST, DEFAULT_IMAGE_MIME_WHITELIST, DEFAULT_MULTIPART_PART_SIZE_BYTES, DEFAULT_MULTIPART_QUEUE_SIZE, DEFAULT_MULTIPART_THRESHOLD_BYTES, DEFAULT_SIGNED_URL_TTL_SECONDS, DEFAULT_VIDEO_MIME_WHITELIST, type ListedObject, MAX_SIGNED_URL_TTL_SECONDS, type ObjectMetadata, STORAGE_ERROR_CODES, type SignedUrlResult, type StorageErrorCode, type StorageErrorResponse, type UploadResult };
@@ -0,0 +1,53 @@
1
+ // src/shared/constants/error-codes.constants.ts
2
+ var STORAGE_ERROR_CODES = {
3
+ STORAGE_NOT_CONFIGURED: "STORAGE_NOT_CONFIGURED",
4
+ STORAGE_KEY_INVALID: "STORAGE_KEY_INVALID",
5
+ STORAGE_BODY_MISSING: "STORAGE_BODY_MISSING",
6
+ STORAGE_CONTENT_TYPE_REQUIRED: "STORAGE_CONTENT_TYPE_REQUIRED",
7
+ STORAGE_MIME_NOT_ALLOWED: "STORAGE_MIME_NOT_ALLOWED",
8
+ STORAGE_SIZE_EXCEEDED: "STORAGE_SIZE_EXCEEDED",
9
+ STORAGE_VALIDATION_FAILED: "STORAGE_VALIDATION_FAILED",
10
+ STORAGE_SCAN_INFECTED: "STORAGE_SCAN_INFECTED",
11
+ STORAGE_SCAN_INCONCLUSIVE: "STORAGE_SCAN_INCONCLUSIVE",
12
+ STORAGE_OBJECT_NOT_FOUND: "STORAGE_OBJECT_NOT_FOUND",
13
+ STORAGE_PROVIDER_ERROR: "STORAGE_PROVIDER_ERROR",
14
+ STORAGE_SIGNED_URL_TTL_INVALID: "STORAGE_SIGNED_URL_TTL_INVALID",
15
+ STORAGE_PART_TOO_SMALL: "STORAGE_PART_TOO_SMALL",
16
+ STORAGE_INVALID_PART_COUNT: "STORAGE_INVALID_PART_COUNT",
17
+ STORAGE_BUCKET_UNDEFINED: "STORAGE_BUCKET_UNDEFINED",
18
+ STORAGE_MULTIPART_ABORTED: "STORAGE_MULTIPART_ABORTED",
19
+ STORAGE_INVALID_CONFIG: "STORAGE_INVALID_CONFIG",
20
+ STORAGE_TIMEOUT: "STORAGE_TIMEOUT"
21
+ };
22
+
23
+ // src/shared/constants/mime-types.constants.ts
24
+ var DEFAULT_IMAGE_MIME_WHITELIST = [
25
+ "image/jpeg",
26
+ "image/png",
27
+ "image/webp",
28
+ "image/gif",
29
+ "image/svg+xml",
30
+ "image/avif"
31
+ ];
32
+ var DEFAULT_VIDEO_MIME_WHITELIST = [
33
+ "video/mp4",
34
+ "video/webm",
35
+ "video/quicktime"
36
+ ];
37
+ var DEFAULT_DOC_MIME_WHITELIST = [
38
+ "application/pdf",
39
+ "application/msword",
40
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
41
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
42
+ "text/csv",
43
+ "text/plain"
44
+ ];
45
+
46
+ // src/shared/constants/default-ttls.constants.ts
47
+ var DEFAULT_SIGNED_URL_TTL_SECONDS = 300;
48
+ var MAX_SIGNED_URL_TTL_SECONDS = 604800;
49
+ var DEFAULT_MULTIPART_THRESHOLD_BYTES = 5242880;
50
+ var DEFAULT_MULTIPART_PART_SIZE_BYTES = 5242880;
51
+ var DEFAULT_MULTIPART_QUEUE_SIZE = 4;
52
+
53
+ export { DEFAULT_DOC_MIME_WHITELIST, DEFAULT_IMAGE_MIME_WHITELIST, DEFAULT_MULTIPART_PART_SIZE_BYTES, DEFAULT_MULTIPART_QUEUE_SIZE, DEFAULT_MULTIPART_THRESHOLD_BYTES, DEFAULT_SIGNED_URL_TTL_SECONDS, DEFAULT_VIDEO_MIME_WHITELIST, MAX_SIGNED_URL_TTL_SECONDS, STORAGE_ERROR_CODES };
package/package.json ADDED
@@ -0,0 +1,159 @@
1
+ {
2
+ "name": "@bymax-one/nest-storage",
3
+ "version": "1.0.0",
4
+ "description": "Provider-agnostic S3-compatible object storage for NestJS. Works with AWS S3, DigitalOcean Spaces, Cloudflare R2, Backblaze B2, MinIO, Wasabi.",
5
+ "author": "Bymax One <support@bymax.one>",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/bymaxone/nest-storage#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/bymaxone/nest-storage.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/bymaxone/nest-storage/issues"
14
+ },
15
+ "type": "module",
16
+ "sideEffects": false,
17
+ "files": [
18
+ "dist",
19
+ "LICENSE",
20
+ "README.md",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "exports": {
24
+ ".": {
25
+ "import": {
26
+ "types": "./dist/server/index.d.ts",
27
+ "default": "./dist/server/index.mjs"
28
+ },
29
+ "require": {
30
+ "types": "./dist/server/index.d.cts",
31
+ "default": "./dist/server/index.cjs"
32
+ }
33
+ },
34
+ "./shared": {
35
+ "import": {
36
+ "types": "./dist/shared/index.d.ts",
37
+ "default": "./dist/shared/index.mjs"
38
+ },
39
+ "require": {
40
+ "types": "./dist/shared/index.d.cts",
41
+ "default": "./dist/shared/index.cjs"
42
+ }
43
+ },
44
+ "./package.json": "./package.json"
45
+ },
46
+ "dependencies": {},
47
+ "peerDependencies": {
48
+ "@nestjs/common": "^11.0.16",
49
+ "@nestjs/core": "^11.1.18",
50
+ "@aws-sdk/client-s3": "^3.700.0",
51
+ "@aws-sdk/lib-storage": "^3.700.0",
52
+ "@aws-sdk/s3-request-presigner": "^3.700.0",
53
+ "reflect-metadata": "^0.2.0"
54
+ },
55
+ "peerDependenciesMeta": {
56
+ "@nestjs/common": {
57
+ "optional": false
58
+ },
59
+ "@nestjs/core": {
60
+ "optional": false
61
+ },
62
+ "@aws-sdk/client-s3": {
63
+ "optional": false
64
+ },
65
+ "@aws-sdk/lib-storage": {
66
+ "optional": false
67
+ },
68
+ "@aws-sdk/s3-request-presigner": {
69
+ "optional": false
70
+ },
71
+ "reflect-metadata": {
72
+ "optional": false
73
+ }
74
+ },
75
+ "devDependencies": {
76
+ "@arethetypeswrong/cli": "^0.18.2",
77
+ "@aws-sdk/client-s3": "^3.1099.0",
78
+ "@aws-sdk/lib-storage": "^3.1099.0",
79
+ "@aws-sdk/s3-request-presigner": "^3.1099.0",
80
+ "@eslint/js": "^9.39.4",
81
+ "@nestjs/common": "^11.1.28",
82
+ "@nestjs/core": "^11.1.28",
83
+ "@nestjs/platform-express": "^11.1.28",
84
+ "@nestjs/testing": "^11.1.28",
85
+ "@stryker-mutator/core": "^9",
86
+ "@stryker-mutator/jest-runner": "^9",
87
+ "@stryker-mutator/typescript-checker": "^9",
88
+ "@testcontainers/minio": "^12",
89
+ "@types/express": "^5.0.6",
90
+ "@types/jest": "^30.0.0",
91
+ "@types/node": "^24.13.3",
92
+ "@types/supertest": "^7.2.1",
93
+ "eslint": "^9.39.5",
94
+ "eslint-config-prettier": "^10.1.8",
95
+ "jest": "^30.4.2",
96
+ "prettier": "^3.9.6",
97
+ "reflect-metadata": "^0.2.2",
98
+ "supertest": "^7.2.2",
99
+ "testcontainers": "^12",
100
+ "ts-jest": "^29.4.12",
101
+ "ts-node": "^10.9.2",
102
+ "tsup": "^8.5.1",
103
+ "typescript": "^5.9.3",
104
+ "typescript-eslint": "^8.65.0"
105
+ },
106
+ "keywords": [
107
+ "nestjs",
108
+ "storage",
109
+ "s3",
110
+ "aws-s3",
111
+ "cloudflare-r2",
112
+ "backblaze-b2",
113
+ "digitalocean-spaces",
114
+ "minio",
115
+ "wasabi",
116
+ "object-storage",
117
+ "presigned-url",
118
+ "multipart-upload"
119
+ ],
120
+ "engines": {
121
+ "node": ">=24.0.0"
122
+ },
123
+ "publishConfig": {
124
+ "access": "public",
125
+ "provenance": true,
126
+ "registry": "https://registry.npmjs.org/"
127
+ },
128
+ "main": "./dist/server/index.cjs",
129
+ "module": "./dist/server/index.mjs",
130
+ "types": "./dist/server/index.d.cts",
131
+ "typesVersions": {
132
+ "*": {
133
+ "shared": [
134
+ "./dist/shared/index.d.cts"
135
+ ]
136
+ }
137
+ },
138
+ "scripts": {
139
+ "build": "pnpm clean && tsup",
140
+ "check:exports": "attw --pack . --profile strict",
141
+ "check:published": "node scripts/check-published-surface.mjs",
142
+ "check:runtime": "node scripts/check-consumer-runtime.mjs",
143
+ "clean": "rm -rf dist coverage",
144
+ "lint": "eslint src",
145
+ "lint:fix": "eslint src --fix",
146
+ "mutation": "stryker run",
147
+ "mutation:dry-run": "stryker run --dryRunOnly",
148
+ "mutation:incremental": "stryker run --incremental",
149
+ "release": "npm publish --provenance --access public",
150
+ "size": "node scripts/check-size.mjs",
151
+ "test": "jest",
152
+ "test:all": "pnpm test && pnpm test:e2e",
153
+ "test:cov": "jest --coverage",
154
+ "test:cov:all": "jest --config jest.coverage.config.ts --coverage",
155
+ "test:e2e": "jest --config jest.e2e.config.ts",
156
+ "test:watch": "jest --watch",
157
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.server.json"
158
+ }
159
+ }