@gusto/baerly-storage 0.6.0 → 0.7.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 +47 -124
- package/dist/API.md +161 -512
- package/dist/CHANGELOG.md +1137 -378
- package/dist/RECIPES.md +398 -80
- package/dist/THIRD-PARTY-LICENSES.txt +5 -26
- package/dist/{app-config-DyiFK3_k.d.ts → app-config-C6qW7m8S.d.ts} +119 -111
- package/dist/app-config.d.ts +31 -1
- package/dist/app-config.js +1 -2
- package/dist/app-config.js.map +1 -1
- package/dist/auth.d.ts +33 -28
- package/dist/auth.js +549 -985
- package/dist/auth.js.map +1 -1
- package/dist/baerly.js +130 -138
- package/dist/baerly.js.map +1 -1
- package/dist/baerly.spec.json +97 -22
- package/dist/capacity-warning-header-BlVopyiI.js +16 -0
- package/dist/capacity-warning-header-BlVopyiI.js.map +1 -0
- package/dist/{client-ypCm3zjt.d.ts → client-CHQTXpef.d.ts} +121 -36
- package/dist/client-react.d.ts +67 -20
- package/dist/client-react.js +240 -54
- package/dist/client-react.js.map +1 -1
- package/dist/client.d.ts +5 -4
- package/dist/client.js +51 -16
- package/dist/client.js.map +1 -1
- package/dist/{cloudflare-wrVYf4bb.js → cloudflare-CKHYXccw.js} +61 -82
- package/dist/cloudflare-CKHYXccw.js.map +1 -0
- package/dist/cloudflare.d.ts +106 -71
- package/dist/cloudflare.js +334 -271
- package/dist/cloudflare.js.map +1 -1
- package/dist/code-resolution-CL_7L0wS.js +22 -0
- package/dist/code-resolution-CL_7L0wS.js.map +1 -0
- package/dist/collection-api-DbyhLAY8.d.ts +1001 -0
- package/dist/config-DEzInG6M.js +4035 -0
- package/dist/config-DEzInG6M.js.map +1 -0
- package/dist/constants-D3GSH3tc.js +469 -0
- package/dist/constants-D3GSH3tc.js.map +1 -0
- package/dist/{context-DRZ3tZ5l.js → context-rlpSnHFA.js} +17 -17
- package/dist/context-rlpSnHFA.js.map +1 -0
- package/dist/cost-B52llVDx.js +330 -0
- package/dist/cost-B52llVDx.js.map +1 -0
- package/dist/{current-json-C6nhPOm1.js → current-json-CC6lE4Aj.js} +115 -32
- package/dist/current-json-CC6lE4Aj.js.map +1 -0
- package/dist/db-plFUNTSF.d.ts +130 -0
- package/dist/db-read-seams-BSs0m1z1.js +3261 -0
- package/dist/db-read-seams-BSs0m1z1.js.map +1 -0
- package/dist/{deploy-Di_Q01qx.js → deploy-Obj4nE-Z.js} +10 -14
- package/dist/deploy-Obj4nE-Z.js.map +1 -0
- package/dist/{dev-banner-CWHIk8tH.d.ts → dev-banner-B5AUHmu1.d.ts} +1 -4
- package/dist/dev-landing-BI5UdmOb.d.ts +32 -0
- package/dist/dev-landing-CD-si4dW.js +50 -0
- package/dist/dev-landing-CD-si4dW.js.map +1 -0
- package/dist/dev-vite.d.ts +9 -14
- package/dist/dev-vite.js +11 -10
- package/dist/dev-vite.js.map +1 -1
- package/dist/dev.d.ts +3 -2
- package/dist/dev.js +2 -1
- package/dist/doctor-BA0i-YAN.js +270 -0
- package/dist/doctor-BA0i-YAN.js.map +1 -0
- package/dist/dump-D1vX8ozg.js +133 -0
- package/dist/dump-D1vX8ozg.js.map +1 -0
- package/dist/errors-7Rk1HGCE.js +160 -0
- package/dist/errors-7Rk1HGCE.js.map +1 -0
- package/dist/{validate-DtljsCh1.js → export-BVL2EvYE.js} +409 -19
- package/dist/export-BVL2EvYE.js.map +1 -0
- package/dist/fsck-BWkPgov4.js +145 -0
- package/dist/fsck-BWkPgov4.js.map +1 -0
- package/dist/{gcs-admin-Bx6xSNJj.d.ts → gcs-admin-Dso1HWQj.d.ts} +18 -14
- package/dist/gcs.d.ts +19 -7
- package/dist/gcs.js +1 -2
- package/dist/{goog4-signer-Z7KnJ1su.js → goog4-signer-CeLIABoE.js} +102 -92
- package/dist/goog4-signer-CeLIABoE.js.map +1 -0
- package/dist/{http-7zT29K3P.js → http-Z5rZyYMX.js} +898 -271
- package/dist/http-Z5rZyYMX.js.map +1 -0
- package/dist/http-transport-DNUM8kU-.js +1299 -0
- package/dist/http-transport-DNUM8kU-.js.map +1 -0
- package/dist/http.d.ts +366 -294
- package/dist/http.js +2 -2
- package/dist/index-JJrIu1pO.d.ts +135 -0
- package/dist/index-LEgHN0qJ.d.ts +50 -0
- package/dist/{index-DP3ClvcA.d.ts → index-RiEYj8t0.d.ts} +291 -78
- package/dist/index.d.ts +27 -6
- package/dist/index.js +3 -5
- package/dist/inspect-BTsVYZKd.js +196 -0
- package/dist/inspect-BTsVYZKd.js.map +1 -0
- package/dist/{key-Di6yyxFu.js → key-C4FPZ9Io.js} +3 -4
- package/dist/{key-Di6yyxFu.js.map → key-C4FPZ9Io.js.map} +1 -1
- package/dist/ledger-Dj_bGgo0.js +192 -0
- package/dist/ledger-Dj_bGgo0.js.map +1 -0
- package/dist/legacy-names-DgZBtgOh.js +47 -0
- package/dist/legacy-names-DgZBtgOh.js.map +1 -0
- package/dist/log-C9W15Dfo.d.ts +94 -0
- package/dist/log-tail-DWJbneBF.js +142 -0
- package/dist/log-tail-DWJbneBF.js.map +1 -0
- package/dist/log-walk-C-vA-WGJ.js +111 -0
- package/dist/log-walk-C-vA-WGJ.js.map +1 -0
- package/dist/maintenance-Dd-Yakqj.js +1709 -0
- package/dist/maintenance-Dd-Yakqj.js.map +1 -0
- package/dist/maintenance-DevB6z4e.js +2237 -0
- package/dist/maintenance-DevB6z4e.js.map +1 -0
- package/dist/maintenance.d.ts +100 -3
- package/dist/maintenance.js +1 -3
- package/dist/node.d.ts +119 -92
- package/dist/node.js +3 -3
- package/dist/{observability-Ch-VQJyE.js → observability-C-ISCCLE.js} +1247 -326
- package/dist/observability-C-ISCCLE.js.map +1 -0
- package/dist/observability.d.ts +27 -3
- package/dist/observability.js +3 -3
- package/dist/path-segment-DBXG26PW.js +363 -0
- package/dist/path-segment-DBXG26PW.js.map +1 -0
- package/dist/{plan-C4qgiXSg.js → plan-BvQbaNMe.js} +19 -11
- package/dist/plan-BvQbaNMe.js.map +1 -0
- package/dist/request-CRWiTrza.js +272 -0
- package/dist/request-CRWiTrza.js.map +1 -0
- package/dist/restore-U6Im8V1V.js +1467 -0
- package/dist/restore-U6Im8V1V.js.map +1 -0
- package/dist/retry-OBtLB2GC.js +126 -0
- package/dist/retry-OBtLB2GC.js.map +1 -0
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/{runtime-spec--LykAdl1.js → runtime-spec-B5mg3pHF.js} +189 -28
- package/dist/runtime-spec-B5mg3pHF.js.map +1 -0
- package/dist/{s3-http-DD5gDc7t.d.ts → s3-http-DBC_wiCL.d.ts} +14 -8
- package/dist/s3.d.ts +20 -7
- package/dist/s3.js +4 -5
- package/dist/s3.js.map +1 -1
- package/dist/{sha256-CqcKTjw9.js → sha256-4FfGQNPw.js} +9 -9
- package/dist/sha256-4FfGQNPw.js.map +1 -0
- package/dist/{shared-secret-DgEicd3x.js → shared-secret-Vkur-8r0.js} +27 -15
- package/dist/shared-secret-Vkur-8r0.js.map +1 -0
- package/dist/{aws4fetch.esm-CXE5ZbAa.js → sigv4-sign-5IUflUD_.js} +143 -96
- package/dist/sigv4-sign-5IUflUD_.js.map +1 -0
- package/dist/snapshot-CknzkDM0.js +148 -0
- package/dist/snapshot-CknzkDM0.js.map +1 -0
- package/dist/{src-BMFfDUI2.js → src-Actga-bO.js} +949 -363
- package/dist/src-Actga-bO.js.map +1 -0
- package/dist/src-D0MQfvOp.js +812 -0
- package/dist/src-D0MQfvOp.js.map +1 -0
- package/dist/src-Dr9uo3dc.js +501 -0
- package/dist/src-Dr9uo3dc.js.map +1 -0
- package/dist/{subcommand-BV68pqwJ.js → subcommand-BLoF66dG.js} +89 -16
- package/dist/subcommand-BLoF66dG.js.map +1 -0
- package/dist/{time-DUqvFMHq.js → time-DRxTP9iv.js} +15 -34
- package/dist/time-DRxTP9iv.js.map +1 -0
- package/dist/types-suVbsEWS.d.ts +116 -0
- package/dist/{usage-BMZR8o6U.js → usage-CPzVhrQr.js} +40 -45
- package/dist/usage-CPzVhrQr.js.map +1 -0
- package/dist/uuid-BuT_c404.js +333 -0
- package/dist/uuid-BuT_c404.js.map +1 -0
- package/dist/verifier-Bmlmndzo.d.ts +95 -0
- package/dist/{wire-izfGZDvr.js → wire-DndvKU-K.js} +2 -3
- package/dist/wire-DndvKU-K.js.map +1 -0
- package/package.json +90 -69
- package/dist/aws4fetch.esm-CXE5ZbAa.js.map +0 -1
- package/dist/bytes-BXdamO3L.js +0 -11
- package/dist/bytes-BXdamO3L.js.map +0 -1
- package/dist/cloudflare-wrVYf4bb.js.map +0 -1
- package/dist/config-B6nTy8e2.js +0 -3095
- package/dist/config-B6nTy8e2.js.map +0 -1
- package/dist/constants-CfeMWQWk.js +0 -222
- package/dist/constants-CfeMWQWk.js.map +0 -1
- package/dist/context-DRZ3tZ5l.js.map +0 -1
- package/dist/cost-_SE_SVgZ.js +0 -203
- package/dist/cost-_SE_SVgZ.js.map +0 -1
- package/dist/current-json-C6nhPOm1.js.map +0 -1
- package/dist/db-DjjthkTi.d.ts +0 -254
- package/dist/deploy-Di_Q01qx.js.map +0 -1
- package/dist/doctor-RWVRpvat.js +0 -102
- package/dist/doctor-RWVRpvat.js.map +0 -1
- package/dist/dump-m2vEYDNY.js +0 -94
- package/dist/dump-m2vEYDNY.js.map +0 -1
- package/dist/errors-Dfa3p78c.js +0 -78
- package/dist/errors-Dfa3p78c.js.map +0 -1
- package/dist/export-DenKwEQu.js +0 -401
- package/dist/export-DenKwEQu.js.map +0 -1
- package/dist/fsck-2Vq-7-e2.js +0 -279
- package/dist/fsck-2Vq-7-e2.js.map +0 -1
- package/dist/goog4-signer-Z7KnJ1su.js.map +0 -1
- package/dist/http-7zT29K3P.js.map +0 -1
- package/dist/http-transport-BTgVCY5r.js +0 -1250
- package/dist/http-transport-BTgVCY5r.js.map +0 -1
- package/dist/index-BHz92Acj.d.ts +0 -162
- package/dist/index-CEZKQsKt.d.ts +0 -1113
- package/dist/index-uE-w2dgj.d.ts +0 -115
- package/dist/indexes-Dn9hbGQG.d.ts +0 -22
- package/dist/inspect-BpYbH1DM.js +0 -133
- package/dist/inspect-BpYbH1DM.js.map +0 -1
- package/dist/log-tail-QWU4wlu-.js +0 -514
- package/dist/log-tail-QWU4wlu-.js.map +0 -1
- package/dist/maintenance-BGHGt2Yg.d.ts +0 -537
- package/dist/maintenance-DULFcpd1.js +0 -2144
- package/dist/maintenance-DULFcpd1.js.map +0 -1
- package/dist/maintenance-fEi-UZ2o.js +0 -1412
- package/dist/maintenance-fEi-UZ2o.js.map +0 -1
- package/dist/normalize-rjnZLwS4.js +0 -133
- package/dist/normalize-rjnZLwS4.js.map +0 -1
- package/dist/observability-Ch-VQJyE.js.map +0 -1
- package/dist/plan-C4qgiXSg.js.map +0 -1
- package/dist/query-C43r-6ib.js +0 -1773
- package/dist/query-C43r-6ib.js.map +0 -1
- package/dist/rebuild-index-BH1dc1p6.js +0 -81
- package/dist/rebuild-index-BH1dc1p6.js.map +0 -1
- package/dist/request-u0M51mhJ.js +0 -72
- package/dist/request-u0M51mhJ.js.map +0 -1
- package/dist/restore-D0VYWzfP.js +0 -778
- package/dist/restore-D0VYWzfP.js.map +0 -1
- package/dist/rolldown-runtime-EAsCxrDo.js +0 -14
- package/dist/runtime-spec--LykAdl1.js.map +0 -1
- package/dist/sha256-CqcKTjw9.js.map +0 -1
- package/dist/shared-secret-DgEicd3x.js.map +0 -1
- package/dist/src-BMFfDUI2.js.map +0 -1
- package/dist/src-DYZ4H1aF.js +0 -392
- package/dist/src-DYZ4H1aF.js.map +0 -1
- package/dist/src-DvbTEya2.js +0 -536
- package/dist/src-DvbTEya2.js.map +0 -1
- package/dist/subcommand-BV68pqwJ.js.map +0 -1
- package/dist/time-DUqvFMHq.js.map +0 -1
- package/dist/usage-BMZR8o6U.js.map +0 -1
- package/dist/validate-DtljsCh1.js.map +0 -1
- package/dist/wire-izfGZDvr.js.map +0 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as isWriteConflict, s as BaerlyError } from "./baerly.js";
|
|
2
|
+
import { D as SHARED_SECRET_MISSING_MESSAGE, O as CF_ACCESS_TEAM_NAME_PATTERN, l as uuid, n as parseBucketUri, r as goog4Signer } from "./config-DEzInG6M.js";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
|
-
|
|
7
|
-
const isConflict = (error) => error instanceof BaerlyError && error.code === "Conflict";
|
|
6
|
+
// ../protocol/src/storage/probe-cas.ts
|
|
8
7
|
/**
|
|
9
8
|
* Runtime probe that a live `Storage` backend honours the conditional
|
|
10
9
|
* writes the protocol depends on. The storage conformance suite asserts
|
|
@@ -22,16 +21,16 @@ const isConflict = (error) => error instanceof BaerlyError && error.code === "Co
|
|
|
22
21
|
* Writes throwaway sentinels under `keyPrefix` and deletes them on
|
|
23
22
|
* the way out (even on failure). Three checks, mirroring the conformance
|
|
24
23
|
* suite:
|
|
25
|
-
* - `ifMatch-stale`: a PUT with a stale `ifMatch` must reject (
|
|
24
|
+
* - `ifMatch-stale`: a PUT with a stale `ifMatch` must reject (WriteConflict).
|
|
26
25
|
* - `ifNoneMatch-exists`: a PUT with `ifNoneMatch:"*"` over an existing
|
|
27
|
-
* key must reject (
|
|
26
|
+
* key must reject (WriteConflict).
|
|
28
27
|
* - `ifNoneMatch-concurrent`: at most one of N concurrent create-if-absent
|
|
29
28
|
* writes on a fresh key wins — the linearizability the writer's log-append
|
|
30
29
|
* commit already relies on (`writer.ts`).
|
|
31
30
|
*
|
|
32
|
-
* A rejected write surfaces as a `BaerlyError` with `code === "
|
|
31
|
+
* A rejected write surfaces as a `BaerlyError` with `code === "WriteConflict"`
|
|
33
32
|
* (the contract `Storage.put` documents); anything else — a resolved
|
|
34
|
-
* promise, or a non-
|
|
33
|
+
* promise, or a non-WriteConflict error — is reported as a failed or
|
|
35
34
|
* inconclusive check rather than thrown.
|
|
36
35
|
*/
|
|
37
36
|
const probeCas = async (storage, opts) => {
|
|
@@ -54,14 +53,14 @@ const probeCas = async (storage, opts) => {
|
|
|
54
53
|
detail: "PUT with a stale If-Match was ACCEPTED — backend ignores If-Match (silent lost-update risk)."
|
|
55
54
|
});
|
|
56
55
|
} catch (error) {
|
|
57
|
-
checks.push(
|
|
56
|
+
checks.push(isWriteConflict(error) ? {
|
|
58
57
|
name: "ifMatch-stale",
|
|
59
58
|
ok: true,
|
|
60
|
-
detail: "stale If-Match rejected (
|
|
59
|
+
detail: "stale If-Match rejected (WriteConflict), as required."
|
|
61
60
|
} : {
|
|
62
61
|
name: "ifMatch-stale",
|
|
63
62
|
ok: false,
|
|
64
|
-
detail: `stale If-Match raised a non-
|
|
63
|
+
detail: `stale If-Match raised a non-WriteConflict error: ${error instanceof Error ? error.message : String(error)}`
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
try {
|
|
@@ -75,14 +74,14 @@ const probeCas = async (storage, opts) => {
|
|
|
75
74
|
detail: "PUT with If-None-Match:\"*\" over an existing key was ACCEPTED — backend ignores If-None-Match (create-only writes unsafe)."
|
|
76
75
|
});
|
|
77
76
|
} catch (error) {
|
|
78
|
-
checks.push(
|
|
77
|
+
checks.push(isWriteConflict(error) ? {
|
|
79
78
|
name: "ifNoneMatch-exists",
|
|
80
79
|
ok: true,
|
|
81
|
-
detail: "If-None-Match:\"*\" over an existing key rejected (
|
|
80
|
+
detail: "If-None-Match:\"*\" over an existing key rejected (WriteConflict), as required."
|
|
82
81
|
} : {
|
|
83
82
|
name: "ifNoneMatch-exists",
|
|
84
83
|
ok: false,
|
|
85
|
-
detail: `If-None-Match:"*" raised a non-
|
|
84
|
+
detail: `If-None-Match:"*" raised a non-WriteConflict error: ${error instanceof Error ? error.message : String(error)}`
|
|
86
85
|
});
|
|
87
86
|
}
|
|
88
87
|
const raceKey = `${prefix}__baerly_cas_probe__/${uuid()}`;
|
|
@@ -93,23 +92,24 @@ const probeCas = async (storage, opts) => {
|
|
|
93
92
|
signal
|
|
94
93
|
})));
|
|
95
94
|
const winners = outcomes.filter((o) => o.status === "fulfilled").length;
|
|
96
|
-
const transient = outcomes.filter((o) => o.status === "rejected" && !
|
|
95
|
+
const transient = outcomes.filter((o) => o.status === "rejected" && !isWriteConflict(o.reason)).length;
|
|
97
96
|
if (winners > 1) checks.push({
|
|
98
97
|
name: "ifNoneMatch-concurrent",
|
|
99
98
|
ok: false,
|
|
100
99
|
detail: `${winners} of ${RACERS} concurrent create-if-absent writes won (expected at most 1) — create-if-absent is NOT linearizable; the log-append commit would split-brain.`
|
|
101
100
|
});
|
|
102
|
-
else if (winners === 1)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
else if (winners === 1) {
|
|
102
|
+
if (transient === 0) checks.push({
|
|
103
|
+
name: "ifNoneMatch-concurrent",
|
|
104
|
+
ok: true,
|
|
105
|
+
detail: `exactly one of ${RACERS} concurrent create-if-absent writes won; the rest rejected (WriteConflict), as required.`
|
|
106
|
+
});
|
|
107
|
+
else checks.push({
|
|
108
|
+
name: "ifNoneMatch-concurrent",
|
|
109
|
+
ok: false,
|
|
110
|
+
detail: `exactly one of ${RACERS} concurrent create-if-absent writes won, but ${transient} loser(s) returned a transient non-WriteConflict error — inconclusive; retry for a clean race.`
|
|
111
|
+
});
|
|
112
|
+
} else checks.push({
|
|
113
113
|
name: "ifNoneMatch-concurrent",
|
|
114
114
|
ok: false,
|
|
115
115
|
detail: `no create-if-absent write succeeded across ${RACERS} attempts — inconclusive (transient failure or outage), not a linearizability verdict; retry.`
|
|
@@ -129,8 +129,7 @@ const probeCas = async (storage, opts) => {
|
|
|
129
129
|
checks
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
|
-
|
|
133
|
-
//#region ../adapter-node/src/gcs-admin.ts
|
|
132
|
+
// ../adapter-node/src/gcs-admin.ts
|
|
134
133
|
/**
|
|
135
134
|
* GCS bucket-administration probes over the native XML API — read-only
|
|
136
135
|
* config checks that fall outside the four-verb `Storage` interface.
|
|
@@ -167,8 +166,7 @@ async function gcsVersioningStatus(opts) {
|
|
|
167
166
|
};
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
|
-
|
|
171
|
-
//#region src/doctor/cas.ts
|
|
169
|
+
// src/doctor/cas.ts
|
|
172
170
|
/**
|
|
173
171
|
* `baerly doctor --bucket <uri>` — live backend CAS probe.
|
|
174
172
|
*
|
|
@@ -212,8 +210,7 @@ const doctorCas = async (storage, keyPrefix, opts) => {
|
|
|
212
210
|
status: result.ok ? "ok" : "error"
|
|
213
211
|
};
|
|
214
212
|
};
|
|
215
|
-
|
|
216
|
-
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
213
|
+
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
217
214
|
/**
|
|
218
215
|
* Creates a JSON scanner on the given text.
|
|
219
216
|
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
@@ -328,11 +325,13 @@ function createScanner(text, ignoreTrivia = false) {
|
|
|
328
325
|
start = pos;
|
|
329
326
|
continue;
|
|
330
327
|
}
|
|
331
|
-
if (ch >= 0 && ch <= 31)
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
328
|
+
if (ch >= 0 && ch <= 31) {
|
|
329
|
+
if (isLineBreak(ch)) {
|
|
330
|
+
result += text.substring(start, pos);
|
|
331
|
+
scanError = 2;
|
|
332
|
+
break;
|
|
333
|
+
} else scanError = 6;
|
|
334
|
+
}
|
|
336
335
|
pos++;
|
|
337
336
|
}
|
|
338
337
|
return result;
|
|
@@ -607,8 +606,7 @@ new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
|
607
606
|
}), new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
608
607
|
return "\r\n" + " ".repeat(index);
|
|
609
608
|
});
|
|
610
|
-
|
|
611
|
-
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
609
|
+
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
612
610
|
var ParseOptions;
|
|
613
611
|
(function(ParseOptions) {
|
|
614
612
|
ParseOptions.DEFAULT = { allowTrailingComma: false };
|
|
@@ -710,9 +708,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
710
708
|
case 2:
|
|
711
709
|
handleError(12);
|
|
712
710
|
break;
|
|
713
|
-
case 6:
|
|
714
|
-
handleError(16);
|
|
715
|
-
break;
|
|
711
|
+
case 6: handleError(16);
|
|
716
712
|
}
|
|
717
713
|
switch (token) {
|
|
718
714
|
case 12:
|
|
@@ -856,8 +852,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
856
852
|
if (_scanner.getToken() !== 17) handleError(9, [], []);
|
|
857
853
|
return true;
|
|
858
854
|
}
|
|
859
|
-
|
|
860
|
-
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
855
|
+
// ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
861
856
|
var ScanError;
|
|
862
857
|
(function(ScanError) {
|
|
863
858
|
ScanError[ScanError["None"] = 0] = "None";
|
|
@@ -912,8 +907,7 @@ var ParseErrorCode;
|
|
|
912
907
|
ParseErrorCode[ParseErrorCode["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
913
908
|
ParseErrorCode[ParseErrorCode["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
914
909
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
915
|
-
|
|
916
|
-
//#region src/doctor/cloudflare.ts
|
|
910
|
+
// src/doctor/cloudflare.ts
|
|
917
911
|
/**
|
|
918
912
|
* `baerly doctor --target=cloudflare` — walks the Cloudflare
|
|
919
913
|
* deploy invariants and reports. With `--fix`, remediates what
|
|
@@ -1127,10 +1121,12 @@ const doctorCloudflare = async (config, opts = {}) => {
|
|
|
1127
1121
|
});
|
|
1128
1122
|
if (config.cloudflareAccess !== void 0) {
|
|
1129
1123
|
const { teamDomain, audienceTag } = config.cloudflareAccess;
|
|
1130
|
-
|
|
1124
|
+
const teamDomainOk = CF_ACCESS_TEAM_NAME_PATTERN.test(teamDomain);
|
|
1125
|
+
if (!teamDomainOk) findings.push({
|
|
1131
1126
|
severity: "error",
|
|
1132
1127
|
check: "cloudflareAccess.teamDomain",
|
|
1133
|
-
message:
|
|
1128
|
+
message: `cloudflareAccess.teamDomain in baerly.config.ts must be a bare team name of lowercase letters, digits and "-" (got ${JSON.stringify(teamDomain)}).`,
|
|
1129
|
+
fix: "Use the team name only, e.g. \"acme\" for acme.cloudflareaccess.com."
|
|
1134
1130
|
});
|
|
1135
1131
|
if (!/^[0-9a-f]{64}$/.test(audienceTag)) findings.push({
|
|
1136
1132
|
severity: "error",
|
|
@@ -1138,7 +1134,7 @@ const doctorCloudflare = async (config, opts = {}) => {
|
|
|
1138
1134
|
message: `cloudflareAccess.audienceTag must be 64 lowercase-hex chars (got ${JSON.stringify(audienceTag)}).`,
|
|
1139
1135
|
fix: "Copy the AUD tag from the Cloudflare Access app's configuration tab."
|
|
1140
1136
|
});
|
|
1141
|
-
else if (
|
|
1137
|
+
else if (teamDomainOk) findings.push({
|
|
1142
1138
|
severity: "ok",
|
|
1143
1139
|
check: "cloudflareAccess",
|
|
1144
1140
|
message: `cloudflareAccess audience tag is well-formed; team domain "${teamDomain}".`
|
|
@@ -1175,8 +1171,7 @@ const doctorCloudflare = async (config, opts = {}) => {
|
|
|
1175
1171
|
status: rollupStatus(findings)
|
|
1176
1172
|
};
|
|
1177
1173
|
};
|
|
1178
|
-
|
|
1179
|
-
//#region src/doctor/gcs.ts
|
|
1174
|
+
// src/doctor/gcs.ts
|
|
1180
1175
|
/**
|
|
1181
1176
|
* `baerly doctor --bucket=gcs://<bucket>` — GCS-specific bucket-config
|
|
1182
1177
|
* checks that go beyond the backend-agnostic CAS probe ({@link doctorCas}
|
|
@@ -1255,8 +1250,7 @@ const doctorGcsConfig = async (opts) => {
|
|
|
1255
1250
|
status: rollupStatus(findings)
|
|
1256
1251
|
};
|
|
1257
1252
|
};
|
|
1258
|
-
|
|
1259
|
-
//#region src/runner.ts
|
|
1253
|
+
// src/runner.ts
|
|
1260
1254
|
/**
|
|
1261
1255
|
* `ProcessRunner` interface + default `node:child_process.spawn`-backed
|
|
1262
1256
|
* implementation. Shared by `baerly deploy` and `baerly doctor`, both of
|
|
@@ -1302,8 +1296,7 @@ const defaultRunner = (opts = {}) => {
|
|
|
1302
1296
|
}));
|
|
1303
1297
|
}) };
|
|
1304
1298
|
};
|
|
1305
|
-
|
|
1306
|
-
//#region src/wrangler-patch.ts
|
|
1299
|
+
// src/wrangler-patch.ts
|
|
1307
1300
|
/**
|
|
1308
1301
|
* Surgical wrangler.jsonc helpers used by `baerly deploy` and the
|
|
1309
1302
|
* `@gusto/create-baerly-storage` bolt-on flow. All functions are pure (no I/O) —
|
|
@@ -1341,23 +1334,19 @@ const parseR2Bindings$1 = (source) => {
|
|
|
1341
1334
|
}
|
|
1342
1335
|
return out;
|
|
1343
1336
|
};
|
|
1344
|
-
|
|
1345
|
-
//#region src/deploy/cloudflare.ts
|
|
1337
|
+
// src/deploy/cloudflare.ts
|
|
1346
1338
|
/**
|
|
1347
1339
|
* `baerly deploy --target=cloudflare` — one-command Cloudflare
|
|
1348
1340
|
* Workers deploy.
|
|
1349
1341
|
*
|
|
1350
1342
|
* Behavior:
|
|
1351
1343
|
* 1. Locate `wrangler.jsonc` at the package root.
|
|
1352
|
-
* 2.
|
|
1353
|
-
*
|
|
1354
|
-
*
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1358
|
-
* `wrangler r2 bucket create` when missing), then run
|
|
1359
|
-
* `wrangler deploy` without the experimental flag.
|
|
1360
|
-
* 5. Warn (non-fatal) on any `requiredSecret` not present in the
|
|
1344
|
+
* 2. Parse `wrangler.jsonc` for declared `r2_buckets[]` and ensure
|
|
1345
|
+
* each bucket exists (creating with `wrangler r2 bucket create`
|
|
1346
|
+
* when missing). Wrangler 4.45+ also provisions declared buckets
|
|
1347
|
+
* on deploy; this step covers older Wranglers and bolt-on apps.
|
|
1348
|
+
* 3. Run `wrangler deploy`.
|
|
1349
|
+
* 4. Warn (non-fatal) on any `requiredSecret` not present in the
|
|
1361
1350
|
* Wrangler-reported secret list.
|
|
1362
1351
|
*
|
|
1363
1352
|
* No `wrangler secret put` is invoked — that requires interactive
|
|
@@ -1398,9 +1387,8 @@ const parseR2Bindings = (wranglerPath) => {
|
|
|
1398
1387
|
/**
|
|
1399
1388
|
* Walk the declared R2 bindings; for each, run `wrangler r2 bucket
|
|
1400
1389
|
* info <name>` and, on non-zero exit, `wrangler r2 bucket create
|
|
1401
|
-
* <name>`.
|
|
1402
|
-
*
|
|
1403
|
-
* --target=cloudflare --fix`.
|
|
1390
|
+
* <name>`. Run before every `baerly deploy`, and directly invoked by
|
|
1391
|
+
* `baerly doctor --target=cloudflare --fix`.
|
|
1404
1392
|
*
|
|
1405
1393
|
* @throws BaerlyError code="NetworkError" — bucket creation
|
|
1406
1394
|
* reported a non-zero exit (Wrangler's own error already on
|
|
@@ -1454,8 +1442,8 @@ const warnOnMissingSecrets = async (runner, cwd, required) => {
|
|
|
1454
1442
|
*
|
|
1455
1443
|
* @throws BaerlyError code="InvalidConfig" — `wrangler.jsonc`
|
|
1456
1444
|
* missing or unparseable.
|
|
1457
|
-
* @throws BaerlyError code="NetworkError" —
|
|
1458
|
-
*
|
|
1445
|
+
* @throws BaerlyError code="NetworkError" — `wrangler r2 bucket create`
|
|
1446
|
+
* failed for a declared R2 bucket.
|
|
1459
1447
|
*/
|
|
1460
1448
|
const deployCloudflare = async (config, opts = {}) => {
|
|
1461
1449
|
const runner = opts.runner ?? defaultRunner({ tee: true });
|
|
@@ -1470,19 +1458,10 @@ const deployCloudflare = async (config, opts = {}) => {
|
|
|
1470
1458
|
}
|
|
1471
1459
|
process.stderr.write(`baerly deploy: CAS preflight OK for ${opts.probeBucketUri}\n`);
|
|
1472
1460
|
}
|
|
1473
|
-
const help = await runner.run("wrangler", ["deploy", "--help"], repoRoot);
|
|
1474
|
-
const hasXProvision = help.code === 0 && help.stdout.includes("--x-provision");
|
|
1475
1461
|
await warnOnMissingSecrets(runner, repoRoot, config.requiredSecrets ?? ["SHARED_SECRET"]);
|
|
1476
|
-
if (hasXProvision) return (await runner.run("wrangler", [
|
|
1477
|
-
"deploy",
|
|
1478
|
-
"--x-provision",
|
|
1479
|
-
"--x-auto-create"
|
|
1480
|
-
], repoRoot)).code;
|
|
1481
|
-
process.stderr.write("baerly deploy: wrangler --x-provision unavailable; falling back to manual provisioning\n");
|
|
1482
1462
|
await ensureBindings(runner, repoRoot, wranglerPath);
|
|
1483
1463
|
return (await runner.run("wrangler", ["deploy"], repoRoot)).code;
|
|
1484
1464
|
};
|
|
1485
|
-
|
|
1486
|
-
export { mergeReports as a, doctorCloudflare as i, defaultRunner as n, doctorCas as o, doctorGcsConfig as r, deployCloudflare as t };
|
|
1465
|
+
export { mergeReports as a, doctorCloudflare as i, defaultRunner as n, rollupStatus as o, doctorGcsConfig as r, doctorCas as s, deployCloudflare as t };
|
|
1487
1466
|
|
|
1488
|
-
//# sourceMappingURL=cloudflare-
|
|
1467
|
+
//# sourceMappingURL=cloudflare-CKHYXccw.js.map
|