@visulima/storage 1.0.0-alpha.1 → 1.0.0-alpha.11
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/CHANGELOG.md +170 -0
- package/LICENSE.md +6 -6
- package/README.md +33 -14
- package/dist/adapter/nuxt/module.d.ts +39 -0
- package/dist/adapter/nuxt/module.js +93 -0
- package/dist/adapter/nuxt/package.json +20 -0
- package/dist/handler/base/base-handler-core.d.ts +91 -0
- package/dist/handler/base/base-handler-fetch.d.ts +76 -0
- package/dist/handler/base/base-handler-node.d.ts +137 -0
- package/dist/handler/http/fetch/index.d.ts +4 -0
- package/dist/handler/http/fetch/index.js +4 -0
- package/dist/handler/http/hono/index.d.ts +67 -0
- package/dist/handler/http/hono/index.js +65 -0
- package/dist/handler/http/nextjs/index.d.ts +61 -0
- package/dist/handler/http/nextjs/index.js +37 -0
- package/dist/handler/http/node/index.d.ts +4 -0
- package/dist/handler/http/node/index.js +8 -0
- package/dist/handler/http/solid-start/index.d.ts +60 -0
- package/dist/handler/http/solid-start/index.js +44 -0
- package/dist/handler/multipart/multipart-base.d.ts +84 -0
- package/dist/handler/multipart/multipart-fetch.d.ts +64 -0
- package/dist/handler/multipart/multipart.d.ts +49 -0
- package/dist/handler/rest/rest-base.d.ts +106 -0
- package/dist/handler/rest/rest-fetch.d.ts +88 -0
- package/dist/handler/rest/rest.d.ts +93 -0
- package/dist/handler/tus/tus-base.d.ts +152 -0
- package/dist/handler/tus/tus-fetch.d.ts +72 -0
- package/dist/handler/tus/tus.d.ts +78 -0
- package/dist/handler/types.d.ts +53 -0
- package/dist/handler/utils/request-parser.d.ts +72 -0
- package/dist/handler/utils/response-builder.d.ts +83 -0
- package/dist/handler/utils/storage-utils.d.ts +10 -0
- package/dist/handler/utils/stream-utils.d.ts +29 -0
- package/dist/handler/utils/upload-handlers.d.ts +76 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +13 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/no-op-metrics.d.ts +15 -0
- package/dist/metrics/opentelemetry-metrics.d.ts +55 -0
- package/dist/openapi/index.d.ts +5 -0
- package/dist/openapi/index.js +5 -0
- package/dist/openapi/rest.d.ts +7 -0
- package/dist/openapi/shared.d.ts +13 -0
- package/dist/openapi/transform.d.ts +3 -0
- package/dist/openapi/tus.d.ts +7 -0
- package/dist/openapi/xhr.d.ts +7 -0
- package/dist/packem_shared/AwsLightFile-tTneXZgG.js +11 -0
- package/dist/packem_shared/AwsLightMetaStorage-D9qWQt6q.js +4 -0
- package/dist/packem_shared/AwsLightStorage-CEJTYBVv.js +133 -0
- package/dist/packem_shared/AzureFile-CesgFzps.js +8 -0
- package/dist/packem_shared/AzureSMetaStorage-BEbXX9Uk.js +89 -0
- package/dist/packem_shared/AzureStorage-CH6nvQx8.js +357 -0
- package/dist/packem_shared/BaseTransformer-9965D4pb.js +83 -0
- package/dist/packem_shared/DiskStorage-DziI2mwX.js +12 -0
- package/dist/packem_shared/DiskStorageWithChecksum-B_XY8_cO.js +240 -0
- package/dist/packem_shared/ERRORS-D0apMqnc.js +97 -0
- package/dist/packem_shared/File-Bb3P23dr.js +69 -0
- package/dist/packem_shared/GCSConfig-vPP22kN6.js +11 -0
- package/dist/packem_shared/GCSFile-BIEunhAN.js +8 -0
- package/dist/packem_shared/GCSMetaStorage-FypK8Tn1.js +7 -0
- package/dist/packem_shared/GCStorage-CasTo9rF.js +408 -0
- package/dist/packem_shared/LocalMetaStorage-BnllcjV9.js +7 -0
- package/dist/packem_shared/MediaTransformer-BErvw2vE.js +1196 -0
- package/dist/packem_shared/MetaStorage-pECeFOad.js +46 -0
- package/dist/packem_shared/Metadata-DRLXeJ0F.js +89 -0
- package/dist/packem_shared/Multipart-CDDlDOs7.js +163 -0
- package/dist/packem_shared/Multipart-vxBL2VXm.js +128 -0
- package/dist/packem_shared/NetlifyBlobFile-CXzyjqrD.js +14 -0
- package/dist/packem_shared/NetlifyBlobMetaStorage-DIkZ2umW.js +9 -0
- package/dist/packem_shared/NetlifyBlobStorage-DEpx_4q-.js +376 -0
- package/dist/packem_shared/NoOpMetrics-DhAk5rXc.js +10 -0
- package/dist/packem_shared/OpenTelemetryMetrics-BnxhqIaH.js +67 -0
- package/dist/packem_shared/Rest-CEj3EhMj.js +228 -0
- package/dist/packem_shared/Rest-D14vM7aJ.js +267 -0
- package/dist/packem_shared/S3File-DZiyk9Qt.js +11 -0
- package/dist/packem_shared/S3MetaStorage-yT4CznlV.js +77 -0
- package/dist/packem_shared/S3Storage-B0scgwPa.js +317 -0
- package/dist/packem_shared/TUS_RESUMABLE-Dtfsffnj.js +434 -0
- package/dist/packem_shared/Tus-Cjz87bpz.js +200 -0
- package/dist/packem_shared/Tus-WOVg-YnB.js +195 -0
- package/dist/packem_shared/ValidationError-BfF1aE4h.js +26 -0
- package/dist/packem_shared/VercelBlobFile-BCg4aTEq.js +18 -0
- package/dist/packem_shared/VercelBlobMetaStorage-c0M-TvAR.js +9 -0
- package/dist/packem_shared/VercelBlobStorage-wOYxv8F7.js +261 -0
- package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +5 -0
- package/dist/packem_shared/aws-light-meta-storage-Ba2b_h-o.js +447 -0
- package/dist/packem_shared/backblaze-BlMnIcBC.js +20 -0
- package/dist/packem_shared/base-handler-core-BoAqTyz7.js +303 -0
- package/dist/packem_shared/base-handler-fetch-CinvR65S.js +291 -0
- package/dist/packem_shared/base-handler-node-c02H0AxN.js +731 -0
- package/dist/packem_shared/cache-B88MXQ_2.js +18 -0
- package/dist/packem_shared/cloudflare-Bi1q8wXE.js +21 -0
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-CGoYrGB2.js +11 -0
- package/dist/packem_shared/digitalOcean-CWQRJM3L.js +21 -0
- package/dist/packem_shared/disk-storage-DeivH-J5.js +816 -0
- package/dist/packem_shared/gcs-meta-storage-B0Baj0Xr.js +159 -0
- package/dist/packem_shared/has-content-CY66ehMK.js +3 -0
- package/dist/packem_shared/headers-YLRp1dLo.js +1318 -0
- package/dist/packem_shared/is-expired-CTThU1q5.js +8 -0
- package/dist/packem_shared/isRetryableError-Dycp7127.js +82 -0
- package/dist/packem_shared/isValidMediaType-BeDgiObq.js +35 -0
- package/dist/packem_shared/local-meta-storage-BlOk6m7F.js +647 -0
- package/dist/packem_shared/minio-C2YBZQOw.js +22 -0
- package/dist/packem_shared/multipart-base-C994naBi.js +102 -0
- package/dist/packem_shared/part-match-BMNqHDYD.js +96 -0
- package/dist/packem_shared/path-aV9lMdcn-DMU5H1-h.js +162 -0
- package/dist/packem_shared/response-builder-BtnRiBUI.js +45 -0
- package/dist/packem_shared/rest-base-D9URIFkc.js +457 -0
- package/dist/packem_shared/restOpenApiSpec-D1zbmid7.js +800 -0
- package/dist/packem_shared/s3-base-storage-CG21uusd.js +513 -0
- package/dist/packem_shared/sharedGet-DAyJfjhl.js +1018 -0
- package/dist/packem_shared/storage-CpJpqLdn.js +1184 -0
- package/dist/packem_shared/tigris-Hac8TKnX.js +21 -0
- package/dist/packem_shared/transformOpenApiSpec-BC0r6PzI.js +975 -0
- package/dist/packem_shared/tusOpenApiSpec-BLIjKf0s.js +740 -0
- package/dist/packem_shared/update-size-CCGm6i1J.js +8 -0
- package/dist/packem_shared/validator-DuO17wFF.js +79 -0
- package/dist/packem_shared/waitForStorage-Cscw85sx.js +18 -0
- package/dist/packem_shared/wasabi-DIyflHSd.js +21 -0
- package/dist/packem_shared/xhrOpenApiSpec-kItrSAsc.js +264 -0
- package/dist/storage/aws/clients/backblaze.d.ts +12 -0
- package/dist/storage/aws/clients/cloudflare.d.ts +13 -0
- package/dist/storage/aws/clients/digital-ocean.d.ts +12 -0
- package/dist/storage/aws/clients/index.d.ts +6 -0
- package/dist/storage/aws/clients/index.js +6 -0
- package/dist/storage/aws/clients/minio.d.ts +13 -0
- package/dist/storage/aws/clients/tigris.d.ts +12 -0
- package/dist/storage/aws/clients/types.d.ts +95 -0
- package/dist/storage/aws/clients/wasabi.d.ts +12 -0
- package/dist/storage/aws/index.d.ts +4 -0
- package/dist/storage/aws/index.js +3 -0
- package/dist/storage/aws/s3-base-storage.d.ts +248 -0
- package/dist/storage/aws/s3-client-adapter.d.ts +110 -0
- package/dist/storage/aws/s3-file.d.ts +10 -0
- package/dist/storage/aws/s3-meta-storage.d.ts +15 -0
- package/dist/storage/aws/s3-storage.d.ts +70 -0
- package/dist/storage/aws/types.d.ts +119 -0
- package/dist/storage/aws-light/aws-light-api-adapter.d.ts +130 -0
- package/dist/storage/aws-light/aws-light-file.d.ts +10 -0
- package/dist/storage/aws-light/aws-light-meta-storage.d.ts +19 -0
- package/dist/storage/aws-light/aws-light-storage.d.ts +65 -0
- package/dist/storage/aws-light/index.d.ts +4 -0
- package/dist/storage/aws-light/index.js +3 -0
- package/dist/storage/aws-light/types.d.ts +37 -0
- package/dist/storage/azure/azure-file.d.ts +6 -0
- package/dist/storage/azure/azure-meta-storage.d.ts +15 -0
- package/dist/storage/azure/azure-storage.d.ts +69 -0
- package/dist/storage/azure/index.d.ts +4 -0
- package/dist/storage/azure/index.js +3 -0
- package/dist/storage/azure/types.d.ts +62 -0
- package/dist/storage/gcs/fetch-error.d.ts +11 -0
- package/dist/storage/gcs/gcs-config.d.ts +2 -0
- package/dist/storage/gcs/gcs-file.d.ts +6 -0
- package/dist/storage/gcs/gcs-meta-storage.d.ts +27 -0
- package/dist/storage/gcs/gcs-storage.d.ts +91 -0
- package/dist/storage/gcs/index.d.ts +5 -0
- package/dist/storage/gcs/index.js +4 -0
- package/dist/storage/gcs/types.d.ts +55 -0
- package/dist/storage/gcs/utils.d.ts +7 -0
- package/dist/storage/local/disk-storage-with-checksum.d.ts +15 -0
- package/dist/storage/local/disk-storage.d.ts +135 -0
- package/dist/storage/local/index.d.ts +4 -0
- package/dist/storage/local/index.js +3 -0
- package/dist/storage/local/local-meta-storage.d.ts +32 -0
- package/dist/storage/meta-storage.d.ts +30 -0
- package/dist/storage/netlify-blob/index.d.ts +4 -0
- package/dist/storage/netlify-blob/index.js +3 -0
- package/dist/storage/netlify-blob/netlify-blob-file.d.ts +12 -0
- package/dist/storage/netlify-blob/netlify-blob-meta-storage.d.ts +7 -0
- package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +93 -0
- package/dist/storage/netlify-blob/types.d.ts +30 -0
- package/dist/storage/storage.d.ts +353 -0
- package/dist/storage/types.d.ts +221 -0
- package/dist/storage/utils/file/file.d.ts +25 -0
- package/dist/storage/utils/file/get-file-status.d.ts +9 -0
- package/dist/storage/utils/file/has-content.d.ts +9 -0
- package/dist/storage/utils/file/index.d.ts +10 -0
- package/dist/storage/utils/file/is-expired.d.ts +8 -0
- package/dist/storage/utils/file/metadata.d.ts +18 -0
- package/dist/storage/utils/file/part-match.d.ts +11 -0
- package/dist/storage/utils/file/types.d.ts +37 -0
- package/dist/storage/utils/file/update-metadata.d.ts +10 -0
- package/dist/storage/utils/file/update-size.d.ts +10 -0
- package/dist/storage/vercel-blob/index.d.ts +4 -0
- package/dist/storage/vercel-blob/index.js +3 -0
- package/dist/storage/vercel-blob/types.d.ts +32 -0
- package/dist/storage/vercel-blob/vercel-blob-file.d.ts +16 -0
- package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +7 -0
- package/dist/storage/vercel-blob/vercel-blob-storage.d.ts +76 -0
- package/dist/transformer/audio-transformer.d.ts +128 -0
- package/dist/transformer/audio-transformer.js +278 -0
- package/dist/transformer/base-transformer.d.ts +63 -0
- package/dist/transformer/image-transformer.d.ts +571 -0
- package/dist/transformer/image-transformer.js +1100 -0
- package/dist/transformer/index.d.ts +5 -0
- package/dist/transformer/index.js +4 -0
- package/dist/transformer/media-transformer.d.ts +332 -0
- package/dist/transformer/types.d.ts +652 -0
- package/dist/transformer/utils.d.ts +33 -0
- package/dist/transformer/validation-error.d.ts +23 -0
- package/dist/transformer/video-transformer.d.ts +145 -0
- package/dist/transformer/video-transformer.js +310 -0
- package/dist/utils/cache.d.ts +32 -0
- package/dist/utils/chunked-upload.d.ts +65 -0
- package/dist/utils/detect-file-type.d.ts +28 -0
- package/dist/utils/errors.d.ts +74 -0
- package/dist/utils/file-path-url-matcher.d.ts +18 -0
- package/dist/utils/headers.d.ts +111 -0
- package/dist/utils/http.d.ts +92 -0
- package/dist/utils/locker.d.ts +26 -0
- package/dist/utils/pipes/stream-checksum.d.ts +47 -0
- package/dist/utils/pipes/stream-length.d.ts +22 -0
- package/dist/utils/primitives/get-last-one.d.ts +3 -0
- package/dist/utils/primitives/is-record.d.ts +2 -0
- package/dist/utils/primitives/map-values.d.ts +9 -0
- package/dist/utils/primitives/pick.d.ts +2 -0
- package/dist/utils/primitives/to-milliseconds.d.ts +12 -0
- package/dist/utils/primitives/to-seconds.d.ts +12 -0
- package/dist/utils/range-checksum.d.ts +33 -0
- package/dist/utils/range-hasher.d.ts +46 -0
- package/dist/utils/retry.d.ts +64 -0
- package/dist/utils/types.d.ts +108 -0
- package/dist/utils/validation-error.d.ts +22 -0
- package/dist/utils/validator.d.ts +36 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,173 @@
|
|
|
1
|
+
## @visulima/storage [1.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.10...@visulima/storage@1.0.0-alpha.11) (2026-04-08)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* remove deprecated baseUrl and downlevelIteration from tsconfigs ([a708366](https://github.com/visulima/visulima/commit/a708366b5c3bc73cfde480a712ed397bd921fb93))
|
|
6
|
+
* **storage:** fix tsconfig.eslint.json to extend local tsconfig ([af2628a](https://github.com/visulima/visulima/commit/af2628ae8a8bc6f10693a96c9280feb81da2c0eb))
|
|
7
|
+
|
|
8
|
+
### Miscellaneous Chores
|
|
9
|
+
|
|
10
|
+
* **storage:** apply prettier formatting ([b2fa58d](https://github.com/visulima/visulima/commit/b2fa58d4364fa580b321b2df47a4264fd22eb070))
|
|
11
|
+
* **storage:** expand inline if-return to block syntax ([29671ac](https://github.com/visulima/visulima/commit/29671ac54f22ae01029f40be73dbd745a1e9a8f9))
|
|
12
|
+
* **storage:** migrate .prettierrc.cjs to prettier.config.js ([98b0fe6](https://github.com/visulima/visulima/commit/98b0fe60cd98ea4c33b8a54ee0b2229ad3c1d4c1))
|
|
13
|
+
* **storage:** remove empty dependency objects from package.json ([ddfeb08](https://github.com/visulima/visulima/commit/ddfeb08fd392ad2553a1ce833dd331540ecc8b09))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* **@visulima/pagination:** upgraded to 5.0.0-alpha.9
|
|
19
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.7
|
|
20
|
+
* **@visulima/humanizer:** upgraded to 3.0.0-alpha.9
|
|
21
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.8
|
|
22
|
+
|
|
23
|
+
## @visulima/storage [1.0.0-alpha.10](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.9...@visulima/storage@1.0.0-alpha.10) (2026-03-26)
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **web:** auto-generate packages page from workspace metadata ([623e520](https://github.com/visulima/visulima/commit/623e5207693a7fe720f5f2f179593a3654c880e3))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Dependencies
|
|
31
|
+
|
|
32
|
+
* **@visulima/pagination:** upgraded to 5.0.0-alpha.8
|
|
33
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.6
|
|
34
|
+
* **@visulima/humanizer:** upgraded to 3.0.0-alpha.8
|
|
35
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.7
|
|
36
|
+
|
|
37
|
+
## @visulima/storage [1.0.0-alpha.9](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.8...@visulima/storage@1.0.0-alpha.9) (2026-03-26)
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **storage:** use workspace:* for internal [@visulima](https://github.com/visulima) deps ([ff79afe](https://github.com/visulima/visulima/commit/ff79afe26f1941eab24cff80477d8c18aaec65e9))
|
|
42
|
+
* **web:** improve build setup with incremental stats caching and prod install ([fe33e75](https://github.com/visulima/visulima/commit/fe33e75827586779b4b3a0c6d57b39f889ee6207))
|
|
43
|
+
|
|
44
|
+
### Miscellaneous Chores
|
|
45
|
+
|
|
46
|
+
* **storage:** migrate deps to pnpm catalogs ([7dfea89](https://github.com/visulima/visulima/commit/7dfea8981d74cd84317133242d2ab5a31f3f98b7))
|
|
47
|
+
|
|
48
|
+
### Code Refactoring
|
|
49
|
+
|
|
50
|
+
* **docs:** migrate Nextra components to fumadocs-ui, remove Nextra stripping ([484878f](https://github.com/visulima/visulima/commit/484878f01879363ef5e9a0282904dc4627d6060c))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* **@visulima/pagination:** upgraded to 5.0.0-alpha.7
|
|
56
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.5
|
|
57
|
+
* **@visulima/humanizer:** upgraded to 3.0.0-alpha.7
|
|
58
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.6
|
|
59
|
+
|
|
60
|
+
## @visulima/storage [1.0.0-alpha.8](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.7...@visulima/storage@1.0.0-alpha.8) (2026-03-16)
|
|
61
|
+
|
|
62
|
+
### Bug Fixes
|
|
63
|
+
|
|
64
|
+
* resolve 5 audit vulnerabilities (simple-git, express-rate-limit, tar, file-type, hono) ([2986d77](https://github.com/visulima/visulima/commit/2986d770746afd3223a074dc1a1a0040cca56e61))
|
|
65
|
+
|
|
66
|
+
### Miscellaneous Chores
|
|
67
|
+
|
|
68
|
+
* **storage:** update dependencies ([a2d2577](https://github.com/visulima/visulima/commit/a2d257702693aac7f368bddfd0481cdac09c3901))
|
|
69
|
+
* visulima website ([#591](https://github.com/visulima/visulima/issues/591)) ([59ab2e2](https://github.com/visulima/visulima/commit/59ab2e2befb03e51cd2088956f83d9b87de6d033))
|
|
70
|
+
|
|
71
|
+
## @visulima/storage [1.0.0-alpha.7](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.6...@visulima/storage@1.0.0-alpha.7) (2026-03-06)
|
|
72
|
+
|
|
73
|
+
### Bug Fixes
|
|
74
|
+
|
|
75
|
+
* **storage:** update packem to 2.0.0-alpha.54 ([a65ad87](https://github.com/visulima/visulima/commit/a65ad877ac5804a0c1354331a380fbcceddf261f))
|
|
76
|
+
|
|
77
|
+
### Miscellaneous Chores
|
|
78
|
+
|
|
79
|
+
* **storage:** update dependencies ([19b3d5c](https://github.com/visulima/visulima/commit/19b3d5c5fd1e535fbbb1419a827e5c4c0b35fa77))
|
|
80
|
+
* **storage:** update dependencies ([f591768](https://github.com/visulima/visulima/commit/f591768de337c1b201191e4b78dd7e3fb79ca42b))
|
|
81
|
+
* update lock file maintenance ([d83e716](https://github.com/visulima/visulima/commit/d83e71697b75d24704185b66bb521a934d2db02d))
|
|
82
|
+
* year update ([47f4105](https://github.com/visulima/visulima/commit/47f410596ce7190cfea36a073db32e0cec50bbcd))
|
|
83
|
+
|
|
84
|
+
### Code Refactoring
|
|
85
|
+
|
|
86
|
+
* **storage:** replace SuperHeaders with native Headers ([68546c5](https://github.com/visulima/visulima/commit/68546c52bedad5c1338d571ad9a2034cc9f49b53))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Dependencies
|
|
90
|
+
|
|
91
|
+
* **@visulima/pagination:** upgraded to 5.0.0-alpha.6
|
|
92
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.4
|
|
93
|
+
* **@visulima/humanizer:** upgraded to 3.0.0-alpha.6
|
|
94
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.5
|
|
95
|
+
|
|
96
|
+
## @visulima/storage [1.0.0-alpha.6](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.5...@visulima/storage@1.0.0-alpha.6) (2026-01-17)
|
|
97
|
+
|
|
98
|
+
### Miscellaneous Chores
|
|
99
|
+
|
|
100
|
+
* **storage:** update dependencies ([b2450d8](https://github.com/visulima/visulima/commit/b2450d8f096991389ceed4bf4def2f99363daf6f))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### Dependencies
|
|
104
|
+
|
|
105
|
+
* **@visulima/pagination:** upgraded to 5.0.0-alpha.5
|
|
106
|
+
|
|
107
|
+
## @visulima/storage [1.0.0-alpha.5](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.4...@visulima/storage@1.0.0-alpha.5) (2025-12-27)
|
|
108
|
+
|
|
109
|
+
### Bug Fixes
|
|
110
|
+
|
|
111
|
+
* **dependencies:** update hono and related packages to version 4.11.2 and update @hono/swagger-ui to version 0.5.3 ([5d3eed5](https://github.com/visulima/visulima/commit/5d3eed57d30d8216bf91484f35d39678938651fb))
|
|
112
|
+
* **storage:** update package files ([5ef0060](https://github.com/visulima/visulima/commit/5ef0060c39b4457395583a828eb2f72fc3949496))
|
|
113
|
+
|
|
114
|
+
### Miscellaneous Chores
|
|
115
|
+
|
|
116
|
+
* **dependencies:** update file-type to version 21.2.0, hono to version 4.11.3, and improve README for storage-client with detailed usage examples ([90bebfa](https://github.com/visulima/visulima/commit/90bebfa9b732afd8d80c133ca0636192b8496801))
|
|
117
|
+
* fixed project.json names and schema path ([964722f](https://github.com/visulima/visulima/commit/964722f691db205c7edb9aa6db29e849a647500b))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Dependencies
|
|
121
|
+
|
|
122
|
+
* **@visulima/pagination:** upgraded to 5.0.0-alpha.4
|
|
123
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.3
|
|
124
|
+
* **@visulima/humanizer:** upgraded to 3.0.0-alpha.5
|
|
125
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.4
|
|
126
|
+
|
|
127
|
+
## @visulima/storage [1.0.0-alpha.4](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.3...@visulima/storage@1.0.0-alpha.4) (2025-12-11)
|
|
128
|
+
|
|
129
|
+
### Bug Fixes
|
|
130
|
+
|
|
131
|
+
* update package OG images across multiple packages ([f08e4dd](https://github.com/visulima/visulima/commit/f08e4dd2b105ccb29c8412020a9c2be36d6c1e9e))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Dependencies
|
|
135
|
+
|
|
136
|
+
* **@visulima/pagination:** upgraded to 5.0.0-alpha.3
|
|
137
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.2
|
|
138
|
+
* **@visulima/humanizer:** upgraded to 3.0.0-alpha.4
|
|
139
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.3
|
|
140
|
+
|
|
141
|
+
## @visulima/storage [1.0.0-alpha.3](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.2...@visulima/storage@1.0.0-alpha.3) (2025-12-10)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Dependencies
|
|
145
|
+
|
|
146
|
+
* **@visulima/humanizer:** upgraded to 3.0.0-alpha.3
|
|
147
|
+
|
|
148
|
+
## @visulima/storage [1.0.0-alpha.2](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.1...@visulima/storage@1.0.0-alpha.2) (2025-12-07)
|
|
149
|
+
|
|
150
|
+
### ⚠ BREAKING CHANGES
|
|
151
|
+
|
|
152
|
+
* change min node version to 22.13
|
|
153
|
+
|
|
154
|
+
### Bug Fixes
|
|
155
|
+
|
|
156
|
+
* add new package image, fixed readme rendering on npm, fixed building of packages ([b790ba2](https://github.com/visulima/visulima/commit/b790ba253ea07fef83528fd822a678facf021b5f))
|
|
157
|
+
* update Node.js engine version requirement to >=22.13 in multiple package.json files for improved compatibility ([b828e9a](https://github.com/visulima/visulima/commit/b828e9aeaebfc798eecddccd90e6ec7560c6d36a))
|
|
158
|
+
|
|
159
|
+
### Miscellaneous Chores
|
|
160
|
+
|
|
161
|
+
* moved all packages into groups ([0615e9d](https://github.com/visulima/visulima/commit/0615e9d14a8a886e11da529ce150cf31ca973c10))
|
|
162
|
+
* update @anolilab/semantic-release-pnpm and @anolilab/semantic-release-preset to versions 3.2.2 and 12.1.2 across multiple package.json files for improved compatibility ([3921626](https://github.com/visulima/visulima/commit/3921626141fe5da398749bf0ba675f1596f18afb))
|
|
163
|
+
* update dependencies across multiple packages to improve compatibility and performance, including upgrading `@anolilab/semantic-release-pnpm` and `@anolilab/semantic-release-preset` to versions 3.2.0 and 12.1.0 respectively, and updating `react`, `react-dom`, and `next` versions to 19.2.1 and 16.0.7 in various package.json files ([aee8fcd](https://github.com/visulima/visulima/commit/aee8fcd796ae9b8d055903260e7150996ea9f53d))
|
|
164
|
+
* update implicit dependencies in project.json for storage package ([2473f8a](https://github.com/visulima/visulima/commit/2473f8a2297df40425ba4eb4d9eb14d40db0b6ac))
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Dependencies
|
|
168
|
+
|
|
169
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.1
|
|
170
|
+
|
|
1
171
|
## @visulima/storage 1.0.0-alpha.1 (2025-12-02)
|
|
2
172
|
|
|
3
173
|
### Features
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 visulima
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -63,7 +63,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
63
63
|
|
|
64
64
|
> MIT License
|
|
65
65
|
>
|
|
66
|
-
> Copyright (c)
|
|
66
|
+
> Copyright (c) 2026 visulima
|
|
67
67
|
>
|
|
68
68
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
69
69
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -97,7 +97,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
97
97
|
>
|
|
98
98
|
> > MIT License
|
|
99
99
|
> >
|
|
100
|
-
> > Copyright (c)
|
|
100
|
+
> > Copyright (c) 2026 visulima
|
|
101
101
|
> >
|
|
102
102
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
103
103
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -131,7 +131,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
131
131
|
> >
|
|
132
132
|
> > > MIT License
|
|
133
133
|
> > >
|
|
134
|
-
> > > Copyright (c)
|
|
134
|
+
> > > Copyright (c) 2026 visulima
|
|
135
135
|
> > >
|
|
136
136
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
137
137
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -358,7 +358,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
358
358
|
|
|
359
359
|
> MIT License
|
|
360
360
|
>
|
|
361
|
-
> Copyright (c)
|
|
361
|
+
> Copyright (c) 2026 visulima
|
|
362
362
|
>
|
|
363
363
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
364
364
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -427,7 +427,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
427
427
|
|
|
428
428
|
> MIT License
|
|
429
429
|
>
|
|
430
|
-
> Copyright (c)
|
|
430
|
+
> Copyright (c) 2026 visulima
|
|
431
431
|
>
|
|
432
432
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
433
433
|
> of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
1
|
+
<!-- START_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
2
|
+
|
|
3
|
+
<a href="https://www.anolilab.com/open-source" align="center">
|
|
4
|
+
|
|
5
|
+
<img src="__assets__/package-og.svg" alt="storage" />
|
|
6
|
+
|
|
7
|
+
</a>
|
|
8
|
+
|
|
9
|
+
<h3 align="center">Visulima upload - Store files in a web-accessible location via a simplified API. Can automatically scale and rotate images. Includes S3, Azure, GCS and local filesystem-based backends with the most convenient features of each.</h3>
|
|
10
|
+
|
|
11
|
+
<!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
7
12
|
|
|
8
13
|
<br />
|
|
9
14
|
|
|
10
15
|
<div align="center">
|
|
11
16
|
|
|
12
|
-
[![typescript-image]
|
|
17
|
+
[![typescript-image][typescript-badge]][typescript-url]
|
|
18
|
+
[![mit licence][license-badge]][license]
|
|
19
|
+
[![npm downloads][npm-downloads-badge]][npm-downloads]
|
|
20
|
+
[![Chat][chat-badge]][chat]
|
|
21
|
+
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
|
|
13
22
|
|
|
14
23
|
</div>
|
|
15
24
|
|
|
@@ -549,13 +558,23 @@ If you would like to help take a look at the [list of issues](https://github.com
|
|
|
549
558
|
- [Daniel Bannert](https://github.com/prisis)
|
|
550
559
|
- [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
|
|
551
560
|
|
|
561
|
+
## Made with ❤️ at Anolilab
|
|
562
|
+
|
|
563
|
+
This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Anolilab](https://www.anolilab.com/open-source) is a Development and AI Studio. Contact us at [hello@anolilab.com](mailto:hello@anolilab.com) if you need any help with these technologies or just want to say hi!
|
|
564
|
+
|
|
552
565
|
## License
|
|
553
566
|
|
|
554
|
-
The visulima
|
|
567
|
+
The visulima storage is open-sourced software licensed under the [MIT][license]
|
|
568
|
+
|
|
569
|
+
<!-- badges -->
|
|
555
570
|
|
|
556
|
-
[
|
|
557
|
-
[
|
|
558
|
-
[
|
|
559
|
-
[
|
|
560
|
-
[
|
|
561
|
-
[
|
|
571
|
+
[license-badge]: https://img.shields.io/npm/l/@visulima/storage?style=for-the-badge
|
|
572
|
+
[license]: https://github.com/visulima/visulima/blob/main/LICENSE
|
|
573
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dm/@visulima/storage?style=for-the-badge
|
|
574
|
+
[npm-downloads]: https://www.npmjs.com/package/@visulima/storage
|
|
575
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
|
|
576
|
+
[prs-welcome]: https://github.com/visulima/visulima/blob/main/.github/CONTRIBUTING.md
|
|
577
|
+
[chat-badge]: https://img.shields.io/discord/932323359193186354.svg?style=for-the-badge
|
|
578
|
+
[chat]: https://discord.gg/TtFJY8xkFK
|
|
579
|
+
[typescript-badge]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
|
580
|
+
[typescript-url]: https://www.typescriptlang.org/
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { UploadOptions } from "../../handler/types.d.ts";
|
|
2
|
+
import type { BaseStorage } from "../../storage/storage.d.ts";
|
|
3
|
+
import type { UploadFile } from "../../storage/utils/index.d.ts";
|
|
4
|
+
/**
|
|
5
|
+
* CORS configuration for upload endpoints
|
|
6
|
+
*/
|
|
7
|
+
export interface CorsOptions {
|
|
8
|
+
/** Allowed CORS headers */
|
|
9
|
+
headers?: string[];
|
|
10
|
+
/** Allowed HTTP methods */
|
|
11
|
+
methods?: string[];
|
|
12
|
+
/** Allowed origins (use "*" for all origins) */
|
|
13
|
+
origin?: string | string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Configuration options for the Nuxt storage module
|
|
17
|
+
*/
|
|
18
|
+
export interface ModuleOptions {
|
|
19
|
+
/** Base path for upload routes (default: '/api/upload') */
|
|
20
|
+
basePath?: string;
|
|
21
|
+
/** CORS configuration */
|
|
22
|
+
cors?: CorsOptions;
|
|
23
|
+
/** Enable multipart upload endpoint (default: true) */
|
|
24
|
+
multipart?: boolean;
|
|
25
|
+
/** Additional options for multipart handler */
|
|
26
|
+
multipartOptions?: Omit<UploadOptions<UploadFile>, "storage">;
|
|
27
|
+
/** Enable REST API endpoint for direct binary uploads (default: true) */
|
|
28
|
+
rest?: boolean;
|
|
29
|
+
/** Additional options for REST handler */
|
|
30
|
+
restOptions?: Omit<UploadOptions<UploadFile>, "storage">;
|
|
31
|
+
/** Storage instance to use for file uploads */
|
|
32
|
+
storage: BaseStorage;
|
|
33
|
+
/** Enable TUS resumable upload endpoint (default: true) */
|
|
34
|
+
tus?: boolean;
|
|
35
|
+
/** Additional options for TUS handler */
|
|
36
|
+
tusOptions?: Omit<UploadOptions<UploadFile>, "storage">;
|
|
37
|
+
}
|
|
38
|
+
declare const nuxtModule: any;
|
|
39
|
+
export default nuxtModule;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
|
+
|
|
3
|
+
const handlerStorage = /* @__PURE__ */ new Map();
|
|
4
|
+
const nuxtModule = defineNuxtModule({
|
|
5
|
+
defaults: {
|
|
6
|
+
basePath: "/api/upload",
|
|
7
|
+
cors: {
|
|
8
|
+
headers: ["Content-Type", "Upload-Offset", "Upload-Length", "Tus-Resumable"],
|
|
9
|
+
methods: ["GET", "POST", "PATCH", "PUT", "HEAD", "DELETE", "OPTIONS"],
|
|
10
|
+
origin: "*"
|
|
11
|
+
},
|
|
12
|
+
multipart: true,
|
|
13
|
+
rest: true,
|
|
14
|
+
tus: true
|
|
15
|
+
},
|
|
16
|
+
meta: {
|
|
17
|
+
compatibility: {
|
|
18
|
+
nuxt: ">=4.0.0"
|
|
19
|
+
},
|
|
20
|
+
configKey: "storage",
|
|
21
|
+
name: "@visulima/storage"
|
|
22
|
+
},
|
|
23
|
+
async setup(options, nuxt) {
|
|
24
|
+
const {
|
|
25
|
+
basePath = "/api/upload",
|
|
26
|
+
cors = {
|
|
27
|
+
headers: ["Content-Type", "Upload-Offset", "Upload-Length", "Tus-Resumable"],
|
|
28
|
+
methods: ["GET", "POST", "PATCH", "PUT", "HEAD", "DELETE", "OPTIONS"],
|
|
29
|
+
origin: "*"
|
|
30
|
+
},
|
|
31
|
+
multipart = true,
|
|
32
|
+
multipartOptions = {},
|
|
33
|
+
rest = true,
|
|
34
|
+
restOptions = {},
|
|
35
|
+
storage,
|
|
36
|
+
tus = true,
|
|
37
|
+
tusOptions = {}
|
|
38
|
+
} = options;
|
|
39
|
+
if (!storage) {
|
|
40
|
+
throw new Error("[@visulima/storage/nuxt] Storage instance is required");
|
|
41
|
+
}
|
|
42
|
+
const { Multipart, Rest, Tus } = await import('../../handler/http/node/index.js');
|
|
43
|
+
const multipartHandler = multipart ? new Multipart({ storage, ...multipartOptions }) : void 0;
|
|
44
|
+
const restHandler = rest ? new Rest({ storage, ...restOptions }) : void 0;
|
|
45
|
+
const tusHandler = tus ? new Tus({ storage, ...tusOptions }) : void 0;
|
|
46
|
+
const setCorsHeaders = (event) => {
|
|
47
|
+
const origin = Array.isArray(cors.origin) ? cors.origin.join(", ") : cors.origin || "*";
|
|
48
|
+
event.node.res.setHeader("Access-Control-Allow-Origin", origin);
|
|
49
|
+
if (cors.methods) {
|
|
50
|
+
event.node.res.setHeader("Access-Control-Allow-Methods", cors.methods.join(", "));
|
|
51
|
+
}
|
|
52
|
+
if (cors.headers) {
|
|
53
|
+
event.node.res.setHeader("Access-Control-Allow-Headers", cors.headers.join(", "));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
if (multipartHandler) {
|
|
57
|
+
handlerStorage.set(`${basePath}/multipart`, { handler: multipartHandler, setCorsHeaders });
|
|
58
|
+
}
|
|
59
|
+
if (restHandler) {
|
|
60
|
+
handlerStorage.set(`${basePath}/rest`, { handler: restHandler, setCorsHeaders });
|
|
61
|
+
}
|
|
62
|
+
if (tusHandler) {
|
|
63
|
+
handlerStorage.set(`${basePath}/tus`, { handler: tusHandler, setCorsHeaders });
|
|
64
|
+
}
|
|
65
|
+
nuxt.hook("nitro:config", (nitroConfig) => {
|
|
66
|
+
const routeRules = nitroConfig.routeRules || {};
|
|
67
|
+
if (multipartHandler) {
|
|
68
|
+
routeRules[`${basePath}/multipart/**`] = { cors: true };
|
|
69
|
+
}
|
|
70
|
+
if (restHandler) {
|
|
71
|
+
routeRules[`${basePath}/rest/**`] = { cors: true };
|
|
72
|
+
}
|
|
73
|
+
if (tusHandler) {
|
|
74
|
+
routeRules[`${basePath}/tus/**`] = { cors: true };
|
|
75
|
+
}
|
|
76
|
+
nitroConfig.routeRules = routeRules;
|
|
77
|
+
});
|
|
78
|
+
nuxt.hook("nitro:init", (nitro) => {
|
|
79
|
+
nitro.hooks.hook("request", async (event) => {
|
|
80
|
+
const url = event.node.req.url || "";
|
|
81
|
+
for (const [route, { handler, setCorsHeaders: setHeaders }] of handlerStorage.entries()) {
|
|
82
|
+
if (url.startsWith(route)) {
|
|
83
|
+
setHeaders(event);
|
|
84
|
+
await handler.handle(event.node.req, event.node.res);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export { nuxtModule as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@visulima/storage-nuxt",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./module.d.ts",
|
|
8
|
+
"import": "./module.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"main": "./module.js",
|
|
12
|
+
"types": "./module.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"."
|
|
15
|
+
],
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@nuxt/kit": ">=4.0.0",
|
|
18
|
+
"nuxt": ">=4.0.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import type { BaseStorage } from "../../storage/storage.d.ts";
|
|
3
|
+
import type { UploadFile } from "../../storage/utils/index.d.ts";
|
|
4
|
+
import type MediaTransformer from "../../transformer/media-transformer.d.ts";
|
|
5
|
+
import type { ErrorResponses } from "../../utils/errors.d.ts";
|
|
6
|
+
import type { ResponseBodyType } from "../../utils/types.d.ts";
|
|
7
|
+
import type { UploadOptions } from "../types.d.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Core base class containing shared business logic for all handlers.
|
|
10
|
+
* This class is platform-agnostic and contains no Node.js or Web API specific code.
|
|
11
|
+
* @template TFile The file type used by this handler.
|
|
12
|
+
*/
|
|
13
|
+
declare abstract class BaseHandlerCore<TFile extends UploadFile> extends EventEmitter {
|
|
14
|
+
/**
|
|
15
|
+
* Response body type for the handler.
|
|
16
|
+
*/
|
|
17
|
+
responseType: ResponseBodyType;
|
|
18
|
+
/**
|
|
19
|
+
* Storage instance for file operations.
|
|
20
|
+
*/
|
|
21
|
+
storage: BaseStorage<TFile>;
|
|
22
|
+
/**
|
|
23
|
+
* Optional media transformer for image/video processing.
|
|
24
|
+
*/
|
|
25
|
+
mediaTransformer?: MediaTransformer;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to disable termination for finished uploads.
|
|
28
|
+
*/
|
|
29
|
+
disableTerminationForFinishedUploads?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Logger instance for debugging and error reporting.
|
|
32
|
+
*/
|
|
33
|
+
protected logger?: Console;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the logger instance.
|
|
36
|
+
* @returns Logger instance or undefined.
|
|
37
|
+
*/
|
|
38
|
+
get loggerInstance(): Console | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Internal error responses configuration.
|
|
41
|
+
*/
|
|
42
|
+
protected internalErrorResponses: ErrorResponses;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the error responses configuration.
|
|
45
|
+
* @returns Error responses configuration.
|
|
46
|
+
*/
|
|
47
|
+
get errorResponses(): ErrorResponses;
|
|
48
|
+
constructor({ disableTerminationForFinishedUploads, mediaTransformer, storage }: UploadOptions<TFile>);
|
|
49
|
+
/**
|
|
50
|
+
* Sets custom error responses.
|
|
51
|
+
* @param value Partial error responses to override defaults.
|
|
52
|
+
*/
|
|
53
|
+
set errorResponses(value: Partial<ErrorResponses>);
|
|
54
|
+
/**
|
|
55
|
+
* Assemble error responses by merging defaults with custom overrides.
|
|
56
|
+
* @param customErrors Custom error responses to override defaults
|
|
57
|
+
*/
|
|
58
|
+
assembleErrors: (customErrors?: {}) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Parses HTTP Range header and returns start/end byte positions for partial content requests.
|
|
61
|
+
* @param rangeHeader HTTP Range header value (e.g., "bytes=0-1023").
|
|
62
|
+
* @param fileSize Total size of the file in bytes.
|
|
63
|
+
* @returns Object with start and end positions, or undefined if range is invalid.
|
|
64
|
+
*/
|
|
65
|
+
parseRangeHeader(rangeHeader: string | undefined, fileSize: number): {
|
|
66
|
+
end: number;
|
|
67
|
+
start: number;
|
|
68
|
+
} | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Build file URL from request and file data.
|
|
71
|
+
* Platform-agnostic version that accepts URL string.
|
|
72
|
+
* @param requestUrl Request URL string
|
|
73
|
+
* @param file File object containing ID and content type
|
|
74
|
+
* @returns Constructed file URL with extension based on content type
|
|
75
|
+
*/
|
|
76
|
+
protected buildFileUrlFromString(requestUrl: string, file: TFile): string;
|
|
77
|
+
/**
|
|
78
|
+
* Negotiates content type based on Accept header and supported formats.
|
|
79
|
+
* Platform-agnostic version that accepts header string.
|
|
80
|
+
* @param acceptHeader Accept header value
|
|
81
|
+
* @param supportedTypes Array of supported MIME types to match against
|
|
82
|
+
* @returns Best matching content type or undefined if no match found
|
|
83
|
+
*/
|
|
84
|
+
negotiateContentTypeFromHeader(acceptHeader: string | undefined, supportedTypes: string[]): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Check for undefined ID or path errors and throw appropriate HTTP errors.
|
|
87
|
+
* @param error The error to check
|
|
88
|
+
*/
|
|
89
|
+
protected checkForUndefinedIdOrPath(error: unknown): void;
|
|
90
|
+
}
|
|
91
|
+
export default BaseHandlerCore;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { UploadFile } from "../../storage/utils/index.d.ts";
|
|
2
|
+
import type { UploadResponse } from "../../utils/types.d.ts";
|
|
3
|
+
import type { Handlers, ResponseFile, ResponseList, UploadOptions } from "../types.d.ts";
|
|
4
|
+
import BaseHandlerCore from "./base-handler-core.d.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Base handler for Web API Fetch platform (Request/Response).
|
|
7
|
+
* Extends BaseHandlerCore with Fetch-specific request/response handling.
|
|
8
|
+
* @template TFile The file type used by this handler.
|
|
9
|
+
*/
|
|
10
|
+
declare abstract class BaseHandlerFetch<TFile extends UploadFile> extends BaseHandlerCore<TFile> {
|
|
11
|
+
/**
|
|
12
|
+
* Limiting enabled HTTP method handler.
|
|
13
|
+
*/
|
|
14
|
+
static readonly methods: Handlers[];
|
|
15
|
+
/**
|
|
16
|
+
* Map of registered HTTP method handlers.
|
|
17
|
+
*/
|
|
18
|
+
protected registeredHandlers: Map<string, (request: Request) => Promise<ResponseFile<TFile> | ResponseList<TFile>>>;
|
|
19
|
+
constructor(options: UploadOptions<TFile>);
|
|
20
|
+
/**
|
|
21
|
+
* Gets the registered handlers map.
|
|
22
|
+
* @returns Map of registered handlers.
|
|
23
|
+
*/
|
|
24
|
+
get handlers(): Map<string, (request: Request) => Promise<ResponseFile<TFile> | ResponseList<TFile>>>;
|
|
25
|
+
/**
|
|
26
|
+
* Handles Web API Fetch requests (for Hono, Cloudflare Workers, etc.).
|
|
27
|
+
* @param request Web API Request object.
|
|
28
|
+
* @returns Promise resolving to Web API Response.
|
|
29
|
+
*/
|
|
30
|
+
fetch(request: Request): Promise<globalThis.Response>;
|
|
31
|
+
/**
|
|
32
|
+
* Compose and register HTTP method handlers.
|
|
33
|
+
* Subclasses should override this to register their specific handlers.
|
|
34
|
+
*/
|
|
35
|
+
protected abstract compose(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Handle the response from handlers for fetch requests and convert to Web API Response.
|
|
38
|
+
* @param request Web API Request object
|
|
39
|
+
* @param file Response file or list from handler
|
|
40
|
+
* @returns Promise resolving to Web API Response object
|
|
41
|
+
*/
|
|
42
|
+
protected handleFetchResponse(request: Request, file: ResponseFile<TFile> | ResponseList<TFile>): Promise<globalThis.Response>;
|
|
43
|
+
/**
|
|
44
|
+
* Convert headers to Web API Headers format by flattening arrays and converting to strings.
|
|
45
|
+
* @param headers Headers object with potentially array values
|
|
46
|
+
* @returns Headers object with all values as strings
|
|
47
|
+
*/
|
|
48
|
+
protected convertHeaders(headers: Record<string, number | string | string[]>): Record<string, string>;
|
|
49
|
+
/**
|
|
50
|
+
* Create Web API Response from UploadResponse object.
|
|
51
|
+
* @param uploadResponse Upload response containing body, headers, and status code
|
|
52
|
+
* @returns Web API Response object
|
|
53
|
+
*/
|
|
54
|
+
protected createResponse(uploadResponse: UploadResponse): globalThis.Response;
|
|
55
|
+
/**
|
|
56
|
+
* Create error Response from Error object with appropriate status code and message.
|
|
57
|
+
* @param error Error object to convert to HTTP error response
|
|
58
|
+
* @returns Web API Response object with error details
|
|
59
|
+
*/
|
|
60
|
+
protected createErrorResponse(error: Error): Promise<globalThis.Response>;
|
|
61
|
+
/**
|
|
62
|
+
* Build file URL from request and file data.
|
|
63
|
+
* @param request Web API Request object
|
|
64
|
+
* @param file File object containing ID and content type
|
|
65
|
+
* @returns Constructed file URL with extension based on content type
|
|
66
|
+
*/
|
|
67
|
+
protected buildFileUrl(request: Request, file: TFile): string;
|
|
68
|
+
/**
|
|
69
|
+
* Negotiates content type based on Accept header and supported formats.
|
|
70
|
+
* @param request Web API Request object containing Accept header.
|
|
71
|
+
* @param supportedTypes Array of supported MIME types to match against.
|
|
72
|
+
* @returns Best matching content type or undefined if no match found.
|
|
73
|
+
*/
|
|
74
|
+
negotiateContentType(request: Request, supportedTypes: string[]): string | undefined;
|
|
75
|
+
}
|
|
76
|
+
export default BaseHandlerFetch;
|