@schmock/core 2.1.6 → 2.2.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/index.d.ts +24 -16
- package/dist/interceptor.js +1 -1
- package/package.json +1 -1
- package/src/interceptor.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -132,7 +132,16 @@ namespace Schmock {
|
|
|
132
132
|
contentType?: string;
|
|
133
133
|
/** Per-route response delay in ms, or [min, max] for random delay (overrides global) */
|
|
134
134
|
delay?: number | [number, number];
|
|
135
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* Extension point for plugin-specific metadata.
|
|
137
|
+
*
|
|
138
|
+
* Intentionally open: `@schmock/openapi` stores "openapi:*" keys here
|
|
139
|
+
* (e.g. `"openapi:operationId"`, `"openapi:tags"`), and third-party plugins
|
|
140
|
+
* may do the same. Removing this signature would be a breaking change.
|
|
141
|
+
*
|
|
142
|
+
* **Known tradeoff:** typos in known keys (e.g. `{ contenType: "…" }`) compile
|
|
143
|
+
* silently. Prefer using the explicitly typed properties above when possible.
|
|
144
|
+
*/
|
|
136
145
|
[key: string]: unknown;
|
|
137
146
|
}
|
|
138
147
|
|
|
@@ -287,8 +296,7 @@ namespace Schmock {
|
|
|
287
296
|
* @param path - Filter by request path
|
|
288
297
|
* @returns Array of request records
|
|
289
298
|
*/
|
|
290
|
-
history(): RequestRecord[];
|
|
291
|
-
history(method: HttpMethod, path: string): RequestRecord[];
|
|
299
|
+
history(method?: HttpMethod, path?: string): RequestRecord[];
|
|
292
300
|
|
|
293
301
|
/**
|
|
294
302
|
* Check if any request was made, optionally for a specific route
|
|
@@ -297,8 +305,7 @@ namespace Schmock {
|
|
|
297
305
|
* @param path - Filter by request path
|
|
298
306
|
* @returns true if at least one matching request was recorded
|
|
299
307
|
*/
|
|
300
|
-
called(): boolean;
|
|
301
|
-
called(method: HttpMethod, path: string): boolean;
|
|
308
|
+
called(method?: HttpMethod, path?: string): boolean;
|
|
302
309
|
|
|
303
310
|
/**
|
|
304
311
|
* Get the number of recorded requests, optionally for a specific route
|
|
@@ -307,8 +314,7 @@ namespace Schmock {
|
|
|
307
314
|
* @param path - Filter by request path
|
|
308
315
|
* @returns Number of matching requests
|
|
309
316
|
*/
|
|
310
|
-
callCount(): number;
|
|
311
|
-
callCount(method: HttpMethod, path: string): number;
|
|
317
|
+
callCount(method?: HttpMethod, path?: string): number;
|
|
312
318
|
|
|
313
319
|
/**
|
|
314
320
|
* Get the most recent request, optionally for a specific route
|
|
@@ -317,8 +323,7 @@ namespace Schmock {
|
|
|
317
323
|
* @param path - Filter by request path
|
|
318
324
|
* @returns Most recent matching request record, or undefined
|
|
319
325
|
*/
|
|
320
|
-
lastRequest(): RequestRecord | undefined;
|
|
321
|
-
lastRequest(method: HttpMethod, path: string): RequestRecord | undefined;
|
|
326
|
+
lastRequest(method?: HttpMethod, path?: string): RequestRecord | undefined;
|
|
322
327
|
|
|
323
328
|
// ===== Reset / Lifecycle =====
|
|
324
329
|
|
|
@@ -408,6 +413,15 @@ namespace Schmock {
|
|
|
408
413
|
pageSize?: number;
|
|
409
414
|
}
|
|
410
415
|
|
|
416
|
+
/**
|
|
417
|
+
* Shape returned by the core `paginate()` helper (packages/core/src/helpers.ts).
|
|
418
|
+
*
|
|
419
|
+
* **Note:** the `@schmock/query` plugin produces a DIFFERENT nested shape:
|
|
420
|
+
* ```ts
|
|
421
|
+
* { data: T[]; pagination: { page: number; limit: number; total: number; totalPages: number } }
|
|
422
|
+
* ```
|
|
423
|
+
* Do not assume this type describes query-plugin responses.
|
|
424
|
+
*/
|
|
411
425
|
interface PaginatedResponse<T> {
|
|
412
426
|
data: T[];
|
|
413
427
|
page: number;
|
|
@@ -577,13 +591,7 @@ namespace Schmock {
|
|
|
577
591
|
/**
|
|
578
592
|
* Override parts of a request before Schmock handles it
|
|
579
593
|
*/
|
|
580
|
-
|
|
581
|
-
method?: string;
|
|
582
|
-
path?: string;
|
|
583
|
-
headers?: Record<string, string>;
|
|
584
|
-
body?: unknown;
|
|
585
|
-
query?: Record<string, string>;
|
|
586
|
-
}
|
|
594
|
+
type AdapterRequestOverride = Partial<AdapterRequest>;
|
|
587
595
|
|
|
588
596
|
/**
|
|
589
597
|
* Configuration options for Express adapter
|
package/dist/interceptor.js
CHANGED
package/package.json
CHANGED
package/src/interceptor.ts
CHANGED