@gusto/baerly-storage 0.5.0 → 0.6.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/dist/API.md +3 -2
- package/dist/CHANGELOG.md +82 -0
- package/dist/THIRD-PARTY-LICENSES.txt +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/aws4fetch.esm-CXE5ZbAa.js +460 -0
- package/dist/aws4fetch.esm-CXE5ZbAa.js.map +1 -0
- package/dist/baerly.js +10 -10
- package/dist/baerly.spec.json +1 -1
- package/dist/client-react.d.ts +2 -2
- package/dist/{client-Fe8CwB73.d.ts → client-ypCm3zjt.d.ts} +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/{cloudflare-DzKBrUlg.js → cloudflare-wrVYf4bb.js} +457 -56
- package/dist/cloudflare-wrVYf4bb.js.map +1 -0
- package/dist/cloudflare.d.ts +3 -3
- package/dist/cloudflare.js +5 -5
- package/dist/{config-1tv0-Yzm.js → config-B6nTy8e2.js} +435 -33
- package/dist/config-B6nTy8e2.js.map +1 -0
- package/dist/constants-CfeMWQWk.js.map +1 -1
- package/dist/{cost-DSMIVqzL.js → cost-_SE_SVgZ.js} +4 -4
- package/dist/{cost-DSMIVqzL.js.map → cost-_SE_SVgZ.js.map} +1 -1
- package/dist/{db-DsPkOVEH.d.ts → db-DjjthkTi.d.ts} +2 -2
- package/dist/{deploy-DonTr-CV.js → deploy-Di_Q01qx.js} +5 -5
- package/dist/deploy-Di_Q01qx.js.map +1 -0
- package/dist/dev-vite.d.ts +31 -27
- package/dist/dev-vite.js +60 -30
- package/dist/dev-vite.js.map +1 -1
- package/dist/dev.d.ts +1 -1
- package/dist/doctor-RWVRpvat.js +102 -0
- package/dist/doctor-RWVRpvat.js.map +1 -0
- package/dist/{dump-Bh5k26VQ.js → dump-m2vEYDNY.js} +4 -4
- package/dist/{dump-Bh5k26VQ.js.map → dump-m2vEYDNY.js.map} +1 -1
- package/dist/{export-DtF5tDIM.js → export-DenKwEQu.js} +4 -4
- package/dist/{export-DtF5tDIM.js.map → export-DenKwEQu.js.map} +1 -1
- package/dist/{fsck-D_djMO5D.js → fsck-2Vq-7-e2.js} +5 -5
- package/dist/{fsck-D_djMO5D.js.map → fsck-2Vq-7-e2.js.map} +1 -1
- package/dist/gcs-admin-Bx6xSNJj.d.ts +123 -0
- package/dist/gcs.d.ts +18 -0
- package/dist/gcs.js +2 -0
- package/dist/goog4-signer-Z7KnJ1su.js +321 -0
- package/dist/goog4-signer-Z7KnJ1su.js.map +1 -0
- package/dist/{http-DGd5tbNs.js → http-7zT29K3P.js} +4 -4
- package/dist/{http-DGd5tbNs.js.map → http-7zT29K3P.js.map} +1 -1
- package/dist/{aws4fetch.esm-p7eEzLCs.js → http-transport-BTgVCY5r.js} +24 -476
- package/dist/http-transport-BTgVCY5r.js.map +1 -0
- package/dist/http.d.ts +2 -2
- package/dist/http.js +2 -2
- package/dist/{index-BNRh23K9.d.ts → index-BHz92Acj.d.ts} +2 -2
- package/dist/{index-BYk9oCNf.d.ts → index-CEZKQsKt.d.ts} +3 -2
- package/dist/{index-CuA9Mi3K.d.ts → index-DP3ClvcA.d.ts} +7 -7
- package/dist/{index-0rZcMBwy.d.ts → index-uE-w2dgj.d.ts} +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{inspect-6WZ-pC7-.js → inspect-BpYbH1DM.js} +5 -5
- package/dist/{inspect-6WZ-pC7-.js.map → inspect-BpYbH1DM.js.map} +1 -1
- package/dist/{log-tail-D98U1JBo.js → log-tail-QWU4wlu-.js} +3 -11
- package/dist/log-tail-QWU4wlu-.js.map +1 -0
- package/dist/{maintenance-B_e0T99L.d.ts → maintenance-BGHGt2Yg.d.ts} +2 -2
- package/dist/{maintenance-B4Dki6Ig.js → maintenance-DULFcpd1.js} +4 -17
- package/dist/maintenance-DULFcpd1.js.map +1 -0
- package/dist/{maintenance-C7coQp4c.js → maintenance-fEi-UZ2o.js} +5 -11
- package/dist/maintenance-fEi-UZ2o.js.map +1 -0
- package/dist/maintenance.d.ts +1 -1
- package/dist/maintenance.js +1 -1
- package/dist/node.d.ts +21 -60
- package/dist/node.js +4 -3
- package/dist/{observability-BmflLCdF.js → observability-Ch-VQJyE.js} +38 -16
- package/dist/{observability-BmflLCdF.js.map → observability-Ch-VQJyE.js.map} +1 -1
- package/dist/observability.d.ts +2 -2
- package/dist/observability.js +1 -1
- package/dist/{plan-a7PJHBCy.js → plan-C4qgiXSg.js} +2 -2
- package/dist/{plan-a7PJHBCy.js.map → plan-C4qgiXSg.js.map} +1 -1
- package/dist/{query-rAtXNQQB.js → query-C43r-6ib.js} +2 -2
- package/dist/{query-rAtXNQQB.js.map → query-C43r-6ib.js.map} +1 -1
- package/dist/{rebuild-index-BVzQSZlm.js → rebuild-index-BH1dc1p6.js} +4 -4
- package/dist/{rebuild-index-BVzQSZlm.js.map → rebuild-index-BH1dc1p6.js.map} +1 -1
- package/dist/{restore-R-4rbciV.js → restore-D0VYWzfP.js} +5 -5
- package/dist/{restore-R-4rbciV.js.map → restore-D0VYWzfP.js.map} +1 -1
- package/dist/{runtime-spec-Dsw2-n8S.js → runtime-spec--LykAdl1.js} +2 -2
- package/dist/{runtime-spec-Dsw2-n8S.js.map → runtime-spec--LykAdl1.js.map} +1 -1
- package/dist/{s3-http-B-z8th6O.d.ts → s3-http-DD5gDc7t.d.ts} +6 -4
- package/dist/s3.d.ts +1 -1
- package/dist/s3.js +1 -1
- package/dist/sha256-CqcKTjw9.js +22 -0
- package/dist/sha256-CqcKTjw9.js.map +1 -0
- package/dist/{src-BL_JoPTn.js → src-BMFfDUI2.js} +68 -28
- package/dist/{src-BL_JoPTn.js.map → src-BMFfDUI2.js.map} +1 -1
- package/dist/{src-CYHFDrKz.js → src-DvbTEya2.js} +3 -3
- package/dist/{src-CYHFDrKz.js.map → src-DvbTEya2.js.map} +1 -1
- package/dist/{subcommand-DoDA-K7d.js → subcommand-BV68pqwJ.js} +2 -2
- package/dist/{subcommand-DoDA-K7d.js.map → subcommand-BV68pqwJ.js.map} +1 -1
- package/dist/{usage-DBV1eQHC.js → usage-BMZR8o6U.js} +3 -3
- package/dist/{usage-DBV1eQHC.js.map → usage-BMZR8o6U.js.map} +1 -1
- package/package.json +10 -4
- package/dist/aws4fetch.esm-p7eEzLCs.js.map +0 -1
- package/dist/cloudflare-DzKBrUlg.js.map +0 -1
- package/dist/config-1tv0-Yzm.js.map +0 -1
- package/dist/deploy-DonTr-CV.js.map +0 -1
- package/dist/doctor-DSIyCDg_.js +0 -346
- package/dist/doctor-DSIyCDg_.js.map +0 -1
- package/dist/log-tail-D98U1JBo.js.map +0 -1
- package/dist/maintenance-B4Dki6Ig.js.map +0 -1
- package/dist/maintenance-C7coQp4c.js.map +0 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { c as configureObservability, n as flushCanonicalLine, o as deriveOutcome, r as flushUnauthorizedAndRespond, t as observableStorage, u as errorEnvelope } from "./observability-
|
|
1
|
+
import { c as configureObservability, n as flushCanonicalLine, o as deriveOutcome, r as flushUnauthorizedAndRespond, t as observableStorage, u as errorEnvelope } from "./observability-Ch-VQJyE.js";
|
|
2
2
|
import { d as MAINTENANCE_PROFILE_NODE } from "./constants-CfeMWQWk.js";
|
|
3
3
|
import { t as BaerlyError } from "./errors-Dfa3p78c.js";
|
|
4
|
-
import { o as parseMaintenanceEnv } from "./maintenance-
|
|
5
|
-
import { a as isDeployedEnv, n as resolveVerifier, t as Db } from "./src-
|
|
4
|
+
import { o as parseMaintenanceEnv } from "./maintenance-DULFcpd1.js";
|
|
5
|
+
import { a as isDeployedEnv, n as resolveVerifier, t as Db } from "./src-DvbTEya2.js";
|
|
6
6
|
import { a as uuid } from "./time-DUqvFMHq.js";
|
|
7
|
-
import { n as createRouter, o as Hono, r as mapError, t as MAX_BODY_BYTES } from "./http-
|
|
7
|
+
import { n as createRouter, o as Hono, r as mapError, t as MAX_BODY_BYTES } from "./http-7zT29K3P.js";
|
|
8
8
|
import { r as runWithContext, t as createObservabilityContext } from "./context-DRZ3tZ5l.js";
|
|
9
9
|
import { a as require_picocolors_browser, r as renderDevLanding, t as LocalFsStorage } from "./src-DYZ4H1aF.js";
|
|
10
|
-
import { t as handleSpecRequest } from "./runtime-spec
|
|
11
|
-
import {
|
|
10
|
+
import { t as handleSpecRequest } from "./runtime-spec--LykAdl1.js";
|
|
11
|
+
import { a as parseAssumeRoleWithWebIdentity, s as parseStsError } from "./http-transport-BTgVCY5r.js";
|
|
12
|
+
import { n as S3HttpStorage, t as AwsClient } from "./aws4fetch.esm-CXE5ZbAa.js";
|
|
13
|
+
import { r as GcsHttpStorage, t as goog4Signer } from "./goog4-signer-Z7KnJ1su.js";
|
|
12
14
|
import { readFile, stat } from "node:fs/promises";
|
|
13
15
|
import { extname, relative, resolve, sep } from "node:path";
|
|
14
16
|
import { STATUS_CODES, createServer } from "node:http";
|
|
@@ -51,12 +53,13 @@ const probeCas = async (storage, opts) => {
|
|
|
51
53
|
const key = `${prefix}__baerly_cas_probe__/${uuid()}`;
|
|
52
54
|
const enc = new TextEncoder();
|
|
53
55
|
const signal = opts?.signal;
|
|
56
|
+
const staleEtag = opts?.staleEtag ?? "\"baerly-cas-probe-stale\"";
|
|
54
57
|
const checks = [];
|
|
55
58
|
try {
|
|
56
59
|
await storage.put(key, enc.encode("v1"), { signal });
|
|
57
60
|
try {
|
|
58
61
|
await storage.put(key, enc.encode("v2"), {
|
|
59
|
-
ifMatch:
|
|
62
|
+
ifMatch: staleEtag,
|
|
60
63
|
signal
|
|
61
64
|
});
|
|
62
65
|
checks.push({
|
|
@@ -141,6 +144,44 @@ const probeCas = async (storage, opts) => {
|
|
|
141
144
|
};
|
|
142
145
|
};
|
|
143
146
|
//#endregion
|
|
147
|
+
//#region packages/adapter-node/src/gcs-admin.ts
|
|
148
|
+
/**
|
|
149
|
+
* GCS bucket-administration probes over the native XML API — read-only
|
|
150
|
+
* config checks that fall outside the four-verb `Storage` interface.
|
|
151
|
+
* Kept in the adapter so GCS wire details (endpoint/URL shape, the
|
|
152
|
+
* `?versioning` sub-resource, the XML response, GOOG4 signing) live
|
|
153
|
+
* behind the adapter boundary rather than leaking into the CLI.
|
|
154
|
+
*/
|
|
155
|
+
/** Case-sensitive per the GCS `?versioning` XML shape; tolerate surrounding whitespace. */
|
|
156
|
+
const VERSIONING_ENABLED_RE = /<Status>\s*Enabled\s*<\/Status>/;
|
|
157
|
+
/**
|
|
158
|
+
* Read a GCS bucket's Object Versioning setting over the native XML API
|
|
159
|
+
* (`GET <endpoint>/<bucket>?versioning`), signed with GOOG4-HMAC-SHA256.
|
|
160
|
+
* Never throws — a non-2xx response or a network error resolves to
|
|
161
|
+
* `{ kind: "inconclusive", reason }`, so callers (e.g. `baerly doctor`)
|
|
162
|
+
* can degrade gracefully instead of aborting.
|
|
163
|
+
*/
|
|
164
|
+
async function gcsVersioningStatus(opts) {
|
|
165
|
+
const endpoint = (opts.endpoint ?? "https://storage.googleapis.com").replace(/\/+$/, "");
|
|
166
|
+
const fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);
|
|
167
|
+
const sign = goog4Signer({ credentials: opts.credentials });
|
|
168
|
+
const url = `${endpoint}/${opts.bucket}?versioning`;
|
|
169
|
+
try {
|
|
170
|
+
const res = await fetchImpl(await sign(new Request(url, { method: "GET" })));
|
|
171
|
+
if (!res.ok) return {
|
|
172
|
+
kind: "inconclusive",
|
|
173
|
+
reason: `HTTP ${res.status}`
|
|
174
|
+
};
|
|
175
|
+
const body = await res.text();
|
|
176
|
+
return VERSIONING_ENABLED_RE.test(body) ? { kind: "enabled" } : { kind: "disabled" };
|
|
177
|
+
} catch (error) {
|
|
178
|
+
return {
|
|
179
|
+
kind: "inconclusive",
|
|
180
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
144
185
|
//#region packages/adapter-node/src/credentials/signer.ts
|
|
145
186
|
const REFRESH_BUFFER_MS = 300 * 1e3;
|
|
146
187
|
function buildAwsClient(creds, region) {
|
|
@@ -298,20 +339,19 @@ function minioStorage(opts) {
|
|
|
298
339
|
});
|
|
299
340
|
}
|
|
300
341
|
/**
|
|
301
|
-
* Google Cloud Storage `Storage` factory
|
|
302
|
-
* at `https://storage.googleapis.com`.
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
* `
|
|
342
|
+
* Google Cloud Storage `Storage` factory over the native GCS XML API
|
|
343
|
+
* at `https://storage.googleapis.com`. Wraps {@link GcsHttpStorage} with
|
|
344
|
+
* a GOOG4-HMAC-SHA256 signer, driving GCS's own generation-precondition
|
|
345
|
+
* conditional writes (`x-goog-if-generation-match: 0` for create-if-absent,
|
|
346
|
+
* `x-goog-if-generation-match: <generation>` for compare-and-swap), which
|
|
347
|
+
* return `412` on a lost write. The object `generation` is carried verbatim
|
|
348
|
+
* as the opaque `Storage` etag. This is the sanctioned GCS path — the
|
|
349
|
+
* S3-interop endpoint treats `If-Match`/`If-None-Match` as read-scoped only
|
|
350
|
+
* and cannot linearize the log, so it is not supported.
|
|
306
351
|
*
|
|
307
|
-
* GCS
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* read-only (native conditional writes use `x-goog-if-generation-match`).
|
|
311
|
-
* Whether GCS's interop layer enforces S3-style conditional *writes* is
|
|
312
|
-
* unverified — run `baerly doctor --bucket=<your-gcs-bucket>` before
|
|
313
|
-
* relying on it; a backend that fails the CAS probe is not a safe baerly
|
|
314
|
-
* store. See ADR-002.
|
|
352
|
+
* Authentication uses GCS HMAC keys (Console → Settings → Interoperability)
|
|
353
|
+
* — mint an interop key, put the HMAC access key in `credentials.accessKeyId`
|
|
354
|
+
* and the HMAC secret in `credentials.secretAccessKey`.
|
|
315
355
|
*
|
|
316
356
|
* @example
|
|
317
357
|
* ```ts
|
|
@@ -327,11 +367,11 @@ function minioStorage(opts) {
|
|
|
327
367
|
* ```
|
|
328
368
|
*/
|
|
329
369
|
function gcsStorage(opts) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
region: "auto",
|
|
370
|
+
const sign = goog4Signer({ credentials: opts.credentials });
|
|
371
|
+
return new GcsHttpStorage({
|
|
333
372
|
bucket: opts.bucket,
|
|
334
|
-
|
|
373
|
+
sign,
|
|
374
|
+
...opts.endpoint !== void 0 && { endpoint: opts.endpoint }
|
|
335
375
|
});
|
|
336
376
|
}
|
|
337
377
|
//#endregion
|
|
@@ -477,7 +517,7 @@ const assertStorageReachable = async (storage, opts) => {
|
|
|
477
517
|
} catch (error) {
|
|
478
518
|
throw new BaerlyError("NetworkError", `Storage readiness check failed: the backend could not be reached. Verify the bucket name, region/endpoint, and credentials. Cause: ${error instanceof Error ? error.message : String(error)}`, error);
|
|
479
519
|
}
|
|
480
|
-
if (!result.ok) throw new BaerlyError("InvalidConfig", `Storage readiness check failed — the backend does not honour the conditional writes baerly requires (data corruption risk). Use a
|
|
520
|
+
if (!result.ok) throw new BaerlyError("InvalidConfig", `Storage readiness check failed — the backend does not honour the conditional writes baerly requires (data corruption risk). Use a store that honours them: AWS S3 or Cloudflare R2 (If-Match / If-None-Match), or native Google Cloud Storage via \`gcsStorage\` (x-goog-if-generation-match). GCS's S3-interop endpoint is not supported.\n${result.checks.filter((c) => !c.ok).map((c) => ` - ${c.name}: ${c.detail}`).join("\n")}`);
|
|
481
521
|
};
|
|
482
522
|
//#endregion
|
|
483
523
|
//#region packages/adapter-node/src/credentials/token-file.ts
|
|
@@ -489,7 +529,7 @@ const assertStorageReachable = async (storage, opts) => {
|
|
|
489
529
|
*
|
|
490
530
|
* A missing / unreadable / empty projected token is a deploy misconfig, not a
|
|
491
531
|
* transient fault — so every failure is `InvalidConfig`, which short-circuits
|
|
492
|
-
* the retry loop (see `PERMANENT_ERROR_CODES` in `
|
|
532
|
+
* the retry loop (see `PERMANENT_ERROR_CODES` in `http-transport.ts`) instead of
|
|
493
533
|
* hammering the credential source. Error messages name the specific env var
|
|
494
534
|
* so the misconfig is debuggable.
|
|
495
535
|
*/
|
|
@@ -2266,6 +2306,6 @@ function baerlyNode(opts) {
|
|
|
2266
2306
|
};
|
|
2267
2307
|
}
|
|
2268
2308
|
//#endregion
|
|
2269
|
-
export { fromEksPodIdentity as a, localFsStorage as c, r2Storage as d, s3Storage as f, fromWebIdentity as i, gcsStorage as l, getRequestListener as n, assertStorageReachable as o, fromEks as r, resolveStorageFromEnv as s, baerlyNode as t, minioStorage as u };
|
|
2309
|
+
export { fromEksPodIdentity as a, localFsStorage as c, r2Storage as d, s3Storage as f, fromWebIdentity as i, gcsStorage as l, getRequestListener as n, assertStorageReachable as o, gcsVersioningStatus as p, fromEks as r, resolveStorageFromEnv as s, baerlyNode as t, minioStorage as u };
|
|
2270
2310
|
|
|
2271
|
-
//# sourceMappingURL=src-
|
|
2311
|
+
//# sourceMappingURL=src-BMFfDUI2.js.map
|