@visulima/storage 1.0.0-alpha.15 → 1.0.0-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE.md +1094 -382
  3. package/dist/adapter/nuxt/module.d.ts +41 -34
  4. package/dist/handler/http/fetch/index.d.ts +297 -4
  5. package/dist/handler/http/hono/index.d.ts +1474 -58
  6. package/dist/handler/http/nextjs/index.d.ts +66 -58
  7. package/dist/handler/http/node/index.d.ts +361 -4
  8. package/dist/handler/http/solid-start/index.d.ts +66 -57
  9. package/dist/index.d.ts +376 -17
  10. package/dist/openapi/index.d.ts +24 -5
  11. package/dist/packem_shared/{GCSMetaStorage-BkUIdJ5m.js → GCSMetaStorage-BygVH0Ee.js} +1 -1
  12. package/dist/packem_shared/{GCStorage-BnsSAjdW.js → GCStorage-4hSx_bN1.js} +1 -1
  13. package/dist/packem_shared/S3Client.d-CZ62Jztg.d.ts +20357 -0
  14. package/dist/packem_shared/disk-storage-with-checksum.d-hEoe2ugb.d.ts +148 -0
  15. package/dist/packem_shared/{gcs-meta-storage-DBeGn2ix.js → gcs-meta-storage-8FovEDbW.js} +1 -1
  16. package/dist/packem_shared/local-meta-storage.d-Dop9RP9k.d.ts +20 -0
  17. package/dist/packem_shared/media-transformer.d-ChmjTvjc.d.ts +331 -0
  18. package/dist/packem_shared/s3-base-storage.d-CczjSe98.d.ts +251 -0
  19. package/dist/packem_shared/storage.d-BOMUJD96.d.ts +939 -0
  20. package/dist/packem_shared/tus-base.d-CpLzyd-S.d.ts +99 -0
  21. package/dist/packem_shared/types.d-DBjmJvIT.d.ts +708 -0
  22. package/dist/packem_shared/types.d-DviSTLOg.d.ts +49 -0
  23. package/dist/storage/aws/clients/index.d.ts +166 -6
  24. package/dist/storage/aws/index.d.ts +320 -4
  25. package/dist/storage/aws-light/index.d.ts +252 -4
  26. package/dist/storage/azure/index.d.ts +10422 -4
  27. package/dist/storage/gcs/index.d.ts +4107 -5
  28. package/dist/storage/gcs/index.js +2 -2
  29. package/dist/storage/local/index.d.ts +7 -4
  30. package/dist/storage/netlify-blob/index.d.ts +142 -4
  31. package/dist/storage/vercel-blob/index.d.ts +129 -4
  32. package/dist/transformer/audio-transformer.d.ts +127 -125
  33. package/dist/transformer/image-transformer.d.ts +569 -568
  34. package/dist/transformer/index.d.ts +62 -5
  35. package/dist/transformer/video-transformer.d.ts +144 -142
  36. package/package.json +38 -38
  37. package/dist/handler/base/base-handler-core.d.ts +0 -91
  38. package/dist/handler/base/base-handler-fetch.d.ts +0 -76
  39. package/dist/handler/base/base-handler-node.d.ts +0 -137
  40. package/dist/handler/multipart/multipart-base.d.ts +0 -84
  41. package/dist/handler/multipart/multipart-fetch.d.ts +0 -64
  42. package/dist/handler/multipart/multipart.d.ts +0 -49
  43. package/dist/handler/rest/rest-base.d.ts +0 -106
  44. package/dist/handler/rest/rest-fetch.d.ts +0 -88
  45. package/dist/handler/rest/rest.d.ts +0 -93
  46. package/dist/handler/tus/tus-base.d.ts +0 -152
  47. package/dist/handler/tus/tus-fetch.d.ts +0 -72
  48. package/dist/handler/tus/tus.d.ts +0 -78
  49. package/dist/handler/types.d.ts +0 -53
  50. package/dist/handler/utils/request-parser.d.ts +0 -72
  51. package/dist/handler/utils/response-builder.d.ts +0 -83
  52. package/dist/handler/utils/storage-utils.d.ts +0 -10
  53. package/dist/handler/utils/stream-utils.d.ts +0 -29
  54. package/dist/handler/utils/upload-handlers.d.ts +0 -76
  55. package/dist/metrics/index.d.ts +0 -2
  56. package/dist/metrics/no-op-metrics.d.ts +0 -15
  57. package/dist/metrics/opentelemetry-metrics.d.ts +0 -55
  58. package/dist/openapi/rest.d.ts +0 -7
  59. package/dist/openapi/shared.d.ts +0 -13
  60. package/dist/openapi/transform.d.ts +0 -3
  61. package/dist/openapi/tus.d.ts +0 -7
  62. package/dist/openapi/xhr.d.ts +0 -7
  63. package/dist/storage/aws/clients/backblaze.d.ts +0 -12
  64. package/dist/storage/aws/clients/cloudflare.d.ts +0 -13
  65. package/dist/storage/aws/clients/digital-ocean.d.ts +0 -12
  66. package/dist/storage/aws/clients/minio.d.ts +0 -13
  67. package/dist/storage/aws/clients/tigris.d.ts +0 -12
  68. package/dist/storage/aws/clients/types.d.ts +0 -95
  69. package/dist/storage/aws/clients/wasabi.d.ts +0 -12
  70. package/dist/storage/aws/s3-base-storage.d.ts +0 -248
  71. package/dist/storage/aws/s3-client-adapter.d.ts +0 -110
  72. package/dist/storage/aws/s3-file.d.ts +0 -10
  73. package/dist/storage/aws/s3-meta-storage.d.ts +0 -15
  74. package/dist/storage/aws/s3-storage.d.ts +0 -70
  75. package/dist/storage/aws/types.d.ts +0 -118
  76. package/dist/storage/aws-light/aws-light-api-adapter.d.ts +0 -130
  77. package/dist/storage/aws-light/aws-light-file.d.ts +0 -10
  78. package/dist/storage/aws-light/aws-light-meta-storage.d.ts +0 -19
  79. package/dist/storage/aws-light/aws-light-storage.d.ts +0 -66
  80. package/dist/storage/aws-light/types.d.ts +0 -36
  81. package/dist/storage/azure/azure-file.d.ts +0 -6
  82. package/dist/storage/azure/azure-meta-storage.d.ts +0 -15
  83. package/dist/storage/azure/azure-storage.d.ts +0 -69
  84. package/dist/storage/azure/types.d.ts +0 -61
  85. package/dist/storage/gcs/fetch-error.d.ts +0 -11
  86. package/dist/storage/gcs/gcs-config.d.ts +0 -2
  87. package/dist/storage/gcs/gcs-file.d.ts +0 -6
  88. package/dist/storage/gcs/gcs-meta-storage.d.ts +0 -27
  89. package/dist/storage/gcs/gcs-storage.d.ts +0 -91
  90. package/dist/storage/gcs/types.d.ts +0 -54
  91. package/dist/storage/gcs/utils.d.ts +0 -7
  92. package/dist/storage/local/disk-storage-with-checksum.d.ts +0 -15
  93. package/dist/storage/local/disk-storage.d.ts +0 -135
  94. package/dist/storage/local/local-meta-storage.d.ts +0 -27
  95. package/dist/storage/meta-storage-options.d.ts +0 -11
  96. package/dist/storage/meta-storage.d.ts +0 -30
  97. package/dist/storage/netlify-blob/netlify-blob-file.d.ts +0 -12
  98. package/dist/storage/netlify-blob/netlify-blob-meta-storage.d.ts +0 -6
  99. package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +0 -93
  100. package/dist/storage/netlify-blob/types.d.ts +0 -29
  101. package/dist/storage/storage.d.ts +0 -353
  102. package/dist/storage/types.d.ts +0 -217
  103. package/dist/storage/utils/file/file.d.ts +0 -25
  104. package/dist/storage/utils/file/get-file-status.d.ts +0 -9
  105. package/dist/storage/utils/file/has-content.d.ts +0 -9
  106. package/dist/storage/utils/file/index.d.ts +0 -10
  107. package/dist/storage/utils/file/is-expired.d.ts +0 -8
  108. package/dist/storage/utils/file/metadata.d.ts +0 -18
  109. package/dist/storage/utils/file/part-match.d.ts +0 -11
  110. package/dist/storage/utils/file/types.d.ts +0 -37
  111. package/dist/storage/utils/file/update-metadata.d.ts +0 -10
  112. package/dist/storage/utils/file/update-size.d.ts +0 -10
  113. package/dist/storage/vercel-blob/types.d.ts +0 -31
  114. package/dist/storage/vercel-blob/vercel-blob-file.d.ts +0 -16
  115. package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +0 -6
  116. package/dist/storage/vercel-blob/vercel-blob-storage.d.ts +0 -76
  117. package/dist/transformer/base-transformer.d.ts +0 -63
  118. package/dist/transformer/media-transformer.d.ts +0 -332
  119. package/dist/transformer/transformer-config.d.ts +0 -16
  120. package/dist/transformer/types.d.ts +0 -639
  121. package/dist/transformer/utils.d.ts +0 -33
  122. package/dist/transformer/validation-error.d.ts +0 -23
  123. package/dist/utils/cache.d.ts +0 -32
  124. package/dist/utils/chunked-upload.d.ts +0 -65
  125. package/dist/utils/detect-file-type.d.ts +0 -28
  126. package/dist/utils/errors.d.ts +0 -74
  127. package/dist/utils/file-path-url-matcher.d.ts +0 -18
  128. package/dist/utils/headers.d.ts +0 -111
  129. package/dist/utils/http.d.ts +0 -92
  130. package/dist/utils/locker.d.ts +0 -26
  131. package/dist/utils/pipes/stream-checksum.d.ts +0 -47
  132. package/dist/utils/pipes/stream-length.d.ts +0 -22
  133. package/dist/utils/primitives/get-last-one.d.ts +0 -3
  134. package/dist/utils/primitives/is-record.d.ts +0 -2
  135. package/dist/utils/primitives/map-values.d.ts +0 -9
  136. package/dist/utils/primitives/pick.d.ts +0 -2
  137. package/dist/utils/primitives/to-milliseconds.d.ts +0 -12
  138. package/dist/utils/primitives/to-seconds.d.ts +0 -12
  139. package/dist/utils/range-checksum.d.ts +0 -33
  140. package/dist/utils/range-hasher.d.ts +0 -46
  141. package/dist/utils/retry.d.ts +0 -64
  142. package/dist/utils/types.d.ts +0 -108
  143. package/dist/utils/validation-error.d.ts +0 -22
  144. 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-DBeGn2ix.js';
4
- export { default as GCStorage } from '../../packem_shared/GCStorage-BnsSAjdW.js';
3
+ export { G as GCSMetaStorage } from '../../packem_shared/gcs-meta-storage-8FovEDbW.js';
4
+ export { default as GCStorage } from '../../packem_shared/GCStorage-4hSx_bN1.js';
@@ -1,4 +1,7 @@
1
- export { default as DiskStorage } from "./disk-storage.d.ts";
2
- export { default as DiskStorageWithChecksum } from "./disk-storage-with-checksum.d.ts";
3
- export type { LocalMetaStorageOptions } from "./local-meta-storage.d.ts";
4
- export { default as LocalMetaStorage } from "./local-meta-storage.d.ts";
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
- export { default as NetlifyBlobFile } from "./netlify-blob-file.d.ts";
2
- export { default as NetlifyBlobMetaStorage } from "./netlify-blob-meta-storage.d.ts";
3
- export { default as NetlifyBlobStorage } from "./netlify-blob-storage.d.ts";
4
- export type { NetlifyBlobStorageOptions } from "./types.d.ts";
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
- export type { VercelBlobStorageOptions } from "./types.d.ts";
2
- export { default as VercelBlobFile } from "./vercel-blob-file.d.ts";
3
- export { default as VercelBlobMetaStorage } from "./vercel-blob-meta-storage.d.ts";
4
- export { default as VercelBlobStorage } from "./vercel-blob-storage.d.ts";
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 type { BaseStorage } from "../storage/storage.d.ts";
2
- import type { File, FileReturn } from "../storage/utils/index.d.ts";
3
- import BaseTransformer from "./base-transformer.d.ts";
4
- import type { AudioChannelMixOptions, AudioResampleOptions, AudioTransformationStep, AudioTransformerConfig, AudioTransformOptions, AudioTransformResult } from "./types.d.ts";
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-DBjmJvIT.js";
3
+ import 'node:stream';
4
+ import 'node:crypto';
5
+ import 'node:http';
6
+ import 'lru-cache';
5
7
  /**
6
- * Audio transformer that uses storage backends and Mediabunny to retrieve and transform audio files
7
- *
8
- * Supports audio transformations with query parameters for on-demand audio processing.
9
- * @example
10
- * ```ts
11
- * const transformer = new AudioTransformer(storage, {
12
- * maxAudioSize: 50 * 1024 * 1024, // 50MB
13
- * cache: new Map()
14
- * });
15
- *
16
- * // Programmatic usage - resample audio
17
- * const result = await transformer.resample('audio-id', {
18
- * sampleRate: 44100
19
- * });
20
- *
21
- * // URL-based transformations
22
- * // GET /files/audio-id?sampleRate=48000&codec=aac&bitrate=128000
23
- * // GET /files/audio-id?numberOfChannels=1&format=mp3
24
- * ```
25
- *
26
- * ## Supported Query Parameters
27
- *
28
- * - `sampleRate`: Sample rate in Hz (Number)
29
- * - `numberOfChannels`: Number of channels (Number)
30
- * - `codec`: Audio codec - aac/opus/mp3/vorbis/flac
31
- * - `bitrate`: Audio bitrate in bits per second (Number)
32
- * - `format`: Output format - mp3/wav/ogg/aac/flac
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
- * Creates a new AudioTransformer instance.
37
- * @param storage The storage backend for retrieving and storing audio files.
38
- * @param config Configuration options for audio transformation including cache settings, codec defaults, and size limits.
39
- */
40
- constructor(storage: BaseStorage<TFile, TFileReturn>, config?: AudioTransformerConfig);
41
- /**
42
- * Resamples audio to different sample rate.
43
- * @param fileId Unique identifier of the audio file to resample.
44
- * @param options Resample options including target sample rate.
45
- * @returns Promise resolving to transformed audio result.
46
- */
47
- resample(fileId: string, options: AudioResampleOptions): Promise<AudioTransformResult<TFileReturn>>;
48
- /**
49
- * Changes number of channels (up/downmixing).
50
- * @param fileId Unique identifier of the audio file to process.
51
- * @param options Channel mix options including target number of channels.
52
- * @returns Promise resolving to transformed audio result.
53
- */
54
- mixChannels(fileId: string, options: AudioChannelMixOptions): Promise<AudioTransformResult<TFileReturn>>;
55
- /**
56
- * Converts audio format or codec.
57
- * @param fileId Unique identifier of the audio file to convert.
58
- * @param format Target audio format (e.g., "mp3", "wav", "ogg").
59
- * @param options Additional transform options.
60
- * @returns Promise resolving to transformed audio result.
61
- */
62
- convertFormat(fileId: string, format: string, options?: AudioTransformOptions): Promise<AudioTransformResult<TFileReturn>>;
63
- /**
64
- * Transcodes audio to different codec.
65
- * @param fileId Unique identifier of the audio file to transcode.
66
- * @param codec Target audio codec (e.g., "aac", "opus", "mp3").
67
- * @param options Additional transform options.
68
- * @returns Promise resolving to transformed audio result.
69
- */
70
- transcode(fileId: string, codec: AudioTransformOptions["codec"], options?: Omit<AudioTransformOptions, "codec">): Promise<AudioTransformResult<TFileReturn>>;
71
- /**
72
- * Applies a custom transformation pipeline to an audio file.
73
- * @param fileId Unique identifier of the audio file to transform.
74
- * @param steps Array of transformation steps to apply in sequence.
75
- * @returns Promise resolving to transformed audio result.
76
- */
77
- transform(fileId: string, steps: AudioTransformationStep[]): Promise<AudioTransformResult<TFileReturn>>;
78
- /**
79
- * Apply multiple transformations in sequence using Mediabunny
80
- */
81
- private applyTransformations;
82
- /**
83
- * Convert transformation steps to Mediabunny audio options
84
- * @param steps Array of audio transformation steps to convert
85
- * @returns Mediabunny audio options object for conversion
86
- * @private
87
- */
88
- private stepsToAudioOptions;
89
- /**
90
- * Determine output format based on transformation steps
91
- * @param steps Array of audio transformation steps
92
- * @returns Mediabunny output format instance (defaults to MP3)
93
- * @private
94
- */
95
- private determineOutputFormat;
96
- /**
97
- * Convert format string to Mediabunny output format
98
- * @param format Audio format string (aac, flac, mp3, ogg, wav)
99
- * @returns Mediabunny output format instance
100
- * @private
101
- */
102
- private formatStringToOutputFormat;
103
- /**
104
- * Validate that the file is a supported audio file
105
- * @param file The file to validate
106
- * @returns Promise that resolves if validation passes
107
- * @throws Error if file size exceeds limits, wrong content type, unsupported format, or invalid audio
108
- * @private
109
- */
110
- private validateAudio;
111
- /**
112
- * Create transformation result with metadata
113
- * @param buffer The transformed audio buffer
114
- * @param originalFile The original file information
115
- * @returns Audio transformation result with metadata
116
- * @private
117
- */
118
- private createTransformResult;
119
- /**
120
- * Generate cache key for transformation
121
- * @param fileId The file identifier
122
- * @param steps Array of transformation steps
123
- * @returns Unique cache key string
124
- * @private
125
- */
126
- private generateCacheKey;
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 AudioTransformer;
130
+ export { AudioTransformer as default };