nestjs-r2-storage 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- export { StorageOptions, FileFieldConfig, PhotoFieldConfig, StorageModuleOptions, AccessMode, } from './r2-storage/interfaces/storage-options.interface';
2
- export { CloudflareService, UploadUrlResult, DownloadUrlResult, FileInfo, AccessModeError, } from './r2-storage/cloudflare.service';
3
- export { PhotoManagerService, PhotoField, PhotoUploadRequest, PhotoUploadResponse, CreatePhotosResult, UpdatePhotosResult, DeletePhotosResult, AppendUrlsOptions, } from './r2-storage/photo-manager.service';
4
- export { R2StorageModule, } from './r2-storage/r2-storage.module';
5
- export { PhotoFields, UploadUrls, StorageInfo, } from './r2-storage/decorators/photo-fields.decorator';
6
- export { parseFieldPath, getNestedValue, setNestedValue, collectNestedValues, isArrayPath, getArrayBasePath, getArrayElementPath, getAllArrayItemPaths, ParsedPath, PathSegment, } from './r2-storage/utils/nested-value.util';
1
+ export { StorageOptions, FileFieldConfig, PhotoFieldConfig, StorageModuleOptions, AccessMode, } from "./r2-storage/interfaces/storage-options.interface";
2
+ export { CloudflareService, AccessModeError, } from "./r2-storage/cloudflare.service";
3
+ export { UploadUrlResult, DownloadUrlResult, FileInfo, } from "./r2-storage/interfaces/cloudflare-service.interface";
4
+ export { PhotoManagerService } from "./r2-storage/photo-manager.service";
5
+ export { PhotoField, AppendUrlsOptions, PhotoUploadRequest, PhotoUploadResponse, CreatePhotosResult, UpdatePhotosResult, DeletePhotosResult, } from "./r2-storage/interfaces/photo-manager.interface";
6
+ export { R2StorageModule } from "./r2-storage/r2-storage.module";
7
+ export { PhotoFields, UploadUrls, StorageInfo, } from "./r2-storage/decorators/photo-fields.decorator";
8
+ export { parseFieldPath, getNestedValue, setNestedValue, collectNestedValues, isArrayPath, getArrayBasePath, getArrayElementPath, getAllArrayItemPaths, ParsedPath, PathSegment, } from "./r2-storage/utils/nested-value.util";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAQA,sEAMyC;AALvC,uHAAA,iBAAiB,OAAA;AAIjB,qHAAA,eAAe,OAAA;AAGjB,4EAS4C;AAR1C,4HAAA,mBAAmB,OAAA;AAUrB,oEAEwC;AADtC,oHAAA,eAAe,OAAA;AAGjB,yFAIwD;AAHtD,qHAAA,WAAW,OAAA;AACX,oHAAA,UAAU,OAAA;AACV,qHAAA,WAAW,OAAA;AAGb,0EAW8C;AAV5C,mHAAA,cAAc,OAAA;AACd,mHAAA,cAAc,OAAA;AACd,mHAAA,cAAc,OAAA;AACd,wHAAA,mBAAmB,OAAA;AACnB,gHAAA,WAAW,OAAA;AACX,qHAAA,gBAAgB,OAAA;AAChB,wHAAA,mBAAmB,OAAA;AACnB,yHAAA,oBAAoB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAQA,sEAGyC;AAFvC,uHAAA,iBAAiB,OAAA;AACjB,qHAAA,eAAe,OAAA;AASjB,4EAAyE;AAAhE,4HAAA,mBAAmB,OAAA;AAY5B,oEAAiE;AAAxD,oHAAA,eAAe,OAAA;AAExB,yFAIwD;AAHtD,qHAAA,WAAW,OAAA;AACX,oHAAA,UAAU,OAAA;AACV,qHAAA,WAAW,OAAA;AAGb,0EAW8C;AAV5C,mHAAA,cAAc,OAAA;AACd,mHAAA,cAAc,OAAA;AACd,mHAAA,cAAc,OAAA;AACd,wHAAA,mBAAmB,OAAA;AACnB,gHAAA,WAAW,OAAA;AACX,qHAAA,gBAAgB,OAAA;AAChB,wHAAA,mBAAmB,OAAA;AACnB,yHAAA,oBAAoB,OAAA"}
@@ -1,49 +1,32 @@
1
- import { OnModuleInit, OnModuleDestroy, BadRequestException } from '@nestjs/common';
2
- import { StorageOptions } from './interfaces/storage-options.interface';
3
- export declare class AccessModeError extends BadRequestException {
4
- constructor(message: string);
5
- }
6
- export interface UploadUrlResult {
7
- uploadUrl: string;
8
- fileKey: string;
9
- publicUrl: string | null;
10
- mimeType: string;
11
- sizeField?: number;
12
- }
13
- export interface DownloadUrlResult {
14
- downloadUrl: string;
15
- publicUrl: string | null;
16
- }
17
- export interface FileInfo {
18
- size: number;
19
- lastModified?: Date;
20
- contentType?: string;
21
- }
22
- export declare class CloudflareService implements OnModuleInit, OnModuleDestroy {
23
- private readonly storageOptions;
24
- private s3Client;
25
- private options;
26
- private readonly defaultExpiry;
27
- private readonly defaultAccessMode;
28
- constructor(storageOptions: StorageOptions);
29
- private get accessMode();
30
- private isPublicAccessAllowed;
31
- private ensurePublicAccessAllowed;
32
- onModuleInit(): void;
33
- onModuleDestroy(): void;
34
- private initializeClient;
35
- setOptions(options: StorageOptions): void;
36
- getOptions(): StorageOptions;
37
- private sanitizeFilename;
38
- private detectMimeType;
39
- getUploadUrl(fileKey: string, fileSize: number, customFilename?: string, contentType?: string): Promise<UploadUrlResult>;
40
- getDownloadUrl(fileKey: string): Promise<DownloadUrlResult>;
41
- deleteFile(fileKey: string): Promise<boolean>;
42
- deleteFiles(fileKeys: string[]): Promise<{
43
- success: string[];
44
- failed: string[];
45
- }>;
46
- getFileInfo(fileKey: string): Promise<FileInfo | null>;
47
- fileExists(fileKey: string): Promise<boolean>;
48
- generateFileKey(prefix: string, filename: string): string;
49
- }
1
+ import { OnModuleInit, OnModuleDestroy, BadRequestException } from "@nestjs/common";
2
+ import { StorageOptions } from "./interfaces/storage-options.interface";
3
+ import { DownloadUrlResult, FileInfo, UploadUrlResult } from "./interfaces/cloudflare-service.interface";
4
+ export declare class AccessModeError extends BadRequestException {
5
+ constructor(message: string);
6
+ }
7
+ export declare class CloudflareService implements OnModuleInit, OnModuleDestroy {
8
+ private readonly storageOptions;
9
+ private s3Client;
10
+ private options;
11
+ private readonly defaultExpiry;
12
+ private readonly defaultAccessMode;
13
+ constructor(storageOptions: StorageOptions);
14
+ private get accessMode();
15
+ private isPublicAccessAllowed;
16
+ onModuleInit(): void;
17
+ onModuleDestroy(): void;
18
+ private initializeClient;
19
+ getOptions(): StorageOptions;
20
+ private sanitizeFilename;
21
+ private detectMimeType;
22
+ getUploadUrl(fileKey: string, fileSize: number, customFilename?: string, contentType?: string): Promise<UploadUrlResult>;
23
+ getDownloadUrl(fileKey: string): Promise<DownloadUrlResult>;
24
+ deleteFile(fileKey: string): Promise<boolean>;
25
+ deleteFiles(fileKeys: string[]): Promise<{
26
+ success: string[];
27
+ failed: string[];
28
+ }>;
29
+ getFileInfo(fileKey: string): Promise<FileInfo | null>;
30
+ fileExists(fileKey: string): Promise<boolean>;
31
+ generateFileKey(prefix: string, filename: string): string;
32
+ }
@@ -1,220 +1,216 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- var __metadata = (this && this.__metadata) || function (k, v) {
42
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
- };
44
- var __param = (this && this.__param) || function (paramIndex, decorator) {
45
- return function (target, key) { decorator(target, key, paramIndex); }
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.CloudflareService = exports.AccessModeError = void 0;
49
- const common_1 = require("@nestjs/common");
50
- const client_s3_1 = require("@aws-sdk/client-s3");
51
- const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
52
- const path = __importStar(require("path"));
53
- const mime = __importStar(require("mime-types"));
54
- const constants_1 = require("./constants");
55
- class AccessModeError extends common_1.BadRequestException {
56
- constructor(message) {
57
- super(message);
58
- this.name = 'AccessModeError';
59
- }
60
- }
61
- exports.AccessModeError = AccessModeError;
62
- let CloudflareService = class CloudflareService {
63
- constructor(storageOptions) {
64
- this.storageOptions = storageOptions;
65
- this.defaultExpiry = 3600;
66
- this.defaultAccessMode = 'hybrid';
67
- this.options = storageOptions;
68
- }
69
- get accessMode() {
70
- return this.options.accessMode || this.defaultAccessMode;
71
- }
72
- isPublicAccessAllowed() {
73
- return this.accessMode === 'public-read' || this.accessMode === 'hybrid';
74
- }
75
- ensurePublicAccessAllowed() {
76
- if (this.accessMode === 'private') {
77
- throw new AccessModeError('Public URL generation is not allowed in "private" access mode. Use presigned URLs for file access.');
78
- }
79
- }
80
- onModuleInit() {
81
- this.initializeClient();
82
- }
83
- onModuleDestroy() {
84
- if (this.s3Client) {
85
- this.s3Client.destroy();
86
- }
87
- }
88
- initializeClient() {
89
- this.s3Client = new client_s3_1.S3Client({
90
- endpoint: this.options.endpoint,
91
- region: this.options.region || 'auto',
92
- credentials: {
93
- accessKeyId: this.options.accessKeyId,
94
- secretAccessKey: this.options.secretAccessKey,
95
- },
96
- forcePathStyle: true,
97
- requestChecksumCalculation: 'WHEN_REQUIRED',
98
- });
99
- }
100
- setOptions(options) {
101
- this.options = options;
102
- this.initializeClient();
103
- }
104
- getOptions() {
105
- return this.options;
106
- }
107
- sanitizeFilename(filename) {
108
- const sanitized = filename.replace(/[^a-zA-Z0-9._-]/g, '_');
109
- const timestamp = Date.now();
110
- const ext = path.extname(sanitized);
111
- const basename = path.basename(sanitized, ext);
112
- return `${basename}_${timestamp}${ext}`;
113
- }
114
- detectMimeType(filename, fallbackContentType = 'application/octet-stream') {
115
- const mimeType = mime.lookup(filename);
116
- return mimeType || fallbackContentType;
117
- }
118
- async getUploadUrl(fileKey, fileSize, customFilename, contentType) {
119
- const filename = customFilename || path.basename(fileKey);
120
- const sanitizedFilename = this.sanitizeFilename(filename);
121
- const finalFileKey = fileKey.includes('/')
122
- ? `${path.dirname(fileKey)}/${sanitizedFilename}`
123
- : sanitizedFilename;
124
- const mimeType = contentType || this.detectMimeType(sanitizedFilename);
125
- const command = new client_s3_1.PutObjectCommand({
126
- Bucket: this.options.bucketName,
127
- Key: finalFileKey,
128
- ContentType: mimeType,
129
- });
130
- const expiry = this.options.signedUrlExpiry || this.defaultExpiry;
131
- const uploadUrl = await (0, s3_request_presigner_1.getSignedUrl)(this.s3Client, command, {
132
- expiresIn: expiry,
133
- signableHeaders: new Set(['host', 'content-type']),
134
- });
135
- let publicUrl = null;
136
- if (this.options.publicUrlBase && this.isPublicAccessAllowed()) {
137
- publicUrl = `${this.options.publicUrlBase}/${finalFileKey}`;
138
- }
139
- return {
140
- uploadUrl,
141
- fileKey: finalFileKey,
142
- publicUrl,
143
- mimeType,
144
- sizeField: fileSize,
145
- };
146
- }
147
- async getDownloadUrl(fileKey) {
148
- const command = new client_s3_1.GetObjectCommand({
149
- Bucket: this.options.bucketName,
150
- Key: fileKey,
151
- });
152
- const expiry = this.options.signedUrlExpiry || this.defaultExpiry;
153
- const downloadUrl = await (0, s3_request_presigner_1.getSignedUrl)(this.s3Client, command, { expiresIn: expiry });
154
- let publicUrl = null;
155
- if (this.options.publicUrlBase && this.isPublicAccessAllowed()) {
156
- publicUrl = `${this.options.publicUrlBase}/${fileKey}`;
157
- }
158
- return {
159
- downloadUrl,
160
- publicUrl,
161
- };
162
- }
163
- async deleteFile(fileKey) {
164
- try {
165
- const command = new client_s3_1.DeleteObjectCommand({
166
- Bucket: this.options.bucketName,
167
- Key: fileKey,
168
- });
169
- await this.s3Client.send(command);
170
- return true;
171
- }
172
- catch (error) {
173
- console.error(`Failed to delete file ${fileKey}:`, error);
174
- return false;
175
- }
176
- }
177
- async deleteFiles(fileKeys) {
178
- const results = await Promise.all(fileKeys.map(async (fileKey) => {
179
- const success = await this.deleteFile(fileKey);
180
- return { fileKey, success };
181
- }));
182
- return {
183
- success: results.filter((r) => r.success).map((r) => r.fileKey),
184
- failed: results.filter((r) => !r.success).map((r) => r.fileKey),
185
- };
186
- }
187
- async getFileInfo(fileKey) {
188
- try {
189
- const command = new client_s3_1.HeadObjectCommand({
190
- Bucket: this.options.bucketName,
191
- Key: fileKey,
192
- });
193
- const response = await this.s3Client.send(command);
194
- return {
195
- size: response.ContentLength || 0,
196
- lastModified: response.LastModified,
197
- contentType: response.ContentType,
198
- };
199
- }
200
- catch (error) {
201
- return null;
202
- }
203
- }
204
- async fileExists(fileKey) {
205
- const fileInfo = await this.getFileInfo(fileKey);
206
- return fileInfo !== null;
207
- }
208
- generateFileKey(prefix, filename) {
209
- const timestamp = Date.now();
210
- const sanitizedFilename = this.sanitizeFilename(filename);
211
- return `${prefix}/${timestamp}_${sanitizedFilename}`;
212
- }
213
- };
214
- exports.CloudflareService = CloudflareService;
215
- exports.CloudflareService = CloudflareService = __decorate([
216
- (0, common_1.Injectable)(),
217
- __param(0, (0, common_1.Inject)(constants_1.STORAGE_OPTIONS)),
218
- __metadata("design:paramtypes", [Object])
219
- ], CloudflareService);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
45
+ return function (target, key) { decorator(target, key, paramIndex); }
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.CloudflareService = exports.AccessModeError = void 0;
49
+ const common_1 = require("@nestjs/common");
50
+ const client_s3_1 = require("@aws-sdk/client-s3");
51
+ const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
52
+ const path = __importStar(require("path"));
53
+ const mime = __importStar(require("mime-types"));
54
+ const constants_1 = require("./constants");
55
+ const validate_options_utils_1 = require("./utils/validate-options.utils");
56
+ class AccessModeError extends common_1.BadRequestException {
57
+ constructor(message) {
58
+ super(message);
59
+ this.name = "AccessModeError";
60
+ }
61
+ }
62
+ exports.AccessModeError = AccessModeError;
63
+ let CloudflareService = class CloudflareService {
64
+ constructor(storageOptions) {
65
+ this.storageOptions = storageOptions;
66
+ this.defaultExpiry = 3600;
67
+ this.defaultAccessMode = "hybrid";
68
+ this.options = this.storageOptions;
69
+ }
70
+ get accessMode() {
71
+ return this.options.accessMode || this.defaultAccessMode;
72
+ }
73
+ isPublicAccessAllowed() {
74
+ return this.accessMode === "public-read" || this.accessMode === "hybrid";
75
+ }
76
+ onModuleInit() {
77
+ (0, validate_options_utils_1.validateOptions)(this.options);
78
+ this.initializeClient();
79
+ }
80
+ onModuleDestroy() {
81
+ if (this.s3Client) {
82
+ this.s3Client.destroy();
83
+ }
84
+ }
85
+ initializeClient() {
86
+ this.s3Client = new client_s3_1.S3Client({
87
+ endpoint: this.options.endpoint,
88
+ region: this.options.region || "auto",
89
+ credentials: {
90
+ accessKeyId: this.options.accessKeyId,
91
+ secretAccessKey: this.options.secretAccessKey,
92
+ },
93
+ forcePathStyle: true,
94
+ requestChecksumCalculation: "WHEN_REQUIRED",
95
+ });
96
+ }
97
+ getOptions() {
98
+ return this.options;
99
+ }
100
+ sanitizeFilename(filename) {
101
+ const sanitized = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
102
+ const unique = `${Date.now()}_${Math.random().toString(36).slice(2)}`;
103
+ const ext = path.extname(sanitized);
104
+ const basename = path.basename(sanitized, ext);
105
+ return `${basename}_${unique}${ext}`;
106
+ }
107
+ detectMimeType(filename, fallbackContentType = "application/octet-stream") {
108
+ const mimeType = mime.lookup(filename);
109
+ return mimeType || fallbackContentType;
110
+ }
111
+ async getUploadUrl(fileKey, fileSize, customFilename, contentType) {
112
+ const filename = customFilename || path.basename(fileKey);
113
+ const sanitizedFilename = this.sanitizeFilename(filename);
114
+ const finalFileKey = fileKey.includes("/")
115
+ ? `${path.dirname(fileKey)}/${sanitizedFilename}`
116
+ : sanitizedFilename;
117
+ const mimeType = contentType || this.detectMimeType(sanitizedFilename);
118
+ const command = new client_s3_1.PutObjectCommand({
119
+ Bucket: this.options.bucketName,
120
+ Key: finalFileKey,
121
+ ContentType: mimeType,
122
+ });
123
+ const expiry = this.options.signedUrlExpiry || this.defaultExpiry;
124
+ const uploadUrl = await (0, s3_request_presigner_1.getSignedUrl)(this.s3Client, command, {
125
+ expiresIn: expiry,
126
+ signableHeaders: new Set(["host", "content-type"]),
127
+ });
128
+ let publicUrl = null;
129
+ if (this.options.publicUrlBase && this.isPublicAccessAllowed()) {
130
+ publicUrl = `${this.options.publicUrlBase}/${finalFileKey}`;
131
+ }
132
+ return {
133
+ uploadUrl,
134
+ fileKey: finalFileKey,
135
+ publicUrl,
136
+ mimeType,
137
+ sizeField: fileSize,
138
+ };
139
+ }
140
+ async getDownloadUrl(fileKey) {
141
+ const command = new client_s3_1.GetObjectCommand({
142
+ Bucket: this.options.bucketName,
143
+ Key: fileKey,
144
+ });
145
+ const expiry = this.options.signedUrlExpiry || this.defaultExpiry;
146
+ const downloadUrl = await (0, s3_request_presigner_1.getSignedUrl)(this.s3Client, command, {
147
+ expiresIn: expiry,
148
+ });
149
+ let publicUrl = null;
150
+ if (this.options.publicUrlBase && this.isPublicAccessAllowed()) {
151
+ publicUrl = `${this.options.publicUrlBase}/${fileKey}`;
152
+ }
153
+ return {
154
+ downloadUrl,
155
+ publicUrl,
156
+ };
157
+ }
158
+ async deleteFile(fileKey) {
159
+ try {
160
+ const command = new client_s3_1.DeleteObjectCommand({
161
+ Bucket: this.options.bucketName,
162
+ Key: fileKey,
163
+ });
164
+ await this.s3Client.send(command);
165
+ return true;
166
+ }
167
+ catch (error) {
168
+ console.error(`Failed to delete file ${fileKey}:`, error);
169
+ return false;
170
+ }
171
+ }
172
+ async deleteFiles(fileKeys) {
173
+ const results = await Promise.all(fileKeys.map(async (fileKey) => {
174
+ const success = await this.deleteFile(fileKey);
175
+ return { fileKey, success };
176
+ }));
177
+ return {
178
+ success: results.filter((r) => r.success).map((r) => r.fileKey),
179
+ failed: results.filter((r) => !r.success).map((r) => r.fileKey),
180
+ };
181
+ }
182
+ async getFileInfo(fileKey) {
183
+ try {
184
+ const command = new client_s3_1.HeadObjectCommand({
185
+ Bucket: this.options.bucketName,
186
+ Key: fileKey,
187
+ });
188
+ const response = await this.s3Client.send(command);
189
+ return {
190
+ size: response.ContentLength || 0,
191
+ lastModified: response.LastModified,
192
+ contentType: response.ContentType,
193
+ };
194
+ }
195
+ catch (error) {
196
+ if (error?.$metadata?.httpStatusCode === 404) {
197
+ return null;
198
+ }
199
+ throw error;
200
+ }
201
+ }
202
+ async fileExists(fileKey) {
203
+ const fileInfo = await this.getFileInfo(fileKey);
204
+ return fileInfo !== null;
205
+ }
206
+ generateFileKey(prefix, filename) {
207
+ return `${prefix}/${this.sanitizeFilename(filename)}`;
208
+ }
209
+ };
210
+ exports.CloudflareService = CloudflareService;
211
+ exports.CloudflareService = CloudflareService = __decorate([
212
+ (0, common_1.Injectable)(),
213
+ __param(0, (0, common_1.Inject)(constants_1.STORAGE_OPTIONS)),
214
+ __metadata("design:paramtypes", [Object])
215
+ ], CloudflareService);
220
216
  //# sourceMappingURL=cloudflare.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare.service.js","sourceRoot":"","sources":["../../src/r2-storage/cloudflare.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwG;AACxG,kDAA0H;AAC1H,wEAA6D;AAC7D,2CAA6B;AAC7B,iDAAmC;AAEnC,2CAA8C;AAE9C,MAAa,eAAgB,SAAQ,4BAAmB;IACtD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AA2BM,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAM5B,YAC2B,cAA+C;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAJzD,kBAAa,GAAG,IAAI,CAAC;QACrB,sBAAiB,GAAe,QAAQ,CAAC;QAKxD,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;IAChC,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,iBAAiB,CAAC;IAC3D,CAAC;IAEO,qBAAqB;QAC3B,OAAO,IAAI,CAAC,UAAU,KAAK,aAAa,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC;IAC3E,CAAC;IAEO,yBAAyB;QAC/B,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,IAAI,eAAe,CACvB,oGAAoG,CACrG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,YAAY;QACV,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,eAAe;QACb,IAAI,IAAI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GAAG,EAAE,CAAC;gBAC7C,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,QAAQ,KAAK,IAAI,CAAC;IAC3B,CAAC;IAED,eAAe,CAAC,MAAc,EAAE,QAAgB;QAC9C,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxD,CAAC;CACF,CAAA;AAlNY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAQR,WAAA,IAAA,eAAM,EAAC,2BAAe,CAAC,CAAA;;GAPf,iBAAiB,CAkN7B"}
@@ -0,0 +1,16 @@
1
+ export interface UploadUrlResult {
2
+ uploadUrl: string;
3
+ fileKey: string;
4
+ publicUrl: string | null;
5
+ mimeType: string;
6
+ sizeField?: number;
7
+ }
8
+ export interface DownloadUrlResult {
9
+ downloadUrl: string;
10
+ publicUrl: string | null;
11
+ }
12
+ export interface FileInfo {
13
+ size: number;
14
+ lastModified?: Date;
15
+ contentType?: string;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=cloudflare-service.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudflare-service.interface.js","sourceRoot":"","sources":["../../../src/r2-storage/interfaces/cloudflare-service.interface.ts"],"names":[],"mappings":""}