@apicity/b2 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Justin Tanner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,630 @@
1
+ # @apicity/b2
2
+
3
+ [![npm](https://img.shields.io/npm/v/@apicity/b2?color=cb0000)](https://www.npmjs.com/package/@apicity/b2)
4
+ [![zero dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](package.json)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue?logo=typescript&logoColor=white)](tsconfig.json)
6
+ [![docs](https://img.shields.io/badge/docs-backblaze.com-blue)](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
7
+
8
+ Backblaze B2 S3-compatible object storage provider.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @apicity/b2
14
+ # or
15
+ pnpm add @apicity/b2
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ```typescript
21
+ import { createB2 } from "@apicity/b2";
22
+
23
+ const b2 = createB2({
24
+ accessKeyId: process.env.B2_ACCESS_KEY_ID!,
25
+ secretAccessKey: process.env.B2_SECRET_ACCESS_KEY!,
26
+ region: process.env.B2_REGION!,
27
+ endpoint: process.env.B2_ENDPOINT,
28
+ });
29
+ ```
30
+
31
+ `@apicity/b2` delegates signing, transport, response parsing, and schemas to `@apicity/s3` while exposing only Backblaze-supported S3-compatible calls.
32
+
33
+ ## API Reference
34
+
35
+ 39 endpoints across 2 groups. Each method mirrors an upstream URL path.
36
+
37
+ ### buckets
38
+
39
+ <details>
40
+ <summary><code>PUT</code> <b><code>b2.buckets.create</code></b></summary>
41
+
42
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}</code>
43
+
44
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
45
+
46
+ ```typescript
47
+ const res = await b2.buckets.create({ /* ... */ });
48
+ ```
49
+
50
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
51
+
52
+ </details>
53
+
54
+ <details>
55
+ <summary><code>DELETE</code> <b><code>b2.buckets.del</code></b></summary>
56
+
57
+ <code>DELETE https://s3.us-west-004.backblazeb2.com/{bucket}</code>
58
+
59
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
60
+
61
+ ```typescript
62
+ const res = await b2.buckets.del({ /* ... */ });
63
+ ```
64
+
65
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
66
+
67
+ </details>
68
+
69
+ <details>
70
+ <summary><code>DELETE</code> <b><code>b2.buckets.delCors</code></b></summary>
71
+
72
+ <code>DELETE https://s3.us-west-004.backblazeb2.com/{bucket}?cors</code>
73
+
74
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
75
+
76
+ ```typescript
77
+ const res = await b2.buckets.delCors({ /* ... */ });
78
+ ```
79
+
80
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
81
+
82
+ </details>
83
+
84
+ <details>
85
+ <summary><code>DELETE</code> <b><code>b2.buckets.delEncryption</code></b></summary>
86
+
87
+ <code>DELETE https://s3.us-west-004.backblazeb2.com/{bucket}?encryption</code>
88
+
89
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
90
+
91
+ ```typescript
92
+ const res = await b2.buckets.delEncryption({ /* ... */ });
93
+ ```
94
+
95
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
96
+
97
+ </details>
98
+
99
+ <details>
100
+ <summary><code>GET</code> <b><code>b2.buckets.getAcl</code></b></summary>
101
+
102
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?acl</code>
103
+
104
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
105
+
106
+ ```typescript
107
+ const res = await b2.buckets.getAcl({ /* ... */ });
108
+ ```
109
+
110
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
111
+
112
+ </details>
113
+
114
+ <details>
115
+ <summary><code>GET</code> <b><code>b2.buckets.getCors</code></b></summary>
116
+
117
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?cors</code>
118
+
119
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
120
+
121
+ ```typescript
122
+ const res = await b2.buckets.getCors({ /* ... */ });
123
+ ```
124
+
125
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
126
+
127
+ </details>
128
+
129
+ <details>
130
+ <summary><code>GET</code> <b><code>b2.buckets.getEncryption</code></b></summary>
131
+
132
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?encryption</code>
133
+
134
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
135
+
136
+ ```typescript
137
+ const res = await b2.buckets.getEncryption({ /* ... */ });
138
+ ```
139
+
140
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
141
+
142
+ </details>
143
+
144
+ <details>
145
+ <summary><code>GET</code> <b><code>b2.buckets.getObjectLockConfiguration</code></b></summary>
146
+
147
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?object-lock</code>
148
+
149
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
150
+
151
+ ```typescript
152
+ const res = await b2.buckets.getObjectLockConfiguration({ /* ... */ });
153
+ ```
154
+
155
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
156
+
157
+ </details>
158
+
159
+ <details>
160
+ <summary><code>GET</code> <b><code>b2.buckets.getVersioning</code></b></summary>
161
+
162
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?versioning</code>
163
+
164
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
165
+
166
+ ```typescript
167
+ const res = await b2.buckets.getVersioning({ /* ... */ });
168
+ ```
169
+
170
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
171
+
172
+ </details>
173
+
174
+ <details>
175
+ <summary><code>HEAD</code> <b><code>b2.buckets.head</code></b></summary>
176
+
177
+ <code>HEAD https://s3.us-west-004.backblazeb2.com/{bucket}</code>
178
+
179
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
180
+
181
+ ```typescript
182
+ const res = await b2.buckets.head({ /* ... */ });
183
+ ```
184
+
185
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
186
+
187
+ </details>
188
+
189
+ <details>
190
+ <summary><code>GET</code> <b><code>b2.buckets.list</code></b></summary>
191
+
192
+ <code>GET https://s3.us-west-004.backblazeb2.com/</code>
193
+
194
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
195
+
196
+ ```typescript
197
+ const res = await b2.buckets.list({ /* ... */ });
198
+ ```
199
+
200
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
201
+
202
+ </details>
203
+
204
+ <details>
205
+ <summary><code>GET</code> <b><code>b2.buckets.location</code></b></summary>
206
+
207
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?location</code>
208
+
209
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
210
+
211
+ ```typescript
212
+ const res = await b2.buckets.location({ /* ... */ });
213
+ ```
214
+
215
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
216
+
217
+ </details>
218
+
219
+ <details>
220
+ <summary><code>PUT</code> <b><code>b2.buckets.putAcl</code></b></summary>
221
+
222
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}?acl</code>
223
+
224
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
225
+
226
+ ```typescript
227
+ const res = await b2.buckets.putAcl({ /* ... */ });
228
+ ```
229
+
230
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
231
+
232
+ </details>
233
+
234
+ <details>
235
+ <summary><code>PUT</code> <b><code>b2.buckets.putCors</code></b></summary>
236
+
237
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}?cors</code>
238
+
239
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
240
+
241
+ ```typescript
242
+ const res = await b2.buckets.putCors({ /* ... */ });
243
+ ```
244
+
245
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
246
+
247
+ </details>
248
+
249
+ <details>
250
+ <summary><code>PUT</code> <b><code>b2.buckets.putEncryption</code></b></summary>
251
+
252
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}?encryption</code>
253
+
254
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
255
+
256
+ ```typescript
257
+ const res = await b2.buckets.putEncryption({ /* ... */ });
258
+ ```
259
+
260
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
261
+
262
+ </details>
263
+
264
+ <details>
265
+ <summary><code>PUT</code> <b><code>b2.buckets.putObjectLockConfiguration</code></b></summary>
266
+
267
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}?object-lock</code>
268
+
269
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
270
+
271
+ ```typescript
272
+ const res = await b2.buckets.putObjectLockConfiguration({ /* ... */ });
273
+ ```
274
+
275
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
276
+
277
+ </details>
278
+
279
+ ### objects
280
+
281
+ <details>
282
+ <summary><code>DELETE</code> <b><code>b2.objects.abortMultipartUpload</code></b></summary>
283
+
284
+ <code>DELETE https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
285
+
286
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
287
+
288
+ ```typescript
289
+ const res = await b2.objects.abortMultipartUpload({ /* ... */ });
290
+ ```
291
+
292
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
293
+
294
+ </details>
295
+
296
+ <details>
297
+ <summary><code>POST</code> <b><code>b2.objects.completeMultipartUpload</code></b></summary>
298
+
299
+ <code>POST https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
300
+
301
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
302
+
303
+ ```typescript
304
+ const res = await b2.objects.completeMultipartUpload({ /* ... */ });
305
+ ```
306
+
307
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
308
+
309
+ </details>
310
+
311
+ <details>
312
+ <summary><code>PUT</code> <b><code>b2.objects.copy</code></b></summary>
313
+
314
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}</code>
315
+
316
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
317
+
318
+ ```typescript
319
+ const res = await b2.objects.copy({ /* ... */ });
320
+ ```
321
+
322
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
323
+
324
+ </details>
325
+
326
+ <details>
327
+ <summary><code>POST</code> <b><code>b2.objects.createMultipartUpload</code></b></summary>
328
+
329
+ <code>POST https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?uploads</code>
330
+
331
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
332
+
333
+ ```typescript
334
+ const res = await b2.objects.createMultipartUpload({ /* ... */ });
335
+ ```
336
+
337
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
338
+
339
+ </details>
340
+
341
+ <details>
342
+ <summary><code>DELETE</code> <b><code>b2.objects.del</code></b></summary>
343
+
344
+ <code>DELETE https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
345
+
346
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
347
+
348
+ ```typescript
349
+ const res = await b2.objects.del({ /* ... */ });
350
+ ```
351
+
352
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
353
+
354
+ </details>
355
+
356
+ <details>
357
+ <summary><code>POST</code> <b><code>b2.objects.delMany</code></b></summary>
358
+
359
+ <code>POST https://s3.us-west-004.backblazeb2.com/{bucket}?delete</code>
360
+
361
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
362
+
363
+ ```typescript
364
+ const res = await b2.objects.delMany({ /* ... */ });
365
+ ```
366
+
367
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
368
+
369
+ </details>
370
+
371
+ <details>
372
+ <summary><code>GET</code> <b><code>b2.objects.get</code></b></summary>
373
+
374
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
375
+
376
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
377
+
378
+ ```typescript
379
+ const res = await b2.objects.get({ /* ... */ });
380
+ ```
381
+
382
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
383
+
384
+ </details>
385
+
386
+ <details>
387
+ <summary><code>GET</code> <b><code>b2.objects.getAcl</code></b></summary>
388
+
389
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?acl{query}</code>
390
+
391
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
392
+
393
+ ```typescript
394
+ const res = await b2.objects.getAcl({ /* ... */ });
395
+ ```
396
+
397
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
398
+
399
+ </details>
400
+
401
+ <details>
402
+ <summary><code>GET</code> <b><code>b2.objects.getLegalHold</code></b></summary>
403
+
404
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?legal-hold{query}</code>
405
+
406
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
407
+
408
+ ```typescript
409
+ const res = await b2.objects.getLegalHold({ /* ... */ });
410
+ ```
411
+
412
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
413
+
414
+ </details>
415
+
416
+ <details>
417
+ <summary><code>GET</code> <b><code>b2.objects.getRetention</code></b></summary>
418
+
419
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?retention{query}</code>
420
+
421
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
422
+
423
+ ```typescript
424
+ const res = await b2.objects.getRetention({ /* ... */ });
425
+ ```
426
+
427
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
428
+
429
+ </details>
430
+
431
+ <details>
432
+ <summary><code>GET</code> <b><code>b2.objects.getStream</code></b></summary>
433
+
434
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
435
+
436
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
437
+
438
+ ```typescript
439
+ const res = await b2.objects.getStream({ /* ... */ });
440
+ ```
441
+
442
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
443
+
444
+ </details>
445
+
446
+ <details>
447
+ <summary><code>HEAD</code> <b><code>b2.objects.head</code></b></summary>
448
+
449
+ <code>HEAD https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
450
+
451
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
452
+
453
+ ```typescript
454
+ const res = await b2.objects.head({ /* ... */ });
455
+ ```
456
+
457
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
458
+
459
+ </details>
460
+
461
+ <details>
462
+ <summary><code>GET</code> <b><code>b2.objects.list</code></b></summary>
463
+
464
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?list-type=2{query}</code>
465
+
466
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
467
+
468
+ ```typescript
469
+ const res = await b2.objects.list({ /* ... */ });
470
+ ```
471
+
472
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
473
+
474
+ </details>
475
+
476
+ <details>
477
+ <summary><code>GET</code> <b><code>b2.objects.listLegacy</code></b></summary>
478
+
479
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}{query}</code>
480
+
481
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
482
+
483
+ ```typescript
484
+ const res = await b2.objects.listLegacy({ /* ... */ });
485
+ ```
486
+
487
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
488
+
489
+ </details>
490
+
491
+ <details>
492
+ <summary><code>GET</code> <b><code>b2.objects.listMultipartUploads</code></b></summary>
493
+
494
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?uploads{query}</code>
495
+
496
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
497
+
498
+ ```typescript
499
+ const res = await b2.objects.listMultipartUploads({ /* ... */ });
500
+ ```
501
+
502
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
503
+
504
+ </details>
505
+
506
+ <details>
507
+ <summary><code>GET</code> <b><code>b2.objects.listParts</code></b></summary>
508
+
509
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
510
+
511
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
512
+
513
+ ```typescript
514
+ const res = await b2.objects.listParts({ /* ... */ });
515
+ ```
516
+
517
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
518
+
519
+ </details>
520
+
521
+ <details>
522
+ <summary><code>GET</code> <b><code>b2.objects.listVersions</code></b></summary>
523
+
524
+ <code>GET https://s3.us-west-004.backblazeb2.com/{bucket}?versions{query}</code>
525
+
526
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
527
+
528
+ ```typescript
529
+ const res = await b2.objects.listVersions({ /* ... */ });
530
+ ```
531
+
532
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
533
+
534
+ </details>
535
+
536
+ <details>
537
+ <summary><code>PUT</code> <b><code>b2.objects.put</code></b></summary>
538
+
539
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}</code>
540
+
541
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
542
+
543
+ ```typescript
544
+ const res = await b2.objects.put({ /* ... */ });
545
+ ```
546
+
547
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
548
+
549
+ </details>
550
+
551
+ <details>
552
+ <summary><code>PUT</code> <b><code>b2.objects.putAcl</code></b></summary>
553
+
554
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?acl{query}</code>
555
+
556
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
557
+
558
+ ```typescript
559
+ const res = await b2.objects.putAcl({ /* ... */ });
560
+ ```
561
+
562
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
563
+
564
+ </details>
565
+
566
+ <details>
567
+ <summary><code>PUT</code> <b><code>b2.objects.putLegalHold</code></b></summary>
568
+
569
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?legal-hold{query}</code>
570
+
571
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
572
+
573
+ ```typescript
574
+ const res = await b2.objects.putLegalHold({ /* ... */ });
575
+ ```
576
+
577
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
578
+
579
+ </details>
580
+
581
+ <details>
582
+ <summary><code>PUT</code> <b><code>b2.objects.putRetention</code></b></summary>
583
+
584
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}?retention{query}</code>
585
+
586
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
587
+
588
+ ```typescript
589
+ const res = await b2.objects.putRetention({ /* ... */ });
590
+ ```
591
+
592
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
593
+
594
+ </details>
595
+
596
+ <details>
597
+ <summary><code>PUT</code> <b><code>b2.objects.uploadPart</code></b></summary>
598
+
599
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
600
+
601
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
602
+
603
+ ```typescript
604
+ const res = await b2.objects.uploadPart({ /* ... */ });
605
+ ```
606
+
607
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
608
+
609
+ </details>
610
+
611
+ <details>
612
+ <summary><code>PUT</code> <b><code>b2.objects.uploadPartCopy</code></b></summary>
613
+
614
+ <code>PUT https://s3.us-west-004.backblazeb2.com/{bucket}/{key}{query}</code>
615
+
616
+ [Upstream docs ↗](https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api)
617
+
618
+ ```typescript
619
+ const res = await b2.objects.uploadPartCopy({ /* ... */ });
620
+ ```
621
+
622
+ Source: [`packages/provider/b2/src/b2.ts`](src/b2.ts)
623
+
624
+ </details>
625
+
626
+ Part of the [apicity](https://github.com/justintanner/apicity) monorepo.
627
+
628
+ ## License
629
+
630
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,3 @@
1
+ import type { B2Options, B2Provider } from "./types";
2
+ export declare function createB2(opts: B2Options): B2Provider;
3
+ //# sourceMappingURL=b2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"b2.d.ts","sourceRoot":"","sources":["../../src/b2.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAMrD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,UAAU,CA+DpD"}
package/dist/src/b2.js ADDED
@@ -0,0 +1,69 @@
1
+ import { createS3 } from "@apicity/s3";
2
+ import { attachExamples } from "./example.js";
3
+ function endpointForRegion(region) {
4
+ return `https://s3.${region}.backblazeb2.com`;
5
+ }
6
+ export function createB2(opts) {
7
+ const s3 = createS3({
8
+ accessKeyId: opts.accessKeyId,
9
+ secretAccessKey: opts.secretAccessKey,
10
+ region: opts.region,
11
+ endpoint: opts.endpoint ?? endpointForRegion(opts.region),
12
+ forcePathStyle: opts.forcePathStyle ?? true,
13
+ signingService: "s3",
14
+ timeout: opts.timeout,
15
+ fetch: opts.fetch,
16
+ });
17
+ return attachExamples({
18
+ buckets: {
19
+ create: s3.buckets.create,
20
+ del: s3.buckets.del,
21
+ delCors: s3.buckets.delCors,
22
+ delEncryption: s3.buckets.delEncryption,
23
+ getAcl: s3.buckets.getAcl,
24
+ getCors: s3.buckets.getCors,
25
+ getEncryption: s3.buckets.getEncryption,
26
+ getObjectLockConfiguration: s3.buckets.getObjectLockConfiguration,
27
+ getVersioning: s3.buckets.getVersioning,
28
+ head: s3.buckets.head,
29
+ list: s3.buckets.list,
30
+ location: s3.buckets.location,
31
+ putAcl: s3.buckets.putAcl,
32
+ putCors: s3.buckets.putCors,
33
+ putEncryption: s3.buckets.putEncryption,
34
+ putObjectLockConfiguration: s3.buckets.putObjectLockConfiguration,
35
+ },
36
+ objects: {
37
+ abortMultipartUpload: s3.objects.abortMultipartUpload,
38
+ completeMultipartUpload: s3.objects.completeMultipartUpload,
39
+ copy: s3.objects.copy,
40
+ createMultipartUpload: s3.objects.createMultipartUpload,
41
+ del: s3.objects.del,
42
+ delMany: s3.objects.delMany,
43
+ get: s3.objects.get,
44
+ getAcl: s3.objects.getAcl,
45
+ getLegalHold: s3.objects.getLegalHold,
46
+ getRetention: s3.objects.getRetention,
47
+ getStream: s3.objects.getStream,
48
+ head: s3.objects.head,
49
+ list: s3.objects.list,
50
+ listLegacy: s3.objects.listLegacy,
51
+ listMultipartUploads: s3.objects.listMultipartUploads,
52
+ listParts: s3.objects.listParts,
53
+ listVersions: s3.objects.listVersions,
54
+ put: s3.objects.put,
55
+ putAcl: s3.objects.putAcl,
56
+ putLegalHold: s3.objects.putLegalHold,
57
+ putRetention: s3.objects.putRetention,
58
+ uploadPart: s3.objects.uploadPart,
59
+ uploadPartCopy: s3.objects.uploadPartCopy,
60
+ },
61
+ presign: {
62
+ deleteObject: s3.presign.deleteObject,
63
+ getObject: s3.presign.getObject,
64
+ headObject: s3.presign.headObject,
65
+ putObject: s3.presign.putObject,
66
+ },
67
+ });
68
+ }
69
+ //# sourceMappingURL=b2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"b2.js","sourceRoot":"","sources":["../../src/b2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE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,CAAC,UAAU;YACjC,cAAc,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc;SAC1C;QACD,OAAO,EAAE;YACP,YAAY,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY;YACrC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS;YAC/B,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU;YACjC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS;SAChC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface EndpointExample {
2
+ source: string;
3
+ payload: unknown;
4
+ }
5
+ declare const EXAMPLES: Record<string, EndpointExample>;
6
+ export default EXAMPLES;
7
+ export declare function attachExamples<T>(provider: T): T;
8
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../src/example.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAM,CAAC;AAErD,eAAe,QAAQ,CAAC;AAOxB,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CA6ChD"}
@@ -0,0 +1,85 @@
1
+ // Auto-generated by `pnpm run gen:examples` — do not edit by hand.
2
+ // Source: tests/recordings/<provider>_*/<test>_*/recording.har
3
+ //
4
+ // Each entry is the green-path payload for one endpoint, mined from a real
5
+ // integration-test recording. `attachExamples` walks the provider tree and
6
+ // hangs the matching entry off each endpoint function as `.example`.
7
+ const EXAMPLES = {};
8
+ export default EXAMPLES;
9
+ // Walks each "<METHOD> <dotPath>" key onto the provider's tree. Tries the
10
+ // standard `provider.<method>.<dotPath>` shape first, then a few fallbacks
11
+ // to cover providers with non-standard layouts (fal's `.run.` namespace,
12
+ // kie's sub-providers, `free`'s flat root). Returns the same provider for
13
+ // drop-in use as `return attachExamples({ ... });`.
14
+ export function attachExamples(provider) {
15
+ const root = provider;
16
+ const HTTP_KEYS = new Set(["post", "get", "put", "delete", "patch", "head"]);
17
+ for (const [key, example] of Object.entries(EXAMPLES)) {
18
+ const sp = key.indexOf(" ");
19
+ if (sp < 0)
20
+ continue;
21
+ const method = key.slice(0, sp).toLowerCase();
22
+ const segs = key.slice(sp + 1).split(".");
23
+ const candidates = [
24
+ root[method],
25
+ root[method]?.run,
26
+ root,
27
+ ];
28
+ if (segs.length > 1) {
29
+ const sub = root[segs[0]];
30
+ if (sub && typeof sub === "object") {
31
+ const subMethod = sub[method];
32
+ if (subMethod)
33
+ candidates.push({ __nested: subMethod, __segs: segs.slice(1) });
34
+ }
35
+ }
36
+ let attached = false;
37
+ for (const c of candidates) {
38
+ const fn = walkToFn(c, segs);
39
+ if (fn) {
40
+ Object.assign(fn, { example });
41
+ attached = true;
42
+ break;
43
+ }
44
+ }
45
+ if (attached)
46
+ continue;
47
+ for (const k of Object.keys(root)) {
48
+ if (HTTP_KEYS.has(k))
49
+ continue;
50
+ if (!segs.includes(k))
51
+ continue;
52
+ const sub = root[k];
53
+ if (!sub || typeof sub !== "object")
54
+ continue;
55
+ const subMethod = sub[method];
56
+ if (!subMethod)
57
+ continue;
58
+ const fn = walkToFn(subMethod, segs);
59
+ if (fn) {
60
+ Object.assign(fn, { example });
61
+ break;
62
+ }
63
+ }
64
+ }
65
+ return provider;
66
+ }
67
+ function walkToFn(start, segs) {
68
+ if (start && typeof start === "object" && "__nested" in start) {
69
+ const wrapper = start;
70
+ return walkToFn(wrapper.__nested, wrapper.__segs);
71
+ }
72
+ let cur = start;
73
+ for (const seg of segs) {
74
+ if (cur === null || cur === undefined)
75
+ return null;
76
+ const t = typeof cur;
77
+ if (t !== "object" && t !== "function")
78
+ return null;
79
+ cur = cur[seg];
80
+ }
81
+ return typeof cur === "function"
82
+ ? cur
83
+ : null;
84
+ }
85
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ACR,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,IAAc;IAC9C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,IAAK,KAAgB,EAAE,CAAC;QAC1E,MAAM,OAAO,GAAG,KAAgD,CAAC;QACjE,OAAO,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,GAAG,GAAY,KAAK,CAAC;IACzB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACnD,MAAM,CAAC,GAAG,OAAO,GAAG,CAAC;QACrB,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,UAAU;YAAE,OAAO,IAAI,CAAC;QACpD,GAAG,GAAI,GAA+B,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,GAAG,KAAK,UAAU;QAC9B,CAAC,CAAE,GAAuC;QAC1C,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { createB2 } from "./b2";
2
+ export { B2Error, S3Error } from "./types";
3
+ export type { B2BucketsNamespace, B2ObjectsNamespace, B2Options, B2PresignNamespace, B2Provider, } from "./types";
4
+ export type * from "@apicity/s3";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE3C,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,kBAAkB,EAClB,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,mBAAmB,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createB2 } from "./b2.js";
2
+ export { B2Error, S3Error } from "./types.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { S3BucketsNamespace, S3ObjectsNamespace, S3PresignNamespace } from "@apicity/s3";
2
+ export { S3Error, S3Error as B2Error } from "@apicity/s3";
3
+ export interface B2Options {
4
+ accessKeyId: string;
5
+ secretAccessKey: string;
6
+ region: string;
7
+ endpoint?: string;
8
+ forcePathStyle?: boolean;
9
+ timeout?: number;
10
+ fetch?: typeof fetch;
11
+ }
12
+ export type B2BucketsNamespace = Pick<S3BucketsNamespace, "create" | "del" | "delCors" | "delEncryption" | "getAcl" | "getCors" | "getEncryption" | "getObjectLockConfiguration" | "getVersioning" | "head" | "list" | "location" | "putAcl" | "putCors" | "putEncryption" | "putObjectLockConfiguration">;
13
+ export type B2ObjectsNamespace = Pick<S3ObjectsNamespace, "abortMultipartUpload" | "completeMultipartUpload" | "copy" | "createMultipartUpload" | "del" | "delMany" | "get" | "getAcl" | "getLegalHold" | "getRetention" | "getStream" | "head" | "list" | "listLegacy" | "listMultipartUploads" | "listParts" | "listVersions" | "put" | "putAcl" | "putLegalHold" | "putRetention" | "uploadPart" | "uploadPartCopy">;
14
+ export type B2PresignNamespace = Pick<S3PresignNamespace, "deleteObject" | "getObject" | "headObject" | "putObject">;
15
+ export interface B2Provider {
16
+ buckets: B2BucketsNamespace;
17
+ objects: B2ObjectsNamespace;
18
+ presign: B2PresignNamespace;
19
+ }
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,kBAAkB,EAChB,QAAQ,GACR,KAAK,GACL,SAAS,GACT,eAAe,GACf,QAAQ,GACR,SAAS,GACT,eAAe,GACf,4BAA4B,GAC5B,eAAe,GACf,MAAM,GACN,MAAM,GACN,UAAU,GACV,QAAQ,GACR,SAAS,GACT,eAAe,GACf,4BAA4B,CAC/B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,kBAAkB,EAChB,sBAAsB,GACtB,yBAAyB,GACzB,MAAM,GACN,uBAAuB,GACvB,KAAK,GACL,SAAS,GACT,KAAK,GACL,QAAQ,GACR,cAAc,GACd,cAAc,GACd,WAAW,GACX,MAAM,GACN,MAAM,GACN,YAAY,GACZ,sBAAsB,GACtB,WAAW,GACX,cAAc,GACd,KAAK,GACL,QAAQ,GACR,cAAc,GACd,cAAc,GACd,YAAY,GACZ,gBAAgB,CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,kBAAkB,EAClB,cAAc,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAC1D,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,EAAE,kBAAkB,CAAC;CAC7B"}
@@ -0,0 +1,2 @@
1
+ export { S3Error, S3Error as B2Error } from "@apicity/s3";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { z } from "zod";
2
+ import type { B2Options } from "./types";
3
+ export { S3AbortMultipartUploadRequestSchema, S3BucketRequestSchema, S3CompleteMultipartUploadRequestSchema, S3CopyObjectRequestSchema, S3CreateBucketRequestSchema, S3CreateMultipartUploadRequestSchema, S3DeleteObjectRequestSchema, S3DeleteObjectsRequestSchema, S3GetBucketVersioningRequestSchema, S3GetObjectRequestSchema, S3HeadObjectRequestSchema, S3ListMultipartUploadsRequestSchema, S3ListObjectVersionsRequestSchema, S3ListObjectsRequestSchema, S3ListObjectsV2RequestSchema, S3ListPartsRequestSchema, S3ObjectGovernanceRequestSchema, S3OptionsSchema, S3PresignObjectRequestSchema, S3PutBucketAclRequestSchema, S3PutBucketXmlConfigRequestSchema, S3PutObjectAclRequestSchema, S3PutObjectLegalHoldRequestSchema, S3PutObjectLockConfigurationRequestSchema, S3PutObjectRetentionRequestSchema, S3PutObjectRequestSchema, S3UploadPartCopyRequestSchema, S3UploadPartRequestSchema, } from "@apicity/s3";
4
+ export declare const B2OptionsSchema: z.ZodType<B2Options>;
5
+ //# sourceMappingURL=zod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../src/zod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EACL,mCAAmC,EACnC,qBAAqB,EACrB,sCAAsC,EACtC,yBAAyB,EACzB,2BAA2B,EAC3B,oCAAoC,EACpC,2BAA2B,EAC3B,4BAA4B,EAC5B,kCAAkC,EAClC,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,iCAAiC,EACjC,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,EAC3B,iCAAiC,EACjC,2BAA2B,EAC3B,iCAAiC,EACjC,yCAAyC,EACzC,iCAAiC,EACjC,wBAAwB,EACxB,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAQvB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { S3OptionsSchema } from "@apicity/s3";
2
+ export { S3AbortMultipartUploadRequestSchema, S3BucketRequestSchema, S3CompleteMultipartUploadRequestSchema, S3CopyObjectRequestSchema, S3CreateBucketRequestSchema, S3CreateMultipartUploadRequestSchema, S3DeleteObjectRequestSchema, S3DeleteObjectsRequestSchema, S3GetBucketVersioningRequestSchema, S3GetObjectRequestSchema, S3HeadObjectRequestSchema, S3ListMultipartUploadsRequestSchema, S3ListObjectVersionsRequestSchema, S3ListObjectsRequestSchema, S3ListObjectsV2RequestSchema, S3ListPartsRequestSchema, S3ObjectGovernanceRequestSchema, S3OptionsSchema, S3PresignObjectRequestSchema, S3PutBucketAclRequestSchema, S3PutBucketXmlConfigRequestSchema, S3PutObjectAclRequestSchema, S3PutObjectLegalHoldRequestSchema, S3PutObjectLockConfigurationRequestSchema, S3PutObjectRetentionRequestSchema, S3PutObjectRequestSchema, S3UploadPartCopyRequestSchema, S3UploadPartRequestSchema, } from "@apicity/s3";
3
+ export const B2OptionsSchema = S3OptionsSchema.pick({
4
+ accessKeyId: true,
5
+ secretAccessKey: true,
6
+ region: true,
7
+ endpoint: true,
8
+ forcePathStyle: true,
9
+ timeout: true,
10
+ fetch: true,
11
+ });
12
+ //# sourceMappingURL=zod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.js","sourceRoot":"","sources":["../../src/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAK9C,OAAO,EACL,mCAAmC,EACnC,qBAAqB,EACrB,sCAAsC,EACtC,yBAAyB,EACzB,2BAA2B,EAC3B,oCAAoC,EACpC,2BAA2B,EAC3B,4BAA4B,EAC5B,kCAAkC,EAClC,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,iCAAiC,EACjC,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,EAC3B,iCAAiC,EACjC,2BAA2B,EAC3B,iCAAiC,EACjC,yCAAyC,EACzC,iCAAiC,EACjC,wBAAwB,EACxB,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,eAAe,GAAyB,eAAe,CAAC,IAAI,CAAC;IACxE,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,IAAI;IACpB,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;CACZ,CAAyB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@apicity/b2",
3
+ "version": "0.3.3",
4
+ "description": "Backblaze B2 S3-compatible object storage provider.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/justintanner/apicity.git",
9
+ "directory": "provider/b2"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "main": "dist/src/index.js",
16
+ "types": "dist/src/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/src/index.js",
20
+ "types": "./dist/src/index.d.ts"
21
+ },
22
+ "./zod": {
23
+ "import": "./dist/src/zod.js",
24
+ "types": "./dist/src/zod.d.ts"
25
+ }
26
+ },
27
+ "dependencies": {
28
+ "zod": "^3.24.0",
29
+ "@apicity/s3": "0.3.3"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "sideEffects": false,
37
+ "keywords": [
38
+ "b2",
39
+ "backblaze",
40
+ "s3",
41
+ "object-storage",
42
+ "storage",
43
+ "apicity"
44
+ ],
45
+ "author": "Justin Tanner",
46
+ "engines": {
47
+ "node": ">=18.0.0"
48
+ },
49
+ "homepage": "https://github.com/justintanner/apicity#readme",
50
+ "bugs": {
51
+ "url": "https://github.com/justintanner/apicity/issues"
52
+ },
53
+ "scripts": {
54
+ "build": "tsc -p tsconfig.json && node scripts/dist.mjs"
55
+ }
56
+ }