@visulima/storage 1.0.0-alpha.2 → 1.0.0-alpha.20
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 +252 -0
- package/LICENSE.md +1256 -512
- package/README.md +4 -4
- package/dist/adapter/nuxt/module.d.ts +41 -34
- package/dist/adapter/nuxt/module.js +1 -93
- package/dist/handler/http/fetch/index.d.ts +297 -4
- package/dist/handler/http/fetch/index.js +1 -4
- package/dist/handler/http/hono/index.d.ts +1474 -58
- package/dist/handler/http/hono/index.js +1 -65
- package/dist/handler/http/nextjs/index.d.ts +66 -58
- package/dist/handler/http/nextjs/index.js +1 -37
- package/dist/handler/http/node/index.d.ts +361 -4
- package/dist/handler/http/node/index.js +1 -4
- package/dist/handler/http/solid-start/index.d.ts +66 -57
- package/dist/handler/http/solid-start/index.js +1 -44
- package/dist/index.d.ts +376 -17
- package/dist/index.js +1 -13
- package/dist/openapi/index.d.ts +24 -5
- package/dist/openapi/index.js +1 -5
- package/dist/packem_shared/AwsLightFile-BTLiRxXj.js +1 -0
- package/dist/packem_shared/AwsLightMetaStorage-DHz1nf_H.js +1 -0
- package/dist/packem_shared/AwsLightStorage-CA9cdfJ6.js +1 -0
- package/dist/packem_shared/AzureFile-BKHru1zB.js +1 -0
- package/dist/packem_shared/AzureSMetaStorage-BqA4jUDJ.js +1 -0
- package/dist/packem_shared/AzureStorage-BKUjCymW.js +1 -0
- package/dist/packem_shared/BaseTransformer-D68eLyz1.js +1 -0
- package/dist/packem_shared/DiskStorage-DNjpDMX9.js +1 -0
- package/dist/packem_shared/DiskStorageWithChecksum-Bb6JX_tC.js +1 -0
- package/dist/packem_shared/ERRORS-B9jkvKwx.js +1 -0
- package/dist/packem_shared/File-alcSNpLq.js +1 -0
- package/dist/packem_shared/GCSConfig-BQ0OpVhe.js +1 -0
- package/dist/packem_shared/GCSFile-CHjX_fJk.js +1 -0
- package/dist/packem_shared/GCSMetaStorage-1UQIN9IN.js +1 -0
- package/dist/packem_shared/GCStorage-PJRb2WWC.js +1 -0
- package/dist/packem_shared/LocalMetaStorage-BWuFvWn4.js +1 -0
- package/dist/packem_shared/MediaTransformer-2C8MJeAg.js +1 -0
- package/dist/packem_shared/MetaStorage-Y4m1dWgd.js +1 -0
- package/dist/packem_shared/Metadata-B6Ir0KO7.js +1 -0
- package/dist/packem_shared/Multipart-Bd9YFFn0.js +1 -0
- package/dist/packem_shared/Multipart-D5bcEvga.js +1 -0
- package/dist/packem_shared/NetlifyBlobFile-CpzkMKng.js +1 -0
- package/dist/packem_shared/NetlifyBlobMetaStorage-dD0oBLom.js +1 -0
- package/dist/packem_shared/NetlifyBlobStorage-ByTwCN-h.js +1 -0
- package/dist/packem_shared/NoOpMetrics-Dky06sf1.js +1 -0
- package/dist/packem_shared/OpenTelemetryMetrics-9uxQMSlg.js +1 -0
- package/dist/packem_shared/Rest-CYEBbtCD.js +1 -0
- package/dist/packem_shared/Rest-DoonVU7B.js +1 -0
- package/dist/packem_shared/S3Client.d-CZ62Jztg.d.ts +20357 -0
- package/dist/packem_shared/S3File-Du6wP0Sz.js +1 -0
- package/dist/packem_shared/S3MetaStorage-vcriiosn.js +1 -0
- package/dist/packem_shared/S3Storage-Fx6-OSc-.js +1 -0
- package/dist/packem_shared/TUS_RESUMABLE-B7KtPVeC.js +1 -0
- package/dist/packem_shared/Tus-Bd_2Ki2G.js +1 -0
- package/dist/packem_shared/Tus-CUBCkuPE.js +1 -0
- package/dist/packem_shared/ValidationError-D8KKJiKA.js +1 -0
- package/dist/packem_shared/VercelBlobFile-CL9MjKcY.js +1 -0
- package/dist/packem_shared/VercelBlobMetaStorage-BsOTx-Su.js +1 -0
- package/dist/packem_shared/VercelBlobStorage-kNkk5Cn4.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
- package/dist/packem_shared/aws-light-meta-storage-TPyQwLvk.js +4 -0
- package/dist/packem_shared/backblaze-DEflv87m.js +1 -0
- package/dist/packem_shared/base-handler-core-DaggCVsq.js +1 -0
- package/dist/packem_shared/base-handler-fetch-DnarP64X.js +1 -0
- package/dist/packem_shared/base-handler-node-BTes6sql.js +1 -0
- package/dist/packem_shared/cache-qV_5Umeq.js +1 -0
- package/dist/packem_shared/cloudflare-DLAeQvgD.js +1 -0
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-yiM9GxHr.js +1 -0
- package/dist/packem_shared/digitalOcean-nhZUds87.js +1 -0
- package/dist/packem_shared/disk-storage-BvdK4bqF.js +5 -0
- package/dist/packem_shared/disk-storage-with-checksum.d-hEoe2ugb.d.ts +148 -0
- package/dist/packem_shared/gcs-meta-storage-DXqBZ3Xm.js +1 -0
- package/dist/packem_shared/has-content-Bx2p8Okx.js +1 -0
- package/dist/packem_shared/headers-DC2MEOrK.js +27 -0
- package/dist/packem_shared/is-expired-1JuZjDtb.js +1 -0
- package/dist/packem_shared/isRetryableError-DQNSZiBc.js +1 -0
- package/dist/packem_shared/isValidMediaType-B-2UKjZx.js +1 -0
- package/dist/packem_shared/local-meta-storage-Bkwqi_gi.js +1 -0
- package/dist/packem_shared/local-meta-storage.d-Dop9RP9k.d.ts +20 -0
- package/dist/packem_shared/media-transformer.d-LGdEjx6A.d.ts +331 -0
- package/dist/packem_shared/minio-BWwgGXeE.js +1 -0
- package/dist/packem_shared/multipart-base-C6OjBwMS.js +1 -0
- package/dist/packem_shared/part-match-DqD5U7An.js +1 -0
- package/dist/packem_shared/path-D7rMc9nq-B718mbm6.js +1 -0
- package/dist/packem_shared/response-builder-Wdo_fvcF.js +1 -0
- package/dist/packem_shared/rest-base-B2Dv7esY.js +1 -0
- package/dist/packem_shared/restOpenApiSpec-PaIVbESh.js +1 -0
- package/dist/packem_shared/s3-base-storage-xHZNtsGe.js +1 -0
- package/dist/packem_shared/s3-base-storage.d-CczjSe98.d.ts +251 -0
- package/dist/packem_shared/sharedGet-Ce7WGAsc.js +1 -0
- package/dist/packem_shared/storage-m_Cxgiih.js +1 -0
- package/dist/packem_shared/storage.d-BOMUJD96.d.ts +939 -0
- package/dist/packem_shared/tigris-DZoyrMNd.js +1 -0
- package/dist/packem_shared/transformOpenApiSpec-C0vEbDTO.js +1 -0
- package/dist/packem_shared/tus-base.d-C20dSee8.d.ts +99 -0
- package/dist/packem_shared/tusOpenApiSpec-DF0-hlWV.js +1 -0
- package/dist/packem_shared/types.d-B4hqF6yH.d.ts +708 -0
- package/dist/packem_shared/types.d-CNvyxOka.d.ts +49 -0
- package/dist/packem_shared/update-size-DANV7aa2.js +1 -0
- package/dist/packem_shared/validator-DK41xp8N.js +1 -0
- package/dist/packem_shared/waitForStorage-ChSBLhLc.js +1 -0
- package/dist/packem_shared/wasabi-Dmce4x9s.js +1 -0
- package/dist/packem_shared/xhrOpenApiSpec-nyoboz83.js +1 -0
- package/dist/storage/aws/clients/index.d.ts +166 -6
- package/dist/storage/aws/clients/index.js +1 -6
- package/dist/storage/aws/index.d.ts +320 -4
- package/dist/storage/aws/index.js +1 -3
- package/dist/storage/aws-light/index.d.ts +252 -4
- package/dist/storage/aws-light/index.js +1 -3
- package/dist/storage/azure/index.d.ts +10422 -4
- package/dist/storage/azure/index.js +1 -3
- package/dist/storage/gcs/index.d.ts +4107 -5
- package/dist/storage/gcs/index.js +1 -4
- package/dist/storage/local/index.d.ts +7 -4
- package/dist/storage/local/index.js +1 -3
- package/dist/storage/netlify-blob/index.d.ts +142 -4
- package/dist/storage/netlify-blob/index.js +1 -3
- package/dist/storage/vercel-blob/index.d.ts +129 -4
- package/dist/storage/vercel-blob/index.js +1 -3
- package/dist/transformer/audio-transformer.d.ts +127 -125
- package/dist/transformer/audio-transformer.js +1 -278
- package/dist/transformer/image-transformer.d.ts +569 -568
- package/dist/transformer/image-transformer.js +1 -1100
- package/dist/transformer/index.d.ts +62 -5
- package/dist/transformer/index.js +1 -4
- package/dist/transformer/video-transformer.d.ts +144 -142
- package/dist/transformer/video-transformer.js +1 -310
- package/package.json +60 -60
- package/dist/handler/base/base-handler-core.d.ts +0 -91
- package/dist/handler/base/base-handler-fetch.d.ts +0 -76
- package/dist/handler/base/base-handler-node.d.ts +0 -137
- package/dist/handler/multipart/multipart-base.d.ts +0 -84
- package/dist/handler/multipart/multipart-fetch.d.ts +0 -64
- package/dist/handler/multipart/multipart.d.ts +0 -49
- package/dist/handler/rest/rest-base.d.ts +0 -106
- package/dist/handler/rest/rest-fetch.d.ts +0 -88
- package/dist/handler/rest/rest.d.ts +0 -93
- package/dist/handler/tus/tus-base.d.ts +0 -152
- package/dist/handler/tus/tus-fetch.d.ts +0 -72
- package/dist/handler/tus/tus.d.ts +0 -78
- package/dist/handler/types.d.ts +0 -53
- package/dist/handler/utils/request-parser.d.ts +0 -72
- package/dist/handler/utils/response-builder.d.ts +0 -83
- package/dist/handler/utils/storage-utils.d.ts +0 -10
- package/dist/handler/utils/stream-utils.d.ts +0 -29
- package/dist/handler/utils/upload-handlers.d.ts +0 -76
- package/dist/metrics/index.d.ts +0 -2
- package/dist/metrics/no-op-metrics.d.ts +0 -15
- package/dist/metrics/opentelemetry-metrics.d.ts +0 -55
- package/dist/openapi/rest.d.ts +0 -7
- package/dist/openapi/shared.d.ts +0 -13
- package/dist/openapi/transform.d.ts +0 -3
- package/dist/openapi/tus.d.ts +0 -7
- package/dist/openapi/xhr.d.ts +0 -7
- package/dist/packem_shared/AwsLightFile-tTneXZgG.js +0 -11
- package/dist/packem_shared/AwsLightMetaStorage-BWSOtVaN.js +0 -4
- package/dist/packem_shared/AwsLightStorage-Cwkkc-z3.js +0 -133
- package/dist/packem_shared/AzureFile-CesgFzps.js +0 -8
- package/dist/packem_shared/AzureSMetaStorage-CFs-OYJT.js +0 -88
- package/dist/packem_shared/AzureStorage-9MoV2W8q.js +0 -357
- package/dist/packem_shared/BaseTransformer-C2gLib6v.js +0 -82
- package/dist/packem_shared/DiskStorage-CJtTzMQ3.js +0 -12
- package/dist/packem_shared/DiskStorageWithChecksum-BgrG8pvC.js +0 -238
- package/dist/packem_shared/ERRORS-D0apMqnc.js +0 -97
- package/dist/packem_shared/File-Bb3P23dr.js +0 -69
- package/dist/packem_shared/GCSConfig-vPP22kN6.js +0 -11
- package/dist/packem_shared/GCSFile-BIEunhAN.js +0 -8
- package/dist/packem_shared/GCSMetaStorage-sYiSjLUx.js +0 -7
- package/dist/packem_shared/GCStorage-DPl1_DAm.js +0 -406
- package/dist/packem_shared/LocalMetaStorage-CZHhKkMd.js +0 -7
- package/dist/packem_shared/MediaTransformer-D6658DL1.js +0 -1197
- package/dist/packem_shared/MetaStorage-pECeFOad.js +0 -46
- package/dist/packem_shared/Metadata-DRLXeJ0F.js +0 -89
- package/dist/packem_shared/Multipart-CNFK_Okz.js +0 -163
- package/dist/packem_shared/Multipart-CtUL7BQw.js +0 -128
- package/dist/packem_shared/NetlifyBlobFile-CXzyjqrD.js +0 -14
- package/dist/packem_shared/NetlifyBlobMetaStorage-DxZ5aDvD.js +0 -9
- package/dist/packem_shared/NetlifyBlobStorage-C6AX-X0P.js +0 -376
- package/dist/packem_shared/NoOpMetrics-DhAk5rXc.js +0 -10
- package/dist/packem_shared/OpenTelemetryMetrics-BnxhqIaH.js +0 -67
- package/dist/packem_shared/Rest-CAOAEkOj.js +0 -267
- package/dist/packem_shared/Rest-DNuLwBrK.js +0 -228
- package/dist/packem_shared/S3File-DZiyk9Qt.js +0 -11
- package/dist/packem_shared/S3MetaStorage-Dz9aDabA.js +0 -76
- package/dist/packem_shared/S3Storage-CgheE2yH.js +0 -316
- package/dist/packem_shared/TUS_RESUMABLE-GJzZ9R-f.js +0 -434
- package/dist/packem_shared/Tus-B8PmlMgR.js +0 -200
- package/dist/packem_shared/Tus-C4F1aYOl.js +0 -195
- package/dist/packem_shared/ValidationError-BfF1aE4h.js +0 -26
- package/dist/packem_shared/VercelBlobFile-BCg4aTEq.js +0 -18
- package/dist/packem_shared/VercelBlobMetaStorage-Bd9F-VFm.js +0 -9
- package/dist/packem_shared/VercelBlobStorage-BbuEYhOz.js +0 -261
- package/dist/packem_shared/_commonjsHelpers-B85MJLTf.js +0 -5
- package/dist/packem_shared/aws-light-meta-storage-DKJBgbR6.js +0 -446
- package/dist/packem_shared/backblaze-BlMnIcBC.js +0 -20
- package/dist/packem_shared/base-handler-core-BKuf4YLT.js +0 -303
- package/dist/packem_shared/base-handler-fetch-Cr0hLiqg.js +0 -291
- package/dist/packem_shared/base-handler-node-gk5aN9Cx.js +0 -730
- package/dist/packem_shared/cache-B88MXQ_2.js +0 -18
- package/dist/packem_shared/cloudflare-Bi1q8wXE.js +0 -21
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-oVDgf-Sw.js +0 -11
- package/dist/packem_shared/digitalOcean-CWQRJM3L.js +0 -21
- package/dist/packem_shared/disk-storage-DkDoHnKB.js +0 -810
- package/dist/packem_shared/gcs-meta-storage-etw4wuh5.js +0 -158
- package/dist/packem_shared/has-content-CY66ehMK.js +0 -3
- package/dist/packem_shared/headers-DoS5nwM-.js +0 -3220
- package/dist/packem_shared/is-expired-CTThU1q5.js +0 -8
- package/dist/packem_shared/isRetryableError-Dycp7127.js +0 -82
- package/dist/packem_shared/isValidMediaType-BeDgiObq.js +0 -35
- package/dist/packem_shared/local-meta-storage-By-3SNBI.js +0 -649
- package/dist/packem_shared/minio-C2YBZQOw.js +0 -22
- package/dist/packem_shared/multipart-base-B3i67SSX.js +0 -102
- package/dist/packem_shared/part-match-BMNqHDYD.js +0 -96
- package/dist/packem_shared/path-CR6YkPXX-7R1-9CMk.js +0 -161
- package/dist/packem_shared/response-builder-BtnRiBUI.js +0 -45
- package/dist/packem_shared/rest-base-GRCcnan7.js +0 -457
- package/dist/packem_shared/restOpenApiSpec-CwcHHY2C.js +0 -800
- package/dist/packem_shared/s3-base-storage-xw6NJFX7.js +0 -510
- package/dist/packem_shared/sharedGet-Cpo7QUyu.js +0 -1019
- package/dist/packem_shared/storage-BwdYUHs3.js +0 -864
- package/dist/packem_shared/tigris-Hac8TKnX.js +0 -21
- package/dist/packem_shared/transformOpenApiSpec-DWM5WtnN.js +0 -975
- package/dist/packem_shared/tusOpenApiSpec-6ohiToBy.js +0 -740
- package/dist/packem_shared/update-size-CCGm6i1J.js +0 -8
- package/dist/packem_shared/validator-BeX_lJet.js +0 -78
- package/dist/packem_shared/waitForStorage-Cscw85sx.js +0 -18
- package/dist/packem_shared/wasabi-DIyflHSd.js +0 -21
- package/dist/packem_shared/xhrOpenApiSpec-DS17brnx.js +0 -264
- package/dist/storage/aws/clients/backblaze.d.ts +0 -12
- package/dist/storage/aws/clients/cloudflare.d.ts +0 -13
- package/dist/storage/aws/clients/digital-ocean.d.ts +0 -12
- package/dist/storage/aws/clients/minio.d.ts +0 -13
- package/dist/storage/aws/clients/tigris.d.ts +0 -12
- package/dist/storage/aws/clients/types.d.ts +0 -95
- package/dist/storage/aws/clients/wasabi.d.ts +0 -12
- package/dist/storage/aws/s3-base-storage.d.ts +0 -248
- package/dist/storage/aws/s3-client-adapter.d.ts +0 -110
- package/dist/storage/aws/s3-file.d.ts +0 -10
- package/dist/storage/aws/s3-meta-storage.d.ts +0 -15
- package/dist/storage/aws/s3-storage.d.ts +0 -70
- package/dist/storage/aws/types.d.ts +0 -119
- package/dist/storage/aws-light/aws-light-api-adapter.d.ts +0 -130
- package/dist/storage/aws-light/aws-light-file.d.ts +0 -10
- package/dist/storage/aws-light/aws-light-meta-storage.d.ts +0 -19
- package/dist/storage/aws-light/aws-light-storage.d.ts +0 -65
- package/dist/storage/aws-light/types.d.ts +0 -37
- package/dist/storage/azure/azure-file.d.ts +0 -6
- package/dist/storage/azure/azure-meta-storage.d.ts +0 -15
- package/dist/storage/azure/azure-storage.d.ts +0 -69
- package/dist/storage/azure/types.d.ts +0 -62
- package/dist/storage/gcs/fetch-error.d.ts +0 -11
- package/dist/storage/gcs/gcs-config.d.ts +0 -2
- package/dist/storage/gcs/gcs-file.d.ts +0 -6
- package/dist/storage/gcs/gcs-meta-storage.d.ts +0 -27
- package/dist/storage/gcs/gcs-storage.d.ts +0 -91
- package/dist/storage/gcs/types.d.ts +0 -55
- package/dist/storage/gcs/utils.d.ts +0 -7
- package/dist/storage/local/disk-storage-with-checksum.d.ts +0 -15
- package/dist/storage/local/disk-storage.d.ts +0 -135
- package/dist/storage/local/local-meta-storage.d.ts +0 -32
- package/dist/storage/meta-storage.d.ts +0 -30
- package/dist/storage/netlify-blob/netlify-blob-file.d.ts +0 -12
- package/dist/storage/netlify-blob/netlify-blob-meta-storage.d.ts +0 -7
- package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +0 -93
- package/dist/storage/netlify-blob/types.d.ts +0 -30
- package/dist/storage/storage.d.ts +0 -353
- package/dist/storage/types.d.ts +0 -221
- package/dist/storage/utils/file/file.d.ts +0 -25
- package/dist/storage/utils/file/get-file-status.d.ts +0 -9
- package/dist/storage/utils/file/has-content.d.ts +0 -9
- package/dist/storage/utils/file/index.d.ts +0 -10
- package/dist/storage/utils/file/is-expired.d.ts +0 -8
- package/dist/storage/utils/file/metadata.d.ts +0 -18
- package/dist/storage/utils/file/part-match.d.ts +0 -11
- package/dist/storage/utils/file/types.d.ts +0 -37
- package/dist/storage/utils/file/update-metadata.d.ts +0 -10
- package/dist/storage/utils/file/update-size.d.ts +0 -10
- package/dist/storage/vercel-blob/types.d.ts +0 -32
- package/dist/storage/vercel-blob/vercel-blob-file.d.ts +0 -16
- package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +0 -7
- package/dist/storage/vercel-blob/vercel-blob-storage.d.ts +0 -76
- package/dist/transformer/base-transformer.d.ts +0 -63
- package/dist/transformer/media-transformer.d.ts +0 -332
- package/dist/transformer/types.d.ts +0 -652
- package/dist/transformer/utils.d.ts +0 -33
- package/dist/transformer/validation-error.d.ts +0 -23
- package/dist/utils/cache.d.ts +0 -32
- package/dist/utils/chunked-upload.d.ts +0 -65
- package/dist/utils/detect-file-type.d.ts +0 -28
- package/dist/utils/errors.d.ts +0 -74
- package/dist/utils/file-path-url-matcher.d.ts +0 -18
- package/dist/utils/headers.d.ts +0 -111
- package/dist/utils/http.d.ts +0 -92
- package/dist/utils/locker.d.ts +0 -26
- package/dist/utils/pipes/stream-checksum.d.ts +0 -47
- package/dist/utils/pipes/stream-length.d.ts +0 -22
- package/dist/utils/primitives/get-last-one.d.ts +0 -3
- package/dist/utils/primitives/is-record.d.ts +0 -2
- package/dist/utils/primitives/map-values.d.ts +0 -9
- package/dist/utils/primitives/pick.d.ts +0 -2
- package/dist/utils/primitives/to-milliseconds.d.ts +0 -12
- package/dist/utils/primitives/to-seconds.d.ts +0 -12
- package/dist/utils/range-checksum.d.ts +0 -33
- package/dist/utils/range-hasher.d.ts +0 -46
- package/dist/utils/retry.d.ts +0 -64
- package/dist/utils/types.d.ts +0 -108
- package/dist/utils/validation-error.d.ts +0 -22
- package/dist/utils/validator.d.ts +0 -36
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
import { F as File, M as MetaStorage, c as createRetryWrapper, b as FileInit, B as BaseStorage, R as RetryConfig, d as FilePart, e as FileQuery, a as FileReturn } from "./storage.d-BOMUJD96.js";
|
|
3
|
+
/**
|
|
4
|
+
* Part interface for multipart uploads.
|
|
5
|
+
*/
|
|
6
|
+
interface Part {
|
|
7
|
+
ETag?: string;
|
|
8
|
+
PartNumber: number;
|
|
9
|
+
Size?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Base file type for S3-compatible storage.
|
|
13
|
+
*/
|
|
14
|
+
interface S3CompatibleFile extends File {
|
|
15
|
+
Parts?: Part[];
|
|
16
|
+
partSize?: number;
|
|
17
|
+
partsUrls?: string[];
|
|
18
|
+
UploadId?: string;
|
|
19
|
+
uri?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* S3 API operations interface that must be implemented by concrete storage classes.
|
|
23
|
+
*/
|
|
24
|
+
interface S3ApiOperations {
|
|
25
|
+
abortMultipartUpload: (params: {
|
|
26
|
+
Bucket: string;
|
|
27
|
+
Key: string;
|
|
28
|
+
UploadId: string;
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
checkBucketAccess: (params: {
|
|
31
|
+
Bucket: string;
|
|
32
|
+
}) => Promise<void>;
|
|
33
|
+
completeMultipartUpload: (params: {
|
|
34
|
+
Bucket: string;
|
|
35
|
+
Key: string;
|
|
36
|
+
Parts: {
|
|
37
|
+
ETag: string;
|
|
38
|
+
PartNumber: number;
|
|
39
|
+
}[];
|
|
40
|
+
UploadId: string;
|
|
41
|
+
}) => Promise<{
|
|
42
|
+
ETag?: string;
|
|
43
|
+
Location: string;
|
|
44
|
+
}>;
|
|
45
|
+
copyObject: (params: {
|
|
46
|
+
Bucket: string;
|
|
47
|
+
CopySource: string;
|
|
48
|
+
Key: string;
|
|
49
|
+
StorageClass?: string;
|
|
50
|
+
}) => Promise<void>;
|
|
51
|
+
createMultipartUpload: (params: {
|
|
52
|
+
ACL?: string;
|
|
53
|
+
Bucket: string;
|
|
54
|
+
ContentType?: string;
|
|
55
|
+
Key: string;
|
|
56
|
+
Metadata?: Record<string, string>;
|
|
57
|
+
}) => Promise<{
|
|
58
|
+
UploadId: string;
|
|
59
|
+
}>;
|
|
60
|
+
deleteObject: (params: {
|
|
61
|
+
Bucket: string;
|
|
62
|
+
Key: string;
|
|
63
|
+
}) => Promise<void>;
|
|
64
|
+
getObject: (params: {
|
|
65
|
+
Bucket: string;
|
|
66
|
+
Key: string;
|
|
67
|
+
}) => Promise<{
|
|
68
|
+
Body?: ReadableStream | Readable;
|
|
69
|
+
ContentLength?: number;
|
|
70
|
+
ContentType?: string;
|
|
71
|
+
ETag?: string;
|
|
72
|
+
Expires?: Date;
|
|
73
|
+
LastModified?: Date;
|
|
74
|
+
Metadata?: Record<string, string>;
|
|
75
|
+
}>;
|
|
76
|
+
getPresignedUrl: (params: {
|
|
77
|
+
Bucket: string;
|
|
78
|
+
expiresIn: number;
|
|
79
|
+
Key: string;
|
|
80
|
+
PartNumber: number;
|
|
81
|
+
UploadId: string;
|
|
82
|
+
}) => Promise<string>;
|
|
83
|
+
headObject: (params: {
|
|
84
|
+
Bucket: string;
|
|
85
|
+
Key: string;
|
|
86
|
+
}) => Promise<{
|
|
87
|
+
ContentLength?: number;
|
|
88
|
+
ContentType?: string;
|
|
89
|
+
ETag?: string;
|
|
90
|
+
Expires?: Date;
|
|
91
|
+
LastModified?: Date;
|
|
92
|
+
Metadata?: Record<string, string>;
|
|
93
|
+
}>;
|
|
94
|
+
listObjectsV2: (params: {
|
|
95
|
+
Bucket: string;
|
|
96
|
+
ContinuationToken?: string;
|
|
97
|
+
MaxKeys?: number;
|
|
98
|
+
}) => Promise<{
|
|
99
|
+
Contents?: {
|
|
100
|
+
Key?: string;
|
|
101
|
+
LastModified?: Date;
|
|
102
|
+
}[];
|
|
103
|
+
IsTruncated?: boolean;
|
|
104
|
+
NextContinuationToken?: string;
|
|
105
|
+
}>;
|
|
106
|
+
listParts: (params: {
|
|
107
|
+
Bucket: string;
|
|
108
|
+
Key: string;
|
|
109
|
+
UploadId: string;
|
|
110
|
+
}) => Promise<{
|
|
111
|
+
Parts?: Part[];
|
|
112
|
+
}>;
|
|
113
|
+
uploadPart: (params: {
|
|
114
|
+
Body: Readable | ReadableStream | Uint8Array;
|
|
115
|
+
Bucket: string;
|
|
116
|
+
ContentLength?: number;
|
|
117
|
+
ContentMD5?: string;
|
|
118
|
+
Key: string;
|
|
119
|
+
PartNumber: number;
|
|
120
|
+
UploadId: string;
|
|
121
|
+
}) => Promise<{
|
|
122
|
+
ETag: string;
|
|
123
|
+
}>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Base class for S3-compatible storage implementations.
|
|
127
|
+
* Contains all shared business logic for S3 operations.
|
|
128
|
+
* @template TFile The file type used by this storage backend.
|
|
129
|
+
*/
|
|
130
|
+
declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3CompatibleFile> extends BaseStorage<TFile> {
|
|
131
|
+
override checksumTypes: string[];
|
|
132
|
+
protected bucket: string;
|
|
133
|
+
protected meta: MetaStorage<TFile>;
|
|
134
|
+
/**
|
|
135
|
+
* S3 multipart upload does not allow more than 10000 parts.
|
|
136
|
+
*/
|
|
137
|
+
protected readonly MAX_PARTS = 1e4;
|
|
138
|
+
protected readonly partSize: number;
|
|
139
|
+
protected readonly retry: ReturnType<typeof createRetryWrapper>;
|
|
140
|
+
/**
|
|
141
|
+
* Abstract method to get S3 API operations implementation.
|
|
142
|
+
*/
|
|
143
|
+
protected abstract getS3Api(): S3ApiOperations;
|
|
144
|
+
/**
|
|
145
|
+
* Abstract method to get the file class constructor.
|
|
146
|
+
*/
|
|
147
|
+
protected abstract getFileClass(): new (config: FileInit) => TFile;
|
|
148
|
+
/**
|
|
149
|
+
* Abstract method to get ACL value.
|
|
150
|
+
*/
|
|
151
|
+
protected abstract getAcl(): string | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Abstract method for access check.
|
|
154
|
+
*/
|
|
155
|
+
protected abstract accessCheck(maxWaitTime?: number): Promise<void>;
|
|
156
|
+
constructor(config: {
|
|
157
|
+
bucket: string;
|
|
158
|
+
clientDirectUpload?: boolean;
|
|
159
|
+
expiration?: {
|
|
160
|
+
maxAge?: string;
|
|
161
|
+
};
|
|
162
|
+
filename?: (file: TFile) => string;
|
|
163
|
+
logger?: BaseStorage<TFile>["logger"];
|
|
164
|
+
metaStorage?: MetaStorage<TFile>;
|
|
165
|
+
metaStorageConfig?: unknown;
|
|
166
|
+
partSize?: number | string;
|
|
167
|
+
retryConfig?: RetryConfig;
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* Creates a new S3 multipart upload.
|
|
171
|
+
*/
|
|
172
|
+
create(config: FileInit): Promise<TFile>;
|
|
173
|
+
/**
|
|
174
|
+
* Writes data to an S3 multipart upload.
|
|
175
|
+
*/
|
|
176
|
+
write(part: FilePart | FileQuery | TFile): Promise<TFile>;
|
|
177
|
+
/**
|
|
178
|
+
* Deletes an upload and its metadata.
|
|
179
|
+
*/
|
|
180
|
+
delete({
|
|
181
|
+
id
|
|
182
|
+
}: FileQuery): Promise<TFile>;
|
|
183
|
+
/**
|
|
184
|
+
* Copies an upload file to a new location.
|
|
185
|
+
*/
|
|
186
|
+
copy(name: string, destination: string, options?: {
|
|
187
|
+
storageClass?: string;
|
|
188
|
+
}): Promise<TFile>;
|
|
189
|
+
/**
|
|
190
|
+
* Moves an upload file to a new location.
|
|
191
|
+
*/
|
|
192
|
+
move(name: string, destination: string): Promise<TFile>;
|
|
193
|
+
/**
|
|
194
|
+
* Lists files in the bucket.
|
|
195
|
+
*/
|
|
196
|
+
override list(limit?: number): Promise<TFile[]>;
|
|
197
|
+
/**
|
|
198
|
+
* Checks if a file exists by verifying both metadata and the actual S3 object.
|
|
199
|
+
* Returns true only if both the metadata and the S3 object exist.
|
|
200
|
+
* @param query File query containing the file ID to check.
|
|
201
|
+
* @returns Promise resolving to true if both metadata and S3 object exist, false otherwise.
|
|
202
|
+
*/
|
|
203
|
+
override exists({
|
|
204
|
+
id
|
|
205
|
+
}: FileQuery): Promise<boolean>;
|
|
206
|
+
/**
|
|
207
|
+
* Gets an uploaded file by ID.
|
|
208
|
+
*/
|
|
209
|
+
get({
|
|
210
|
+
id
|
|
211
|
+
}: FileQuery): Promise<FileReturn>;
|
|
212
|
+
/**
|
|
213
|
+
* Gets file stream (abstract - must be implemented by subclasses due to stream differences).
|
|
214
|
+
*/
|
|
215
|
+
abstract override getStream(query: FileQuery): Promise<{
|
|
216
|
+
headers?: Record<string, string>;
|
|
217
|
+
size?: number;
|
|
218
|
+
stream: Readable;
|
|
219
|
+
}>;
|
|
220
|
+
/**
|
|
221
|
+
* Builds presigned URLs for client uploads.
|
|
222
|
+
*/
|
|
223
|
+
protected buildPresigned(file: TFile): Promise<TFile>;
|
|
224
|
+
/**
|
|
225
|
+
* Gets presigned URLs for all parts.
|
|
226
|
+
*/
|
|
227
|
+
protected getPartsPresignedUrls(file: TFile): Promise<string[]>;
|
|
228
|
+
/**
|
|
229
|
+
* Gets parts for a multipart upload.
|
|
230
|
+
*/
|
|
231
|
+
protected getParts(file: TFile): Promise<Part[]>;
|
|
232
|
+
/**
|
|
233
|
+
* Completes a multipart upload.
|
|
234
|
+
*/
|
|
235
|
+
protected completeMultipartUpload(file: TFile): Promise<{
|
|
236
|
+
ETag?: string;
|
|
237
|
+
Location: string;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* Aborts a multipart upload.
|
|
241
|
+
*/
|
|
242
|
+
protected abortMultipartUpload(file: TFile): Promise<void>;
|
|
243
|
+
/**
|
|
244
|
+
* Internal onComplete handler.
|
|
245
|
+
*/
|
|
246
|
+
protected internalOnComplete: (file: TFile) => Promise<[{
|
|
247
|
+
ETag?: string;
|
|
248
|
+
Location: string;
|
|
249
|
+
}, TFile]>;
|
|
250
|
+
}
|
|
251
|
+
export { Part as P, S3ApiOperations as S, S3BaseStorage as a };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var d=(e,t)=>g(e,"name",{value:t,configurable:!0});var y=Object.defineProperty,r=d((e,t)=>y(e,"name",{value:t,configurable:!0}),"a");const l={value:{createdAt:"2022-12-16T10:35:17.466Z",id:"391c9157ec481ac6-f72b2d884632d7e6-cdeb2056546033e3",modifiedAt:"2022-12-16T10:35:17.470Z"}},s=r((e,t)=>e.map(i=>({...i,description:`[${t}] ${i.description}`,"x-group":t})),"createParameterGroup"),u=r((e,t=["jpeg","png","webp","avif","tiff","gif","mp4","webm","mkv","ogg","mp3","wav","aac","flac"])=>{if(!e)return[];const i=s([{description:"Output format for the transformed media",in:"query",name:"format",schema:{enum:t,type:"string"}},{description:"Quality setting (0-100 for images, affects compression)",in:"query",name:"quality",schema:{maximum:100,minimum:1,type:"integer"}}],"Common"),n=s([{description:"Desired width in pixels",in:"query",name:"width",schema:{minimum:1,type:"integer"}},{description:"Desired height in pixels",in:"query",name:"height",schema:{minimum:1,type:"integer"}},{description:"Resize fit mode",in:"query",name:"fit",schema:{enum:["cover","contain","fill","inside","outside"],type:"string"}},{description:"Position for cover/contain fits",in:"query",name:"position",schema:{oneOf:[{enum:["top","right","bottom","left","center"],type:"string"},{minimum:0,type:"integer"}]}},{description:"Avoid enlarging images smaller than specified dimensions",in:"query",name:"withoutEnlargement",schema:{type:"boolean"}},{description:"Avoid reducing images larger than specified dimensions",in:"query",name:"withoutReduction",schema:{type:"boolean"}},{description:"Resize kernel algorithm",in:"query",name:"kernel",schema:{enum:["nearest","cubic","mitchell","lanczos2","lanczos3"],type:"string"}},{description:"Fast shrink on load for large images",in:"query",name:"fastShrinkOnLoad",schema:{type:"boolean"}},{description:"Crop area left offset",in:"query",name:"left",schema:{minimum:0,type:"integer"}},{description:"Crop area top offset",in:"query",name:"top",schema:{minimum:0,type:"integer"}},{description:"Crop area width",in:"query",name:"cropWidth",schema:{minimum:1,type:"integer"}},{description:"Crop area height",in:"query",name:"cropHeight",schema:{minimum:1,type:"integer"}},{description:"Rotation angle in degrees. Note: angles other than 90°, 180°, and 270° require interpolation and may affect quality",in:"query",name:"angle",schema:{type:"number"}},{description:"Background color for rotation (hex, rgb, or color name)",in:"query",name:"background",schema:{type:"string"}},{description:"Apply blur effect",in:"query",name:"blur",schema:{type:"boolean"}},{description:"Apply sharpening",in:"query",name:"sharpen",schema:{type:"boolean"}},{description:"Apply median filter with specified size",in:"query",name:"median",schema:{minimum:1,type:"integer"}},{description:"Apply CLAHE (Contrast Limited Adaptive Histogram Equalization)",in:"query",name:"clahe",schema:{type:"boolean"}},{description:"Apply thresholding with specified value (0-255)",in:"query",name:"threshold",schema:{maximum:255,minimum:0,type:"integer"}},{description:"Apply gamma correction",in:"query",name:"gamma",schema:{type:"boolean"}},{description:"Negate (invert) the image",in:"query",name:"negate",schema:{type:"boolean"}},{description:"Normalise the image",in:"query",name:"normalise",schema:{type:"boolean"}},{description:"Flatten alpha channel",in:"query",name:"flatten",schema:{type:"boolean"}},{description:"Unflatten alpha channel",in:"query",name:"unflatten",schema:{type:"boolean"}},{description:"Flip image vertically",in:"query",name:"flip",schema:{type:"boolean"}},{description:"Flop image horizontally",in:"query",name:"flop",schema:{type:"boolean"}},{description:"Convert to greyscale",in:"query",name:"greyscale",schema:{type:"boolean"}},{description:"Apply modulation effects",in:"query",name:"modulate",schema:{type:"boolean"}},{description:"Brightness multiplier for modulation",in:"query",name:"brightness",schema:{type:"number"}},{description:"Saturation multiplier for modulation",in:"query",name:"saturation",schema:{type:"number"}},{description:"Hue rotation in degrees for modulation",in:"query",name:"hue",schema:{type:"integer"}},{description:"Lightness adjustment for modulation",in:"query",name:"lightness",schema:{type:"integer"}},{description:"Apply tinting",in:"query",name:"tint",schema:{type:"boolean"}},{description:"Convert colourspace",in:"query",name:"colourspace",schema:{enum:["srgb","rgb","cmyk","lab","b-w"],type:"string"}},{description:"Apply affine transformation",in:"query",name:"affine",schema:{type:"boolean"}},{description:"Apply dilation",in:"query",name:"dilate",schema:{type:"boolean"}},{description:"Apply erosion",in:"query",name:"erode",schema:{type:"boolean"}},{description:"Set pipeline colourspace",in:"query",name:"pipelineColourspace",schema:{type:"boolean"}},{description:"Convert to colourspace",in:"query",name:"toColourspace",schema:{type:"boolean"}},{description:"Remove alpha channel",in:"query",name:"removeAlpha",schema:{type:"boolean"}},{description:"Ensure alpha channel",in:"query",name:"ensureAlpha",schema:{type:"boolean"}}],"Image"),m=s([{description:"Desired width in pixels",in:"query",name:"width",schema:{minimum:1,type:"integer"}},{description:"Desired height in pixels",in:"query",name:"height",schema:{minimum:1,type:"integer"}},{description:"Video frame rate in Hz",in:"query",name:"frameRate",schema:{minimum:1,type:"number"}},{description:"Video key frame interval in seconds",in:"query",name:"keyFrameInterval",schema:{minimum:.1,type:"number"}}],"Video"),o=s([{description:"Target bitrate in bits per second",in:"query",name:"bitrate",schema:{minimum:1,type:"integer"}},{description:"Video or audio codec",in:"query",name:"codec",schema:{enum:["avc","hevc","vp8","vp9","av1","aac","opus","mp3","vorbis","flac"],type:"string"}}],"Video/Audio"),h=s([{description:"Audio channel count",in:"query",name:"numberOfChannels",schema:{enum:[1,2,3,4,5,6,7,8],type:"integer"}},{description:"Audio sample rate in Hz",in:"query",name:"sampleRate",schema:{enum:[8e3,11025,16e3,22050,32e3,44100,48e3,88200,96e3,192e3],type:"integer"}}],"Audio");let a=[];a=[...a,...i],(e===!0||e==="image")&&(a=[...a,...n]),(e===!0||e==="video")&&(a=[...a,...m]),(e===!0||e==="video"||e==="audio")&&(a=[...a,...o]),(e===!0||e==="audio")&&(a=[...a,...h]);const p=new Set;return a.filter(c=>p.has(c.name)?!1:(p.add(c.name),!0))},"getTransformationParameters"),q=r((e,t=["jpeg","png","webp","avif","tiff","gif","mp4","webm","mkv","ogg","mp3","wav","aac","flac"])=>{const i=u(e,t),n={};return i.forEach(m=>{const o=m["x-group"]||"Other";n[o]||(n[o]=[]),n[o].push(m.name)}),{groups:n,parameters:i}},"getOrganizedTransformationParameters"),f=r(e=>e?{"X-Media-Type":{description:"Type of media (image/video/audio)",schema:{enum:["image","video","audio"],type:"string"}},"X-Original-Format":{description:"Original file format",schema:{type:"string"}},"X-Transformed-Format":{description:"Transformed file format",schema:{type:"string"}}}:{},"getTransformationHeaders"),b=r(e=>e?{400:{content:{"application/json":{examples:{ValidationError:{value:{error:{code:"INVALID_PARAMS_FOR_IMAGE",details:{invalidParams:["codec","bitrate"],mediaType:"image",validParams:["format","quality","width","height","fit","position","withoutEnlargement","withoutReduction","kernel","fastShrinkOnLoad","left","top","cropWidth","cropHeight","angle","background","blur","sharpen","median","clahe","threshold","gamma","negate","normalise","flatten","unflatten","flip","flop","greyscale","modulate","brightness","saturation","hue","lightness","tint","colourspace","affine","dilate","erode","pipelineColourspace","toColourspace","removeAlpha","ensureAlpha"]},message:"Invalid query parameters for image transformation: codec, bitrate. Images support: format, quality, width, height, fit, position, withoutEnlargement, withoutReduction, kernel, fastShrinkOnLoad, left, top, cropWidth, cropHeight, angle, background, blur, sharpen, median, clahe, threshold, gamma, negate, normalise, flatten, unflatten, flip, flop, greyscale, modulate, brightness, saturation, hue, lightness, tint, colourspace, affine, dilate, erode, pipelineColourspace, toColourspace, removeAlpha, ensureAlpha. Video/audio parameters (codec, bitrate) are not supported for images.",name:"ValidationError"}}}},schema:{$ref:"#/components/schemas/ValidationError"}}},description:"Invalid transformation parameters"},413:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"File too large for transformation"},415:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Unsupported media type for transformation"}}:{},"getTransformationErrorResponses"),I=r((e,t,i,n)=>({description:"Get the uploaded file with optional media transformation support",operationId:e,parameters:[{in:"path",name:"id",required:!0,schema:{type:"string"}},...u(i,n)],responses:{200:{content:{"*/*":{schema:{description:i?"Transformed file content":"File content",format:"binary",type:"string"}}},description:i?"File retrieved and transformed successfully":"File retrieved successfully",headers:{"Content-Type":{description:`MIME type of the file${i?" (or transformed file)":""}`,schema:{type:"string"}},ETag:{description:`Upload ETag${i?" (or transformed file ETag)":""}`,schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},"Last-Modified":{description:"Upload last modified date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}},...f(i),"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},...b(i),404:{content:{"application/json":{example:{error:{code:"FileNotFound",message:"Not found"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Get the uploaded file",tags:t}),"sharedGet"),v=r((e,t)=>({description:"Get the uploaded file metadata",operationId:e,parameters:[{in:"path",name:"id",required:!0,schema:{type:"string"}}],responses:{200:{content:{"application/json":{schema:{$ref:"#/components/schemas/FileMeta"}}},description:"OK",headers:{"Last-Modified":{description:"Upload last modified date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},404:{content:{"application/json":{example:{error:{code:"FileNotFound",message:"File metadata not found"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Get the uploaded file metadata",tags:t}),"sharedGetMeta"),E={Error:{description:"Error",properties:{error:{properties:{code:{minLength:1,type:"string"},message:{minLength:1,type:"string"},name:{minLength:3,type:"string"}},required:["message"],type:"object"}},required:["error"],type:"object"},ValidationError:{description:"Validation error response",properties:{code:{enum:["INVALID_PARAMS_FOR_IMAGE","INVALID_PARAMS_FOR_VIDEO","INVALID_PARAMS_FOR_AUDIO","INVALID_FIT_VALUE","INVALID_ANGLE_VALUE","INVALID_FORMAT","INCOMPLETE_CROP_PARAMS","INVALID_VIDEO_CODEC","INVALID_VIDEO_FORMAT","INVALID_WIDTH","INVALID_HEIGHT","INVALID_BITRATE","INVALID_FRAME_RATE","INVALID_KEY_FRAME_INTERVAL","INVALID_AUDIO_CODEC","INVALID_AUDIO_FORMAT","INVALID_CHANNEL_COUNT","INVALID_SAMPLE_RATE"],type:"string"},details:{properties:{invalidParams:{items:{type:"string"},type:"array"},mediaType:{enum:["image","video","audio"],type:"string"},suggestions:{items:{type:"string"},type:"array"},validParams:{items:{type:"string"},type:"array"}},required:["invalidParams","validParams","mediaType"],type:"object"},message:{type:"string"},name:{enum:["ValidationError"],type:"string"}},required:["code","details","message","name"],type:"object"}},L={FileMeta:{description:"File meta",properties:{bytesWritten:{type:"integer"},contentType:{type:"string"},createdAt:{format:"date-time",type:"string"},id:{minLength:1,type:"string"},metadata:{type:"object"},name:{minLength:1,type:"string"},originalName:{minLength:1,type:"string"},status:{enum:["completed","part","deleted","created"],type:"string"}},type:"object"}},_={FileMeta:{value:[l]},FileMetaPagination:{value:{data:[l.value],meta:{firstPage:1,firstPageUrl:"/?page=1",lastPage:1,lastPageUrl:"/?page=10",nextPageUrl:"/?page=2",page:1,perPage:1,previousPageUrl:void 0,total:1}}}},F=r((e,t)=>({description:"List upload",operationId:e,parameters:[{description:"Maximum number of elements to retrieve.",in:"query",name:"limit",schema:{nullable:!0,type:"integer"}},{description:"Page number. Use only for pagination.",in:"query",name:"page",schema:{nullable:!0,type:"integer"}}],responses:{200:{content:{"application/json":{examples:{Default:{$ref:"#/components/examples/FileMeta"},Pagination:{$ref:"#/components/examples/FileMetaPagination"}},schema:{$ref:"#/components/schemas/FileMeta"}}},description:"OK"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"List upload",tags:t}),"sharedGetList");export{q as getOrganizedTransformationParameters,E as sharedErrorSchemaObject,_ as sharedFileMetaExampleObject,L as sharedFileMetaSchemaObject,I as sharedGet,F as sharedGetList,v as sharedGetMeta};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Z=Object.defineProperty;var y=(t,e)=>Z(t,"name",{value:e,configurable:!0});import{Readable as q}from"node:stream";import{setInterval as W}from"node:timers";import{inspect as X}from"node:util";import{L as H,O as j}from"./path-D7rMc9nq-B718mbm6.js";import J from"type-is";import Q from"./NoOpMetrics-Dky06sf1.js";import{N as ee}from"./cache-qV_5Umeq.js";import{ErrorMap as T,throwErrorCode as M,ERRORS as N}from"./ERRORS-B9jkvKwx.js";import{LRUCache as te}from"lru-cache";import{V as re}from"./validator-DK41xp8N.js";import{o as oe}from"./is-expired-1JuZjDtb.js";var se=Object.defineProperty,ae=y((t,e)=>se(t,"name",{value:e,configurable:!0}),"y$2"),ie=Object.defineProperty,ne=ae((t,e)=>ie(t,"name",{value:e,configurable:!0}),"y"),ce=Object.defineProperty,O=ne((t,e)=>ce(t,"name",{value:e,configurable:!0}),"i");const le=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,ue=/^KIBI/,me=/^MIBI/,ge=/^GIBI/,pe=/^TEBI/,he=/^PEBI/,de=/^EXBI/,fe=/^ZEBI/,ye=/^YIBI/,be=/^(.)IB$/,U={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},we=O((t,e)=>{const r=new Intl.NumberFormat(e).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),o=new Intl.NumberFormat(e).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(t.replaceAll(new RegExp(`\\${r}`,"g"),"").replace(new RegExp(`\\${o}`),"."))},"parseLocalizedNumber"),_=O(t=>{switch(t){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},"fromBase"),D=O((t,e)=>{const r={base:2,locale:"en-US",units:"metric",...e};if(typeof t!="string"||t.length===0)throw new TypeError("Value is not a string or is empty.");if(t.length>100)throw new TypeError("Value exceeds the maximum length of 100 characters.");const o=le.exec(t)?.groups;if(!o)return Number.NaN;const i=we(o.value,r.locale),a=(o.type??"Bytes").toUpperCase().replace(ue,"KILO").replace(me,"MEGA").replace(ge,"GIGA").replace(pe,"TERA").replace(he,"PETA").replace(de,"EXA").replace(fe,"ZETTA").replace(ye,"YOTTA").replace(be,"$1B"),n=U[r.units].findIndex(c=>c.short[0].toUpperCase()===a[0]),l=_(r.base);return i*l**n},"parseBytes");O((t,e)=>{if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("Bytesize is not a number.");const{base:r,decimals:o,locale:i,long:a,unit:n,units:l,...c}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...e},s=_(r),m=Math.abs(t),u=e?.space??!0?" ":"",g=U[l],p=g.findIndex(w=>w.short===n);if(t===0){const w=Math.min(0,Math.max(p,g.length-1));return"0"+u+g[w][a?"long":"short"]}const f=p===-1?Math.min(Math.floor(Math.log(m)/Math.log(s)),g.length-1):p,$=g[f][a?"long":"short"],x=t/s**f,v=o<0?void 0:o;return new Intl.NumberFormat(i,{maximumFractionDigits:v,minimumFractionDigits:v,...c}).format(x)+u+$},"formatBytes");var ve=Object.defineProperty,Ee=y((t,e)=>ve(t,"name",{value:e,configurable:!0}),"u$1"),$e=Object.defineProperty,xe=Ee((t,e)=>$e(t,"name",{value:e,configurable:!0}),"v"),Me=Object.defineProperty,Ne=xe((t,e)=>Me(t,"name",{value:e,configurable:!0}),"D");const Se=Ne((t,e,r,o,i,a,n,l,c,s,m,u,g,p)=>{const f={d:o,h:i,m:a,mo:e,ms:l,s:n,w:r,y:t};return c!==void 0&&(f.future=c),s!==void 0&&(f.past=s),m!==void 0&&(f.decimal=m),u!==void 0&&(f.unitMap=u),g!==void 0&&(f.groupSeparator=g),p!==void 0&&(f.placeholderSeparator=p),f},"createDurationLanguage"),k={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Be=Se(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",k,",","_");var Oe=Object.defineProperty,Te=y((t,e)=>Oe(t,"name",{value:e,configurable:!0}),"o$1"),Pe=Object.defineProperty,Ce=Te((t,e)=>Pe(t,"name",{value:e,configurable:!0}),"o"),Ae=Object.defineProperty,Ie=Ce((t,e)=>Ae(t,"name",{value:e,configurable:!0}),"o");const ze=Ie(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const o of e)if(!Object.hasOwn(t,o))throw new TypeError(`Missing required property: ${o}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const o of r)if(typeof t[o]!="string"&&typeof t[o]!="function")throw new TypeError(`Property ${o} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(o=>typeof o!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var De=Object.defineProperty,Fe=y((t,e)=>De(t,"name",{value:e,configurable:!0}),"w"),je=Object.defineProperty,Ue=Fe((t,e)=>je(t,"name",{value:e,configurable:!0}),"S"),_e=Object.defineProperty,ke=Ue((t,e)=>_e(t,"name",{value:e,configurable:!0}),"h");const F={d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},S=/[-/\\^$*+?.()|[\]{}]/g,Re=/^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/i,Le=/^(?:(\d+):)?(?:(\d+):)?(\d+)$/,Ge=/^[+-]?\d+(?:\.\d+)?$/,Ve=/^[-+]/,Ye=ke((t,e)=>{if(typeof t!="string"||t.length===0)return;const{defaultUnit:r="ms",language:o=Be}=e??{};ze(o);const i=o.decimal??".",a=o.groupSeparator??",",n=o.placeholderSeparator??"_",l=i.replaceAll(S,String.raw`\$&`),c=a.replaceAll(S,String.raw`\$&`),s=n.replaceAll(S,String.raw`\$&`),m=o.unitMap??k;let u=t.replaceAll(new RegExp(String.raw`(\d)[${s}${c}](\d)`,"g"),"$1$2");if(i!=="."&&(u=u.replace(l,".")),Ge.test(t)){const h=Number.parseFloat(u.trim());if(!Number.isNaN(h)){const d=m[r];if(d!==void 0)return h*F[d]}return}const g=Re.exec(t);if(g){const h=Number.parseInt(g[1]??"0",10),d=Number.parseInt(g[2]??"0",10),E=Number.parseInt(g[3]??"0",10);return h*36e5+d*6e4+E*1e3}const p=Le.exec(t);if(p){let h=0,d=0;p[2]!==void 0?(h=Number.parseInt(p[1]??"0",10),d=Number.parseInt(p[2],10)):p[1]!==void 0&&(d=Number.parseInt(p[1],10));const E=Number.parseInt(p[3]??"0",10);return h*36e5+d*6e4+E*1e3}const f=Object.keys(m).toSorted((h,d)=>d.length-h.length).map(h=>h.replaceAll(S,String.raw`\$&`)).join("|"),$=new RegExp(String.raw`(-?\d*\.?\d+)\s*(${f})`,"gi");let x=0,v,w=!1,C=-1,A=0;for($.lastIndex=0;(v=$.exec(u))!==null;){w||(C=v.index),w=!0;const h=v[1],d=v[2];if(!h||!d)continue;const E=h.trim(),V=E.startsWith("-")?-1:1,Y=E.replace(Ve,""),I=Number.parseFloat(Y),z=m[d.toLowerCase()];if(z===void 0)continue;const K=F[z];if(Number.isNaN(I))return;x+=V*I*K,A=$.lastIndex}const L=u.slice(0,C).trim(),G=u.slice(A).trim();if(!(w&&(L.length>0||G.length>0))&&w)return x},"parseDuration");var Ke=Object.defineProperty,Ze=y((t,e)=>Ke(t,"name",{value:e,configurable:!0}),"e");const B=Ze(t=>{if(t===Number(t))return t;if(!t)return;const e=Ye(t);if(e!==void 0)return e},"toMilliseconds");var qe=Object.defineProperty,We=y((t,e)=>qe(t,"name",{value:e,configurable:!0}),"r");class Xe extends te{static{y(this,"o")}static{We(this,"Locker")}constructor(e){super({ttl:1e3,ttlAutopurge:!0,...e})}lock(e){if(this.get(e))throw new Error(`${e} is locked`);return this.set(e,e),e}unlock(e){this.delete(e)}}var He=Object.defineProperty,P=y((t,e)=>He(t,"name",{value:e,configurable:!0}),"i");const Je=P(t=>{if(typeof t.name=="string")return t.name;if(typeof t.title=="string")return t.title;if(typeof t.originalName=="string")return t.originalName;if(typeof t.filename=="string")return t.filename},"extractOriginalName"),R=P((t,e)=>{const r={...t};return Object.keys(e).forEach(o=>{const i=e[o];if(i!==null&&typeof i=="object"&&!Array.isArray(i)){const a=r[o],n=a&&typeof a=="object"&&!Array.isArray(a)?a:{};r[o]=R(n,i)}else r[o]=i}),r},"deepMerge"),Qe=P((t,e)=>{const r=R(t,e);Object.assign(t,r),t.originalName=Je(t.metadata)||t.originalName},"updateMetadata");var et=Object.defineProperty,b=y((t,e)=>et(t,"name",{value:e,configurable:!0}),"g");const tt={allowMIME:["*/*"],filename:b(({id:t})=>t,"filename"),maxMetadataSize:"8MB",maxUploadSize:"5TB",onComplete:b(()=>{},"onComplete"),onCreate:b(()=>{},"onCreate"),onDelete:b(()=>{},"onDelete"),onError:b(()=>{},"onError"),onUpdate:b(()=>{},"onUpdate"),useRelativeLocation:!1,validation:{}},rt=b(t=>!t||t.length<3||t.length>255||j(t)?!1:!(t.toUpperCase().includes("../")||t.includes("\0")),"defaultCloudStorageFileNameValidation"),dt=b(t=>{if(!t||t.length<3||t.length>255||j(t))return!1;const e=t.toUpperCase();return!['"',"*",":","<",">","?","\\","|","../","\0"].some(r=>e.includes(r))},"defaultFilesystemFileNameValidation");class ft{static{y(this,"BaseStorage")}static{b(this,"BaseStorage")}onCreate;onUpdate;onComplete;onDelete;onError;isReady=!0;errorResponses={};cache;logger;metrics;genericConfig;maxMetadataSize;checksumTypes=[];maxUploadSize;expiration;locker;namingFunction;validation=new re;assetFolder=void 0;concurrency;constructor(e){const r={...tt,...e};this.onCreate=r.onCreate,this.onUpdate=r.onUpdate,this.onComplete=r.onComplete,this.onDelete=r.onDelete,this.onError=r.onError,this.namingFunction=r.filename,this.maxUploadSize=typeof r.maxUploadSize=="string"?D(r.maxUploadSize):r.maxUploadSize,this.maxMetadataSize=typeof r.maxMetadataSize=="string"?D(r.maxMetadataSize):r.maxMetadataSize,this.expiration=r.expiration,this.genericConfig=r,r.assetFolder!==void 0&&(this.assetFolder=H(r.assetFolder)),this.locker=new Xe({max:1e3,ttl:3e4,ttlAutopurge:!0}),this.cache=r.cache??new ee,this.logger=r.logger,this.metrics=r.metrics??new Q,this.logger?.debug(`${this.constructor.name} config: ${X({...e,logger:this.logger.constructor})}`);const o=B(r.expiration?.purgeInterval);o&&this.startAutoPurge(o);const i={isValid(c){if(c.size===void 0)return!0;const s=c.size;if(s==null)return!1;const m=typeof s=="number"?s:Number(s);if(Number.isNaN(m)||m<0)return!1;const u=typeof this.value=="number"?this.value:Number(this.value);return!Number.isNaN(u)&&m<=u},response:T.RequestEntityTooLarge,value:this.maxUploadSize},a={isValid(c){return!!J.is(c.contentType,this.value)},response:T.UnsupportedMediaType,value:r.allowMIME},n=r.fileNameValidation??rt,l={isValid(c){return n(c.name)},response:T.InvalidFileName};this.validation.add({filename:l,mime:a,size:i}),this.validation.add({...r.validation})}get tusExtension(){const e=["creation","creation-with-upload","termination","checksum","creation-defer-length","concatenation"];return this.expiration&&e.push("expiration"),e}async validate(e){await this.validation.verify(e)}async exists(e){return this.instrumentOperation("exists",async()=>{try{return await this.getMeta(e.id),!0}catch{return!1}})}normalizeError(e){const r={code:e.name,message:e.message,name:e.name,statusCode:500};return{...r,message:`[${this.constructor.name}] ${r.message}`}}get config(){return this.genericConfig}async saveMeta(e){return this.updateTimestamps(e),this.cache.set(e.id,e),this.meta.save(e.id,e)}async deleteMeta(e){return this.cache.delete(e),this.meta.delete(e)}async getMeta(e){try{const r=await this.meta.get(e);return this.cache.set(r.id,r),{...r}}catch(r){const o=this.normalizeError(r instanceof Error?r:new Error(String(r)));return await this.onError(o),M(N.FILE_NOT_FOUND)}}async checkIfExpired(e){return oe(e)?(this.delete(e).catch(()=>{}),this.deleteMeta(e.id).catch(()=>{}),M(N.GONE)):e}async purge(e){return this.instrumentOperation("purge",async()=>{const r=B(e||this.expiration?.maxAge),o={items:[],maxAgeMs:r};if(r){const i=Date.now()-r,a=(await this.list()).filter(n=>Number(new Date(this.expiration?.rolling&&n.modifiedAt||n.createdAt))<i);for await(const{id:n,...l}of a)try{const c=await this.delete({id:n});o.items.push({...c,...l})}catch(c){this.logger?.warn(`Failed to delete file ${n} during purge: ${c instanceof Error?c.message:String(c)}`)}o.items.length>0&&(this.logger?.info(`Purge: removed ${o.items.length} uploads`),this.metrics.gauge("storage.operations.purge.items_count",o.items.length,{storage:this.constructor.name.toLowerCase().replace("storage","")}))}return o})}async getStream({id:e}){return this.instrumentOperation("getStream",async()=>{const r=await this.get({id:e}),o=q.from(r.content);return{headers:{"Content-Length":String(r.size),"Content-Type":r.contentType,...r.ETag&&{ETag:r.ETag},...r.modifiedAt&&{"Last-Modified":r.modifiedAt.toString()}},size:typeof r.size=="number"?r.size:void 0,stream:o}})}async list(e=1e3){return this.instrumentOperation("list",async()=>{throw new Error("Not implemented")})}async update({id:e},r){return this.instrumentOperation("update",async()=>{const o=await this.getMeta(e),i={...r};if("ttl"in i&&i.ttl!==void 0){const n=i.ttl,l=typeof n=="string"?B(n):n;l!==void 0&&(i.expiredAt=Date.now()+l),delete i.ttl}Qe(o,i),await this.saveMeta(o);const a={...o,status:"updated"};return await this.onUpdate(a),a})}async deleteBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.delete.count",1,{batch_size:e.length,storage:o});const i=[],a=[],n=e.map(async s=>{try{return{file:await this.delete({id:s}),id:s,success:!0}}catch(m){const u=m instanceof Error?m.message:"Delete failed";return this.metrics.increment("storage.operations.delete.error.count",1,{error:u,storage:o}),{error:u,id:s,success:!1}}}),l=await Promise.allSettled(n);for(const s of l)s.status==="fulfilled"?s.value.success?i.push(s.value.file):a.push({error:s.value.error,id:s.value.id}):a.push({error:s.reason?.message||"Delete failed",id:""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.delete.duration",c,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.delete.success_count",i.length,{storage:o}),this.metrics.gauge("storage.operations.batch.delete.failed_count",a.length,{storage:o}),{failed:a,failedCount:a.length,successful:i,successfulCount:i.length}}async copyBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.copy.count",1,{batch_size:e.length,storage:o});const i=[],a=[],n=e.map(async({destination:s,options:m,source:u})=>{try{return{file:await this.copy(u,s,m),id:s,success:!0}}catch(g){const p=g instanceof Error?g.message:"Copy failed";return this.metrics.increment("storage.operations.copy.error.count",1,{error:p,storage:o}),{error:p,id:s,success:!1}}}),l=await Promise.allSettled(n);for(const s of l)s.status==="fulfilled"?s.value.success&&s.value.file?i.push(s.value.file):a.push({error:s.value.error||"Copy failed",id:s.value.id}):a.push({error:s.reason?.message||"Copy failed",id:""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.copy.duration",c,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.copy.success_count",i.length,{storage:o}),this.metrics.gauge("storage.operations.batch.copy.failed_count",a.length,{storage:o}),{failed:a,failedCount:a.length,successful:i,successfulCount:i.length}}async moveBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.move.count",1,{batch_size:e.length,storage:o});const i=[],a=[],n=e.map(async({destination:s,source:m})=>{try{return{file:await this.move(m,s),id:s,success:!0}}catch(u){const g=u instanceof Error?u.message:"Move failed";return this.metrics.increment("storage.operations.move.error.count",1,{error:g,storage:o}),{error:g,id:s,success:!1}}}),l=await Promise.allSettled(n);for(const s of l)s.status==="fulfilled"?s.value.success&&s.value.file?i.push(s.value.file):a.push({error:s.value.error||"Move failed",id:s.value.id}):a.push({error:s.reason?.message||"Move failed",id:s.reason?.id||""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.move.duration",c,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.move.success_count",i.length,{storage:o}),this.metrics.gauge("storage.operations.batch.move.failed_count",a.length,{storage:o}),{failed:a,failedCount:a.length,successful:i,successfulCount:i.length}}async lock(e){const r=[...this.locker.keys()];return r.includes(e)?M(N.FILE_LOCKED):this.config.concurrency&&typeof this.config.concurrency=="number"&&this.config.concurrency<r.length?M(N.STORAGE_BUSY):(this.locker.set(e,e),e)}async unlock(e){this.locker.unlock(e)}isUnsupportedChecksum(e=""){return!!e&&!this.checksumTypes.includes(e)}startAutoPurge(e){if(e>=2147483647)throw new Error("“purgeInterval” must be less than 2147483647 ms");W(()=>{this.purge().catch(r=>this.logger?.error(r))},e)}updateTimestamps(e){e.createdAt??=new Date().toISOString();const r=B(this.expiration?.maxAge);return r&&!e.expiredAt&&(e.expiredAt=this.expiration?.rolling?Date.now()+r:+new Date(e.createdAt)+r),e}async instrumentOperation(e,r,o){const i=Date.now(),a={storage:this.constructor.name.toLowerCase().replace("storage",""),...o};try{this.metrics.increment(`storage.operations.${e}.count`,1,a);const n=await r(),l=Date.now()-i;return this.metrics.timing(`storage.operations.${e}.duration`,l,a),n&&typeof n=="object"&&"size"in n&&typeof n.size=="number"&&this.metrics.gauge("storage.files.size",n.size,{...a,operation:e}),n}catch(n){const l=Date.now()-i,c=n instanceof Error?n.message:"Unknown error";throw this.metrics.timing(`storage.operations.${e}.duration`,l,{...a,error:"true"}),this.metrics.increment(`storage.operations.${e}.error.count`,1,{...a,error:c}),n}}}export{D as $,ft as B,dt as a,rt as d,B as t,Qe as u,Ye as z};
|