@gusto/baerly-storage 0.3.0 → 0.4.1
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 +157 -92
- package/dist/API.md +64 -32
- package/dist/CHANGELOG.md +301 -5
- package/dist/RECIPES.md +125 -0
- package/dist/THIRD-PARTY-LICENSES.txt +22 -96
- package/dist/{app-config-BIzyAKzy.d.ts → app-config-DyiFK3_k.d.ts} +43 -11
- package/dist/app-config.d.ts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +13 -13
- package/dist/auth.js.map +1 -1
- package/dist/aws4fetch.esm-p7eEzLCs.js +1702 -0
- package/dist/aws4fetch.esm-p7eEzLCs.js.map +1 -0
- package/dist/baerly.js +35 -15
- package/dist/baerly.js.map +1 -1
- package/dist/baerly.spec.json +342 -0
- package/dist/{client-BJXF3XJA.d.ts → client-Fe8CwB73.d.ts} +3 -3
- package/dist/client-react.d.ts +3 -3
- package/dist/client-react.js +4 -4
- package/dist/client-react.js.map +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.js +3 -3
- package/dist/{cloudflare-Cn2ibODt.js → cloudflare-DzKBrUlg.js} +2 -2
- package/dist/{cloudflare-Cn2ibODt.js.map → cloudflare-DzKBrUlg.js.map} +1 -1
- package/dist/cloudflare.d.ts +49 -6
- package/dist/cloudflare.js +55 -21
- package/dist/cloudflare.js.map +1 -1
- package/dist/config-1tv0-Yzm.js +2693 -0
- package/dist/config-1tv0-Yzm.js.map +1 -0
- package/dist/constants-CfeMWQWk.js +222 -0
- package/dist/constants-CfeMWQWk.js.map +1 -0
- package/dist/{cost-BZ_MDBmn.js → cost-DSMIVqzL.js} +42 -43
- package/dist/cost-DSMIVqzL.js.map +1 -0
- package/dist/{current-json-DsN7FNY1.js → current-json-C6nhPOm1.js} +6 -204
- package/dist/current-json-C6nhPOm1.js.map +1 -0
- package/dist/{db-CCT6tDfY.d.ts → db-DsPkOVEH.d.ts} +3 -3
- package/dist/{deploy-BKKyGlSJ.js → deploy-DonTr-CV.js} +4 -4
- package/dist/{deploy-BKKyGlSJ.js.map → deploy-DonTr-CV.js.map} +1 -1
- package/dist/dev-vite.d.ts +9 -5
- package/dist/dev-vite.js +5 -4
- package/dist/dev-vite.js.map +1 -1
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +1 -1
- package/dist/{doctor-BVU4GNXN.js → doctor-DSIyCDg_.js} +5 -8
- package/dist/{doctor-BVU4GNXN.js.map → doctor-DSIyCDg_.js.map} +1 -1
- package/dist/{dump-DPEAKub6.js → dump-Bh5k26VQ.js} +9 -32
- package/dist/dump-Bh5k26VQ.js.map +1 -0
- package/dist/{errors-DOdL95kK.js → errors-Dfa3p78c.js} +25 -5
- package/dist/errors-Dfa3p78c.js.map +1 -0
- package/dist/{export-BcuCLFFe.js → export-DtF5tDIM.js} +9 -32
- package/dist/{export-BcuCLFFe.js.map → export-DtF5tDIM.js.map} +1 -1
- package/dist/{fsck-RXgLOaJG.js → fsck-D_djMO5D.js} +10 -33
- package/dist/fsck-D_djMO5D.js.map +1 -0
- package/dist/{http-Bd4byR4n.js → http-DxM9MflO.js} +123 -35
- package/dist/http-DxM9MflO.js.map +1 -0
- package/dist/http.d.ts +42 -26
- package/dist/http.js +3 -2
- package/dist/{index-DnBGSeuU.d.ts → index-0rZcMBwy.d.ts} +2 -2
- package/dist/{index-Cmsxx-ZN.d.ts → index-B6oexfOB.d.ts} +7 -7
- package/dist/{index-BDceQQi-.d.ts → index-BNRh23K9.d.ts} +4 -4
- package/dist/{index-DW7GT6M2.d.ts → index-BYk9oCNf.d.ts} +193 -163
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/{indexes-Cx7uMXm0.d.ts → indexes-Dn9hbGQG.d.ts} +2 -2
- package/dist/{inspect-DhI49PSi.js → inspect-6WZ-pC7-.js} +10 -33
- package/dist/inspect-6WZ-pC7-.js.map +1 -0
- package/dist/key-Di6yyxFu.js +35 -0
- package/dist/key-Di6yyxFu.js.map +1 -0
- package/dist/{log-tail-DXeDkWEp.js → log-tail-D98U1JBo.js} +31 -7
- package/dist/log-tail-D98U1JBo.js.map +1 -0
- package/dist/{maintenance-CWBQpZ2y.js → maintenance-B4Dki6Ig.js} +77 -22
- package/dist/maintenance-B4Dki6Ig.js.map +1 -0
- package/dist/{maintenance-BkhUr72A.d.ts → maintenance-B_e0T99L.d.ts} +28 -5
- package/dist/{maintenance-C_KSkVjd.js → maintenance-C7coQp4c.js} +17 -16
- package/dist/maintenance-C7coQp4c.js.map +1 -0
- package/dist/maintenance.d.ts +3 -3
- package/dist/maintenance.js +3 -3
- package/dist/node.d.ts +168 -65
- package/dist/node.js +3 -2
- package/dist/{normalize-XWY25_sG.js → normalize-rjnZLwS4.js} +2 -2
- package/dist/normalize-rjnZLwS4.js.map +1 -0
- package/dist/{observability-BYd-RzEx.js → observability-wzs3-BL_.js} +233 -71
- package/dist/observability-wzs3-BL_.js.map +1 -0
- package/dist/observability.d.ts +2 -2
- package/dist/observability.js +1 -1
- package/dist/{plan-DIu_B6fy.js → plan-a7PJHBCy.js} +2 -2
- package/dist/{plan-DIu_B6fy.js.map → plan-a7PJHBCy.js.map} +1 -1
- package/dist/{query-sQNO5vU_.js → query-rAtXNQQB.js} +96 -207
- package/dist/query-rAtXNQQB.js.map +1 -0
- package/dist/{rebuild-index-DP4CqSSs.js → rebuild-index-BVzQSZlm.js} +9 -32
- package/dist/rebuild-index-BVzQSZlm.js.map +1 -0
- package/dist/{request-BEF_OvMh.js → request-u0M51mhJ.js} +3 -3
- package/dist/{request-BEF_OvMh.js.map → request-u0M51mhJ.js.map} +1 -1
- package/dist/{restore-DpQYef6r.js → restore-R-4rbciV.js} +73 -100
- package/dist/restore-R-4rbciV.js.map +1 -0
- package/dist/runtime-spec-_GTdeSMo.js +391 -0
- package/dist/runtime-spec-_GTdeSMo.js.map +1 -0
- package/dist/s3-http-B-z8th6O.d.ts +60 -0
- package/dist/s3.d.ts +47 -0
- package/dist/s3.js +45 -0
- package/dist/s3.js.map +1 -0
- package/dist/{shared-secret-BJdSwpgw.js → shared-secret-DgEicd3x.js} +13 -5
- package/dist/shared-secret-DgEicd3x.js.map +1 -0
- package/dist/{src-Db4-qVtM.js → src-CYHFDrKz.js} +51 -8
- package/dist/src-CYHFDrKz.js.map +1 -0
- package/dist/{src-CWpkSbvJ.js → src-DYZ4H1aF.js} +6 -5
- package/dist/src-DYZ4H1aF.js.map +1 -0
- package/dist/src-D__mHQmQ.js +2271 -0
- package/dist/src-D__mHQmQ.js.map +1 -0
- package/dist/{subcommand-CP9NY2J4.js → subcommand-DoDA-K7d.js} +44 -6
- package/dist/subcommand-DoDA-K7d.js.map +1 -0
- package/dist/time-DUqvFMHq.js +119 -0
- package/dist/time-DUqvFMHq.js.map +1 -0
- package/dist/{usage-CTfDq9HR.js → usage-DBV1eQHC.js} +7 -22
- package/dist/usage-DBV1eQHC.js.map +1 -0
- package/dist/wire-izfGZDvr.js.map +1 -1
- package/package.json +51 -27
- package/dist/config-CGyBopy3.js +0 -5326
- package/dist/config-CGyBopy3.js.map +0 -1
- package/dist/cost-BZ_MDBmn.js.map +0 -1
- package/dist/current-json-DsN7FNY1.js.map +0 -1
- package/dist/dump-DPEAKub6.js.map +0 -1
- package/dist/errors-DOdL95kK.js.map +0 -1
- package/dist/fsck-RXgLOaJG.js.map +0 -1
- package/dist/http-Bd4byR4n.js.map +0 -1
- package/dist/inspect-DhI49PSi.js.map +0 -1
- package/dist/log-tail-DXeDkWEp.js.map +0 -1
- package/dist/maintenance-CWBQpZ2y.js.map +0 -1
- package/dist/maintenance-C_KSkVjd.js.map +0 -1
- package/dist/normalize-XWY25_sG.js.map +0 -1
- package/dist/observability-BYd-RzEx.js.map +0 -1
- package/dist/query-sQNO5vU_.js.map +0 -1
- package/dist/rebuild-index-DP4CqSSs.js.map +0 -1
- package/dist/restore-DpQYef6r.js.map +0 -1
- package/dist/shared-secret-BJdSwpgw.js.map +0 -1
- package/dist/src-CWpkSbvJ.js.map +0 -1
- package/dist/src-D24wDpzR.js +0 -6247
- package/dist/src-D24wDpzR.js.map +0 -1
- package/dist/src-Db4-qVtM.js.map +0 -1
- package/dist/subcommand-CP9NY2J4.js.map +0 -1
- package/dist/usage-CTfDq9HR.js.map +0 -1
- /package/dist/{chunk-EAsCxrDo.js → rolldown-runtime-EAsCxrDo.js} +0 -0
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
//#region packages/protocol/src/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Current major version of the snapshot control-object schema
|
|
4
|
+
* ({@link SnapshotBody}). Readers MUST reject unknown versions with
|
|
5
|
+
* `BaerlyError{code:"InvalidResponse"}` rather than try to coerce.
|
|
6
|
+
*
|
|
7
|
+
* Bump only on a breaking change to `SnapshotBody` field semantics.
|
|
8
|
+
* Adding a new optional field is NOT breaking; renaming or removing
|
|
9
|
+
* a field IS breaking.
|
|
10
|
+
*
|
|
11
|
+
* @see packages/server/src/snapshot.ts
|
|
12
|
+
*/
|
|
13
|
+
declare const SNAPSHOT_SCHEMA_VERSION: 1;
|
|
2
14
|
type MaintenanceProfileShape = Readonly<{
|
|
3
15
|
gcInterval: number;
|
|
4
16
|
gcMaxMarks: number;
|
|
@@ -11,6 +23,19 @@ type MaintenanceProfileShape = Readonly<{
|
|
|
11
23
|
declare const MAINTENANCE_PROFILE_CF_FREE: MaintenanceProfileShape;
|
|
12
24
|
/** Node profile; 10× CF-free caps. */
|
|
13
25
|
declare const MAINTENANCE_PROFILE_NODE: MaintenanceProfileShape;
|
|
26
|
+
/**
|
|
27
|
+
* CF-paid profile — opt-in via `BAERLY_MAINTENANCE_PROFILE=cf-paid`. A paid
|
|
28
|
+
* isolate keeps the CPU-killable single-phase shape but has the 10,000-
|
|
29
|
+
* subrequest budget (vs free's 50), so it reuses the `NODE_MAINTENANCE_*`
|
|
30
|
+
* per-pass caps. CRITICAL: snapshot ceilings `maxFoldBytes` (`C`) /
|
|
31
|
+
* `maxFoldRows` (`E`) are UNCHANGED — a profile moves rate, never correctness
|
|
32
|
+
* (the equivalence invariant); the memory wall is raised via
|
|
33
|
+
* `BAERLY_MAINTENANCE_MAX_FOLD_BYTES`.
|
|
34
|
+
*
|
|
35
|
+
* @see packages/adapter-cloudflare/src/worker.ts
|
|
36
|
+
* @see docs/about/graduation.md
|
|
37
|
+
*/
|
|
38
|
+
declare const MAINTENANCE_PROFILE_CF_PAID: MaintenanceProfileShape;
|
|
14
39
|
/**
|
|
15
40
|
* Canonical auth posture identifiers consumed by `BaerlyAppConfig.auth`,
|
|
16
41
|
* the adapter resolution path (`packages/adapter-cloudflare/src/worker.ts`,
|
|
@@ -37,10 +62,10 @@ declare const AUTH_CONFIG_VALUES: readonly ["none", "shared-secret"];
|
|
|
37
62
|
* {@link DocumentValue}.
|
|
38
63
|
*
|
|
39
64
|
* The document **body** itself must be an object (not an array) —
|
|
40
|
-
*
|
|
65
|
+
* baerly-storage's writer is built on JSON Merge Patch (RFC 7386), which
|
|
41
66
|
* is only defined over object documents. Array *values* at any
|
|
42
67
|
* nested level are fine; per RFC 7386, an array in a patch
|
|
43
|
-
* replaces the target array wholesale (
|
|
68
|
+
* replaces the target array wholesale (baerly-storage has no array-merge
|
|
44
69
|
* semantics).
|
|
45
70
|
*/
|
|
46
71
|
type DocumentData = {
|
|
@@ -60,6 +85,13 @@ type JSONObject = {
|
|
|
60
85
|
type JSONValue = string | number | boolean | null | JSONObject | Array<JSONValue>;
|
|
61
86
|
//#endregion
|
|
62
87
|
//#region packages/protocol/src/query/wire.d.ts
|
|
88
|
+
/**
|
|
89
|
+
* Runtime mirror of {@link PredicateOpName}. The type derives from this
|
|
90
|
+
* tuple so the value is the single source of truth: the spec generator
|
|
91
|
+
* and the drift gate enumerate `PREDICATE_OPS`, and tsgo rejects any
|
|
92
|
+
* member added to the type-union without a matching tuple entry.
|
|
93
|
+
*/
|
|
94
|
+
declare const PREDICATE_OPS: readonly ["eq", "gt", "gte", "lt", "lte", "in"];
|
|
63
95
|
/**
|
|
64
96
|
* Locked operator vocabulary. Methods on {@link PredicateBuilder}
|
|
65
97
|
* map 1:1 to these names; the validator rejects any other.
|
|
@@ -69,7 +101,7 @@ type JSONValue = string | number | boolean | null | JSONObject | Array<JSONValue
|
|
|
69
101
|
* or finite `number`. Type-mismatched actuals are always-miss.
|
|
70
102
|
* `in` — set membership. Empty array → `UnsatisfiablePredicate`.
|
|
71
103
|
*/
|
|
72
|
-
type PredicateOpName =
|
|
104
|
+
type PredicateOpName = (typeof PREDICATE_OPS)[number];
|
|
73
105
|
/**
|
|
74
106
|
* One clause in a normalised predicate. `field` is a top-level key
|
|
75
107
|
* or a dotted path. `value` is an array iff `op === "in"`.
|
|
@@ -115,14 +147,14 @@ interface IndexDefinition {
|
|
|
115
147
|
* Stable path-safe identifier, used directly as a key segment under
|
|
116
148
|
* `<logPrefix>/index/<name>/...`. Must match `/^[a-z][a-z0-9_]*$/`.
|
|
117
149
|
* A reserved leading-`_` name throws `InvalidConfig`; a malformed
|
|
118
|
-
* name throws `SchemaError`. See docs/adr/
|
|
150
|
+
* name throws `SchemaError`. See docs/adr/003-layout-versioning-cordon.md.
|
|
119
151
|
*/
|
|
120
152
|
readonly name: string;
|
|
121
153
|
/**
|
|
122
|
-
* Field name(s) to index on. `string` is a single-field index
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
154
|
+
* Field name(s) to index on. `string` is a single-field index.
|
|
155
|
+
* `readonly string[]` is composite; the read path can route a
|
|
156
|
+
* left-anchored equality prefix and, when present, a range / `$in`
|
|
157
|
+
* clause on the final indexed field beyond that equality prefix.
|
|
126
158
|
*
|
|
127
159
|
* Top-level fields only — dotted-path `on` values throw
|
|
128
160
|
* `SchemaError` from `projectIndexValues`. A future change widens
|
|
@@ -194,7 +226,7 @@ interface IndexDefinition {
|
|
|
194
226
|
* ```
|
|
195
227
|
*/
|
|
196
228
|
/**
|
|
197
|
-
* Subset of the StandardSchemaV1 contract
|
|
229
|
+
* Subset of the StandardSchemaV1 contract baerly-storage consumes at the
|
|
198
230
|
* server boundary. The full spec lives at
|
|
199
231
|
* <https://standardschema.dev/>; we copy the `validate` shape locally
|
|
200
232
|
* because that's the only field the boundary calls, and inlining
|
|
@@ -497,5 +529,5 @@ type RowOf<C extends BaerlyConfig, N extends CollectionNames<C>> = C extends {
|
|
|
497
529
|
readonly schema: infer S;
|
|
498
530
|
} ? S extends SchemaValidator<unknown, infer Out> ? Out : Record<string, unknown> : Record<string, unknown> : Record<string, unknown> : Record<string, unknown>;
|
|
499
531
|
//#endregion
|
|
500
|
-
export { CollectionNames as a, defineConfig as c, IndexDefinition as d, DocumentData as f,
|
|
501
|
-
//# sourceMappingURL=app-config-
|
|
532
|
+
export { MAINTENANCE_PROFILE_NODE as _, CollectionNames as a, defineConfig as c, IndexDefinition as d, DocumentData as f, MAINTENANCE_PROFILE_CF_PAID as g, MAINTENANCE_PROFILE_CF_FREE as h, CollectionDefinition as i, SchemaIssue as l, JSONValue as m, BaerlyAppConfig as n, RowOf as o, DocumentValue as p, BaerlyConfig as r, UnboundConfig as s, AuthConfig as t, SchemaValidator as u, SNAPSHOT_SCHEMA_VERSION as v };
|
|
533
|
+
//# sourceMappingURL=app-config-DyiFK3_k.d.ts.map
|
package/dist/app-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CollectionNames, c as defineConfig, f as DocumentData, i as CollectionDefinition, n as BaerlyAppConfig, o as RowOf, p as DocumentValue, r as BaerlyConfig, s as UnboundConfig, t as AuthConfig } from "./app-config-
|
|
1
|
+
import { a as CollectionNames, c as defineConfig, f as DocumentData, i as CollectionDefinition, n as BaerlyAppConfig, o as RowOf, p as DocumentValue, r as BaerlyConfig, s as UnboundConfig, t as AuthConfig } from "./app-config-DyiFK3_k.js";
|
|
2
2
|
export { AuthConfig, BaerlyAppConfig, BaerlyConfig, CollectionDefinition, CollectionNames, type DocumentData, type DocumentValue, RowOf, UnboundConfig, defineConfig };
|
package/dist/auth.d.ts
CHANGED
package/dist/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
1
|
+
import { n as BEARER_JWT_CONFIG_RESOLUTION, r as CLOUDFLARE_ACCESS_CONFIG_RESOLUTION, t as sharedSecret } from "./shared-secret-DgEicd3x.js";
|
|
2
|
+
import { t as BaerlyError } from "./errors-Dfa3p78c.js";
|
|
3
3
|
//#region node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
4
4
|
const encoder = new TextEncoder();
|
|
5
5
|
const decoder = new TextDecoder();
|
|
@@ -636,11 +636,11 @@ const handleKeyObject = (keyObject, alg) => {
|
|
|
636
636
|
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
637
637
|
}
|
|
638
638
|
if (keyObject.asymmetricKeyType === "ec") {
|
|
639
|
-
const namedCurve = new Map([
|
|
639
|
+
const namedCurve = (/* @__PURE__ */ new Map([
|
|
640
640
|
["prime256v1", "P-256"],
|
|
641
641
|
["secp384r1", "P-384"],
|
|
642
642
|
["secp521r1", "P-521"]
|
|
643
|
-
]).get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
643
|
+
])).get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
644
644
|
if (!namedCurve) throw new TypeError(unusableForAlg);
|
|
645
645
|
const expectedCurve = {
|
|
646
646
|
ES256: "P-256",
|
|
@@ -700,7 +700,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
700
700
|
...parsedProt,
|
|
701
701
|
...jws.header
|
|
702
702
|
};
|
|
703
|
-
const extensions = validateCrit(JWSInvalid, new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
703
|
+
const extensions = validateCrit(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
704
704
|
let b64 = true;
|
|
705
705
|
if (extensions.has("b64")) {
|
|
706
706
|
b64 = parsedProt.b64;
|
|
@@ -719,7 +719,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
719
719
|
resolvedKey = true;
|
|
720
720
|
}
|
|
721
721
|
checkKeyType(alg, key, "verify");
|
|
722
|
-
const data = concat(jws.protected !== void 0 ? encode(jws.protected) : new Uint8Array(), encode("."), typeof jws.payload === "string" ? b64 ? encode(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
722
|
+
const data = concat(jws.protected !== void 0 ? encode(jws.protected) : /* @__PURE__ */ new Uint8Array(), encode("."), typeof jws.payload === "string" ? b64 ? encode(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
723
723
|
const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
|
|
724
724
|
const k = await normalizeKey(key, alg);
|
|
725
725
|
if (!await verify(alg, k, signature, data)) throw new JWSSignatureVerificationFailed();
|
|
@@ -1207,13 +1207,13 @@ const JWKS_KID_REFRESH_MIN_INTERVAL_MS = 6e4;
|
|
|
1207
1207
|
* ```
|
|
1208
1208
|
*/
|
|
1209
1209
|
const bearerJwt = (opts) => {
|
|
1210
|
-
if (opts.issuer.length === 0) throw new BaerlyError("InvalidConfig", "bearerJwt: issuer must be non-empty");
|
|
1211
|
-
if (opts.audience.length === 0) throw new BaerlyError("InvalidConfig", "bearerJwt: audience must be non-empty");
|
|
1210
|
+
if (opts.issuer.length === 0) throw new BaerlyError("InvalidConfig", "bearerJwt: issuer must be non-empty", void 0, void 0, void 0, BEARER_JWT_CONFIG_RESOLUTION);
|
|
1211
|
+
if (opts.audience.length === 0) throw new BaerlyError("InvalidConfig", "bearerJwt: audience must be non-empty", void 0, void 0, void 0, BEARER_JWT_CONFIG_RESOLUTION);
|
|
1212
1212
|
const algorithms = opts.algorithms ?? DEFAULT_ALGORITHMS;
|
|
1213
|
-
if (algorithms.length === 0) throw new BaerlyError("InvalidConfig", "bearerJwt: algorithms must be non-empty");
|
|
1213
|
+
if (algorithms.length === 0) throw new BaerlyError("InvalidConfig", "bearerJwt: algorithms must be non-empty", void 0, void 0, void 0, BEARER_JWT_CONFIG_RESOLUTION);
|
|
1214
1214
|
if (opts.tenantPrefix !== void 0) {
|
|
1215
|
-
if (opts.tenantClaim !== void 0) throw new BaerlyError("InvalidConfig", "bearerJwt: tenantPrefix and tenantClaim are mutually exclusive");
|
|
1216
|
-
if (opts.tenantPrefix.length === 0 || opts.tenantPrefix.includes("/")) throw new BaerlyError("InvalidConfig", `bearerJwt: tenantPrefix must be non-empty and contain no "/" (got ${JSON.stringify(opts.tenantPrefix)})
|
|
1215
|
+
if (opts.tenantClaim !== void 0) throw new BaerlyError("InvalidConfig", "bearerJwt: tenantPrefix and tenantClaim are mutually exclusive", void 0, void 0, void 0, BEARER_JWT_CONFIG_RESOLUTION);
|
|
1216
|
+
if (opts.tenantPrefix.length === 0 || opts.tenantPrefix.includes("/")) throw new BaerlyError("InvalidConfig", `bearerJwt: tenantPrefix must be non-empty and contain no "/" (got ${JSON.stringify(opts.tenantPrefix)})`, void 0, void 0, void 0, BEARER_JWT_CONFIG_RESOLUTION);
|
|
1217
1217
|
}
|
|
1218
1218
|
const tenantClaim = opts.tenantClaim ?? DEFAULT_TENANT_CLAIM;
|
|
1219
1219
|
const fixedTenantPrefix = opts.tenantPrefix;
|
|
@@ -1307,8 +1307,8 @@ const isJwksFetchFailure = (error) => {
|
|
|
1307
1307
|
* ```
|
|
1308
1308
|
*/
|
|
1309
1309
|
const cloudflareAccess = (opts) => {
|
|
1310
|
-
if (opts.teamDomain.length === 0) throw new BaerlyError("InvalidConfig", "cloudflareAccess: teamDomain must be non-empty");
|
|
1311
|
-
if (!/^[0-9a-f]{64}$/.test(opts.audienceTag)) throw new BaerlyError("InvalidConfig", `cloudflareAccess: audienceTag must be 64 lowercase-hex chars (got ${JSON.stringify(opts.audienceTag)})
|
|
1310
|
+
if (opts.teamDomain.length === 0) throw new BaerlyError("InvalidConfig", "cloudflareAccess: teamDomain must be non-empty", void 0, void 0, void 0, CLOUDFLARE_ACCESS_CONFIG_RESOLUTION);
|
|
1311
|
+
if (!/^[0-9a-f]{64}$/.test(opts.audienceTag)) throw new BaerlyError("InvalidConfig", `cloudflareAccess: audienceTag must be 64 lowercase-hex chars (got ${JSON.stringify(opts.audienceTag)})`, void 0, void 0, void 0, CLOUDFLARE_ACCESS_CONFIG_RESOLUTION);
|
|
1312
1312
|
const issuer = `https://${opts.teamDomain}.cloudflareaccess.com`;
|
|
1313
1313
|
const inner = bearerJwt({
|
|
1314
1314
|
jwks: `${issuer}/cdn-cgi/access/certs`,
|