@visulima/storage 1.0.0-alpha.31 → 1.0.0-alpha.32

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 (173) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +2 -2
  3. package/dist/adapter/nuxt/module.d.ts +4 -4
  4. package/dist/adapter/nuxt/node_modules/.bin/nuxi +2 -2
  5. package/dist/adapter/nuxt/node_modules/.bin/nuxt +2 -2
  6. package/dist/ai/ai-sdk/index.d.ts +3 -3
  7. package/dist/ai/claude/index.d.ts +2 -2
  8. package/dist/ai/openai/index.d.ts +3 -3
  9. package/dist/ai/tanstack/index.d.ts +2 -2
  10. package/dist/handler/http/fetch/index.d.ts +7 -7
  11. package/dist/handler/http/fetch/index.js +1 -1
  12. package/dist/handler/http/hono/index.d.ts +4 -4
  13. package/dist/handler/http/hono/index.js +1 -1
  14. package/dist/handler/http/nextjs/index.d.ts +4 -4
  15. package/dist/handler/http/nextjs/index.js +1 -1
  16. package/dist/handler/http/node/index.d.ts +7 -7
  17. package/dist/handler/http/node/index.js +1 -1
  18. package/dist/handler/http/solid-start/index.d.ts +4 -4
  19. package/dist/handler/http/solid-start/index.js +1 -1
  20. package/dist/index.d.ts +6 -5
  21. package/dist/index.js +1 -1
  22. package/dist/packem_shared/{AwsLightStorage-DbQrK9m7.js → AwsLightStorage-B1jNF7sv.js} +1 -1
  23. package/dist/packem_shared/AzureStorage-B4E6VLn5.js +1 -0
  24. package/dist/packem_shared/{BoxMetaStorage-DLdXbZaV.js → BoxMetaStorage-nESVquA1.js} +1 -1
  25. package/dist/packem_shared/BoxStorage-CHYDrcxw.js +1 -0
  26. package/dist/packem_shared/{BunS3MetaStorage-Bv_CTTMz.js → BunS3MetaStorage-BkZx5q4w.js} +1 -1
  27. package/dist/packem_shared/BunS3Storage-BopE7kmX.js +1 -0
  28. package/dist/packem_shared/{BunnyMetaStorage-DNMTSeoN.js → BunnyMetaStorage-bB8NXGUI.js} +1 -1
  29. package/dist/packem_shared/BunnyStorage-C3IBxJqr.js +1 -0
  30. package/dist/packem_shared/{CloudinaryMetaStorage-DEBk5eQy.js → CloudinaryMetaStorage-BzibHydK.js} +1 -1
  31. package/dist/packem_shared/CloudinaryStorage-Cj00ZXWV.js +1 -0
  32. package/dist/packem_shared/DiskStorage-BrAb28Je.js +1 -0
  33. package/dist/packem_shared/DiskStorageWithChecksum-BX85CHJ6.js +1 -0
  34. package/dist/packem_shared/{DropboxMetaStorage-C6vj1QDA.js → DropboxMetaStorage-Bfm5bblb.js} +1 -1
  35. package/dist/packem_shared/DropboxStorage-Btz9h9Mj.js +1 -0
  36. package/dist/packem_shared/Files-tnc_buzM.js +1 -0
  37. package/dist/packem_shared/{FirebaseMetaStorage-CzyOim-J.js → FirebaseMetaStorage-CshnJMb0.js} +1 -1
  38. package/dist/packem_shared/FirebaseStorage-Y9P6Dx8I.js +2 -0
  39. package/dist/packem_shared/{FtpMetaStorage-1Njy0DpU.js → FtpMetaStorage-CoyWJafY.js} +1 -1
  40. package/dist/packem_shared/FtpStorage-DCKPMX0z.js +1 -0
  41. package/dist/packem_shared/{GCSMetaStorage-DFIjFmn-.js → GCSMetaStorage-CfZj52hQ.js} +1 -1
  42. package/dist/packem_shared/GCStorage-hfL1u2KQ.js +1 -0
  43. package/dist/packem_shared/{GoogleDriveMetaStorage-WGuUZPyx.js → GoogleDriveMetaStorage-CBSdEQr6.js} +1 -1
  44. package/dist/packem_shared/GoogleDriveStorage-C7iuV7qb.js +1 -0
  45. package/dist/packem_shared/{LocalMetaStorage-QMKL7McF.js → LocalMetaStorage-DSwsmdt7.js} +1 -1
  46. package/dist/packem_shared/MemoryMetaStorage-DEzfBNgL.js +1 -0
  47. package/dist/packem_shared/{Multipart-DkH4QwNs.js → Multipart-kQ5wJQaV.js} +1 -1
  48. package/dist/packem_shared/{Multipart-C6Mw7V9W.js → Multipart-qaEOWKz1.js} +1 -1
  49. package/dist/packem_shared/{NetlifyBlobMetaStorage-ClIFdTkT.js → NetlifyBlobMetaStorage-CqluIgV0.js} +1 -1
  50. package/dist/packem_shared/NetlifyBlobStorage-CkMw9Uyv.js +1 -0
  51. package/dist/packem_shared/{OneDriveMetaStorage-DS4f83X2.js → OneDriveMetaStorage-DPTNMpeq.js} +1 -1
  52. package/dist/packem_shared/OneDriveStorage-CEGYb6OC.js +1 -0
  53. package/dist/packem_shared/{PocketBaseMetaStorage-B6utPncj.js → PocketBaseMetaStorage-CemTT_01.js} +1 -1
  54. package/dist/packem_shared/PocketBaseStorage-BZNzWj09.js +1 -0
  55. package/dist/packem_shared/{Rest-DY1neM_3.js → Rest-BAcUFAgk.js} +1 -1
  56. package/dist/packem_shared/{Rest-DWrS4Z_j.js → Rest-DukkeDZe.js} +1 -1
  57. package/dist/packem_shared/S3Storage-7hG3izjU.js +1 -0
  58. package/dist/packem_shared/{SftpMetaStorage-DYqXwCdM.js → SftpMetaStorage-Cs8b7uBO.js} +1 -1
  59. package/dist/packem_shared/SftpStorage-DnigT9GT.js +1 -0
  60. package/dist/packem_shared/{SharePointMetaStorage-DVM5-X6g.js → SharePointMetaStorage-DTVKAx6f.js} +1 -1
  61. package/dist/packem_shared/{SharePointStorage-r934t5HX.js → SharePointStorage-D1cWu-14.js} +1 -1
  62. package/dist/packem_shared/{SupabaseMetaStorage-ivXoYVUu.js → SupabaseMetaStorage-D_fGv0d6.js} +1 -1
  63. package/dist/packem_shared/SupabaseStorage-DbIUa6NZ.js +1 -0
  64. package/dist/packem_shared/{Tus-d2hPK5nV.js → Tus-BYTcw17H.js} +1 -1
  65. package/dist/packem_shared/{Tus-BMd67Cnb.js → Tus-BrP4RFTg.js} +1 -1
  66. package/dist/packem_shared/{UploadThingMetaStorage-BvKNzgm7.js → UploadThingMetaStorage-CAQ1uTfv.js} +1 -1
  67. package/dist/packem_shared/UploadThingStorage-B1qw1GrM.js +1 -0
  68. package/dist/packem_shared/{VercelBlobMetaStorage-CwaqWucZ.js → VercelBlobMetaStorage-DY4zAB6M.js} +1 -1
  69. package/dist/packem_shared/VercelBlobStorage-u6xmp8ox.js +1 -0
  70. package/dist/packem_shared/{base-handler-core-Cwd9uq_E.js → base-handler-core-Ccvdhx-k.js} +1 -1
  71. package/dist/packem_shared/{base-handler-fetch-_BD4V1W2.js → base-handler-fetch-DzbThEWy.js} +1 -1
  72. package/dist/packem_shared/{base-handler-node-BDNRnVIc.js → base-handler-node-CmCpLlBt.js} +1 -1
  73. package/dist/packem_shared/default-BrhEhSqN.js +1 -0
  74. package/dist/packem_shared/{defaultCloudStorageFileNameValidation-hWLdEgOD.js → defaultCloudStorageFileNameValidation-DwDn0XB5.js} +1 -1
  75. package/dist/packem_shared/disk-storage-fWizVrge.js +1 -0
  76. package/dist/packem_shared/{disk-storage-with-checksum.d-Dm4agCey.d.ts → disk-storage-with-checksum.d-aYBmkg45.d.ts} +8 -2
  77. package/dist/packem_shared/{executors.d-Cut3Gstb.d.ts → executors.d-WGJGPSZs.d.ts} +1 -1
  78. package/dist/packem_shared/{gcs-meta-storage-Bwts-MUe.js → gcs-meta-storage-COq32th7.js} +1 -1
  79. package/dist/packem_shared/get-file-status-DLS18Zvd.js +1 -0
  80. package/dist/packem_shared/index.d-CYdFIB-w.d.ts +455 -0
  81. package/dist/packem_shared/isRetryableError-CBZ65V6T.js +1 -0
  82. package/dist/packem_shared/local-meta-storage-Dr891Iy7.js +1 -0
  83. package/dist/packem_shared/{local-meta-storage.d-qZQI1JUe.d.ts → local-meta-storage.d-CuvN-KQ3.d.ts} +1 -1
  84. package/dist/packem_shared/{media-transformer.d-lQ_RUjb5.d.ts → media-transformer.d-DfU7VbFl.d.ts} +2 -2
  85. package/dist/packem_shared/memory-storage.d-DRbE0WMO.d.ts +101 -0
  86. package/dist/packem_shared/part-match-D_NwyoF3.js +1 -0
  87. package/dist/packem_shared/{path-D7rMc9nq-B718mbm6.js → path-D7rMc9nq-CPbxyMDy.js} +1 -1
  88. package/dist/packem_shared/{rest-base-C-a7pXUc.js → rest-base-xrnOBxS9.js} +1 -1
  89. package/dist/packem_shared/s3-base-storage-CqAyWHR6.js +1 -0
  90. package/dist/packem_shared/{s3-base-storage.d-CDIOMTpp.d.ts → s3-base-storage.d-BrHiKWFw.d.ts} +9 -2
  91. package/dist/packem_shared/storage-uhIhcN-O.js +1 -0
  92. package/dist/packem_shared/{storage.d-BoJgdi1n.d.ts → storage.d-X6TimMHY.d.ts} +23 -1
  93. package/dist/packem_shared/{tus-base.d-C28C_AY9.d.ts → tus-base.d-Ds7xYAJC.d.ts} +3 -3
  94. package/dist/packem_shared/{types.d-CPxJpoPH.d.ts → types.d-B72PbsLY.d.ts} +2 -2
  95. package/dist/packem_shared/{types.d-DCPQvHDI.d.ts → types.d-C4QumoP1.d.ts} +2 -2
  96. package/dist/packem_shared/{types.d-C0MDnUYc.d.ts → types.d-a1grKnaX.d.ts} +1 -1
  97. package/dist/storage/aws/index.d.ts +9 -3
  98. package/dist/storage/aws/index.js +1 -1
  99. package/dist/storage/aws-light/index.d.ts +2 -2
  100. package/dist/storage/aws-light/index.js +1 -1
  101. package/dist/storage/azure/index.d.ts +1 -1
  102. package/dist/storage/azure/index.js +1 -1
  103. package/dist/storage/box/index.d.ts +2 -2
  104. package/dist/storage/box/index.js +1 -1
  105. package/dist/storage/bun-s3/index.d.ts +2 -2
  106. package/dist/storage/bun-s3/index.js +1 -1
  107. package/dist/storage/bunny/index.d.ts +2 -2
  108. package/dist/storage/bunny/index.js +1 -1
  109. package/dist/storage/cloudinary/index.d.ts +2 -2
  110. package/dist/storage/cloudinary/index.js +1 -1
  111. package/dist/storage/dropbox/index.d.ts +2 -2
  112. package/dist/storage/dropbox/index.js +1 -1
  113. package/dist/storage/firebase/index.d.ts +2 -2
  114. package/dist/storage/firebase/index.js +1 -1
  115. package/dist/storage/ftp/index.d.ts +2 -2
  116. package/dist/storage/ftp/index.js +1 -1
  117. package/dist/storage/gcs/index.d.ts +1 -1
  118. package/dist/storage/gcs/index.js +1 -1
  119. package/dist/storage/google-drive/index.d.ts +2 -2
  120. package/dist/storage/google-drive/index.js +1 -1
  121. package/dist/storage/local/index.d.ts +3 -3
  122. package/dist/storage/local/index.js +1 -1
  123. package/dist/storage/memory/index.d.ts +6 -0
  124. package/dist/storage/memory/index.js +1 -0
  125. package/dist/storage/netlify-blob/index.d.ts +2 -2
  126. package/dist/storage/netlify-blob/index.js +1 -1
  127. package/dist/storage/onedrive/index.d.ts +4 -4
  128. package/dist/storage/onedrive/index.js +1 -1
  129. package/dist/storage/pocketbase/index.d.ts +2 -2
  130. package/dist/storage/pocketbase/index.js +1 -1
  131. package/dist/storage/sftp/index.d.ts +2 -2
  132. package/dist/storage/sftp/index.js +1 -1
  133. package/dist/storage/sharepoint/index.d.ts +3 -3
  134. package/dist/storage/sharepoint/index.js +1 -1
  135. package/dist/storage/supabase/index.d.ts +2 -2
  136. package/dist/storage/supabase/index.js +1 -1
  137. package/dist/storage/uploadthing/index.d.ts +2 -2
  138. package/dist/storage/uploadthing/index.js +1 -1
  139. package/dist/storage/vercel-blob/index.d.ts +2 -2
  140. package/dist/storage/vercel-blob/index.js +1 -1
  141. package/dist/transformer/audio-transformer.d.ts +2 -2
  142. package/dist/transformer/image-transformer.d.ts +2 -2
  143. package/dist/transformer/index.d.ts +3 -3
  144. package/dist/transformer/video-transformer.d.ts +2 -2
  145. package/package.json +6 -2
  146. package/dist/packem_shared/AzureStorage-Cmr0nPDq.js +0 -1
  147. package/dist/packem_shared/BoxStorage-DYzAYPIr.js +0 -1
  148. package/dist/packem_shared/BunS3Storage-BvaFeKeu.js +0 -1
  149. package/dist/packem_shared/BunnyStorage-DsQndiy5.js +0 -1
  150. package/dist/packem_shared/CloudinaryStorage-DiK0T7N7.js +0 -1
  151. package/dist/packem_shared/DiskStorage-RvZNMWe7.js +0 -1
  152. package/dist/packem_shared/DiskStorageWithChecksum-eGOV3leX.js +0 -1
  153. package/dist/packem_shared/DropboxStorage-Dfd78aJL.js +0 -1
  154. package/dist/packem_shared/Files-CtggibJ-.js +0 -1
  155. package/dist/packem_shared/FirebaseStorage-C-FwZOYA.js +0 -2
  156. package/dist/packem_shared/FtpStorage-DzaP89bG.js +0 -1
  157. package/dist/packem_shared/GCStorage-1vA3xkFO.js +0 -1
  158. package/dist/packem_shared/GoogleDriveStorage-D_RaKV_j.js +0 -1
  159. package/dist/packem_shared/NetlifyBlobStorage-C-IkXF0_.js +0 -1
  160. package/dist/packem_shared/OneDriveStorage-C7rqK2Wp.js +0 -1
  161. package/dist/packem_shared/PocketBaseStorage-Cdgr5w88.js +0 -1
  162. package/dist/packem_shared/S3Storage-Dn3l4WkO.js +0 -1
  163. package/dist/packem_shared/SftpStorage-CBW6MBLV.js +0 -1
  164. package/dist/packem_shared/SupabaseStorage-DMRhLPNo.js +0 -1
  165. package/dist/packem_shared/UploadThingStorage-BjF_gRMY.js +0 -1
  166. package/dist/packem_shared/VercelBlobStorage-Dx2jywjl.js +0 -1
  167. package/dist/packem_shared/disk-storage-Bmvawf-b.js +0 -1
  168. package/dist/packem_shared/index.d-DSZjPbvW.d.ts +0 -230
  169. package/dist/packem_shared/isRetryableError-BhizNeAz.js +0 -1
  170. package/dist/packem_shared/local-meta-storage-Bi0mK6gD.js +0 -1
  171. package/dist/packem_shared/part-match-B5fLLmFw.js +0 -1
  172. package/dist/packem_shared/s3-base-storage-Ek1HinGR.js +0 -1
  173. package/dist/packem_shared/storage-B-NDsI-o.js +0 -1
@@ -0,0 +1,455 @@
1
+ import { O as OperationOptions, B as BaseStorage } from "./storage.d-X6TimMHY.js";
2
+ /**
3
+ * Web-standard and Node-native body types accepted by {@link Files.upload}.
4
+ */
5
+ type FileBody = ArrayBuffer | ArrayBufferView | Blob | Buffer | NodeJS.ReadableStream | ReadableStream<Uint8Array> | string;
6
+ /**
7
+ * Byte range for {@link Files.download}. Both bounds are 0-based and `end` is
8
+ * **inclusive**, mirroring the HTTP `Range: bytes=start-end` header. Omit `end`
9
+ * to read from `start` to EOF (e.g. resume an interrupted download).
10
+ */
11
+ interface DownloadRange {
12
+ end?: number;
13
+ start: number;
14
+ }
15
+ /**
16
+ * Realtime upload progress report. `total` is omitted for streaming bodies of
17
+ * unknown length. The optional `key` is set on the bulk array form so a single
18
+ * callback can drive a multi-row UI.
19
+ */
20
+ interface UploadProgress {
21
+ key?: string;
22
+ loaded: number;
23
+ total?: number;
24
+ }
25
+ type UploadProgressCallback = (event: UploadProgress) => void;
26
+ /**
27
+ * Multipart tuning for {@link Files.upload}. `true` enables multipart with
28
+ * adapter defaults; an object lets the caller tune the per-part size and the
29
+ * number of parts uploaded in parallel.
30
+ */
31
+ interface MultipartOptions {
32
+ /** In-flight parts. Adapter-defined default. */
33
+ concurrency?: number;
34
+ /** Per-part size in bytes. Adapter-defined default. */
35
+ partSize?: number;
36
+ }
37
+ interface UploadOptions {
38
+ contentType?: string;
39
+ metadata?: Record<string, unknown>;
40
+ /**
41
+ * Enable multipart/chunked upload for large bodies. `true` uses the
42
+ * adapter's defaults; pass an object to tune. Adapters that don't have a
43
+ * multipart primitive ignore this option.
44
+ */
45
+ multipart?: MultipartOptions | boolean;
46
+ /**
47
+ * Realtime progress reporter. For buffered bodies a coarse start/done pair
48
+ * is emitted. For streaming bodies each chunk is reported as it leaves the
49
+ * facade. Adapters that report progress natively (`reportsUploadProgress`)
50
+ * supersede this with byte-accurate events. A throwing callback can never
51
+ * fail the upload — exceptions are swallowed.
52
+ */
53
+ onProgress?: UploadProgressCallback;
54
+ /**
55
+ * Explicit byte length. Required for {@link NodeJS.ReadableStream} and Web `ReadableStream`
56
+ * inputs because their length is not derivable from the value itself; ignored otherwise.
57
+ */
58
+ size?: number;
59
+ storageClass?: string;
60
+ }
61
+ interface SignedReadUrlOptions {
62
+ expiresIn?: number;
63
+ responseContentDisposition?: string;
64
+ responseContentType?: string;
65
+ }
66
+ interface SignedUploadUrlOptions {
67
+ contentLength?: number;
68
+ contentType?: string;
69
+ expiresIn?: number;
70
+ }
71
+ interface ListOptions {
72
+ limit?: number;
73
+ prefix?: string;
74
+ }
75
+ interface ListAllOptions {
76
+ /** Per-page size requested from the adapter. */
77
+ limit?: number;
78
+ prefix?: string;
79
+ }
80
+ interface DownloadOptions extends OperationOptions {
81
+ /**
82
+ * Fetch a contiguous byte slice instead of the whole object. Throws
83
+ * `METHOD_NOT_ALLOWED` when the underlying adapter has `supportsRange =
84
+ * false`, so the bandwidth saving is never silently lost client-side.
85
+ */
86
+ range?: DownloadRange;
87
+ }
88
+ /**
89
+ * Provider-agnostic metadata-only view of an object.
90
+ */
91
+ interface FileObject {
92
+ contentType: string;
93
+ etag?: string;
94
+ key: string;
95
+ lastModified?: Date | number | string;
96
+ metadata?: Record<string, unknown>;
97
+ size?: number;
98
+ }
99
+ interface DownloadResult extends FileObject {
100
+ body: Buffer;
101
+ }
102
+ /**
103
+ * Caller-facing event for {@link FilesOptions.hooks}. Mirrors what runs through
104
+ * the facade (the public `key`/`keys` and the operation type) without leaking
105
+ * adapter internals.
106
+ */
107
+ interface HookEvent {
108
+ durationMs?: number;
109
+ error?: Error;
110
+ /** Source key for `copy`/`move`. */
111
+ from?: string;
112
+ key?: string;
113
+ keys?: string[];
114
+ /** Destination key for `copy`/`move`. */
115
+ to?: string;
116
+ type: HookActionType;
117
+ }
118
+ type HookActionType = "copy" | "delete" | "download" | "exists" | "head" | "list" | "listAll" | "move" | "signedUploadUrl" | "transfer" | "upload" | "url";
119
+ /**
120
+ * Lifecycle hooks observed by the Files facade. Every hook is fire-and-forget —
121
+ * called, not awaited — and exceptions are swallowed so a hook can never fail
122
+ * the operation it observes.
123
+ */
124
+ interface FilesHooks {
125
+ /** Called once per successful operation, with timing and result keys. */
126
+ onAction?: (event: HookEvent) => void;
127
+ /** Called once per failed operation, with the error attached. */
128
+ onError?: (event: HookEvent & {
129
+ error: Error;
130
+ }) => void;
131
+ /**
132
+ * Called when the underlying adapter retries an operation. Receives the
133
+ * attempt number (1-based) and the error that triggered the retry.
134
+ */
135
+ onRetry?: (event: HookEvent & {
136
+ attempt: number;
137
+ error: Error;
138
+ }) => void;
139
+ }
140
+ interface FilesOptions<TStorage extends BaseStorage = BaseStorage> {
141
+ adapter: TStorage;
142
+ /**
143
+ * Default {@link OperationOptions} (`signal`, `timeout`, `retries`) merged into every call.
144
+ * Per-call overrides win. The `signal` is combined with any per-call `signal` via
145
+ * `AbortSignal.any`, so either one aborts the operation.
146
+ */
147
+ defaults?: OperationOptions;
148
+ /**
149
+ * Lifecycle hooks observed by every operation. Fire-and-forget — a throwing
150
+ * hook is silently swallowed and never fails the call it observes.
151
+ */
152
+ hooks?: FilesHooks;
153
+ /**
154
+ * Namespace every key under this prefix. Reads, writes, copies, listings, URLs, and signed
155
+ * uploads all resolve keys as `${prefix}/${key}`; returned keys (including from `list()`) have
156
+ * the prefix stripped back off. Leading/trailing slashes are normalized so `"/users/"` and
157
+ * `"users"` behave identically.
158
+ *
159
+ * `list()` scopes results on a path boundary, so `prefix: "users"` never matches the sibling
160
+ * `users-archive/`.
161
+ */
162
+ prefix?: string;
163
+ }
164
+ /**
165
+ * One item in a bulk upload call.
166
+ */
167
+ interface BulkUploadItem extends UploadOptions {
168
+ body: FileBody;
169
+ key: string;
170
+ }
171
+ /**
172
+ * Per-call options shared by every bulk method (`upload`, `download`, `head`, `exists`, `delete`).
173
+ */
174
+ interface BulkOptions extends OperationOptions {
175
+ /**
176
+ * Maximum number of in-flight operations.
177
+ * @default 8
178
+ */
179
+ concurrency?: number;
180
+ /**
181
+ * When `true`, stop dispatching new operations as soon as one fails. The already-issued
182
+ * operations still complete. Defaults to `false`: every key is attempted and per-key failures
183
+ * are collected in `errors`.
184
+ * @default false
185
+ */
186
+ stopOnError?: boolean;
187
+ }
188
+ interface BulkDownloadOptions extends BulkOptions {
189
+ range?: DownloadRange;
190
+ }
191
+ interface BulkUploadOptions extends BulkOptions {
192
+ multipart?: MultipartOptions | boolean;
193
+ onProgress?: UploadProgressCallback;
194
+ }
195
+ interface BulkError {
196
+ error: Error;
197
+ key: string;
198
+ }
199
+ interface BulkUploadResult {
200
+ errors?: BulkError[];
201
+ uploaded: FileObject[];
202
+ }
203
+ interface BulkDownloadResult {
204
+ downloaded: DownloadResult[];
205
+ errors?: BulkError[];
206
+ }
207
+ interface BulkHeadResult {
208
+ errors?: BulkError[];
209
+ files: FileObject[];
210
+ }
211
+ interface BulkExistsResult {
212
+ errors?: BulkError[];
213
+ existing: string[];
214
+ missing: string[];
215
+ }
216
+ interface BulkDeleteResult {
217
+ deleted: string[];
218
+ errors?: BulkError[];
219
+ }
220
+ interface BulkMoveItem {
221
+ from: string;
222
+ to: string;
223
+ }
224
+ interface BulkMoveResult {
225
+ errors?: BulkError[];
226
+ moved: FileObject[];
227
+ }
228
+ /**
229
+ * Provider-agnostic facade over a {@link BaseStorage} instance.
230
+ *
231
+ * Provides a small, consistent surface (`upload`, `download`, `head`, `exists`, `delete`, `copy`,
232
+ * `move`, `list`, `listAll`, `url`, `signedUploadUrl`) and a `raw` escape hatch to the adapter's native
233
+ * client. A separate {@link transfer} top-level export streams every object from one Files instance
234
+ * to another for cross-provider migration.
235
+ *
236
+ * Each operation accepts per-call `signal`, `timeout`, and `retries` via {@link OperationOptions};
237
+ * defaults set on the constructor are merged in (per-call wins). Single-key methods also accept an
238
+ * array of keys (or {@link BulkUploadItem}s for `upload`) to run a bounded-concurrency batch and
239
+ * return a structured `{ ..., errors? }` result instead of throwing on partial failure.
240
+ *
241
+ * When constructed with a `prefix`, every key is resolved relative to the prefix and the prefix is
242
+ * stripped back off the keys returned in results — application code works in its own namespace.
243
+ *
244
+ * Pass `hooks: { onAction, onError, onRetry }` to observe activity. Hooks are fire-and-forget and
245
+ * never fail the operation they observe.
246
+ * @example
247
+ * ```ts
248
+ * import { Files, S3Storage } from "@visulima/storage";
249
+ *
250
+ * const files = new Files({
251
+ * adapter: new S3Storage({ bucket: "uploads", region: "us-east-1" }),
252
+ * prefix: "users",
253
+ * defaults: { timeout: 30_000 },
254
+ * hooks: { onAction: (event) => console.log(event.type, event.key) },
255
+ * });
256
+ *
257
+ * await files.upload("123/avatar.png", buffer, { contentType: "image/png" });
258
+ * const head = await files.head("123/avatar.png");
259
+ * for await (const file of files.listAll({ prefix: "123/" })) {
260
+ * console.log(file.key, file.size);
261
+ * }
262
+ * ```
263
+ */
264
+ declare class Files<TStorage extends BaseStorage = BaseStorage> {
265
+ readonly adapter: TStorage;
266
+ private readonly defaults;
267
+ private readonly hooks;
268
+ private readonly prefix;
269
+ constructor(options: FilesOptions<TStorage>);
270
+ /**
271
+ * Escape hatch to the adapter's native client (S3Client, BlobServiceClient, ...).
272
+ * Typed via the `TStorage` parameter, so pinning the adapter type at construction yields a
273
+ * typed view of the native client. Returns `undefined` when the adapter has no native client
274
+ * (e.g. DiskStorage).
275
+ */
276
+ get raw(): TStorage["raw"];
277
+ /** Resolve a caller-supplied key into the underlying storage key. */
278
+ private resolveKey;
279
+ /**
280
+ * Strip the constructor prefix off a key returned by the adapter. Returns `null` when the key
281
+ * is outside the prefix or is the bare prefix itself (used to filter `list()` results on a path
282
+ * boundary and drop any synthetic directory entry the adapter may emit).
283
+ */
284
+ private stripPrefix;
285
+ /**
286
+ * Merge constructor defaults with per-call options. When `hooks.onRetry` is configured,
287
+ * fold a wrapped `onRetry` into the per-call retry config so the hook fires with
288
+ * facade-level context (type, key, from/to) for each retry attempt the adapter performs.
289
+ */
290
+ private mergeOptions;
291
+ private emitAction;
292
+ private emitError;
293
+ private withHooks;
294
+ /**
295
+ * Upload a single object, or — when passed an array of {@link BulkUploadItem}s — bulk-upload
296
+ * many in one call with bounded concurrency.
297
+ */
298
+ upload(key: string, body: FileBody, options?: OperationOptions & UploadOptions): Promise<FileObject>;
299
+ upload(items: BulkUploadItem[], options?: BulkUploadOptions): Promise<BulkUploadResult>;
300
+ private uploadOne;
301
+ private uploadMany;
302
+ /**
303
+ * Download a single object, or — when passed an array of keys — bulk-download many in one
304
+ * call with bounded concurrency.
305
+ */
306
+ download(key: string, options?: DownloadOptions): Promise<DownloadResult>;
307
+ download(keys: string[], options?: BulkDownloadOptions): Promise<BulkDownloadResult>;
308
+ private assertRangeSupported;
309
+ private downloadOne;
310
+ private downloadMany;
311
+ /**
312
+ * Fetch metadata for a single object, or — when passed an array of keys — bulk-head many in
313
+ * one call with bounded concurrency.
314
+ */
315
+ head(key: string, options?: OperationOptions): Promise<FileObject>;
316
+ head(keys: string[], options?: BulkOptions): Promise<BulkHeadResult>;
317
+ private headOne;
318
+ private headMany;
319
+ /**
320
+ * Resolves to `true`/`false` for a single key, or — when passed an array — splits the keys
321
+ * into `existing` and `missing` arrays. Hard errors (auth, transport) are reported in
322
+ * `errors`. Never throws for a missing object.
323
+ */
324
+ exists(key: string, options?: OperationOptions): Promise<boolean>;
325
+ exists(keys: string[], options?: BulkOptions): Promise<BulkExistsResult>;
326
+ private existsOne;
327
+ private existsMany;
328
+ /**
329
+ * Delete a single object (resolves to `void`, throws on failure), or — when passed an array
330
+ * of keys — delete many in one call. Adapters with a native bulk-delete primitive (S3's
331
+ * `DeleteObjects`, Supabase's `remove`, UploadThing's `deleteFiles`) use it via
332
+ * {@link BaseStorage.deleteBatch}; otherwise the keys are fanned out with bounded concurrency.
333
+ */
334
+ delete(key: string, options?: OperationOptions): Promise<void>;
335
+ delete(keys: string[], options?: BulkOptions): Promise<BulkDeleteResult>;
336
+ private deleteOne;
337
+ private deleteMany;
338
+ /**
339
+ * Copy `source` to `destination` (both resolved under any constructor prefix). Returns the
340
+ * destination object's metadata with the caller-facing (un-prefixed) key.
341
+ */
342
+ copy(source: string, destination: string, options?: OperationOptions & {
343
+ storageClass?: string;
344
+ }): Promise<FileObject>;
345
+ /**
346
+ * Rename `source` to `destination`. Uses the adapter's native rename where one exists
347
+ * (DiskStorage atomic move, Cloudinary server-side rename) and falls back to
348
+ * `copy` + `delete` otherwise. Moving a key onto itself is a no-op. Also accepts an array of
349
+ * `{ from, to }` items for bounded-concurrency bulk moves; per-item failures land in `errors`.
350
+ */
351
+ move(from: string, to: string, options?: OperationOptions & {
352
+ storageClass?: string;
353
+ }): Promise<FileObject>;
354
+ move(items: BulkMoveItem[], options?: BulkOptions): Promise<BulkMoveResult>;
355
+ private moveOne;
356
+ private moveMany;
357
+ /**
358
+ * List objects in the bucket. Returned keys have any constructor prefix stripped off, and
359
+ * keys outside the prefix namespace (e.g. `users-archive/` when prefix is `users`) are filtered
360
+ * out. The optional `prefix` filter is interpreted *relative to the constructor prefix*.
361
+ *
362
+ * **Caveat with constructor prefix**: `limit` is applied by the underlying adapter *before*
363
+ * the path-boundary filter runs, so the returned array may contain fewer than `limit` items
364
+ * even when more in-namespace objects exist. Use {@link Files.listAll} when you need every
365
+ * in-namespace object.
366
+ */
367
+ list(options?: ListOptions & OperationOptions): Promise<FileObject[]>;
368
+ /**
369
+ * Walk every object in the bucket. Yields one {@link FileObject} at a time as an async
370
+ * iterable; pages internally so callers don't have to thread a cursor. Returned keys have any
371
+ * constructor prefix stripped off and out-of-namespace keys are filtered out, just like
372
+ * {@link Files.list}.
373
+ *
374
+ * Most adapters return all objects in a single `list()` call (the default `limit` is 1000),
375
+ * so this is effectively `list` + iteration for them. Adapters that paginate natively can
376
+ * override `list` to honour the per-page `limit` and `listAll` will keep pulling pages until
377
+ * the page is short.
378
+ *
379
+ * @example
380
+ * ```ts
381
+ * for await (const file of files.listAll({ prefix: "avatars/" })) {
382
+ * console.log(file.key, file.size);
383
+ * }
384
+ * ```
385
+ */
386
+ listAll(options?: ListAllOptions & OperationOptions): AsyncGenerator<FileObject, void, void>;
387
+ url(key: string, options?: OperationOptions & SignedReadUrlOptions): Promise<string>;
388
+ signedUploadUrl(key: string, options?: OperationOptions & SignedUploadUrlOptions): Promise<string>;
389
+ }
390
+ /**
391
+ * Per-key event reported to {@link TransferOptions.onProgress}.
392
+ */
393
+ interface TransferProgress {
394
+ /** 1-based index of the current key in walk order. */
395
+ done: number;
396
+ error?: Error;
397
+ key: string;
398
+ status: "errored" | "skipped" | "transferred";
399
+ }
400
+ interface TransferOptions extends OperationOptions {
401
+ /**
402
+ * In-flight key transfers.
403
+ * @default 8
404
+ */
405
+ concurrency?: number;
406
+ /** Per-page size requested from the source adapter while walking. */
407
+ limit?: number;
408
+ /** Fire-and-forget progress reporter. Throws are swallowed. */
409
+ onProgress?: (event: TransferProgress) => void;
410
+ /**
411
+ * When `true`, the first failing transfer rejects {@link transfer} instead of being
412
+ * collected in `errors`.
413
+ * @default false
414
+ */
415
+ stopOnError?: boolean;
416
+ /** Transform each source key into the destination key. Defaults to identity. */
417
+ transformKey?: (key: string) => string;
418
+ /**
419
+ * When `false`, skip keys that already exist at the destination. When `true`, always upload.
420
+ * @default false
421
+ */
422
+ overwrite?: boolean;
423
+ /** Restrict the walk to this prefix on the source. */
424
+ prefix?: string;
425
+ }
426
+ interface TransferResult {
427
+ errors?: BulkError[];
428
+ skipped: string[];
429
+ transferred: string[];
430
+ }
431
+ /**
432
+ * Streams every object from `source` to `destination` for cross-provider migration.
433
+ * Built entirely on the public {@link Files} surface — no adapter implements anything new.
434
+ *
435
+ * Each object is downloaded and re-uploaded with bounded concurrency. By default missing
436
+ * destination keys are uploaded and existing keys are skipped — pass `overwrite: true` to force
437
+ * re-upload. Body, content type, and user metadata travel; `etag`/`lastModified` are
438
+ * destination-assigned.
439
+ *
440
+ * Like the other bulk methods, `transfer` doesn't throw on partial failure: results come back as
441
+ * `{ transferred, skipped, errors? }`.
442
+ *
443
+ * @example
444
+ * ```ts
445
+ * const from = new Files({ adapter: new S3Storage({ bucket: "old", ... }) });
446
+ * const to = new Files({ adapter: new GCSStorage({ bucket: "new", ... }) });
447
+ *
448
+ * const { transferred, skipped, errors } = await transfer(from, to, {
449
+ * prefix: "uploads/",
450
+ * onProgress: ({ done, key, status }) => console.log(done, key, status),
451
+ * });
452
+ * ```
453
+ */
454
+ declare const transfer: (source: Files, destination: Files, options?: TransferOptions) => Promise<TransferResult>;
455
+ export { BulkDeleteResult as B, DownloadOptions as D, Files as F, HookActionType as H, ListAllOptions as L, MultipartOptions as M, SignedReadUrlOptions as S, TransferOptions as T, UploadOptions as U, BulkDownloadOptions as a, BulkDownloadResult as b, BulkError as c, BulkExistsResult as d, BulkHeadResult as e, BulkMoveItem as f, BulkMoveResult as g, BulkOptions as h, BulkUploadItem as i, BulkUploadOptions as j, BulkUploadResult as k, DownloadRange as l, DownloadResult as m, FileBody as n, FileObject as o, FilesHooks as p, FilesOptions as q, HookEvent as r, ListOptions as s, SignedUploadUrlOptions as t, TransferProgress as u, TransferResult as v, UploadProgress as w, UploadProgressCallback as x, transfer as y };
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var E=(e,t)=>b(e,"name",{value:t,configurable:!0});var p=Object.defineProperty,u=E((e,t)=>p(e,"name",{value:t,configurable:!0}),"u");const l={backoffMultiplier:2,calculateDelay:void 0,initialDelay:1e3,maxDelay:3e4,maxRetries:3,retryableStatusCodes:[408,429,500,502,503,504],shouldRetry:u(()=>!1,"shouldRetry")},h=u((e,t,r,o)=>{const a=Math.min(t*r**e,o);return Math.floor(Math.random()*a)},"calculateExponentialBackoff"),D=u(e=>new Promise(t=>{setTimeout(t,e)}),"sleep"),C=u((e,t=l.retryableStatusCodes)=>{if(e instanceof Error){const r=e.code,o=e.name;if(o==="AbortError"||r==="ABORT_ERR")return!1;if(r==="ECONNRESET"||r==="ETIMEDOUT"||r==="ENOTFOUND"||r==="ECONNREFUSED"||r==="EAI_AGAIN"||o==="NetworkError"||o==="TimeoutError")return!0;const a=e;if(a.$metadata){const c=a.$metadata.httpStatusCode;if(c&&t.includes(c)||a.$fault==="server")return!0}if(a.statusCode&&t.includes(a.statusCode))return!0;const{retryable:n}=a;return n===!0||typeof n=="string"&&n==="true"}return!1},"isRetryableError"),x=u(async(e,t={})=>{const{backoffMultiplier:r=l.backoffMultiplier,calculateDelay:o=l.calculateDelay,initialDelay:a=l.initialDelay,maxDelay:n=l.maxDelay,maxRetries:c=l.maxRetries,onRetry:f,retryableStatusCodes:R=l.retryableStatusCodes,shouldRetry:m=l.shouldRetry}=t;let d;for(let i=0;i<=c;i+=1)try{return await e()}catch(s){if(d=s,i>=c)break;if(!(m(s)||C(s,R)))throw s;const y=o?o(i,s):h(i,a,r,n);if(f)try{f(i+1,s)}catch{}y!==void 0&&y>0&&await D(y)}throw d},"retry"),M=u((e={})=>t=>x(t,e),"createRetryWrapper");export{M as createRetryWrapper,C as isRetryableError,x as retry};
@@ -0,0 +1 @@
1
+ var kr=Object.defineProperty;var h=(e,t)=>kr(e,"name",{value:t,configurable:!0});import{utimes as _r}from"node:fs/promises";import{tmpdir as Ar}from"node:os";import{createRequire as R}from"node:module";import{L as _e,M as Tr}from"./path-D7rMc9nq-CPbxyMDy.js";import{throwErrorCode as ne,ERRORS as oe}from"./ERRORS-CyOuSMLY.js";import Br from"./MetaStorage-Y4m1dWgd.js";import{stringifyMetadata as Rr,parseMetadata as Sr}from"./Metadata-B6Ir0KO7.js";const ie=0,Fr=4;var Ir=Object.defineProperty,Nr=h((e,t)=>Ir(e,"name",{value:t,configurable:!0}),"t$6"),Lr=Object.defineProperty,Cr=Nr((e,t)=>Lr(e,"name",{value:t,configurable:!0}),"t"),Dr=Object.defineProperty,Wr=Cr((e,t)=>Dr(e,"name",{value:t,configurable:!0}),"n");const G=Wr(e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var Ur=Object.defineProperty,qr=h((e,t)=>Ur(e,"name",{value:t,configurable:!0}),"i$8"),Zr=Object.defineProperty,Vr=qr((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"r"),Gr=Object.defineProperty,Jr=Vr((e,t)=>Gr(e,"name",{value:t,configurable:!0}),"i");const Ae=Jr(e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},"getFileInfoType");var Xr=Object.defineProperty,Yr=h((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"i$7"),Hr=Object.defineProperty,Le=Yr((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"s");const Kr=R(import.meta.url),C=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qr=Le(e=>{if(typeof C<"u"&&C.versions&&C.versions.node){const[t,o]=C.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return C.getBuiltinModule(e)}return Kr(e)},"__cjs_getBuiltinModule"),{lstat:Te,mkdir:en}=Qr("node:fs/promises");var tn=Object.defineProperty,rn=Le((e,t)=>tn(e,"name",{value:t,configurable:!0}),"o");const nn=rn(async e=>{G(e);try{const t=await Te(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(Ae(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{await en(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const o=await Te(e);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(Ae(o))}'`,{cause:t})}},"ensureDir");var on=Object.defineProperty,c=h((e,t)=>on(e,"name",{value:t,configurable:!0}),"s$4");let Be=c(()=>{var e=(()=>{var t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=c((r,n)=>{for(var a in n)t(r,a,{get:n[a],enumerable:!0})},"ne"),y=c((r,n,a,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of l(n))!d.call(r,s)&&s!==a&&t(r,s,{get:c(()=>n[s],"get"),enumerable:!(i=o(n,s))||i.enumerable});return r},"ae"),v=c(r=>y(t({},"__esModule",{value:!0}),r),"oe"),k={};m(k,{zeptomatch:c(()=>ke,"zeptomatch")});var S=c(r=>{const n=new Set,a=[r];for(let i=0;i<a.length;i++){const s=a[i];if(n.has(s))continue;n.add(s);const{children:u}=s;if(u?.length)for(let f=0,g=u.length;f<g;f++)a.push(u[f])}return Array.from(n)},"M"),J=c(r=>{let n="";const a=S(r);for(let i=0,s=a.length;i<s;i++){const u=a[i];if(!u.regex)continue;const f=u.regex.flags;if(n||(n=f),n!==f)throw new Error(`Inconsistent RegExp flags used: "${n}" and "${f}"`)}return n},"se"),fe=c((r,n,a)=>{const i=a.get(r);if(i!==void 0)return i;const s=r.partial??n;let u="";if(r.regex&&(u+=s?"(?:$|":"",u+=r.regex.source),r.children?.length){const f=ot(r.children.map(g=>fe(g,n,a)).filter(Boolean));if(f?.length){const g=r.children.some(N=>!N.regex||!(N.partial??n)),$=f.length>1||s&&(!u.length||g);u+=$?s?"(?:$|":"(?:":"",u+=f.join("|"),u+=$?")":""}}return r.regex&&(u+=s?")":""),a.set(r,u),u},"O"),nt=c((r,n)=>{const a=new Map,i=S(r);for(let s=i.length-1;s>=0;s--){const u=fe(i[s],n,a);if(!(s>0))return u}return""},"ie"),ot=c(r=>Array.from(new Set(r)),"ue"),H=c((r,n,a)=>H.compile(r,a).test(n),"R");H.compile=(r,n)=>{const a=n?.partial??!1,i=nt(r,a),s=J(r);return new RegExp(`^(?:${i})$`,s)};var at=H,st=c((r,n)=>{const a=at.compile(r,n),i=`${a.source.slice(0,-1)}[\\\\/]?$`,s=a.flags;return new RegExp(i,s)},"le"),it=st,lt=c(r=>{const n=r.map(i=>i.source).join("|")||"$^",a=r[0]?.flags;return new RegExp(n,a)},"ve"),ct=lt,pe=c(r=>Array.isArray(r),"j"),F=c(r=>typeof r=="function","_"),ut=c(r=>r.length===0,"he"),ft=(()=>{const{toString:r}=Function.prototype,n=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return a=>(a.length===0||a.length===1)&&n.test(r.call(a))})(),pt=c(r=>typeof r=="number","de"),dt=c(r=>typeof r=="object"&&r!==null,"xe"),gt=c(r=>r instanceof RegExp,"me"),mt=(()=>{const r=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return n=>r.test(n.source)})(),ht=(()=>{const r=/^[a-zA-Z0-9_-]+$/;return n=>r.test(n.source)&&!n.flags.includes("i")})(),de=c(r=>typeof r=="string","A"),P=c(r=>r===void 0,"f"),bt=c(r=>{const n=new Map;return a=>{const i=n.get(a);if(i!==void 0)return i;const s=r(a);return n.set(a,s),s}},"ye"),ge=c((r,n,a={})=>{const i={cache:{},input:r,index:0,indexBacktrackMax:0,options:a,output:[]},s=E(n)(i),u=Math.max(i.index,i.indexBacktrackMax);if(s&&i.index===r.length)return i.output;throw new Error(`Failed to parse at index ${u}`)},"I"),p=c((r,n)=>pe(r)?$t(r,n):de(r)?me(r,n):vt(r,n),"i"),$t=c((r,n)=>{const a={};for(const i of r){if(i.length!==1)throw new Error(`Invalid character: "${i}"`);const s=i.charCodeAt(0);a[s]=!0}return i=>{const s=i.input;let u=i.index,f=u;for(;f<s.length&&s.charCodeAt(f)in a;)f+=1;if(f>u){if(!P(n)&&!i.options.silent){const g=s.slice(u,f),$=F(n)?n(g,s,`${u}`):n;P($)||i.output.push($)}i.index=f}return!0}},"we"),vt=c((r,n)=>{if(ht(r))return me(r.source,n);{const a=r.source,i=r.flags.replace(/y|$/,"y"),s=new RegExp(a,i);return mt(r)&&F(n)&&!ft(n)?yt(s,n):wt(s,n)}},"$e"),yt=c((r,n)=>a=>{const i=a.index,s=a.input;r.lastIndex=i;const u=r.exec(s);if(u){const f=r.lastIndex;if(!a.options.silent){const g=n(...u,s,`${i}`);P(g)||a.output.push(g)}return a.index=f,!0}else return!1},"Ee"),wt=c((r,n)=>a=>{const i=a.index,s=a.input;if(r.lastIndex=i,r.test(s)){const u=r.lastIndex;if(!P(n)&&!a.options.silent){const f=F(n)?n(s.slice(i,u),s,`${i}`):n;P(f)||a.output.push(f)}return a.index=u,!0}else return!1},"Ce"),me=c((r,n)=>a=>{const i=a.index,s=a.input;if(s.startsWith(r,i)){if(!P(n)&&!a.options.silent){const u=F(n)?n(r,s,`${i}`):n;P(u)||a.output.push(u)}return a.index+=r.length,!0}else return!1},"F"),K=c((r,n,a,i)=>{const s=E(r),u=n>1;return ee(Q(be(f=>{let g=0;for(;g<a;){const $=f.index;if(!s(f)||(g+=1,f.index===$))break}return g>=n},u),i))},"k"),he=c((r,n)=>K(r,0,1,n),"L"),X=c((r,n)=>K(r,0,1/0,n),"$"),xt=c((r,n)=>K(r,1,1/0,n),"Re"),A=c((r,n)=>{const a=r.map(E);return ee(Q(be(i=>{for(let s=0,u=a.length;s<u;s++)if(!a[s](i))return!1;return!0}),n))},"x"),x=c((r,n)=>{const a=r.map(E);return ee(Q(i=>{for(let s=0,u=a.length;s<u;s++)if(a[s](i))return!0;return!1},n))},"p"),be=c((r,n=!0,a=!1)=>{const i=E(r);return n?s=>{const u=s.index,f=s.output.length,g=i(s);return!g&&!a&&(s.indexBacktrackMax=Math.max(s.indexBacktrackMax,s.index)),(!g||a)&&(s.index=u,s.output.length!==f&&(s.output.length=f)),g}:i},"q"),Q=c((r,n)=>{const a=E(r);return n?i=>{if(i.options.silent)return a(i);const s=i.output.length;if(a(i)){const u=i.output.splice(s,1/0),f=n(u);return P(f)||i.output.push(f),!0}else return!1}:a},"B"),ee=(()=>{let r=0;return n=>{const a=E(n),i=r+=1;return s=>{var u;if(s.options.memoization===!1)return a(s);const f=s.index,g=(u=s.cache)[i]||(u[i]={indexMax:-1,queue:[]}),$=g.queue;if(f<=g.indexMax){const L=g.store||(g.store=new Map);if($.length){for(let B=0,Er=$.length;B<Er;B+=2){const Mr=$[B*2],zr=$[B*2+1];L.set(Mr,zr)}$.length=0}const j=L.get(f);if(j===!1)return!1;if(pt(j))return s.index=j,!0;if(j)return s.index=j.index,j.output?.length&&s.output.push(...j.output),!0}const N=s.output.length,Pr=a(s);if(g.indexMax=Math.max(g.indexMax,f),Pr){const L=s.index,j=s.output.length;if(j>N){const B=s.output.slice(N,j);$.push(f,{index:L,output:B})}else $.push(f,L);return!0}else return $.push(f,!1),!1}}})(),$e=c(r=>{let n;return a=>(n||(n=E(r())),n(a))},"G"),E=bt(r=>{if(F(r))return ut(r)?$e(r):r;if(de(r)||gt(r))return p(r);if(pe(r))return A(r);if(dt(r))return x(Object.values(r));throw new Error("Invalid rule")}),_=c(r=>r,"d"),jt=c(r=>typeof r=="string","ke"),Ot=c(r=>{const n=new WeakMap,a=new WeakMap;return(i,s)=>{const u=s?.partial?a:n,f=u.get(i);if(f!==void 0)return f;const g=r(i,s);return u.set(i,g),g}},"Be"),Pt=c(r=>{const n={},a={};return(i,s)=>{const u=s?.partial?a:n;return u[i]??(u[i]=r(i,s))}},"Pe"),Et=p(/\\./,_),Mt=p(/./,_),zt=p(/\*\*\*+/,"*"),kt=p(/([^/{[(!])\*\*/,(r,n)=>`${n}*`),_t=p(/(^|.)\*\*(?=[^*/)\]}])/,(r,n)=>`${n}*`),At=X(x([Et,zt,kt,_t,Mt])),Tt=At,Bt=c(r=>ge(r,Tt,{memoization:!1}).join(""),"Ie"),Rt=Bt,ve="abcdefghijklmnopqrstuvwxyz",St=c(r=>{let n="";for(;r>0;){const a=(r-1)%26;n=ve[a]+n,r=Math.floor((r-1)/26)}return n},"Le"),ye=c(r=>{let n=0;for(let a=0,i=r.length;a<i;a++)n=n*26+ve.indexOf(r[a])+1;return n},"V"),te=c((r,n)=>{if(n<r)return te(n,r);const a=[];for(;r<=n;)a.push(r++);return a},"b"),Ft=c((r,n,a)=>te(r,n).map(i=>String(i).padStart(a,"0")),"qe"),we=c((r,n)=>te(ye(r),ye(n)).map(St),"W"),b=c(r=>({partial:!1,regex:new RegExp(r,"s"),children:[]}),"c"),I=c(r=>({children:r}),"y"),T=(()=>{const r=c((n,a,i)=>{if(i.has(n))return;i.add(n);const{children:s}=n;if(!s.length)s.push(a);else for(let u=0,f=s.length;u<f;u++)r(s[u],a,i)},"e");return n=>{if(!n.length)return I([]);for(let a=n.length-1;a>=1;a--){const i=new Set,s=n[a-1],u=n[a];r(s,u,i)}return n[0]}})(),M=c(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),It=p(/\\./,b),Nt=p(/[$.*+?^(){}[\]\|]/,r=>b(`\\${r}`)),Lt=p(/[\\\/]/,M),Ct=p(/[^$.*+?^(){}[\]\|\\\/]+/,b),Dt=p(/^(?:!!)*!(.*)$/,(r,n)=>b(`(?!^${ke.compile(n).source}$).*?`)),Wt=p(/^(!!)+/),Ut=x([Dt,Wt]),qt=p(/\/(\*\*\/)+/,()=>I([T([M(),b(".+?"),M()]),M()])),Zt=p(/^(\*\*\/)+/,()=>I([b("^"),T([b(".*?"),M()])])),Vt=p(/\/(\*\*)$/,()=>I([T([M(),b(".*?")]),b("$")])),Gt=p(/\*\*/,()=>b(".*?")),xe=x([qt,Zt,Vt,Gt]),Jt=p(/\*\/(?!\*\*\/|\*$)/,()=>T([b("[^\\\\/]*?"),M()])),Xt=p(/\*/,()=>b("[^\\\\/]*")),je=x([Jt,Xt]),Oe=p("?",()=>b("[^\\\\/]")),Yt=p("[",_),Ht=p("]",_),Kt=p(/[!^]/,"^\\\\/"),Qt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,_),er=p(/\\./,_),tr=p(/[$.*+?^(){}[\|]/,r=>`\\${r}`),rr=p(/[\\\/]/,"\\\\/"),nr=p(/[^$.*+?^(){}[\]\|\\\/]+/,_),or=x([er,tr,rr,Qt,nr]),Pe=A([Yt,he(Kt),X(or),Ht],r=>b(r.join(""))),ar=p("{","(?:"),sr=p("}",")"),ir=p(/(\d+)\.\.(\d+)/,(r,n,a)=>Ft(+n,+a,Math.min(n.length,a.length)).join("|")),lr=p(/([a-z]+)\.\.([a-z]+)/,(r,n,a)=>we(n,a).join("|")),cr=p(/([A-Z]+)\.\.([A-Z]+)/,(r,n,a)=>we(n.toLowerCase(),a.toLowerCase()).join("|").toUpperCase()),ur=x([ir,lr,cr]),Ee=A([ar,ur,sr],r=>b(r.join(""))),fr=p("{"),pr=p("}"),dr=p(","),gr=p(/\\./,b),mr=p(/[$.*+?^(){[\]\|]/,r=>b(`\\${r}`)),hr=p(/[\\\/]/,M),br=p(/[^$.*+?^(){}[\]\|\\\/,]+/,b),$r=$e(()=>ze),vr=p("",()=>b("(?:)")),yr=xt(x([xe,je,Oe,Pe,Ee,$r,gr,mr,hr,br]),T),Me=x([yr,vr]),ze=A([fr,he(A([Me,X(A([dr,Me]))])),pr],I),wr=X(x([Ut,xe,je,Oe,Pe,Ee,ze,It,Nt,Lt,Ct]),T),xr=wr,jr=c(r=>ge(r,xr,{memoization:!1})[0],"kr"),Or=jr,re=c((r,n,a)=>re.compile(r,a).test(n),"N");re.compile=(()=>{const r=Pt((a,i)=>it(Or(Rt(a)),i)),n=Ot((a,i)=>ct(a.map(s=>r(s,i))));return(a,i)=>jt(a)?r(a,i):n(a,i)})();var ke=re;return v(k)})();return e.default||e},"_lazyMatch"),ae;const an=c((e,t)=>(ae||(ae=Be(),Be=null),ae(e,t)),"zeptomatch"),sn=/^[A-Z]:\//i,O=c((e="")=>e&&e.replaceAll("\\","/").replace(sn,t=>t.toUpperCase()),"normalizeWindowsPath"),ln=/^[/\\]{2}/,cn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Ce=/^[A-Z]:$/i,Re=/^\/([A-Z]:)?$/i,un=/.(\.[^./]+)$/,fn=/^[/\\]|^[a-z]:[/\\]/i,pn=/\/$/,dn=c(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),De=c((e,t)=>{let o="",l=0,d=-1,m=0,y;for(let v=0;v<=e.length;++v){if(v<e.length)y=e[v];else{if(y==="/")break;y="/"}if(y==="/"){if(!(d===v-1||m===1))if(m===2){if(o.length<2||l!==2||!o.endsWith(".")||o.at(-2)!=="."){if(o.length>2){const k=o.lastIndexOf("/");k===-1?(o="",l=0):(o=o.slice(0,k),l=o.length-1-o.lastIndexOf("/")),d=v,m=0;continue}else if(o.length>0){o="",l=0,d=v,m=0;continue}}t&&(o+=o.length>0?"/..":"..",l=2)}else o.length>0?o+=`/${e.slice(d+1,v)}`:o=e.slice(d+1,v),l=v-d-1;d=v,m=0}else y==="."&&m!==-1?++m:m=-1}return o},"normalizeString"),V=c(e=>cn.test(e),"isAbsolute"),We=c(function(e){if(e.length===0)return".";e=O(e);const t=ln.exec(e),o=V(e),l=e.at(-1)==="/";return e=De(e,!o),e.length===0?o?"/":l?"./":".":(l&&(e+="/"),Ce.test(e)&&(e+="/"),t?o?`//${e}`:`//./${e}`:o&&!V(e)?`/${e}`:e)},"normalize"),Ue=c((...e)=>{let t="";for(const o of e)if(o)if(t.length>0){const l=t.at(-1)==="/",d=o[0]==="/";l&&d?t+=o.slice(1):t+=l||d?o:`/${o}`}else t+=o;return We(t)},"join"),le=c(function(...e){e=e.map(l=>O(l));let t="",o=!1;for(let l=e.length-1;l>=-1&&!o;l--){const d=l>=0?e[l]:dn();!d||d.length===0||(t=`${d}/${t}`,o=V(d))}return t=De(t,!o),o&&!V(t)?`/${t}`:t.length>0?t:"."},"resolve");c(function(e){return O(e)},"toNamespacedPath");const qe=c(function(e){return un.exec(O(e))?.[1]??""},"extname");c(function(e,t){const o=le(e).replace(Re,"$1").split("/"),l=le(t).replace(Re,"$1").split("/");if(l[0][1]===":"&&o[0][1]===":"&&o[0]!==l[0])return l.join("/");const d=[...o];for(const m of d){if(l[0]!==m)break;o.shift(),l.shift()}return[...o.map(()=>".."),...l].join("/")},"relative");const Ze=c(e=>{const t=O(e).replace(pn,"").split("/").slice(0,-1);return t.length===1&&Ce.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(V(e)?"/":".")},"dirname");c(function(e){const t=[e.root,e.dir,e.base??e.name+e.ext].filter(Boolean);return O(e.root?le(...t):t.join("/"))},"format");const gn=c((e,t)=>{const o=O(e).split("/").pop();return t&&o.endsWith(t)?o.slice(0,-t.length):o},"basename");c(function(e){const t=fn.exec(e)?.[0]?.replaceAll("\\","/")??"",o=gn(e),l=qe(o);return{base:o,dir:Ze(e),ext:l,name:o.slice(0,o.length-l.length),root:t}},"parse");c((e,t)=>an(t,We(e)),"matchesGlob");var mn=Object.defineProperty,w=h((e,t)=>mn(e,"name",{value:t,configurable:!0}),"i$6");const hn=R(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,bn=w(e=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[t,o]=D.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return D.getBuiltinModule(e)}return hn(e)},"__cjs_getBuiltinModule"),{fileURLToPath:$n}=bn("node:url");function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}h(Ve,"w$2");w(Ve,"getDefaultExportFromCjs");var Se,Fe;function Ge(){return Fe||(Fe=1,Se=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Se}h(Ge,"y$2");w(Ge,"requireBinaryExtensions");var vn=Ge();const yn=Ve(vn),wn=new Set(yn),xn=new Set(["/","\\",void 0]),Ie=Symbol.for("pathe:normalizedAlias"),jn=/(^|[/\\])([^/\\]+?)(?=(?:\.[^.]+)?$)/,On=w((e,t)=>t.split("/").length-e.split("/").length,"compareAliases"),Y=w((e="/")=>{const t=e.at(-1);return t==="/"||t==="\\"},"hasTrailingSlash"),Je=w(e=>{if(e[Ie])return e;const t=Object.fromEntries(Object.entries(e).toSorted(([o],[l])=>On(o,l)));for(const o in t)for(const l in t)l===o||o.startsWith(l)||t[o].startsWith(l)&&xn.has(t[o][l.length])&&(t[o]=t[l]+t[o].slice(l.length));return Object.defineProperty(t,Ie,{enumerable:!1,value:!0}),t},"normalizeAliases");w((e,t)=>{e=O(e),t=Je(t);for(const[o,l]of Object.entries(t)){if(!e.startsWith(o))continue;const d=Y(o)?o.slice(0,-1):o;if(Y(e[d.length]))return Ue(l,e.slice(o.length))}return e},"resolveAlias");w(e=>jn.exec(e)?.[2],"filename");w((e,t)=>{e=O(e),t=Je(t);for(const[o,l]of Object.entries(t).toReversed()){if(!e.startsWith(l))continue;const d=Y(l)?l.slice(0,-1):l;if(Y(e[d.length]))return Ue(o,e.slice(l.length))}return e},"reverseResolveAlias");const Pn=/^(?:\.?\.[/\\]|\.\.\B)/,En=/^(?:msys|cygwin)$/;w(e=>Pn.test(e)||e==="..","isRelative");w(e=>wn.has(qe(e).slice(1).toLowerCase()),"isBinaryPath");const ce=w(e=>O(e instanceof URL?$n(e):e),"toPath");w(()=>{if(!globalThis.process)return!1;if(globalThis.process.platform==="win32"||globalThis.process.platform==="cygwin")return!0;const e=globalThis.process.env.OSTYPE;return typeof e!="string"?!1:En.test(e)},"isWindows");var Mn=Object.defineProperty,Xe=h((e,t)=>Mn(e,"name",{value:t,configurable:!0}),"t$4"),zn=Object.defineProperty,ue=Xe((e,t)=>zn(e,"name",{value:t,configurable:!0}),"s");const kn=R(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_n=ue(e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[t,o]=W.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return W.getBuiltinModule(e)}return kn(e)},"__cjs_getBuiltinModule"),{access:An}=_n("node:fs/promises");var Tn=Object.defineProperty,Bn=ue((e,t)=>Tn(e,"name",{value:t,configurable:!0}),"o");async function z(e,t=ie){G(e),e=ce(e);try{return await An(e,t),!0}catch{return!1}}h(z,"i$5");Xe(z,"d");ue(z,"m");Bn(z,"isAccessible");var Rn=Object.defineProperty,Ye=h((e,t)=>Rn(e,"name",{value:t,configurable:!0}),"t$3"),Sn=Object.defineProperty,He=Ye((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"t"),Fn=Object.defineProperty,In=He((e,t)=>Fn(e,"name",{value:t,configurable:!0}),"o");let Nn=class extends Error{static{h(this,"c")}static{Ye(this,"i")}static{He(this,"n")}static{In(this,"PermissionError")}constructor(t){super(`EPERM: Operation not permitted, ${t}`)}get code(){return"EPERM"}set code(t){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(t){throw new Error("Cannot overwrite name of PermissionError")}};var Ln=Object.defineProperty,Cn=h((e,t)=>Ln(e,"name",{value:t,configurable:!0}),"f$4"),Dn=Object.defineProperty,Ke=Cn((e,t)=>Dn(e,"name",{value:t,configurable:!0}),"i");const Wn=R(import.meta.url),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qe=Ke(e=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[t,o]=U.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return U.getBuiltinModule(e)}return Wn(e)},"__cjs_getBuiltinModule"),{readFile:Un}=Qe("node:fs/promises"),{unzip:qn,brotliDecompress:Zn}=Qe("node:zlib");var Vn=Object.defineProperty,et=Ke((e,t)=>Vn(e,"name",{value:t,configurable:!0}),"n");const Gn={brotli:Zn,gzip:qn,none:et((e,t)=>{t(null,e)},"none")},Jn=et(async(e,t)=>{if(G(e),e=ce(e),!await z(e))throw new Nn(`unable to read the non-accessible file: ${e}`);if(!await z(e,Fr))throw new Error(`Unable to read the non-readable file: ${e}`);const{buffer:o,compression:l,encoding:d,flag:m}=t??{};return await Un(e,m?{encoding:d,flag:m}:{encoding:d}).then(async y=>await new Promise((v,k)=>{Gn[l??"none"](y,(S,J)=>{S?k(S):v(o?J:J.toString())})})).catch(y=>{throw y})},"readFile");var Xn=Object.defineProperty,Yn=h((e,t)=>Xn(e,"name",{value:t,configurable:!0}),"a$4"),Hn=Object.defineProperty,Kn=Yn((e,t)=>Hn(e,"name",{value:t,configurable:!0}),"t"),Qn=Object.defineProperty,eo=Kn((e,t)=>Qn(e,"name",{value:t,configurable:!0}),"t");const to=eo(e=>{const t={force:!0,recursive:!0};return e?.maxRetries!==void 0&&(t.maxRetries=e.maxRetries),e?.retryDelay!==void 0&&(t.retryDelay=e.retryDelay),t},"buildRmOptions");var ro=Object.defineProperty,no=h((e,t)=>ro(e,"name",{value:t,configurable:!0}),"i$2"),oo=Object.defineProperty,tt=no((e,t)=>oo(e,"name",{value:t,configurable:!0}),"s");const ao=R(import.meta.url),q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,so=tt(e=>{if(typeof q<"u"&&q.versions&&q.versions.node){const[t,o]=q.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return q.getBuiltinModule(e)}return ao(e)},"__cjs_getBuiltinModule"),{unlink:io,rm:lo}=so("node:fs/promises");var co=Object.defineProperty,uo=tt((e,t)=>co(e,"name",{value:t,configurable:!0}),"i");const fo=uo(async(e,t={})=>{G(e);try{await io(e)}catch{}try{await lo(e,to(t))}catch{}},"remove");var po=Object.defineProperty,go=h((e,t)=>po(e,"name",{value:t,configurable:!0}),"a$2"),mo=Object.defineProperty,ho=go((e,t)=>mo(e,"name",{value:t,configurable:!0}),"t"),bo=Object.defineProperty,$o=ho((e,t)=>bo(e,"name",{value:t,configurable:!0}),"e");const vo=$o(e=>{if(typeof e!="string"&&!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")},"assertValidFileContents");var yo=Object.defineProperty,wo=h((e,t)=>yo(e,"name",{value:t,configurable:!0}),"t"),xo=Object.defineProperty,jo=wo((e,t)=>xo(e,"name",{value:t,configurable:!0}),"r"),Oo=Object.defineProperty,Po=jo((e,t)=>Oo(e,"name",{value:t,configurable:!0}),"f");const Eo=new TextEncoder,Mo=Po(e=>{if(e instanceof Uint8Array)return e;if(typeof e=="string")return Eo.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")},"toUint8Array");var zo=Object.defineProperty,ko=h((e,t)=>zo(e,"name",{value:t,configurable:!0}),"m"),_o=Object.defineProperty,rt=ko((e,t)=>_o(e,"name",{value:t,configurable:!0}),"s");const Ao=R(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,To=rt(e=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[t,o]=Z.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Z.getBuiltinModule(e)}return Ao(e)},"__cjs_getBuiltinModule"),{mkdir:Bo,writeFile:Ro,stat:So,rename:Ne,chown:Fo,chmod:Io,unlink:No}=To("node:fs/promises");var Lo=Object.defineProperty,Co=rt((e,t)=>Lo(e,"name",{value:t,configurable:!0}),"d");const Do=Co(async(e,t,o)=>{o={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...o},G(e),vo(t),e=ce(e);const l=`${e}.tmp`;try{const d=await z(e,ie);if(!d&&o.recursive){const y=Ze(e);await z(y,ie)||await Bo(y,{recursive:!0})}let m;if(await Ro(l,Mo(t),{encoding:o.encoding,flag:o.flag}),d&&!o.overwrite&&(m=await So(e),o.chown??={gid:m.gid,uid:m.uid},await Ne(e,`${e}.bak`)),o.chown)try{await Fo(l,o.chown.uid,o.chown.gid)}catch{}await Io(l,m&&!o.mode?m.mode:o.mode??438),await Ne(l,e)}catch(d){throw new Error(`Failed to write file at: ${e} - ${d.message}`,{cause:d})}finally{await z(l)&&await No(`${e}.tmp`)}},"writeFile");var Wo=Object.defineProperty,se=h((e,t)=>Wo(e,"name",{value:t,configurable:!0}),"a");let Ko=class extends Br{static{h(this,"v")}static{se(this,"LocalMetaStorage")}directory;constructor(t){super(t),this.directory=_e(t?.directory||Tr(Ar(),"Upload_meta")),this.accessCheck().catch(o=>{this.logger?.error("Metadata storage access check failed: %O",o)})}getMetaPath=se(t=>{const o=_e(`${this.directory}/${this.prefix}${t}${this.suffix}`),l=this.directory.endsWith("/")?this.directory:`${this.directory}/`;return o.startsWith(l)?o:ne(oe.INVALID_FILE_NAME,`Invalid id: "${t}" resolves outside the meta directory`)},"getMetaPath");getIdFromPath=se(t=>t.slice(`${this.directory}/${this.prefix}`.length,-this.suffix.length),"getIdFromPath");async save(t,o){await this.accessCheck();const l={...o};return l.metadata&&(l.metadata=Rr(o.metadata)),await Do(this.getMetaPath(t),JSON.stringify(l),{recursive:!0}),o}async touch(t,o){const l=new Date;return await _r(this.getMetaPath(t),l,l),o}async get(t){try{const o=await Jn(this.getMetaPath(t));if(o===void 0)throw ne(oe.FILE_NOT_FOUND);const l=JSON.parse(o);return l.metadata&&typeof l.metadata=="string"&&(l.metadata=Sr(l.metadata)),l}catch(o){const l=o,d=o instanceof SyntaxError;throw l.code==="ENOENT"||d?ne(oe.FILE_NOT_FOUND):o}}async delete(t){await fo(this.getMetaPath(t))}async accessCheck(){await nn(this.directory)}};export{We as B,le as L,ce as P,Ze as V,gn as X,Ue as _,ie as a,Jn as b,G as f,z as i,Ae as l,Ko as v,nn as w,fo as y};
@@ -1,4 +1,4 @@
1
- import { F as File, L as LocalMetaStorageOptions, M as MetaStorage } from "./storage.d-BoJgdi1n.js";
1
+ import { F as File, L as LocalMetaStorageOptions, M as MetaStorage } from "./storage.d-X6TimMHY.js";
2
2
  import 'node:stream';
3
3
  /**
4
4
  * Stores upload metafiles on local disk
@@ -1,5 +1,5 @@
1
- import { F as File, a as FileReturn, B as BaseStorage } from "./storage.d-BoJgdi1n.js";
2
- import { O as MediaTransformerConfig, Q as MediaTransformResult } from "./types.d-DCPQvHDI.js";
1
+ import { F as File, a as FileReturn, B as BaseStorage } from "./storage.d-X6TimMHY.js";
2
+ import { M as MediaTransformerConfig, g as MediaTransformResult } from "./types.d-C4QumoP1.js";
3
3
  /**
4
4
  * Unified media transformer that automatically detects media type and routes to appropriate transformer.
5
5
  * @template TFile The file type used by this transformer.
@@ -0,0 +1,101 @@
1
+ import { Readable } from 'node:stream';
2
+ import { F as File, h as MetaStorageOptions, M as MetaStorage, i as BaseStorageOptions, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "./storage.d-X6TimMHY.js";
3
+ /**
4
+ * Map-backed metadata storage used by {@link MemoryStorage}. Holds a deep-copied
5
+ * snapshot of each `File` so callers can mutate the returned object without leaking
6
+ * back into the backing store.
7
+ */
8
+ declare class MemoryMetaStorage<T extends File = File> extends MetaStorage<T> {
9
+ private readonly store;
10
+ constructor(config?: MetaStorageOptions & {
11
+ store?: Map<string, T>;
12
+ });
13
+ override save(id: string, file: T): Promise<T>;
14
+ override get(id: string): Promise<T>;
15
+ override delete(id: string): Promise<void>;
16
+ override touch(id: string, file: T): Promise<T>;
17
+ /** Reset the in-memory metadata. Test/reset helper. */
18
+ clear(): void;
19
+ }
20
+ /**
21
+ * Public options for {@link MemoryStorage}. The `initial` record lets tests seed the
22
+ * store with a few key→bytes pairs; pass `metaStorage` to share metadata with another
23
+ * `Files` instance (rarely needed — the memory adapter is meant to be ephemeral).
24
+ */
25
+ interface MemoryStorageOptions<T extends File = File> extends BaseStorageOptions<T> {
26
+ /** Pre-populate the store with these key → bytes entries. */
27
+ initial?: Record<string, Buffer | Uint8Array | string>;
28
+ metaStorageConfig?: MetaStorageOptions;
29
+ }
30
+ /**
31
+ * Stored entry in the backing {@link Map}. `bytes` is the raw payload; `meta` is a
32
+ * lightweight per-key metadata snapshot so {@link MemoryStorage.list} and
33
+ * `head` can answer without dragging the file class around.
34
+ */
35
+ interface MemoryEntry {
36
+ bytes: Buffer;
37
+ contentType: string;
38
+ createdAt: string;
39
+ eTag: string;
40
+ metadata: Record<string, unknown>;
41
+ modifiedAt: string;
42
+ }
43
+ /**
44
+ * In-memory storage adapter backed by a {@link Map}.
45
+ *
46
+ * Implements the full {@link BaseStorage} surface without touching disk or any
47
+ * external service — useful for tests, ephemeral environments, and as a
48
+ * reference implementation. `raw` returns the backing map so tests can inspect
49
+ * or reset state directly:
50
+ *
51
+ * ```ts
52
+ * const storage = new MemoryStorage({ initial: { "users/1.json": '{"id":1}' } });
53
+ * storage.raw.clear();
54
+ * ```
55
+ *
56
+ * Metadata is shallow-cloned on both write and read so callers never share a
57
+ * mutable object with the store.
58
+ */
59
+ declare class MemoryStorage<TFile extends File = File> extends BaseStorage<TFile> {
60
+ static override readonly name: string;
61
+ override checksumTypes: string[];
62
+ override readonly supportsRange: boolean;
63
+ meta: MemoryMetaStorage<TFile>;
64
+ private readonly store;
65
+ constructor(config?: MemoryStorageOptions<TFile>);
66
+ override get raw(): Map<string, MemoryEntry>;
67
+ create(fileInit: FileInit, _options?: OperationOptions): Promise<TFile>;
68
+ write(part: FilePart | FileQuery, _options?: OperationOptions): Promise<TFile>;
69
+ get({
70
+ id
71
+ }: FileQuery, _options?: OperationOptions & {
72
+ range?: {
73
+ end?: number;
74
+ start: number;
75
+ };
76
+ }): Promise<FileReturn>;
77
+ override getStream({
78
+ id
79
+ }: FileQuery, _options?: OperationOptions & {
80
+ range?: {
81
+ end?: number;
82
+ start: number;
83
+ };
84
+ }): Promise<{
85
+ headers?: Record<string, string>;
86
+ size?: number;
87
+ stream: Readable;
88
+ }>;
89
+ override exists({
90
+ id
91
+ }: FileQuery): Promise<boolean>;
92
+ delete({
93
+ id
94
+ }: FileQuery): Promise<TFile>;
95
+ copy(source: string, destination: string): Promise<TFile>;
96
+ move(source: string, destination: string): Promise<TFile>;
97
+ override list(): Promise<TFile[]>;
98
+ override getReadUrl(key: string): Promise<string>;
99
+ override getUploadUrl(key: string): Promise<string>;
100
+ }
101
+ export { MemoryMetaStorage as M, MemoryStorage as a, MemoryStorageOptions as b };
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var r=(e,i)=>s(e,"name",{value:i,configurable:!0});var a=Object.defineProperty,t=r((e,i)=>a(e,"name",{value:i,configurable:!0}),"i");const o=t((e,i)=>e.size!==void 0&&i.size!==void 0&&e.size>0&&i.size>0&&e.size>i.size?!1:i.size===void 0?!0:(e.start||0)+(e.contentLength||0)<=i.size,"partMatch");export{o as r};