@burdenoff/be-sdk 2026.820.1 → 2026.825.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
- export { getSDKState, initializeBurdenoffSDK, isSDKInitialized, resetSDK } from '../chunk-J4GHZLIY.js';
1
+ export { getSDKState, initializeBurdenoffSDK, isSDKInitialized, resetSDK } from '../chunk-BH5T72N3.js';
2
2
  import '../chunk-XWVP4MC6.js';
3
3
  import '../chunk-AWPNRV3L.js';
4
- import '../chunk-MVXXLAO5.js';
5
- import '../chunk-N4RXJ5QR.js';
4
+ import '../chunk-WMICUFAN.js';
5
+ import '../chunk-MJDXQJJZ.js';
6
+ import '../chunk-FZRODKIN.js';
6
7
  import '../chunk-7UJXIX4I.js';
7
8
  import '../chunk-VFCMR5GX.js';
8
9
  import '../chunk-RZOFS2BQ.js';
@@ -1,4 +1,4 @@
1
- export { A as ApolloInlineTraceOptions, C as CacheInstrumentationConfig, b as Counter, D as DEFAULT_CACHE_CONFIG, c as DEFAULT_DATABASE_CONFIG, d as DEFAULT_EVENT_QUEUE_CONFIG, e as DEFAULT_FEATURE_FLAGS, f as DEFAULT_GRAPHQL_CONFIG, g as DEFAULT_HTTP_CONFIG, h as DEFAULT_LOGGING_CONFIG, j as DEFAULT_METRICS_CONFIG, k as DEFAULT_TRACING_CONFIG, l as DatabaseInstrumentationConfig, E as ENV_VARS, m as EventQueueInstrumentationConfig, G as Gauge, n as GraphQLInstrumentationConfig, o as GraphQLOperationInfo, p as GraphQLOperationType, H as HTTPInstrumentationConfig, q as Histogram, r as InitializeInstrumentationOptions, t as Instrument, u as InstrumentationConfig, v as InstrumentationContextExtension, w as InstrumentationFeatureFlags, I as InstrumentationSetupResult, L as Log, x as LoggingConfig, M as Metric, y as MetricDefinition, z as MetricLabels, B as MetricsConfig, F as MetricsRegistry, O as OperationContext, P as PrometheusPluginOptions, J as STANDARD_METRICS, S as SetupInstrumentationOptions, K as Span, N as SpanAttributes, Q as SpanContext, R as SpanEvent, T as SpanKind, U as SpanStatus, V as Trace, W as TraceContext, X as Tracer, Y as TracingConfig, Z as UpDownCounter, _ as buildDatabaseConfig, $ as buildFeatureFlags, a0 as buildGraphQLConfig, a1 as buildInstrumentationConfig, a2 as buildMetricsConfig, a3 as buildTracingConfig, a4 as createApolloInlineTracePlugin, a5 as createCounter, a6 as createGauge, a7 as createGraphQLInstrumentationPlugin, a8 as createHistogram, a9 as createPrometheusPlugin, aa as createUpDownCounter, ab as extractOperationInfo, ac as extractTraceContext, ad as getGraphQLOperationFromContext, ae as getGraphQLSpanFromContext, af as getInstrumentationConfig, ag as getLogger, ah as getMetricsRegistry, ai as getTraceContext, aj as getTracer, i as initializeInstrumentation, ak as initializeInstrumentationConfig, al as initializeMetricsRegistry, am as initializeTracer, an as injectTraceContext, ao as instrumentResolver, ap as instrumentResolverMap, aq as instrumented, ar as isApolloInlineTraceAvailable, as as isFeatureEnabled, at as isInstrumentationConfigInitialized, au as isInstrumentationInitialized, av as isMetricsRegistryInitialized, aw as isPrometheusAvailable, ax as isTracerInitialized, ay as resetInstrumentation, az as resetInstrumentationConfig, aA as resetMetricsRegistry, s as setupInstrumentation, aB as startSpan, aC as traced, aD as updateInstrumentationConfig, aE as withSpan } from '../index-CXPvdXhS.js';
1
+ export { A as ApolloInlineTraceOptions, C as CacheInstrumentationConfig, b as Counter, D as DEFAULT_CACHE_CONFIG, c as DEFAULT_DATABASE_CONFIG, d as DEFAULT_EVENT_QUEUE_CONFIG, e as DEFAULT_FEATURE_FLAGS, f as DEFAULT_GRAPHQL_CONFIG, g as DEFAULT_HTTP_CONFIG, h as DEFAULT_LOGGING_CONFIG, j as DEFAULT_METRICS_CONFIG, k as DEFAULT_TRACING_CONFIG, l as DatabaseInstrumentationConfig, E as ENV_VARS, m as EventQueueInstrumentationConfig, G as Gauge, n as GraphQLInstrumentationConfig, o as GraphQLOperationInfo, p as GraphQLOperationType, H as HTTPInstrumentationConfig, q as Histogram, r as InitializeInstrumentationOptions, t as Instrument, u as InstrumentationConfig, v as InstrumentationContextExtension, w as InstrumentationFeatureFlags, I as InstrumentationSetupResult, L as Log, x as LoggingConfig, M as Metric, y as MetricDefinition, z as MetricLabels, B as MetricsConfig, F as MetricsRegistry, O as OperationContext, P as PrometheusPluginOptions, J as STANDARD_METRICS, S as SetupInstrumentationOptions, K as Span, N as SpanAttributes, Q as SpanContext, R as SpanEvent, T as SpanKind, U as SpanStatus, V as Trace, W as TraceContext, X as Tracer, Y as TracingConfig, Z as UpDownCounter, _ as buildDatabaseConfig, $ as buildFeatureFlags, a0 as buildGraphQLConfig, a1 as buildInstrumentationConfig, a2 as buildMetricsConfig, a3 as buildTracingConfig, a4 as createApolloInlineTracePlugin, a5 as createCounter, a6 as createGauge, a7 as createGraphQLInstrumentationPlugin, a8 as createHistogram, a9 as createPrometheusPlugin, aa as createUpDownCounter, ab as extractOperationInfo, ac as extractTraceContext, ad as getGraphQLOperationFromContext, ae as getGraphQLSpanFromContext, af as getInstrumentationConfig, ag as getLogger, ah as getMetricsRegistry, ai as getTraceContext, aj as getTracer, a as initializeInstrumentation, ak as initializeInstrumentationConfig, al as initializeMetricsRegistry, am as initializeTracer, an as injectTraceContext, ao as instrumentResolver, ap as instrumentResolverMap, aq as instrumented, ar as isApolloInlineTraceAvailable, as as isFeatureEnabled, at as isInstrumentationConfigInitialized, au as isInstrumentationInitialized, av as isMetricsRegistryInitialized, aw as isPrometheusAvailable, ax as isTracerInitialized, ay as resetInstrumentation, az as resetInstrumentationConfig, aA as resetMetricsRegistry, s as setupInstrumentation, aB as startSpan, aC as traced, aD as updateInstrumentationConfig, aE as withSpan } from '../index-BtpoFSLa.js';
2
2
  export { l as logger } from '../index-C0qWSC_Q.js';
3
3
  import '../index-B8viwwDM.js';
4
4
  import '../layer-GNAVXBMf.js';
@@ -1,5 +1,5 @@
1
- import { W as WorkspaceSecret, I as IActor, J as JWTPayload, S as ServerDefinition, a as ServerInstance, b as ITenant, G as GraphQLContext, Y as YogaPlugin } from '../types-Dg2F8FNa.js';
2
- export { C as ConsentContext, E as ElysiaApp, c as IContextFilterInput, d as IOperationContext, e as IOrganization, f as IProduct, g as IProject, h as ITracking, i as IWorkspace, M as ModuleGraphConfig, P as PrismaClientConstructor, R as RESTEndpoint, j as ServerConfig, k as ServerI18nConfig, l as ServerInfo, m as WspaceGraphQLContext } from '../types-Dg2F8FNa.js';
1
+ import { W as WorkspaceSecret, I as IActor, J as JWTPayload, S as ServerDefinition, a as ServerInstance, b as ITenant, G as GraphQLContext, Y as YogaPlugin } from '../types-BAHkj1GE.js';
2
+ export { C as ConsentContext, E as ElysiaApp, c as IContextFilterInput, d as IOperationContext, e as IOrganization, f as IProduct, g as IProject, h as ITracking, i as IWorkspace, M as ModuleGraphConfig, P as PrismaClientConstructor, R as RESTEndpoint, j as ServerConfig, k as ServerI18nConfig, l as ServerInfo, m as WspaceGraphQLContext } from '../types-BAHkj1GE.js';
3
3
  import * as jose from 'jose';
4
4
  import { VerifyOptions } from 'jsonwebtoken';
5
5
  import { I as I18n } from '../i18n-DrdPTann.js';
@@ -511,6 +511,141 @@ function createQuotaGaugeRefresher(opts) {
511
511
  }
512
512
  __name(createQuotaGaugeRefresher, "createQuotaGaugeRefresher");
513
513
 
514
+ // src/server/readiness.ts
515
+ var READINESS_CACHE_MS = 1e3;
516
+ var READINESS_PROBE_TIMEOUT_MS = 2e3;
517
+ var DEFAULT_REQUIRED = [
518
+ "postgres"
519
+ ];
520
+ async function withTimeout(work, ms, label) {
521
+ let timer;
522
+ try {
523
+ return await Promise.race([
524
+ work,
525
+ new Promise((_, reject) => {
526
+ timer = setTimeout(() => reject(new Error(`${label} check timed out after ${ms}ms`)), ms);
527
+ })
528
+ ]);
529
+ } finally {
530
+ if (timer) clearTimeout(timer);
531
+ }
532
+ }
533
+ __name(withTimeout, "withTimeout");
534
+ async function runCheck(name, required, work, now) {
535
+ const started = now();
536
+ try {
537
+ await withTimeout(Promise.resolve(work()), READINESS_PROBE_TIMEOUT_MS, name);
538
+ return {
539
+ ok: true,
540
+ required,
541
+ latencyMs: now() - started
542
+ };
543
+ } catch (err) {
544
+ return {
545
+ ok: false,
546
+ required,
547
+ error: err instanceof Error ? err.message : String(err),
548
+ latencyMs: now() - started
549
+ };
550
+ }
551
+ }
552
+ __name(runCheck, "runCheck");
553
+ function createReadinessProbe(deps, now = Date.now) {
554
+ const required = new Set(deps.requiredDependencies ?? DEFAULT_REQUIRED);
555
+ let cache = null;
556
+ let inFlight = null;
557
+ async function probe() {
558
+ const checks = {};
559
+ const jobs = [];
560
+ if (deps.prisma) {
561
+ jobs.push(runCheck("postgres", required.has("postgres"), async () => {
562
+ const client = deps.prisma?.();
563
+ if (!client) throw new Error("prisma client not initialised");
564
+ await client.$queryRaw`SELECT 1`;
565
+ }, now).then((r) => {
566
+ checks.postgres = r;
567
+ }));
568
+ }
569
+ if (deps.valkey) {
570
+ jobs.push(runCheck("valkey", required.has("valkey"), async () => {
571
+ const client = await deps.valkey?.();
572
+ if (!client) throw new Error("valkey client not initialised");
573
+ await client.ping();
574
+ }, now).then((r) => {
575
+ checks.valkey = r;
576
+ }));
577
+ }
578
+ if (deps.eventQueue) {
579
+ jobs.push(runCheck("eventQueue", required.has("eventQueue"), async () => {
580
+ const q = deps.eventQueue?.();
581
+ if (!q) throw new Error("event queue not initialised");
582
+ if (typeof q.isConnected === "function") {
583
+ const connected = await Promise.resolve(q.isConnected());
584
+ if (!connected) throw new Error("event queue reports disconnected");
585
+ return;
586
+ }
587
+ if (typeof q.healthCheck === "function") {
588
+ const res = await q.healthCheck();
589
+ if (!res.ok) throw new Error("event queue health check failed");
590
+ }
591
+ }, now).then((r) => {
592
+ checks.eventQueue = r;
593
+ }));
594
+ }
595
+ await Promise.all(jobs);
596
+ const results = Object.values(checks);
597
+ return {
598
+ ready: results.every((c) => c.ok || !c.required),
599
+ healthy: results.every((c) => c.ok),
600
+ checks
601
+ };
602
+ }
603
+ __name(probe, "probe");
604
+ return /* @__PURE__ */ __name(async function getReadiness() {
605
+ const at = now();
606
+ if (cache && at - cache.at < READINESS_CACHE_MS) return cache.snapshot;
607
+ if (inFlight) return inFlight;
608
+ inFlight = probe().then((snapshot) => {
609
+ cache = {
610
+ snapshot,
611
+ at: now()
612
+ };
613
+ return snapshot;
614
+ }).finally(() => {
615
+ inFlight = null;
616
+ });
617
+ return inFlight;
618
+ }, "getReadiness");
619
+ }
620
+ __name(createReadinessProbe, "createReadinessProbe");
621
+ function readinessStatusCode(snapshot) {
622
+ return snapshot.ready ? 200 : 503;
623
+ }
624
+ __name(readinessStatusCode, "readinessStatusCode");
625
+ function readinessBody(snapshot, service, version, timestamp, uptimeSeconds) {
626
+ const status = !snapshot.ready ? "unavailable" : snapshot.healthy ? "healthy" : "degraded";
627
+ return {
628
+ status,
629
+ service,
630
+ version,
631
+ timestamp,
632
+ checks: snapshot.checks,
633
+ ...uptimeSeconds === void 0 ? {} : {
634
+ uptimeSeconds
635
+ }
636
+ };
637
+ }
638
+ __name(readinessBody, "readinessBody");
639
+ function livenessBody(service, version, timestamp) {
640
+ return {
641
+ status: "healthy",
642
+ service,
643
+ version,
644
+ timestamp
645
+ };
646
+ }
647
+ __name(livenessBody, "livenessBody");
648
+
514
649
  // src/server/server.ts
515
650
  var serverStartTime = null;
516
651
  var quotaGaugeRefresher = createQuotaGaugeRefresher({
@@ -824,16 +959,33 @@ ${sdkBody}` : promBody;
824
959
  enableCSRF: config.enableCSRF ?? false,
825
960
  enableSessionSecurity: config.enableSessionSecurity ?? false
826
961
  }));
827
- const healthResponse = /* @__PURE__ */ __name(() => ({
828
- status: "healthy",
829
- service: config.serviceName,
830
- version: config.serviceVersion || "1.0.0",
831
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
832
- }), "healthResponse");
833
- app.get("/health", healthResponse);
834
- app.get("/health/live", healthResponse);
835
- app.get("/health/ready", healthResponse);
836
- app.get("/health/startup", healthResponse);
962
+ const serviceVersion = config.serviceVersion || "1.0.0";
963
+ const getReadiness = createReadinessProbe({
964
+ prisma: /* @__PURE__ */ __name(() => getDb2(), "prisma"),
965
+ valkey: /* @__PURE__ */ __name(async () => {
966
+ try {
967
+ const { getValkeyClient } = await import('../cache/index.js');
968
+ return await getValkeyClient();
969
+ } catch {
970
+ return void 0;
971
+ }
972
+ }, "valkey"),
973
+ ...config.health?.requiredDependencies ? {
974
+ requiredDependencies: config.health.requiredDependencies
975
+ } : {}
976
+ });
977
+ const shallow = /* @__PURE__ */ __name(() => livenessBody(config.serviceName, serviceVersion, (/* @__PURE__ */ new Date()).toISOString()), "shallow");
978
+ const deep = /* @__PURE__ */ __name(async (ctx) => {
979
+ const snapshot = await getReadiness();
980
+ const ctxWithSet = ctx;
981
+ const code = readinessStatusCode(snapshot);
982
+ if (ctxWithSet.set) ctxWithSet.set.status = code;
983
+ return readinessBody(snapshot, config.serviceName, serviceVersion, (/* @__PURE__ */ new Date()).toISOString(), Math.round(process.uptime()));
984
+ }, "deep");
985
+ app.get("/health", deep);
986
+ app.get("/health/live", shallow);
987
+ app.get("/health/ready", deep);
988
+ app.get("/health/startup", shallow);
837
989
  if (moduleGraph) {
838
990
  app.get("/api/graph/schema", async ({ request, set }) => {
839
991
  const context = await buildContext(request);