@burdenoff/be-sdk 2026.1130.1 → 2026.1130.3
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-BhNJE93c.js → EventQueueFactory-S_K9dVRM.js} +32 -3
- package/dist/EventQueueFactory-S_K9dVRM.js.map +1 -0
- package/dist/auth/index.d.ts +1 -1
- package/dist/{RedisStreamsConnection-CY8WySJy.js → backoff-BIk9Wy8O.js} +19 -2
- package/dist/backoff-BIk9Wy8O.js.map +1 -0
- package/dist/consumer-health-CaKEsnsv.js +33 -0
- package/dist/consumer-health-CaKEsnsv.js.map +1 -0
- package/dist/event-queue/index.d.ts +2 -2
- package/dist/event-queue/index.js +6 -5
- package/dist/{event-queue-CKvgAqF3.js → event-queue-C58O9KEG.js} +332 -15
- package/dist/event-queue-C58O9KEG.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-BdoM7_90.js → graph-LKv5fzet.js} +4 -4
- package/dist/{graph-BdoM7_90.js.map → graph-LKv5fzet.js.map} +1 -1
- package/dist/{graph-emitter-DpaWxRBp.js → graph-emitter-D_zQC0MZ.js} +2 -2
- package/dist/{graph-emitter-DpaWxRBp.js.map → graph-emitter-D_zQC0MZ.js.map} +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/{graphql-DzzWneMu.js → graphql-Gusog8jG.js} +3 -5
- package/dist/graphql-Gusog8jG.js.map +1 -0
- package/dist/{index-CjY5YV9F.d.ts → index-BMy-d2_f.d.ts} +1 -1
- package/dist/{index-CIgoeobA.d.ts → index-Bnz5Bqtl.d.ts} +14 -3
- package/dist/{index-BaB4Nsv7.d.ts → index-C4hRRihw.d.ts} +1 -1
- package/dist/{index-CGPNFIR3.d.ts → index-CeaJcbar.d.ts} +67 -2
- package/dist/{index-BFNCCa2W.d.ts → index-Cl3Xiw1O.d.ts} +2 -2
- package/dist/{index-DYKWUbL4.d.ts → index-GzZunmGS.d.ts} +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +7 -7
- package/dist/init/index.js +1 -1
- package/dist/{init-DaHOxzwF.js → init-2gMeersr.js} +2 -2
- package/dist/{init-DaHOxzwF.js.map → init-2gMeersr.js.map} +1 -1
- package/dist/{middleware-z8KzMFU_.js → middleware-Cd1Z4_DD.js} +2 -2
- package/dist/{middleware-z8KzMFU_.js.map → middleware-Cd1Z4_DD.js.map} +1 -1
- package/dist/prisma/index.js +2 -2
- package/dist/{prisma-CUij0pph.js → prisma-Bo-C0XUv.js} +3 -3
- package/dist/{prisma-CUij0pph.js.map → prisma-Bo-C0XUv.js.map} +1 -1
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +302 -10
- package/dist/server/index.js.map +1 -1
- package/dist/{types-2PuLMwAy.d.ts → types-C36JkwDg.d.ts} +85 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/dist/{validation-CPUITdMk.js → validation-bwJzOytZ.js} +66 -97
- package/dist/{validation-CPUITdMk.js.map → validation-bwJzOytZ.js.map} +1 -1
- package/package.json +1 -1
- package/dist/EventQueueFactory-BhNJE93c.js.map +0 -1
- package/dist/RedisStreamsConnection-CY8WySJy.js.map +0 -1
- package/dist/event-queue-CKvgAqF3.js.map +0 -1
- package/dist/graphql-DzzWneMu.js.map +0 -1
package/dist/server/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { l as getMetricsRegistry } from "../metrics-collector-DXQrMUle.js";
|
|
|
7
7
|
import { t as getWorkspaceQuotaRegistry } from "../metrics-CQaHT12m.js";
|
|
8
8
|
import { t as collectPromDefaultMetrics } from "../bun-runtime-metrics-CPy5D6NT.js";
|
|
9
9
|
import { t as getPubSubHealth } from "../pubsub-health-DCeAKI3q.js";
|
|
10
|
+
import { t as getConsumerHealth } from "../consumer-health-CaKEsnsv.js";
|
|
10
11
|
import { a as VERIFIED_SERVICE_IDENTITY_HEADER, c as isDsarOrchestratorActor, i as DsarOrchestratorForbiddenError, l as resolveDsarCallerIdentity, n as DSAR_ALLOWED_ORCHESTRATORS_ENV, o as assertDsarOrchestrator, r as DSAR_REQUIRE_VERIFIED_SERVICE_TOKEN_ENV, s as getAllowedDsarOrchestrators, t as DEFAULT_DSAR_ORCHESTRATOR_ID } from "../dsar-orchestrator-BlOSa9A_.js";
|
|
11
12
|
import { i as suppressMutationAudit, r as runInExplicitActivityScope, t as createExplicitActivityScope } from "../explicit-activity-scope-DikJ7NAE.js";
|
|
12
13
|
import { GraphQLError, Kind, OperationTypeNode } from "graphql";
|
|
@@ -1053,6 +1054,12 @@ function createReadinessProbe(deps, now = Date.now) {
|
|
|
1053
1054
|
}, now).then((r) => {
|
|
1054
1055
|
checks.pubsub = r;
|
|
1055
1056
|
}));
|
|
1057
|
+
const consumers = deps.consumers?.();
|
|
1058
|
+
if (consumers) jobs.push(runCheck("consumers", required.has("consumers"), async () => {
|
|
1059
|
+
if (!consumers.ok) throw new Error(`event consumer degraded (${consumers.unhealthy.join("; ")})`);
|
|
1060
|
+
}, now).then((r) => {
|
|
1061
|
+
checks.consumers = r;
|
|
1062
|
+
}));
|
|
1056
1063
|
await Promise.all(jobs);
|
|
1057
1064
|
const results = Object.values(checks);
|
|
1058
1065
|
return {
|
|
@@ -1101,6 +1108,275 @@ function livenessBody(service, version, timestamp) {
|
|
|
1101
1108
|
};
|
|
1102
1109
|
}
|
|
1103
1110
|
|
|
1111
|
+
// src/server/dependency-watchdog.ts
|
|
1112
|
+
/**
|
|
1113
|
+
* Dependency watchdog for the liveness probe (BOFF-17229, generalised into the
|
|
1114
|
+
* SDK by BOFF-17231; `createServer` wires it through `health.watchdog`).
|
|
1115
|
+
*
|
|
1116
|
+
* Readiness answers "can this pod serve right now?" and covers short
|
|
1117
|
+
* datastore blips by taking the pod out of the Service. It cannot help a
|
|
1118
|
+
* process that got stuck: on 2026-11-28 the alpha pod hit `EAI_AGAIN` at boot,
|
|
1119
|
+
* its readiness stayed 503 for hours, and because liveness always passed
|
|
1120
|
+
* Kubernetes never restarted it.
|
|
1121
|
+
*
|
|
1122
|
+
* The watchdog probes each critical dependency in the background and
|
|
1123
|
+
* remembers since when it has been unhealthy. Liveness fails only once a
|
|
1124
|
+
* dependency has been unhealthy for longer than a bounded window (5 minutes by
|
|
1125
|
+
* default, plus up to 1 minute of per-process jitter), so kubelet restarts a
|
|
1126
|
+
* stuck process while a short outage never restarts anything. The jitter keeps
|
|
1127
|
+
* a fleet that lost the same datastore together from restarting in lockstep.
|
|
1128
|
+
*
|
|
1129
|
+
* The liveness handler only reads in-memory state, so the probe stays cheap
|
|
1130
|
+
* and never waits on the datastore itself.
|
|
1131
|
+
*/
|
|
1132
|
+
const DEFAULT_DEPENDENCY_WATCHDOG_CONFIG = {
|
|
1133
|
+
enabled: true,
|
|
1134
|
+
unhealthyThresholdMs: 3e5,
|
|
1135
|
+
jitterMs: 6e4,
|
|
1136
|
+
intervalMs: 15e3,
|
|
1137
|
+
checkTimeoutMs: 5e3
|
|
1138
|
+
};
|
|
1139
|
+
/**
|
|
1140
|
+
* The shortest threshold the env may configure. A smaller value would let a
|
|
1141
|
+
* routine datastore failover restart the whole fleet.
|
|
1142
|
+
*/
|
|
1143
|
+
const MIN_UNHEALTHY_THRESHOLD_MS = 6e4;
|
|
1144
|
+
function readPositiveInt(raw, fallback) {
|
|
1145
|
+
if (raw === void 0 || raw.trim() === "") return fallback;
|
|
1146
|
+
const value = Number(raw);
|
|
1147
|
+
return Number.isInteger(value) && value > 0 ? value : fallback;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Read the watchdog settings from the environment:
|
|
1151
|
+
* `DEPENDENCY_WATCHDOG_ENABLED` (default true), `DEPENDENCY_WATCHDOG_THRESHOLD_MS`
|
|
1152
|
+
* (default 300000, minimum 60000), `DEPENDENCY_WATCHDOG_JITTER_MS` (default
|
|
1153
|
+
* 60000), `DEPENDENCY_WATCHDOG_INTERVAL_MS` (default 15000) and
|
|
1154
|
+
* `DEPENDENCY_WATCHDOG_CHECK_TIMEOUT_MS` (default 5000). Invalid values fall
|
|
1155
|
+
* back to the defaults. `base` replaces the built-in defaults (a service's
|
|
1156
|
+
* `health.watchdog` settings); the env still wins, so operators can tune or
|
|
1157
|
+
* disable the watchdog without a release.
|
|
1158
|
+
*/
|
|
1159
|
+
function resolveDependencyWatchdogConfig(env = process.env, base = {}) {
|
|
1160
|
+
const defaults = {
|
|
1161
|
+
...DEFAULT_DEPENDENCY_WATCHDOG_CONFIG,
|
|
1162
|
+
...base
|
|
1163
|
+
};
|
|
1164
|
+
return {
|
|
1165
|
+
enabled: defaults.enabled && (env["DEPENDENCY_WATCHDOG_ENABLED"] ?? "").trim().toLowerCase() !== "false",
|
|
1166
|
+
unhealthyThresholdMs: Math.max(MIN_UNHEALTHY_THRESHOLD_MS, readPositiveInt(env["DEPENDENCY_WATCHDOG_THRESHOLD_MS"], defaults.unhealthyThresholdMs)),
|
|
1167
|
+
jitterMs: readPositiveInt(env["DEPENDENCY_WATCHDOG_JITTER_MS"], defaults.jitterMs),
|
|
1168
|
+
intervalMs: readPositiveInt(env["DEPENDENCY_WATCHDOG_INTERVAL_MS"], defaults.intervalMs),
|
|
1169
|
+
checkTimeoutMs: readPositiveInt(env["DEPENDENCY_WATCHDOG_CHECK_TIMEOUT_MS"], defaults.checkTimeoutMs)
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
function errorMessage(error) {
|
|
1173
|
+
return error instanceof Error ? error.message : String(error);
|
|
1174
|
+
}
|
|
1175
|
+
var DependencyWatchdog = class {
|
|
1176
|
+
/** Effective threshold for this process: configured value plus jitter. */
|
|
1177
|
+
thresholdMs;
|
|
1178
|
+
config;
|
|
1179
|
+
probes;
|
|
1180
|
+
now;
|
|
1181
|
+
states = /* @__PURE__ */ new Map();
|
|
1182
|
+
timer;
|
|
1183
|
+
round = null;
|
|
1184
|
+
expiredLogged = false;
|
|
1185
|
+
constructor(options) {
|
|
1186
|
+
const { probes, now, random, ...overrides } = options;
|
|
1187
|
+
this.config = {
|
|
1188
|
+
...DEFAULT_DEPENDENCY_WATCHDOG_CONFIG,
|
|
1189
|
+
...overrides
|
|
1190
|
+
};
|
|
1191
|
+
this.probes = probes;
|
|
1192
|
+
this.now = now ?? Date.now;
|
|
1193
|
+
const jitter = Math.floor((random ?? Math.random)() * this.config.jitterMs);
|
|
1194
|
+
this.thresholdMs = this.config.unhealthyThresholdMs + jitter;
|
|
1195
|
+
const startedAt = this.now();
|
|
1196
|
+
for (const probe of probes) this.states.set(probe.name, {
|
|
1197
|
+
unhealthySince: startedAt,
|
|
1198
|
+
lastError: "not checked yet"
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
/** Start background probing (an immediate round, then every `intervalMs`). */
|
|
1202
|
+
start() {
|
|
1203
|
+
if (this.timer) return;
|
|
1204
|
+
this.checkNow();
|
|
1205
|
+
const timer = setInterval(() => {
|
|
1206
|
+
this.checkNow();
|
|
1207
|
+
}, this.config.intervalMs);
|
|
1208
|
+
timer.unref?.();
|
|
1209
|
+
this.timer = timer;
|
|
1210
|
+
}
|
|
1211
|
+
stop() {
|
|
1212
|
+
if (this.timer) {
|
|
1213
|
+
clearInterval(this.timer);
|
|
1214
|
+
this.timer = void 0;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
/** Run one probe round; concurrent callers share the round in flight. */
|
|
1218
|
+
checkNow() {
|
|
1219
|
+
if (!this.round) this.round = this.runRound().finally(() => {
|
|
1220
|
+
this.round = null;
|
|
1221
|
+
});
|
|
1222
|
+
return this.round;
|
|
1223
|
+
}
|
|
1224
|
+
/** Record a probe outcome observed elsewhere (for example by readiness). */
|
|
1225
|
+
record(name, healthy, error) {
|
|
1226
|
+
const state = this.states.get(name);
|
|
1227
|
+
if (!state) return;
|
|
1228
|
+
if (healthy) {
|
|
1229
|
+
if (state.unhealthySince !== null) logger.info("[DependencyWatchdog] Dependency recovered", {
|
|
1230
|
+
dependency: name,
|
|
1231
|
+
unhealthyForMs: this.now() - state.unhealthySince
|
|
1232
|
+
});
|
|
1233
|
+
state.unhealthySince = null;
|
|
1234
|
+
state.lastError = null;
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
state.unhealthySince ??= this.now();
|
|
1238
|
+
state.lastError = error === void 0 ? "reported unhealthy" : errorMessage(error);
|
|
1239
|
+
}
|
|
1240
|
+
/** Liveness verdict from in-memory state only; never touches a dependency. */
|
|
1241
|
+
liveness() {
|
|
1242
|
+
const now = this.now();
|
|
1243
|
+
const failing = [];
|
|
1244
|
+
for (const [name, state] of this.states) {
|
|
1245
|
+
if (state.unhealthySince === null) continue;
|
|
1246
|
+
const unhealthyForMs = now - state.unhealthySince;
|
|
1247
|
+
if (unhealthyForMs > this.thresholdMs) failing.push({
|
|
1248
|
+
name,
|
|
1249
|
+
unhealthyForMs
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
const alive = !this.config.enabled || failing.length === 0;
|
|
1253
|
+
if (failing.length > 0 && !this.expiredLogged) {
|
|
1254
|
+
this.expiredLogged = true;
|
|
1255
|
+
logger.error("[DependencyWatchdog] Dependency unhealthy beyond the watchdog window", {
|
|
1256
|
+
enforced: this.config.enabled,
|
|
1257
|
+
thresholdMs: this.thresholdMs,
|
|
1258
|
+
failing: failing.map((f) => ({
|
|
1259
|
+
...f,
|
|
1260
|
+
lastError: this.states.get(f.name)?.lastError ?? null
|
|
1261
|
+
}))
|
|
1262
|
+
});
|
|
1263
|
+
} else if (failing.length === 0) this.expiredLogged = false;
|
|
1264
|
+
return {
|
|
1265
|
+
alive,
|
|
1266
|
+
thresholdMs: this.thresholdMs,
|
|
1267
|
+
failing
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
async runRound() {
|
|
1271
|
+
await Promise.all(this.probes.map(async (probe) => {
|
|
1272
|
+
try {
|
|
1273
|
+
const healthy = await this.withTimeout(probe);
|
|
1274
|
+
this.record(probe.name, healthy === true);
|
|
1275
|
+
} catch (error) {
|
|
1276
|
+
this.record(probe.name, false, error);
|
|
1277
|
+
}
|
|
1278
|
+
}));
|
|
1279
|
+
}
|
|
1280
|
+
async withTimeout(probe) {
|
|
1281
|
+
let timer;
|
|
1282
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
1283
|
+
timer = setTimeout(() => {
|
|
1284
|
+
reject(/* @__PURE__ */ new Error(`probe timed out after ${String(this.config.checkTimeoutMs)}ms`));
|
|
1285
|
+
}, this.config.checkTimeoutMs);
|
|
1286
|
+
timer.unref?.();
|
|
1287
|
+
});
|
|
1288
|
+
try {
|
|
1289
|
+
return await Promise.race([Promise.resolve().then(() => probe.check()), timeout]);
|
|
1290
|
+
} finally {
|
|
1291
|
+
clearTimeout(timer);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
/** Probes for the dependencies a service listed in `health.watchdog`. */
|
|
1296
|
+
function buildWatchdogProbes(config, sources) {
|
|
1297
|
+
const probes = [];
|
|
1298
|
+
for (const name of new Set(config.dependencies)) switch (name) {
|
|
1299
|
+
case "postgres":
|
|
1300
|
+
probes.push({
|
|
1301
|
+
name,
|
|
1302
|
+
check: async () => {
|
|
1303
|
+
const client = sources.prisma();
|
|
1304
|
+
if (!client) return false;
|
|
1305
|
+
await client.$queryRaw`SELECT 1`;
|
|
1306
|
+
return true;
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
break;
|
|
1310
|
+
case "valkey":
|
|
1311
|
+
probes.push({
|
|
1312
|
+
name,
|
|
1313
|
+
check: async () => {
|
|
1314
|
+
const client = await sources.valkey();
|
|
1315
|
+
if (!client) return false;
|
|
1316
|
+
await client.ping();
|
|
1317
|
+
return true;
|
|
1318
|
+
}
|
|
1319
|
+
});
|
|
1320
|
+
break;
|
|
1321
|
+
case "pubsub":
|
|
1322
|
+
probes.push({
|
|
1323
|
+
name,
|
|
1324
|
+
check: () => sources.pubsub()?.ok ?? true
|
|
1325
|
+
});
|
|
1326
|
+
break;
|
|
1327
|
+
case "consumers": probes.push({
|
|
1328
|
+
name,
|
|
1329
|
+
check: () => sources.consumers()?.ok ?? true
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
return [...probes, ...config.probes ?? []];
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* Build the watchdog for `createServer`, or `undefined` when the service did
|
|
1336
|
+
* not opt in. The env (`DEPENDENCY_WATCHDOG_*`) overrides the service settings.
|
|
1337
|
+
*/
|
|
1338
|
+
function createServerWatchdog(config, sources, env = process.env) {
|
|
1339
|
+
if (!config) return void 0;
|
|
1340
|
+
const probes = buildWatchdogProbes(config, sources);
|
|
1341
|
+
if (probes.length === 0) return void 0;
|
|
1342
|
+
const base = {};
|
|
1343
|
+
if (config.unhealthyThresholdMs !== void 0) base.unhealthyThresholdMs = config.unhealthyThresholdMs;
|
|
1344
|
+
if (config.jitterMs !== void 0) base.jitterMs = config.jitterMs;
|
|
1345
|
+
if (config.intervalMs !== void 0) base.intervalMs = config.intervalMs;
|
|
1346
|
+
if (config.checkTimeoutMs !== void 0) base.checkTimeoutMs = config.checkTimeoutMs;
|
|
1347
|
+
return new DependencyWatchdog({
|
|
1348
|
+
...resolveDependencyWatchdogConfig(env, base),
|
|
1349
|
+
probes
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* `/health/live` answer: the static liveness body while the watchdog (if any)
|
|
1354
|
+
* reports alive, else 503 with the failing dependencies. Reads in-memory state
|
|
1355
|
+
* only.
|
|
1356
|
+
*/
|
|
1357
|
+
function watchdogLivenessResponse(body, watchdog) {
|
|
1358
|
+
if (!watchdog) return {
|
|
1359
|
+
status: 200,
|
|
1360
|
+
body
|
|
1361
|
+
};
|
|
1362
|
+
const report = watchdog.liveness();
|
|
1363
|
+
if (report.alive) return {
|
|
1364
|
+
status: 200,
|
|
1365
|
+
body
|
|
1366
|
+
};
|
|
1367
|
+
return {
|
|
1368
|
+
status: 503,
|
|
1369
|
+
body: {
|
|
1370
|
+
...body,
|
|
1371
|
+
status: "unavailable",
|
|
1372
|
+
watchdog: {
|
|
1373
|
+
thresholdMs: report.thresholdMs,
|
|
1374
|
+
failing: report.failing
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1104
1380
|
// src/server/errors.ts
|
|
1105
1381
|
const DEFAULT_ERROR_CODE = "INTERNAL_SERVER_ERROR";
|
|
1106
1382
|
const DEFAULT_HTTP_STATUS = 500;
|
|
@@ -1721,20 +1997,34 @@ async function createServer(definition) {
|
|
|
1721
1997
|
enableSessionSecurity: config.enableSessionSecurity ?? false
|
|
1722
1998
|
}));
|
|
1723
1999
|
const serviceVersion = config.serviceVersion || "1.0.0";
|
|
2000
|
+
const valkeySource = async () => {
|
|
2001
|
+
try {
|
|
2002
|
+
const { getValkeyClient } = await import("../cache/index.js");
|
|
2003
|
+
return await getValkeyClient();
|
|
2004
|
+
} catch {
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
};
|
|
1724
2008
|
const getReadiness = createReadinessProbe({
|
|
1725
2009
|
prisma: () => getDb(),
|
|
1726
|
-
valkey:
|
|
1727
|
-
try {
|
|
1728
|
-
const { getValkeyClient } = await import("../cache/index.js");
|
|
1729
|
-
return await getValkeyClient();
|
|
1730
|
-
} catch {
|
|
1731
|
-
return;
|
|
1732
|
-
}
|
|
1733
|
-
},
|
|
2010
|
+
valkey: valkeySource,
|
|
1734
2011
|
pubsub: () => getPubSubHealth(),
|
|
2012
|
+
consumers: () => getConsumerHealth(),
|
|
1735
2013
|
...config.health?.requiredDependencies ? { requiredDependencies: config.health.requiredDependencies } : {}
|
|
1736
2014
|
});
|
|
2015
|
+
const watchdog = createServerWatchdog(config.health?.watchdog, {
|
|
2016
|
+
prisma: () => getDb(),
|
|
2017
|
+
valkey: valkeySource,
|
|
2018
|
+
pubsub: () => getPubSubHealth(),
|
|
2019
|
+
consumers: () => getConsumerHealth()
|
|
2020
|
+
});
|
|
1737
2021
|
const shallow = () => livenessBody(config.serviceName, serviceVersion, (/* @__PURE__ */ new Date()).toISOString());
|
|
2022
|
+
const live = (ctx) => {
|
|
2023
|
+
const { status, body } = watchdogLivenessResponse(livenessBody(config.serviceName, serviceVersion, (/* @__PURE__ */ new Date()).toISOString()), watchdog);
|
|
2024
|
+
const ctxWithSet = ctx;
|
|
2025
|
+
if (ctxWithSet.set) ctxWithSet.set.status = status;
|
|
2026
|
+
return body;
|
|
2027
|
+
};
|
|
1738
2028
|
const deep = async (ctx) => {
|
|
1739
2029
|
const snapshot = await getReadiness();
|
|
1740
2030
|
const ctxWithSet = ctx;
|
|
@@ -1743,7 +2033,7 @@ async function createServer(definition) {
|
|
|
1743
2033
|
return readinessBody(snapshot, config.serviceName, serviceVersion, (/* @__PURE__ */ new Date()).toISOString(), Math.round(process.uptime()));
|
|
1744
2034
|
};
|
|
1745
2035
|
app.get("/health", deep);
|
|
1746
|
-
app.get("/health/live",
|
|
2036
|
+
app.get("/health/live", live);
|
|
1747
2037
|
app.get("/health/ready", deep);
|
|
1748
2038
|
app.get("/health/startup", shallow);
|
|
1749
2039
|
if (moduleGraph) {
|
|
@@ -1824,6 +2114,7 @@ async function createServer(definition) {
|
|
|
1824
2114
|
server: null,
|
|
1825
2115
|
start: async () => {
|
|
1826
2116
|
serverStartTime = /* @__PURE__ */ new Date();
|
|
2117
|
+
watchdog?.start();
|
|
1827
2118
|
app.listen({
|
|
1828
2119
|
port,
|
|
1829
2120
|
hostname: host,
|
|
@@ -1834,6 +2125,7 @@ async function createServer(definition) {
|
|
|
1834
2125
|
},
|
|
1835
2126
|
stop: async () => {
|
|
1836
2127
|
logger.info(`[Server] Stopping ${config.serviceName}...`);
|
|
2128
|
+
watchdog?.stop();
|
|
1837
2129
|
if (onShutdown) await onShutdown();
|
|
1838
2130
|
if (moduleGraph) await moduleGraph.shutdown();
|
|
1839
2131
|
await getDatabaseManager().disconnect();
|
|
@@ -2291,5 +2583,5 @@ function createMutationAuditPlugin(options) {
|
|
|
2291
2583
|
} };
|
|
2292
2584
|
}
|
|
2293
2585
|
|
|
2294
|
-
export { ACTOR_ORIGIN_HEADER, AI_ASSISTANT_ACTOR_ORIGIN, ASSISTANT_CORRELATION_ID_HEADER, ASSISTANT_SESSION_ID_HEADER, DEFAULT_DSAR_ORCHESTRATOR_ID, DEFAULT_MAX_REQUEST_BODY_SIZE, DEFAULT_RAW_BODY_MAX_BYTES, DSAR_ALLOWED_ORCHESTRATORS_ENV, DSAR_REQUIRE_VERIFIED_SERVICE_TOKEN_ENV, DsarOrchestratorForbiddenError, MAX_IDLE_TIMEOUT_SECONDS, MUTATION_AUDIT_ACTIVITY_TYPE, MUTATION_AUDIT_RESOURCE_TYPE, PayloadTooLargeError, UserFacingGraphQLError, VERIFIED_SERVICE_IDENTITY_HEADER, assertDsarOrchestrator, authCheck, buildContext, configureAuth, configureContext, configureDefaultAuth, configureServerAuth, createHttpErrorResponse, createHumanReadableErrorPlugin, createMutationAuditPlugin, createRawBodyRouter, createServer, createWorkspaceGuardPlugin, decodeJWT, extendRequestIdleTimeout, fetchWorkspaceSecret, formatHttpError, generateSymmetricSecret, getAllowedDsarOrchestrators, getContextOptions, getDelegatedPrincipal, getMutationFieldNames, isDsarOrchestratorActor, normalizeError, normalizeExecutionResultErrors, normalizeGraphQLResponse, normalizeGraphQLResponsePayload, orgCheck, parseAssistantSessionHeaders, readAssistantSessionAttribution, readBoundedRawBody, requireWorkspace, resolveBodyLimitBytes, resolveDsarCallerIdentity, resolveMaxRequestBodySize, resolveOnBehalfOf, sanitizeAuditValue, suppressMutationAudit, tenantCheck, toAssistantSessionAttribution, toUserFacingGraphQLError, verifyJWT, workspaceCheck };
|
|
2586
|
+
export { ACTOR_ORIGIN_HEADER, AI_ASSISTANT_ACTOR_ORIGIN, ASSISTANT_CORRELATION_ID_HEADER, ASSISTANT_SESSION_ID_HEADER, DEFAULT_DEPENDENCY_WATCHDOG_CONFIG, DEFAULT_DSAR_ORCHESTRATOR_ID, DEFAULT_MAX_REQUEST_BODY_SIZE, DEFAULT_RAW_BODY_MAX_BYTES, DSAR_ALLOWED_ORCHESTRATORS_ENV, DSAR_REQUIRE_VERIFIED_SERVICE_TOKEN_ENV, DependencyWatchdog, DsarOrchestratorForbiddenError, MAX_IDLE_TIMEOUT_SECONDS, MIN_UNHEALTHY_THRESHOLD_MS, MUTATION_AUDIT_ACTIVITY_TYPE, MUTATION_AUDIT_RESOURCE_TYPE, PayloadTooLargeError, UserFacingGraphQLError, VERIFIED_SERVICE_IDENTITY_HEADER, assertDsarOrchestrator, authCheck, buildContext, buildWatchdogProbes, configureAuth, configureContext, configureDefaultAuth, configureServerAuth, createHttpErrorResponse, createHumanReadableErrorPlugin, createMutationAuditPlugin, createRawBodyRouter, createServer, createServerWatchdog, createWorkspaceGuardPlugin, decodeJWT, extendRequestIdleTimeout, fetchWorkspaceSecret, formatHttpError, generateSymmetricSecret, getAllowedDsarOrchestrators, getContextOptions, getDelegatedPrincipal, getMutationFieldNames, isDsarOrchestratorActor, normalizeError, normalizeExecutionResultErrors, normalizeGraphQLResponse, normalizeGraphQLResponsePayload, orgCheck, parseAssistantSessionHeaders, readAssistantSessionAttribution, readBoundedRawBody, requireWorkspace, resolveBodyLimitBytes, resolveDependencyWatchdogConfig, resolveDsarCallerIdentity, resolveMaxRequestBodySize, resolveOnBehalfOf, sanitizeAuditValue, suppressMutationAudit, tenantCheck, toAssistantSessionAttribution, toUserFacingGraphQLError, verifyJWT, watchdogLivenessResponse, workspaceCheck };
|
|
2295
2587
|
//# sourceMappingURL=index.js.map
|