@gusto/baerly-storage 0.4.0 → 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 +49 -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-qL3_lTTU.js → runtime-spec-Dsw2-n8S.js} +2 -2
- package/dist/{runtime-spec-qL3_lTTU.js.map → runtime-spec-Dsw2-n8S.js.map} +1 -1
- package/dist/{src-BG20LZs7.js → src-BL_JoPTn.js} +5 -5
- package/dist/{src-BG20LZs7.js.map → src-BL_JoPTn.js.map} +1 -1
- package/package.json +5 -5
package/dist/http.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { u as errorEnvelope } from "./observability-
|
|
2
|
-
import { a as longPollSince, i as listEventsSince, n as createRouter, r as mapError, t as MAX_BODY_BYTES } from "./http-
|
|
1
|
+
import { u as errorEnvelope } from "./observability-BmflLCdF.js";
|
|
2
|
+
import { a as longPollSince, i as listEventsSince, n as createRouter, r as mapError, t as MAX_BODY_BYTES } from "./http-DGd5tbNs.js";
|
|
3
3
|
export { MAX_BODY_BYTES, createRouter, errorEnvelope, listEventsSince, longPollSince, mapError };
|
|
@@ -1346,9 +1346,11 @@ interface ObservabilityConfig {
|
|
|
1346
1346
|
/**
|
|
1347
1347
|
* Wire LogTape's global config.
|
|
1348
1348
|
*
|
|
1349
|
-
* Idempotent — call as many times as you
|
|
1350
|
-
*
|
|
1351
|
-
* `beforeEach`.
|
|
1349
|
+
* Idempotent over baerly's own config — call as many times as you
|
|
1350
|
+
* like and the last call wins. The adapter boot path calls it once at
|
|
1351
|
+
* init; tests call it once per `beforeEach`. When LogTape is already
|
|
1352
|
+
* configured by the host application (see the module doc), this is a
|
|
1353
|
+
* no-op apart from a one-line meta-logger notice.
|
|
1352
1354
|
*/
|
|
1353
1355
|
declare const configureObservability: (config?: ObservabilityConfig) => Promise<void>;
|
|
1354
1356
|
/**
|
|
@@ -1466,4 +1468,4 @@ type Outcome = "read" | "committed" | "conflict" | "error";
|
|
|
1466
1468
|
declare const deriveOutcome: (method: string, status: number, error?: unknown) => Outcome;
|
|
1467
1469
|
//#endregion
|
|
1468
1470
|
export { ObservabilityContextInit as _, flushCanonicalLine as a, runWithContext as b, CATEGORY as c, ObservabilityConfig as d, configureObservability as f, ObservabilityContext as g, LogRecord as h, FlushCanonicalLineOptions as i, CategoryName as l, Sink as m, deriveOutcome as n, flushUnauthorizedAndRespond as o, getLogger as p, observableStorage as r, withHttpObservability as s, Outcome as t, FriendlyLogLevel as u, createObservabilityContext as v, getCurrentContext as y };
|
|
1469
|
-
//# sourceMappingURL=index-
|
|
1471
|
+
//# sourceMappingURL=index-CuA9Mi3K.d.ts.map
|
package/dist/node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as BaerlyAppConfig } from "./app-config-DyiFK3_k.js";
|
|
2
2
|
import { p as Storage, r as Verifier } from "./index-BYk9oCNf.js";
|
|
3
3
|
import { i as DevLandingOptions } from "./index-0rZcMBwy.js";
|
|
4
|
-
import { d as ObservabilityConfig } from "./index-
|
|
4
|
+
import { d as ObservabilityConfig } from "./index-CuA9Mi3K.js";
|
|
5
5
|
import { n as S3HttpStorageOptions, t as S3HttpStorage } from "./s3-http-B-z8th6O.js";
|
|
6
6
|
|
|
7
7
|
//#region packages/adapter-node/src/credentials/types.d.ts
|
|
@@ -390,7 +390,7 @@ interface BaerlyNodeOptions {
|
|
|
390
390
|
* `GET /v1/healthz` always bypasses the verifier.
|
|
391
391
|
*/
|
|
392
392
|
readonly verifier?: Verifier;
|
|
393
|
-
readonly observability?: ObservabilityConfig;
|
|
393
|
+
readonly observability?: ObservabilityConfig | false;
|
|
394
394
|
readonly dev?: DevLandingOptions;
|
|
395
395
|
readonly webRoot?: string;
|
|
396
396
|
readonly sinceTimeoutMs?: number;
|
package/dist/node.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as fromEksPodIdentity, c as localFsStorage, d as r2Storage, f as s3Storage, i as fromWebIdentity, l as gcsStorage, o as assertStorageReachable, r as fromEks, s as resolveStorageFromEnv, t as baerlyNode, u as minioStorage } from "./src-
|
|
1
|
+
import { a as fromEksPodIdentity, c as localFsStorage, d as r2Storage, f as s3Storage, i as fromWebIdentity, l as gcsStorage, o as assertStorageReachable, r as fromEks, s as resolveStorageFromEnv, t as baerlyNode, u as minioStorage } from "./src-BL_JoPTn.js";
|
|
2
2
|
import { n as S3HttpStorage } from "./aws4fetch.esm-p7eEzLCs.js";
|
|
3
3
|
export { S3HttpStorage, assertStorageReachable, baerlyNode, fromEks, fromEksPodIdentity, fromWebIdentity, gcsStorage, localFsStorage, minioStorage, r2Storage, resolveStorageFromEnv, s3Storage };
|
|
@@ -1891,6 +1891,13 @@ function configureInternal(config, allowAsync) {
|
|
|
1891
1891
|
});
|
|
1892
1892
|
}
|
|
1893
1893
|
/**
|
|
1894
|
+
* Get the current configuration, if any. Otherwise, `null`.
|
|
1895
|
+
* @returns The current configuration, if any. Otherwise, `null`.
|
|
1896
|
+
*/
|
|
1897
|
+
function getConfig() {
|
|
1898
|
+
return currentConfig;
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1894
1901
|
* Reset the configuration. Mostly for testing purposes.
|
|
1895
1902
|
*/
|
|
1896
1903
|
async function reset() {
|
|
@@ -2045,12 +2052,14 @@ var ConfigError = class extends Error {
|
|
|
2045
2052
|
* the rest of the project's vocabulary; we translate at the
|
|
2046
2053
|
* configure boundary.
|
|
2047
2054
|
*
|
|
2048
|
-
* ## Idempotency
|
|
2055
|
+
* ## Idempotency & host-config coexistence
|
|
2049
2056
|
*
|
|
2050
|
-
*
|
|
2051
|
-
*
|
|
2052
|
-
*
|
|
2053
|
-
*
|
|
2057
|
+
* Safe to call repeatedly: over baerly's own config (or none) we
|
|
2058
|
+
* reconfigure with `reset: true` so the last call wins. But baerly is
|
|
2059
|
+
* a library — an embedding app may own LogTape. To avoid clobbering a
|
|
2060
|
+
* host config, we skip (with one meta-logger notice) when {@link
|
|
2061
|
+
* getConfig} shows a config we didn't install. Embedders opt out fully
|
|
2062
|
+
* via the adapter's `observability: false`.
|
|
2054
2063
|
*/
|
|
2055
2064
|
/**
|
|
2056
2065
|
* Canonical category names. Use these instead of bare strings.
|
|
@@ -2067,29 +2076,56 @@ const CATEGORY = {
|
|
|
2067
2076
|
storage: ["baerly", "storage"]
|
|
2068
2077
|
};
|
|
2069
2078
|
/**
|
|
2079
|
+
* Sink id baerly registers under. Doubles as our config-ownership
|
|
2080
|
+
* marker: a LogTape config carrying a sink under this key is one we
|
|
2081
|
+
* installed, so re-running {@link configureObservability} may safely
|
|
2082
|
+
* reset it. A config *without* this key belongs to the host app and
|
|
2083
|
+
* we must not clobber it.
|
|
2084
|
+
*
|
|
2085
|
+
* Deliberately namespaced rather than a bare `"baerly"`: this key
|
|
2086
|
+
* gates a destructive `reset`, so a host must never be able to trip it
|
|
2087
|
+
* by coincidentally naming one of its own sinks the same thing. The id
|
|
2088
|
+
* is internal (never surfaced on the wire) and depends only on
|
|
2089
|
+
* LogTape's documented `Config.sinks` shape.
|
|
2090
|
+
*/
|
|
2091
|
+
const BAERLY_SINK_ID = "@gusto/baerly-storage";
|
|
2092
|
+
/**
|
|
2070
2093
|
* Wire LogTape's global config.
|
|
2071
2094
|
*
|
|
2072
|
-
* Idempotent — call as many times as you
|
|
2073
|
-
*
|
|
2074
|
-
* `beforeEach`.
|
|
2095
|
+
* Idempotent over baerly's own config — call as many times as you
|
|
2096
|
+
* like and the last call wins. The adapter boot path calls it once at
|
|
2097
|
+
* init; tests call it once per `beforeEach`. When LogTape is already
|
|
2098
|
+
* configured by the host application (see the module doc), this is a
|
|
2099
|
+
* no-op apart from a one-line meta-logger notice.
|
|
2075
2100
|
*/
|
|
2076
2101
|
const configureObservability = async (config = {}) => {
|
|
2102
|
+
const existing = getConfig();
|
|
2103
|
+
if (existing !== null && !isBaerlyOwnedConfig(existing)) {
|
|
2104
|
+
getLogger$1(["logtape", "meta"]).warn("LogTape already configured by the host; baerly left it intact. Add a [\"baerly\"] logger to route baerly logs, or pass observability:false.");
|
|
2105
|
+
return;
|
|
2106
|
+
}
|
|
2077
2107
|
const level = resolveLevel(config.level);
|
|
2108
|
+
const sink = resolveSink(config.sink);
|
|
2078
2109
|
await configure({
|
|
2079
2110
|
reset: true,
|
|
2080
|
-
sinks: {
|
|
2111
|
+
sinks: { [BAERLY_SINK_ID]: sink },
|
|
2081
2112
|
loggers: [{
|
|
2082
2113
|
category: "baerly",
|
|
2083
|
-
sinks: [
|
|
2114
|
+
sinks: [BAERLY_SINK_ID],
|
|
2084
2115
|
lowestLevel: level
|
|
2085
2116
|
}, {
|
|
2086
2117
|
category: ["logtape", "meta"],
|
|
2087
|
-
sinks: [
|
|
2118
|
+
sinks: [BAERLY_SINK_ID],
|
|
2088
2119
|
lowestLevel: "error"
|
|
2089
2120
|
}]
|
|
2090
2121
|
});
|
|
2091
2122
|
};
|
|
2092
2123
|
/**
|
|
2124
|
+
* Is this LogTape config one baerly installed? Detected by the marker
|
|
2125
|
+
* sink id — see {@link BAERLY_SINK_ID}.
|
|
2126
|
+
*/
|
|
2127
|
+
const isBaerlyOwnedConfig = (cfg) => Object.prototype.hasOwnProperty.call(cfg.sinks, BAERLY_SINK_ID);
|
|
2128
|
+
/**
|
|
2093
2129
|
* Thin re-export. Identical shape to `@logtape/logtape`'s `getLogger`.
|
|
2094
2130
|
* Constants in {@link CATEGORY} are the canonical inputs; bare
|
|
2095
2131
|
* strings still work for ad-hoc instrumentation.
|
|
@@ -2500,4 +2536,4 @@ const observableStorage = (inner) => {
|
|
|
2500
2536
|
//#endregion
|
|
2501
2537
|
export { withHttpObservability as a, configureObservability as c, WHERE_ORDER_JSON_RESOLUTION as d, WRITE_BODY_SHAPE_RESOLUTION as f, serializeError as i, getLogger as l, flushCanonicalLine as n, deriveOutcome as o, flushUnauthorizedAndRespond as r, CATEGORY as s, observableStorage as t, errorEnvelope as u };
|
|
2502
2538
|
|
|
2503
|
-
//# sourceMappingURL=observability-
|
|
2539
|
+
//# sourceMappingURL=observability-BmflLCdF.js.map
|