@claxedo/workspace-relay 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/dist/bun.d.ts +31 -0
- package/dist/cloudflare.d.ts +98 -0
- package/dist/index.mjs +309 -39
- package/dist/main.d.ts +47 -27
- package/dist/main.mjs +19692 -39183
- package/dist/worker.d.ts +12 -0
- package/dist/workerd-fixture/binary-frame-worker.d.ts +33 -0
- package/package.json +13 -6
package/dist/main.d.ts
CHANGED
|
@@ -4,48 +4,68 @@ import { type RelayHostPublicKey, type RevocationLookup, type WorkspaceRelayTarg
|
|
|
4
4
|
import type { RelayKey } from "./auth";
|
|
5
5
|
export { createCachedRevocationClient, createCachedTargetClient } from "./server";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* W2c (2026-07-28-001): PostHog is the relay's error sink — one vendor
|
|
8
|
+
* carries error tracking for every runtime behind one distinct_id space.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
10
|
+
* Sending requires two independent opt-ins: `CLAXEDO_TELEMETRY_MODE=on` AND
|
|
11
|
+
* `CLAXEDO_POSTHOG_KEY` (`POSTHOG_KEY` accepted as a fallback — the same
|
|
12
|
+
* unprefixed name claxedo-server's posthog.ts already reads). Any other
|
|
13
|
+
* combination → no `PostHog` client is ever constructed: zero SDK overhead,
|
|
14
|
+
* zero network — a clean no-op safe to ship before the telemetry account
|
|
15
|
+
* exists. Host defaults to `https://us.i.posthog.com` (the canonical ingest
|
|
16
|
+
* host — NOT the legacy `app.posthog.com` default some SDKs ship). Release =
|
|
17
|
+
* git SHA passed by the D11 deploy workflow (`CLAXEDO_RELEASE`; `GIT_SHA`
|
|
18
|
+
* accepted as alias); captures are tagged unit=relay + deployment_mode
|
|
19
|
+
* (absent → "self-host", mirroring D9's default).
|
|
17
20
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* (https://docs.sentry.io/platforms/javascript/guides/bun/).
|
|
21
|
+
* `posthog-node` runs fine on Bun (`Bun.serve`), unlike the Cloudflare
|
|
22
|
+
* Worker, which keeps it off its import graph entirely (see worker.ts).
|
|
21
23
|
*/
|
|
22
24
|
export type RelayObservabilityEnv = {
|
|
23
|
-
|
|
25
|
+
/** Only `on` permits sending, matched case-insensitively after trimming. */
|
|
26
|
+
CLAXEDO_TELEMETRY_MODE?: string | undefined;
|
|
27
|
+
CLAXEDO_POSTHOG_KEY?: string | undefined;
|
|
28
|
+
POSTHOG_KEY?: string | undefined;
|
|
29
|
+
CLAXEDO_POSTHOG_HOST?: string | undefined;
|
|
24
30
|
CLAXEDO_RELEASE?: string | undefined;
|
|
25
31
|
GIT_SHA?: string | undefined;
|
|
26
32
|
CLAXEDO_DEPLOYMENT_MODE?: string | undefined;
|
|
27
33
|
/** Accept process.env verbatim (extra keys are ignored). */
|
|
28
34
|
[key: string]: string | undefined;
|
|
29
35
|
};
|
|
30
|
-
export type
|
|
31
|
-
|
|
36
|
+
export type RelayTelemetryOptions = {
|
|
37
|
+
key: string;
|
|
38
|
+
host: string;
|
|
32
39
|
release?: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
unit: "relay";
|
|
37
|
-
deployment_mode: string;
|
|
38
|
-
};
|
|
40
|
+
tags: {
|
|
41
|
+
unit: "relay";
|
|
42
|
+
deployment_mode: string;
|
|
39
43
|
};
|
|
40
44
|
};
|
|
41
45
|
/**
|
|
42
|
-
* Pure env →
|
|
43
|
-
* (no client, no network)
|
|
46
|
+
* Pure env → PostHog options resolver. `undefined` = do NOT construct a client
|
|
47
|
+
* (no client, no network), which is the answer unless BOTH opt-ins are
|
|
48
|
+
* present. The mode is read before the key so that a deployment which has not
|
|
49
|
+
* said `on` stays silent no matter which keys reach its environment.
|
|
50
|
+
* Exported for tests.
|
|
44
51
|
*/
|
|
45
|
-
export declare function
|
|
52
|
+
export declare function relayTelemetryOptions(env: RelayObservabilityEnv): RelayTelemetryOptions | undefined;
|
|
46
53
|
export declare function initRelayObservability(env?: RelayObservabilityEnv): {
|
|
47
54
|
enabled: boolean;
|
|
48
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Capture-and-flush used by the fatal handlers and the startup catch. With no
|
|
58
|
+
* initialized client (key absent) this is a documented no-op. Never throws —
|
|
59
|
+
* observability must not preempt the exit path.
|
|
60
|
+
*
|
|
61
|
+
* `distinctId: "system"` mirrors the ops-plane convention: process-fatal
|
|
62
|
+
* events carry no user identity. `client.flush()` has no built-in timeout,
|
|
63
|
+
* so it races a 2s timer; the flush promise's
|
|
64
|
+
* rejection is swallowed even when the timer wins the race, so a slow network
|
|
65
|
+
* failure that resolves after the timeout never surfaces as a second
|
|
66
|
+
* unhandledRejection mid-shutdown.
|
|
67
|
+
*/
|
|
68
|
+
export declare function reportFatal(error: unknown): Promise<void>;
|
|
49
69
|
/**
|
|
50
70
|
* Production fail-closed gate for the relay → claxedo-server resolver channel.
|
|
51
71
|
*
|
|
@@ -212,9 +232,9 @@ export type FatalProcessHandlerOptions = {
|
|
|
212
232
|
log?: (message: string) => void;
|
|
213
233
|
register?: boolean;
|
|
214
234
|
/**
|
|
215
|
-
*
|
|
216
|
-
* crash reaches
|
|
217
|
-
* never block the exit path. Defaults to none (tests,
|
|
235
|
+
* W2c: error-tracker hook, invoked (and awaited) before teardown so a fatal
|
|
236
|
+
* crash reaches PostHog before the process exits. Failures are logged and
|
|
237
|
+
* never block the exit path. Defaults to none (tests, key-absent runs).
|
|
218
238
|
*/
|
|
219
239
|
report?: (error: unknown, source: "uncaughtException" | "unhandledRejection") => void | Promise<void>;
|
|
220
240
|
stopServer?: () => Promise<void> | void;
|