@gusto/baerly-storage 0.4.1 → 0.5.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/CHANGELOG.md +43 -0
- package/dist/baerly.spec.json +1 -1
- package/dist/cloudflare.d.ts +11 -8
- package/dist/cloudflare.js +4 -4
- package/dist/cloudflare.js.map +1 -1
- package/dist/dev-vite.js +1 -1
- package/dist/{http-DxM9MflO.js → http-DGd5tbNs.js} +2 -2
- package/dist/{http-DxM9MflO.js.map → http-DGd5tbNs.js.map} +1 -1
- package/dist/http.js +2 -2
- package/dist/{index-B6oexfOB.d.ts → index-CuA9Mi3K.d.ts} +6 -4
- package/dist/node.d.ts +2 -2
- package/dist/node.js +1 -1
- package/dist/{observability-wzs3-BL_.js → observability-BmflLCdF.js} +48 -12
- package/dist/{observability-wzs3-BL_.js.map → observability-BmflLCdF.js.map} +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/observability.js +1 -1
- package/dist/{runtime-spec-_GTdeSMo.js → runtime-spec-Dsw2-n8S.js} +2 -2
- package/dist/{runtime-spec-_GTdeSMo.js.map → runtime-spec-Dsw2-n8S.js.map} +1 -1
- package/dist/{src-D__mHQmQ.js → src-BL_JoPTn.js} +5 -5
- package/dist/{src-D__mHQmQ.js.map → src-BL_JoPTn.js.map} +1 -1
- package/package.json +4 -4
package/dist/observability.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as MetricsRecorder } from "./index-BYk9oCNf.js";
|
|
2
|
-
import { _ as ObservabilityContextInit, a as flushCanonicalLine, b as runWithContext, c as CATEGORY, d as ObservabilityConfig, f as configureObservability, g as ObservabilityContext, h as LogRecord, i as FlushCanonicalLineOptions, l as CategoryName, m as Sink, n as deriveOutcome, o as flushUnauthorizedAndRespond, p as getLogger, r as observableStorage, s as withHttpObservability, t as Outcome, u as FriendlyLogLevel, v as createObservabilityContext, y as getCurrentContext } from "./index-
|
|
2
|
+
import { _ as ObservabilityContextInit, a as flushCanonicalLine, b as runWithContext, c as CATEGORY, d as ObservabilityConfig, f as configureObservability, g as ObservabilityContext, h as LogRecord, i as FlushCanonicalLineOptions, l as CategoryName, m as Sink, n as deriveOutcome, o as flushUnauthorizedAndRespond, p as getLogger, r as observableStorage, s as withHttpObservability, t as Outcome, u as FriendlyLogLevel, v as createObservabilityContext, y as getCurrentContext } from "./index-CuA9Mi3K.js";
|
|
3
3
|
export { CATEGORY, type CategoryName, type FlushCanonicalLineOptions, type FriendlyLogLevel, type LogRecord, type MetricsRecorder, type ObservabilityConfig, type ObservabilityContext, type ObservabilityContextInit, type Outcome, type Sink, configureObservability, createObservabilityContext, deriveOutcome, flushCanonicalLine, flushUnauthorizedAndRespond, getCurrentContext, getLogger, observableStorage, runWithContext, withHttpObservability };
|
package/dist/observability.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as withHttpObservability, c as configureObservability, l as getLogger, n as flushCanonicalLine, o as deriveOutcome, r as flushUnauthorizedAndRespond, s as CATEGORY, t as observableStorage } from "./observability-
|
|
1
|
+
import { a as withHttpObservability, c as configureObservability, l as getLogger, n as flushCanonicalLine, o as deriveOutcome, r as flushUnauthorizedAndRespond, s as CATEGORY, t as observableStorage } from "./observability-BmflLCdF.js";
|
|
2
2
|
import { n as getCurrentContext, r as runWithContext, t as createObservabilityContext } from "./context-DRZ3tZ5l.js";
|
|
3
3
|
export { CATEGORY, configureObservability, createObservabilityContext, deriveOutcome, flushCanonicalLine, flushUnauthorizedAndRespond, getCurrentContext, getLogger, observableStorage, runWithContext, withHttpObservability };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const specIr = {
|
|
4
4
|
$schema: "https://baerly.dev/spec/ir-schema.json",
|
|
5
5
|
specVersion: "1",
|
|
6
|
-
|
|
6
|
+
serverVersion: "0.5.0",
|
|
7
7
|
errorCodes: [
|
|
8
8
|
{
|
|
9
9
|
"code": "InvalidConfig",
|
|
@@ -388,4 +388,4 @@ async function handleSpecRequest(request, resolve) {
|
|
|
388
388
|
//#endregion
|
|
389
389
|
export { handleSpecRequest as t };
|
|
390
390
|
|
|
391
|
-
//# sourceMappingURL=runtime-spec-
|
|
391
|
+
//# sourceMappingURL=runtime-spec-Dsw2-n8S.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-spec-
|
|
1
|
+
{"version":3,"file":"runtime-spec-Dsw2-n8S.js","names":["rawSpecIr"],"sources":["../packages/server/spec/baerly.spec.json","../packages/server/src/spec/runtime-spec.ts"],"sourcesContent":["","import type { BaerlyConfig, Verifier } from \"@baerly/protocol\";\nimport type { SpecIR } from \"./ir.ts\";\nimport rawSpecIr from \"../../spec/baerly.spec.json\" with { type: \"json\" };\n\n// Import the JSON as data (not ir.ts which drags the HTTP router into\n// the kernel closure). Cast to SpecIR so callers get typed access to\n// errorCodes, specVersion, etc. without following the ir.ts import chain.\nconst specIr = rawSpecIr as unknown as SpecIR;\n\n/** A declared collection summary, emitted only to authed callers. */\nexport interface SpecCollection {\n readonly name: string;\n readonly indexes: ReadonlyArray<string>;\n readonly schemaVendor?: string;\n}\n\n/** The /v1/spec response: the static IR plus an optional authed collections section. */\nexport type SpecResponse = SpecIR & { collections?: ReadonlyArray<SpecCollection> };\n\n/**\n * Build the /v1/spec response body. With no `config` (anonymous caller)\n * the static contract IR is returned verbatim. With a `config` (the\n * request already carried a valid identity), the declared collection\n * names + index names + schema vendor are appended — these are gated\n * behind the verifier so unauthenticated callers can't enumerate tenant\n * collection names.\n */\nexport function buildSpecResponse(config?: BaerlyConfig): SpecResponse {\n if (config === undefined) {\n return specIr as SpecResponse;\n }\n const collections: SpecCollection[] = Object.entries(config.collections).map(\n ([name, def]): SpecCollection => {\n const indexes = (def.indexes ?? []).map((ix) => ix.name);\n if (def.schema !== undefined) {\n return { name, indexes, schemaVendor: def.schema[\"~standard\"].vendor };\n }\n return { name, indexes };\n },\n );\n return { ...(specIr as SpecResponse), collections };\n}\n\n// Shared `GET /v1/spec` handler for both adapters (keeps the response shape\n// from drifting). `resolve` yields the adapter's verifier + tenant config.\n// Run tolerantly: any `resolve` or verifier failure degrades to the anonymous\n// static contract — it is public infra that must stay up when auth/config is\n// unhealthy. Collections are appended only for a non-null identity, so an\n// unauthenticated probe never enumerates them.\nexport async function handleSpecRequest(\n request: Request,\n resolve: () => Promise<{ verifier: Verifier; config: BaerlyConfig | undefined }>,\n): Promise<Response> {\n let config: BaerlyConfig | undefined;\n try {\n const { verifier, config: resolved } = await resolve();\n const identity = await verifier(request);\n if (identity !== null) {\n config = resolved;\n }\n } catch (error) {\n // A verifier *reject* is `null` (handled above); reaching here means\n // resolve() or the verifier *threw* — the auth backend or tenant config\n // is unhealthy. Stay tolerant (the static contract is public infra and\n // must stay up), but emit one operational signal so the outage isn't\n // invisible on this anonymous, pre-observability route. `console.warn`\n // (not a canonical line) matches the adapters' other ops warnings and\n // keeps this light module out of the observability closure. Log only the\n // error *message*, never the error object: an auth-backend failure can\n // carry credential material (tokens, keys, connection strings) in its\n // fields/stack, and this line lands in plaintext logs.\n const reason = error instanceof Error ? error.message : String(error);\n console.warn(`[baerly] /v1/spec degraded to the anonymous contract: ${reason}`);\n }\n return new Response(JSON.stringify(buildSpecResponse(config)), {\n status: 200,\n headers: { \"content-type\": \"application/json\" },\n });\n}\n"],"mappings":";;ACOA,MAAM,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA;;;;;;;;;AAoBf,SAAgB,kBAAkB,QAAqC;CACrE,IAAI,WAAW,KAAA,GACb,OAAO;CAET,MAAM,cAAgC,OAAO,QAAQ,OAAO,WAAW,CAAC,CAAC,KACtE,CAAC,MAAM,SAAyB;EAC/B,MAAM,WAAW,IAAI,WAAW,CAAC,EAAA,CAAG,KAAK,OAAO,GAAG,IAAI;EACvD,IAAI,IAAI,WAAW,KAAA,GACjB,OAAO;GAAE;GAAM;GAAS,cAAc,IAAI,OAAO,YAAY,CAAC;EAAO;EAEvE,OAAO;GAAE;GAAM;EAAQ;CACzB,CACF;CACA,OAAO;EAAE,GAAI;EAAyB;CAAY;AACpD;AAQA,eAAsB,kBACpB,SACA,SACmB;CACnB,IAAI;CACJ,IAAI;EACF,MAAM,EAAE,UAAU,QAAQ,aAAa,MAAM,QAAQ;EAErD,IAAI,MADmB,SAAS,OAAO,MACtB,MACf,SAAS;CAEb,SAAS,OAAO;EAWd,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACpE,QAAQ,KAAK,yDAAyD,QAAQ;CAChF;CACA,OAAO,IAAI,SAAS,KAAK,UAAU,kBAAkB,MAAM,CAAC,GAAG;EAC7D,QAAQ;EACR,SAAS,EAAE,gBAAgB,mBAAmB;CAChD,CAAC;AACH"}
|
|
@@ -1,13 +1,13 @@
|
|
|
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-BmflLCdF.js";
|
|
2
2
|
import { d as MAINTENANCE_PROFILE_NODE } from "./constants-CfeMWQWk.js";
|
|
3
3
|
import { t as BaerlyError } from "./errors-Dfa3p78c.js";
|
|
4
4
|
import { o as parseMaintenanceEnv } from "./maintenance-B4Dki6Ig.js";
|
|
5
5
|
import { a as isDeployedEnv, n as resolveVerifier, t as Db } from "./src-CYHFDrKz.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-DGd5tbNs.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-
|
|
10
|
+
import { t as handleSpecRequest } from "./runtime-spec-Dsw2-n8S.js";
|
|
11
11
|
import { i as parseStsError, n as S3HttpStorage, r as parseAssumeRoleWithWebIdentity, t as AwsClient } from "./aws4fetch.esm-p7eEzLCs.js";
|
|
12
12
|
import { readFile, stat } from "node:fs/promises";
|
|
13
13
|
import { extname, relative, resolve, sep } from "node:path";
|
|
@@ -2011,7 +2011,7 @@ const nodeMaintenanceDispatch = (readEnv = (k) => process.env[k]) => {
|
|
|
2011
2011
|
* coverage in `server.test.ts`.
|
|
2012
2012
|
*/
|
|
2013
2013
|
function createFetchHandler(opts) {
|
|
2014
|
-
configureObservability(resolveDefaultSink(opts.observability ?? {}));
|
|
2014
|
+
if (opts.observability !== false) configureObservability(resolveDefaultSink(opts.observability ?? {}));
|
|
2015
2015
|
const wrappedStorage = observableStorage(opts.storage);
|
|
2016
2016
|
return async (request) => {
|
|
2017
2017
|
const path = new URL(request.url).pathname;
|
|
@@ -2268,4 +2268,4 @@ function baerlyNode(opts) {
|
|
|
2268
2268
|
//#endregion
|
|
2269
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 };
|
|
2270
2270
|
|
|
2271
|
-
//# sourceMappingURL=src-
|
|
2271
|
+
//# sourceMappingURL=src-BL_JoPTn.js.map
|