@visulima/storage 1.0.0-alpha.15 → 1.0.0-alpha.16
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 +11 -0
- package/LICENSE.md +1094 -382
- package/dist/adapter/nuxt/module.d.ts +41 -34
- package/dist/handler/http/fetch/index.d.ts +297 -4
- package/dist/handler/http/hono/index.d.ts +1474 -58
- package/dist/handler/http/nextjs/index.d.ts +66 -58
- package/dist/handler/http/node/index.d.ts +361 -4
- package/dist/handler/http/solid-start/index.d.ts +66 -57
- package/dist/index.d.ts +376 -17
- package/dist/openapi/index.d.ts +24 -5
- package/dist/packem_shared/{GCSMetaStorage-BkUIdJ5m.js → GCSMetaStorage-CNXq7vGd.js} +1 -1
- package/dist/packem_shared/{GCStorage-BnsSAjdW.js → GCStorage-CdnSuQwa.js} +1 -1
- package/dist/packem_shared/S3Client.d-CZ62Jztg.d.ts +20357 -0
- package/dist/packem_shared/disk-storage-with-checksum.d-hEoe2ugb.d.ts +148 -0
- package/dist/packem_shared/{gcs-meta-storage-DBeGn2ix.js → gcs-meta-storage-B5AVt1aS.js} +1 -1
- package/dist/packem_shared/local-meta-storage.d-Dop9RP9k.d.ts +20 -0
- package/dist/packem_shared/media-transformer.d-DeHZkBVx.d.ts +331 -0
- package/dist/packem_shared/s3-base-storage.d-CczjSe98.d.ts +251 -0
- package/dist/packem_shared/storage.d-BOMUJD96.d.ts +939 -0
- package/dist/packem_shared/tus-base.d-BftIixIA.d.ts +99 -0
- package/dist/packem_shared/types.d-BPd_JkW1.d.ts +708 -0
- package/dist/packem_shared/types.d-D-mlfmef.d.ts +49 -0
- package/dist/storage/aws/clients/index.d.ts +166 -6
- package/dist/storage/aws/index.d.ts +320 -4
- package/dist/storage/aws-light/index.d.ts +252 -4
- package/dist/storage/azure/index.d.ts +10422 -4
- package/dist/storage/gcs/index.d.ts +4107 -5
- package/dist/storage/gcs/index.js +2 -2
- package/dist/storage/local/index.d.ts +7 -4
- package/dist/storage/netlify-blob/index.d.ts +142 -4
- package/dist/storage/vercel-blob/index.d.ts +129 -4
- package/dist/transformer/audio-transformer.d.ts +127 -125
- package/dist/transformer/image-transformer.d.ts +569 -568
- package/dist/transformer/index.d.ts +62 -5
- package/dist/transformer/video-transformer.d.ts +144 -142
- package/package.json +37 -37
- 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/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 -118
- 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 -66
- package/dist/storage/aws-light/types.d.ts +0 -36
- 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 -61
- 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 -54
- 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 -27
- package/dist/storage/meta-storage-options.d.ts +0 -11
- 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 -6
- package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +0 -93
- package/dist/storage/netlify-blob/types.d.ts +0 -29
- package/dist/storage/storage.d.ts +0 -353
- package/dist/storage/types.d.ts +0 -217
- 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 -31
- package/dist/storage/vercel-blob/vercel-blob-file.d.ts +0 -16
- package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +0 -6
- 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/transformer-config.d.ts +0 -16
- package/dist/transformer/types.d.ts +0 -639
- 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
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenTelemetry Metrics implementation for storage operations.
|
|
3
|
-
*
|
|
4
|
-
* Provides counters, timers, and gauges using OpenTelemetry Metrics API.
|
|
5
|
-
* This allows integration with any OpenTelemetry-compatible observability backend
|
|
6
|
-
* (Prometheus, Datadog, New Relic, etc.).
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { metrics } from "@opentelemetry/api";
|
|
10
|
-
* import { OpenTelemetryMetrics } from "@visulima/storage/metrics";
|
|
11
|
-
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
12
|
-
*
|
|
13
|
-
* // Initialize OpenTelemetry (typically done once in your app)
|
|
14
|
-
* const meter = metrics.getMeter("@visulima/storage", "1.0.0");
|
|
15
|
-
*
|
|
16
|
-
* // Create metrics instance
|
|
17
|
-
* const storageMetrics = new OpenTelemetryMetrics(meter);
|
|
18
|
-
*
|
|
19
|
-
* // Use with storage
|
|
20
|
-
* const storage = new S3Storage({
|
|
21
|
-
* bucket: "my-bucket",
|
|
22
|
-
* metrics: storageMetrics,
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
import type { Meter } from "@opentelemetry/api";
|
|
27
|
-
import type { Metrics } from "../utils/types.d.ts";
|
|
28
|
-
/**
|
|
29
|
-
* OpenTelemetry-based metrics implementation.
|
|
30
|
-
*/
|
|
31
|
-
declare class OpenTelemetryMetrics implements Metrics {
|
|
32
|
-
private readonly meter;
|
|
33
|
-
private readonly counters;
|
|
34
|
-
private readonly histograms;
|
|
35
|
-
private readonly gauges;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a new OpenTelemetryMetrics instance.
|
|
38
|
-
* @param meter OpenTelemetry Meter instance. If not provided, uses the default meter.
|
|
39
|
-
* @throws {Error} If \@opentelemetry/api is not installed
|
|
40
|
-
*/
|
|
41
|
-
constructor(meter?: Meter);
|
|
42
|
-
/**
|
|
43
|
-
* Increment a counter metric.
|
|
44
|
-
*/
|
|
45
|
-
increment(name: string, value?: number, attributes?: Record<string, string | number>): void;
|
|
46
|
-
/**
|
|
47
|
-
* Record a duration/timing metric in milliseconds.
|
|
48
|
-
*/
|
|
49
|
-
timing(name: string, duration: number, attributes?: Record<string, string | number>): void;
|
|
50
|
-
/**
|
|
51
|
-
* Set a gauge metric value.
|
|
52
|
-
*/
|
|
53
|
-
gauge(name: string, value: number, attributes?: Record<string, string | number>): void;
|
|
54
|
-
}
|
|
55
|
-
export default OpenTelemetryMetrics;
|
package/dist/openapi/rest.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
declare const swaggerSpec: (origin: string, path: string, options: {
|
|
3
|
-
supportedTransformerFormat?: string[];
|
|
4
|
-
tags?: string[] | undefined;
|
|
5
|
-
transformer?: boolean | "audio" | "video" | "image";
|
|
6
|
-
}) => Partial<OpenAPIV3.Document>;
|
|
7
|
-
export default swaggerSpec;
|
package/dist/openapi/shared.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
type TransformType = boolean | "audio" | "video" | "image";
|
|
3
|
-
declare const getOrganizedTransformationParameters: (transform?: TransformType, format?: string[]) => {
|
|
4
|
-
groups: Record<string, string[]>;
|
|
5
|
-
parameters: OpenAPIV3.ParameterObject[];
|
|
6
|
-
};
|
|
7
|
-
export { getOrganizedTransformationParameters };
|
|
8
|
-
export declare const sharedGet: (operationId: string, tags: string[] | undefined, transform?: TransformType, transformerFormat?: string[]) => OpenAPIV3.OperationObject;
|
|
9
|
-
export declare const sharedGetMeta: (operationId: string, tags: string[] | undefined) => OpenAPIV3.OperationObject;
|
|
10
|
-
export declare const sharedErrorSchemaObject: Record<string, OpenAPIV3.NonArraySchemaObject>;
|
|
11
|
-
export declare const sharedFileMetaSchemaObject: Record<string, OpenAPIV3.NonArraySchemaObject>;
|
|
12
|
-
export declare const sharedFileMetaExampleObject: Record<string, OpenAPIV3.ExampleObject>;
|
|
13
|
-
export declare const sharedGetList: (operationId: string, tags: string[] | undefined) => OpenAPIV3.OperationObject;
|
package/dist/openapi/tus.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
declare const swaggerSpec: (path: string, options: {
|
|
3
|
-
supportedTransformerFormat?: string[];
|
|
4
|
-
tags?: string[] | undefined;
|
|
5
|
-
transformer?: boolean | "audio" | "video" | "image";
|
|
6
|
-
}) => Partial<OpenAPIV3.Document>;
|
|
7
|
-
export default swaggerSpec;
|
package/dist/openapi/xhr.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
declare const swaggerSpec: (origin: string, path: string, options: {
|
|
3
|
-
supportedTransformerFormat?: string[];
|
|
4
|
-
tags?: string[] | undefined;
|
|
5
|
-
transformer?: boolean | "audio" | "video" | "image";
|
|
6
|
-
}) => Partial<OpenAPIV3.Document>;
|
|
7
|
-
export default swaggerSpec;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
|
-
import type { CreateBackblazeClientParameters } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Create a Backblaze B2 client, compatible with the S3 API.
|
|
5
|
-
*
|
|
6
|
-
* Optionally, you can omit the parameters and use the following environment variables:
|
|
7
|
-
* - `B2_REGION`
|
|
8
|
-
* - `B2_APP_KEY_ID`
|
|
9
|
-
* - `B2_APP_KEY`
|
|
10
|
-
*/
|
|
11
|
-
export declare const backblaze: (parameters?: CreateBackblazeClientParameters) => S3ClientConfig;
|
|
12
|
-
export default backblaze;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
|
-
import type { CreateCloudflareClientParameters } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Create a Cloudflare R2 client, compatible with the S3 API.
|
|
5
|
-
*
|
|
6
|
-
* Optionally, you can omit the parameters and use the following environment variables:
|
|
7
|
-
* - `CLOUDFLARE_ACCOUNT_ID`
|
|
8
|
-
* - `AWS_ACCESS_KEY_ID`
|
|
9
|
-
* - `AWS_SECRET_ACCESS_KEY`
|
|
10
|
-
* - `CLOUDFLARE_JURISDICTION`
|
|
11
|
-
*/
|
|
12
|
-
export declare const cloudflare: (parameters?: CreateCloudflareClientParameters) => S3ClientConfig;
|
|
13
|
-
export default cloudflare;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
|
-
import type { CreateDigitalOceanClientParameters } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Create a DigitalOcean Spaces client, compatible with the S3 API.
|
|
5
|
-
*
|
|
6
|
-
* Optionally, you can omit the parameters and use the following environment variables:
|
|
7
|
-
* - `SPACES_REGION`
|
|
8
|
-
* - `SPACES_KEY`
|
|
9
|
-
* - `SPACES_SECRET`
|
|
10
|
-
*/
|
|
11
|
-
declare const digitalOcean: (parameters?: CreateDigitalOceanClientParameters) => S3ClientConfig;
|
|
12
|
-
export default digitalOcean;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
|
-
import type { CreateMinioClientParameters } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Create a Minio client, compatible with the S3 API.
|
|
5
|
-
*
|
|
6
|
-
* Optionally, you can omit the parameters and use the following environment variables:
|
|
7
|
-
* - `AWS_REGION`
|
|
8
|
-
* - `AWS_ACCESS_KEY_ID`
|
|
9
|
-
* - `AWS_SECRET_ACCESS_KEY`
|
|
10
|
-
* - `MINIO_ENDPOINT`
|
|
11
|
-
*/
|
|
12
|
-
declare const minio: (parameters?: CreateMinioClientParameters) => S3ClientConfig;
|
|
13
|
-
export default minio;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
|
-
import type { CreateTigrisClientParameters } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Create a Tigris client, compatible with the S3 API.
|
|
5
|
-
*
|
|
6
|
-
* Optionally, you can omit the parameters and use the following environment variables:
|
|
7
|
-
* - `AWS_ACCESS_KEY_ID`
|
|
8
|
-
* - `AWS_SECRET_ACCESS_KEY`
|
|
9
|
-
* - `TIGRIS_ENDPOINT`
|
|
10
|
-
*/
|
|
11
|
-
declare const tigris: (parameters?: CreateTigrisClientParameters) => S3ClientConfig;
|
|
12
|
-
export default tigris;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
export type CreateCloudflareClientParameters = {
|
|
2
|
-
/**
|
|
3
|
-
* Cloudflare R2 access key ID.
|
|
4
|
-
*/
|
|
5
|
-
accessKeyId: string;
|
|
6
|
-
/**
|
|
7
|
-
* Cloudflare account ID.
|
|
8
|
-
*/
|
|
9
|
-
accountId: string;
|
|
10
|
-
/**
|
|
11
|
-
* The jurisdiction where the data is stored.
|
|
12
|
-
*
|
|
13
|
-
* Only use this if you created your R2 bucket using a jurisdiction.
|
|
14
|
-
*/
|
|
15
|
-
jurisdiction?: "eu" | "fedramp";
|
|
16
|
-
/**
|
|
17
|
-
* Cloudflare R2 secret access key.
|
|
18
|
-
*/
|
|
19
|
-
secretAccessKey: string;
|
|
20
|
-
};
|
|
21
|
-
export type CreateMinioClientParameters = {
|
|
22
|
-
/**
|
|
23
|
-
* Minio access key ID.
|
|
24
|
-
*/
|
|
25
|
-
accessKeyId: string;
|
|
26
|
-
/**
|
|
27
|
-
* Minio endpoint.
|
|
28
|
-
*/
|
|
29
|
-
endpoint: string;
|
|
30
|
-
/**
|
|
31
|
-
* Minio region.
|
|
32
|
-
*/
|
|
33
|
-
region: string;
|
|
34
|
-
/**
|
|
35
|
-
* Minio secret access key.
|
|
36
|
-
*/
|
|
37
|
-
secretAccessKey: string;
|
|
38
|
-
};
|
|
39
|
-
export type CreateBackblazeClientParameters = {
|
|
40
|
-
/**
|
|
41
|
-
* Backblaze B2 application key.
|
|
42
|
-
*/
|
|
43
|
-
applicationKey: string;
|
|
44
|
-
/**
|
|
45
|
-
* Backblaze B2 application key ID.
|
|
46
|
-
*/
|
|
47
|
-
applicationKeyId: string;
|
|
48
|
-
/**
|
|
49
|
-
* Backblaze B2 region.
|
|
50
|
-
*/
|
|
51
|
-
region: string;
|
|
52
|
-
};
|
|
53
|
-
export type CreateWasabiClientParameters = {
|
|
54
|
-
/**
|
|
55
|
-
* Wasabi access key ID.
|
|
56
|
-
*/
|
|
57
|
-
accessKeyId: string;
|
|
58
|
-
/**
|
|
59
|
-
* Wasabi region.
|
|
60
|
-
*/
|
|
61
|
-
region: string;
|
|
62
|
-
/**
|
|
63
|
-
* Wasabi secret access key.
|
|
64
|
-
*/
|
|
65
|
-
secretAccessKey: string;
|
|
66
|
-
};
|
|
67
|
-
export type CreateDigitalOceanClientParameters = {
|
|
68
|
-
/**
|
|
69
|
-
* DigitalOcean Spaces key.
|
|
70
|
-
*/
|
|
71
|
-
key: string;
|
|
72
|
-
/**
|
|
73
|
-
* DigitalOcean Spaces region.
|
|
74
|
-
*/
|
|
75
|
-
region: string;
|
|
76
|
-
/**
|
|
77
|
-
* DigitalOcean Spaces secret.
|
|
78
|
-
*/
|
|
79
|
-
secret: string;
|
|
80
|
-
};
|
|
81
|
-
export type CreateTigrisClientParameters = {
|
|
82
|
-
/**
|
|
83
|
-
* Tigris access key ID.
|
|
84
|
-
*/
|
|
85
|
-
accessKeyId: string;
|
|
86
|
-
/**
|
|
87
|
-
* Tigris endpoint.
|
|
88
|
-
* @default `https://t3.storage.dev`
|
|
89
|
-
*/
|
|
90
|
-
endpoint?: string;
|
|
91
|
-
/**
|
|
92
|
-
* Tigris secret access key.
|
|
93
|
-
*/
|
|
94
|
-
secretAccessKey: string;
|
|
95
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
|
-
import type { CreateWasabiClientParameters } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Create a Wasabi client, compatible with the S3 API.
|
|
5
|
-
*
|
|
6
|
-
* Optionally, you can omit the parameters and use the following environment variables:
|
|
7
|
-
* - `WASABI_REGION`
|
|
8
|
-
* - `AWS_ACCESS_KEY_ID`
|
|
9
|
-
* - `AWS_SECRET_ACCESS_KEY`
|
|
10
|
-
*/
|
|
11
|
-
declare const wasabi: (parameters?: CreateWasabiClientParameters) => S3ClientConfig;
|
|
12
|
-
export default wasabi;
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { Readable } from "node:stream";
|
|
2
|
-
import type { RetryConfig } from "../../utils/retry.d.ts";
|
|
3
|
-
import { createRetryWrapper } from "../../utils/retry.d.ts";
|
|
4
|
-
import type MetaStorage from "../meta-storage.d.ts";
|
|
5
|
-
import { BaseStorage } from "../storage.d.ts";
|
|
6
|
-
import type { File, FileInit, FilePart, FileQuery, FileReturn } from "../utils/index.d.ts";
|
|
7
|
-
/**
|
|
8
|
-
* Part interface for multipart uploads.
|
|
9
|
-
*/
|
|
10
|
-
export interface Part {
|
|
11
|
-
ETag?: string;
|
|
12
|
-
PartNumber: number;
|
|
13
|
-
Size?: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Base file type for S3-compatible storage.
|
|
17
|
-
*/
|
|
18
|
-
export interface S3CompatibleFile extends File {
|
|
19
|
-
Parts?: Part[];
|
|
20
|
-
partSize?: number;
|
|
21
|
-
partsUrls?: string[];
|
|
22
|
-
UploadId?: string;
|
|
23
|
-
uri?: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* S3 API operations interface that must be implemented by concrete storage classes.
|
|
27
|
-
*/
|
|
28
|
-
export interface S3ApiOperations {
|
|
29
|
-
abortMultipartUpload: (params: {
|
|
30
|
-
Bucket: string;
|
|
31
|
-
Key: string;
|
|
32
|
-
UploadId: string;
|
|
33
|
-
}) => Promise<void>;
|
|
34
|
-
checkBucketAccess: (params: {
|
|
35
|
-
Bucket: string;
|
|
36
|
-
}) => Promise<void>;
|
|
37
|
-
completeMultipartUpload: (params: {
|
|
38
|
-
Bucket: string;
|
|
39
|
-
Key: string;
|
|
40
|
-
Parts: {
|
|
41
|
-
ETag: string;
|
|
42
|
-
PartNumber: number;
|
|
43
|
-
}[];
|
|
44
|
-
UploadId: string;
|
|
45
|
-
}) => Promise<{
|
|
46
|
-
ETag?: string;
|
|
47
|
-
Location: string;
|
|
48
|
-
}>;
|
|
49
|
-
copyObject: (params: {
|
|
50
|
-
Bucket: string;
|
|
51
|
-
CopySource: string;
|
|
52
|
-
Key: string;
|
|
53
|
-
StorageClass?: string;
|
|
54
|
-
}) => Promise<void>;
|
|
55
|
-
createMultipartUpload: (params: {
|
|
56
|
-
ACL?: string;
|
|
57
|
-
Bucket: string;
|
|
58
|
-
ContentType?: string;
|
|
59
|
-
Key: string;
|
|
60
|
-
Metadata?: Record<string, string>;
|
|
61
|
-
}) => Promise<{
|
|
62
|
-
UploadId: string;
|
|
63
|
-
}>;
|
|
64
|
-
deleteObject: (params: {
|
|
65
|
-
Bucket: string;
|
|
66
|
-
Key: string;
|
|
67
|
-
}) => Promise<void>;
|
|
68
|
-
getObject: (params: {
|
|
69
|
-
Bucket: string;
|
|
70
|
-
Key: string;
|
|
71
|
-
}) => Promise<{
|
|
72
|
-
Body?: ReadableStream | Readable;
|
|
73
|
-
ContentLength?: number;
|
|
74
|
-
ContentType?: string;
|
|
75
|
-
ETag?: string;
|
|
76
|
-
Expires?: Date;
|
|
77
|
-
LastModified?: Date;
|
|
78
|
-
Metadata?: Record<string, string>;
|
|
79
|
-
}>;
|
|
80
|
-
getPresignedUrl: (params: {
|
|
81
|
-
Bucket: string;
|
|
82
|
-
expiresIn: number;
|
|
83
|
-
Key: string;
|
|
84
|
-
PartNumber: number;
|
|
85
|
-
UploadId: string;
|
|
86
|
-
}) => Promise<string>;
|
|
87
|
-
headObject: (params: {
|
|
88
|
-
Bucket: string;
|
|
89
|
-
Key: string;
|
|
90
|
-
}) => Promise<{
|
|
91
|
-
ContentLength?: number;
|
|
92
|
-
ContentType?: string;
|
|
93
|
-
ETag?: string;
|
|
94
|
-
Expires?: Date;
|
|
95
|
-
LastModified?: Date;
|
|
96
|
-
Metadata?: Record<string, string>;
|
|
97
|
-
}>;
|
|
98
|
-
listObjectsV2: (params: {
|
|
99
|
-
Bucket: string;
|
|
100
|
-
ContinuationToken?: string;
|
|
101
|
-
MaxKeys?: number;
|
|
102
|
-
}) => Promise<{
|
|
103
|
-
Contents?: {
|
|
104
|
-
Key?: string;
|
|
105
|
-
LastModified?: Date;
|
|
106
|
-
}[];
|
|
107
|
-
IsTruncated?: boolean;
|
|
108
|
-
NextContinuationToken?: string;
|
|
109
|
-
}>;
|
|
110
|
-
listParts: (params: {
|
|
111
|
-
Bucket: string;
|
|
112
|
-
Key: string;
|
|
113
|
-
UploadId: string;
|
|
114
|
-
}) => Promise<{
|
|
115
|
-
Parts?: Part[];
|
|
116
|
-
}>;
|
|
117
|
-
uploadPart: (params: {
|
|
118
|
-
Body: Readable | ReadableStream | Uint8Array;
|
|
119
|
-
Bucket: string;
|
|
120
|
-
ContentLength?: number;
|
|
121
|
-
ContentMD5?: string;
|
|
122
|
-
Key: string;
|
|
123
|
-
PartNumber: number;
|
|
124
|
-
UploadId: string;
|
|
125
|
-
}) => Promise<{
|
|
126
|
-
ETag: string;
|
|
127
|
-
}>;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Base class for S3-compatible storage implementations.
|
|
131
|
-
* Contains all shared business logic for S3 operations.
|
|
132
|
-
* @template TFile The file type used by this storage backend.
|
|
133
|
-
*/
|
|
134
|
-
export declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3CompatibleFile> extends BaseStorage<TFile> {
|
|
135
|
-
checksumTypes: string[];
|
|
136
|
-
protected bucket: string;
|
|
137
|
-
protected meta: MetaStorage<TFile>;
|
|
138
|
-
/**
|
|
139
|
-
* S3 multipart upload does not allow more than 10000 parts.
|
|
140
|
-
*/
|
|
141
|
-
protected readonly MAX_PARTS = 10000;
|
|
142
|
-
protected readonly partSize: number;
|
|
143
|
-
protected readonly retry: ReturnType<typeof createRetryWrapper>;
|
|
144
|
-
/**
|
|
145
|
-
* Abstract method to get S3 API operations implementation.
|
|
146
|
-
*/
|
|
147
|
-
protected abstract getS3Api(): S3ApiOperations;
|
|
148
|
-
/**
|
|
149
|
-
* Abstract method to get the file class constructor.
|
|
150
|
-
*/
|
|
151
|
-
protected abstract getFileClass(): new (config: FileInit) => TFile;
|
|
152
|
-
/**
|
|
153
|
-
* Abstract method to get ACL value.
|
|
154
|
-
*/
|
|
155
|
-
protected abstract getAcl(): string | undefined;
|
|
156
|
-
/**
|
|
157
|
-
* Abstract method for access check.
|
|
158
|
-
*/
|
|
159
|
-
protected abstract accessCheck(maxWaitTime?: number): Promise<void>;
|
|
160
|
-
constructor(config: {
|
|
161
|
-
bucket: string;
|
|
162
|
-
clientDirectUpload?: boolean;
|
|
163
|
-
expiration?: {
|
|
164
|
-
maxAge?: string;
|
|
165
|
-
};
|
|
166
|
-
filename?: (file: TFile) => string;
|
|
167
|
-
logger?: BaseStorage<TFile>["logger"];
|
|
168
|
-
metaStorage?: MetaStorage<TFile>;
|
|
169
|
-
metaStorageConfig?: unknown;
|
|
170
|
-
partSize?: number | string;
|
|
171
|
-
retryConfig?: RetryConfig;
|
|
172
|
-
});
|
|
173
|
-
/**
|
|
174
|
-
* Creates a new S3 multipart upload.
|
|
175
|
-
*/
|
|
176
|
-
create(config: FileInit): Promise<TFile>;
|
|
177
|
-
/**
|
|
178
|
-
* Writes data to an S3 multipart upload.
|
|
179
|
-
*/
|
|
180
|
-
write(part: FilePart | FileQuery | TFile): Promise<TFile>;
|
|
181
|
-
/**
|
|
182
|
-
* Deletes an upload and its metadata.
|
|
183
|
-
*/
|
|
184
|
-
delete({ id }: FileQuery): Promise<TFile>;
|
|
185
|
-
/**
|
|
186
|
-
* Copies an upload file to a new location.
|
|
187
|
-
*/
|
|
188
|
-
copy(name: string, destination: string, options?: {
|
|
189
|
-
storageClass?: string;
|
|
190
|
-
}): Promise<TFile>;
|
|
191
|
-
/**
|
|
192
|
-
* Moves an upload file to a new location.
|
|
193
|
-
*/
|
|
194
|
-
move(name: string, destination: string): Promise<TFile>;
|
|
195
|
-
/**
|
|
196
|
-
* Lists files in the bucket.
|
|
197
|
-
*/
|
|
198
|
-
list(limit?: number): Promise<TFile[]>;
|
|
199
|
-
/**
|
|
200
|
-
* Checks if a file exists by verifying both metadata and the actual S3 object.
|
|
201
|
-
* Returns true only if both the metadata and the S3 object exist.
|
|
202
|
-
* @param query File query containing the file ID to check.
|
|
203
|
-
* @returns Promise resolving to true if both metadata and S3 object exist, false otherwise.
|
|
204
|
-
*/
|
|
205
|
-
exists({ id }: FileQuery): Promise<boolean>;
|
|
206
|
-
/**
|
|
207
|
-
* Gets an uploaded file by ID.
|
|
208
|
-
*/
|
|
209
|
-
get({ id }: FileQuery): Promise<FileReturn>;
|
|
210
|
-
/**
|
|
211
|
-
* Gets file stream (abstract - must be implemented by subclasses due to stream differences).
|
|
212
|
-
*/
|
|
213
|
-
abstract getStream(query: FileQuery): Promise<{
|
|
214
|
-
headers?: Record<string, string>;
|
|
215
|
-
size?: number;
|
|
216
|
-
stream: Readable;
|
|
217
|
-
}>;
|
|
218
|
-
/**
|
|
219
|
-
* Builds presigned URLs for client uploads.
|
|
220
|
-
*/
|
|
221
|
-
protected buildPresigned(file: TFile): Promise<TFile>;
|
|
222
|
-
/**
|
|
223
|
-
* Gets presigned URLs for all parts.
|
|
224
|
-
*/
|
|
225
|
-
protected getPartsPresignedUrls(file: TFile): Promise<string[]>;
|
|
226
|
-
/**
|
|
227
|
-
* Gets parts for a multipart upload.
|
|
228
|
-
*/
|
|
229
|
-
protected getParts(file: TFile): Promise<Part[]>;
|
|
230
|
-
/**
|
|
231
|
-
* Completes a multipart upload.
|
|
232
|
-
*/
|
|
233
|
-
protected completeMultipartUpload(file: TFile): Promise<{
|
|
234
|
-
ETag?: string;
|
|
235
|
-
Location: string;
|
|
236
|
-
}>;
|
|
237
|
-
/**
|
|
238
|
-
* Aborts a multipart upload.
|
|
239
|
-
*/
|
|
240
|
-
protected abortMultipartUpload(file: TFile): Promise<void>;
|
|
241
|
-
/**
|
|
242
|
-
* Internal onComplete handler.
|
|
243
|
-
*/
|
|
244
|
-
protected internalOnComplete: (file: TFile) => Promise<[{
|
|
245
|
-
ETag?: string;
|
|
246
|
-
Location: string;
|
|
247
|
-
}, TFile]>;
|
|
248
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Readable } from "node:stream";
|
|
2
|
-
import type { S3Client } from "@aws-sdk/client-s3";
|
|
3
|
-
import type { Part, S3ApiOperations } from "./s3-base-storage.d.ts";
|
|
4
|
-
type ReadableStream = globalThis.ReadableStream;
|
|
5
|
-
/**
|
|
6
|
-
* Adapter that wraps AWS SDK S3Client to implement S3ApiOperations interface.
|
|
7
|
-
*/
|
|
8
|
-
declare class S3ClientAdapter implements S3ApiOperations {
|
|
9
|
-
private readonly client;
|
|
10
|
-
constructor(client: S3Client, _bucket: string);
|
|
11
|
-
createMultipartUpload(params: {
|
|
12
|
-
ACL?: string;
|
|
13
|
-
Bucket: string;
|
|
14
|
-
ContentType?: string;
|
|
15
|
-
Key: string;
|
|
16
|
-
Metadata?: Record<string, string>;
|
|
17
|
-
}): Promise<{
|
|
18
|
-
UploadId: string;
|
|
19
|
-
}>;
|
|
20
|
-
uploadPart(params: {
|
|
21
|
-
Body: Readable | ReadableStream | Uint8Array;
|
|
22
|
-
Bucket: string;
|
|
23
|
-
ContentLength?: number;
|
|
24
|
-
ContentMD5?: string;
|
|
25
|
-
Key: string;
|
|
26
|
-
PartNumber: number;
|
|
27
|
-
UploadId: string;
|
|
28
|
-
}): Promise<{
|
|
29
|
-
ETag: string;
|
|
30
|
-
}>;
|
|
31
|
-
completeMultipartUpload(params: {
|
|
32
|
-
Bucket: string;
|
|
33
|
-
Key: string;
|
|
34
|
-
Parts: {
|
|
35
|
-
ETag: string;
|
|
36
|
-
PartNumber: number;
|
|
37
|
-
}[];
|
|
38
|
-
UploadId: string;
|
|
39
|
-
}): Promise<{
|
|
40
|
-
ETag?: string;
|
|
41
|
-
Location: string;
|
|
42
|
-
}>;
|
|
43
|
-
abortMultipartUpload(params: {
|
|
44
|
-
Bucket: string;
|
|
45
|
-
Key: string;
|
|
46
|
-
UploadId: string;
|
|
47
|
-
}): Promise<void>;
|
|
48
|
-
listParts(params: {
|
|
49
|
-
Bucket: string;
|
|
50
|
-
Key: string;
|
|
51
|
-
UploadId: string;
|
|
52
|
-
}): Promise<{
|
|
53
|
-
Parts?: Part[];
|
|
54
|
-
}>;
|
|
55
|
-
getObject(params: {
|
|
56
|
-
Bucket: string;
|
|
57
|
-
Key: string;
|
|
58
|
-
}): Promise<{
|
|
59
|
-
Body?: ReadableStream | Readable;
|
|
60
|
-
ContentLength?: number;
|
|
61
|
-
ContentType?: string;
|
|
62
|
-
ETag?: string;
|
|
63
|
-
Expires?: Date;
|
|
64
|
-
LastModified?: Date;
|
|
65
|
-
Metadata?: Record<string, string>;
|
|
66
|
-
}>;
|
|
67
|
-
headObject(params: {
|
|
68
|
-
Bucket: string;
|
|
69
|
-
Key: string;
|
|
70
|
-
}): Promise<{
|
|
71
|
-
ContentLength?: number;
|
|
72
|
-
ContentType?: string;
|
|
73
|
-
ETag?: string;
|
|
74
|
-
Expires?: Date;
|
|
75
|
-
LastModified?: Date;
|
|
76
|
-
}>;
|
|
77
|
-
deleteObject(params: {
|
|
78
|
-
Bucket: string;
|
|
79
|
-
Key: string;
|
|
80
|
-
}): Promise<void>;
|
|
81
|
-
copyObject(params: {
|
|
82
|
-
Bucket: string;
|
|
83
|
-
CopySource: string;
|
|
84
|
-
Key: string;
|
|
85
|
-
StorageClass?: string;
|
|
86
|
-
}): Promise<void>;
|
|
87
|
-
listObjectsV2(params: {
|
|
88
|
-
Bucket: string;
|
|
89
|
-
ContinuationToken?: string;
|
|
90
|
-
MaxKeys?: number;
|
|
91
|
-
}): Promise<{
|
|
92
|
-
Contents?: {
|
|
93
|
-
Key?: string;
|
|
94
|
-
LastModified?: Date;
|
|
95
|
-
}[];
|
|
96
|
-
IsTruncated?: boolean;
|
|
97
|
-
NextContinuationToken?: string;
|
|
98
|
-
}>;
|
|
99
|
-
getPresignedUrl(params: {
|
|
100
|
-
Bucket: string;
|
|
101
|
-
expiresIn: number;
|
|
102
|
-
Key: string;
|
|
103
|
-
PartNumber: number;
|
|
104
|
-
UploadId: string;
|
|
105
|
-
}): Promise<string>;
|
|
106
|
-
checkBucketAccess(params: {
|
|
107
|
-
Bucket: string;
|
|
108
|
-
}): Promise<void>;
|
|
109
|
-
}
|
|
110
|
-
export default S3ClientAdapter;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { File } from "../utils/index.d.ts";
|
|
2
|
-
import type { Part } from "./s3-base-storage.d.ts";
|
|
3
|
-
declare class S3File extends File {
|
|
4
|
-
Parts?: Part[];
|
|
5
|
-
UploadId?: string;
|
|
6
|
-
uri?: string;
|
|
7
|
-
partsUrls?: string[];
|
|
8
|
-
partSize?: number;
|
|
9
|
-
}
|
|
10
|
-
export default S3File;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import MetaStorage from "../meta-storage.d.ts";
|
|
2
|
-
import type { File } from "../utils/index.d.ts";
|
|
3
|
-
import type { S3MetaStorageOptions } from "./types.d.ts";
|
|
4
|
-
declare class S3MetaStorage<T extends File = File> extends MetaStorage<T> {
|
|
5
|
-
config: S3MetaStorageOptions;
|
|
6
|
-
private readonly bucket;
|
|
7
|
-
private readonly client;
|
|
8
|
-
constructor(config: S3MetaStorageOptions);
|
|
9
|
-
get(id: string): Promise<T>;
|
|
10
|
-
touch(id: string, file: T): Promise<T>;
|
|
11
|
-
delete(id: string): Promise<void>;
|
|
12
|
-
save(id: string, file: T): Promise<T>;
|
|
13
|
-
private accessCheck;
|
|
14
|
-
}
|
|
15
|
-
export default S3MetaStorage;
|