@crvouga/mockingbird-service-sentry 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  runCli,
4
4
  serveCommand,
5
5
  serveTarget
6
- } from "./chunk-SYFMGGNZ.js";
7
- import "./chunk-3XKUROOO.js";
6
+ } from "./chunk-KKLMNMWS.js";
7
+ import "./chunk-7ORSUYU5.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var code = await runCli(
package/dist/index.d.ts CHANGED
@@ -184,9 +184,15 @@ declare class Collection<T> {
184
184
  }>;
185
185
  }
186
186
 
187
+ /**
188
+ * What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
189
+ * which derives the base from the wall clock when the runtime is created.
190
+ */
191
+ type IdBase = number | string;
187
192
  /**
188
193
  * Sequential id source persisted in SQLite. Ids are deterministic for a given
189
194
  * sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
195
+ * A runtime's `idBase` is mixed in, so a different base reissues none of another's ids.
190
196
  */
191
197
  declare class IdSequence {
192
198
  private readonly sqlite;
@@ -298,6 +304,15 @@ type FaultRule = {
298
304
  requestHeaders?: Record<string, string>;
299
305
  /** Fault only requests carrying these query parameters. `"*"` matches any value. */
300
306
  query?: Record<string, string>;
307
+ /**
308
+ * Fault only requests whose JSON body carries these fields. Each key is a dotted path into
309
+ * the parsed body (`"patient_details.email"`; a number steps into an array, `"items.0.sku"`)
310
+ * and each value is what the field must equal: a string, number, boolean or `null`, compared
311
+ * strictly (`3` is not `"3"`). `"*"` matches any value that is present. A request whose body
312
+ * is missing, is not JSON, or is not a JSON object never matches. Not `body`, which is the
313
+ * response a rule injects.
314
+ */
315
+ requestBody?: Record<string, RequestBodyValue>;
301
316
  /**
302
317
  * Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
303
318
  * an in-process caller usually wants, and what a parallel worker usually does not:
@@ -364,6 +379,8 @@ type FaultRule = {
364
379
  /** The preset this rule was expanded from, if any. */
365
380
  fromPreset?: string;
366
381
  };
382
+ /** What a field of the request body must equal in {@link FaultRule.requestBody}. */
383
+ type RequestBodyValue = string | number | boolean | null;
367
384
  /** A fault that fired for one request. */
368
385
  type FaultHit = {
369
386
  id: string;
@@ -401,6 +418,11 @@ type FaultCandidate = {
401
418
  /** Request headers and query, for rules that match on them. */
402
419
  headers?: Headers;
403
420
  query?: URLSearchParams;
421
+ /**
422
+ * The request body parsed as JSON, read only when a rule matches on `requestBody`. Resolve
423
+ * `undefined` for a body that is missing or not JSON. It must leave the request readable.
424
+ */
425
+ readJson?: () => Promise<unknown>;
404
426
  /** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
405
427
  now?: number;
406
428
  /** How to spend a delay for this request. Default: the registry's own sleep. */
@@ -923,6 +945,12 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
923
945
  mount(prefix: string): MountedAPI;
924
946
  readonly sqlite: SqliteClient$1;
925
947
  readonly clock: Clock;
948
+ /**
949
+ * Change the id base ({@link RuntimeOptions.idBase}) for ids generated from now on, and
950
+ * return the number it resolved to. Set it before the first request so a boot's ids stay
951
+ * one run.
952
+ */
953
+ setIdBase(base: IdBase): number;
926
954
  readonly faults: FaultRegistry;
927
955
  /** Baseline response time per namespace. */
928
956
  readonly latency: LatencyRegistry;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  document,
9
9
  sentryCredential,
10
10
  supportedOperationIds
11
- } from "./chunk-3XKUROOO.js";
11
+ } from "./chunk-7ORSUYU5.js";
12
12
  export {
13
13
  DEFAULT_PROJECT,
14
14
  SENTRY_NAMESPACE,
package/dist/server.d.ts CHANGED
@@ -133,6 +133,12 @@ interface SqliteClient$2 {
133
133
  transaction<T>(fn: () => T): T;
134
134
  }
135
135
 
136
+ /**
137
+ * What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
138
+ * which derives the base from the wall clock when the runtime is created.
139
+ */
140
+ type IdBase$1 = number | string;
141
+
136
142
  /**
137
143
  * The single source of time for a service.
138
144
  *
@@ -215,6 +221,15 @@ type FaultRule$1 = {
215
221
  requestHeaders?: Record<string, string>;
216
222
  /** Fault only requests carrying these query parameters. `"*"` matches any value. */
217
223
  query?: Record<string, string>;
224
+ /**
225
+ * Fault only requests whose JSON body carries these fields. Each key is a dotted path into
226
+ * the parsed body (`"patient_details.email"`; a number steps into an array, `"items.0.sku"`)
227
+ * and each value is what the field must equal: a string, number, boolean or `null`, compared
228
+ * strictly (`3` is not `"3"`). `"*"` matches any value that is present. A request whose body
229
+ * is missing, is not JSON, or is not a JSON object never matches. Not `body`, which is the
230
+ * response a rule injects.
231
+ */
232
+ requestBody?: Record<string, RequestBodyValue$1>;
218
233
  /**
219
234
  * Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
220
235
  * an in-process caller usually wants, and what a parallel worker usually does not:
@@ -281,6 +296,8 @@ type FaultRule$1 = {
281
296
  /** The preset this rule was expanded from, if any. */
282
297
  fromPreset?: string;
283
298
  };
299
+ /** What a field of the request body must equal in {@link FaultRule.requestBody}. */
300
+ type RequestBodyValue$1 = string | number | boolean | null;
284
301
  /** A fault that fired for one request. */
285
302
  type FaultHit$1 = {
286
303
  id: string;
@@ -305,6 +322,11 @@ type FaultCandidate$1 = {
305
322
  /** Request headers and query, for rules that match on them. */
306
323
  headers?: Headers;
307
324
  query?: URLSearchParams;
325
+ /**
326
+ * The request body parsed as JSON, read only when a rule matches on `requestBody`. Resolve
327
+ * `undefined` for a body that is missing or not JSON. It must leave the request readable.
328
+ */
329
+ readJson?: () => Promise<unknown>;
308
330
  /** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
309
331
  now?: number;
310
332
  /** How to spend a delay for this request. Default: the registry's own sleep. */
@@ -827,6 +849,12 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
827
849
  mount(prefix: string): MountedAPI$1;
828
850
  readonly sqlite: SqliteClient$2;
829
851
  readonly clock: Clock$1;
852
+ /**
853
+ * Change the id base ({@link RuntimeOptions.idBase}) for ids generated from now on, and
854
+ * return the number it resolved to. Set it before the first request so a boot's ids stay
855
+ * one run.
856
+ */
857
+ setIdBase(base: IdBase$1): number;
830
858
  readonly faults: FaultRegistry$1;
831
859
  /** Baseline response time per namespace. */
832
860
  readonly latency: LatencyRegistry$1;
@@ -932,6 +960,12 @@ type CommonServeOptions = {
932
960
  /** Synthetic provider fixture objects supplied by a fleet entry. */
933
961
  fixtures?: Record<string, unknown>;
934
962
  baseUrl?: string;
963
+ /**
964
+ * Boot settings from `--settings`, `MOCKINGBIRD_SETTINGS` or a fleet entry's `settings`,
965
+ * already checked by the target's {@link ServeTarget.parseSettings}. Pass them to the
966
+ * service's own `settings` option so they become every namespace's defaults.
967
+ */
968
+ settings?: Record<string, unknown>;
935
969
  };
936
970
  /**
937
971
  * What a service contributes to `serve`: how to build its runtime from CLI flags,
@@ -944,6 +978,13 @@ type ServeTarget = {
944
978
  defaultPort: number;
945
979
  /** Serve flags beyond the common ones. */
946
980
  options?: Record<string, CliOption>;
981
+ /**
982
+ * Check the boot settings a caller supplied (`--settings`, `MOCKINGBIRD_SETTINGS`, a fleet
983
+ * entry's `settings`) against the service's settings schema, returning them normalized
984
+ * or throwing a message naming the bad field. A target without one takes no boot settings,
985
+ * and supplying some is refused before a port is bound.
986
+ */
987
+ parseSettings?(settings: Record<string, unknown>): Record<string, unknown>;
947
988
  create(values: CliValues, common: CommonServeOptions): Promise<ServiceRuntime$1<ServiceInstance$1>> | ServiceRuntime$1<ServiceInstance$1>;
948
989
  /** Startup lines after the listen address, e.g. the loaded corpus version. */
949
990
  banner?(runtime: ServiceRuntime$1<ServiceInstance$1>): string[];
@@ -1125,9 +1166,15 @@ declare class Collection<T> {
1125
1166
  }>;
1126
1167
  }
1127
1168
 
1169
+ /**
1170
+ * What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
1171
+ * which derives the base from the wall clock when the runtime is created.
1172
+ */
1173
+ type IdBase = number | string;
1128
1174
  /**
1129
1175
  * Sequential id source persisted in SQLite. Ids are deterministic for a given
1130
1176
  * sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
1177
+ * A runtime's `idBase` is mixed in, so a different base reissues none of another's ids.
1131
1178
  */
1132
1179
  declare class IdSequence {
1133
1180
  private readonly sqlite;
@@ -1239,6 +1286,15 @@ type FaultRule = {
1239
1286
  requestHeaders?: Record<string, string>;
1240
1287
  /** Fault only requests carrying these query parameters. `"*"` matches any value. */
1241
1288
  query?: Record<string, string>;
1289
+ /**
1290
+ * Fault only requests whose JSON body carries these fields. Each key is a dotted path into
1291
+ * the parsed body (`"patient_details.email"`; a number steps into an array, `"items.0.sku"`)
1292
+ * and each value is what the field must equal: a string, number, boolean or `null`, compared
1293
+ * strictly (`3` is not `"3"`). `"*"` matches any value that is present. A request whose body
1294
+ * is missing, is not JSON, or is not a JSON object never matches. Not `body`, which is the
1295
+ * response a rule injects.
1296
+ */
1297
+ requestBody?: Record<string, RequestBodyValue>;
1242
1298
  /**
1243
1299
  * Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
1244
1300
  * an in-process caller usually wants, and what a parallel worker usually does not:
@@ -1305,6 +1361,8 @@ type FaultRule = {
1305
1361
  /** The preset this rule was expanded from, if any. */
1306
1362
  fromPreset?: string;
1307
1363
  };
1364
+ /** What a field of the request body must equal in {@link FaultRule.requestBody}. */
1365
+ type RequestBodyValue = string | number | boolean | null;
1308
1366
  /** A fault that fired for one request. */
1309
1367
  type FaultHit = {
1310
1368
  id: string;
@@ -1329,6 +1387,11 @@ type FaultCandidate = {
1329
1387
  /** Request headers and query, for rules that match on them. */
1330
1388
  headers?: Headers;
1331
1389
  query?: URLSearchParams;
1390
+ /**
1391
+ * The request body parsed as JSON, read only when a rule matches on `requestBody`. Resolve
1392
+ * `undefined` for a body that is missing or not JSON. It must leave the request readable.
1393
+ */
1394
+ readJson?: () => Promise<unknown>;
1332
1395
  /** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
1333
1396
  now?: number;
1334
1397
  /** How to spend a delay for this request. Default: the registry's own sleep. */
@@ -1851,6 +1914,12 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1851
1914
  mount(prefix: string): MountedAPI;
1852
1915
  readonly sqlite: SqliteClient$1;
1853
1916
  readonly clock: Clock;
1917
+ /**
1918
+ * Change the id base ({@link RuntimeOptions.idBase}) for ids generated from now on, and
1919
+ * return the number it resolved to. Set it before the first request so a boot's ids stay
1920
+ * one run.
1921
+ */
1922
+ setIdBase(base: IdBase): number;
1854
1923
  readonly faults: FaultRegistry;
1855
1924
  /** Baseline response time per namespace. */
1856
1925
  readonly latency: LatencyRegistry;
package/dist/server.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  DEFAULT_PORT,
3
3
  createServer,
4
4
  serveTarget
5
- } from "./chunk-SYFMGGNZ.js";
6
- import "./chunk-3XKUROOO.js";
5
+ } from "./chunk-KKLMNMWS.js";
6
+ import "./chunk-7ORSUYU5.js";
7
7
  export {
8
8
  DEFAULT_PORT,
9
9
  createServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-sentry",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Stateful Sentry emulator: SDK envelope/store/minidump ingestion, events, issues, attachments and deterministic transport controls.",
5
5
  "license": "MIT",
6
6
  "type": "module",