@cloudbitmaps/s3 0.19.1 → 0.21.0
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/README.md +4 -3
- package/dist/aws-errors.d.ts +4 -8
- package/dist/backend.d.ts +7 -5
- package/dist/bounded-body.d.ts +2 -1
- package/dist/client-probe.d.ts +7 -0
- package/dist/defined.d.ts +8 -0
- package/dist/index.js +286 -272
- package/dist/index.js.map +4 -4
- package/dist/read-timeout.d.ts +0 -4
- package/dist/registry.d.ts +3 -3
- package/dist/s3-errors.d.ts +11 -0
- package/dist/storage.d.ts +34 -16
- package/package.json +2 -2
- package/dist/keys.d.ts +0 -17
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ It builds its own client from your usual AWS credentials. Any other key is refus
|
|
|
44
44
|
| `maxSockets` | most sockets the client you do not pass opens at once, for `https` and plain `http` alike; a positive integer, default 128 (the SDK's own is 50; if a future SDK changes its handler, the built client keeps the SDK's own limit); refused beside `client` |
|
|
45
45
|
| `partBytes`, `maxObjectBytes` | multipart sizing: part size (default 8 MiB; the upload buffers one part at a time) and the largest object (about 80 GiB by default, up to S3's 5 TiB). A cap above 5 TiB, or a part above S3's 5 GiB part limit, is a `ValidationError` |
|
|
46
46
|
| `readTimeoutMs` | how long one read (a `GetObject` or `HeadObject`, its body included) may take before it throws `TransientError` and the store retries it; `0`, the default, sets no timeout. Writes are not timed |
|
|
47
|
-
| `conditionalDelete` | whether the registry removes a deleted row
|
|
47
|
+
| `conditionalDelete` | whether the store applies `If-Match` on a `DeleteObject`: the registry then removes a deleted row rather than leaving a tombstone, and the storage half deletes an erasure's holder only while it is the object the erasure read, by its ETag. On by default when the host the client resolves is an AWS S3 host, however its endpoint was set (`endpoint`, `AWS_ENDPOINT_URL_S3`, `AWS_ENDPOINT_URL`, the shared config file); off for any other host: set it for an S3-compatible store only once you know it applies the header (MinIO ignores it) |
|
|
48
48
|
|
|
49
49
|
## Before production
|
|
50
50
|
|
|
@@ -57,8 +57,9 @@ It builds its own client from your usual AWS credentials. Any other key is refus
|
|
|
57
57
|
MinIO, 3.640.0 silently overwrites an existing object, which loses a published generation. `If-Match` on
|
|
58
58
|
`PutObject`, which the registry's compare-and-swap is built on, is modelled from 3.700.0: 3.699.0's serializer
|
|
59
59
|
omits it, so a fenced row write goes out unconditionally and can land over a concurrent writer's. This package's
|
|
60
|
-
own range never resolves below 3.700.0. The registry also checks, before its first request, that the client it is given sends `If-Match`
|
|
61
|
-
`
|
|
60
|
+
own range never resolves below 3.700.0. The registry also checks, before its first request, that the client it is given sends `If-None-Match` and
|
|
61
|
+
`If-Match` on `PutObject`, and refuses a registry write it would send without its precondition; a client that does
|
|
62
|
+
not send `If-Match` on `DeleteObject` turns `conditionalDelete` off.
|
|
62
63
|
- **Grant `s3:GetObject`, `s3:PutObject`, `s3:DeleteObject`, `s3:AbortMultipartUpload` and `s3:ListBucket`.** Without
|
|
63
64
|
`s3:ListBucket`, S3 answers a missing key with `403` instead of `404`.
|
|
64
65
|
- **Add a lifecycle rule that aborts incomplete multipart uploads**, and never one that expires current objects or the
|
package/dist/aws-errors.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SDK-free helpers for classifying AWS-style errors (used by the S3 drivers).
|
|
3
|
-
*
|
|
4
|
-
* These only read structural shapes an AWS SDK v3 error carries — `name`, `$metadata.httpStatusCode`, a
|
|
5
|
-
* lower-level `code`/`errno`, and the SDK's own `$retryable` marker — so the (subtle, easy-to-get-wrong)
|
|
6
|
-
* transient-vs-fatal decision is unit-testable without a live backend or even the SDK installed. They import no SDK.
|
|
7
|
-
*/
|
|
8
1
|
export declare function httpStatus(err: unknown): number | undefined;
|
|
9
2
|
export declare function errorName(err: unknown): string | undefined;
|
|
10
3
|
/** A lower-level transport code (e.g. `ECONNRESET`) — the Node networking layer sets `code`. */
|
|
@@ -13,5 +6,8 @@ export declare function errorCode(err: unknown): string | undefined;
|
|
|
13
6
|
export declare function isSdkRetryable(err: unknown): boolean;
|
|
14
7
|
/** Any 5xx is a server-side fault that's safe to retry (the request didn't deterministically fail). */
|
|
15
8
|
export declare function isServerSide(err: unknown): boolean;
|
|
16
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* A dropped/timed-out connection — transient by nature; a retry on a fresh connection usually succeeds. The SDK's
|
|
11
|
+
* transport error names, the codes Node gives a failed connection ({@link isTransportFault}), and the messages above.
|
|
12
|
+
*/
|
|
17
13
|
export declare function isNetworkOrTimeout(err: unknown): boolean;
|
package/dist/backend.d.ts
CHANGED
|
@@ -89,11 +89,13 @@ export interface S3StorageOptions {
|
|
|
89
89
|
/** Injected clock for the registry's `createdAt`/`updatedAt`; defaults to `Date.now`. */
|
|
90
90
|
readonly now?: () => number;
|
|
91
91
|
/**
|
|
92
|
-
* Whether the
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
92
|
+
* Whether the store applies `If-Match` on a `DeleteObject`, which both halves rely on when it is on: the registry
|
|
93
|
+
* removes a deleted row for good rather than leaving a tombstone a full listing reads forever, and the storage half
|
|
94
|
+
* removes an erasure's holder only while it is the object the erasure searched, by its ETag. Defaults to `true` when
|
|
95
|
+
* the host the client resolves is an AWS S3 host, whichever way its endpoint was set (`endpoint`,
|
|
96
|
+
* `AWS_ENDPOINT_URL_S3`, `AWS_ENDPOINT_URL`, the shared config file), and to `false` for any other host: set it for an
|
|
97
|
+
* S3-compatible store only once you know the store applies `If-Match` on a delete. MinIO, for one, ignores it. It is
|
|
98
|
+
* never `true` for an SDK that does not send the header.
|
|
97
99
|
*/
|
|
98
100
|
readonly conditionalDelete?: boolean;
|
|
99
101
|
}
|
package/dist/bounded-body.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The `GetObject` response body, narrowed to the parts used. */
|
|
2
|
-
|
|
2
|
+
type ResponseBody = {
|
|
3
3
|
transformToByteArray?: () => Promise<Uint8Array>;
|
|
4
4
|
[Symbol.asyncIterator]?: () => AsyncIterator<unknown>;
|
|
5
5
|
destroy?: () => void;
|
|
@@ -12,3 +12,4 @@ export declare function destroyBody(body: unknown): void;
|
|
|
12
12
|
* propagates as it is.
|
|
13
13
|
*/
|
|
14
14
|
export declare function readBounded(body: ResponseBody, maxBytes: number, oversize: () => Error, advertised?: number): Promise<Uint8Array>;
|
|
15
|
+
export {};
|
package/dist/client-probe.d.ts
CHANGED
|
@@ -17,6 +17,13 @@ export declare const PROBE_KEY = "cloudbitmaps-probe";
|
|
|
17
17
|
* found out. Never throws, never sends a request, and never runs anything the caller added to `client`.
|
|
18
18
|
*/
|
|
19
19
|
export declare function probeClient(client: S3Client, bucket: string): Promise<ClientFacts | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Whether a `DeleteObject` may rely on `If-Match`, for the registry's row delete and the storage half's conditional
|
|
22
|
+
* delete alike: `explicit` when the caller set it, but never for an SDK seen not to send the header; otherwise only
|
|
23
|
+
* when the client resolves to an AWS S3 host, which applies the precondition, and `false` until the client has been
|
|
24
|
+
* asked, since an S3-compatible store (MinIO, for one) can accept the header and ignore it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function appliesDeleteIfMatch(explicit: boolean | undefined, facts: ClientFacts | undefined): boolean;
|
|
20
27
|
/**
|
|
21
28
|
* Whether `hostname` is an AWS S3 host, by its structure: under an AWS domain, with a label that names S3 (`s3`,
|
|
22
29
|
* `s3-fips`, an access point's, a multi-region access point's `s3-global`, Object Lambda's, an Outpost's, a dash-joined
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `values` without the entries that are `undefined`, typed as optional properties, so a constructor can pass on the
|
|
3
|
+
* options it was given: `exactOptionalPropertyTypes` refuses `{ x: undefined }` for an optional `x`, and a sub-driver
|
|
4
|
+
* must see an option the caller left out as absent.
|
|
5
|
+
*/
|
|
6
|
+
export declare function defined<T extends Record<string, unknown>>(values: T): {
|
|
7
|
+
[K in keyof T]?: Exclude<T[K], undefined>;
|
|
8
|
+
};
|