@burdenoff/be-sdk 2026.1202.4 → 2026.1202.6
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/{EventQueueFactory-DbLEV5h_.js → EventQueueFactory-0XHOTKEv.js} +19 -13
- package/dist/{EventQueueFactory-DbLEV5h_.js.map → EventQueueFactory-0XHOTKEv.js.map} +1 -1
- package/dist/activity/index.d.ts +2 -2
- package/dist/auth/index.d.ts +1 -1
- package/dist/{backoff-Di7sEjSw.js → backoff-Ck5QMdig.js} +2 -2
- package/dist/{backoff-Di7sEjSw.js.map → backoff-Ck5QMdig.js.map} +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/env-cCfoPZ7m.js +122 -0
- package/dist/env-cCfoPZ7m.js.map +1 -0
- package/dist/event-queue/index.d.ts +2 -2
- package/dist/event-queue/index.js +6 -6
- package/dist/{event-queue-ANzylLK1.js → event-queue-CpVi7BET.js} +11 -8
- package/dist/event-queue-CpVi7BET.js.map +1 -0
- package/dist/feature-flags/index.d.ts +1 -1
- package/dist/graph/index.d.ts +1 -1
- package/dist/graph/index.js +2 -2
- package/dist/{graph-emitter-CwSyGt3g.js → graph-emitter-CtfPpHxL.js} +8 -4
- package/dist/{graph-emitter-CwSyGt3g.js.map → graph-emitter-CtfPpHxL.js.map} +1 -1
- package/dist/{graph-BTaqvVYQ.js → graph-hPqNRoKC.js} +4 -4
- package/dist/{graph-BTaqvVYQ.js.map → graph-hPqNRoKC.js.map} +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/{graphql-D_DkedFZ.js → graphql-Cn-OBnyu.js} +2 -2
- package/dist/{graphql-D_DkedFZ.js.map → graphql-Cn-OBnyu.js.map} +1 -1
- package/dist/{graphql-DcZAKC6p.d.ts → graphql-DPkc5IMZ.d.ts} +1 -1
- package/dist/{index-UQSbAERe.d.ts → index--w3AsbqC.d.ts} +2 -2
- package/dist/{index-BMy-d2_f.d.ts → index-12QwfPvR.d.ts} +3 -3
- package/dist/{index-GzZunmGS.d.ts → index-B30y7Yry.d.ts} +3 -3
- package/dist/{index-C96mNrLW.d.ts → index-C4MFjzOT.d.ts} +2 -2
- package/dist/{index-CQ3vxT5P.d.ts → index-CDdrBQom.d.ts} +1 -0
- package/dist/{index-CeaJcbar.d.ts → index-ChJqXbVL.d.ts} +8 -4
- package/dist/{index-B4ckqUZX.d.ts → index-Cx77z1cc.d.ts} +1 -1
- package/dist/{index-Cl3Xiw1O.d.ts → index-DM5zS9TT.d.ts} +2 -2
- package/dist/{index-Cs426iRP.d.ts → index-DMKCyeBm.d.ts} +4 -4
- package/dist/{index-BmL-JjQK.d.ts → index-DMq2xPV7.d.ts} +1 -1
- package/dist/{index-C4hRRihw.d.ts → index-Dl32yXnZ.d.ts} +1 -1
- package/dist/{index-j1B6eYHc.d.ts → index-Ds_V1Crj.d.ts} +2 -2
- package/dist/{index-CZWopQsh.d.ts → index-PvHsCusi.d.ts} +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/dist/init/index.js +1 -1
- package/dist/{init-knkrqVvJ.js → init-CsfDrW9M.js} +3 -3
- package/dist/{init-knkrqVvJ.js.map → init-CsfDrW9M.js.map} +1 -1
- package/dist/instrumentation/index.d.ts +2 -2
- package/dist/logger/index.d.ts +1 -1
- package/dist/{middleware-InVCyjUX.js → middleware-aO50bLUO.js} +2 -2
- package/dist/{middleware-InVCyjUX.js.map → middleware-aO50bLUO.js.map} +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/payments/index.d.ts +2 -2
- package/dist/prisma/index.d.ts +2 -2
- package/dist/prisma/index.js +2 -2
- package/dist/{prisma-DcMrbj7W.js → prisma-BlB0aalN.js} +3 -3
- package/dist/{prisma-DcMrbj7W.js.map → prisma-BlB0aalN.js.map} +1 -1
- package/dist/rbac/index.d.ts +1 -1
- package/dist/resource-caps/index.d.ts +1 -1
- package/dist/search/index.d.ts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/tracker/index.d.ts +2 -2
- package/dist/translation/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/{types-C36JkwDg.d.ts → types-BxZmaW3v.d.ts} +1 -1
- package/dist/usage/index.d.ts +1 -1
- package/dist/{workspace-extension-C0qib11C.d.ts → workspace-extension-DAs06Hv_.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/env-DdaoGjIt.js +0 -74
- package/dist/env-DdaoGjIt.js.map +0 -1
- package/dist/event-queue-ANzylLK1.js.map +0 -1
package/dist/graphql/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as registerPubSubHealthSource, t as getPubSubHealth } from "../pubsub-health-DCeAKI3q.js";
|
|
2
|
-
import { n as computePubSubBackoffMs, r as createRedisStreamsEventTarget } from "../graphql-
|
|
2
|
+
import { n as computePubSubBackoffMs, r as createRedisStreamsEventTarget } from "../graphql-Cn-OBnyu.js";
|
|
3
3
|
import { n as Logger, t as createDatabaseService } from "../services-BWzfz7vG.js";
|
|
4
4
|
|
|
5
5
|
export { Logger, computePubSubBackoffMs, createDatabaseService, createRedisStreamsEventTarget, getPubSubHealth, registerPubSubHealthSource };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.js";
|
|
2
2
|
import { l as getMetricsRegistry } from "./metrics-collector-DXQrMUle.js";
|
|
3
3
|
import { a as logger } from "./logger-B6rCpb7D.js";
|
|
4
|
-
import { n as RedisStreamsConnection, t as computeBackoffMs } from "./backoff-
|
|
4
|
+
import { n as RedisStreamsConnection, t as computeBackoffMs } from "./backoff-Ck5QMdig.js";
|
|
5
5
|
import { n as registerPubSubHealthSource, t as getPubSubHealth } from "./pubsub-health-DCeAKI3q.js";
|
|
6
6
|
import { n as Logger, t as createDatabaseService } from "./services-BWzfz7vG.js";
|
|
7
7
|
|
|
@@ -393,4 +393,4 @@ var graphql_exports = /* @__PURE__ */ __exportAll({
|
|
|
393
393
|
});
|
|
394
394
|
|
|
395
395
|
export { computePubSubBackoffMs as n, createRedisStreamsEventTarget as r, graphql_exports as t };
|
|
396
|
-
//# sourceMappingURL=graphql-
|
|
396
|
+
//# sourceMappingURL=graphql-Cn-OBnyu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-D_DkedFZ.js","names":[],"sources":["../src/graphql/redis-streams-event-target.ts","../src/graphql/index.ts"],"sourcesContent":["/**\n * Redis Streams-based EventTarget for graphql-yoga distributed PubSub.\n *\n * Each server tails a per-event-type stream with `XREAD BLOCK ... $` (no\n * consumer group) so every instance receives every dispatch — the fan-out\n * semantics GraphQL subscriptions require.\n *\n * For durable inter-svc events use `event-queue/createPublisher` instead.\n *\n * RECOVERY (BOFF-17232)\n * Redis can be unreachable when a pod boots (CoreDNS still starting, a\n * Valkey failover) or later in its life. The target never gives up:\n *\n * - The connection is retried in the background with capped, equal-jitter\n * exponential backoff until it is ready. ioredis keeps one client\n * reconnecting underneath; this loop only waits on it, so a retry never\n * builds a second client (see `RedisStreamsConnection.connect`).\n * - Each per-event-type reader is supervised. If it cannot get a blocking\n * client, or XREAD fails, it backs off and starts again. Before the fix a\n * reader whose first connect timed out logged \"reader crashed\" and was\n * never restarted, so that pod's subscribers silently received nothing —\n * not even events published on the same pod — for the life of the process.\n * - A reader that never managed to read resumes from the moment it was\n * subscribed, so events dispatched while Redis was down (up to `maxLen`)\n * still reach the subscriber once Redis is back.\n * - The degraded state is logged on entry and on recovery, exported as the\n * `graphql_pubsub_redis_degraded` gauge, and reported to `createServer`'s\n * readiness probe as the optional `pubsub` dependency.\n */\nimport { getMetricsRegistry } from '../instrumentation/metrics-collector.js';\nimport { logger } from '../logger/index.js';\nimport { computeBackoffMs } from '../event-queue/backoff.js';\nimport { RedisStreamsConnection } from '../event-queue/implementations/redis-streams/RedisStreamsConnection.js';\nimport { registerPubSubHealthSource } from './pubsub-health.js';\n\nexport interface RedisStreamsEventTarget {\n addEventListener(type: string, listener: (event: Event) => void): void;\n removeEventListener(type: string, listener: (event: Event) => void): void;\n dispatchEvent(event: Event): boolean;\n close(): Promise<void>;\n /** True when Redis is connected and no reader is retrying. */\n isHealthy(): boolean;\n /** Point-in-time view of the transport, for health endpoints and logs. */\n getStatus(): RedisStreamsEventTargetStatus;\n}\n\nexport interface RedisStreamsEventTargetStatus {\n /** The `subjectPrefix` this target was created with. */\n prefix: string;\n /** The shared command connection is ready. */\n connected: boolean;\n /** Not connected, or at least one reader is retrying. */\n degraded: boolean;\n /** Epoch milliseconds when the current degraded period began, else null. */\n degradedSince: number | null;\n /** Event types with a live reader. */\n readers: number;\n /** Readers currently backing off after a failure. */\n retryingReaders: number;\n /** Consecutive failed connection attempts (0 once connected). */\n connectFailures: number;\n}\n\n/** Backoff for connection and reader retries. */\nexport interface RedisStreamsRetryOptions {\n /** First retry delay ceiling in ms. Default 500. */\n baseDelayMs?: number;\n /** Maximum retry delay ceiling in ms. Default 30000. */\n maxDelayMs?: number;\n}\n\n/** Blocking client used by a reader (one per event type). */\nexport interface RedisStreamsBlockingClient {\n /** Runs `XREAD <args>`; resolves to the raw reply or null on timeout. */\n xread(...args: Array<string | number>): Promise<unknown>;\n disconnect(): void;\n}\n\n/**\n * Transport the target runs on. The default wraps `RedisStreamsConnection`;\n * tests and custom transports can supply their own.\n */\nexport interface RedisStreamsEventTargetConnection {\n connect(): Promise<void>;\n isConnected(): boolean;\n /** Runs `XADD <args>`, connecting first when no client exists yet. */\n xadd(...args: Array<string | number>): Promise<unknown>;\n makeBlockingClient(): Promise<RedisStreamsBlockingClient>;\n disconnect(): Promise<void>;\n}\n\nexport interface RedisStreamsEventTargetOptions {\n /** Redis connection URL. Defaults to `REDIS_URL` env. */\n redisUrl?: string;\n /** Optional password override. */\n password?: string;\n /** Subject prefix; keys become `<prefix>.<type>` mapped via `:` separator. */\n subjectPrefix?: string;\n /** Approximate MAXLEN trim for each pubsub stream. Default 1000. */\n maxLen?: number;\n /** Per-event serialiser. */\n serializer?: {\n stringify: (data: unknown) => string | Promise<string>;\n parse: (msg: string) => unknown | Promise<unknown>;\n };\n /** Retry backoff for the connection and the readers. */\n retry?: RedisStreamsRetryOptions;\n /** How often the degraded state is re-evaluated, in ms. Default 5000. */\n healthCheckIntervalMs?: number;\n /** XREAD BLOCK timeout in ms. Default 5000. */\n blockMs?: number;\n /** Transport override. When set, `redisUrl` is not required. */\n connection?: RedisStreamsEventTargetConnection;\n}\n\nexport const DEFAULT_PUBSUB_RETRY_BASE_MS = 500;\nexport const DEFAULT_PUBSUB_RETRY_MAX_MS = 30_000;\nconst DEFAULT_HEALTH_CHECK_INTERVAL_MS = 5000;\nconst DEFAULT_BLOCK_MS = 5000;\n\n/**\n * Equal-jitter exponential backoff: the ceiling doubles per attempt up to\n * `maxMs`, and the delay is drawn from [ceiling/2, ceiling). Half the window\n * is fixed so retries never collapse to zero; the random half spreads a\n * fleet of pods that lost the same Redis at the same moment.\n */\nexport function computePubSubBackoffMs(\n attempt: number,\n baseMs: number = DEFAULT_PUBSUB_RETRY_BASE_MS,\n maxMs: number = DEFAULT_PUBSUB_RETRY_MAX_MS,\n random: () => number = Math.random\n): number {\n return computeBackoffMs(attempt, baseMs, maxMs, random);\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\ntype ConnectionLike = Pick<\n RedisStreamsConnection,\n 'connect' | 'isConnected' | 'getClient' | 'makeBlockingClient' | 'disconnect'\n>;\n\n/**\n * Default transport: adapts the SDK's shared Redis Streams connection.\n * Exported for tests only; not part of the package entry point.\n */\nexport function adaptRedisStreamsConnection(conn: ConnectionLike): RedisStreamsEventTargetConnection {\n return {\n connect: () => conn.connect(),\n isConnected: () => conn.isConnected(),\n async xadd(...args) {\n let client: ReturnType<ConnectionLike['getClient']>;\n try {\n client = conn.getClient();\n } catch {\n // No client yet (first connect still loading ioredis, or it failed\n // before a client existed). Connect once; a reconnecting client\n // otherwise queues the command until it is ready.\n await conn.connect();\n client = conn.getClient();\n }\n return client.xadd(...args);\n },\n async makeBlockingClient() {\n const client = await conn.makeBlockingClient();\n // XREAD is not on the narrowed ioredis type; `call` sends it verbatim.\n const raw = client as unknown as { call: (command: string, ...args: unknown[]) => Promise<unknown> };\n return {\n xread: (...args) => raw.call('XREAD', ...args),\n disconnect: () => client.disconnect(),\n };\n },\n disconnect: () => conn.disconnect(),\n };\n}\n\ntype XReadReply = Array<[string, Array<[string, string[]]>]>;\n\ninterface ReaderState {\n stopped: boolean;\n retrying: boolean;\n attempt: number;\n client: RedisStreamsBlockingClient | null;\n wake: (() => void) | null;\n}\n\nexport async function createRedisStreamsEventTarget(\n options: RedisStreamsEventTargetOptions = {}\n): Promise<RedisStreamsEventTarget> {\n const prefix = options.subjectPrefix ?? 'graphql.pubsub';\n const maxLen = options.maxLen ?? 1000;\n const baseDelayMs = options.retry?.baseDelayMs ?? DEFAULT_PUBSUB_RETRY_BASE_MS;\n const maxDelayMs = options.retry?.maxDelayMs ?? DEFAULT_PUBSUB_RETRY_MAX_MS;\n const healthCheckIntervalMs = options.healthCheckIntervalMs ?? DEFAULT_HEALTH_CHECK_INTERVAL_MS;\n const blockMs = options.blockMs ?? DEFAULT_BLOCK_MS;\n const serializer = options.serializer ?? {\n stringify: (d: unknown): string => JSON.stringify(d),\n parse: (m: string): unknown => JSON.parse(m),\n };\n\n let conn: RedisStreamsEventTargetConnection;\n if (options.connection) {\n conn = options.connection;\n } else {\n const url = options.redisUrl ?? process.env['REDIS_URL'];\n if (!url) throw new Error('[RedisStreamsEventTarget] redisUrl or REDIS_URL is required');\n conn = adaptRedisStreamsConnection(\n new RedisStreamsConnection({\n type: 'redis-streams',\n url,\n password: options.password ?? process.env['REDIS_PASSWORD'],\n name: 'graphql-pubsub',\n })\n );\n }\n\n const streamKey = (type: string): string => `boff:pubsub:${prefix}:${type.replace(/\\./g, ':')}`;\n\n const listeners = new Map<string, Set<(event: Event) => void>>();\n const readers = new Map<string, ReaderState>();\n let closed = false;\n let connectLoop: Promise<void> | null = null;\n let connectFailures = 0;\n let connectWake: (() => void) | null = null;\n let degradedSince: number | null = null;\n\n // Metrics are resolved per use: the registry can be (re)initialised after\n // this target is created, and lookups are a map hit.\n const metricLabels = { prefix };\n function recordRetry(component: 'connection' | 'reader'): void {\n getMetricsRegistry()\n .createCounter(\n 'graphql_pubsub_redis_retries_total',\n 'Retries of the GraphQL subscription pubsub Redis connection or stream readers'\n )\n .inc({ prefix, component });\n }\n function recordDispatchFailure(): void {\n getMetricsRegistry()\n .createCounter(\n 'graphql_pubsub_dispatch_failures_total',\n 'GraphQL subscription events that could not be published'\n )\n .inc(metricLabels);\n }\n\n /** Sleep that `close()` / reader stop can cut short. */\n function sleep(ms: number, setWake: (wake: (() => void) | null) => void): Promise<void> {\n return new Promise<void>((resolve) => {\n const done = (): void => {\n clearTimeout(timer);\n setWake(null);\n resolve();\n };\n const timer = setTimeout(done, ms);\n setWake(done);\n });\n }\n\n function retryingReaderCount(): number {\n let n = 0;\n for (const r of readers.values()) if (r.retrying) n++;\n return n;\n }\n\n function isDegraded(): boolean {\n return !conn.isConnected() || retryingReaderCount() > 0;\n }\n\n /** Log and export degraded-state transitions. */\n function refreshDegraded(): void {\n if (closed) return;\n const degraded = isDegraded();\n getMetricsRegistry()\n .createGauge(\n 'graphql_pubsub_redis_degraded',\n '1 while the GraphQL subscription pubsub cannot reach Redis or a stream reader is retrying'\n )\n .set(degraded ? 1 : 0, metricLabels);\n if (degraded && degradedSince === null) {\n degradedSince = Date.now();\n logger.warn(\n '[RedisStreamsEventTarget] pubsub degraded: subscribers on this replica may miss events until Redis recovers',\n { prefix, connected: conn.isConnected(), retryingReaders: retryingReaderCount() }\n );\n } else if (!degraded && degradedSince !== null) {\n logger.info('[RedisStreamsEventTarget] pubsub recovered', { prefix, degradedForMs: Date.now() - degradedSince });\n degradedSince = null;\n }\n }\n\n /** Retry the connection with backoff until it is ready. Idempotent. */\n function ensureConnected(): void {\n if (closed || connectLoop || conn.isConnected()) return;\n connectLoop = (async (): Promise<void> => {\n while (!closed && !conn.isConnected()) {\n try {\n await conn.connect();\n } catch (err) {\n if (closed) break;\n connectFailures++;\n recordRetry('connection');\n const delayMs = computePubSubBackoffMs(connectFailures, baseDelayMs, maxDelayMs);\n logger.warn('[RedisStreamsEventTarget] redis connect failed; retrying', {\n prefix,\n attempt: connectFailures,\n delayMs,\n error: errorMessage(err),\n });\n refreshDegraded();\n await sleep(delayMs, (wake) => {\n connectWake = wake;\n });\n }\n }\n if (!closed && conn.isConnected()) {\n if (connectFailures > 0) {\n logger.info('[RedisStreamsEventTarget] redis connected after retries', { prefix, attempts: connectFailures });\n } else {\n logger.info('[RedisStreamsEventTarget] redis connected', { prefix });\n }\n connectFailures = 0;\n }\n })().finally(() => {\n connectLoop = null;\n refreshDegraded();\n });\n }\n\n async function deliver(type: string, rawFields: string[]): Promise<void> {\n const fields: Record<string, string> = {};\n for (let i = 0; i + 1 < rawFields.length; i += 2) {\n fields[rawFields[i]!] = rawFields[i + 1]!;\n }\n let payload: unknown;\n try {\n payload = await serializer.parse(fields['payload'] ?? 'null');\n } catch (err) {\n // One malformed entry must not stop the stream for every subscriber.\n logger.error('[RedisStreamsEventTarget] dropping unparseable event', { type, error: errorMessage(err) });\n return;\n }\n const cbs = listeners.get(type);\n if (!cbs) return;\n const ev = new CustomEvent(type, { detail: payload });\n for (const cb of Array.from(cbs)) {\n try {\n cb(ev);\n } catch (cbErr) {\n logger.error('[RedisStreamsEventTarget] listener error', { type, error: errorMessage(cbErr) });\n }\n }\n }\n\n function startReader(type: string): void {\n if (readers.has(type) || closed) return;\n const state: ReaderState = { stopped: false, retrying: false, attempt: 0, client: null, wake: null };\n readers.set(type, state);\n const stream = streamKey(type);\n // While nothing has arrived yet, the point to resume from after a failure:\n // the subscribe time, moved forward by every empty XREAD so a later\n // failure never replays entries older than what the reader already waited\n // through.\n let resumeFrom = Date.now();\n // `$` = only entries added after the first XREAD. Replaced by the last\n // seen id once anything arrives, so a restart resumes where it stopped.\n let lastId = '$';\n\n const run = async (): Promise<void> => {\n while (!state.stopped && !closed) {\n try {\n state.client = await conn.makeBlockingClient();\n if (state.stopped || closed) break;\n while (!state.stopped && !closed) {\n const raw = (await state.client.xread(\n 'COUNT',\n 50,\n 'BLOCK',\n blockMs,\n 'STREAMS',\n stream,\n lastId\n )) as XReadReply | null;\n if (state.retrying) {\n logger.info('[RedisStreamsEventTarget] reader recovered', { prefix, type, attempts: state.attempt });\n state.retrying = false;\n state.attempt = 0;\n refreshDegraded();\n }\n if (!raw) {\n if (lastId === '$') resumeFrom = Date.now();\n continue;\n }\n for (const [, entries] of raw) {\n for (const [id, rawFields] of entries) {\n lastId = id;\n await deliver(type, rawFields);\n }\n }\n }\n } catch (err) {\n if (state.stopped || closed) break;\n // Never read anything yet: resume from the last known-empty point\n // instead of `$`, so events dispatched during the outage are not lost.\n if (lastId === '$') lastId = `${String(resumeFrom)}-0`;\n state.attempt++;\n state.retrying = true;\n recordRetry('reader');\n const delayMs = computePubSubBackoffMs(state.attempt, baseDelayMs, maxDelayMs);\n logger.warn('[RedisStreamsEventTarget] reader failed; retrying', {\n prefix,\n type,\n attempt: state.attempt,\n delayMs,\n error: errorMessage(err),\n });\n refreshDegraded();\n ensureConnected();\n await sleep(delayMs, (wake) => {\n state.wake = wake;\n });\n } finally {\n const client = state.client;\n state.client = null;\n if (client) {\n try {\n client.disconnect();\n } catch {\n /* already closed */\n }\n }\n }\n }\n };\n\n void run().finally(() => {\n // A stopped reader no longer counts toward the degraded state.\n state.retrying = false;\n refreshDegraded();\n });\n }\n\n function stopReader(type: string): void {\n const r = readers.get(type);\n if (!r) return;\n r.stopped = true;\n readers.delete(type);\n r.wake?.();\n // Unblock a pending XREAD now rather than after the BLOCK timeout.\n try {\n r.client?.disconnect();\n } catch {\n /* already closed */\n }\n }\n\n const target: RedisStreamsEventTarget = {\n addEventListener(type, listener): void {\n let set = listeners.get(type);\n if (!set) {\n set = new Set();\n listeners.set(type, set);\n startReader(type);\n }\n set.add(listener);\n },\n removeEventListener(type, listener): void {\n const set = listeners.get(type);\n if (!set) return;\n set.delete(listener);\n if (set.size === 0) {\n listeners.delete(type);\n stopReader(type);\n }\n },\n dispatchEvent(event): boolean {\n const detail = 'detail' in event ? (event as CustomEvent).detail : event;\n void (async (): Promise<void> => {\n try {\n const payload = await serializer.stringify(detail);\n await conn.xadd(streamKey(event.type), 'MAXLEN', '~', maxLen, '*', 'payload', payload);\n } catch (err) {\n recordDispatchFailure();\n logger.error('[RedisStreamsEventTarget] dispatch failed', { type: event.type, error: errorMessage(err) });\n ensureConnected();\n }\n })();\n return true;\n },\n async close(): Promise<void> {\n if (closed) return;\n closed = true;\n clearInterval(healthTimer);\n unregister();\n connectWake?.();\n for (const type of Array.from(readers.keys())) stopReader(type);\n listeners.clear();\n await conn.disconnect();\n },\n isHealthy(): boolean {\n return !isDegraded();\n },\n getStatus(): RedisStreamsEventTargetStatus {\n return {\n prefix,\n connected: conn.isConnected(),\n degraded: isDegraded(),\n degradedSince,\n readers: readers.size,\n retryingReaders: retryingReaderCount(),\n connectFailures,\n };\n },\n };\n\n const unregister = registerPubSubHealthSource({\n isHealthy: () => target.isHealthy(),\n describe: () => {\n const s = target.getStatus();\n return `${prefix}: connected=${String(s.connected)} retryingReaders=${String(s.retryingReaders)}`;\n },\n });\n\n // Re-evaluate on a timer as well: a mid-life disconnect is only visible by\n // polling the connection, and the connect loop must restart after it.\n const healthTimer = setInterval(() => {\n if (conn.isConnected()) {\n // Redis is back: cut short any backoff so recovery does not wait for\n // the full (up to maxDelayMs) sleep.\n connectWake?.();\n for (const r of readers.values()) if (r.retrying) r.wake?.();\n } else {\n ensureConnected();\n }\n refreshDegraded();\n }, healthCheckIntervalMs);\n healthTimer.unref?.();\n\n // Connect in the background — don't block svc startup on Redis reachability.\n ensureConnected();\n\n logger.info('[RedisStreamsEventTarget] ready', { prefix });\n return target;\n}\n","/**\n * GraphQL Utilities Module\n *\n * Provides GraphQL-related utilities for Burdenoff products.\n *\n * @module graphql\n */\n\n// NATS event target was removed on 2026-05-16. Use\n// `createRedisStreamsEventTarget` from `./redis-streams-event-target.js`\n// for distributed GraphQL Yoga subscriptions.\n\nexport { createRedisStreamsEventTarget } from './redis-streams-event-target.js';\nexport { computePubSubBackoffMs } from './redis-streams-event-target.js';\nexport type {\n RedisStreamsBlockingClient,\n RedisStreamsEventTarget,\n RedisStreamsEventTargetConnection,\n RedisStreamsEventTargetOptions,\n RedisStreamsEventTargetStatus,\n RedisStreamsRetryOptions,\n} from './redis-streams-event-target.js';\nexport { getPubSubHealth, registerPubSubHealthSource } from './pubsub-health.js';\nexport type { PubSubHealth, PubSubHealthSource } from './pubsub-health.js';\n\n// Injectable services for GraphQL Modules\nexport { Logger, createDatabaseService } from './services/index.js';\nexport type { DatabaseService, PrismaTransactionClient } from './services/index.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAa,+BAA+B;AAC5C,MAAa,8BAA8B;AAC3C,MAAM,mCAAmC;AACzC,MAAM,mBAAmB;;;;;;;AAQzB,SAAgB,uBACd,SACA,cACA,QAAgB,6BAChB,SAAuB,KAAK,QACpB;CACR,OAAO,iBAAiB,SAAS,QAAQ,OAAO,MAAM;AACxD;AAEA,SAAS,aAAa,KAAsB;CAC1C,OAAO,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AACxD;;;;;AAWA,SAAgB,4BAA4B,MAAyD;CACnG,OAAO;EACL,eAAe,KAAK,QAAQ;EAC5B,mBAAmB,KAAK,YAAY;EACpC,MAAM,KAAK,GAAG,MAAM;GAClB,IAAI;GACJ,IAAI;IACF,SAAS,KAAK,UAAU;GAC1B,QAAQ;IAIN,MAAM,KAAK,QAAQ;IACnB,SAAS,KAAK,UAAU;GAC1B;GACA,OAAO,OAAO,KAAK,GAAG,IAAI;EAC5B;EAC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EACxB;EACA,YAAqB;GACnB,OAAO,CAAC,WAAW;EACrB;EACA,YAA2C;GACzC,OAAO;IACL;IACA,WAAW,KAAK,YAAY;IAC5B,UAAU,WAAW;IACrB;IACA,SAAS,QAAQ;IACjB,iBAAiB,oBAAoB;IACrC;GACF;EACF;CACF;CAEA,MAAM,aAAa,2BAA2B;EAC5C,iBAAiB,OAAO,UAAU;EAClC,gBAAgB;GACd,MAAM,IAAI,OAAO,UAAU;GAC3B,OAAO,GAAG,OAAO,cAAc,OAAO,EAAE,SAAS,EAAE,mBAAmB,OAAO,EAAE,eAAe;EAChG;CACF,CAAC;CAID,MAAM,cAAc,kBAAkB;EACpC,IAAI,KAAK,YAAY,GAAG;GAGtB,cAAc;GACd,KAAK,MAAM,KAAK,QAAQ,OAAO,GAAG,IAAI,EAAE,UAAU,EAAE,OAAO;EAC7D,OACE,gBAAgB;EAElB,gBAAgB;CAClB,GAAG,qBAAqB;CACxB,YAAY,QAAQ;CAGpB,gBAAgB;CAEhB,OAAO,KAAK,mCAAmC,EAAE,OAAO,CAAC;CACzD,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"graphql-Cn-OBnyu.js","names":[],"sources":["../src/graphql/redis-streams-event-target.ts","../src/graphql/index.ts"],"sourcesContent":["/**\n * Redis Streams-based EventTarget for graphql-yoga distributed PubSub.\n *\n * Each server tails a per-event-type stream with `XREAD BLOCK ... $` (no\n * consumer group) so every instance receives every dispatch — the fan-out\n * semantics GraphQL subscriptions require.\n *\n * For durable inter-svc events use `event-queue/createPublisher` instead.\n *\n * RECOVERY (BOFF-17232)\n * Redis can be unreachable when a pod boots (CoreDNS still starting, a\n * Valkey failover) or later in its life. The target never gives up:\n *\n * - The connection is retried in the background with capped, equal-jitter\n * exponential backoff until it is ready. ioredis keeps one client\n * reconnecting underneath; this loop only waits on it, so a retry never\n * builds a second client (see `RedisStreamsConnection.connect`).\n * - Each per-event-type reader is supervised. If it cannot get a blocking\n * client, or XREAD fails, it backs off and starts again. Before the fix a\n * reader whose first connect timed out logged \"reader crashed\" and was\n * never restarted, so that pod's subscribers silently received nothing —\n * not even events published on the same pod — for the life of the process.\n * - A reader that never managed to read resumes from the moment it was\n * subscribed, so events dispatched while Redis was down (up to `maxLen`)\n * still reach the subscriber once Redis is back.\n * - The degraded state is logged on entry and on recovery, exported as the\n * `graphql_pubsub_redis_degraded` gauge, and reported to `createServer`'s\n * readiness probe as the optional `pubsub` dependency.\n */\nimport { getMetricsRegistry } from '../instrumentation/metrics-collector.js';\nimport { logger } from '../logger/index.js';\nimport { computeBackoffMs } from '../event-queue/backoff.js';\nimport { RedisStreamsConnection } from '../event-queue/implementations/redis-streams/RedisStreamsConnection.js';\nimport { registerPubSubHealthSource } from './pubsub-health.js';\n\nexport interface RedisStreamsEventTarget {\n addEventListener(type: string, listener: (event: Event) => void): void;\n removeEventListener(type: string, listener: (event: Event) => void): void;\n dispatchEvent(event: Event): boolean;\n close(): Promise<void>;\n /** True when Redis is connected and no reader is retrying. */\n isHealthy(): boolean;\n /** Point-in-time view of the transport, for health endpoints and logs. */\n getStatus(): RedisStreamsEventTargetStatus;\n}\n\nexport interface RedisStreamsEventTargetStatus {\n /** The `subjectPrefix` this target was created with. */\n prefix: string;\n /** The shared command connection is ready. */\n connected: boolean;\n /** Not connected, or at least one reader is retrying. */\n degraded: boolean;\n /** Epoch milliseconds when the current degraded period began, else null. */\n degradedSince: number | null;\n /** Event types with a live reader. */\n readers: number;\n /** Readers currently backing off after a failure. */\n retryingReaders: number;\n /** Consecutive failed connection attempts (0 once connected). */\n connectFailures: number;\n}\n\n/** Backoff for connection and reader retries. */\nexport interface RedisStreamsRetryOptions {\n /** First retry delay ceiling in ms. Default 500. */\n baseDelayMs?: number;\n /** Maximum retry delay ceiling in ms. Default 30000. */\n maxDelayMs?: number;\n}\n\n/** Blocking client used by a reader (one per event type). */\nexport interface RedisStreamsBlockingClient {\n /** Runs `XREAD <args>`; resolves to the raw reply or null on timeout. */\n xread(...args: Array<string | number>): Promise<unknown>;\n disconnect(): void;\n}\n\n/**\n * Transport the target runs on. The default wraps `RedisStreamsConnection`;\n * tests and custom transports can supply their own.\n */\nexport interface RedisStreamsEventTargetConnection {\n connect(): Promise<void>;\n isConnected(): boolean;\n /** Runs `XADD <args>`, connecting first when no client exists yet. */\n xadd(...args: Array<string | number>): Promise<unknown>;\n makeBlockingClient(): Promise<RedisStreamsBlockingClient>;\n disconnect(): Promise<void>;\n}\n\nexport interface RedisStreamsEventTargetOptions {\n /** Redis connection URL. Defaults to `REDIS_URL` env. */\n redisUrl?: string;\n /** Optional password override. */\n password?: string;\n /** Subject prefix; keys become `<prefix>.<type>` mapped via `:` separator. */\n subjectPrefix?: string;\n /** Approximate MAXLEN trim for each pubsub stream. Default 1000. */\n maxLen?: number;\n /** Per-event serialiser. */\n serializer?: {\n stringify: (data: unknown) => string | Promise<string>;\n parse: (msg: string) => unknown | Promise<unknown>;\n };\n /** Retry backoff for the connection and the readers. */\n retry?: RedisStreamsRetryOptions;\n /** How often the degraded state is re-evaluated, in ms. Default 5000. */\n healthCheckIntervalMs?: number;\n /** XREAD BLOCK timeout in ms. Default 5000. */\n blockMs?: number;\n /** Transport override. When set, `redisUrl` is not required. */\n connection?: RedisStreamsEventTargetConnection;\n}\n\nexport const DEFAULT_PUBSUB_RETRY_BASE_MS = 500;\nexport const DEFAULT_PUBSUB_RETRY_MAX_MS = 30_000;\nconst DEFAULT_HEALTH_CHECK_INTERVAL_MS = 5000;\nconst DEFAULT_BLOCK_MS = 5000;\n\n/**\n * Equal-jitter exponential backoff: the ceiling doubles per attempt up to\n * `maxMs`, and the delay is drawn from [ceiling/2, ceiling). Half the window\n * is fixed so retries never collapse to zero; the random half spreads a\n * fleet of pods that lost the same Redis at the same moment.\n */\nexport function computePubSubBackoffMs(\n attempt: number,\n baseMs: number = DEFAULT_PUBSUB_RETRY_BASE_MS,\n maxMs: number = DEFAULT_PUBSUB_RETRY_MAX_MS,\n random: () => number = Math.random\n): number {\n return computeBackoffMs(attempt, baseMs, maxMs, random);\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\ntype ConnectionLike = Pick<\n RedisStreamsConnection,\n 'connect' | 'isConnected' | 'getClient' | 'makeBlockingClient' | 'disconnect'\n>;\n\n/**\n * Default transport: adapts the SDK's shared Redis Streams connection.\n * Exported for tests only; not part of the package entry point.\n */\nexport function adaptRedisStreamsConnection(conn: ConnectionLike): RedisStreamsEventTargetConnection {\n return {\n connect: () => conn.connect(),\n isConnected: () => conn.isConnected(),\n async xadd(...args) {\n let client: ReturnType<ConnectionLike['getClient']>;\n try {\n client = conn.getClient();\n } catch {\n // No client yet (first connect still loading ioredis, or it failed\n // before a client existed). Connect once; a reconnecting client\n // otherwise queues the command until it is ready.\n await conn.connect();\n client = conn.getClient();\n }\n return client.xadd(...args);\n },\n async makeBlockingClient() {\n const client = await conn.makeBlockingClient();\n // XREAD is not on the narrowed ioredis type; `call` sends it verbatim.\n const raw = client as unknown as { call: (command: string, ...args: unknown[]) => Promise<unknown> };\n return {\n xread: (...args) => raw.call('XREAD', ...args),\n disconnect: () => client.disconnect(),\n };\n },\n disconnect: () => conn.disconnect(),\n };\n}\n\ntype XReadReply = Array<[string, Array<[string, string[]]>]>;\n\ninterface ReaderState {\n stopped: boolean;\n retrying: boolean;\n attempt: number;\n client: RedisStreamsBlockingClient | null;\n wake: (() => void) | null;\n}\n\nexport async function createRedisStreamsEventTarget(\n options: RedisStreamsEventTargetOptions = {}\n): Promise<RedisStreamsEventTarget> {\n const prefix = options.subjectPrefix ?? 'graphql.pubsub';\n const maxLen = options.maxLen ?? 1000;\n const baseDelayMs = options.retry?.baseDelayMs ?? DEFAULT_PUBSUB_RETRY_BASE_MS;\n const maxDelayMs = options.retry?.maxDelayMs ?? DEFAULT_PUBSUB_RETRY_MAX_MS;\n const healthCheckIntervalMs = options.healthCheckIntervalMs ?? DEFAULT_HEALTH_CHECK_INTERVAL_MS;\n const blockMs = options.blockMs ?? DEFAULT_BLOCK_MS;\n const serializer = options.serializer ?? {\n stringify: (d: unknown): string => JSON.stringify(d),\n parse: (m: string): unknown => JSON.parse(m),\n };\n\n let conn: RedisStreamsEventTargetConnection;\n if (options.connection) {\n conn = options.connection;\n } else {\n const url = options.redisUrl ?? process.env['REDIS_URL'];\n if (!url) throw new Error('[RedisStreamsEventTarget] redisUrl or REDIS_URL is required');\n conn = adaptRedisStreamsConnection(\n new RedisStreamsConnection({\n type: 'redis-streams',\n url,\n password: options.password ?? process.env['REDIS_PASSWORD'],\n name: 'graphql-pubsub',\n })\n );\n }\n\n const streamKey = (type: string): string => `boff:pubsub:${prefix}:${type.replace(/\\./g, ':')}`;\n\n const listeners = new Map<string, Set<(event: Event) => void>>();\n const readers = new Map<string, ReaderState>();\n let closed = false;\n let connectLoop: Promise<void> | null = null;\n let connectFailures = 0;\n let connectWake: (() => void) | null = null;\n let degradedSince: number | null = null;\n\n // Metrics are resolved per use: the registry can be (re)initialised after\n // this target is created, and lookups are a map hit.\n const metricLabels = { prefix };\n function recordRetry(component: 'connection' | 'reader'): void {\n getMetricsRegistry()\n .createCounter(\n 'graphql_pubsub_redis_retries_total',\n 'Retries of the GraphQL subscription pubsub Redis connection or stream readers'\n )\n .inc({ prefix, component });\n }\n function recordDispatchFailure(): void {\n getMetricsRegistry()\n .createCounter(\n 'graphql_pubsub_dispatch_failures_total',\n 'GraphQL subscription events that could not be published'\n )\n .inc(metricLabels);\n }\n\n /** Sleep that `close()` / reader stop can cut short. */\n function sleep(ms: number, setWake: (wake: (() => void) | null) => void): Promise<void> {\n return new Promise<void>((resolve) => {\n const done = (): void => {\n clearTimeout(timer);\n setWake(null);\n resolve();\n };\n const timer = setTimeout(done, ms);\n setWake(done);\n });\n }\n\n function retryingReaderCount(): number {\n let n = 0;\n for (const r of readers.values()) if (r.retrying) n++;\n return n;\n }\n\n function isDegraded(): boolean {\n return !conn.isConnected() || retryingReaderCount() > 0;\n }\n\n /** Log and export degraded-state transitions. */\n function refreshDegraded(): void {\n if (closed) return;\n const degraded = isDegraded();\n getMetricsRegistry()\n .createGauge(\n 'graphql_pubsub_redis_degraded',\n '1 while the GraphQL subscription pubsub cannot reach Redis or a stream reader is retrying'\n )\n .set(degraded ? 1 : 0, metricLabels);\n if (degraded && degradedSince === null) {\n degradedSince = Date.now();\n logger.warn(\n '[RedisStreamsEventTarget] pubsub degraded: subscribers on this replica may miss events until Redis recovers',\n { prefix, connected: conn.isConnected(), retryingReaders: retryingReaderCount() }\n );\n } else if (!degraded && degradedSince !== null) {\n logger.info('[RedisStreamsEventTarget] pubsub recovered', { prefix, degradedForMs: Date.now() - degradedSince });\n degradedSince = null;\n }\n }\n\n /** Retry the connection with backoff until it is ready. Idempotent. */\n function ensureConnected(): void {\n if (closed || connectLoop || conn.isConnected()) return;\n connectLoop = (async (): Promise<void> => {\n while (!closed && !conn.isConnected()) {\n try {\n await conn.connect();\n } catch (err) {\n if (closed) break;\n connectFailures++;\n recordRetry('connection');\n const delayMs = computePubSubBackoffMs(connectFailures, baseDelayMs, maxDelayMs);\n logger.warn('[RedisStreamsEventTarget] redis connect failed; retrying', {\n prefix,\n attempt: connectFailures,\n delayMs,\n error: errorMessage(err),\n });\n refreshDegraded();\n await sleep(delayMs, (wake) => {\n connectWake = wake;\n });\n }\n }\n if (!closed && conn.isConnected()) {\n if (connectFailures > 0) {\n logger.info('[RedisStreamsEventTarget] redis connected after retries', { prefix, attempts: connectFailures });\n } else {\n logger.info('[RedisStreamsEventTarget] redis connected', { prefix });\n }\n connectFailures = 0;\n }\n })().finally(() => {\n connectLoop = null;\n refreshDegraded();\n });\n }\n\n async function deliver(type: string, rawFields: string[]): Promise<void> {\n const fields: Record<string, string> = {};\n for (let i = 0; i + 1 < rawFields.length; i += 2) {\n fields[rawFields[i]!] = rawFields[i + 1]!;\n }\n let payload: unknown;\n try {\n payload = await serializer.parse(fields['payload'] ?? 'null');\n } catch (err) {\n // One malformed entry must not stop the stream for every subscriber.\n logger.error('[RedisStreamsEventTarget] dropping unparseable event', { type, error: errorMessage(err) });\n return;\n }\n const cbs = listeners.get(type);\n if (!cbs) return;\n const ev = new CustomEvent(type, { detail: payload });\n for (const cb of Array.from(cbs)) {\n try {\n cb(ev);\n } catch (cbErr) {\n logger.error('[RedisStreamsEventTarget] listener error', { type, error: errorMessage(cbErr) });\n }\n }\n }\n\n function startReader(type: string): void {\n if (readers.has(type) || closed) return;\n const state: ReaderState = { stopped: false, retrying: false, attempt: 0, client: null, wake: null };\n readers.set(type, state);\n const stream = streamKey(type);\n // While nothing has arrived yet, the point to resume from after a failure:\n // the subscribe time, moved forward by every empty XREAD so a later\n // failure never replays entries older than what the reader already waited\n // through.\n let resumeFrom = Date.now();\n // `$` = only entries added after the first XREAD. Replaced by the last\n // seen id once anything arrives, so a restart resumes where it stopped.\n let lastId = '$';\n\n const run = async (): Promise<void> => {\n while (!state.stopped && !closed) {\n try {\n state.client = await conn.makeBlockingClient();\n if (state.stopped || closed) break;\n while (!state.stopped && !closed) {\n const raw = (await state.client.xread(\n 'COUNT',\n 50,\n 'BLOCK',\n blockMs,\n 'STREAMS',\n stream,\n lastId\n )) as XReadReply | null;\n if (state.retrying) {\n logger.info('[RedisStreamsEventTarget] reader recovered', { prefix, type, attempts: state.attempt });\n state.retrying = false;\n state.attempt = 0;\n refreshDegraded();\n }\n if (!raw) {\n if (lastId === '$') resumeFrom = Date.now();\n continue;\n }\n for (const [, entries] of raw) {\n for (const [id, rawFields] of entries) {\n lastId = id;\n await deliver(type, rawFields);\n }\n }\n }\n } catch (err) {\n if (state.stopped || closed) break;\n // Never read anything yet: resume from the last known-empty point\n // instead of `$`, so events dispatched during the outage are not lost.\n if (lastId === '$') lastId = `${String(resumeFrom)}-0`;\n state.attempt++;\n state.retrying = true;\n recordRetry('reader');\n const delayMs = computePubSubBackoffMs(state.attempt, baseDelayMs, maxDelayMs);\n logger.warn('[RedisStreamsEventTarget] reader failed; retrying', {\n prefix,\n type,\n attempt: state.attempt,\n delayMs,\n error: errorMessage(err),\n });\n refreshDegraded();\n ensureConnected();\n await sleep(delayMs, (wake) => {\n state.wake = wake;\n });\n } finally {\n const client = state.client;\n state.client = null;\n if (client) {\n try {\n client.disconnect();\n } catch {\n /* already closed */\n }\n }\n }\n }\n };\n\n void run().finally(() => {\n // A stopped reader no longer counts toward the degraded state.\n state.retrying = false;\n refreshDegraded();\n });\n }\n\n function stopReader(type: string): void {\n const r = readers.get(type);\n if (!r) return;\n r.stopped = true;\n readers.delete(type);\n r.wake?.();\n // Unblock a pending XREAD now rather than after the BLOCK timeout.\n try {\n r.client?.disconnect();\n } catch {\n /* already closed */\n }\n }\n\n const target: RedisStreamsEventTarget = {\n addEventListener(type, listener): void {\n let set = listeners.get(type);\n if (!set) {\n set = new Set();\n listeners.set(type, set);\n startReader(type);\n }\n set.add(listener);\n },\n removeEventListener(type, listener): void {\n const set = listeners.get(type);\n if (!set) return;\n set.delete(listener);\n if (set.size === 0) {\n listeners.delete(type);\n stopReader(type);\n }\n },\n dispatchEvent(event): boolean {\n const detail = 'detail' in event ? (event as CustomEvent).detail : event;\n void (async (): Promise<void> => {\n try {\n const payload = await serializer.stringify(detail);\n await conn.xadd(streamKey(event.type), 'MAXLEN', '~', maxLen, '*', 'payload', payload);\n } catch (err) {\n recordDispatchFailure();\n logger.error('[RedisStreamsEventTarget] dispatch failed', { type: event.type, error: errorMessage(err) });\n ensureConnected();\n }\n })();\n return true;\n },\n async close(): Promise<void> {\n if (closed) return;\n closed = true;\n clearInterval(healthTimer);\n unregister();\n connectWake?.();\n for (const type of Array.from(readers.keys())) stopReader(type);\n listeners.clear();\n await conn.disconnect();\n },\n isHealthy(): boolean {\n return !isDegraded();\n },\n getStatus(): RedisStreamsEventTargetStatus {\n return {\n prefix,\n connected: conn.isConnected(),\n degraded: isDegraded(),\n degradedSince,\n readers: readers.size,\n retryingReaders: retryingReaderCount(),\n connectFailures,\n };\n },\n };\n\n const unregister = registerPubSubHealthSource({\n isHealthy: () => target.isHealthy(),\n describe: () => {\n const s = target.getStatus();\n return `${prefix}: connected=${String(s.connected)} retryingReaders=${String(s.retryingReaders)}`;\n },\n });\n\n // Re-evaluate on a timer as well: a mid-life disconnect is only visible by\n // polling the connection, and the connect loop must restart after it.\n const healthTimer = setInterval(() => {\n if (conn.isConnected()) {\n // Redis is back: cut short any backoff so recovery does not wait for\n // the full (up to maxDelayMs) sleep.\n connectWake?.();\n for (const r of readers.values()) if (r.retrying) r.wake?.();\n } else {\n ensureConnected();\n }\n refreshDegraded();\n }, healthCheckIntervalMs);\n healthTimer.unref?.();\n\n // Connect in the background — don't block svc startup on Redis reachability.\n ensureConnected();\n\n logger.info('[RedisStreamsEventTarget] ready', { prefix });\n return target;\n}\n","/**\n * GraphQL Utilities Module\n *\n * Provides GraphQL-related utilities for Burdenoff products.\n *\n * @module graphql\n */\n\n// NATS event target was removed on 2026-05-16. Use\n// `createRedisStreamsEventTarget` from `./redis-streams-event-target.js`\n// for distributed GraphQL Yoga subscriptions.\n\nexport { createRedisStreamsEventTarget } from './redis-streams-event-target.js';\nexport { computePubSubBackoffMs } from './redis-streams-event-target.js';\nexport type {\n RedisStreamsBlockingClient,\n RedisStreamsEventTarget,\n RedisStreamsEventTargetConnection,\n RedisStreamsEventTargetOptions,\n RedisStreamsEventTargetStatus,\n RedisStreamsRetryOptions,\n} from './redis-streams-event-target.js';\nexport { getPubSubHealth, registerPubSubHealthSource } from './pubsub-health.js';\nexport type { PubSubHealth, PubSubHealthSource } from './pubsub-health.js';\n\n// Injectable services for GraphQL Modules\nexport { Logger, createDatabaseService } from './services/index.js';\nexport type { DatabaseService, PrismaTransactionClient } from './services/index.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAa,+BAA+B;AAC5C,MAAa,8BAA8B;AAC3C,MAAM,mCAAmC;AACzC,MAAM,mBAAmB;;;;;;;AAQzB,SAAgB,uBACd,SACA,cACA,QAAgB,6BAChB,SAAuB,KAAK,QACpB;CACR,OAAO,i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UAAU,KAAK,QAAQ,KAAK,WAAW,OAAO;IACvF,SAAS,KAAK;KACZ,sBAAsB;KACtB,OAAO,MAAM,6CAA6C;MAAE,MAAM,MAAM;MAAM,OAAO,aAAa,GAAG;KAAE,CAAC;KACxG,gBAAgB;IAClB;GACF,EAAC,CAAE;GACH,OAAO;EACT;EACA,MAAM,QAAuB;GAC3B,IAAI,QAAQ;GACZ,SAAS;GACT,cAAc,WAAW;GACzB,WAAW;GACX,cAAc;GACd,KAAK,MAAM,QAAQ,MAAM,KAAK,QAAQ,KAAK,CAAC,GAAG,WAAW,IAAI;GAC9D,UAAU,MAAM;GAChB,MAAM,KAAK,WAAW;EACxB;EACA,YAAqB;GACnB,OAAO,CAAC,WAAW;EACrB;EACA,YAA2C;GACzC,OAAO;IACL;IACA,WAAW,KAAK,YAAY;IAC5B,UAAU,WAAW;IACrB;IACA,SAAS,QAAQ;IACjB,iBAAiB,oBAAoB;IACrC;GACF;EACF;CACF;CAEA,MAAM,aAAa,2BAA2B;EAC5C,iBAAiB,OAAO,UAAU;EAClC,gBAAgB;GACd,MAAM,IAAI,OAAO,UAAU;GAC3B,OAAO,GAAG,OAAO,cAAc,OAAO,EAAE,SAAS,EAAE,mBAAmB,OAAO,EAAE,eAAe;EAChG;CACF,CAAC;CAID,MAAM,cAAc,kBAAkB;EACpC,IAAI,KAAK,YAAY,GAAG;GAGtB,cAAc;GACd,KAAK,MAAM,KAAK,QAAQ,OAAO,GAAG,IAAI,EAAE,UAAU,EAAE,OAAO;EAC7D,OACE,gBAAgB;EAElB,gBAAgB;CAClB,GAAG,qBAAqB;CACxB,YAAY,QAAQ;CAGpB,gBAAgB;CAEhB,OAAO,KAAK,mCAAmC,EAAE,OAAO,CAAC;CACzD,OAAO;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { h as SDKError, m as SDKContext } from "./index-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-DPkc5IMZ.js";
|
|
2
|
+
import { h as SDKError, m as SDKContext } from "./index-CDdrBQom.js";
|
|
3
3
|
import { S as GatewayClient } from "./index-XkPephwV.js";
|
|
4
4
|
interface BillingUsageOperationInput {
|
|
5
5
|
quotaName: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { m as SDKContext } from "./index-
|
|
3
|
-
import { i as GraphQLContext } from "./types-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-DPkc5IMZ.js";
|
|
2
|
+
import { m as SDKContext } from "./index-CDdrBQom.js";
|
|
3
|
+
import { i as GraphQLContext } from "./types-BxZmaW3v.js";
|
|
4
4
|
interface CookieOptions {
|
|
5
5
|
name: string;
|
|
6
6
|
value: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as SDKContext } from "./index-
|
|
2
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
1
|
+
import { m as SDKContext } from "./index-CDdrBQom.js";
|
|
2
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-DPkc5IMZ.js";
|
|
3
3
|
import { n as PrismaClientBase } from "./client-NknQrWsP.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Zt as EntityEventRbacMetadata, en as GraphEventEmitterImpl } from "./index-ChJqXbVL.js";
|
|
5
5
|
import { _ as SearchResponse, a as EdgeDocument, c as EntityVertex, d as ModuleGraphConfig, f as ProductFacet, g as SearchFilters, h as SearchFacets, i as addGraphExtension, l as GraphEvent, m as RelationshipGraphConfig, n as GraphEventEmitter, o as EntityBulkOperationsConfig, p as RegistryEntityRbacConfig, r as GraphMiddlewareConfig, s as EntityGraphConfig, t as EntityEventType, u as GraphEventType, v as SearchResult, y as TypeFacet } from "./prisma-extension-Cfl09swM.js";
|
|
6
6
|
interface ResolvedEntityGraphConfig extends Omit<EntityGraphConfig, 'fields'> {
|
|
7
7
|
fields: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { m as SDKContext } from "./index-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-DPkc5IMZ.js";
|
|
2
|
+
import { m as SDKContext } from "./index-CDdrBQom.js";
|
|
3
3
|
declare namespace tenant_notifications_d_exports {
|
|
4
4
|
export { BatchNotificationInput, Notification$1 as Notification, NotificationChannel$1 as NotificationChannel, NotificationPriority, NotificationStats, NotificationTemplate, NotificationType$1 as NotificationType, RecipientInput$1 as RecipientInput, SendNotificationInput, SendWithTemplateInput, TenantNotificationsModule };
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as ServiceLayer } from "./layer-C0zxAUgR.js";
|
|
2
2
|
import { n as ShutdownDisposable } from "./index-Dt1HJPTX.js";
|
|
3
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
4
|
-
import { m as SDKContext } from "./index-
|
|
3
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-DPkc5IMZ.js";
|
|
4
|
+
import { m as SDKContext } from "./index-CDdrBQom.js";
|
|
5
5
|
interface EventMessage$1<T = unknown> {
|
|
6
6
|
id: string;
|
|
7
7
|
subject: string;
|
|
@@ -701,9 +701,13 @@ declare const GRAPH_EVENTS_URL_ENV_KEYS: readonly ["GRAPH_REDIS_URL", "REDIS_STR
|
|
|
701
701
|
type EnvSource = Readonly<Record<string, string | undefined>>;
|
|
702
702
|
declare function resolveEventStreamsUrl(env?: EnvSource): string | undefined;
|
|
703
703
|
declare function resolveEventStreamsUrlSource(env?: EnvSource): string | undefined;
|
|
704
|
+
declare function resolveEventStreamsPassword(env?: EnvSource): string | undefined;
|
|
704
705
|
declare function resolveGraphEventsUrl(env?: EnvSource): string | undefined;
|
|
705
706
|
declare function resolveGraphEventsUrlSource(env?: EnvSource): string | undefined;
|
|
707
|
+
declare function resolveGraphEventsPassword(env?: EnvSource): string | undefined;
|
|
708
|
+
declare function resolveEventStreamsKeyScope(env?: EnvSource): string | undefined;
|
|
706
709
|
declare function eventKeyScopeForUrl(url: string | undefined): string;
|
|
710
|
+
declare function resolveEventStreamsEffectiveKeyScope(env?: EnvSource): string;
|
|
707
711
|
type TaxonomyEventKind = 'fact' | 'command' | 'graph';
|
|
708
712
|
type TaxonomyEventLayer = 'wspace' | 'global';
|
|
709
713
|
type TaxonomyEventStatus = 'published' | 'planned';
|
|
@@ -1065,6 +1069,6 @@ declare function parseWorkspaceMemberRemoved(data: unknown): WorkspaceMemberRemo
|
|
|
1065
1069
|
declare function parseOrganizationDeleted(data: unknown): OrganizationDeletedFact | null;
|
|
1066
1070
|
declare function createLifecycleConsumer(options: LifecycleConsumerOptions): LifecycleConsumer;
|
|
1067
1071
|
declare namespace index_d_exports {
|
|
1068
|
-
export { AcknowledgeableEvent, BaseQueueConfig, BulkEventPayload, ConsumerConfig, ConsumerHealth, ConsumerHealthSource, ConsumerOptions, DEFAULT_START_ATTEMPT_TIMEOUT_MS, DEFAULT_START_RETRY_BASE_MS, DEFAULT_START_RETRY_MAX_MS, DEFAULT_START_TEARDOWN_TIMEOUT_MS, DefinedEventTaxonomy, EVENT_STREAMS_URL_ENV_KEYS, EVENT_TAXONOMY_BRAND, EntityEventRbacMetadata, EntityEventType, EventHandler, EventMessage$1 as EventMessage, EventMetadata, EventPriority, EventQueueFactory, EventQueueHealthCheckResult, EventSpec, EventTaxonomy, EventsManager, EventsManagerHandler, EventsManagerMessage, EventsManagerOptions, EventsManagerSingleton, EventsManagerStreamRoute, EventsManagerSubscribeOptions, EventsModule, GRAPH_EVENTS_URL_ENV_KEYS, GraphEntityEventPayload, GraphEventEmitter, GraphEventEmitterImpl, EventMessage as GraphQLEventMessage, EventQueueHealthCheckResult as HealthCheckResult, IEventConsumer, IEventPublisher, IEventQueue, ISubscription, LIFECYCLE_SUBJECTS, LifecycleConsumer, LifecycleConsumerOptions, LifecycleEventContext, LifecycleEventSource, LifecycleHandlers, MemoryEventBus, MemoryEventConsumer, MemoryEventPublisher, MemoryEventQueue, ModuleEventPayload, ModuleEventsConfig, ModuleEventsService, OrganizationDeletedFact, OrganizationDeletedPayload, PLATFORM_EVENT_TAXONOMY, PublishEventOptions, PublishOptions, PublishResult, PublishableEventName, PublisherConfig, QueueStatistics, QueueType, REFERENCE_PRODUCT_EVENT_TAXONOMY, RedisStreamsConnection, RedisStreamsEventConsumer, RedisStreamsEventPublisher, StartRetryOptions, StreamConfig, StreamInfo, SubscribeOptions, SubscriptionChangedPayload, SubscriptionOptions, SupervisedConsumer, SupervisedConsumerOptions, SupervisedStart, SupervisedStartOptions, SupervisedStartState, SupervisedStartStatus, TaxonomyEventKind, TaxonomyEventLayer, TaxonomyEventPii, TaxonomyEventStatus, TaxonomyPayload, TaxonomyPublishMetadata, UserDeletedPayload, VibecontrolsAgentConnectedPayload, VibecontrolsAgentDisconnectedPayload, VibecontrolsSessionEndedPayload, VibecontrolsSessionStartedPayload, WSPACE_GRAPH_EVENTS_STREAM, WorkflowRunCompletedPayload, WorkflowRunFailedPayload, WorkflowRunStartedPayload, WorkspaceCreatedPayload, WorkspaceDeletedFact, WorkspaceDeletedPayload, WorkspaceMemberAddedPayload, WorkspaceMemberRemovedFact, WorkspaceMemberRemovedPayload, WorkspaceMemberRoleUpdatedPayload, buildConsumerGroupName, computeBackoffMs, createConsumer, createEventsManagerSingleton, createGraphEventEmitter, createLifecycleConsumer, createMemoryConsumer, createGraphEventEmitter$1 as createMemoryGraphEventEmitter, createMemoryPublisher, createModuleEventsService, createPublisher, createSupervisedConsumer, defineEventTaxonomy, eventKeyScopeForUrl, eventSpec, getConsumerHealth, getGraphEventEmitter, isDefinedEventTaxonomy, mergeEventTaxonomies, parseOrganizationDeleted, parseWorkspaceDeletedGraph, parseWorkspaceDeletedStream, parseWorkspaceMemberRemoved, publishTaxonomyEvent, dlqKey as redisDlqKey, streamKey as redisStreamKey, registerConsumerHealthSource, resetGraphEventEmitter, resolveEventStreamsUrl, resolveEventStreamsUrlSource, resolveGraphEventsUrl, resolveGraphEventsUrlSource, superviseStart, taxonomyEventNames, taxonomyNameViolation };
|
|
1072
|
+
export { AcknowledgeableEvent, BaseQueueConfig, BulkEventPayload, ConsumerConfig, ConsumerHealth, ConsumerHealthSource, ConsumerOptions, DEFAULT_START_ATTEMPT_TIMEOUT_MS, DEFAULT_START_RETRY_BASE_MS, DEFAULT_START_RETRY_MAX_MS, DEFAULT_START_TEARDOWN_TIMEOUT_MS, DefinedEventTaxonomy, EVENT_STREAMS_URL_ENV_KEYS, EVENT_TAXONOMY_BRAND, EntityEventRbacMetadata, EntityEventType, EventHandler, EventMessage$1 as EventMessage, EventMetadata, EventPriority, EventQueueFactory, EventQueueHealthCheckResult, EventSpec, EventTaxonomy, EventsManager, EventsManagerHandler, EventsManagerMessage, EventsManagerOptions, EventsManagerSingleton, EventsManagerStreamRoute, EventsManagerSubscribeOptions, EventsModule, GRAPH_EVENTS_URL_ENV_KEYS, GraphEntityEventPayload, GraphEventEmitter, GraphEventEmitterImpl, EventMessage as GraphQLEventMessage, EventQueueHealthCheckResult as HealthCheckResult, IEventConsumer, IEventPublisher, IEventQueue, ISubscription, LIFECYCLE_SUBJECTS, LifecycleConsumer, LifecycleConsumerOptions, LifecycleEventContext, LifecycleEventSource, LifecycleHandlers, MemoryEventBus, MemoryEventConsumer, MemoryEventPublisher, MemoryEventQueue, ModuleEventPayload, ModuleEventsConfig, ModuleEventsService, OrganizationDeletedFact, OrganizationDeletedPayload, PLATFORM_EVENT_TAXONOMY, PublishEventOptions, PublishOptions, PublishResult, PublishableEventName, PublisherConfig, QueueStatistics, QueueType, REFERENCE_PRODUCT_EVENT_TAXONOMY, RedisStreamsConnection, RedisStreamsEventConsumer, RedisStreamsEventPublisher, StartRetryOptions, StreamConfig, StreamInfo, SubscribeOptions, SubscriptionChangedPayload, SubscriptionOptions, SupervisedConsumer, SupervisedConsumerOptions, SupervisedStart, SupervisedStartOptions, SupervisedStartState, SupervisedStartStatus, TaxonomyEventKind, TaxonomyEventLayer, TaxonomyEventPii, TaxonomyEventStatus, TaxonomyPayload, TaxonomyPublishMetadata, UserDeletedPayload, VibecontrolsAgentConnectedPayload, VibecontrolsAgentDisconnectedPayload, VibecontrolsSessionEndedPayload, VibecontrolsSessionStartedPayload, WSPACE_GRAPH_EVENTS_STREAM, WorkflowRunCompletedPayload, WorkflowRunFailedPayload, WorkflowRunStartedPayload, WorkspaceCreatedPayload, WorkspaceDeletedFact, WorkspaceDeletedPayload, WorkspaceMemberAddedPayload, WorkspaceMemberRemovedFact, WorkspaceMemberRemovedPayload, WorkspaceMemberRoleUpdatedPayload, buildConsumerGroupName, computeBackoffMs, createConsumer, createEventsManagerSingleton, createGraphEventEmitter, createLifecycleConsumer, createMemoryConsumer, createGraphEventEmitter$1 as createMemoryGraphEventEmitter, createMemoryPublisher, createModuleEventsService, createPublisher, createSupervisedConsumer, defineEventTaxonomy, eventKeyScopeForUrl, eventSpec, getConsumerHealth, getGraphEventEmitter, isDefinedEventTaxonomy, mergeEventTaxonomies, parseOrganizationDeleted, parseWorkspaceDeletedGraph, parseWorkspaceDeletedStream, parseWorkspaceMemberRemoved, publishTaxonomyEvent, dlqKey as redisDlqKey, streamKey as redisStreamKey, registerConsumerHealthSource, resetGraphEventEmitter, resolveEventStreamsEffectiveKeyScope, resolveEventStreamsKeyScope, resolveEventStreamsPassword, resolveEventStreamsUrl, resolveEventStreamsUrlSource, resolveGraphEventsPassword, resolveGraphEventsUrl, resolveGraphEventsUrlSource, superviseStart, taxonomyEventNames, taxonomyNameViolation };
|
|
1069
1073
|
}
|
|
1070
|
-
export { TaxonomyEventKind as $,
|
|
1074
|
+
export { TaxonomyEventKind as $, GraphEventEmitter as $t, ConsumerHealth as A, EventHandler as An, resolveEventStreamsKeyScope as At, EventsManagerStreamRoute as B, EventPriority as Bt, DEFAULT_START_TEARDOWN_TIMEOUT_MS as C, ConsumerConfig as Cn, publishTaxonomyEvent as Ct, SupervisedStartState as D, QueueType as Dn, GRAPH_EVENTS_URL_ENV_KEYS as Dt, SupervisedStartOptions as E, QueueStatistics as En, EVENT_STREAMS_URL_ENV_KEYS as Et, EventsManager as F, resolveGraphEventsUrl as Ft, EventSpec as G, SubscribeOptions as Gt, createEventsManagerSingleton as H, PublishEventOptions as Ht, EventsManagerHandler as I, resolveGraphEventsUrlSource as It, OrganizationDeletedPayload as J, ModuleEventsConfig as Jt, EventTaxonomy as K, BulkEventPayload as Kt, EventsManagerMessage as L, createConsumer as Lt, getConsumerHealth as M, EventMetadata as Mn, resolveEventStreamsUrl as Mt, registerConsumerHealthSource as N, StreamConfig as Nn, resolveEventStreamsUrlSource as Nt, SupervisedStartStatus as O, AcknowledgeableEvent as On, eventKeyScopeForUrl as Ot, computeBackoffMs as P, SubscriptionOptions as Pn, resolveGraphEventsPassword as Pt, SubscriptionChangedPayload as Q, EntityEventType as Qt, EventsManagerOptions as R, createPublisher as Rt, DEFAULT_START_RETRY_MAX_MS as S, BaseQueueConfig as Sn, mergeEventTaxonomies as St, SupervisedStart as T, PublisherConfig as Tn, taxonomyNameViolation as Tt, DefinedEventTaxonomy as U, PublishResult as Ut, EventsManagerSubscribeOptions as V, EventsModule as Vt, EVENT_TAXONOMY_BRAND as W, StreamInfo as Wt, PublishableEventName as X, createModuleEventsService as Xt, PLATFORM_EVENT_TAXONOMY as Y, ModuleEventsService as Yt, REFERENCE_PRODUCT_EVENT_TAXONOMY as Z, EntityEventRbacMetadata as Zt, SupervisedConsumer as _, IEventConsumer as _n, WorkspaceMemberRemovedPayload as _t, LifecycleEventContext as a, MemoryEventConsumer as an, UserDeletedPayload as at, DEFAULT_START_ATTEMPT_TIMEOUT_MS as b, PublishOptions as bn, eventSpec as bt, OrganizationDeletedFact as c, createGraphEventEmitter$1 as cn, VibecontrolsSessionEndedPayload as ct, buildConsumerGroupName as d, dlqKey as dn, WorkflowRunCompletedPayload as dt, GraphEventEmitterImpl as en, TaxonomyEventLayer as et, createLifecycleConsumer as f, streamKey as fn, WorkflowRunFailedPayload as ft, parseWorkspaceMemberRemoved as g, EventQueueFactory as gn, WorkspaceMemberAddedPayload as gt, parseWorkspaceDeletedStream as h, RedisStreamsConnection as hn, WorkspaceDeletedPayload as ht, LifecycleConsumerOptions as i, MemoryEventBus as in, TaxonomyPublishMetadata as it, ConsumerHealthSource as j, EventMessage$1 as jn, resolveEventStreamsPassword as jt, superviseStart as k, ConsumerOptions as kn, resolveEventStreamsEffectiveKeyScope as kt, WorkspaceDeletedFact as l, createMemoryConsumer as ln, VibecontrolsSessionStartedPayload as lt, parseWorkspaceDeletedGraph as m, RedisStreamsEventPublisher as mn, WorkspaceCreatedPayload as mt, LIFECYCLE_SUBJECTS as n, getGraphEventEmitter as nn, TaxonomyEventStatus as nt, LifecycleEventSource as o, MemoryEventPublisher as on, VibecontrolsAgentConnectedPayload as ot, parseOrganizationDeleted as p, RedisStreamsEventConsumer as pn, WorkflowRunStartedPayload as pt, GraphEntityEventPayload as q, ModuleEventPayload as qt, LifecycleConsumer as r, resetGraphEventEmitter as rn, TaxonomyPayload as rt, LifecycleHandlers as s, MemoryEventQueue as sn, VibecontrolsAgentDisconnectedPayload as st, index_d_exports as t, createGraphEventEmitter as tn, TaxonomyEventPii as tt, WorkspaceMemberRemovedFact as u, createMemoryPublisher as un, WSPACE_GRAPH_EVENTS_STREAM as ut, SupervisedConsumerOptions as v, ISubscription as vn, WorkspaceMemberRoleUpdatedPayload as vt, StartRetryOptions as w, EventQueueHealthCheckResult as wn, taxonomyEventNames as wt, DEFAULT_START_RETRY_BASE_MS as x, IEventQueue as xn, isDefinedEventTaxonomy as xt, createSupervisedConsumer as y, IEventPublisher as yn, defineEventTaxonomy as yt, EventsManagerSingleton as z, EventMessage as zt };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as PrismaClientConfig, _ as installAcquireRetry, a as PrismaEvent, b as ConnectionState, c as PrismaLogLevel, d as configurePrismaLogging, f as createConnectionPool, g as fingerprintSqlQuery, h as ensureServiceApplicationName, i as PrismaClientWrapper, l as PrismaQueryEvent, m as createPrismaClient, n as PrismaClientBase, o as PrismaLogDefinition, p as createPrismaAdapter, r as PrismaClientConstructorOptions, s as PrismaLogEvent, t as DatabaseReturnType, u as PrismaTransactionOptions, v as isTransientAcquireError, x as DatabaseHealth, y as normalizeSqlTemplate } from "./client-NknQrWsP.js";
|
|
2
2
|
import { n as GraphEventEmitter } from "./prisma-extension-Cfl09swM.js";
|
|
3
|
-
import { A as withSystemScopeSync, C as requireWorkspaceContext, D as runOperationWithRlsGuc, E as runOperationInCallerTransaction, M as withWorkspaceContextSync, O as setWorkspaceContext, S as maybeTagConnection, T as resetWorkspaceContextStateForTests, _ as getWorkspaceContextFallbackMode, a as WORKSPACE_CONTEXT_WARN_MODE_REMOVAL_DATE, b as isSystemScope, c as WorkspaceExtensionConfig, d as configureWorkspaceContextFallback, f as defaultWorkspaceExtensionConfig, g as getWorkspaceContext, h as getScopedWorkspaceContext, i as TransactionContextStatement, j as withWorkspaceContext, k as withSystemScope, l as addWorkspaceExtension, m as getCallerTransaction, n as PrismaQueryInternalParams, o as WorkspaceContext, p as explicitWorkspaceIdFromArgs, r as RawPrismaForCallerTransaction, s as WorkspaceContextFallbackMode, t as CallerTransaction, u as buildTransactionContextStatement, v as injectCreateFields, w as resetCallerTransactionStateForTests, x as maybeSetRlsGuc, y as injectWhereWorkspaceId } from "./workspace-extension-
|
|
3
|
+
import { A as withSystemScopeSync, C as requireWorkspaceContext, D as runOperationWithRlsGuc, E as runOperationInCallerTransaction, M as withWorkspaceContextSync, O as setWorkspaceContext, S as maybeTagConnection, T as resetWorkspaceContextStateForTests, _ as getWorkspaceContextFallbackMode, a as WORKSPACE_CONTEXT_WARN_MODE_REMOVAL_DATE, b as isSystemScope, c as WorkspaceExtensionConfig, d as configureWorkspaceContextFallback, f as defaultWorkspaceExtensionConfig, g as getWorkspaceContext, h as getScopedWorkspaceContext, i as TransactionContextStatement, j as withWorkspaceContext, k as withSystemScope, l as addWorkspaceExtension, m as getCallerTransaction, n as PrismaQueryInternalParams, o as WorkspaceContext, p as explicitWorkspaceIdFromArgs, r as RawPrismaForCallerTransaction, s as WorkspaceContextFallbackMode, t as CallerTransaction, u as buildTransactionContextStatement, v as injectCreateFields, w as resetCallerTransactionStateForTests, x as maybeSetRlsGuc, y as injectWhereWorkspaceId } from "./workspace-extension-DAs06Hv_.js";
|
|
4
4
|
interface DatabaseClientConfig extends PrismaClientConfig {
|
|
5
5
|
productName: string;
|
|
6
6
|
enableGraphExtension?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as YogaPlugin } from "./types-
|
|
2
|
-
import "./index-
|
|
1
|
+
import { E as YogaPlugin } from "./types-BxZmaW3v.js";
|
|
2
|
+
import "./index-Dl32yXnZ.js";
|
|
3
3
|
type FlagType = 'BOOLEAN' | 'STRING' | 'NUMBER' | 'JSON';
|
|
4
4
|
interface EvaluationContext {
|
|
5
5
|
actorId?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { m as SDKContext } from "./index-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-DPkc5IMZ.js";
|
|
2
|
+
import { m as SDKContext } from "./index-CDdrBQom.js";
|
|
3
3
|
import { ActivitySeverity, ActivityType } from "./activity/index.js";
|
|
4
|
-
import { p as UsageMetricType } from "./index
|
|
5
|
-
import { a as NotificationType } from "./index-
|
|
4
|
+
import { p as UsageMetricType } from "./index--w3AsbqC.js";
|
|
5
|
+
import { a as NotificationType } from "./index-C4MFjzOT.js";
|
|
6
6
|
import { o as AssistantSessionAttribution } from "./assistant-session-DA5ZKJOr.js";
|
|
7
7
|
interface TrackingEvent {
|
|
8
8
|
eventType: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as VerifiedDelegationContext, E as YogaPlugin, S as ServerInstance, _ as RESTEndpoint, a as IActor, d as ITenant, i as GraphQLContext, m as JWTPayload, w as WorkspaceSecret, y as ServerDefinition } from "./types-
|
|
1
|
+
import { C as VerifiedDelegationContext, E as YogaPlugin, S as ServerInstance, _ as RESTEndpoint, a as IActor, d as ITenant, i as GraphQLContext, m as JWTPayload, w as WorkspaceSecret, y as ServerDefinition } from "./types-BxZmaW3v.js";
|
|
2
2
|
import { E as I18n } from "./index-CPQDMSFS.js";
|
|
3
3
|
import { VerifyOptions } from "jsonwebtoken";
|
|
4
4
|
import { DocumentNode, GraphQLError } from "graphql";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { m as SDKContext } from "./index-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-DPkc5IMZ.js";
|
|
2
|
+
import { m as SDKContext } from "./index-CDdrBQom.js";
|
|
3
3
|
import { m as ServiceLayer } from "./layer-C0zxAUgR.js";
|
|
4
4
|
import { DocumentNode, FieldNode, GraphQLSchema, OperationDefinitionNode } from "graphql";
|
|
5
5
|
type MaybePromise<T> = Promise<T> | T;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as SDKContext } from "./index-
|
|
1
|
+
import { m as SDKContext } from "./index-CDdrBQom.js";
|
|
2
2
|
declare namespace index_d_exports {
|
|
3
3
|
export { LogLevel, LogMeta, Logger, LoggerConfig, LoggerTransport, debug, error, log, logger, redactSensitiveFields, redactSensitiveString, warn };
|
|
4
4
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { a as DEFAULT_LAYER_RESOURCES, c as GatewayRetryConfig, d as LayerFullConfig, f as LayerGatewayConfig, i as DEFAULT_GATEWAY_ROUTING, l as GatewayRoutingConfig, m as ServiceLayer, n as DEFAULT_CIRCUIT_BREAKER_CONFIG, o as DEFAULT_LAYER_STREAMS, p as LayerResourceUrls, r as DEFAULT_GATEWAY_RETRY_CONFIG, s as GatewayRequestHeaders, t as CircuitBreakerConfig, u as LayerConfig } from "./layer-C0zxAUgR.js";
|
|
2
|
-
import { _ as SDKShutdownOptions, a as EventQueueHealthStatus, c as LoggerTransport, g as SDKHealthStatus, m as SDKContext, o as EventQueueSDKConfig, p as SDKConfig, s as LoggerConfig, v as TemporalHealthStatus } from "./index-
|
|
3
|
-
import { c as index_d_exports$17, r as Logger } from "./index-
|
|
2
|
+
import { _ as SDKShutdownOptions, a as EventQueueHealthStatus, c as LoggerTransport, g as SDKHealthStatus, m as SDKContext, o as EventQueueSDKConfig, p as SDKConfig, s as LoggerConfig, v as TemporalHealthStatus } from "./index-CDdrBQom.js";
|
|
3
|
+
import { c as index_d_exports$17, r as Logger } from "./index-PvHsCusi.js";
|
|
4
4
|
import { ContextManager } from "./context/index.js";
|
|
5
|
-
import { t as AuthModule } from "./index-
|
|
6
|
-
import { _ as TenantNotificationsModule, o as NotificationsModule, v as tenant_notifications_d_exports } from "./index-
|
|
7
|
-
import { _ as createRBACDirective, m as RBACDirectiveConfig, o as RBACModule, u as LayerAwareRBACConfig, v as createRBACDirectiveForLayer, y as createRBACDirectiveFromEnv } from "./index-
|
|
5
|
+
import { t as AuthModule } from "./index-12QwfPvR.js";
|
|
6
|
+
import { _ as TenantNotificationsModule, o as NotificationsModule, v as tenant_notifications_d_exports } from "./index-C4MFjzOT.js";
|
|
7
|
+
import { _ as createRBACDirective, m as RBACDirectiveConfig, o as RBACModule, u as LayerAwareRBACConfig, v as createRBACDirectiveForLayer, y as createRBACDirectiveFromEnv } from "./index-Ds_V1Crj.js";
|
|
8
8
|
import { Activity, ActivityActorType, ActivityModule, ActivityOperationUnsupportedError, GetActivitiesOptions, LogActivityOptions } from "./activity/index.js";
|
|
9
|
-
import { C as OrgBillingUsageOperationInput, S as BillingUsageOperationInput, T as WorkspaceBillingUsageOperationInput, b as BillingUsageClient, m as UsageModule, w as QuotaLimit, x as BillingUsageClientConfig } from "./index
|
|
10
|
-
import { r as TrackerModule } from "./index-
|
|
9
|
+
import { C as OrgBillingUsageOperationInput, S as BillingUsageOperationInput, T as WorkspaceBillingUsageOperationInput, b as BillingUsageClient, m as UsageModule, w as QuotaLimit, x as BillingUsageClientConfig } from "./index--w3AsbqC.js";
|
|
10
|
+
import { r as TrackerModule } from "./index-DMKCyeBm.js";
|
|
11
11
|
import { DatabaseModule } from "./database/index.js";
|
|
12
|
-
import {
|
|
13
|
-
import { i as GraphModule, u as index_d_exports$10 } from "./index-
|
|
12
|
+
import { Vt as EventsModule, t as index_d_exports$5, yn as IEventPublisher } from "./index-ChJqXbVL.js";
|
|
13
|
+
import { i as GraphModule, u as index_d_exports$10 } from "./index-B30y7Yry.js";
|
|
14
14
|
import { SearchModule } from "./search/index.js";
|
|
15
15
|
import { ExportProductTranslationsOptions, ProductTranslationTree, ProductTranslationsExportResult, TranslationExportFormat, TranslationModule, UpsertProductTranslationsOptions, UpsertProductTranslationsResult } from "./translation/index.js";
|
|
16
16
|
import { PaymentsModule } from "./payments/index.js";
|
|
17
17
|
import { BootstrapModule, createBootstrap } from "./bootstrap/index.js";
|
|
18
18
|
import { a as TemporalWorkerManager, c as TemporalClientFactory, i as TemporalWorkerFactory, l as WorkflowStartOptions, n as TemporalWorker, o as TemporalClient, r as TemporalWorkerConfig, s as TemporalClientConfig, t as TemporalModule } from "./index-DSynXDRD.js";
|
|
19
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
19
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-DPkc5IMZ.js";
|
|
20
20
|
import { createInternalClient, createInternalClientForTenant, createInternalClientForWorkspaces } from "./client/internal-client.js";
|
|
21
21
|
import { a as registerDisposable, i as getRegisteredDisposableCount, n as ShutdownDisposable, o as unregisterDisposable, r as disposeAll, t as index_d_exports$16 } from "./index-Dt1HJPTX.js";
|
|
22
22
|
import { BillingPlanTransport, PlanTier, RESOURCE_CAP_DEFAULTS, ResourceCap, ResourceCapDefaults, ResourceCapExceededError, ResourceCapsConfig, ResourceCapsModule, ResourceName, WorkspaceResourceCapScope, configureResourceCaps, getResourceCaps } from "./resource-caps/index.js";
|
|
@@ -28,22 +28,22 @@ import { o as index_d_exports$1 } from "./index-SvWwlTUC.js";
|
|
|
28
28
|
import { t as index_d_exports$18 } from "./index-BMIMnp6T.js";
|
|
29
29
|
import { t as index_d_exports$19 } from "./index-C5uEKchX.js";
|
|
30
30
|
import { t as index_d_exports$11 } from "./index-D56fE7tl.js";
|
|
31
|
-
import { t as index_d_exports$21 } from "./index-
|
|
31
|
+
import { t as index_d_exports$21 } from "./index-Cx77z1cc.js";
|
|
32
32
|
import { s as index_d_exports$25 } from "./index-BrRQe24P.js";
|
|
33
33
|
import { C as getLocale, S as getLanguage, T as t, b as Translator, r as index_d_exports$12, w as hasI18n, x as createTranslator, y as I18nCapableContext } from "./index-CPQDMSFS.js";
|
|
34
34
|
import { t as index_d_exports$6 } from "./index-Bwn5Z1h-.js";
|
|
35
35
|
import { n as index_d_exports$13 } from "./index-Cwu5Mpji.js";
|
|
36
36
|
import { p as index_d_exports$4 } from "./index-DGgh9DWn.js";
|
|
37
|
-
import { a as index_d_exports$14 } from "./index-
|
|
37
|
+
import { a as index_d_exports$14 } from "./index-DMq2xPV7.js";
|
|
38
38
|
import { a as index_d_exports$15 } from "./index-Base-sg5.js";
|
|
39
39
|
import { t as index_d_exports$3 } from "./index-BVOL7458.js";
|
|
40
40
|
import { t as index_d_exports$9 } from "./index-XkPephwV.js";
|
|
41
|
-
import { t as index_d_exports$7 } from "./index-
|
|
41
|
+
import { t as index_d_exports$7 } from "./index-DM5zS9TT.js";
|
|
42
42
|
import { a as index_d_exports$2, c as verifyCaptchaIfEnabled, n as RecaptchaVerifyResult, o as isCaptchaEnabled, s as verifyCaptcha, t as RecaptchaVerifyOptions } from "./index-yBSjMY32.js";
|
|
43
43
|
import { t as index_d_exports$20 } from "./index-DY3dNhMN.js";
|
|
44
44
|
import { B as validateUserFields, C as RbacCoverageOptions, G as validateUsername, H as USERNAME_MIN_LENGTH, I as UserFieldError, J as NameErrorCode, K as NAME_MAX_LENGTH, L as UserFieldKey, M as assertRbacCoverage, R as UserFieldsValidationResult, S as RbacCoverageError, T as RbacCoverageSource, U as UsernameErrorCode, V as USERNAME_MAX_LENGTH, W as UsernameValidationResult, X as lengthInCodePoints, Y as NameValidationResult, Z as validateName, j as analyzeRbacCoverage, q as NAME_MIN_LENGTH, t as index_d_exports$26, w as RbacCoverageReport, z as ValidatedUserFields } from "./index-Bnz5Bqtl.js";
|
|
45
45
|
import { A as normalizeTemplateKey, C as isSameTemplateKey, D as normalizeProductSlug, E as normalizeGraphQLName, F as templateKeyVariants, I as toCurrentName, L as toLegacyName, M as quotaKeyVariants, N as rbacResourceVariants, O as normalizeQuotaKey, P as readRenamedEnv, S as isSameRbacResource, T as normalizeBillingId, _ as isSameBillingId, a as ProductRename, b as isSameProductSlug, c as billingIdVariants, d as emitProductSlug, f as emitQuotaKey, g as isLegacyName, h as index_d_exports$22, i as PRODUCT_SLUG_ALIASES, j as productSlugVariants, k as normalizeRbacResource, l as emitBillingId, m as emitTemplateKey, n as PRODUCT_RENAMES, o as RENAME_CONCERNS, p as emitRbacResource, r as PRODUCT_RENAME_EMIT, s as RenameConcern, t as EmitGeneration, u as emitName, v as isSameGraphQLName, w as nameVariants, x as isSameQuotaKey, y as isSameName } from "./index-BBqooJ52.js";
|
|
46
|
-
import { A as assertDsarOrchestrator, C as DSAR_REQUIRE_VERIFIED_SERVICE_TOKEN_ENV, D as DsarOrchestratorRejectionReason, E as DsarOrchestratorOptions, M as isDsarOrchestratorActor, N as resolveDsarCallerIdentity, O as ResolvedDsarCaller, S as DSAR_ALLOWED_ORCHESTRATORS_ENV, T as DsarOrchestratorForbiddenError, j as getAllowedDsarOrchestrators, k as VERIFIED_SERVICE_IDENTITY_HEADER, w as DsarOrchestratorContext, x as DEFAULT_DSAR_ORCHESTRATOR_ID } from "./index-
|
|
46
|
+
import { A as assertDsarOrchestrator, C as DSAR_REQUIRE_VERIFIED_SERVICE_TOKEN_ENV, D as DsarOrchestratorRejectionReason, E as DsarOrchestratorOptions, M as isDsarOrchestratorActor, N as resolveDsarCallerIdentity, O as ResolvedDsarCaller, S as DSAR_ALLOWED_ORCHESTRATORS_ENV, T as DsarOrchestratorForbiddenError, j as getAllowedDsarOrchestrators, k as VERIFIED_SERVICE_IDENTITY_HEADER, w as DsarOrchestratorContext, x as DEFAULT_DSAR_ORCHESTRATOR_ID } from "./index-Dl32yXnZ.js";
|
|
47
47
|
interface TenantBackendClientConfig {
|
|
48
48
|
tenantBackendUrl: string;
|
|
49
49
|
workspacesBackendUrl?: string;
|
package/dist/index.js
CHANGED
|
@@ -11,12 +11,12 @@ import { ActivityModule, ActivityOperationUnsupportedError } from "./activity/in
|
|
|
11
11
|
import { a as UsageModule, c as BillingUsageClient } from "./usage-BK7eyP42.js";
|
|
12
12
|
import { t as TrackerModule } from "./tracker-Cb58dqj9.js";
|
|
13
13
|
import { DatabaseModule } from "./database/index.js";
|
|
14
|
-
import { j as EventsModule, t as event_queue_exports } from "./event-queue-
|
|
14
|
+
import { j as EventsModule, t as event_queue_exports } from "./event-queue-CpVi7BET.js";
|
|
15
15
|
import { a as unregisterDisposable, i as registerDisposable, n as disposeAll, r as getRegisteredDisposableCount, t as lifecycle_exports } from "./lifecycle-DeoLSX0U.js";
|
|
16
|
-
import { n as graph_exports, t as GraphModule } from "./graph-
|
|
17
|
-
import { l as QueueType, t as EventQueueFactory } from "./EventQueueFactory-
|
|
16
|
+
import { n as graph_exports, t as GraphModule } from "./graph-hPqNRoKC.js";
|
|
17
|
+
import { l as QueueType, t as EventQueueFactory } from "./EventQueueFactory-0XHOTKEv.js";
|
|
18
18
|
import { SearchModule } from "./search/index.js";
|
|
19
|
-
import {
|
|
19
|
+
import { c as resolveEventStreamsUrl, o as resolveEventStreamsKeyScope, s as resolveEventStreamsPassword } from "./env-cCfoPZ7m.js";
|
|
20
20
|
import { TranslationModule } from "./translation/index.js";
|
|
21
21
|
import { PaymentsModule } from "./payments/index.js";
|
|
22
22
|
import { BootstrapModule, createBootstrap } from "./bootstrap/index.js";
|
|
@@ -30,12 +30,12 @@ import { a as TemporalClient, i as TemporalWorkerManager, n as TemporalWorker, o
|
|
|
30
30
|
import { t as cache_exports } from "./cache-CU0uLwcS.js";
|
|
31
31
|
import { t as middleware_exports } from "./middleware-Cq0zFMGp.js";
|
|
32
32
|
import { t as observability_exports } from "./observability-DBDXipTU.js";
|
|
33
|
-
import { t as graphql_exports } from "./graphql-
|
|
34
|
-
import { t as prisma_exports } from "./prisma-
|
|
33
|
+
import { t as graphql_exports } from "./graphql-Cn-OBnyu.js";
|
|
34
|
+
import { t as prisma_exports } from "./prisma-BlB0aalN.js";
|
|
35
35
|
import { v as utils_exports } from "./utils-DpW6K_iB.js";
|
|
36
36
|
import { a as getLanguage, c as t, i as createTranslator, o as getLocale, r as i18n_exports, s as hasI18n } from "./i18n-BBMYFd0P.js";
|
|
37
37
|
import { t as export_exports } from "./export-D3EySJjJ.js";
|
|
38
|
-
import { n as init_exports } from "./init-
|
|
38
|
+
import { n as init_exports } from "./init-CsfDrW9M.js";
|
|
39
39
|
import { s as dataloader_exports } from "./dataloader-DwpT3YoS.js";
|
|
40
40
|
import { r as instrumentation_exports } from "./instrumentation-DKHAGCoz.js";
|
|
41
41
|
import { a as layer_exports } from "./layer-CEKy6cm8.js";
|
|
@@ -590,15 +590,19 @@ var BurdenoffSDK = class {
|
|
|
590
590
|
*/
|
|
591
591
|
async initializeEventQueue() {
|
|
592
592
|
if (!this.eventQueueConfig || this.eventPublisher) return;
|
|
593
|
+
const usesEnvUrl = !this.eventQueueConfig.url;
|
|
593
594
|
const url = this.eventQueueConfig.url || resolveEventStreamsUrl();
|
|
594
595
|
if (!url) {
|
|
595
596
|
logger.warn("[SDK] No REDIS_STREAMS_URL / REDIS_URL available — event publisher disabled");
|
|
596
597
|
return;
|
|
597
598
|
}
|
|
599
|
+
const password = this.eventQueueConfig.password ?? (usesEnvUrl ? resolveEventStreamsPassword() : void 0);
|
|
600
|
+
const keyScope = this.eventQueueConfig.keyScope ?? (usesEnvUrl ? resolveEventStreamsKeyScope() : void 0);
|
|
598
601
|
const publisherConfig = {
|
|
599
602
|
type: "redis-streams",
|
|
600
603
|
url,
|
|
601
|
-
password:
|
|
604
|
+
...password !== void 0 ? { password } : {},
|
|
605
|
+
...keyScope !== void 0 ? { keyScope } : {},
|
|
602
606
|
name: this.eventQueueConfig.name || "burdenoff-sdk-publisher",
|
|
603
607
|
maxReconnectAttempts: this.eventQueueConfig.maxReconnectAttempts ?? -1,
|
|
604
608
|
reconnectTimeWait: this.eventQueueConfig.reconnectTimeWait ?? 2e3
|