express-storage 2.0.2 → 2.0.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.
Files changed (113) hide show
  1. package/dist/cjs/drivers/azure.driver.d.ts.map +1 -0
  2. package/dist/cjs/drivers/azure.driver.js +396 -0
  3. package/dist/cjs/drivers/azure.driver.js.map +1 -0
  4. package/dist/cjs/drivers/base.driver.d.ts.map +1 -0
  5. package/dist/cjs/drivers/base.driver.js +354 -0
  6. package/dist/cjs/drivers/base.driver.js.map +1 -0
  7. package/dist/cjs/drivers/gcs.driver.d.ts.map +1 -0
  8. package/dist/cjs/drivers/gcs.driver.js +359 -0
  9. package/dist/cjs/drivers/gcs.driver.js.map +1 -0
  10. package/dist/cjs/drivers/local.driver.d.ts.map +1 -0
  11. package/dist/cjs/drivers/local.driver.js +628 -0
  12. package/dist/cjs/drivers/local.driver.js.map +1 -0
  13. package/dist/cjs/drivers/s3.driver.d.ts.map +1 -0
  14. package/dist/cjs/drivers/s3.driver.js +392 -0
  15. package/dist/cjs/drivers/s3.driver.js.map +1 -0
  16. package/dist/cjs/factory/driver.factory.d.ts.map +1 -0
  17. package/dist/cjs/factory/driver.factory.js +181 -0
  18. package/dist/cjs/factory/driver.factory.js.map +1 -0
  19. package/dist/cjs/index.d.ts.map +1 -0
  20. package/dist/cjs/index.js +64 -0
  21. package/dist/cjs/index.js.map +1 -0
  22. package/dist/cjs/package.json +1 -0
  23. package/dist/cjs/storage-manager.d.ts.map +1 -0
  24. package/dist/cjs/storage-manager.js +719 -0
  25. package/dist/cjs/storage-manager.js.map +1 -0
  26. package/dist/cjs/types/storage.types.d.ts.map +1 -0
  27. package/dist/cjs/types/storage.types.js +3 -0
  28. package/dist/cjs/types/storage.types.js.map +1 -0
  29. package/dist/cjs/utils/config.utils.d.ts.map +1 -0
  30. package/dist/cjs/utils/config.utils.js +213 -0
  31. package/dist/cjs/utils/config.utils.js.map +1 -0
  32. package/dist/cjs/utils/file.utils.d.ts.map +1 -0
  33. package/dist/cjs/utils/file.utils.js +297 -0
  34. package/dist/cjs/utils/file.utils.js.map +1 -0
  35. package/dist/esm/drivers/azure.driver.d.ts +88 -0
  36. package/dist/esm/drivers/azure.driver.d.ts.map +1 -0
  37. package/dist/esm/drivers/azure.driver.js.map +1 -0
  38. package/dist/esm/drivers/base.driver.d.ts +170 -0
  39. package/dist/esm/drivers/base.driver.d.ts.map +1 -0
  40. package/dist/esm/drivers/base.driver.js.map +1 -0
  41. package/dist/esm/drivers/gcs.driver.d.ts +86 -0
  42. package/dist/esm/drivers/gcs.driver.d.ts.map +1 -0
  43. package/dist/esm/drivers/gcs.driver.js.map +1 -0
  44. package/dist/esm/drivers/local.driver.d.ts +107 -0
  45. package/dist/esm/drivers/local.driver.d.ts.map +1 -0
  46. package/dist/esm/drivers/local.driver.js.map +1 -0
  47. package/dist/esm/drivers/s3.driver.d.ts +89 -0
  48. package/dist/esm/drivers/s3.driver.d.ts.map +1 -0
  49. package/dist/esm/drivers/s3.driver.js.map +1 -0
  50. package/dist/esm/factory/driver.factory.d.ts +62 -0
  51. package/dist/esm/factory/driver.factory.d.ts.map +1 -0
  52. package/dist/esm/factory/driver.factory.js.map +1 -0
  53. package/dist/esm/index.d.ts +30 -0
  54. package/dist/esm/index.d.ts.map +1 -0
  55. package/dist/esm/index.js.map +1 -0
  56. package/dist/esm/package.json +1 -0
  57. package/dist/esm/storage-manager.d.ts +228 -0
  58. package/dist/esm/storage-manager.d.ts.map +1 -0
  59. package/dist/esm/storage-manager.js.map +1 -0
  60. package/dist/esm/types/storage.types.d.ts +295 -0
  61. package/dist/esm/types/storage.types.d.ts.map +1 -0
  62. package/dist/esm/types/storage.types.js.map +1 -0
  63. package/dist/esm/utils/config.utils.d.ts +45 -0
  64. package/dist/esm/utils/config.utils.d.ts.map +1 -0
  65. package/dist/esm/utils/config.utils.js.map +1 -0
  66. package/dist/esm/utils/file.utils.d.ts +142 -0
  67. package/dist/esm/utils/file.utils.d.ts.map +1 -0
  68. package/dist/esm/utils/file.utils.js.map +1 -0
  69. package/package.json +13 -10
  70. package/dist/drivers/azure.driver.d.ts.map +0 -1
  71. package/dist/drivers/azure.driver.js.map +0 -1
  72. package/dist/drivers/base.driver.d.ts.map +0 -1
  73. package/dist/drivers/base.driver.js.map +0 -1
  74. package/dist/drivers/gcs.driver.d.ts.map +0 -1
  75. package/dist/drivers/gcs.driver.js.map +0 -1
  76. package/dist/drivers/local.driver.d.ts.map +0 -1
  77. package/dist/drivers/local.driver.js.map +0 -1
  78. package/dist/drivers/s3.driver.d.ts.map +0 -1
  79. package/dist/drivers/s3.driver.js.map +0 -1
  80. package/dist/factory/driver.factory.d.ts.map +0 -1
  81. package/dist/factory/driver.factory.js.map +0 -1
  82. package/dist/index.d.ts.map +0 -1
  83. package/dist/index.js.map +0 -1
  84. package/dist/storage-manager.d.ts.map +0 -1
  85. package/dist/storage-manager.js.map +0 -1
  86. package/dist/types/storage.types.d.ts.map +0 -1
  87. package/dist/types/storage.types.js.map +0 -1
  88. package/dist/utils/config.utils.d.ts.map +0 -1
  89. package/dist/utils/config.utils.js.map +0 -1
  90. package/dist/utils/file.utils.d.ts.map +0 -1
  91. package/dist/utils/file.utils.js.map +0 -1
  92. /package/dist/{drivers → cjs/drivers}/azure.driver.d.ts +0 -0
  93. /package/dist/{drivers → cjs/drivers}/base.driver.d.ts +0 -0
  94. /package/dist/{drivers → cjs/drivers}/gcs.driver.d.ts +0 -0
  95. /package/dist/{drivers → cjs/drivers}/local.driver.d.ts +0 -0
  96. /package/dist/{drivers → cjs/drivers}/s3.driver.d.ts +0 -0
  97. /package/dist/{factory → cjs/factory}/driver.factory.d.ts +0 -0
  98. /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  99. /package/dist/{storage-manager.d.ts → cjs/storage-manager.d.ts} +0 -0
  100. /package/dist/{types → cjs/types}/storage.types.d.ts +0 -0
  101. /package/dist/{utils → cjs/utils}/config.utils.d.ts +0 -0
  102. /package/dist/{utils → cjs/utils}/file.utils.d.ts +0 -0
  103. /package/dist/{drivers → esm/drivers}/azure.driver.js +0 -0
  104. /package/dist/{drivers → esm/drivers}/base.driver.js +0 -0
  105. /package/dist/{drivers → esm/drivers}/gcs.driver.js +0 -0
  106. /package/dist/{drivers → esm/drivers}/local.driver.js +0 -0
  107. /package/dist/{drivers → esm/drivers}/s3.driver.js +0 -0
  108. /package/dist/{factory → esm/factory}/driver.factory.js +0 -0
  109. /package/dist/{index.js → esm/index.js} +0 -0
  110. /package/dist/{storage-manager.js → esm/storage-manager.js} +0 -0
  111. /package/dist/{types → esm/types}/storage.types.js +0 -0
  112. /package/dist/{utils → esm/utils}/config.utils.js +0 -0
  113. /package/dist/{utils → esm/utils}/file.utils.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azure.driver.d.ts","sourceRoot":"","sources":["../../../src/drivers/azure.driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAIhB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,eAAe,EAAE,aAAa,EAAY,MAAM,2BAA2B,CAAC;AAEvL;;;;;;;;;;GAUG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,OAAO,CAAC,aAAa,CAAS;IAC9B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAElB,MAAM,EAAE,aAAa;IAqDjC;;;;;;OAMG;IACG,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqE3F;;;;;;OAMG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgE/G;;OAEG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4CpE;;;OAGG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAyBhD;;;;;;;;OAQG;IACY,wBAAwB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IA0DhC;;OAEG;IACG,SAAS,CACb,MAAM,CAAC,EAAE,MAAM,EACf,UAAU,GAAE,MAAa,EACzB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,eAAe,CAAC;CAyD5B;AAED;;;;;;;;GAQG;AACH,qBAAa,2BAA4B,SAAQ,kBAAkB;gBACrD,MAAM,EAAE,aAAa;IAYjC,OAAO,CAAC,aAAa;IAIrB;;;;;;;;;;;OAWG;IACY,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA2BtG"}
@@ -0,0 +1,396 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AzurePresignedStorageDriver = exports.AzureStorageDriver = void 0;
4
+ const storage_blob_1 = require("@azure/storage-blob");
5
+ const identity_1 = require("@azure/identity");
6
+ const base_driver_js_1 = require("./base.driver.js");
7
+ /**
8
+ * AzureStorageDriver - Handles file operations with Azure Blob Storage.
9
+ *
10
+ * Supports three authentication methods:
11
+ * 1. Connection string (simplest — recommended for getting started)
12
+ * 2. Account name + Account key (more control)
13
+ * 3. Managed Identity (when running on Azure — no secrets needed!)
14
+ *
15
+ * Important: SAS URL generation requires an account key.
16
+ * Managed Identity works great for direct uploads but can't create presigned URLs.
17
+ */
18
+ class AzureStorageDriver extends base_driver_js_1.BaseStorageDriver {
19
+ constructor(config) {
20
+ super(config);
21
+ this.containerName = config.azureContainerName || config.bucketName || '';
22
+ if (!this.containerName) {
23
+ throw new Error('Azure container name is required. Set BUCKET_NAME environment variable or pass azureContainerName in credentials.');
24
+ }
25
+ this.accountName = '';
26
+ if (config.azureConnectionString) {
27
+ // Method 1: Connection string
28
+ this.blobServiceClient = storage_blob_1.BlobServiceClient.fromConnectionString(config.azureConnectionString);
29
+ const accountNameMatch = config.azureConnectionString.match(/AccountName=([a-z0-9]{3,24})(?:;|$)/i);
30
+ if (accountNameMatch && accountNameMatch[1]) {
31
+ this.accountName = accountNameMatch[1].toLowerCase();
32
+ }
33
+ else {
34
+ throw new Error('Could not extract AccountName from Azure connection string. ' +
35
+ 'Ensure the connection string contains "AccountName=<name>" where name is 3-24 lowercase letters/numbers.');
36
+ }
37
+ const keyMatch = config.azureConnectionString.match(/AccountKey=([A-Za-z0-9+/=]{20,})(?:;|$)/);
38
+ if (keyMatch && keyMatch[1]) {
39
+ this.accountKey = keyMatch[1];
40
+ }
41
+ }
42
+ else if (config.azureAccountName && config.azureAccountKey) {
43
+ // Method 2: Account name + key
44
+ this.accountName = config.azureAccountName;
45
+ this.accountKey = config.azureAccountKey;
46
+ const sharedKeyCredential = new storage_blob_1.StorageSharedKeyCredential(config.azureAccountName, config.azureAccountKey);
47
+ this.blobServiceClient = new storage_blob_1.BlobServiceClient(`https://${config.azureAccountName}.blob.core.windows.net`, sharedKeyCredential);
48
+ }
49
+ else if (config.azureAccountName) {
50
+ // Method 3: Managed Identity
51
+ this.accountName = config.azureAccountName;
52
+ this.blobServiceClient = new storage_blob_1.BlobServiceClient(`https://${config.azureAccountName}.blob.core.windows.net`, new identity_1.DefaultAzureCredential());
53
+ }
54
+ else {
55
+ throw new Error('Azure configuration requires either AZURE_CONNECTION_STRING, AZURE_ACCOUNT_NAME + AZURE_ACCOUNT_KEY, or AZURE_ACCOUNT_NAME (for Managed Identity)');
56
+ }
57
+ this.containerClient = this.blobServiceClient.getContainerClient(this.containerName);
58
+ }
59
+ /**
60
+ * Uploads a file directly to Azure Blob Storage.
61
+ * Handles both memory and disk storage from Multer.
62
+ *
63
+ * For large files (>100MB), uses streaming upload to reduce
64
+ * memory usage and improve reliability.
65
+ */
66
+ async upload(file, options) {
67
+ try {
68
+ const validationErrors = this.validateFile(file);
69
+ if (validationErrors.length > 0) {
70
+ return this.createErrorResult(validationErrors.join(', '));
71
+ }
72
+ const fileName = this.generateFileName(file.originalname);
73
+ const blobPath = this.buildFilePath(fileName);
74
+ const blockBlobClient = this.containerClient.getBlockBlobClient(blobPath);
75
+ const uploadOptions = {
76
+ blobHTTPHeaders: {
77
+ blobContentType: options?.contentType || file.mimetype,
78
+ },
79
+ };
80
+ if (options?.cacheControl) {
81
+ uploadOptions.blobHTTPHeaders.blobCacheControl = options.cacheControl;
82
+ }
83
+ if (options?.contentDisposition) {
84
+ uploadOptions.blobHTTPHeaders.blobContentDisposition = options.contentDisposition;
85
+ }
86
+ if (options?.metadata) {
87
+ uploadOptions.metadata = options.metadata;
88
+ }
89
+ // Use streaming upload for large files to reduce memory usage
90
+ if (this.shouldUseStreaming(file)) {
91
+ const fileStream = this.getFileStream(file);
92
+ const streamOptions = {
93
+ blobHTTPHeaders: uploadOptions.blobHTTPHeaders,
94
+ };
95
+ if (uploadOptions.metadata) {
96
+ streamOptions.metadata = uploadOptions.metadata;
97
+ }
98
+ await blockBlobClient.uploadStream(fileStream, 4 * 1024 * 1024, // 4MB buffer size
99
+ 4, // 4 concurrent uploads
100
+ streamOptions);
101
+ }
102
+ else {
103
+ const fileContent = this.getFileContent(file);
104
+ await blockBlobClient.uploadData(fileContent, uploadOptions);
105
+ }
106
+ // Build the public URL with proper encoding
107
+ const encodedPath = blobPath.split('/').map(segment => encodeURIComponent(segment)).join('/');
108
+ const fileUrl = `https://${this.accountName}.blob.core.windows.net/${this.containerName}/${encodedPath}`;
109
+ return this.createSuccessResult(blobPath, fileUrl);
110
+ }
111
+ catch (error) {
112
+ return this.createErrorResult(error instanceof Error ? error.message : 'Failed to upload file to Azure');
113
+ }
114
+ }
115
+ /**
116
+ * Creates a SAS URL for uploading directly to Azure.
117
+ *
118
+ * Important: Unlike S3 and GCS, Azure SAS URLs do NOT enforce file size
119
+ * or content type. Always call validateAndConfirmUpload() after the
120
+ * client uploads to verify the file is what you expected.
121
+ */
122
+ async generateUploadUrl(fileName, contentType, fileSize) {
123
+ // Security: Defense-in-depth validation (StorageManager also validates)
124
+ // Decode URL-encoded characters first to catch encoded traversal attempts like %2e%2e%2f
125
+ let decodedFileName;
126
+ try {
127
+ decodedFileName = decodeURIComponent(fileName);
128
+ }
129
+ catch {
130
+ return this.createPresignedErrorResult('Invalid fileName: malformed URL encoding');
131
+ }
132
+ if (decodedFileName.includes('..') || decodedFileName.includes('\0')) {
133
+ return this.createPresignedErrorResult('Invalid fileName: path traversal sequences are not allowed');
134
+ }
135
+ // Warn developers that fileSize is not enforced by Azure (unlike S3/GCS)
136
+ if (fileSize !== undefined && process.env['NODE_ENV'] !== 'production') {
137
+ console.warn('[express-storage] Azure SAS URLs do not enforce fileSize constraints. ' +
138
+ 'The provided fileSize (%d bytes) is recorded but not enforced at upload time. ' +
139
+ 'Always call validateAndConfirmUpload() with expectedFileSize to verify the uploaded file.', fileSize);
140
+ }
141
+ try {
142
+ if (!this.accountKey) {
143
+ return this.createPresignedErrorResult('Account key is required for generating SAS URLs. Use connection string or provide AZURE_ACCOUNT_KEY.');
144
+ }
145
+ const blockBlobClient = this.containerClient.getBlockBlobClient(decodedFileName);
146
+ const expiresOn = new Date(Date.now() + (this.getPresignedUrlExpiry() * 1000));
147
+ const resolvedContentType = contentType || 'application/octet-stream';
148
+ const sasOptions = {
149
+ containerName: this.containerName,
150
+ blobName: decodedFileName,
151
+ permissions: storage_blob_1.BlobSASPermissions.parse('cw'),
152
+ expiresOn,
153
+ contentType: resolvedContentType,
154
+ };
155
+ const sasToken = (0, storage_blob_1.generateBlobSASQueryParameters)(sasOptions, new storage_blob_1.StorageSharedKeyCredential(this.accountName, this.accountKey)).toString();
156
+ const uploadUrl = `${blockBlobClient.url}?${sasToken}`;
157
+ return this.createPresignedSuccessResult(uploadUrl);
158
+ }
159
+ catch (error) {
160
+ return this.createPresignedErrorResult(error instanceof Error ? error.message : 'Failed to generate upload URL');
161
+ }
162
+ }
163
+ /**
164
+ * Creates a SAS URL for downloading/viewing a file.
165
+ */
166
+ async generateViewUrl(fileName) {
167
+ // Security: Defense-in-depth validation
168
+ // Decode URL-encoded characters first to catch encoded traversal attempts like %2e%2e%2f
169
+ let decodedFileName;
170
+ try {
171
+ decodedFileName = decodeURIComponent(fileName);
172
+ }
173
+ catch {
174
+ return this.createPresignedErrorResult('Invalid fileName: malformed URL encoding');
175
+ }
176
+ if (decodedFileName.includes('..') || decodedFileName.includes('\0')) {
177
+ return this.createPresignedErrorResult('Invalid fileName: path traversal sequences are not allowed');
178
+ }
179
+ try {
180
+ if (!this.accountKey) {
181
+ return this.createPresignedErrorResult('Account key is required for generating SAS URLs. Use connection string or provide AZURE_ACCOUNT_KEY.');
182
+ }
183
+ const blockBlobClient = this.containerClient.getBlockBlobClient(decodedFileName);
184
+ const expiresOn = new Date(Date.now() + (this.getPresignedUrlExpiry() * 1000));
185
+ const sasToken = (0, storage_blob_1.generateBlobSASQueryParameters)({
186
+ containerName: this.containerName,
187
+ blobName: decodedFileName,
188
+ permissions: storage_blob_1.BlobSASPermissions.parse('r'),
189
+ expiresOn,
190
+ }, new storage_blob_1.StorageSharedKeyCredential(this.accountName, this.accountKey)).toString();
191
+ const viewUrl = `${blockBlobClient.url}?${sasToken}`;
192
+ return this.createPresignedSuccessResult(undefined, viewUrl);
193
+ }
194
+ catch (error) {
195
+ return this.createPresignedErrorResult(error instanceof Error ? error.message : 'Failed to generate view URL');
196
+ }
197
+ }
198
+ /**
199
+ * Deletes a file from Azure Blob Storage.
200
+ * Returns false if the file doesn't exist, throws on real errors.
201
+ */
202
+ async delete(fileName) {
203
+ // Security: Defense-in-depth validation
204
+ // Decode URL-encoded characters first to catch encoded traversal attempts like %2e%2e%2f
205
+ let decodedFileName;
206
+ try {
207
+ decodedFileName = decodeURIComponent(fileName);
208
+ }
209
+ catch {
210
+ return false;
211
+ }
212
+ if (decodedFileName.includes('..') || decodedFileName.includes('\0')) {
213
+ return false;
214
+ }
215
+ const blockBlobClient = this.containerClient.getBlockBlobClient(decodedFileName);
216
+ const exists = await blockBlobClient.exists();
217
+ if (!exists) {
218
+ return false;
219
+ }
220
+ await blockBlobClient.delete();
221
+ return true;
222
+ }
223
+ /**
224
+ * Validates an upload against expected values and deletes invalid files.
225
+ *
226
+ * This is CRITICAL for Azure presigned uploads because Azure doesn't
227
+ * enforce constraints at the URL level. Someone could upload a 10GB
228
+ * executable when you expected a 1MB image.
229
+ *
230
+ * Always call this after presigned uploads with your expected values.
231
+ */
232
+ async validateAndConfirmUpload(reference, options) {
233
+ const deleteOnFailure = options?.deleteOnFailure !== false;
234
+ try {
235
+ const blockBlobClient = this.containerClient.getBlockBlobClient(reference);
236
+ const properties = await blockBlobClient.getProperties();
237
+ const actualContentType = properties.contentType;
238
+ const actualFileSize = properties.contentLength;
239
+ // Validate content type if expected
240
+ if (options?.expectedContentType && actualContentType !== options.expectedContentType) {
241
+ if (deleteOnFailure) {
242
+ await this.delete(reference);
243
+ }
244
+ const errorResult = {
245
+ success: false,
246
+ error: `Content type mismatch: expected '${options.expectedContentType}', got '${actualContentType}'${deleteOnFailure ? ' (file deleted)' : ' (file kept for inspection)'}`,
247
+ };
248
+ if (actualContentType)
249
+ errorResult.actualContentType = actualContentType;
250
+ if (actualFileSize !== undefined)
251
+ errorResult.actualFileSize = actualFileSize;
252
+ return errorResult;
253
+ }
254
+ // Validate file size if expected
255
+ if (options?.expectedFileSize !== undefined && actualFileSize !== options.expectedFileSize) {
256
+ if (deleteOnFailure) {
257
+ await this.delete(reference);
258
+ }
259
+ const errorResult = {
260
+ success: false,
261
+ error: `File size mismatch: expected ${options.expectedFileSize} bytes, got ${actualFileSize} bytes${deleteOnFailure ? ' (file deleted)' : ' (file kept for inspection)'}`,
262
+ };
263
+ if (actualContentType)
264
+ errorResult.actualContentType = actualContentType;
265
+ if (actualFileSize !== undefined)
266
+ errorResult.actualFileSize = actualFileSize;
267
+ return errorResult;
268
+ }
269
+ const viewResult = await this.generateViewUrl(reference);
270
+ const successResult = {
271
+ success: true,
272
+ reference,
273
+ expiresIn: this.getPresignedUrlExpiry(),
274
+ };
275
+ if (viewResult.viewUrl)
276
+ successResult.viewUrl = viewResult.viewUrl;
277
+ if (actualContentType)
278
+ successResult.actualContentType = actualContentType;
279
+ if (actualFileSize !== undefined)
280
+ successResult.actualFileSize = actualFileSize;
281
+ return successResult;
282
+ }
283
+ catch (error) {
284
+ return {
285
+ success: false,
286
+ error: error instanceof Error ? error.message : 'Failed to validate upload',
287
+ };
288
+ }
289
+ }
290
+ /**
291
+ * Lists files in the container with optional prefix filtering and pagination.
292
+ */
293
+ async listFiles(prefix, maxResults = 1000, continuationToken) {
294
+ try {
295
+ const validatedMaxResults = Math.floor(Math.max(1, Math.min(Number.isNaN(maxResults) ? 1000 : maxResults, 1000)));
296
+ const files = [];
297
+ let nextToken;
298
+ const listOptions = {};
299
+ if (prefix)
300
+ listOptions.prefix = prefix;
301
+ const pageOptions = {
302
+ maxPageSize: validatedMaxResults,
303
+ };
304
+ if (continuationToken)
305
+ pageOptions.continuationToken = continuationToken;
306
+ const iterator = this.containerClient.listBlobsFlat(listOptions)
307
+ .byPage(pageOptions);
308
+ const page = await iterator.next();
309
+ if (!page.done && page.value) {
310
+ for (const blob of page.value.segment.blobItems) {
311
+ const fileInfo = { name: blob.name };
312
+ if (blob.properties.contentLength !== undefined) {
313
+ fileInfo.size = blob.properties.contentLength;
314
+ }
315
+ if (blob.properties.contentType) {
316
+ fileInfo.contentType = blob.properties.contentType;
317
+ }
318
+ if (blob.properties.lastModified) {
319
+ fileInfo.lastModified = blob.properties.lastModified;
320
+ }
321
+ files.push(fileInfo);
322
+ }
323
+ nextToken = page.value.continuationToken;
324
+ }
325
+ const result = {
326
+ success: true,
327
+ files,
328
+ };
329
+ if (nextToken) {
330
+ result.nextToken = nextToken;
331
+ }
332
+ return result;
333
+ }
334
+ catch (error) {
335
+ return {
336
+ success: false,
337
+ error: error instanceof Error ? error.message : 'Failed to list files',
338
+ };
339
+ }
340
+ }
341
+ }
342
+ exports.AzureStorageDriver = AzureStorageDriver;
343
+ /**
344
+ * AzurePresignedStorageDriver - Azure driver that returns SAS URLs from upload().
345
+ *
346
+ * Use this when you want clients to upload directly to Azure without
347
+ * the file passing through your server.
348
+ *
349
+ * Critical: Always call validateAndConfirmUpload() after clients upload!
350
+ * Azure doesn't enforce any constraints on SAS URLs.
351
+ */
352
+ class AzurePresignedStorageDriver extends AzureStorageDriver {
353
+ constructor(config) {
354
+ super(config);
355
+ if (!this.hasAccountKey()) {
356
+ throw new Error('AzurePresignedStorageDriver requires an account key for SAS URL generation. ' +
357
+ 'Use AZURE_CONNECTION_STRING or provide both AZURE_ACCOUNT_NAME and AZURE_ACCOUNT_KEY. ' +
358
+ 'Managed Identity cannot be used with presigned URLs - use the regular "azure" driver instead.');
359
+ }
360
+ }
361
+ hasAccountKey() {
362
+ return this.accountKey !== undefined;
363
+ }
364
+ /**
365
+ * Instead of uploading the file, returns a SAS URL for the client to use.
366
+ *
367
+ * The returned fileUrl is the SAS upload URL.
368
+ * After the client uploads, use validateAndConfirmUpload() to verify
369
+ * the file and get a view URL.
370
+ *
371
+ * Note: The `options` parameter (metadata, cacheControl, etc.) is NOT applied
372
+ * when using presigned uploads. These options must be set by the client when
373
+ * making the actual upload request to Azure, or configured via container settings.
374
+ * For server-side uploads with full options support, use the regular 'azure' driver.
375
+ */
376
+ async upload(file, _options) {
377
+ try {
378
+ const validationErrors = this.validateFile(file);
379
+ if (validationErrors.length > 0) {
380
+ return this.createErrorResult(validationErrors.join(', '));
381
+ }
382
+ const fileName = this.generateFileName(file.originalname);
383
+ const filePath = this.buildFilePath(fileName);
384
+ const presignedResult = await this.generateUploadUrl(filePath, file.mimetype, file.size);
385
+ if (!presignedResult.success) {
386
+ return this.createErrorResult(presignedResult.error || 'Failed to generate presigned URL');
387
+ }
388
+ return this.createSuccessResult(filePath, presignedResult.uploadUrl);
389
+ }
390
+ catch (error) {
391
+ return this.createErrorResult(error instanceof Error ? error.message : 'Failed to generate presigned URL');
392
+ }
393
+ }
394
+ }
395
+ exports.AzurePresignedStorageDriver = AzurePresignedStorageDriver;
396
+ //# sourceMappingURL=azure.driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azure.driver.js","sourceRoot":"","sources":["../../../src/drivers/azure.driver.ts"],"names":[],"mappings":";;;AAAA,sDAM6B;AAC7B,8CAAyD;AACzD,qDAAqD;AAGrD;;;;;;;;;;GAUG;AACH,MAAa,kBAAmB,SAAQ,kCAAiB;IAOvD,YAAY,MAAqB;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC1E,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,mHAAmH,CAAC,CAAC;QACvI,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QAEtB,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;YACjC,8BAA8B;YAC9B,IAAI,CAAC,iBAAiB,GAAG,gCAAiB,CAAC,oBAAoB,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;YAE9F,MAAM,gBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;YACpG,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,CAAC,CAA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