@cloudbitmaps/gcs 0.20.0 → 0.22.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 +32 -1
- package/dist/backend.d.ts +14 -10
- package/dist/index.js +449 -229
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
- package/dist/bucket-presence.d.ts +0 -37
- package/dist/crc32c.d.ts +0 -5
- package/dist/download-retry.d.ts +0 -8
- package/dist/gcs-errors.d.ts +0 -46
- package/dist/keys.d.ts +0 -31
- package/dist/read-client.d.ts +0 -6
- package/dist/read-once.d.ts +0 -52
- package/dist/read-timeout.d.ts +0 -28
- package/dist/registry.d.ts +0 -89
- package/dist/scrub-error.d.ts +0 -18
- package/dist/send-once.d.ts +0 -5
- package/dist/storage.d.ts +0 -106
package/README.md
CHANGED
|
@@ -14,7 +14,14 @@ second service to run.
|
|
|
14
14
|
pnpm add @cloudbitmaps/roaring @cloudbitmaps/gcs
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
`roaring` needs its one install script to fetch its native binary, and newer clients run a dependency's script only if you allow it. Allow it before you install:
|
|
18
|
+
|
|
19
|
+
- **npm 12:** add `{ "allowScripts": { "roaring": true } }` to your `package.json`. Without it the install exits 0 and the package throws at `import`. npm 11 runs the script but warns until you allow it the same way.
|
|
20
|
+
- **pnpm 11 and later:** put `allowBuilds: { roaring: true }` in a `pnpm-workspace.yaml` beside your `package.json`. Those versions no longer read the `package.json` `pnpm` key. Without it the install exits 1 with `ERR_PNPM_IGNORED_BUILDS`.
|
|
21
|
+
- **pnpm 10:** add `{ "pnpm": { "onlyBuiltDependencies": ["roaring"] } }` to your `package.json`. Without it the install exits 0 and the package throws at `import`.
|
|
22
|
+
- **pnpm 9:** nothing extra.
|
|
23
|
+
|
|
24
|
+
[Details](https://github.com/cloudbitmaps/cloudbitmaps/blob/main/docs/guide/getting-started.md#cannot-find-module-buildreleaseroaringnode-after-a-successful-install).
|
|
18
25
|
|
|
19
26
|
`@google-cloud/storage` (`^7 || ^8`) is a real dependency of this package, so installing it is the whole step.
|
|
20
27
|
`@cloudbitmaps/core`, the engine underneath, arrives with it and you never name it.
|
|
@@ -109,6 +116,30 @@ It builds its own client from Application Default Credentials. Any other key is
|
|
|
109
116
|
store's clock).
|
|
110
117
|
|
|
111
118
|
The [production checklist](https://github.com/cloudbitmaps/cloudbitmaps/blob/main/docs/guide/production.md) covers each item, and the ones every backend shares: backups of the data and the registry, and a schedule for your loads.
|
|
119
|
+
- **The driver redacts the credentials it recognises from an error before it throws it.** The SDK keeps the response it
|
|
120
|
+
got on the error (`response`), and through it the request it sent, with the bearer token in its `Authorization`
|
|
121
|
+
header, and the HTTP agent it shares with other calls; a resumable upload's or a token request's error keeps the
|
|
122
|
+
request's `config`. On a download, and wherever a body lists no errors, the SDK makes the response body the error's
|
|
123
|
+
message, so a proxy's page or a JSON body that quotes the request puts the token in the message. In the error the
|
|
124
|
+
driver throws, the value under a credential's name is replaced by `[redacted]` (`authorization`,
|
|
125
|
+
`x-goog-encryption-key`, `x-goog-api-key`, `X-Goog-Signature`, `X-Goog-Credential`, `access_token`, `refresh_token`,
|
|
126
|
+
`client_secret`, `private_key` and the like; a service account's `client_email` and `private_key_id` are kept), and so
|
|
127
|
+
are the value after one in a header list or under one in a map, the value beside one in a record (a `{ name, value }`
|
|
128
|
+
pair, a `{ th, td }` row; a number, a boolean, and the `message`, `reason` and `location` of a Google error item are
|
|
129
|
+
kept), and, anywhere in its text, a credential header line; an `Authorization` value, an encryption key, an API key,
|
|
130
|
+
an OAuth token or client secret, or a signed URL's signature or credential after its name; a cookie header's value
|
|
131
|
+
after its name; a bearer token after its scheme; a Google access token (`ya29.`) or a JWT on its own; a V2 signed
|
|
132
|
+
URL's `Signature=`; a PEM private key's body; the text of an element named for a credential, such as the
|
|
133
|
+
`<CanonicalRequest>` a service quotes back; and the text of the cell after one that names a credential (a
|
|
134
|
+
`<th>`/`<td>` row, a `<dt>`/`<dd>` pair, after a heading or a caption too). A credential in another form is not
|
|
135
|
+
recognised (a header table laid out by column, a user and password written into a URL, a colon written as an HTML
|
|
136
|
+
entity such as `:` in a body a download quotes as it came), and a text these steps cannot finish is replaced
|
|
137
|
+
whole. An SDK error that carries its transport or shows a credential, and every error it reaches (its `cause` chain,
|
|
138
|
+
an `AggregateError`'s `errors`), is thrown as a copy: a native error with the same prototype, name, message, stack,
|
|
139
|
+
`code`, `status` and `errors`, with `response` reduced to its status and status text, so classification is unchanged,
|
|
140
|
+
without `config`, the request, its agent or socket, any function or accessor property, or anything nested deeper than
|
|
141
|
+
ten levels. The live error is never changed, and an error that holds only plain data and shows no credential is thrown
|
|
142
|
+
as it is.
|
|
112
143
|
|
|
113
144
|
## Documentation
|
|
114
145
|
|
package/dist/backend.d.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `GcsStorage` — the Google Cloud Storage backend as one object: generations and pointer, one bucket, stated once.
|
|
3
|
-
*
|
|
4
|
-
* See {@link StorageBackend} for why the two halves are configured together rather than separately.
|
|
5
|
-
*
|
|
6
|
-
* **A note on the word.** `@google-cloud/storage` names its own client class `Storage`, so the driver option
|
|
7
|
-
* that takes it is also called `storage` — which, since this library calls its durable tier storage too, reads
|
|
8
|
-
* as the same word meaning two things. That is why this class builds the client itself: `new GcsStorage({ bucket })`
|
|
9
|
-
* never makes you write `{ storage: storage }`. Supply `client` when you need your own.
|
|
10
|
-
*/
|
|
11
1
|
import { STORAGE_BACKEND } from '@cloudbitmaps/core/driver-kit';
|
|
12
2
|
import type { IRegistryDriver, IStorageDriver, StorageBackend } from '@cloudbitmaps/core/driver-kit';
|
|
13
3
|
import { Storage as GcsClient } from '@google-cloud/storage';
|
|
4
|
+
/**
|
|
5
|
+
* What {@link GcsStorage} takes: a `bucket`, and either a `client` or the two settings that build one (`projectId`,
|
|
6
|
+
* `apiEndpoint`), never both.
|
|
7
|
+
*/
|
|
14
8
|
export interface GcsStorageOptions {
|
|
15
9
|
/** Target bucket (must already exist). */
|
|
16
10
|
readonly bucket: string;
|
|
@@ -77,6 +71,16 @@ export interface GcsStorageOptions {
|
|
|
77
71
|
* for a client pointed at an emulator that is production traffic from a wiring typo.
|
|
78
72
|
*/
|
|
79
73
|
export declare const GCS_STORAGE_OPTION_KEYS: readonly ["bucket", "prefix", "client", "projectId", "apiEndpoint", "maxObjectBytes", "simpleUploadThresholdBytes", "now", "readTimeoutMs", "conditionalDelete"];
|
|
74
|
+
/**
|
|
75
|
+
* `GcsStorage` — the Google Cloud Storage backend as one object: generations and pointer, one bucket, stated once.
|
|
76
|
+
*
|
|
77
|
+
* See {@link StorageBackend} for why the two halves are configured together rather than separately.
|
|
78
|
+
*
|
|
79
|
+
* **A note on the word.** `@google-cloud/storage` names its own client class `Storage`, so the driver option
|
|
80
|
+
* that takes it is also called `storage` — which, since this library calls its durable tier storage too, reads
|
|
81
|
+
* as the same word meaning two things. That is why this class builds the client itself: `new GcsStorage({ bucket })`
|
|
82
|
+
* never makes you write `{ storage: storage }`. Supply `client` when you need your own.
|
|
83
|
+
*/
|
|
80
84
|
export declare class GcsStorage implements StorageBackend {
|
|
81
85
|
/** Cross-bundle brand, stamped non-enumerably in the constructor so a spread cannot carry it. */
|
|
82
86
|
readonly [STORAGE_BACKEND]: true;
|