@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,4 +1,4 @@
|
|
|
1
1
|
export { default as GCSConfig } from '../../packem_shared/GCSConfig-vPP22kN6.js';
|
|
2
2
|
export { default as GCSFile } from '../../packem_shared/GCSFile-DaDiCKE2.js';
|
|
3
|
-
export { G as GCSMetaStorage } from '../../packem_shared/gcs-meta-storage-
|
|
4
|
-
export { default as GCStorage } from '../../packem_shared/GCStorage-
|
|
3
|
+
export { G as GCSMetaStorage } from '../../packem_shared/gcs-meta-storage-B5AVt1aS.js';
|
|
4
|
+
export { default as GCStorage } from '../../packem_shared/GCStorage-CdnSuQwa.js';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export type
|
|
4
|
-
|
|
1
|
+
export { D as DiskStorage, a as DiskStorageWithChecksum } from "../../packem_shared/disk-storage-with-checksum.d-hEoe2ugb.js";
|
|
2
|
+
export { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-Dop9RP9k.js";
|
|
3
|
+
export { type L as LocalMetaStorageOptions } from "../../packem_shared/storage.d-BOMUJD96.js";
|
|
4
|
+
import 'node:stream';
|
|
5
|
+
import 'node:crypto';
|
|
6
|
+
import 'node:http';
|
|
7
|
+
import 'lru-cache';
|
|
@@ -1,4 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, k as BaseStorageOptions, M as MetaStorage, b as FileInit, d as FilePart, e as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BOMUJD96.js";
|
|
2
|
+
import 'node:stream';
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-Dop9RP9k.js";
|
|
4
|
+
import 'node:crypto';
|
|
5
|
+
import 'node:http';
|
|
6
|
+
import 'lru-cache';
|
|
7
|
+
declare class NetlifyBlobFile extends File {
|
|
8
|
+
/**
|
|
9
|
+
* The blob's public URL
|
|
10
|
+
*/
|
|
11
|
+
url?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The blob's pathname within the store
|
|
14
|
+
*/
|
|
15
|
+
pathname?: string;
|
|
16
|
+
}
|
|
17
|
+
declare class NetlifyBlobMetaStorage extends LocalMetaStorage {
|
|
18
|
+
constructor(config?: LocalMetaStorageOptions);
|
|
19
|
+
}
|
|
20
|
+
interface NetlifyBlobStorageOptions extends BaseStorageOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Configure metafiles storage
|
|
23
|
+
* @example
|
|
24
|
+
* Using local metafiles
|
|
25
|
+
* ```ts
|
|
26
|
+
* const storage = new NetlifyBlobStorage({
|
|
27
|
+
* storeName: 'uploads',
|
|
28
|
+
* metaStorageConfig: { directory: '/tmp/upload-metafiles' }
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
metaStorageConfig?: LocalMetaStorageOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Netlify site ID (optional, used for explicit store access)
|
|
35
|
+
*/
|
|
36
|
+
siteID?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Netlify Blob store name
|
|
39
|
+
* @default 'default'
|
|
40
|
+
*/
|
|
41
|
+
storeName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Netlify API token (optional, can use environment variable NETLIFY_TOKEN)
|
|
44
|
+
*/
|
|
45
|
+
token?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Netlify Blob storage based backend.
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const storage = new NetlifyBlobStorage({
|
|
52
|
+
* storeName: 'uploads',
|
|
53
|
+
* metaStorageConfig: { directory: '/tmp/upload-metafiles' }
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
* @remarks
|
|
57
|
+
* ## Supported Operations
|
|
58
|
+
* - ✅ create, write, delete, get, list, copy, move
|
|
59
|
+
* - ✅ Batch operations: deleteBatch, copyBatch, moveBatch (inherited from BaseStorage)
|
|
60
|
+
* - ✅ exists: Implemented (checks metadata and Netlify Blob)
|
|
61
|
+
* - ✅ update: Implemented (updates metadata file, Netlify Blob API doesn't support blob metadata updates)
|
|
62
|
+
* - ❌ getStream: Not implemented (use get() for file retrieval)
|
|
63
|
+
* - ❌ getUrl: Not implemented (Netlify Blob URLs available via Netlify Blob API)
|
|
64
|
+
* - ❌ getUploadUrl: Not implemented (Netlify Blob upload URLs handled internally)
|
|
65
|
+
*/
|
|
66
|
+
declare class NetlifyBlobStorage extends BaseStorage<NetlifyBlobFile> {
|
|
67
|
+
static override readonly name: string;
|
|
68
|
+
override checksumTypes: string[];
|
|
69
|
+
protected meta: MetaStorage;
|
|
70
|
+
private readonly storeName;
|
|
71
|
+
private readonly siteID?;
|
|
72
|
+
private readonly token?;
|
|
73
|
+
private store;
|
|
74
|
+
private readonly retry;
|
|
75
|
+
constructor(config: NetlifyBlobStorageOptions);
|
|
76
|
+
create(config: FileInit): Promise<NetlifyBlobFile>;
|
|
77
|
+
write(part: FilePart | FileQuery | NetlifyBlobFile): Promise<NetlifyBlobFile>;
|
|
78
|
+
/**
|
|
79
|
+
* Deletes an upload and its metadata.
|
|
80
|
+
* @param query File query containing the file ID to delete.
|
|
81
|
+
* @param query.id File ID to delete.
|
|
82
|
+
* @returns Promise resolving to the deleted file object with status: "deleted".
|
|
83
|
+
* @throws {UploadError} If the file metadata cannot be found.
|
|
84
|
+
*/
|
|
85
|
+
delete({
|
|
86
|
+
id
|
|
87
|
+
}: FileQuery): Promise<NetlifyBlobFile>;
|
|
88
|
+
/**
|
|
89
|
+
* Checks if a file exists by verifying both metadata and the actual Netlify Blob.
|
|
90
|
+
* Returns true only if both the metadata and the blob exist.
|
|
91
|
+
* @param query File query containing the file ID to check.
|
|
92
|
+
* @returns Promise resolving to true if both metadata and blob exist, false otherwise.
|
|
93
|
+
*/
|
|
94
|
+
override exists({
|
|
95
|
+
id
|
|
96
|
+
}: FileQuery): Promise<boolean>;
|
|
97
|
+
get({
|
|
98
|
+
id
|
|
99
|
+
}: FileQuery): Promise<FileReturn>;
|
|
100
|
+
/**
|
|
101
|
+
* Copies an upload file to a new location.
|
|
102
|
+
* @param name Source file name/ID.
|
|
103
|
+
* @param destination Destination file name/ID.
|
|
104
|
+
* @returns Promise resolving to the copied file object.
|
|
105
|
+
* @throws {UploadError} If the source file cannot be found.
|
|
106
|
+
*/
|
|
107
|
+
copy(name: string, destination: string): Promise<NetlifyBlobFile>;
|
|
108
|
+
/**
|
|
109
|
+
* Moves an upload file to a new location.
|
|
110
|
+
* @param name Source file name/ID.
|
|
111
|
+
* @param destination Destination file name/ID.
|
|
112
|
+
* @returns Promise resolving to the moved file object.
|
|
113
|
+
* @throws {UploadError} If the source file cannot be found.
|
|
114
|
+
*/
|
|
115
|
+
move(name: string, destination: string): Promise<NetlifyBlobFile>;
|
|
116
|
+
/**
|
|
117
|
+
* Updates file metadata with user-provided key-value pairs.
|
|
118
|
+
* Updates the metadata file (overwrites it) but does not update Netlify Blob metadata
|
|
119
|
+
* since the Netlify Blob API doesn't support metadata updates.
|
|
120
|
+
* @param query File query containing the file ID to update.
|
|
121
|
+
* @param query.id File ID to update.
|
|
122
|
+
* @param metadata Partial file object containing fields to update.
|
|
123
|
+
* @returns Promise resolving to the updated file object.
|
|
124
|
+
* @throws {UploadError} If the file cannot be found (ERRORS.FILE_NOT_FOUND).
|
|
125
|
+
* @remarks
|
|
126
|
+
* Supports TTL (time-to-live) option: if metadata contains a 'ttl' field,
|
|
127
|
+
* it will be converted to an 'expiredAt' timestamp.
|
|
128
|
+
* TTL can be a number (milliseconds) or string (e.g., "1h", "30m", "7d").
|
|
129
|
+
*/
|
|
130
|
+
override update({
|
|
131
|
+
id
|
|
132
|
+
}: FileQuery, metadata: Partial<NetlifyBlobFile>): Promise<NetlifyBlobFile>;
|
|
133
|
+
override list(limit?: number): Promise<NetlifyBlobFile[]>;
|
|
134
|
+
private internalOnComplete;
|
|
135
|
+
/**
|
|
136
|
+
* Generate a URL for a blob in Netlify Blob store
|
|
137
|
+
* Note: Netlify Blob doesn't provide direct public URLs like Vercel Blob
|
|
138
|
+
* In production, you would typically serve these through Netlify Functions or Edge Functions
|
|
139
|
+
*/
|
|
140
|
+
private getBlobUrl;
|
|
141
|
+
}
|
|
142
|
+
export { NetlifyBlobFile, NetlifyBlobMetaStorage, NetlifyBlobStorage, type NetlifyBlobStorageOptions };
|
|
@@ -1,4 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { L as LocalMetaStorageOptions, k as BaseStorageOptions, F as File, M as MetaStorage, b as FileInit, d as FilePart, e as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BOMUJD96.js";
|
|
2
|
+
import 'node:stream';
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-Dop9RP9k.js";
|
|
4
|
+
import 'node:crypto';
|
|
5
|
+
import 'node:http';
|
|
6
|
+
import 'lru-cache';
|
|
7
|
+
interface VercelBlobStorageOptions extends BaseStorageOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Configure metafiles storage
|
|
10
|
+
* @example
|
|
11
|
+
* Using local metafiles
|
|
12
|
+
* ```ts
|
|
13
|
+
* const storage = new VercelBlobStorage({
|
|
14
|
+
* token: process.env.BLOB_READ_WRITE_TOKEN,
|
|
15
|
+
* metaStorageConfig: { directory: '/tmp/upload-metafiles' }
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
metaStorageConfig?: LocalMetaStorageOptions;
|
|
20
|
+
/**
|
|
21
|
+
* Enable multipart uploads for large files
|
|
22
|
+
* Can be a boolean to always use multipart, or a number (in bytes) as threshold
|
|
23
|
+
* @default false
|
|
24
|
+
* @example
|
|
25
|
+
* // Always use multipart uploads
|
|
26
|
+
* multipart: true
|
|
27
|
+
* // Use multipart for files larger than 100MB
|
|
28
|
+
* multipart: 100 * 1024 * 1024
|
|
29
|
+
*/
|
|
30
|
+
multipart?: boolean | number;
|
|
31
|
+
/**
|
|
32
|
+
* Vercel Blob read-write token
|
|
33
|
+
*/
|
|
34
|
+
token?: string;
|
|
35
|
+
}
|
|
36
|
+
declare class VercelBlobFile extends File {
|
|
37
|
+
/**
|
|
38
|
+
* The blob's public URL
|
|
39
|
+
*/
|
|
40
|
+
url?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The blob's download URL (may be different from url for private blobs)
|
|
43
|
+
*/
|
|
44
|
+
downloadUrl?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The blob's pathname within the store
|
|
47
|
+
*/
|
|
48
|
+
pathname?: string;
|
|
49
|
+
}
|
|
50
|
+
declare class VercelBlobMetaStorage extends LocalMetaStorage {
|
|
51
|
+
constructor(config?: LocalMetaStorageOptions);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Vercel Blob storage based backend.
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const storage = new VercelBlobStorage({
|
|
58
|
+
* token: process.env.BLOB_READ_WRITE_TOKEN,
|
|
59
|
+
* metaStorageConfig: { directory: '/tmp/upload-metafiles' }
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
* @remarks
|
|
63
|
+
* ## Supported Operations
|
|
64
|
+
* - ✅ create, write, delete, get, copy, move
|
|
65
|
+
* - ✅ Batch operations: deleteBatch, copyBatch, moveBatch (inherited from BaseStorage)
|
|
66
|
+
* - ✅ exists: Implemented (checks metadata and Vercel Blob)
|
|
67
|
+
* - ❌ getStream: Not implemented (use get() for file retrieval)
|
|
68
|
+
* - ❌ list: Not implemented (Vercel Blob API doesn't support listing)
|
|
69
|
+
* - ❌ update: Not implemented (Vercel Blob API doesn't support metadata updates)
|
|
70
|
+
* - ❌ getUrl: Not implemented (Vercel Blob URLs available via Vercel Blob API)
|
|
71
|
+
* - ❌ getUploadUrl: Not implemented (Vercel Blob upload URLs handled internally)
|
|
72
|
+
*/
|
|
73
|
+
declare class VercelBlobStorage extends BaseStorage<VercelBlobFile> {
|
|
74
|
+
static override readonly name: string;
|
|
75
|
+
override checksumTypes: string[];
|
|
76
|
+
protected meta: MetaStorage;
|
|
77
|
+
private readonly token;
|
|
78
|
+
private readonly multipart;
|
|
79
|
+
constructor(config: VercelBlobStorageOptions);
|
|
80
|
+
create(config: FileInit): Promise<VercelBlobFile>;
|
|
81
|
+
write(part: FilePart | FileQuery | VercelBlobFile): Promise<VercelBlobFile>;
|
|
82
|
+
/**
|
|
83
|
+
* Deletes an upload and its metadata.
|
|
84
|
+
* @param query File query containing the file ID to delete.
|
|
85
|
+
* @param query.id File ID to delete.
|
|
86
|
+
* @returns Promise resolving to the deleted file object with status: "deleted".
|
|
87
|
+
* @throws {UploadError} If the file metadata cannot be found.
|
|
88
|
+
*/
|
|
89
|
+
delete({
|
|
90
|
+
id
|
|
91
|
+
}: FileQuery): Promise<VercelBlobFile>;
|
|
92
|
+
/**
|
|
93
|
+
* Checks if a file exists by verifying both metadata and the actual Vercel Blob.
|
|
94
|
+
* Returns true only if both the metadata and the blob exist.
|
|
95
|
+
* @param query File query containing the file ID to check.
|
|
96
|
+
* @returns Promise resolving to true if both metadata and blob exist, false otherwise.
|
|
97
|
+
*/
|
|
98
|
+
override exists({
|
|
99
|
+
id
|
|
100
|
+
}: FileQuery): Promise<boolean>;
|
|
101
|
+
get({
|
|
102
|
+
id
|
|
103
|
+
}: FileQuery): Promise<FileReturn>;
|
|
104
|
+
/**
|
|
105
|
+
* Copies an upload file to a new location.
|
|
106
|
+
* @param name Source file name/ID.
|
|
107
|
+
* @param destination Destination file name/ID.
|
|
108
|
+
* @returns Promise resolving to the copied file object.
|
|
109
|
+
* @throws {UploadError} If the source file cannot be found.
|
|
110
|
+
*/
|
|
111
|
+
copy(name: string, destination: string): Promise<VercelBlobFile>;
|
|
112
|
+
/**
|
|
113
|
+
* Moves an upload file to a new location.
|
|
114
|
+
* @param name Source file name/ID.
|
|
115
|
+
* @param destination Destination file name/ID.
|
|
116
|
+
* @returns Promise resolving to the moved file object.
|
|
117
|
+
* @throws {UploadError} If the source file cannot be found.
|
|
118
|
+
*/
|
|
119
|
+
move(name: string, destination: string): Promise<VercelBlobFile>;
|
|
120
|
+
override list(limit?: number): Promise<VercelBlobFile[]>;
|
|
121
|
+
private internalOnComplete;
|
|
122
|
+
/**
|
|
123
|
+
* Determines if multipart upload should be used for the given file.
|
|
124
|
+
* @param file File object to check.
|
|
125
|
+
* @returns True if multipart upload should be used, false otherwise.
|
|
126
|
+
*/
|
|
127
|
+
private shouldUseMultipart;
|
|
128
|
+
}
|
|
129
|
+
export { VercelBlobFile, VercelBlobMetaStorage, VercelBlobStorage, type VercelBlobStorageOptions };
|
|
@@ -1,128 +1,130 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-BOMUJD96.js";
|
|
2
|
+
import { A as AudioTransformerConfig, a as AudioTransformResult, b as AudioResampleOptions, c as AudioChannelMixOptions, d as AudioTransformOptions, e as AudioTransformationStep, B as BaseTransformer } from "../packem_shared/types.d-BPd_JkW1.js";
|
|
3
|
+
import 'node:stream';
|
|
4
|
+
import 'node:crypto';
|
|
5
|
+
import 'node:http';
|
|
6
|
+
import 'lru-cache';
|
|
5
7
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
8
|
+
* Audio transformer that uses storage backends and Mediabunny to retrieve and transform audio files
|
|
9
|
+
*
|
|
10
|
+
* Supports audio transformations with query parameters for on-demand audio processing.
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const transformer = new AudioTransformer(storage, {
|
|
14
|
+
* maxAudioSize: 50 * 1024 * 1024, // 50MB
|
|
15
|
+
* cache: new Map()
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // Programmatic usage - resample audio
|
|
19
|
+
* const result = await transformer.resample('audio-id', {
|
|
20
|
+
* sampleRate: 44100
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // URL-based transformations
|
|
24
|
+
* // GET /files/audio-id?sampleRate=48000&codec=aac&bitrate=128000
|
|
25
|
+
* // GET /files/audio-id?numberOfChannels=1&format=mp3
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* ## Supported Query Parameters
|
|
29
|
+
*
|
|
30
|
+
* - `sampleRate`: Sample rate in Hz (Number)
|
|
31
|
+
* - `numberOfChannels`: Number of channels (Number)
|
|
32
|
+
* - `codec`: Audio codec - aac/opus/mp3/vorbis/flac
|
|
33
|
+
* - `bitrate`: Audio bitrate in bits per second (Number)
|
|
34
|
+
* - `format`: Output format - mp3/wav/ogg/aac/flac
|
|
35
|
+
*/
|
|
34
36
|
declare class AudioTransformer<TFile extends File = File, TFileReturn extends FileReturn = FileReturn> extends BaseTransformer<AudioTransformerConfig, AudioTransformResult<TFileReturn>, TFile, TFileReturn> {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new AudioTransformer instance.
|
|
39
|
+
* @param storage The storage backend for retrieving and storing audio files.
|
|
40
|
+
* @param config Configuration options for audio transformation including cache settings, codec defaults, and size limits.
|
|
41
|
+
*/
|
|
42
|
+
constructor(storage: BaseStorage<TFile, TFileReturn>, config?: AudioTransformerConfig);
|
|
43
|
+
/**
|
|
44
|
+
* Resamples audio to different sample rate.
|
|
45
|
+
* @param fileId Unique identifier of the audio file to resample.
|
|
46
|
+
* @param options Resample options including target sample rate.
|
|
47
|
+
* @returns Promise resolving to transformed audio result.
|
|
48
|
+
*/
|
|
49
|
+
resample(fileId: string, options: AudioResampleOptions): Promise<AudioTransformResult<TFileReturn>>;
|
|
50
|
+
/**
|
|
51
|
+
* Changes number of channels (up/downmixing).
|
|
52
|
+
* @param fileId Unique identifier of the audio file to process.
|
|
53
|
+
* @param options Channel mix options including target number of channels.
|
|
54
|
+
* @returns Promise resolving to transformed audio result.
|
|
55
|
+
*/
|
|
56
|
+
mixChannels(fileId: string, options: AudioChannelMixOptions): Promise<AudioTransformResult<TFileReturn>>;
|
|
57
|
+
/**
|
|
58
|
+
* Converts audio format or codec.
|
|
59
|
+
* @param fileId Unique identifier of the audio file to convert.
|
|
60
|
+
* @param format Target audio format (e.g., "mp3", "wav", "ogg").
|
|
61
|
+
* @param options Additional transform options.
|
|
62
|
+
* @returns Promise resolving to transformed audio result.
|
|
63
|
+
*/
|
|
64
|
+
convertFormat(fileId: string, format: string, options?: AudioTransformOptions): Promise<AudioTransformResult<TFileReturn>>;
|
|
65
|
+
/**
|
|
66
|
+
* Transcodes audio to different codec.
|
|
67
|
+
* @param fileId Unique identifier of the audio file to transcode.
|
|
68
|
+
* @param codec Target audio codec (e.g., "aac", "opus", "mp3").
|
|
69
|
+
* @param options Additional transform options.
|
|
70
|
+
* @returns Promise resolving to transformed audio result.
|
|
71
|
+
*/
|
|
72
|
+
transcode(fileId: string, codec: AudioTransformOptions["codec"], options?: Omit<AudioTransformOptions, "codec">): Promise<AudioTransformResult<TFileReturn>>;
|
|
73
|
+
/**
|
|
74
|
+
* Applies a custom transformation pipeline to an audio file.
|
|
75
|
+
* @param fileId Unique identifier of the audio file to transform.
|
|
76
|
+
* @param steps Array of transformation steps to apply in sequence.
|
|
77
|
+
* @returns Promise resolving to transformed audio result.
|
|
78
|
+
*/
|
|
79
|
+
transform(fileId: string, steps: AudioTransformationStep[]): Promise<AudioTransformResult<TFileReturn>>;
|
|
80
|
+
/**
|
|
81
|
+
* Apply multiple transformations in sequence using Mediabunny
|
|
82
|
+
*/
|
|
83
|
+
private applyTransformations;
|
|
84
|
+
/**
|
|
85
|
+
* Convert transformation steps to Mediabunny audio options
|
|
86
|
+
* @param steps Array of audio transformation steps to convert
|
|
87
|
+
* @returns Mediabunny audio options object for conversion
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
private stepsToAudioOptions;
|
|
91
|
+
/**
|
|
92
|
+
* Determine output format based on transformation steps
|
|
93
|
+
* @param steps Array of audio transformation steps
|
|
94
|
+
* @returns Mediabunny output format instance (defaults to MP3)
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private determineOutputFormat;
|
|
98
|
+
/**
|
|
99
|
+
* Convert format string to Mediabunny output format
|
|
100
|
+
* @param format Audio format string (aac, flac, mp3, ogg, wav)
|
|
101
|
+
* @returns Mediabunny output format instance
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
private formatStringToOutputFormat;
|
|
105
|
+
/**
|
|
106
|
+
* Validate that the file is a supported audio file
|
|
107
|
+
* @param file The file to validate
|
|
108
|
+
* @returns Promise that resolves if validation passes
|
|
109
|
+
* @throws Error if file size exceeds limits, wrong content type, unsupported format, or invalid audio
|
|
110
|
+
* @private
|
|
111
|
+
*/
|
|
112
|
+
private validateAudio;
|
|
113
|
+
/**
|
|
114
|
+
* Create transformation result with metadata
|
|
115
|
+
* @param buffer The transformed audio buffer
|
|
116
|
+
* @param originalFile The original file information
|
|
117
|
+
* @returns Audio transformation result with metadata
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
private createTransformResult;
|
|
121
|
+
/**
|
|
122
|
+
* Generate cache key for transformation
|
|
123
|
+
* @param fileId The file identifier
|
|
124
|
+
* @param steps Array of transformation steps
|
|
125
|
+
* @returns Unique cache key string
|
|
126
|
+
* @private
|
|
127
|
+
*/
|
|
128
|
+
private generateCacheKey;
|
|
127
129
|
}
|
|
128
|
-
export default
|
|
130
|
+
export { AudioTransformer as default };
|