@crvouga/mockingbird-service-resend 3.5.0 → 3.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/CHANGELOG.md +13 -1
- package/dist/{chunk-ZB42MLNS.js → chunk-WUSDDKWD.js} +315 -51
- package/dist/chunk-WUSDDKWD.js.map +7 -0
- package/dist/{chunk-KPX5JPKL.js → chunk-XGCASVDX.js} +117 -33
- package/dist/chunk-XGCASVDX.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +28 -0
- package/dist/index.js +1 -1
- package/dist/server.d.ts +69 -0
- package/dist/server.js +2 -2
- package/openapi.yaml +2 -4
- package/package.json +1 -1
- package/dist/chunk-KPX5JPKL.js.map +0 -7
- package/dist/chunk-ZB42MLNS.js.map +0 -7
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -274,6 +274,12 @@ declare class Collection<T> {
|
|
|
274
274
|
}>;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
/**
|
|
278
|
+
* What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
|
|
279
|
+
* which derives the base from the wall clock when the runtime is created.
|
|
280
|
+
*/
|
|
281
|
+
type IdBase = number | string;
|
|
282
|
+
|
|
277
283
|
/** Options every provider constructor accepts. */
|
|
278
284
|
type APIOptions = {
|
|
279
285
|
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
@@ -369,6 +375,15 @@ type FaultRule = {
|
|
|
369
375
|
requestHeaders?: Record<string, string>;
|
|
370
376
|
/** Fault only requests carrying these query parameters. `"*"` matches any value. */
|
|
371
377
|
query?: Record<string, string>;
|
|
378
|
+
/**
|
|
379
|
+
* Fault only requests whose JSON body carries these fields. Each key is a dotted path into
|
|
380
|
+
* the parsed body (`"patient_details.email"`; a number steps into an array, `"items.0.sku"`)
|
|
381
|
+
* and each value is what the field must equal: a string, number, boolean or `null`, compared
|
|
382
|
+
* strictly (`3` is not `"3"`). `"*"` matches any value that is present. A request whose body
|
|
383
|
+
* is missing, is not JSON, or is not a JSON object never matches. Not `body`, which is the
|
|
384
|
+
* response a rule injects.
|
|
385
|
+
*/
|
|
386
|
+
requestBody?: Record<string, RequestBodyValue>;
|
|
372
387
|
/**
|
|
373
388
|
* Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
|
|
374
389
|
* an in-process caller usually wants, and what a parallel worker usually does not:
|
|
@@ -435,6 +450,8 @@ type FaultRule = {
|
|
|
435
450
|
/** The preset this rule was expanded from, if any. */
|
|
436
451
|
fromPreset?: string;
|
|
437
452
|
};
|
|
453
|
+
/** What a field of the request body must equal in {@link FaultRule.requestBody}. */
|
|
454
|
+
type RequestBodyValue = string | number | boolean | null;
|
|
438
455
|
/** A fault that fired for one request. */
|
|
439
456
|
type FaultHit = {
|
|
440
457
|
id: string;
|
|
@@ -472,6 +489,11 @@ type FaultCandidate = {
|
|
|
472
489
|
/** Request headers and query, for rules that match on them. */
|
|
473
490
|
headers?: Headers;
|
|
474
491
|
query?: URLSearchParams;
|
|
492
|
+
/**
|
|
493
|
+
* The request body parsed as JSON, read only when a rule matches on `requestBody`. Resolve
|
|
494
|
+
* `undefined` for a body that is missing or not JSON. It must leave the request readable.
|
|
495
|
+
*/
|
|
496
|
+
readJson?: () => Promise<unknown>;
|
|
475
497
|
/** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
|
|
476
498
|
now?: number;
|
|
477
499
|
/** How to spend a delay for this request. Default: the registry's own sleep. */
|
|
@@ -1012,6 +1034,12 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
|
1012
1034
|
mount(prefix: string): MountedAPI;
|
|
1013
1035
|
readonly sqlite: SqliteClient$1;
|
|
1014
1036
|
readonly clock: Clock;
|
|
1037
|
+
/**
|
|
1038
|
+
* Change the id base ({@link RuntimeOptions.idBase}) for ids generated from now on, and
|
|
1039
|
+
* return the number it resolved to. Set it before the first request so a boot's ids stay
|
|
1040
|
+
* one run.
|
|
1041
|
+
*/
|
|
1042
|
+
setIdBase(base: IdBase): number;
|
|
1015
1043
|
readonly faults: FaultRegistry;
|
|
1016
1044
|
/** Baseline response time per namespace. */
|
|
1017
1045
|
readonly latency: LatencyRegistry;
|
package/dist/index.js
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -133,6 +133,12 @@ interface SqliteClient$3 {
|
|
|
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$3;
|
|
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,6 +1166,12 @@ 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;
|
|
1174
|
+
|
|
1128
1175
|
/** Options every provider constructor accepts. */
|
|
1129
1176
|
type APIOptions$1 = {
|
|
1130
1177
|
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
@@ -1220,6 +1267,15 @@ type FaultRule = {
|
|
|
1220
1267
|
requestHeaders?: Record<string, string>;
|
|
1221
1268
|
/** Fault only requests carrying these query parameters. `"*"` matches any value. */
|
|
1222
1269
|
query?: Record<string, string>;
|
|
1270
|
+
/**
|
|
1271
|
+
* Fault only requests whose JSON body carries these fields. Each key is a dotted path into
|
|
1272
|
+
* the parsed body (`"patient_details.email"`; a number steps into an array, `"items.0.sku"`)
|
|
1273
|
+
* and each value is what the field must equal: a string, number, boolean or `null`, compared
|
|
1274
|
+
* strictly (`3` is not `"3"`). `"*"` matches any value that is present. A request whose body
|
|
1275
|
+
* is missing, is not JSON, or is not a JSON object never matches. Not `body`, which is the
|
|
1276
|
+
* response a rule injects.
|
|
1277
|
+
*/
|
|
1278
|
+
requestBody?: Record<string, RequestBodyValue>;
|
|
1223
1279
|
/**
|
|
1224
1280
|
* Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
|
|
1225
1281
|
* an in-process caller usually wants, and what a parallel worker usually does not:
|
|
@@ -1286,6 +1342,8 @@ type FaultRule = {
|
|
|
1286
1342
|
/** The preset this rule was expanded from, if any. */
|
|
1287
1343
|
fromPreset?: string;
|
|
1288
1344
|
};
|
|
1345
|
+
/** What a field of the request body must equal in {@link FaultRule.requestBody}. */
|
|
1346
|
+
type RequestBodyValue = string | number | boolean | null;
|
|
1289
1347
|
/** A fault that fired for one request. */
|
|
1290
1348
|
type FaultHit = {
|
|
1291
1349
|
id: string;
|
|
@@ -1310,6 +1368,11 @@ type FaultCandidate = {
|
|
|
1310
1368
|
/** Request headers and query, for rules that match on them. */
|
|
1311
1369
|
headers?: Headers;
|
|
1312
1370
|
query?: URLSearchParams;
|
|
1371
|
+
/**
|
|
1372
|
+
* The request body parsed as JSON, read only when a rule matches on `requestBody`. Resolve
|
|
1373
|
+
* `undefined` for a body that is missing or not JSON. It must leave the request readable.
|
|
1374
|
+
*/
|
|
1375
|
+
readJson?: () => Promise<unknown>;
|
|
1313
1376
|
/** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
|
|
1314
1377
|
now?: number;
|
|
1315
1378
|
/** How to spend a delay for this request. Default: the registry's own sleep. */
|
|
@@ -1850,6 +1913,12 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
1850
1913
|
mount(prefix: string): MountedAPI;
|
|
1851
1914
|
readonly sqlite: SqliteClient$2;
|
|
1852
1915
|
readonly clock: Clock;
|
|
1916
|
+
/**
|
|
1917
|
+
* Change the id base ({@link RuntimeOptions.idBase}) for ids generated from now on, and
|
|
1918
|
+
* return the number it resolved to. Set it before the first request so a boot's ids stay
|
|
1919
|
+
* one run.
|
|
1920
|
+
*/
|
|
1921
|
+
setIdBase(base: IdBase): number;
|
|
1853
1922
|
readonly faults: FaultRegistry;
|
|
1854
1923
|
/** Baseline response time per namespace. */
|
|
1855
1924
|
readonly latency: LatencyRegistry;
|
package/dist/server.js
CHANGED
package/openapi.yaml
CHANGED
|
@@ -1080,12 +1080,10 @@
|
|
|
1080
1080
|
"maxLength": 200
|
|
1081
1081
|
},
|
|
1082
1082
|
"html": {
|
|
1083
|
-
"type": "string"
|
|
1084
|
-
"maxLength": 5000
|
|
1083
|
+
"type": "string"
|
|
1085
1084
|
},
|
|
1086
1085
|
"text": {
|
|
1087
|
-
"type": "string"
|
|
1088
|
-
"maxLength": 5000
|
|
1086
|
+
"type": "string"
|
|
1089
1087
|
},
|
|
1090
1088
|
"cc": {
|
|
1091
1089
|
"$ref": "#/components/schemas/Recipients"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-resend",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Stateful emulator of the Resend email API (send with idempotency, received emails, attachments) with an outbox and Svix-signed inbound webhooks (Mockingbird service contract).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|