@crvouga/mockingbird-service-docker 1.2.0 → 1.4.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/CHANGELOG.md +18 -4
- package/DISCOVERY.md +23 -0
- package/README.md +29 -11
- package/dist/{chunk-TR75ZFCZ.js → chunk-DG4KWFV5.js} +3 -2
- package/dist/{chunk-TR75ZFCZ.js.map → chunk-DG4KWFV5.js.map} +2 -2
- package/dist/chunk-PEU54Q4H.js +6092 -0
- package/dist/chunk-PEU54Q4H.js.map +7 -0
- package/dist/cli.js +4078 -160
- package/dist/cli.js.map +4 -4
- package/dist/index.d.ts +371 -45
- package/dist/index.js +1 -1
- package/dist/server.d.ts +726 -86
- package/dist/server.js +2 -2
- package/package.json +3 -2
- package/dist/chunk-5I542RFL.js +0 -4198
- package/dist/chunk-5I542RFL.js.map +0 -7
package/dist/server.d.ts
CHANGED
|
@@ -145,7 +145,7 @@ type ClockState$1 = {
|
|
|
145
145
|
now: number;
|
|
146
146
|
/** True while time does not advance on its own. */
|
|
147
147
|
frozen: boolean;
|
|
148
|
-
/** Milliseconds
|
|
148
|
+
/** Milliseconds a running clock adds to its underlying source. `0` while frozen. */
|
|
149
149
|
offsetMs: number;
|
|
150
150
|
};
|
|
151
151
|
type Clock$1 = {
|
|
@@ -181,7 +181,10 @@ type Rng$1 = {
|
|
|
181
181
|
state(): number;
|
|
182
182
|
/** Restore a state previously returned by {@link state}. */
|
|
183
183
|
setState(state: number): void;
|
|
184
|
-
seed
|
|
184
|
+
/** Restart the stream from a new seed. `reset` then returns to this seed. */
|
|
185
|
+
reseed(seed: number | string): void;
|
|
186
|
+
/** The seed the stream currently starts from. */
|
|
187
|
+
readonly seed: number;
|
|
185
188
|
};
|
|
186
189
|
|
|
187
190
|
/**
|
|
@@ -190,44 +193,83 @@ type Rng$1 = {
|
|
|
190
193
|
* This is how a suite reaches the vendor's failure modes without the vendor: the
|
|
191
194
|
* quota error that only appears when a shared sandbox is full, the 429 that only
|
|
192
195
|
* appears under load, the 5xx that proves a retry path works.
|
|
196
|
+
*
|
|
197
|
+
* A rule has three parts. What it **matches** (`operationId`, `method`, `path`, …), **when**
|
|
198
|
+
* it fires among the matching requests (`after`, `every`, `count`, `rate`, `from`, `until`),
|
|
199
|
+
* and what it **does** (`status`, `delay`, `timeout`, `drop`, `truncate`, `effect`).
|
|
193
200
|
*/
|
|
194
201
|
type FaultRule$1 = {
|
|
195
|
-
/** Stable id, so a suite can retire exactly the rule it added. */
|
|
202
|
+
/** Stable id, so a suite can retire exactly the rule it added. Unique within a namespace. */
|
|
196
203
|
id: string;
|
|
197
204
|
/** Fault only this operation. Omit to match every operation. */
|
|
198
205
|
operationId?: string;
|
|
199
206
|
/** Fault only this HTTP method, case-insensitive. Omit to match every method. */
|
|
200
207
|
method?: string;
|
|
208
|
+
/** Fault only this exact path. */
|
|
209
|
+
path?: string;
|
|
201
210
|
/** Fault only paths starting with this prefix. Omit to match every path. */
|
|
202
211
|
pathPrefix?: string;
|
|
212
|
+
/** Fault only paths matching this regular expression (JavaScript syntax, unanchored). */
|
|
213
|
+
pathPattern?: string;
|
|
214
|
+
/** Fault only requests carrying these headers. `"*"` matches any value. */
|
|
215
|
+
requestHeaders?: Record<string, string>;
|
|
216
|
+
/** Fault only requests carrying these query parameters. `"*"` matches any value. */
|
|
217
|
+
query?: Record<string, string>;
|
|
203
218
|
/**
|
|
204
219
|
* Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
|
|
205
220
|
* an in-process caller usually wants, and what a parallel worker usually does not:
|
|
206
221
|
* rules added through `POST /__admin/faults` default to the calling namespace.
|
|
207
222
|
*/
|
|
208
223
|
namespace?: string;
|
|
224
|
+
/** Let this many matching requests through first. */
|
|
225
|
+
after?: number;
|
|
226
|
+
/** Then fault only every nth matching request: `3` faults the 3rd, 6th, 9th. */
|
|
227
|
+
every?: number;
|
|
228
|
+
/** Retire the rule after this many faults. Omit to keep it until removed. */
|
|
229
|
+
count?: number;
|
|
230
|
+
/** Fault this fraction of the remaining requests, `0`–`1`, drawn from the seed. Default `1`. */
|
|
231
|
+
rate?: number;
|
|
232
|
+
/**
|
|
233
|
+
* Fault only from this instant on the namespace clock. A duration (`"5m"`) counts from the
|
|
234
|
+
* clock when the rule was added. Listed as epoch ms.
|
|
235
|
+
*/
|
|
236
|
+
from?: Instant$1 | Duration$1;
|
|
237
|
+
/** Stop faulting at this instant on the namespace clock. A duration counts from when added. */
|
|
238
|
+
until?: Instant$1 | Duration$1;
|
|
209
239
|
/**
|
|
210
|
-
* Status of the injected response. Omit for a rule that only delays
|
|
211
|
-
*
|
|
212
|
-
* the request then still reaches the service.
|
|
240
|
+
* Status of the injected response. Omit for a rule that only delays, times out, drops,
|
|
241
|
+
* truncates, or switches on an `effect`: the request then still reaches the service.
|
|
213
242
|
*/
|
|
214
243
|
status?: number;
|
|
215
244
|
/** Response body, serialized as JSON. A string is sent as-is. */
|
|
216
245
|
body?: unknown;
|
|
246
|
+
/** Response headers. */
|
|
217
247
|
headers?: Record<string, string>;
|
|
218
|
-
/**
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
rate?: number;
|
|
222
|
-
/** Hold the response back this long, to exercise timeouts. */
|
|
248
|
+
/** Hold the response back this long. Listed as `delayMs`. */
|
|
249
|
+
delay?: Duration$1;
|
|
250
|
+
/** `delay`, in milliseconds. */
|
|
223
251
|
delayMs?: number;
|
|
224
252
|
/** Alias of `delayMs`. */
|
|
225
253
|
latencyMs?: number;
|
|
254
|
+
/** Extra seeded delay in `[0, jitter]`. Listed as `jitterMs`. */
|
|
255
|
+
jitter?: Duration$1;
|
|
256
|
+
jitterMs?: number;
|
|
257
|
+
/**
|
|
258
|
+
* Never answer: hold the request this long, then drop the connection. Listed as
|
|
259
|
+
* `timeoutMs`. With virtual time the wait is spent on the mock clock.
|
|
260
|
+
*/
|
|
261
|
+
timeout?: Duration$1;
|
|
262
|
+
timeoutMs?: number;
|
|
226
263
|
/**
|
|
227
264
|
* Drop the connection instead of answering: an in-process `fetch` rejects with a
|
|
228
265
|
* `TypeError`, and a served mock destroys the socket. Models "unknown outcome" failures.
|
|
229
266
|
*/
|
|
230
267
|
drop?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Cut the response body off after this many bytes: the status and headers arrive, then
|
|
270
|
+
* the connection dies mid-body.
|
|
271
|
+
*/
|
|
272
|
+
truncate?: number;
|
|
231
273
|
/**
|
|
232
274
|
* A named service behaviour to switch on for the matching request instead of (or
|
|
233
275
|
* before) a canned response, e.g. `created_but_500` or `numeric_tracking_id`. Services
|
|
@@ -236,8 +278,8 @@ type FaultRule$1 = {
|
|
|
236
278
|
effect?: string;
|
|
237
279
|
/** Parameters for `effect`. */
|
|
238
280
|
params?: Record<string, unknown>;
|
|
239
|
-
/**
|
|
240
|
-
|
|
281
|
+
/** The preset this rule was expanded from, if any. */
|
|
282
|
+
fromPreset?: string;
|
|
241
283
|
};
|
|
242
284
|
/** A fault that fired for one request. */
|
|
243
285
|
type FaultHit$1 = {
|
|
@@ -245,6 +287,10 @@ type FaultHit$1 = {
|
|
|
245
287
|
/** The injected response; absent when the rule only delays, drops, or sets an effect. */
|
|
246
288
|
response?: Response;
|
|
247
289
|
drop?: boolean;
|
|
290
|
+
/** Set with `drop` when the rule held the request for its `timeout` first. */
|
|
291
|
+
timeout?: boolean;
|
|
292
|
+
/** Bytes of response body to let through before the connection dies. */
|
|
293
|
+
truncate?: number;
|
|
248
294
|
effect?: {
|
|
249
295
|
name: string;
|
|
250
296
|
params: Record<string, unknown>;
|
|
@@ -256,38 +302,202 @@ type FaultCandidate$1 = {
|
|
|
256
302
|
method: string;
|
|
257
303
|
path: string;
|
|
258
304
|
namespace: string;
|
|
305
|
+
/** Request headers and query, for rules that match on them. */
|
|
306
|
+
headers?: Headers;
|
|
307
|
+
query?: URLSearchParams;
|
|
308
|
+
/** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
|
|
309
|
+
now?: number;
|
|
310
|
+
/** How to spend a delay for this request. Default: the registry's own sleep. */
|
|
311
|
+
wait?: (ms: number) => Promise<void>;
|
|
312
|
+
};
|
|
313
|
+
/** A stored rule and how often it was consulted. */
|
|
314
|
+
type FaultListing$1 = FaultRule$1 & {
|
|
315
|
+
/** Faults left before the rule retires. `null` when it has no `count`. */
|
|
316
|
+
remaining: number | null;
|
|
317
|
+
/** Times the rule faulted a request. */
|
|
318
|
+
hits: number;
|
|
319
|
+
/** Requests that matched the rule, faulted or not. */
|
|
320
|
+
seen: number;
|
|
321
|
+
};
|
|
322
|
+
/** A namespace's own rules, with their counters, in the order they are tried. */
|
|
323
|
+
type FaultSnapshot$1 = {
|
|
324
|
+
/**
|
|
325
|
+
* `position` is how many `"*"` rules are tried before the rule, which is what its place
|
|
326
|
+
* in the order means to a request and holds in any process.
|
|
327
|
+
*/
|
|
328
|
+
rules: (FaultListing$1 & {
|
|
329
|
+
position?: number;
|
|
330
|
+
})[];
|
|
331
|
+
/** How many `fault_<n>` ids the namespace has handed out. */
|
|
332
|
+
nextId?: number;
|
|
259
333
|
};
|
|
260
334
|
type FaultRegistry$1 = {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
rules: (FaultRule$1 & {
|
|
264
|
-
remaining: number | null;
|
|
265
|
-
hits: number;
|
|
266
|
-
position: number;
|
|
267
|
-
})[];
|
|
268
|
-
rngState: number;
|
|
269
|
-
};
|
|
335
|
+
snapshot(namespace: string): FaultSnapshot$1;
|
|
336
|
+
/** Add a rule, or replace the rule with the same id in the same namespace. */
|
|
270
337
|
add(rule: FaultRule$1): FaultRule$1;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
})[];
|
|
283
|
-
rngState: number;
|
|
284
|
-
}): void;
|
|
338
|
+
/** The next unused `fault_<n>` id in `namespace`. */
|
|
339
|
+
nextId(namespace: string): string;
|
|
340
|
+
/** Every rule, or the rules a namespace's requests can hit: its own and the global ones. */
|
|
341
|
+
list(namespace?: string): FaultListing$1[];
|
|
342
|
+
get(id: string, namespace?: string): FaultListing$1 | undefined;
|
|
343
|
+
/** Remove a rule by id: from `namespace` (its own, then a global one), or wherever it is. */
|
|
344
|
+
remove(id: string, namespace?: string): boolean;
|
|
345
|
+
/** Remove every rule, or one namespace's own rules. */
|
|
346
|
+
clear(namespace?: string): void;
|
|
347
|
+
/** Replace a namespace's own rules with a snapshot's, wherever the snapshot was taken. */
|
|
348
|
+
restore(namespace: string, state: FaultSnapshot$1): void;
|
|
285
349
|
/**
|
|
286
350
|
* Every fault this request should get, in rule order, stopping at the first that answers
|
|
287
351
|
* or drops (effect-only and delay-only rules let later rules match too). Consumes one of
|
|
288
352
|
* each matching rule's remaining uses.
|
|
289
353
|
*/
|
|
290
354
|
take(candidate: FaultCandidate$1): Promise<FaultHit$1[]>;
|
|
355
|
+
/**
|
|
356
|
+
* Fire these rules at one request without storing them: no matching, no schedule, in order,
|
|
357
|
+
* stopping at the first that answers or drops. Jitter draws from the namespace's stream.
|
|
358
|
+
*/
|
|
359
|
+
fire(rules: readonly FaultRule$1[], candidate: FaultCandidate$1): Promise<FaultHit$1[]>;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* The admin controls every mock shares, as one document.
|
|
364
|
+
*
|
|
365
|
+
* The same shape is accepted in three places, and means the same thing in each:
|
|
366
|
+
*
|
|
367
|
+
* - at boot: `createRuntime({ adminControls })`, `serve --admin-controls`,
|
|
368
|
+
* `MOCKINGBIRD_ADMIN_CONTROLS`
|
|
369
|
+
* - over HTTP: `PUT /__admin/controls`
|
|
370
|
+
* - per request: the `x-mockingbird-*` headers in {@link CONTROL_HEADERS}
|
|
371
|
+
*
|
|
372
|
+
* Every control is deterministic: given the same seed, clock and requests, a mock answers
|
|
373
|
+
* the same bytes. Nothing here reads the wall clock or `Math.random`.
|
|
374
|
+
*/
|
|
375
|
+
/** Milliseconds, or a string like `"250ms"`, `"2s"`, `"15m"`, `"1h"`, `"3d"`. */
|
|
376
|
+
type Duration$1 = number | string;
|
|
377
|
+
/** Epoch milliseconds, or an ISO-8601 string. */
|
|
378
|
+
type Instant$1 = number | string;
|
|
379
|
+
type ClockControls$1 = {
|
|
380
|
+
/** Move the clock to this instant. */
|
|
381
|
+
now?: Instant$1;
|
|
382
|
+
/** Stop time. A frozen clock moves only when told to, so timestamps replay exactly. */
|
|
383
|
+
frozen?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Step the clock forward by this much before every vendor request. With a frozen clock
|
|
386
|
+
* each request still gets its own, reproducible timestamp.
|
|
387
|
+
*/
|
|
388
|
+
autoAdvance?: Duration$1;
|
|
389
|
+
};
|
|
390
|
+
/** How long a response takes: a fixed delay plus seeded jitter in `[0, jitter]`. */
|
|
391
|
+
type LatencyRuleInput$1 = {
|
|
392
|
+
delay?: Duration$1;
|
|
393
|
+
jitter?: Duration$1;
|
|
394
|
+
};
|
|
395
|
+
type LatencyControls$1 = LatencyRuleInput$1 & {
|
|
396
|
+
/** Per-operation overrides, keyed by operationId. A bare duration is its `delay`. */
|
|
397
|
+
operations?: Record<string, Duration$1 | LatencyRuleInput$1>;
|
|
398
|
+
};
|
|
399
|
+
/** A fault to add: a rule (the id is assigned when omitted), or a named preset with overrides. */
|
|
400
|
+
type FaultInput$1 = (Omit<FaultRule$1, "id"> & {
|
|
401
|
+
id?: string;
|
|
402
|
+
}) | ({
|
|
403
|
+
preset: string;
|
|
404
|
+
} & Partial<FaultRule$1>);
|
|
405
|
+
/** Identifies a {@link SnapshotDocument}. */
|
|
406
|
+
declare const SNAPSHOT_FORMAT$1 = "mockingbird.snapshot/v1";
|
|
407
|
+
/**
|
|
408
|
+
* A namespace, as portable JSON: what `GET /__admin/snapshots/:id` returns and what
|
|
409
|
+
* `PUT /__admin/snapshots/:id` and the boot `snapshot` control accept. Only `format` and
|
|
410
|
+
* `records` are required, so a hand-written seed file is a valid snapshot.
|
|
411
|
+
*/
|
|
412
|
+
type SnapshotDocument$1 = {
|
|
413
|
+
format: typeof SNAPSHOT_FORMAT$1;
|
|
414
|
+
/** The service that wrote it. A snapshot is rejected by any other service. */
|
|
415
|
+
service?: string;
|
|
416
|
+
/**
|
|
417
|
+
* Stored rows. `seq` orders a collection; omitted, rows keep their listed order. `raw` is
|
|
418
|
+
* the stored text of a row that is not a plain record, and replaces `value` when present.
|
|
419
|
+
*/
|
|
420
|
+
records: {
|
|
421
|
+
collection: string;
|
|
422
|
+
id: string;
|
|
423
|
+
seq?: number;
|
|
424
|
+
value?: unknown;
|
|
425
|
+
raw?: string;
|
|
426
|
+
}[];
|
|
427
|
+
/** Id counters, so the next generated id continues where the snapshot left off. */
|
|
428
|
+
sequences?: {
|
|
429
|
+
name: string;
|
|
430
|
+
kind: string;
|
|
431
|
+
value: number;
|
|
432
|
+
}[];
|
|
433
|
+
clock?: {
|
|
434
|
+
now: number;
|
|
435
|
+
frozen: boolean;
|
|
436
|
+
autoAdvanceMs?: number;
|
|
437
|
+
};
|
|
438
|
+
seed?: number | string;
|
|
439
|
+
/** Positions of the seeded random streams. */
|
|
440
|
+
rng?: {
|
|
441
|
+
state: number;
|
|
442
|
+
faults?: number;
|
|
443
|
+
latency?: number;
|
|
444
|
+
};
|
|
445
|
+
faults?: unknown;
|
|
446
|
+
latency?: unknown;
|
|
447
|
+
virtualTime?: boolean;
|
|
448
|
+
/** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
|
|
449
|
+
webhooks?: unknown;
|
|
450
|
+
};
|
|
451
|
+
/** Controls for one namespace. */
|
|
452
|
+
type NamespaceControls$1 = {
|
|
453
|
+
/** Seeds every random choice: fault rates, jitter, and whatever the service invents. */
|
|
454
|
+
seed?: number | string;
|
|
455
|
+
clock?: ClockControls$1;
|
|
456
|
+
/**
|
|
457
|
+
* Spend injected waits (latency, fault delays, timeouts) on the mock clock instead of the
|
|
458
|
+
* wall clock: the request returns at once, the clock has moved, and the journal records
|
|
459
|
+
* the wait exactly. Default `false`: waits are real, so a client's own timeout can fire.
|
|
460
|
+
*/
|
|
461
|
+
virtualTime?: boolean;
|
|
462
|
+
/** Baseline response time for every vendor request. A bare duration is its `delay`. */
|
|
463
|
+
latency?: Duration$1 | LatencyControls$1;
|
|
464
|
+
faults?: readonly FaultInput$1[];
|
|
465
|
+
/** Start from this state instead of the service's own seed data. */
|
|
466
|
+
snapshot?: SnapshotDocument$1;
|
|
467
|
+
};
|
|
468
|
+
/** {@link NamespaceControls} for every namespace, with per-namespace overrides. */
|
|
469
|
+
type MockControls$1 = NamespaceControls$1 & {
|
|
470
|
+
/** Vendor credential → namespace, for SDKs that cannot send a namespace header. */
|
|
471
|
+
credentials?: Record<string, string>;
|
|
472
|
+
/** Overrides for named namespaces. A key given here replaces the shared value. */
|
|
473
|
+
namespaces?: Record<string, NamespaceControls$1>;
|
|
474
|
+
};
|
|
475
|
+
/** A latency rule in milliseconds. */
|
|
476
|
+
type LatencyRule$1 = {
|
|
477
|
+
delayMs: number;
|
|
478
|
+
jitterMs: number;
|
|
479
|
+
};
|
|
480
|
+
/** Baseline latency for a namespace, normalized. */
|
|
481
|
+
type LatencyState$1 = LatencyRule$1 & {
|
|
482
|
+
operations: Record<string, LatencyRule$1>;
|
|
483
|
+
};
|
|
484
|
+
/** What {@link controlHeaders} turns into request headers. */
|
|
485
|
+
type ControlHeaderInput$1 = {
|
|
486
|
+
namespace?: string;
|
|
487
|
+
adminKey?: string;
|
|
488
|
+
branch?: string;
|
|
489
|
+
at?: string;
|
|
490
|
+
reset?: boolean;
|
|
491
|
+
restore?: string;
|
|
492
|
+
seed?: number | string;
|
|
493
|
+
time?: Instant$1 | Date;
|
|
494
|
+
advance?: Duration$1;
|
|
495
|
+
virtualTime?: boolean;
|
|
496
|
+
delay?: Duration$1;
|
|
497
|
+
timeout?: Duration$1;
|
|
498
|
+
/** A status, `"drop"`, a preset name, or a fault rule. */
|
|
499
|
+
fault?: number | string | Record<string, unknown>;
|
|
500
|
+
snapshot?: string;
|
|
291
501
|
};
|
|
292
502
|
|
|
293
503
|
/**
|
|
@@ -327,6 +537,8 @@ type RequestLog$1 = {
|
|
|
327
537
|
unmatched: boolean;
|
|
328
538
|
/** Set when a fault rule produced the response. */
|
|
329
539
|
faultId?: string;
|
|
540
|
+
/** Milliseconds of injected wait: latency, fault delays and timeouts. Absent when none. */
|
|
541
|
+
delayMs?: number;
|
|
330
542
|
/** Resource ids the handler touched (`userId`, `orderId`, …), when the service reports them. */
|
|
331
543
|
ids?: Record<string, string>;
|
|
332
544
|
/** Set when the service created a resource the request referred to but that did not exist. */
|
|
@@ -372,6 +584,12 @@ type JournalQuery$1 = {
|
|
|
372
584
|
/** Only this namespace. Omit for every namespace, oldest first across all of them. */
|
|
373
585
|
namespace?: string;
|
|
374
586
|
operationId?: string;
|
|
587
|
+
/** Only this HTTP method, case-insensitive. */
|
|
588
|
+
method?: string;
|
|
589
|
+
/** Only this exact path. */
|
|
590
|
+
path?: string;
|
|
591
|
+
/** Only requests this fault rule answered or shaped. */
|
|
592
|
+
faultId?: string;
|
|
375
593
|
status?: number;
|
|
376
594
|
/** Only entries at or after this instant (epoch ms). */
|
|
377
595
|
since?: number;
|
|
@@ -386,6 +604,50 @@ type Journal$1 = {
|
|
|
386
604
|
clear(namespace?: string): void;
|
|
387
605
|
};
|
|
388
606
|
|
|
607
|
+
/**
|
|
608
|
+
* Baseline response time, per namespace: how long every vendor request takes before any
|
|
609
|
+
* fault is considered. Jitter draws from a stream the caller owns, one per namespace and
|
|
610
|
+
* separate from the fault stream, so adding latency never shifts which requests a `rate`
|
|
611
|
+
* fault hits.
|
|
612
|
+
*/
|
|
613
|
+
type LatencyRegistry$1 = {
|
|
614
|
+
get(namespace: string): LatencyState$1;
|
|
615
|
+
set(namespace: string, state: LatencyState$1): LatencyState$1;
|
|
616
|
+
/** Remove one namespace's latency, or every namespace's. */
|
|
617
|
+
clear(namespace?: string): void;
|
|
618
|
+
/** Milliseconds this request waits. Draws jitter, so call it once per request. */
|
|
619
|
+
take(namespace: string, operationId: string | undefined): number;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
/** Clock state as the admin API reports it. */
|
|
623
|
+
type ControlClock$1 = ClockState$1 & {
|
|
624
|
+
/** `now`, as ISO-8601. */
|
|
625
|
+
iso: string;
|
|
626
|
+
/** Milliseconds the clock steps before every vendor request. */
|
|
627
|
+
autoAdvanceMs: number;
|
|
628
|
+
};
|
|
629
|
+
/** One namespace's controls: the body of `GET /__admin/controls`. */
|
|
630
|
+
type ControlState$1 = {
|
|
631
|
+
namespace: string;
|
|
632
|
+
seed: number | string;
|
|
633
|
+
clock: ControlClock$1;
|
|
634
|
+
virtualTime: boolean;
|
|
635
|
+
latency: LatencyState$1;
|
|
636
|
+
faults: FaultListing$1[];
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
/** What `GET /__admin/snapshots` lists for each snapshot. */
|
|
640
|
+
type SnapshotInfo$1 = {
|
|
641
|
+
id: string;
|
|
642
|
+
namespace: string;
|
|
643
|
+
/** Stored rows in the snapshot. */
|
|
644
|
+
records: number;
|
|
645
|
+
/** The namespace clock when it was taken, epoch ms. */
|
|
646
|
+
at: number;
|
|
647
|
+
/** Whether `GET /snapshots/:id` can return it as a {@link SnapshotDocument}. */
|
|
648
|
+
portable: boolean;
|
|
649
|
+
};
|
|
650
|
+
|
|
389
651
|
/** Credential → namespace mapping behind `PUT /__admin/credentials`. */
|
|
390
652
|
type CredentialRegistry$1 = {
|
|
391
653
|
set(credential: string, namespace: string): void;
|
|
@@ -398,6 +660,8 @@ type CredentialRegistry$1 = {
|
|
|
398
660
|
}[];
|
|
399
661
|
};
|
|
400
662
|
|
|
663
|
+
type OwnedTransport$1 = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
|
|
664
|
+
|
|
401
665
|
/**
|
|
402
666
|
* A point-in-time copy of everything a service namespace holds.
|
|
403
667
|
*
|
|
@@ -515,8 +779,16 @@ type PublishInput$1 = {
|
|
|
515
779
|
id?: string;
|
|
516
780
|
};
|
|
517
781
|
type WebhookHub$1 = {
|
|
782
|
+
observeDeliveries(listener: (event: {
|
|
783
|
+
namespace: string;
|
|
784
|
+
state: string;
|
|
785
|
+
deliveryId: string;
|
|
786
|
+
}) => void): () => void;
|
|
787
|
+
setTransportPolicy(policy: OwnedTransport$1): void;
|
|
518
788
|
pending(namespace: string): number;
|
|
519
789
|
snapshot(namespace: string): unknown;
|
|
790
|
+
exportSnapshot(handle: unknown): unknown;
|
|
791
|
+
importSnapshot(namespace: string, document: unknown): unknown;
|
|
520
792
|
restore(namespace: string, snapshot: unknown): void;
|
|
521
793
|
publish(input: PublishInput$1): WebhookMessage$1;
|
|
522
794
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
@@ -529,7 +801,7 @@ type WebhookHub$1 = {
|
|
|
529
801
|
/** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
|
|
530
802
|
flush(): Promise<void>;
|
|
531
803
|
/** Resolve once nothing is in flight. */
|
|
532
|
-
idle(): Promise<void>;
|
|
804
|
+
idle(namespace?: string): Promise<void>;
|
|
533
805
|
fault(namespace: string, fault: WebhookFault$1): void;
|
|
534
806
|
clear(namespace?: string): void;
|
|
535
807
|
};
|
|
@@ -540,7 +812,10 @@ type ServiceInstance$1 = FetchAPI$2 & {
|
|
|
540
812
|
};
|
|
541
813
|
type ServiceTimelineState$1 = Readonly<{
|
|
542
814
|
snapshot: NamespaceSnapshot$1;
|
|
543
|
-
clock
|
|
815
|
+
/** `pinned`: the namespace's clock was frozen itself, not just following a frozen base. */
|
|
816
|
+
clock: Readonly<ClockState$1 & {
|
|
817
|
+
pinned?: boolean;
|
|
818
|
+
}>;
|
|
544
819
|
rngState: number;
|
|
545
820
|
}>;
|
|
546
821
|
type ServiceCheckpoint$1 = Checkpoint$1<ServiceTimelineState$1>;
|
|
@@ -553,27 +828,63 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
|
|
|
553
828
|
readonly sqlite: SqliteClient$2;
|
|
554
829
|
readonly clock: Clock$1;
|
|
555
830
|
readonly faults: FaultRegistry$1;
|
|
831
|
+
/** Baseline response time per namespace. */
|
|
832
|
+
readonly latency: LatencyRegistry$1;
|
|
556
833
|
readonly metrics: Metrics$1;
|
|
557
834
|
readonly journal: Journal$1;
|
|
558
835
|
readonly rng: Rng$1;
|
|
559
836
|
readonly credentials: CredentialRegistry$1;
|
|
560
837
|
/** The webhook hub, when the service has outbound webhooks. */
|
|
561
838
|
readonly webhooks: WebhookHub$1 | undefined;
|
|
562
|
-
/**
|
|
563
|
-
|
|
839
|
+
/**
|
|
840
|
+
* A namespace's clock. Each follows the base clock, {@link ServiceRuntime.clock}, with an
|
|
841
|
+
* offset and a freeze of its own, so moving one never moves another.
|
|
842
|
+
*/
|
|
564
843
|
namespaceClock(namespace?: string): Clock$1;
|
|
565
844
|
namespaceOf(request: Request): string;
|
|
566
845
|
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
567
846
|
fleetSnapshot(namespace: string): object;
|
|
568
847
|
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
848
|
+
fleetExport(snapshot: unknown): SnapshotDocument$1;
|
|
849
|
+
fleetImport(namespace: string, document: unknown): object;
|
|
569
850
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
570
851
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule$1>): FaultRule$1[];
|
|
571
852
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
572
853
|
instance(namespace?: string): T;
|
|
573
854
|
/** Public names of every namespace created so far. */
|
|
574
855
|
namespaces(): string[];
|
|
575
|
-
/**
|
|
856
|
+
/** Return one namespace to its boot state, or every namespace with `"*"`. */
|
|
576
857
|
reset(namespace?: string): Promise<void>;
|
|
858
|
+
/** Reset a namespace and forget it, releasing everything it held. */
|
|
859
|
+
dropNamespace(namespace: string): Promise<void>;
|
|
860
|
+
/** A namespace's controls: seed, clock, virtual time, latency, faults and snapshots. */
|
|
861
|
+
controls(namespace?: string): ControlState$1 & {
|
|
862
|
+
snapshots: SnapshotInfo$1[];
|
|
863
|
+
};
|
|
864
|
+
/** Apply a control document to a namespace. A given key replaces that control. */
|
|
865
|
+
configure(controls: NamespaceControls$1, namespace?: string): ControlState$1 & {
|
|
866
|
+
snapshots: SnapshotInfo$1[];
|
|
867
|
+
};
|
|
868
|
+
/** Named snapshots of a namespace: records, clock, random streams, faults and latency. */
|
|
869
|
+
readonly snapshots: {
|
|
870
|
+
/** Capture the namespace now. Reusing a name replaces that snapshot. */
|
|
871
|
+
create(options?: {
|
|
872
|
+
name?: string;
|
|
873
|
+
namespace?: string;
|
|
874
|
+
}): SnapshotInfo$1;
|
|
875
|
+
list(namespace?: string): SnapshotInfo$1[];
|
|
876
|
+
/** The snapshot as portable JSON, to commit beside a suite or boot another mock from. */
|
|
877
|
+
export(id: string, namespace?: string): SnapshotDocument$1;
|
|
878
|
+
/** Store a document as a snapshot without restoring it. */
|
|
879
|
+
import(document: SnapshotDocument$1, options?: {
|
|
880
|
+
name?: string;
|
|
881
|
+
namespace?: string;
|
|
882
|
+
}): SnapshotInfo$1;
|
|
883
|
+
restore(id: string, namespace?: string): void;
|
|
884
|
+
delete(id: string, namespace?: string): boolean;
|
|
885
|
+
};
|
|
886
|
+
/** Request headers that carry controls, checked: spread them into a `fetch` or an SDK's defaults. */
|
|
887
|
+
headers(input: ControlHeaderInput$1): Record<string, string>;
|
|
577
888
|
snapshot(namespace?: string): NamespaceSnapshot$1;
|
|
578
889
|
restore(snapshot: NamespaceSnapshot$1, namespace?: string): void;
|
|
579
890
|
/** Capture the current branch. Mutating HTTP calls do this automatically. */
|
|
@@ -616,6 +927,8 @@ type CommonServeOptions = {
|
|
|
616
927
|
adminKey: string | undefined;
|
|
617
928
|
seed: string | undefined;
|
|
618
929
|
onLog: ((entry: RequestLog$1) => void) | undefined;
|
|
930
|
+
/** Admin controls to boot with: clock, latency, faults, a starting snapshot. */
|
|
931
|
+
adminControls?: MockControls$1;
|
|
619
932
|
/** Synthetic provider fixture objects supplied by a fleet entry. */
|
|
620
933
|
fixtures?: Record<string, unknown>;
|
|
621
934
|
baseUrl?: string;
|
|
@@ -626,6 +939,7 @@ type CommonServeOptions = {
|
|
|
626
939
|
* `serveTarget`, which is also how `serve --config` finds services by name.
|
|
627
940
|
*/
|
|
628
941
|
type ServeTarget = {
|
|
942
|
+
packageVersion?: string;
|
|
629
943
|
name: string;
|
|
630
944
|
defaultPort: number;
|
|
631
945
|
/** Serve flags beyond the common ones. */
|
|
@@ -1011,7 +1325,7 @@ type ClockState = {
|
|
|
1011
1325
|
now: number;
|
|
1012
1326
|
/** True while time does not advance on its own. */
|
|
1013
1327
|
frozen: boolean;
|
|
1014
|
-
/** Milliseconds
|
|
1328
|
+
/** Milliseconds a running clock adds to its underlying source. `0` while frozen. */
|
|
1015
1329
|
offsetMs: number;
|
|
1016
1330
|
};
|
|
1017
1331
|
type Clock = {
|
|
@@ -1047,7 +1361,10 @@ type Rng = {
|
|
|
1047
1361
|
state(): number;
|
|
1048
1362
|
/** Restore a state previously returned by {@link state}. */
|
|
1049
1363
|
setState(state: number): void;
|
|
1050
|
-
seed
|
|
1364
|
+
/** Restart the stream from a new seed. `reset` then returns to this seed. */
|
|
1365
|
+
reseed(seed: number | string): void;
|
|
1366
|
+
/** The seed the stream currently starts from. */
|
|
1367
|
+
readonly seed: number;
|
|
1051
1368
|
};
|
|
1052
1369
|
|
|
1053
1370
|
/**
|
|
@@ -1056,44 +1373,83 @@ type Rng = {
|
|
|
1056
1373
|
* This is how a suite reaches the vendor's failure modes without the vendor: the
|
|
1057
1374
|
* quota error that only appears when a shared sandbox is full, the 429 that only
|
|
1058
1375
|
* appears under load, the 5xx that proves a retry path works.
|
|
1376
|
+
*
|
|
1377
|
+
* A rule has three parts. What it **matches** (`operationId`, `method`, `path`, …), **when**
|
|
1378
|
+
* it fires among the matching requests (`after`, `every`, `count`, `rate`, `from`, `until`),
|
|
1379
|
+
* and what it **does** (`status`, `delay`, `timeout`, `drop`, `truncate`, `effect`).
|
|
1059
1380
|
*/
|
|
1060
1381
|
type FaultRule = {
|
|
1061
|
-
/** Stable id, so a suite can retire exactly the rule it added. */
|
|
1382
|
+
/** Stable id, so a suite can retire exactly the rule it added. Unique within a namespace. */
|
|
1062
1383
|
id: string;
|
|
1063
1384
|
/** Fault only this operation. Omit to match every operation. */
|
|
1064
1385
|
operationId?: string;
|
|
1065
1386
|
/** Fault only this HTTP method, case-insensitive. Omit to match every method. */
|
|
1066
1387
|
method?: string;
|
|
1388
|
+
/** Fault only this exact path. */
|
|
1389
|
+
path?: string;
|
|
1067
1390
|
/** Fault only paths starting with this prefix. Omit to match every path. */
|
|
1068
1391
|
pathPrefix?: string;
|
|
1392
|
+
/** Fault only paths matching this regular expression (JavaScript syntax, unanchored). */
|
|
1393
|
+
pathPattern?: string;
|
|
1394
|
+
/** Fault only requests carrying these headers. `"*"` matches any value. */
|
|
1395
|
+
requestHeaders?: Record<string, string>;
|
|
1396
|
+
/** Fault only requests carrying these query parameters. `"*"` matches any value. */
|
|
1397
|
+
query?: Record<string, string>;
|
|
1069
1398
|
/**
|
|
1070
1399
|
* Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
|
|
1071
1400
|
* an in-process caller usually wants, and what a parallel worker usually does not:
|
|
1072
1401
|
* rules added through `POST /__admin/faults` default to the calling namespace.
|
|
1073
1402
|
*/
|
|
1074
1403
|
namespace?: string;
|
|
1404
|
+
/** Let this many matching requests through first. */
|
|
1405
|
+
after?: number;
|
|
1406
|
+
/** Then fault only every nth matching request: `3` faults the 3rd, 6th, 9th. */
|
|
1407
|
+
every?: number;
|
|
1408
|
+
/** Retire the rule after this many faults. Omit to keep it until removed. */
|
|
1409
|
+
count?: number;
|
|
1410
|
+
/** Fault this fraction of the remaining requests, `0`–`1`, drawn from the seed. Default `1`. */
|
|
1411
|
+
rate?: number;
|
|
1412
|
+
/**
|
|
1413
|
+
* Fault only from this instant on the namespace clock. A duration (`"5m"`) counts from the
|
|
1414
|
+
* clock when the rule was added. Listed as epoch ms.
|
|
1415
|
+
*/
|
|
1416
|
+
from?: Instant | Duration;
|
|
1417
|
+
/** Stop faulting at this instant on the namespace clock. A duration counts from when added. */
|
|
1418
|
+
until?: Instant | Duration;
|
|
1075
1419
|
/**
|
|
1076
|
-
* Status of the injected response. Omit for a rule that only delays
|
|
1077
|
-
*
|
|
1078
|
-
* the request then still reaches the service.
|
|
1420
|
+
* Status of the injected response. Omit for a rule that only delays, times out, drops,
|
|
1421
|
+
* truncates, or switches on an `effect`: the request then still reaches the service.
|
|
1079
1422
|
*/
|
|
1080
1423
|
status?: number;
|
|
1081
1424
|
/** Response body, serialized as JSON. A string is sent as-is. */
|
|
1082
1425
|
body?: unknown;
|
|
1426
|
+
/** Response headers. */
|
|
1083
1427
|
headers?: Record<string, string>;
|
|
1084
|
-
/**
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
rate?: number;
|
|
1088
|
-
/** Hold the response back this long, to exercise timeouts. */
|
|
1428
|
+
/** Hold the response back this long. Listed as `delayMs`. */
|
|
1429
|
+
delay?: Duration;
|
|
1430
|
+
/** `delay`, in milliseconds. */
|
|
1089
1431
|
delayMs?: number;
|
|
1090
1432
|
/** Alias of `delayMs`. */
|
|
1091
1433
|
latencyMs?: number;
|
|
1434
|
+
/** Extra seeded delay in `[0, jitter]`. Listed as `jitterMs`. */
|
|
1435
|
+
jitter?: Duration;
|
|
1436
|
+
jitterMs?: number;
|
|
1437
|
+
/**
|
|
1438
|
+
* Never answer: hold the request this long, then drop the connection. Listed as
|
|
1439
|
+
* `timeoutMs`. With virtual time the wait is spent on the mock clock.
|
|
1440
|
+
*/
|
|
1441
|
+
timeout?: Duration;
|
|
1442
|
+
timeoutMs?: number;
|
|
1092
1443
|
/**
|
|
1093
1444
|
* Drop the connection instead of answering: an in-process `fetch` rejects with a
|
|
1094
1445
|
* `TypeError`, and a served mock destroys the socket. Models "unknown outcome" failures.
|
|
1095
1446
|
*/
|
|
1096
1447
|
drop?: boolean;
|
|
1448
|
+
/**
|
|
1449
|
+
* Cut the response body off after this many bytes: the status and headers arrive, then
|
|
1450
|
+
* the connection dies mid-body.
|
|
1451
|
+
*/
|
|
1452
|
+
truncate?: number;
|
|
1097
1453
|
/**
|
|
1098
1454
|
* A named service behaviour to switch on for the matching request instead of (or
|
|
1099
1455
|
* before) a canned response, e.g. `created_but_500` or `numeric_tracking_id`. Services
|
|
@@ -1102,8 +1458,8 @@ type FaultRule = {
|
|
|
1102
1458
|
effect?: string;
|
|
1103
1459
|
/** Parameters for `effect`. */
|
|
1104
1460
|
params?: Record<string, unknown>;
|
|
1105
|
-
/**
|
|
1106
|
-
|
|
1461
|
+
/** The preset this rule was expanded from, if any. */
|
|
1462
|
+
fromPreset?: string;
|
|
1107
1463
|
};
|
|
1108
1464
|
/** A fault that fired for one request. */
|
|
1109
1465
|
type FaultHit = {
|
|
@@ -1111,6 +1467,10 @@ type FaultHit = {
|
|
|
1111
1467
|
/** The injected response; absent when the rule only delays, drops, or sets an effect. */
|
|
1112
1468
|
response?: Response;
|
|
1113
1469
|
drop?: boolean;
|
|
1470
|
+
/** Set with `drop` when the rule held the request for its `timeout` first. */
|
|
1471
|
+
timeout?: boolean;
|
|
1472
|
+
/** Bytes of response body to let through before the connection dies. */
|
|
1473
|
+
truncate?: number;
|
|
1114
1474
|
effect?: {
|
|
1115
1475
|
name: string;
|
|
1116
1476
|
params: Record<string, unknown>;
|
|
@@ -1135,38 +1495,202 @@ type FaultCandidate = {
|
|
|
1135
1495
|
method: string;
|
|
1136
1496
|
path: string;
|
|
1137
1497
|
namespace: string;
|
|
1498
|
+
/** Request headers and query, for rules that match on them. */
|
|
1499
|
+
headers?: Headers;
|
|
1500
|
+
query?: URLSearchParams;
|
|
1501
|
+
/** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
|
|
1502
|
+
now?: number;
|
|
1503
|
+
/** How to spend a delay for this request. Default: the registry's own sleep. */
|
|
1504
|
+
wait?: (ms: number) => Promise<void>;
|
|
1505
|
+
};
|
|
1506
|
+
/** A stored rule and how often it was consulted. */
|
|
1507
|
+
type FaultListing = FaultRule & {
|
|
1508
|
+
/** Faults left before the rule retires. `null` when it has no `count`. */
|
|
1509
|
+
remaining: number | null;
|
|
1510
|
+
/** Times the rule faulted a request. */
|
|
1511
|
+
hits: number;
|
|
1512
|
+
/** Requests that matched the rule, faulted or not. */
|
|
1513
|
+
seen: number;
|
|
1514
|
+
};
|
|
1515
|
+
/** A namespace's own rules, with their counters, in the order they are tried. */
|
|
1516
|
+
type FaultSnapshot = {
|
|
1517
|
+
/**
|
|
1518
|
+
* `position` is how many `"*"` rules are tried before the rule, which is what its place
|
|
1519
|
+
* in the order means to a request and holds in any process.
|
|
1520
|
+
*/
|
|
1521
|
+
rules: (FaultListing & {
|
|
1522
|
+
position?: number;
|
|
1523
|
+
})[];
|
|
1524
|
+
/** How many `fault_<n>` ids the namespace has handed out. */
|
|
1525
|
+
nextId?: number;
|
|
1138
1526
|
};
|
|
1139
1527
|
type FaultRegistry = {
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
rules: (FaultRule & {
|
|
1143
|
-
remaining: number | null;
|
|
1144
|
-
hits: number;
|
|
1145
|
-
position: number;
|
|
1146
|
-
})[];
|
|
1147
|
-
rngState: number;
|
|
1148
|
-
};
|
|
1528
|
+
snapshot(namespace: string): FaultSnapshot;
|
|
1529
|
+
/** Add a rule, or replace the rule with the same id in the same namespace. */
|
|
1149
1530
|
add(rule: FaultRule): FaultRule;
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
})[];
|
|
1162
|
-
rngState: number;
|
|
1163
|
-
}): void;
|
|
1531
|
+
/** The next unused `fault_<n>` id in `namespace`. */
|
|
1532
|
+
nextId(namespace: string): string;
|
|
1533
|
+
/** Every rule, or the rules a namespace's requests can hit: its own and the global ones. */
|
|
1534
|
+
list(namespace?: string): FaultListing[];
|
|
1535
|
+
get(id: string, namespace?: string): FaultListing | undefined;
|
|
1536
|
+
/** Remove a rule by id: from `namespace` (its own, then a global one), or wherever it is. */
|
|
1537
|
+
remove(id: string, namespace?: string): boolean;
|
|
1538
|
+
/** Remove every rule, or one namespace's own rules. */
|
|
1539
|
+
clear(namespace?: string): void;
|
|
1540
|
+
/** Replace a namespace's own rules with a snapshot's, wherever the snapshot was taken. */
|
|
1541
|
+
restore(namespace: string, state: FaultSnapshot): void;
|
|
1164
1542
|
/**
|
|
1165
1543
|
* Every fault this request should get, in rule order, stopping at the first that answers
|
|
1166
1544
|
* or drops (effect-only and delay-only rules let later rules match too). Consumes one of
|
|
1167
1545
|
* each matching rule's remaining uses.
|
|
1168
1546
|
*/
|
|
1169
1547
|
take(candidate: FaultCandidate): Promise<FaultHit[]>;
|
|
1548
|
+
/**
|
|
1549
|
+
* Fire these rules at one request without storing them: no matching, no schedule, in order,
|
|
1550
|
+
* stopping at the first that answers or drops. Jitter draws from the namespace's stream.
|
|
1551
|
+
*/
|
|
1552
|
+
fire(rules: readonly FaultRule[], candidate: FaultCandidate): Promise<FaultHit[]>;
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* The admin controls every mock shares, as one document.
|
|
1557
|
+
*
|
|
1558
|
+
* The same shape is accepted in three places, and means the same thing in each:
|
|
1559
|
+
*
|
|
1560
|
+
* - at boot: `createRuntime({ adminControls })`, `serve --admin-controls`,
|
|
1561
|
+
* `MOCKINGBIRD_ADMIN_CONTROLS`
|
|
1562
|
+
* - over HTTP: `PUT /__admin/controls`
|
|
1563
|
+
* - per request: the `x-mockingbird-*` headers in {@link CONTROL_HEADERS}
|
|
1564
|
+
*
|
|
1565
|
+
* Every control is deterministic: given the same seed, clock and requests, a mock answers
|
|
1566
|
+
* the same bytes. Nothing here reads the wall clock or `Math.random`.
|
|
1567
|
+
*/
|
|
1568
|
+
/** Milliseconds, or a string like `"250ms"`, `"2s"`, `"15m"`, `"1h"`, `"3d"`. */
|
|
1569
|
+
type Duration = number | string;
|
|
1570
|
+
/** Epoch milliseconds, or an ISO-8601 string. */
|
|
1571
|
+
type Instant = number | string;
|
|
1572
|
+
type ClockControls = {
|
|
1573
|
+
/** Move the clock to this instant. */
|
|
1574
|
+
now?: Instant;
|
|
1575
|
+
/** Stop time. A frozen clock moves only when told to, so timestamps replay exactly. */
|
|
1576
|
+
frozen?: boolean;
|
|
1577
|
+
/**
|
|
1578
|
+
* Step the clock forward by this much before every vendor request. With a frozen clock
|
|
1579
|
+
* each request still gets its own, reproducible timestamp.
|
|
1580
|
+
*/
|
|
1581
|
+
autoAdvance?: Duration;
|
|
1582
|
+
};
|
|
1583
|
+
/** How long a response takes: a fixed delay plus seeded jitter in `[0, jitter]`. */
|
|
1584
|
+
type LatencyRuleInput = {
|
|
1585
|
+
delay?: Duration;
|
|
1586
|
+
jitter?: Duration;
|
|
1587
|
+
};
|
|
1588
|
+
type LatencyControls = LatencyRuleInput & {
|
|
1589
|
+
/** Per-operation overrides, keyed by operationId. A bare duration is its `delay`. */
|
|
1590
|
+
operations?: Record<string, Duration | LatencyRuleInput>;
|
|
1591
|
+
};
|
|
1592
|
+
/** A fault to add: a rule (the id is assigned when omitted), or a named preset with overrides. */
|
|
1593
|
+
type FaultInput = (Omit<FaultRule, "id"> & {
|
|
1594
|
+
id?: string;
|
|
1595
|
+
}) | ({
|
|
1596
|
+
preset: string;
|
|
1597
|
+
} & Partial<FaultRule>);
|
|
1598
|
+
/** Identifies a {@link SnapshotDocument}. */
|
|
1599
|
+
declare const SNAPSHOT_FORMAT = "mockingbird.snapshot/v1";
|
|
1600
|
+
/**
|
|
1601
|
+
* A namespace, as portable JSON: what `GET /__admin/snapshots/:id` returns and what
|
|
1602
|
+
* `PUT /__admin/snapshots/:id` and the boot `snapshot` control accept. Only `format` and
|
|
1603
|
+
* `records` are required, so a hand-written seed file is a valid snapshot.
|
|
1604
|
+
*/
|
|
1605
|
+
type SnapshotDocument = {
|
|
1606
|
+
format: typeof SNAPSHOT_FORMAT;
|
|
1607
|
+
/** The service that wrote it. A snapshot is rejected by any other service. */
|
|
1608
|
+
service?: string;
|
|
1609
|
+
/**
|
|
1610
|
+
* Stored rows. `seq` orders a collection; omitted, rows keep their listed order. `raw` is
|
|
1611
|
+
* the stored text of a row that is not a plain record, and replaces `value` when present.
|
|
1612
|
+
*/
|
|
1613
|
+
records: {
|
|
1614
|
+
collection: string;
|
|
1615
|
+
id: string;
|
|
1616
|
+
seq?: number;
|
|
1617
|
+
value?: unknown;
|
|
1618
|
+
raw?: string;
|
|
1619
|
+
}[];
|
|
1620
|
+
/** Id counters, so the next generated id continues where the snapshot left off. */
|
|
1621
|
+
sequences?: {
|
|
1622
|
+
name: string;
|
|
1623
|
+
kind: string;
|
|
1624
|
+
value: number;
|
|
1625
|
+
}[];
|
|
1626
|
+
clock?: {
|
|
1627
|
+
now: number;
|
|
1628
|
+
frozen: boolean;
|
|
1629
|
+
autoAdvanceMs?: number;
|
|
1630
|
+
};
|
|
1631
|
+
seed?: number | string;
|
|
1632
|
+
/** Positions of the seeded random streams. */
|
|
1633
|
+
rng?: {
|
|
1634
|
+
state: number;
|
|
1635
|
+
faults?: number;
|
|
1636
|
+
latency?: number;
|
|
1637
|
+
};
|
|
1638
|
+
faults?: unknown;
|
|
1639
|
+
latency?: unknown;
|
|
1640
|
+
virtualTime?: boolean;
|
|
1641
|
+
/** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
|
|
1642
|
+
webhooks?: unknown;
|
|
1643
|
+
};
|
|
1644
|
+
/** Controls for one namespace. */
|
|
1645
|
+
type NamespaceControls = {
|
|
1646
|
+
/** Seeds every random choice: fault rates, jitter, and whatever the service invents. */
|
|
1647
|
+
seed?: number | string;
|
|
1648
|
+
clock?: ClockControls;
|
|
1649
|
+
/**
|
|
1650
|
+
* Spend injected waits (latency, fault delays, timeouts) on the mock clock instead of the
|
|
1651
|
+
* wall clock: the request returns at once, the clock has moved, and the journal records
|
|
1652
|
+
* the wait exactly. Default `false`: waits are real, so a client's own timeout can fire.
|
|
1653
|
+
*/
|
|
1654
|
+
virtualTime?: boolean;
|
|
1655
|
+
/** Baseline response time for every vendor request. A bare duration is its `delay`. */
|
|
1656
|
+
latency?: Duration | LatencyControls;
|
|
1657
|
+
faults?: readonly FaultInput[];
|
|
1658
|
+
/** Start from this state instead of the service's own seed data. */
|
|
1659
|
+
snapshot?: SnapshotDocument;
|
|
1660
|
+
};
|
|
1661
|
+
/** {@link NamespaceControls} for every namespace, with per-namespace overrides. */
|
|
1662
|
+
type MockControls = NamespaceControls & {
|
|
1663
|
+
/** Vendor credential → namespace, for SDKs that cannot send a namespace header. */
|
|
1664
|
+
credentials?: Record<string, string>;
|
|
1665
|
+
/** Overrides for named namespaces. A key given here replaces the shared value. */
|
|
1666
|
+
namespaces?: Record<string, NamespaceControls>;
|
|
1667
|
+
};
|
|
1668
|
+
/** A latency rule in milliseconds. */
|
|
1669
|
+
type LatencyRule = {
|
|
1670
|
+
delayMs: number;
|
|
1671
|
+
jitterMs: number;
|
|
1672
|
+
};
|
|
1673
|
+
/** Baseline latency for a namespace, normalized. */
|
|
1674
|
+
type LatencyState = LatencyRule & {
|
|
1675
|
+
operations: Record<string, LatencyRule>;
|
|
1676
|
+
};
|
|
1677
|
+
/** What {@link controlHeaders} turns into request headers. */
|
|
1678
|
+
type ControlHeaderInput = {
|
|
1679
|
+
namespace?: string;
|
|
1680
|
+
adminKey?: string;
|
|
1681
|
+
branch?: string;
|
|
1682
|
+
at?: string;
|
|
1683
|
+
reset?: boolean;
|
|
1684
|
+
restore?: string;
|
|
1685
|
+
seed?: number | string;
|
|
1686
|
+
time?: Instant | Date;
|
|
1687
|
+
advance?: Duration;
|
|
1688
|
+
virtualTime?: boolean;
|
|
1689
|
+
delay?: Duration;
|
|
1690
|
+
timeout?: Duration;
|
|
1691
|
+
/** A status, `"drop"`, a preset name, or a fault rule. */
|
|
1692
|
+
fault?: number | string | Record<string, unknown>;
|
|
1693
|
+
snapshot?: string;
|
|
1170
1694
|
};
|
|
1171
1695
|
|
|
1172
1696
|
/**
|
|
@@ -1206,6 +1730,8 @@ type RequestLog = {
|
|
|
1206
1730
|
unmatched: boolean;
|
|
1207
1731
|
/** Set when a fault rule produced the response. */
|
|
1208
1732
|
faultId?: string;
|
|
1733
|
+
/** Milliseconds of injected wait: latency, fault delays and timeouts. Absent when none. */
|
|
1734
|
+
delayMs?: number;
|
|
1209
1735
|
/** Resource ids the handler touched (`userId`, `orderId`, …), when the service reports them. */
|
|
1210
1736
|
ids?: Record<string, string>;
|
|
1211
1737
|
/** Set when the service created a resource the request referred to but that did not exist. */
|
|
@@ -1251,6 +1777,12 @@ type JournalQuery = {
|
|
|
1251
1777
|
/** Only this namespace. Omit for every namespace, oldest first across all of them. */
|
|
1252
1778
|
namespace?: string;
|
|
1253
1779
|
operationId?: string;
|
|
1780
|
+
/** Only this HTTP method, case-insensitive. */
|
|
1781
|
+
method?: string;
|
|
1782
|
+
/** Only this exact path. */
|
|
1783
|
+
path?: string;
|
|
1784
|
+
/** Only requests this fault rule answered or shaped. */
|
|
1785
|
+
faultId?: string;
|
|
1254
1786
|
status?: number;
|
|
1255
1787
|
/** Only entries at or after this instant (epoch ms). */
|
|
1256
1788
|
since?: number;
|
|
@@ -1265,6 +1797,38 @@ type Journal = {
|
|
|
1265
1797
|
clear(namespace?: string): void;
|
|
1266
1798
|
};
|
|
1267
1799
|
|
|
1800
|
+
/**
|
|
1801
|
+
* Baseline response time, per namespace: how long every vendor request takes before any
|
|
1802
|
+
* fault is considered. Jitter draws from a stream the caller owns, one per namespace and
|
|
1803
|
+
* separate from the fault stream, so adding latency never shifts which requests a `rate`
|
|
1804
|
+
* fault hits.
|
|
1805
|
+
*/
|
|
1806
|
+
type LatencyRegistry = {
|
|
1807
|
+
get(namespace: string): LatencyState;
|
|
1808
|
+
set(namespace: string, state: LatencyState): LatencyState;
|
|
1809
|
+
/** Remove one namespace's latency, or every namespace's. */
|
|
1810
|
+
clear(namespace?: string): void;
|
|
1811
|
+
/** Milliseconds this request waits. Draws jitter, so call it once per request. */
|
|
1812
|
+
take(namespace: string, operationId: string | undefined): number;
|
|
1813
|
+
};
|
|
1814
|
+
|
|
1815
|
+
/** Clock state as the admin API reports it. */
|
|
1816
|
+
type ControlClock = ClockState & {
|
|
1817
|
+
/** `now`, as ISO-8601. */
|
|
1818
|
+
iso: string;
|
|
1819
|
+
/** Milliseconds the clock steps before every vendor request. */
|
|
1820
|
+
autoAdvanceMs: number;
|
|
1821
|
+
};
|
|
1822
|
+
/** One namespace's controls: the body of `GET /__admin/controls`. */
|
|
1823
|
+
type ControlState = {
|
|
1824
|
+
namespace: string;
|
|
1825
|
+
seed: number | string;
|
|
1826
|
+
clock: ControlClock;
|
|
1827
|
+
virtualTime: boolean;
|
|
1828
|
+
latency: LatencyState;
|
|
1829
|
+
faults: FaultListing[];
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1268
1832
|
type AdminRequest = {
|
|
1269
1833
|
request: Request;
|
|
1270
1834
|
url: URL;
|
|
@@ -1281,6 +1845,17 @@ type AdminRoute = (request: AdminRequest) => Response | Promise<Response>;
|
|
|
1281
1845
|
* `:param` segments — e.g. `"POST /orders/:id/transition"`.
|
|
1282
1846
|
*/
|
|
1283
1847
|
type AdminRoutes = Record<string, AdminRoute>;
|
|
1848
|
+
/** What `GET /__admin/snapshots` lists for each snapshot. */
|
|
1849
|
+
type SnapshotInfo = {
|
|
1850
|
+
id: string;
|
|
1851
|
+
namespace: string;
|
|
1852
|
+
/** Stored rows in the snapshot. */
|
|
1853
|
+
records: number;
|
|
1854
|
+
/** The namespace clock when it was taken, epoch ms. */
|
|
1855
|
+
at: number;
|
|
1856
|
+
/** Whether `GET /snapshots/:id` can return it as a {@link SnapshotDocument}. */
|
|
1857
|
+
portable: boolean;
|
|
1858
|
+
};
|
|
1284
1859
|
|
|
1285
1860
|
/** Credential → namespace mapping behind `PUT /__admin/credentials`. */
|
|
1286
1861
|
type CredentialRegistry = {
|
|
@@ -1294,6 +1869,8 @@ type CredentialRegistry = {
|
|
|
1294
1869
|
}[];
|
|
1295
1870
|
};
|
|
1296
1871
|
|
|
1872
|
+
type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
|
|
1873
|
+
|
|
1297
1874
|
/**
|
|
1298
1875
|
* A point-in-time copy of everything a service namespace holds.
|
|
1299
1876
|
*
|
|
@@ -1480,8 +2057,16 @@ type PublishInput = {
|
|
|
1480
2057
|
id?: string;
|
|
1481
2058
|
};
|
|
1482
2059
|
type WebhookHub = {
|
|
2060
|
+
observeDeliveries(listener: (event: {
|
|
2061
|
+
namespace: string;
|
|
2062
|
+
state: string;
|
|
2063
|
+
deliveryId: string;
|
|
2064
|
+
}) => void): () => void;
|
|
2065
|
+
setTransportPolicy(policy: OwnedTransport): void;
|
|
1483
2066
|
pending(namespace: string): number;
|
|
1484
2067
|
snapshot(namespace: string): unknown;
|
|
2068
|
+
exportSnapshot(handle: unknown): unknown;
|
|
2069
|
+
importSnapshot(namespace: string, document: unknown): unknown;
|
|
1485
2070
|
restore(namespace: string, snapshot: unknown): void;
|
|
1486
2071
|
publish(input: PublishInput): WebhookMessage;
|
|
1487
2072
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
@@ -1494,7 +2079,7 @@ type WebhookHub = {
|
|
|
1494
2079
|
/** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
|
|
1495
2080
|
flush(): Promise<void>;
|
|
1496
2081
|
/** Resolve once nothing is in flight. */
|
|
1497
|
-
idle(): Promise<void>;
|
|
2082
|
+
idle(namespace?: string): Promise<void>;
|
|
1498
2083
|
fault(namespace: string, fault: WebhookFault): void;
|
|
1499
2084
|
clear(namespace?: string): void;
|
|
1500
2085
|
};
|
|
@@ -1525,14 +2110,26 @@ type RuntimeOptions<T extends ServiceInstance> = {
|
|
|
1525
2110
|
sqlite?: SqliteClient$1;
|
|
1526
2111
|
/** Defaults to a live clock over `Date.now`. */
|
|
1527
2112
|
clock?: Clock;
|
|
1528
|
-
/** Seeds every random choice the runtime makes (fault rates). Default `0`. */
|
|
2113
|
+
/** Seeds every random choice the runtime makes (fault rates, jitter). Default `0`. */
|
|
1529
2114
|
seed?: number | string;
|
|
2115
|
+
/**
|
|
2116
|
+
* Admin controls to boot with: clock, latency, faults, a starting snapshot, credential
|
|
2117
|
+
* mappings and per-namespace overrides. `reset` returns a namespace to exactly this.
|
|
2118
|
+
*/
|
|
2119
|
+
adminControls?: MockControls;
|
|
1530
2120
|
/** Extra `GET /__admin/health` fields, such as the loaded corpus version. */
|
|
1531
2121
|
describe?: () => Record<string, unknown>;
|
|
1532
2122
|
/** Service-specific admin routes, given the runtime so they can reach any namespace. */
|
|
1533
2123
|
admin?: (runtime: ServiceRuntime<T>) => AdminRoutes;
|
|
1534
2124
|
/** Reserved tree for every internal HTTP endpoint, UI and namespace carrier. Default /__admin. */
|
|
1535
2125
|
adminPrefix?: string;
|
|
2126
|
+
/**
|
|
2127
|
+
* A namespace's clock was moved — by `/__admin/clock`, a header, a restore, a reset, or a
|
|
2128
|
+
* wait spent in virtual time. Run whatever the service schedules by that clock, so what
|
|
2129
|
+
* came due is seen at once and not on the next request. Moving the base clock in process
|
|
2130
|
+
* (`runtime.clock`) is the caller's own doing and is not reported here.
|
|
2131
|
+
*/
|
|
2132
|
+
onClockChange?: (namespace: string) => void;
|
|
1536
2133
|
/** Invalidate transient handles before replacing an existing instance's stored state. */
|
|
1537
2134
|
beforeRestore?: (instance: T) => void;
|
|
1538
2135
|
/** Require this value in `x-mockingbird-admin-key` on admin data routes. */
|
|
@@ -1550,7 +2147,10 @@ type RuntimeOptions<T extends ServiceInstance> = {
|
|
|
1550
2147
|
* `sigV4AccessKeyId`.
|
|
1551
2148
|
*/
|
|
1552
2149
|
credential?: (request: Request) => string | undefined;
|
|
1553
|
-
/**
|
|
2150
|
+
/**
|
|
2151
|
+
* Named faults, switched on with `POST /__admin/faults {"preset": "<name>"}`. They join the
|
|
2152
|
+
* standard presets every mock has; one with a standard name replaces it.
|
|
2153
|
+
*/
|
|
1554
2154
|
presets?: Record<string, FaultPreset>;
|
|
1555
2155
|
/** Outbound webhooks; adds the `/__admin/webhooks*` routes and clears on reset. */
|
|
1556
2156
|
webhooks?: WebhookHub;
|
|
@@ -1573,11 +2173,15 @@ type RuntimeOptions<T extends ServiceInstance> = {
|
|
|
1573
2173
|
type RuntimeIO = {
|
|
1574
2174
|
wallNow(): number;
|
|
1575
2175
|
monotonicNow(): number;
|
|
1576
|
-
|
|
2176
|
+
/** Wait on the wall clock. Rejects with the signal's reason when it aborts first. */
|
|
2177
|
+
sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
1577
2178
|
};
|
|
1578
2179
|
type ServiceTimelineState = Readonly<{
|
|
1579
2180
|
snapshot: NamespaceSnapshot;
|
|
1580
|
-
clock
|
|
2181
|
+
/** `pinned`: the namespace's clock was frozen itself, not just following a frozen base. */
|
|
2182
|
+
clock: Readonly<ClockState & {
|
|
2183
|
+
pinned?: boolean;
|
|
2184
|
+
}>;
|
|
1581
2185
|
rngState: number;
|
|
1582
2186
|
}>;
|
|
1583
2187
|
type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
|
|
@@ -1590,27 +2194,63 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
|
1590
2194
|
readonly sqlite: SqliteClient$1;
|
|
1591
2195
|
readonly clock: Clock;
|
|
1592
2196
|
readonly faults: FaultRegistry;
|
|
2197
|
+
/** Baseline response time per namespace. */
|
|
2198
|
+
readonly latency: LatencyRegistry;
|
|
1593
2199
|
readonly metrics: Metrics;
|
|
1594
2200
|
readonly journal: Journal;
|
|
1595
2201
|
readonly rng: Rng;
|
|
1596
2202
|
readonly credentials: CredentialRegistry;
|
|
1597
2203
|
/** The webhook hub, when the service has outbound webhooks. */
|
|
1598
2204
|
readonly webhooks: WebhookHub | undefined;
|
|
1599
|
-
/**
|
|
1600
|
-
|
|
2205
|
+
/**
|
|
2206
|
+
* A namespace's clock. Each follows the base clock, {@link ServiceRuntime.clock}, with an
|
|
2207
|
+
* offset and a freeze of its own, so moving one never moves another.
|
|
2208
|
+
*/
|
|
1601
2209
|
namespaceClock(namespace?: string): Clock;
|
|
1602
2210
|
namespaceOf(request: Request): string;
|
|
1603
2211
|
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
1604
2212
|
fleetSnapshot(namespace: string): object;
|
|
1605
2213
|
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
2214
|
+
fleetExport(snapshot: unknown): SnapshotDocument;
|
|
2215
|
+
fleetImport(namespace: string, document: unknown): object;
|
|
1606
2216
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
1607
2217
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
|
|
1608
2218
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
1609
2219
|
instance(namespace?: string): T;
|
|
1610
2220
|
/** Public names of every namespace created so far. */
|
|
1611
2221
|
namespaces(): string[];
|
|
1612
|
-
/**
|
|
2222
|
+
/** Return one namespace to its boot state, or every namespace with `"*"`. */
|
|
1613
2223
|
reset(namespace?: string): Promise<void>;
|
|
2224
|
+
/** Reset a namespace and forget it, releasing everything it held. */
|
|
2225
|
+
dropNamespace(namespace: string): Promise<void>;
|
|
2226
|
+
/** A namespace's controls: seed, clock, virtual time, latency, faults and snapshots. */
|
|
2227
|
+
controls(namespace?: string): ControlState & {
|
|
2228
|
+
snapshots: SnapshotInfo[];
|
|
2229
|
+
};
|
|
2230
|
+
/** Apply a control document to a namespace. A given key replaces that control. */
|
|
2231
|
+
configure(controls: NamespaceControls, namespace?: string): ControlState & {
|
|
2232
|
+
snapshots: SnapshotInfo[];
|
|
2233
|
+
};
|
|
2234
|
+
/** Named snapshots of a namespace: records, clock, random streams, faults and latency. */
|
|
2235
|
+
readonly snapshots: {
|
|
2236
|
+
/** Capture the namespace now. Reusing a name replaces that snapshot. */
|
|
2237
|
+
create(options?: {
|
|
2238
|
+
name?: string;
|
|
2239
|
+
namespace?: string;
|
|
2240
|
+
}): SnapshotInfo;
|
|
2241
|
+
list(namespace?: string): SnapshotInfo[];
|
|
2242
|
+
/** The snapshot as portable JSON, to commit beside a suite or boot another mock from. */
|
|
2243
|
+
export(id: string, namespace?: string): SnapshotDocument;
|
|
2244
|
+
/** Store a document as a snapshot without restoring it. */
|
|
2245
|
+
import(document: SnapshotDocument, options?: {
|
|
2246
|
+
name?: string;
|
|
2247
|
+
namespace?: string;
|
|
2248
|
+
}): SnapshotInfo;
|
|
2249
|
+
restore(id: string, namespace?: string): void;
|
|
2250
|
+
delete(id: string, namespace?: string): boolean;
|
|
2251
|
+
};
|
|
2252
|
+
/** Request headers that carry controls, checked: spread them into a `fetch` or an SDK's defaults. */
|
|
2253
|
+
headers(input: ControlHeaderInput): Record<string, string>;
|
|
1614
2254
|
snapshot(namespace?: string): NamespaceSnapshot;
|
|
1615
2255
|
restore(snapshot: NamespaceSnapshot, namespace?: string): void;
|
|
1616
2256
|
/** Capture the current branch. Mutating HTTP calls do this automatically. */
|
|
@@ -1752,7 +2392,7 @@ declare class DockerLifecycle {
|
|
|
1752
2392
|
cancelWaits(): void;
|
|
1753
2393
|
}
|
|
1754
2394
|
|
|
1755
|
-
type DockerRuntimeOptions = Pick<RuntimeOptions<DockerAPI>, "sqlite" | "clock" | "seed" | "adminKey" | "onLog" | "journalSize" | "maxCheckpoints"> & Pick<DockerAPIOptions, "onAttach">;
|
|
2395
|
+
type DockerRuntimeOptions = Pick<RuntimeOptions<DockerAPI>, "sqlite" | "clock" | "seed" | "adminKey" | "adminControls" | "onLog" | "journalSize" | "maxCheckpoints"> & Pick<DockerAPIOptions, "onAttach">;
|
|
1756
2396
|
type DockerRuntime = ServiceRuntime<DockerAPI> & {
|
|
1757
2397
|
close(): void;
|
|
1758
2398
|
};
|