@softistx/s3 0.0.0-stage → 0.13.2

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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +609 -2
  3. package/dist/bucket/bind-bucket.d.ts +42 -0
  4. package/dist/bucket/bind-bucket.d.ts.map +1 -0
  5. package/dist/bucket/bound-bucket.d.ts +119 -0
  6. package/dist/bucket/bound-bucket.d.ts.map +1 -0
  7. package/dist/bucket/context.d.ts +55 -0
  8. package/dist/bucket/context.d.ts.map +1 -0
  9. package/dist/bucket/define-bucket.d.ts +16 -0
  10. package/dist/bucket/define-bucket.d.ts.map +1 -0
  11. package/dist/bucket/disposition.d.ts +9 -0
  12. package/dist/bucket/disposition.d.ts.map +1 -0
  13. package/dist/bucket/guards.d.ts +38 -0
  14. package/dist/bucket/guards.d.ts.map +1 -0
  15. package/dist/bucket/operations/counted-stream.d.ts +26 -0
  16. package/dist/bucket/operations/counted-stream.d.ts.map +1 -0
  17. package/dist/bucket/operations/deadline.d.ts +21 -0
  18. package/dist/bucket/operations/deadline.d.ts.map +1 -0
  19. package/dist/bucket/operations/fetch-object.d.ts +68 -0
  20. package/dist/bucket/operations/fetch-object.d.ts.map +1 -0
  21. package/dist/bucket/operations/list-xml.d.ts +18 -0
  22. package/dist/bucket/operations/list-xml.d.ts.map +1 -0
  23. package/dist/bucket/operations/list.d.ts +12 -0
  24. package/dist/bucket/operations/list.d.ts.map +1 -0
  25. package/dist/bucket/operations/open-answer.d.ts +5 -0
  26. package/dist/bucket/operations/open-answer.d.ts.map +1 -0
  27. package/dist/bucket/operations/open-range.d.ts +10 -0
  28. package/dist/bucket/operations/open-range.d.ts.map +1 -0
  29. package/dist/bucket/operations/open-relay.d.ts +8 -0
  30. package/dist/bucket/operations/open-relay.d.ts.map +1 -0
  31. package/dist/bucket/operations/open.d.ts +4 -0
  32. package/dist/bucket/operations/open.d.ts.map +1 -0
  33. package/dist/bucket/operations/post-policy.d.ts +77 -0
  34. package/dist/bucket/operations/post-policy.d.ts.map +1 -0
  35. package/dist/bucket/operations/post-signer.d.ts +21 -0
  36. package/dist/bucket/operations/post-signer.d.ts.map +1 -0
  37. package/dist/bucket/operations/presign-post.d.ts +44 -0
  38. package/dist/bucket/operations/presign-post.d.ts.map +1 -0
  39. package/dist/bucket/operations/presign.d.ts +34 -0
  40. package/dist/bucket/operations/presign.d.ts.map +1 -0
  41. package/dist/bucket/operations/put-body.d.ts +13 -0
  42. package/dist/bucket/operations/put-body.d.ts.map +1 -0
  43. package/dist/bucket/operations/query-sign.d.ts +15 -0
  44. package/dist/bucket/operations/query-sign.d.ts.map +1 -0
  45. package/dist/bucket/operations/reads.d.ts +8 -0
  46. package/dist/bucket/operations/reads.d.ts.map +1 -0
  47. package/dist/bucket/operations/sized-body.d.ts +24 -0
  48. package/dist/bucket/operations/sized-body.d.ts.map +1 -0
  49. package/dist/bucket/operations/slice.d.ts +4 -0
  50. package/dist/bucket/operations/slice.d.ts.map +1 -0
  51. package/dist/bucket/operations/writes.d.ts +10 -0
  52. package/dist/bucket/operations/writes.d.ts.map +1 -0
  53. package/dist/bucket/shape.d.ts +6 -0
  54. package/dist/bucket/shape.d.ts.map +1 -0
  55. package/dist/bucket/types.d.ts +164 -0
  56. package/dist/bucket/types.d.ts.map +1 -0
  57. package/dist/chunks/index-jgjey570.js +118 -0
  58. package/dist/chunks/index-jgjey570.js.map +13 -0
  59. package/dist/errors/is-bucket-unavailable.d.ts +18 -0
  60. package/dist/errors/is-bucket-unavailable.d.ts.map +1 -0
  61. package/dist/errors/s3-error.d.ts +80 -0
  62. package/dist/errors/s3-error.d.ts.map +1 -0
  63. package/dist/index.d.ts +8 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +1288 -0
  66. package/dist/index.js.map +32 -0
  67. package/dist/testing/fetch-archive.d.ts +8 -0
  68. package/dist/testing/fetch-archive.d.ts.map +1 -0
  69. package/dist/testing/index.d.ts +6 -0
  70. package/dist/testing/index.d.ts.map +1 -0
  71. package/dist/testing/index.js +416 -0
  72. package/dist/testing/index.js.map +16 -0
  73. package/dist/testing/ports.d.ts +15 -0
  74. package/dist/testing/ports.d.ts.map +1 -0
  75. package/dist/testing/ready.d.ts +49 -0
  76. package/dist/testing/ready.d.ts.map +1 -0
  77. package/dist/testing/reaper.d.ts +4 -0
  78. package/dist/testing/reaper.d.ts.map +1 -0
  79. package/dist/testing/seaweedfs.d.ts +64 -0
  80. package/dist/testing/seaweedfs.d.ts.map +1 -0
  81. package/dist/testing/test-s3.d.ts +35 -0
  82. package/dist/testing/test-s3.d.ts.map +1 -0
  83. package/dist/testing/weed.d.ts +17 -0
  84. package/dist/testing/weed.d.ts.map +1 -0
  85. package/docs/README.md +17 -0
  86. package/docs/guide/buckets.md +220 -0
  87. package/docs/guide/presigned-urls.md +403 -0
  88. package/docs/guide/reads.md +417 -0
  89. package/docs/guide/testing.md +151 -0
  90. package/docs/guide/writes.md +374 -0
  91. package/docs/roadmap.md +116 -0
  92. package/docs/troubleshooting.md +982 -0
  93. package/package.json +61 -5
@@ -0,0 +1,80 @@
1
+ /**
2
+ * What went wrong. Each one is in the README's Errors table, and each
3
+ * message it carries has an entry in `docs/troubleshooting.md`, headed by its
4
+ * text.
5
+ */
6
+ export type S3ErrorCode =
7
+ /**
8
+ * The content type is not one this bucket accepts, or none was named where
9
+ * the bucket names some — on `put` and on `presignPost`, which also
10
+ * refuses a `{ startsWith }` prefix on a bucket that names its types.
11
+ */
12
+ 'WRONG_TYPE'
13
+ /** The body is bigger than this bucket's `maxSize`. */
14
+ | 'TOO_LARGE'
15
+ /** The body's size cannot be known before sending, and `maxSize` is set. */
16
+ | 'UNMEASURABLE'
17
+ /**
18
+ * An option's own value is not one the service accepts: `acl` or
19
+ * `storageClass` on a write; `acl` or `expiresIn` on `presignGet`,
20
+ * `presignPut` and `presignPost`; and on `presignPost`, a `maxSize` or
21
+ * `minSize` that is not a whole number of bytes, a `maxSize` above the
22
+ * bucket's own or missing on a bucket without one, a `minSize` above the
23
+ * `maxSize`, or a `type` that is neither a string nor `{ startsWith }`; and a
24
+ * `timeoutMs` that is not a whole number of milliseconds, 1 or more.
25
+ */
26
+ | 'WRONG_OPTION'
27
+ /**
28
+ * A streamed `put` sent a different number of bytes than the `size` it
29
+ * declared, short or long. The upload was aborted, so no object is stored.
30
+ * Raised after the request went out, like `TIMEOUT`.
31
+ */
32
+ | 'SIZE_MISMATCH'
33
+ /**
34
+ * The source of a streamed `put` failed or misbehaved after the upload
35
+ * started: it threw (a client that disconnected, a file that vanished) or
36
+ * gave a chunk that is not bytes. The upload was aborted, nothing is stored,
37
+ * and the source's own error is the `cause`. Raised after the request went
38
+ * out, like `TIMEOUT`.
39
+ */
40
+ | 'SOURCE_FAILED'
41
+ /**
42
+ * A call that names `timeoutMs` (or a bucket bound with one) got no answer
43
+ * in time, and its request was aborted. One of the codes raised **after**
44
+ * something was sent: the service may still have acted on it.
45
+ */
46
+ | 'TIMEOUT'
47
+ /**
48
+ * `open` was given a byte range that starts at or past the end of the
49
+ * object (or any range of an empty one): the service answers 416. The
50
+ * error's `objectSize` is the object's size in bytes when the service said
51
+ * it. Also raised for a `{ suffix }` range when the service ignored `Range` and
52
+ * sent no `Content-Length` (no `objectSize`). Raised from the service's answer, so after a request was sent; it is a
53
+ * read, so nothing was changed.
54
+ */
55
+ | 'RANGE_NOT_SATISFIABLE';
56
+ /**
57
+ * This package's error class for refusals, and every one of them is thrown
58
+ * **before** anything is sent, except `TIMEOUT`, `SIZE_MISMATCH`, `SOURCE_FAILED`
59
+ * and `RANGE_NOT_SATISFIABLE`, the codes raised after a request went out (the
60
+ * last is the service's own answer to a read, which changed nothing). The
61
+ * package also throws a `TypeError` for a
62
+ * bucket definition that could never work, a `bindBucket` `timeoutMs` default
63
+ * that is not whole milliseconds, or a `presignPost` secret that is not Bun's, and a plain `Error` when the URL Bun signed cannot be read. S3's
64
+ * own failures come back as they are, from Bun's client.
65
+ */
66
+ export declare class S3Error extends Error {
67
+ readonly code: S3ErrorCode;
68
+ /** The object key it was about — the bucket and the key, never the body. */
69
+ readonly key: string;
70
+ /**
71
+ * Only on `RANGE_NOT_SATISFIABLE`, and only when the service said it: the
72
+ * object's size in bytes. Absent on every other error.
73
+ */
74
+ readonly objectSize?: number;
75
+ constructor(code: S3ErrorCode, key: string, message: string, options?: {
76
+ cause?: unknown;
77
+ objectSize?: number;
78
+ });
79
+ }
80
+ //# sourceMappingURL=s3-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3-error.d.ts","sourceRoot":"","sources":["../../src/errors/s3-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,WAAW;AACtB;;;;GAIG;AACD,YAAY;AACd,uDAAuD;GACrD,WAAW;AACb,4EAA4E;GAC1E,cAAc;AAChB;;;;;;;;GAQG;GACD,cAAc;AAChB;;;;GAIG;GACD,eAAe;AACjB;;;;;;GAMG;GACD,eAAe;AACjB;;;;GAIG;GACD,SAAS;AACX;;;;;;;GAOG;GACD,uBAAuB,CAAC;AAE3B;;;;;;;;;GASG;AACH,qBAAa,OAAQ,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAiB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAGpC,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;CAWnD"}
@@ -0,0 +1,8 @@
1
+ export type { BindOptions, BoundBucket, PresignedPost, PresignGetOptions, PresignOptions, PresignPostOptions, } from './bucket/bind-bucket.js';
2
+ export { bindBucket } from './bucket/bind-bucket.js';
3
+ export { defineBucket } from './bucket/define-bucket.js';
4
+ export type { BucketDefinition, ByteRange, CallOptions, ObjectPage, OpenedObject, OpenOptions, OpenRange, ParamsOf, PutBody, PutOptions, StoredObject, StreamBody, StreamOptions, } from './bucket/types.js';
5
+ export { isBucketUnavailable } from './errors/is-bucket-unavailable.js';
6
+ export type { S3ErrorCode } from './errors/s3-error.js';
7
+ export { S3Error } from './errors/s3-error.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,kBAAkB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EACX,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,OAAO,EACP,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}