@visulima/storage 1.0.0-alpha.11 → 1.0.0-alpha.13

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 (89) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/LICENSE.md +155 -126
  3. package/dist/handler/http/fetch/index.js +3 -3
  4. package/dist/handler/http/hono/index.js +3 -3
  5. package/dist/handler/http/nextjs/index.d.ts +1 -1
  6. package/dist/handler/http/nextjs/index.js +3 -3
  7. package/dist/handler/http/node/index.js +3 -3
  8. package/dist/handler/http/solid-start/index.d.ts +1 -1
  9. package/dist/handler/http/solid-start/index.js +3 -3
  10. package/dist/handler/utils/upload-handlers.d.ts +2 -2
  11. package/dist/index.js +5 -5
  12. package/dist/openapi/index.js +5 -5
  13. package/dist/packem_shared/{AwsLightFile-tTneXZgG.js → AwsLightFile-C-Nd5rtl.js} +1 -1
  14. package/dist/packem_shared/{AwsLightMetaStorage-D9qWQt6q.js → AwsLightMetaStorage-BIDb5EPg.js} +1 -1
  15. package/dist/packem_shared/{AwsLightStorage-CEJTYBVv.js → AwsLightStorage-CMuKw4bI.js} +4 -4
  16. package/dist/packem_shared/{AzureFile-CesgFzps.js → AzureFile-C0kug4w4.js} +1 -1
  17. package/dist/packem_shared/{AzureStorage-CH6nvQx8.js → AzureStorage-98-LRZ1e.js} +7 -5
  18. package/dist/packem_shared/{DiskStorage-DziI2mwX.js → DiskStorage-COMe_G42.js} +5 -5
  19. package/dist/packem_shared/{DiskStorageWithChecksum-B_XY8_cO.js → DiskStorageWithChecksum-BVaaZiyS.js} +18 -9
  20. package/dist/packem_shared/{File-Bb3P23dr.js → File-CPUhj3DI.js} +1 -1
  21. package/dist/packem_shared/{GCSFile-BIEunhAN.js → GCSFile-DaDiCKE2.js} +1 -1
  22. package/dist/packem_shared/{GCSMetaStorage-FypK8Tn1.js → GCSMetaStorage-CSamGLFP.js} +1 -1
  23. package/dist/packem_shared/{GCStorage-CasTo9rF.js → GCStorage-Cpp5KSGP.js} +8 -6
  24. package/dist/packem_shared/{LocalMetaStorage-BnllcjV9.js → LocalMetaStorage-DvnZqf61.js} +1 -1
  25. package/dist/packem_shared/{MediaTransformer-BErvw2vE.js → MediaTransformer-BRRqYA0E.js} +9 -3
  26. package/dist/packem_shared/{Multipart-vxBL2VXm.js → Multipart-BzzvNxt4.js} +2 -2
  27. package/dist/packem_shared/{Multipart-CDDlDOs7.js → Multipart-DLtFLQ8s.js} +1 -1
  28. package/dist/packem_shared/{NetlifyBlobFile-CXzyjqrD.js → NetlifyBlobFile-CfyJtGWN.js} +1 -1
  29. package/dist/packem_shared/{NetlifyBlobMetaStorage-DIkZ2umW.js → NetlifyBlobMetaStorage-eJT6RFy9.js} +1 -1
  30. package/dist/packem_shared/{NetlifyBlobStorage-DEpx_4q-.js → NetlifyBlobStorage-nPv7iIAG.js} +4 -4
  31. package/dist/packem_shared/{Rest-D14vM7aJ.js → Rest-DEa7IA9R.js} +3 -3
  32. package/dist/packem_shared/{Rest-CEj3EhMj.js → Rest-qhMbCn5a.js} +3 -3
  33. package/dist/packem_shared/{S3File-DZiyk9Qt.js → S3File-BXCuJaQZ.js} +1 -1
  34. package/dist/packem_shared/{S3Storage-B0scgwPa.js → S3Storage-wi5XT-yu.js} +2 -2
  35. package/dist/packem_shared/{Tus-WOVg-YnB.js → Tus-Ck0Hdle5.js} +3 -3
  36. package/dist/packem_shared/{Tus-Cjz87bpz.js → Tus-_0vCdHyB.js} +1 -1
  37. package/dist/packem_shared/{VercelBlobFile-BCg4aTEq.js → VercelBlobFile-DkFIIb9Q.js} +1 -1
  38. package/dist/packem_shared/{VercelBlobMetaStorage-c0M-TvAR.js → VercelBlobMetaStorage-DjFmi4vp.js} +1 -1
  39. package/dist/packem_shared/{VercelBlobStorage-wOYxv8F7.js → VercelBlobStorage-CmMgiDgr.js} +4 -4
  40. package/dist/packem_shared/{aws-light-meta-storage-Ba2b_h-o.js → aws-light-meta-storage-BGZEiY3y.js} +2 -2
  41. package/dist/packem_shared/{base-handler-core-BoAqTyz7.js → base-handler-core-lVB-D59L.js} +6 -3
  42. package/dist/packem_shared/{base-handler-fetch-CinvR65S.js → base-handler-fetch-CitgN-Aw.js} +1 -1
  43. package/dist/packem_shared/{base-handler-node-c02H0AxN.js → base-handler-node-BiO2DF87.js} +3 -3
  44. package/dist/packem_shared/{defaultCloudStorageFileNameValidation-CGoYrGB2.js → defaultCloudStorageFileNameValidation-Brw40ZEP.js} +1 -1
  45. package/dist/packem_shared/{disk-storage-DeivH-J5.js → disk-storage-D9RfoKjW.js} +31 -15
  46. package/dist/packem_shared/{gcs-meta-storage-B0Baj0Xr.js → gcs-meta-storage-zzzem93r.js} +2 -2
  47. package/dist/packem_shared/{local-meta-storage-BlOk6m7F.js → local-meta-storage-D-pPc3FI.js} +12 -1
  48. package/dist/packem_shared/{part-match-BMNqHDYD.js → part-match-Dt738Ddb.js} +3 -3
  49. package/dist/packem_shared/{rest-base-D9URIFkc.js → rest-base-k1ory8uB.js} +2 -2
  50. package/dist/packem_shared/{restOpenApiSpec-D1zbmid7.js → restOpenApiSpec-BBJ_SiPE.js} +1 -1
  51. package/dist/packem_shared/{s3-base-storage-CG21uusd.js → s3-base-storage-zUO8u8Cp.js} +4 -7
  52. package/dist/packem_shared/{sharedGet-DAyJfjhl.js → sharedGet-CkSLSnMd.js} +6 -2
  53. package/dist/packem_shared/{storage-CpJpqLdn.js → storage-5XW1E7XU.js} +11 -7
  54. package/dist/packem_shared/{transformOpenApiSpec-BC0r6PzI.js → transformOpenApiSpec-BodFhFls.js} +1 -1
  55. package/dist/packem_shared/{tusOpenApiSpec-BLIjKf0s.js → tusOpenApiSpec-DzppyJTW.js} +1 -1
  56. package/dist/packem_shared/{xhrOpenApiSpec-kItrSAsc.js → xhrOpenApiSpec-CXz7BC5J.js} +1 -1
  57. package/dist/storage/aws/index.js +2 -2
  58. package/dist/storage/aws/s3-base-storage.d.ts +1 -1
  59. package/dist/storage/aws/s3-storage.d.ts +1 -1
  60. package/dist/storage/aws/types.d.ts +1 -2
  61. package/dist/storage/aws-light/aws-light-storage.d.ts +3 -2
  62. package/dist/storage/aws-light/index.js +3 -3
  63. package/dist/storage/aws-light/types.d.ts +1 -2
  64. package/dist/storage/azure/azure-storage.d.ts +2 -2
  65. package/dist/storage/azure/index.js +2 -2
  66. package/dist/storage/azure/types.d.ts +1 -2
  67. package/dist/storage/gcs/gcs-storage.d.ts +2 -2
  68. package/dist/storage/gcs/index.js +3 -3
  69. package/dist/storage/gcs/types.d.ts +1 -2
  70. package/dist/storage/local/disk-storage.d.ts +1 -1
  71. package/dist/storage/local/index.js +3 -3
  72. package/dist/storage/local/local-meta-storage.d.ts +2 -7
  73. package/dist/storage/meta-storage-options.d.ts +11 -0
  74. package/dist/storage/meta-storage.d.ts +1 -1
  75. package/dist/storage/netlify-blob/index.js +3 -3
  76. package/dist/storage/netlify-blob/netlify-blob-meta-storage.d.ts +1 -2
  77. package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +2 -2
  78. package/dist/storage/netlify-blob/types.d.ts +1 -2
  79. package/dist/storage/types.d.ts +2 -6
  80. package/dist/storage/vercel-blob/index.js +3 -3
  81. package/dist/storage/vercel-blob/types.d.ts +1 -2
  82. package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +1 -2
  83. package/dist/storage/vercel-blob/vercel-blob-storage.d.ts +2 -2
  84. package/dist/transformer/base-transformer.d.ts +1 -1
  85. package/dist/transformer/index.js +1 -1
  86. package/dist/transformer/transformer-config.d.ts +16 -0
  87. package/dist/transformer/types.d.ts +2 -15
  88. package/dist/utils/types.d.ts +1 -1
  89. package/package.json +6 -6
@@ -1,7 +1,7 @@
1
1
  import 'node:crypto';
2
2
  import 'gaxios';
3
3
  import 'google-auth-library';
4
- export { G as default } from './gcs-meta-storage-B0Baj0Xr.js';
4
+ export { G as default } from './gcs-meta-storage-zzzem93r.js';
5
5
  import './MetaStorage-pECeFOad.js';
6
6
  import './Metadata-DRLXeJ0F.js';
7
7
  import './GCSConfig-vPP22kN6.js';
@@ -1,13 +1,13 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { request } from 'gaxios';
3
3
  import { GoogleAuth } from 'google-auth-library';
4
- import { r as retryOptions, G as GCSMetaStorage, g as getRangeEnd, p as package_, b as buildContentRange } from './gcs-meta-storage-B0Baj0Xr.js';
5
- import { p as partMatch, d as detectFileTypeFromStream, g as getFileStatus } from './part-match-BMNqHDYD.js';
4
+ import { r as retryOptions, G as GCSMetaStorage, g as getRangeEnd, p as package_, b as buildContentRange } from './gcs-meta-storage-zzzem93r.js';
5
+ import { p as partMatch, d as detectFileTypeFromStream, g as getFileStatus } from './part-match-Dt738Ddb.js';
6
6
  import { throwErrorCode, ERRORS } from './ERRORS-D0apMqnc.js';
7
- import { B as BaseStorage, t as toMilliseconds } from './storage-CpJpqLdn.js';
8
- import { L as LocalMetaStorage } from './local-meta-storage-BlOk6m7F.js';
7
+ import { B as BaseStorage, t as toMilliseconds } from './storage-5XW1E7XU.js';
8
+ import { L as LocalMetaStorage } from './local-meta-storage-D-pPc3FI.js';
9
9
  import GCSConfig from './GCSConfig-vPP22kN6.js';
10
- import GCSFile from './GCSFile-BIEunhAN.js';
10
+ import GCSFile from './GCSFile-DaDiCKE2.js';
11
11
  import { h as hasContent } from './has-content-CY66ehMK.js';
12
12
 
13
13
  class FetchError extends Error {
@@ -350,7 +350,9 @@ class GCStorage extends BaseStorage {
350
350
  const options = { method: "PUT" };
351
351
  if (body?.on) {
352
352
  const abortController = new AbortController();
353
- body.on("aborted", () => abortController.abort());
353
+ body.on("aborted", () => {
354
+ abortController.abort();
355
+ });
354
356
  options.body = body;
355
357
  options.signal = abortController.signal;
356
358
  }
@@ -4,4 +4,4 @@ import './ERRORS-D0apMqnc.js';
4
4
  import './MetaStorage-pECeFOad.js';
5
5
  import './Metadata-DRLXeJ0F.js';
6
6
  import './path-aV9lMdcn-DMU5H1-h.js';
7
- export { L as default } from './local-meta-storage-BlOk6m7F.js';
7
+ export { L as default } from './local-meta-storage-D-pPc3FI.js';
@@ -209,9 +209,15 @@ class MediaTransformer {
209
209
  image: this.imageTransformer?.getCacheStats(),
210
210
  video: this.videoTransformer?.getCacheStats()
211
211
  };
212
- if (stats.image === void 0) delete stats.image;
213
- if (stats.video === void 0) delete stats.video;
214
- if (stats.audio === void 0) delete stats.audio;
212
+ if (stats.image === void 0) {
213
+ delete stats.image;
214
+ }
215
+ if (stats.video === void 0) {
216
+ delete stats.video;
217
+ }
218
+ if (stats.audio === void 0) {
219
+ delete stats.audio;
220
+ }
215
221
  return stats;
216
222
  }
217
223
  /**
@@ -1,9 +1,9 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import { parseMultipartRequest, MaxFileSizeExceededError, MultipartParseError } from '@remix-run/multipart-parser/node';
3
3
  import { c as createHttpError } from './headers-YLRp1dLo.js';
4
- import { g as getIdFromRequest } from './base-handler-core-BoAqTyz7.js';
4
+ import { g as getIdFromRequest } from './base-handler-core-lVB-D59L.js';
5
5
  import { V as ValidationError } from './validator-DuO17wFF.js';
6
- import { B as BaseHandlerNode } from './base-handler-node-c02H0AxN.js';
6
+ import { B as BaseHandlerNode } from './base-handler-node-BiO2DF87.js';
7
7
  import { M as MultipartBase } from './multipart-base-C994naBi.js';
8
8
 
9
9
  const RE_MIME = /^multipart\/.+|application\/x-www-form-urlencoded$/i;
@@ -2,7 +2,7 @@ import { Readable } from 'node:stream';
2
2
  import { parseMultipartRequest, MaxFileSizeExceededError, MultipartParseError } from '@remix-run/multipart-parser';
3
3
  import { c as createHttpError } from './headers-YLRp1dLo.js';
4
4
  import { V as ValidationError } from './validator-DuO17wFF.js';
5
- import { B as BaseHandlerFetch } from './base-handler-fetch-CinvR65S.js';
5
+ import { B as BaseHandlerFetch } from './base-handler-fetch-CitgN-Aw.js';
6
6
  import { M as MultipartBase } from './multipart-base-C994naBi.js';
7
7
 
8
8
  const RE_MIME = /^multipart\/.+|application\/x-www-form-urlencoded$/i;
@@ -1,4 +1,4 @@
1
- import File from './File-Bb3P23dr.js';
1
+ import File from './File-CPUhj3DI.js';
2
2
 
3
3
  class NetlifyBlobFile extends File {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { L as LocalMetaStorage } from './local-meta-storage-BlOk6m7F.js';
1
+ import { L as LocalMetaStorage } from './local-meta-storage-D-pPc3FI.js';
2
2
 
3
3
  class NetlifyBlobMetaStorage extends LocalMetaStorage {
4
4
  constructor(config) {
@@ -1,9 +1,9 @@
1
1
  import { getStore } from '@netlify/blobs';
2
- import { g as getFileStatus, p as partMatch, a as detectFileTypeFromBuffer } from './part-match-BMNqHDYD.js';
3
- import { B as BaseStorage, t as toMilliseconds, u as updateMetadata } from './storage-CpJpqLdn.js';
2
+ import { g as getFileStatus, p as partMatch, a as detectFileTypeFromBuffer } from './part-match-Dt738Ddb.js';
3
+ import { B as BaseStorage, t as toMilliseconds, u as updateMetadata } from './storage-5XW1E7XU.js';
4
4
  import { createRetryWrapper } from './isRetryableError-Dycp7127.js';
5
- import { L as LocalMetaStorage } from './local-meta-storage-BlOk6m7F.js';
6
- import NetlifyBlobFile from './NetlifyBlobFile-CXzyjqrD.js';
5
+ import { L as LocalMetaStorage } from './local-meta-storage-D-pPc3FI.js';
6
+ import NetlifyBlobFile from './NetlifyBlobFile-CfyJtGWN.js';
7
7
  import { u as updateSize } from './update-size-CCGm6i1J.js';
8
8
  import { h as hasContent } from './has-content-CY66ehMK.js';
9
9
 
@@ -1,8 +1,8 @@
1
1
  import { c as createHttpError } from './headers-YLRp1dLo.js';
2
2
  import { ERRORS } from './ERRORS-D0apMqnc.js';
3
- import { b as getRequestStream } from './base-handler-core-BoAqTyz7.js';
4
- import { B as BaseHandlerFetch } from './base-handler-fetch-CinvR65S.js';
5
- import { R as RestBase, c as parseContentDispositionValue } from './rest-base-D9URIFkc.js';
3
+ import { b as getRequestStream } from './base-handler-core-lVB-D59L.js';
4
+ import { B as BaseHandlerFetch } from './base-handler-fetch-CitgN-Aw.js';
5
+ import { R as RestBase, c as parseContentDispositionValue } from './rest-base-k1ory8uB.js';
6
6
 
7
7
  class RestFetch extends BaseHandlerFetch {
8
8
  /**
@@ -1,8 +1,8 @@
1
1
  import { c as createHttpError } from './headers-YLRp1dLo.js';
2
2
  import { hasBody } from 'type-is';
3
- import { a as getHeader, b as getRequestStream, g as getIdFromRequest, r as readBody } from './base-handler-core-BoAqTyz7.js';
4
- import { B as BaseHandlerNode } from './base-handler-node-c02H0AxN.js';
5
- import { R as RestBase, v as validateRequestBody, a as validateContentLength, e as extractFileInit, p as parseContentDisposition, b as parseChunkHeaders } from './rest-base-D9URIFkc.js';
3
+ import { a as getHeader, b as getRequestStream, g as getIdFromRequest, r as readBody } from './base-handler-core-lVB-D59L.js';
4
+ import { B as BaseHandlerNode } from './base-handler-node-BiO2DF87.js';
5
+ import { R as RestBase, v as validateRequestBody, a as validateContentLength, e as extractFileInit, p as parseContentDisposition, b as parseChunkHeaders } from './rest-base-k1ory8uB.js';
6
6
 
7
7
  class Rest extends BaseHandlerNode {
8
8
  /**
@@ -1,4 +1,4 @@
1
- import File from './File-Bb3P23dr.js';
1
+ import File from './File-CPUhj3DI.js';
2
2
 
3
3
  class S3File extends File {
4
4
  Parts;
@@ -1,10 +1,10 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import { CreateMultipartUploadCommand, UploadPartCommand, CompleteMultipartUploadCommand, AbortMultipartUploadCommand, ListPartsCommand, GetObjectCommand, HeadObjectCommand, DeleteObjectCommand, CopyObjectCommand, ListObjectsV2Command, waitUntilBucketExists, S3Client } from '@aws-sdk/client-s3';
3
3
  import { fromIni } from '@aws-sdk/credential-providers';
4
- import { S as S3BaseStorage } from './s3-base-storage-CG21uusd.js';
4
+ import { S as S3BaseStorage } from './s3-base-storage-zUO8u8Cp.js';
5
5
  import { ReadableStream } from 'node:stream/web';
6
6
  import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
7
- import S3File from './S3File-DZiyk9Qt.js';
7
+ import S3File from './S3File-BXCuJaQZ.js';
8
8
  import S3MetaStorage from './S3MetaStorage-yT4CznlV.js';
9
9
 
10
10
  class S3ClientAdapter {
@@ -1,7 +1,7 @@
1
1
  import { format } from 'node:url';
2
2
  import { c as createHttpError } from './headers-YLRp1dLo.js';
3
- import { a as getHeader, b as getRequestStream, g as getIdFromRequest, c as getBaseUrl } from './base-handler-core-BoAqTyz7.js';
4
- import { B as BaseHandlerNode } from './base-handler-node-c02H0AxN.js';
3
+ import { a as getHeader, b as getRequestStream, g as getIdFromRequest, c as getBaseUrl } from './base-handler-core-lVB-D59L.js';
4
+ import { B as BaseHandlerNode } from './base-handler-node-BiO2DF87.js';
5
5
  import { TusBase } from './TUS_RESUMABLE-Dtfsffnj.js';
6
6
  export { TUS_RESUMABLE, TUS_VERSION } from './TUS_RESUMABLE-Dtfsffnj.js';
7
7
 
@@ -188,7 +188,7 @@ class Tus extends BaseHandlerNode {
188
188
  const { pathname } = url;
189
189
  const query = Object.fromEntries(url.searchParams.entries());
190
190
  const relative = format({ pathname: `${pathname}/${file.id}`, query });
191
- return `${this.storage.config.useRelativeLocation ? relative : getBaseUrl({ }) + relative}`;
191
+ return this.storage.config.useRelativeLocation ? relative : getBaseUrl({ }) + relative;
192
192
  }
193
193
  }
194
194
 
@@ -1,5 +1,5 @@
1
1
  import { c as createHttpError } from './headers-YLRp1dLo.js';
2
- import { B as BaseHandlerFetch } from './base-handler-fetch-CinvR65S.js';
2
+ import { B as BaseHandlerFetch } from './base-handler-fetch-CitgN-Aw.js';
3
3
  import { TusBase } from './TUS_RESUMABLE-Dtfsffnj.js';
4
4
  export { TUS_RESUMABLE, TUS_VERSION } from './TUS_RESUMABLE-Dtfsffnj.js';
5
5
 
@@ -1,4 +1,4 @@
1
- import File from './File-Bb3P23dr.js';
1
+ import File from './File-CPUhj3DI.js';
2
2
 
3
3
  class VercelBlobFile extends File {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { L as LocalMetaStorage } from './local-meta-storage-BlOk6m7F.js';
1
+ import { L as LocalMetaStorage } from './local-meta-storage-D-pPc3FI.js';
2
2
 
3
3
  class VercelBlobMetaStorage extends LocalMetaStorage {
4
4
  constructor(config) {
@@ -1,8 +1,8 @@
1
1
  import { put, del, copy, list } from '@vercel/blob';
2
- import { g as getFileStatus, p as partMatch, a as detectFileTypeFromBuffer } from './part-match-BMNqHDYD.js';
3
- import { B as BaseStorage, t as toMilliseconds } from './storage-CpJpqLdn.js';
4
- import { L as LocalMetaStorage } from './local-meta-storage-BlOk6m7F.js';
5
- import VercelBlobFile from './VercelBlobFile-BCg4aTEq.js';
2
+ import { g as getFileStatus, p as partMatch, a as detectFileTypeFromBuffer } from './part-match-Dt738Ddb.js';
3
+ import { B as BaseStorage, t as toMilliseconds } from './storage-5XW1E7XU.js';
4
+ import { L as LocalMetaStorage } from './local-meta-storage-D-pPc3FI.js';
5
+ import VercelBlobFile from './VercelBlobFile-DkFIIb9Q.js';
6
6
  import { u as updateSize } from './update-size-CCGm6i1J.js';
7
7
  import { h as hasContent } from './has-content-CY66ehMK.js';
8
8
 
@@ -11,7 +11,7 @@ const parseXml = (text) => {
11
11
  const matches = [...cleanText.matchAll(tagRegex)];
12
12
  for (const match of matches) {
13
13
  const [, tagName, content] = match;
14
- if (tagName && content && content.trim()) {
14
+ if (tagName && content?.trim()) {
15
15
  if (result[tagName]) {
16
16
  if (!Array.isArray(result[tagName])) {
17
17
  result[tagName] = [result[tagName]];
@@ -26,7 +26,7 @@ const parseXml = (text) => {
26
26
  let nestedMatch;
27
27
  while ((nestedMatch = nestedRegex.exec(cleanText)) !== null) {
28
28
  const [, tagName, innerContent] = nestedMatch;
29
- if (tagName && innerContent && innerContent.includes("<")) {
29
+ if (tagName && innerContent?.includes("<")) {
30
30
  const nested = parseXml(innerContent);
31
31
  if (Object.keys(nested).length > 0) {
32
32
  result[tagName] = nested;
@@ -31,11 +31,14 @@ const readBody = (request, encoding = "utf8", limit) => new Promise((resolve, re
31
31
  request.setEncoding(encoding);
32
32
  request.on("data", (chunk) => {
33
33
  if (body.length + chunk.length > limit) {
34
- return reject(new Error("Request body length limit exceeded"));
34
+ reject(new Error("Request body length limit exceeded"));
35
+ return;
35
36
  }
36
37
  body += chunk;
37
38
  });
38
- request.once("end", () => resolve(body));
39
+ request.once("end", () => {
40
+ resolve(body);
41
+ });
39
42
  });
40
43
  const getHeader = (request, name, all = false) => {
41
44
  const raw = request.headers?.[name.toLowerCase()];
@@ -223,7 +226,7 @@ class BaseHandlerCore extends EventEmitter {
223
226
  */
224
227
  // eslint-disable-next-line class-methods-use-this
225
228
  parseRangeHeader(rangeHeader, fileSize) {
226
- if (!rangeHeader || !rangeHeader.startsWith("bytes=")) {
229
+ if (!rangeHeader?.startsWith("bytes=")) {
227
230
  return void 0;
228
231
  }
229
232
  const ranges = rangeHeader.slice(6).split(",");
@@ -1,6 +1,6 @@
1
1
  import { H as HeaderUtilities, h as httpErrorsExports } from './headers-YLRp1dLo.js';
2
2
  import { ERRORS, isUploadError } from './ERRORS-D0apMqnc.js';
3
- import { B as BaseHandlerCore, p as pick } from './base-handler-core-BoAqTyz7.js';
3
+ import { B as BaseHandlerCore, p as pick } from './base-handler-core-lVB-D59L.js';
4
4
  import { i as isValidationError } from './validator-DuO17wFF.js';
5
5
  import { waitForStorage } from './waitForStorage-Cscw85sx.js';
6
6
 
@@ -3,7 +3,7 @@ import { H as HeaderUtilities, h as httpErrorsExports, c as createHttpError } fr
3
3
  import mime from 'mime';
4
4
  import { ERRORS, isUploadError } from './ERRORS-D0apMqnc.js';
5
5
  import { match } from 'path-to-regexp';
6
- import { p as pick, B as BaseHandlerCore, s as setHeaders, d as getRealPath, u as uuidRegex } from './base-handler-core-BoAqTyz7.js';
6
+ import { p as pick, B as BaseHandlerCore, s as setHeaders, d as getRealPath, u as uuidRegex } from './base-handler-core-lVB-D59L.js';
7
7
  import { i as isValidationError } from './validator-DuO17wFF.js';
8
8
  import { waitForStorage } from './waitForStorage-Cscw85sx.js';
9
9
  import { PassThrough } from 'node:stream';
@@ -523,7 +523,7 @@ class BaseHandlerNode extends BaseHandlerCore {
523
523
  // eslint-disable-next-line sonarjs/cognitive-complexity
524
524
  async get(request, _response) {
525
525
  const pathMatch = filePathUrlMatcher(getRealPath(request));
526
- if (pathMatch && pathMatch.params.uuid) {
526
+ if (pathMatch?.params.uuid) {
527
527
  const { ext, metadata, uuid: rawUuid } = pathMatch.params;
528
528
  const uuid = ext ? rawUuid.replace(new RegExp(String.raw`\.${ext}$`), "") : rawUuid;
529
529
  if (metadata === "metadata" && getRealPath(request).endsWith("/metadata")) {
@@ -676,7 +676,7 @@ class BaseHandlerNode extends BaseHandlerCore {
676
676
  */
677
677
  async download(request, response) {
678
678
  const pathMatch = filePathUrlMatcher(getRealPath(request));
679
- if (!pathMatch || !pathMatch.params.uuid || !uuidRegex.test(pathMatch.params.uuid)) {
679
+ if (!pathMatch?.params.uuid || !uuidRegex.test(pathMatch.params.uuid)) {
680
680
  throw createHttpError(404, "File not found");
681
681
  }
682
682
  const { ext, uuid } = pathMatch.params;
@@ -5,7 +5,7 @@ import 'type-is';
5
5
  import './NoOpMetrics-DhAk5rXc.js';
6
6
  import './cache-B88MXQ_2.js';
7
7
  import './ERRORS-D0apMqnc.js';
8
- export { B as BaseStorage, d as defaultCloudStorageFileNameValidation, a as defaultFilesystemFileNameValidation } from './storage-CpJpqLdn.js';
8
+ export { B as BaseStorage, d as defaultCloudStorageFileNameValidation, a as defaultFilesystemFileNameValidation } from './storage-5XW1E7XU.js';
9
9
  import './validator-DuO17wFF.js';
10
10
  import './path-aV9lMdcn-DMU5H1-h.js';
11
11
  import './is-expired-CTThU1q5.js';
@@ -4,12 +4,12 @@ import { PassThrough, Transform, pipeline } from 'node:stream';
4
4
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers-BqLXS_qQ.js';
5
5
  import require$$0 from 'crypto';
6
6
  import require$$1 from 'fs';
7
- import { g as getFileStatus, p as partMatch, d as detectFileTypeFromStream } from './part-match-BMNqHDYD.js';
7
+ import { g as getFileStatus, p as partMatch, d as detectFileTypeFromStream } from './part-match-Dt738Ddb.js';
8
8
  import { throwErrorCode, isUploadError, ERRORS } from './ERRORS-D0apMqnc.js';
9
9
  import { createHash } from 'node:crypto';
10
- import { B as BaseStorage, a as defaultFilesystemFileNameValidation, t as toMilliseconds } from './storage-CpJpqLdn.js';
11
- import { a as assertValidFileOrDirectoryPath, g as getFileInfoType, e as ensureDir, t as toPath, i as isAccessible, L as LocalMetaStorage, b as readFile, r as remove } from './local-meta-storage-BlOk6m7F.js';
12
- import File from './File-Bb3P23dr.js';
10
+ import { B as BaseStorage, a as defaultFilesystemFileNameValidation, t as toMilliseconds } from './storage-5XW1E7XU.js';
11
+ import { a as assertValidFileOrDirectoryPath, g as getFileInfoType, e as ensureDir, t as toPath, i as isAccessible, L as LocalMetaStorage, b as readFile, r as remove } from './local-meta-storage-D-pPc3FI.js';
12
+ import File from './File-CPUhj3DI.js';
13
13
  import { createRequire } from 'node:module';
14
14
  import { d as dirname, r as resolve, j as join, n as normalize, b as basename, i as isAbsolute } from './path-aV9lMdcn-DMU5H1-h.js';
15
15
  import { u as updateSize } from './update-size-CCGm6i1J.js';
@@ -126,9 +126,16 @@ async function* walk(directory, {
126
126
  if (maxDepth < 0) {
127
127
  return;
128
128
  }
129
- const mappedMatch = match ? match.map((pattern) => typeof pattern === "string" ? globToRegExp(pattern) : pattern) : void 0;
130
- const mappedSkip = skip ? skip.map((pattern) => typeof pattern === "string" ? globToRegExp(pattern) : pattern) : void 0;
131
- directory = resolve(toPath(directory));
129
+ const mappedMatch = match ? match.map(
130
+ // eslint-disable-next-line no-confusing-arrow
131
+ (pattern) => typeof pattern === "string" ? globToRegExp(pattern) : pattern
132
+ ) : void 0;
133
+ const mappedSkip = skip ? skip.map(
134
+ // eslint-disable-next-line no-confusing-arrow
135
+ (pattern) => typeof pattern === "string" ? globToRegExp(pattern) : pattern
136
+ ) : void 0;
137
+ const resolvedDirectory = resolve(toPath(directory));
138
+ directory = resolvedDirectory;
132
139
  if (includeDirectories && walkInclude(directory, extensions, mappedMatch, mappedSkip)) {
133
140
  yield await _createWalkEntry(directory);
134
141
  }
@@ -776,15 +783,22 @@ class DiskStorage extends BaseStorage {
776
783
  cleanupStreams();
777
784
  resolve([Number.NaN, code]);
778
785
  };
779
- lengthChecker.on("error", () => failWithCode(ERRORS.FILE_CONFLICT));
780
- checksumChecker.on("error", () => failWithCode(ERRORS.CHECKSUM_MISMATCH));
781
- part.body.on("aborted", () => failWithCode(keepPartial ? void 0 : ERRORS.REQUEST_ABORTED));
786
+ lengthChecker.on("error", () => {
787
+ failWithCode(ERRORS.FILE_CONFLICT);
788
+ });
789
+ checksumChecker.on("error", () => {
790
+ failWithCode(ERRORS.CHECKSUM_MISMATCH);
791
+ });
792
+ part.body.on("aborted", () => {
793
+ failWithCode(keepPartial ? void 0 : ERRORS.REQUEST_ABORTED);
794
+ });
782
795
  part.body.on("error", (error) => {
783
796
  cleanupStreams();
784
797
  reject(error);
785
798
  });
786
799
  if (signal?.aborted) {
787
- return failWithCode(keepPartial ? void 0 : ERRORS.REQUEST_ABORTED);
800
+ failWithCode(keepPartial ? void 0 : ERRORS.REQUEST_ABORTED);
801
+ return;
788
802
  }
789
803
  if (signal) {
790
804
  signal.addEventListener("abort", () => {
@@ -799,12 +813,14 @@ class DiskStorage extends BaseStorage {
799
813
  pipeline(part.body, lengthChecker, checksumChecker, destination, (error) => {
800
814
  if (error) {
801
815
  cleanupStreams();
802
- if (signal && signal.aborted) {
803
- return resolve([Number.NaN, keepPartial ? void 0 : ERRORS.REQUEST_ABORTED]);
816
+ if (signal?.aborted) {
817
+ resolve([Number.NaN, keepPartial ? void 0 : ERRORS.REQUEST_ABORTED]);
818
+ return;
804
819
  }
805
- return resolve([Number.NaN, ERRORS.FILE_ERROR]);
820
+ resolve([Number.NaN, ERRORS.FILE_ERROR]);
821
+ return;
806
822
  }
807
- return resolve([part.start + destination.bytesWritten]);
823
+ resolve([part.start + destination.bytesWritten]);
808
824
  });
809
825
  });
810
826
  }
@@ -7,14 +7,14 @@ import GCSConfig from './GCSConfig-vPP22kN6.js';
7
7
  import { h as hasContent } from './has-content-CY66ehMK.js';
8
8
 
9
9
  var name = "@visulima/storage";
10
- var version = "1.0.0-alpha.10";
10
+ var version = "1.0.0-alpha.12";
11
11
  const package_ = {
12
12
  name: name,
13
13
  version: version};
14
14
 
15
15
  const getRangeEnd = (range) => {
16
16
  const match = range.match(/(\d+)-(\d+)/);
17
- const end = match && match[2] ? +match[2] : 0;
17
+ const end = match?.[2] ? +match[2] : 0;
18
18
  return end > 0 ? end + 1 : 0;
19
19
  };
20
20
  const buildContentRange = (part) => {
@@ -463,6 +463,17 @@ const readFile = async (path, options) => {
463
463
  });
464
464
  };
465
465
 
466
+ const buildRmOptions = (options) => {
467
+ const rmOptions = { force: true, recursive: true };
468
+ if (options?.maxRetries !== void 0) {
469
+ rmOptions.maxRetries = options.maxRetries;
470
+ }
471
+ if (options?.retryDelay !== void 0) {
472
+ rmOptions.retryDelay = options.retryDelay;
473
+ }
474
+ return rmOptions;
475
+ };
476
+
466
477
  const __cjs_require$1 = createRequire(import.meta.url);
467
478
  const __cjs_getProcess$1 = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
468
479
  const __cjs_getBuiltinModule$1 = (module) => {
@@ -485,7 +496,7 @@ const remove = async (path, options = {}) => {
485
496
  } catch {
486
497
  }
487
498
  try {
488
- await rm(path, { force: true, maxRetries: options.maxRetries, recursive: true, retryDelay: options.retryDelay });
499
+ await rm(path, buildRmOptions(options));
489
500
  } catch {
490
501
  }
491
502
  };
@@ -50,7 +50,7 @@ const detectFileTypeFromStream = async (stream, options) => {
50
50
  resolve();
51
51
  return;
52
52
  }
53
- const timeout = setTimeout(() => resolve(), 10);
53
+ const timeout = setTimeout(resolve, 10);
54
54
  peekStream.once("data", () => {
55
55
  clearTimeout(timeout);
56
56
  resolve();
@@ -61,14 +61,14 @@ const detectFileTypeFromStream = async (stream, options) => {
61
61
  });
62
62
  }),
63
63
  new Promise((resolve) => {
64
- setTimeout(() => resolve(), 10);
64
+ setTimeout(resolve, 10);
65
65
  })
66
66
  ]);
67
67
  if (detectionPromise) {
68
68
  await Promise.race([
69
69
  detectionPromise.then(() => void 0),
70
70
  new Promise((resolve) => {
71
- setTimeout(() => resolve(), 150);
71
+ setTimeout(resolve, 150);
72
72
  })
73
73
  ]).catch(() => {
74
74
  });
@@ -1,6 +1,6 @@
1
1
  import { c as createHttpError } from './headers-YLRp1dLo.js';
2
2
  import { hasBody } from 'type-is';
3
- import { a as getHeader } from './base-handler-core-BoAqTyz7.js';
3
+ import { a as getHeader } from './base-handler-core-lVB-D59L.js';
4
4
  import { ERRORS } from './ERRORS-D0apMqnc.js';
5
5
  import { b as buildResponseFile, a as buildFileHeaders, c as buildChunkedUploadHeaders, d as buildFileMetadataHeaders } from './response-builder-BtnRiBUI.js';
6
6
 
@@ -136,7 +136,7 @@ const isUploadComplete = (chunks, totalSize) => {
136
136
  }
137
137
  const sorted = [...chunks].toSorted((a, b) => a.offset - b.offset);
138
138
  const firstChunk = sorted[0];
139
- if (!firstChunk || firstChunk.offset !== 0) {
139
+ if (firstChunk?.offset !== 0) {
140
140
  return false;
141
141
  }
142
142
  let currentEnd = firstChunk.length;
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
3
- import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-DAyJfjhl.js';
3
+ import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-CkSLSnMd.js';
4
4
 
5
5
  const swaggerSpec = (origin, path, options) => {
6
6
  const { supportedTransformerFormat, tags, transformer } = { tags: ["REST"], transformer: false, ...options };
@@ -1,9 +1,9 @@
1
1
  import { Readable } from 'node:stream';
2
- import { p as partMatch, d as detectFileTypeFromStream, g as getFileStatus } from './part-match-BMNqHDYD.js';
2
+ import { p as partMatch, d as detectFileTypeFromStream, g as getFileStatus } from './part-match-Dt738Ddb.js';
3
3
  import { throwErrorCode, ERRORS } from './ERRORS-D0apMqnc.js';
4
- import { p as parseDuration, B as BaseStorage, b as parseBytes, t as toMilliseconds } from './storage-CpJpqLdn.js';
4
+ import { p as parseDuration, B as BaseStorage, b as parseBytes, t as toMilliseconds } from './storage-5XW1E7XU.js';
5
5
  import { createRetryWrapper } from './isRetryableError-Dycp7127.js';
6
- import { L as LocalMetaStorage } from './local-meta-storage-BlOk6m7F.js';
6
+ import { L as LocalMetaStorage } from './local-meta-storage-D-pPc3FI.js';
7
7
  import { u as updateSize } from './update-size-CCGm6i1J.js';
8
8
  import { h as hasContent } from './has-content-CY66ehMK.js';
9
9
  import { i as isExpired } from './is-expired-CTThU1q5.js';
@@ -110,10 +110,7 @@ class S3BaseStorage extends BaseStorage {
110
110
  Bucket: this.bucket,
111
111
  ContentType: file.contentType,
112
112
  Key: file.name,
113
- Metadata: mapValues(
114
- { originalName: file.originalName, ...file.metadata },
115
- (value) => encodeURI(String(value))
116
- )
113
+ Metadata: mapValues({ originalName: file.originalName, ...file.metadata }, (value) => encodeURI(String(value)))
117
114
  })
118
115
  );
119
116
  } catch {
@@ -520,7 +520,9 @@ const getOrganizedTransformationParameters = (transform, format = ["jpeg", "png"
520
520
  return { groups, parameters };
521
521
  };
522
522
  const getTransformationHeaders = (transform) => {
523
- if (!transform) return {};
523
+ if (!transform) {
524
+ return {};
525
+ }
524
526
  const headers = {
525
527
  "X-Media-Type": {
526
528
  description: "Type of media (image/video/audio)",
@@ -545,7 +547,9 @@ const getTransformationHeaders = (transform) => {
545
547
  return headers;
546
548
  };
547
549
  const getTransformationErrorResponses = (transform) => {
548
- if (!transform) return {};
550
+ if (!transform) {
551
+ return {};
552
+ }
549
553
  return {
550
554
  400: {
551
555
  content: {
@@ -10,7 +10,7 @@ import { a as Validator } from './validator-DuO17wFF.js';
10
10
  import { n as normalize, i as isAbsolute } from './path-aV9lMdcn-DMU5H1-h.js';
11
11
  import { i as isExpired } from './is-expired-CTThU1q5.js';
12
12
 
13
- const PARSE_BYTES_REGEX = /^(?<value>-?(?:\d+(([.,])\d+)*)?[.,]?\d+) *(?<type>bytes?|b|kb|kib|mb|mib|gb|gib|tb|tib|pb|pib|eb|eib|zb|zib|yb|yib|(kilo|kibi|mega|mebi|giga|gibi|tera|tebi|peta|pebi|exa|exbi|zetta|zebi|yotta|yobi)?bytes)?$/i;
13
+ const PARSE_BYTES_REGEX = /^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i;
14
14
  const KIBI_REGEX = /^KIBI/;
15
15
  const MIBI_REGEX = /^MIBI/;
16
16
  const GIBI_REGEX = /^GIBI/;
@@ -180,13 +180,17 @@ const parseLocalizedNumber = (stringNumber, locale) => {
180
180
  return Number.parseFloat(stringNumber.replaceAll(new RegExp(`\\${thousandSeparator}`, "g"), "").replace(new RegExp(`\\${decimalSeparator}`), "."));
181
181
  };
182
182
  const fromBase = (base) => {
183
- if (base === 2) {
184
- return 1024;
185
- }
186
- if (base === 10) {
187
- return 1e3;
183
+ switch (base) {
184
+ case 2: {
185
+ return 1024;
186
+ }
187
+ case 10: {
188
+ return 1e3;
189
+ }
190
+ default: {
191
+ throw new Error("Unsupported base.");
192
+ }
188
193
  }
189
- throw new Error("Unsupported base.");
190
194
  };
191
195
  const parseBytes = (value, options) => {
192
196
  const config = {
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
3
- import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject } from './sharedGet-DAyJfjhl.js';
3
+ import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject } from './sharedGet-CkSLSnMd.js';
4
4
 
5
5
  const swaggerSpec = (path = "/", tags = ["Transform"]) => {
6
6
  const pathHash = createHash("sha256").update(path).digest("base64");
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
3
- import { sharedGet, sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGetMeta } from './sharedGet-DAyJfjhl.js';
3
+ import { sharedGet, sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGetMeta } from './sharedGet-CkSLSnMd.js';
4
4
 
5
5
  const swaggerSpec = (path, options) => {
6
6
  const { supportedTransformerFormat, tags, transformer } = { tags: ["Tus"], transformer: false, ...options };
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
3
- import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-DAyJfjhl.js';
3
+ import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-CkSLSnMd.js';
4
4
 
5
5
  const swaggerSpec = (origin, path, options) => {
6
6
  const { supportedTransformerFormat, tags, transformer } = { tags: ["Multipart"], transformer: false, ...options };
@@ -1,3 +1,3 @@
1
- export { default as S3File } from '../../packem_shared/S3File-DZiyk9Qt.js';
1
+ export { default as S3File } from '../../packem_shared/S3File-BXCuJaQZ.js';
2
2
  export { default as S3MetaStorage } from '../../packem_shared/S3MetaStorage-yT4CznlV.js';
3
- export { default as S3Storage } from '../../packem_shared/S3Storage-B0scgwPa.js';
3
+ export { default as S3Storage } from '../../packem_shared/S3Storage-wi5XT-yu.js';