@zimic/interceptor 0.14.0 → 0.15.0-canary.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/README.md +1 -1
- package/dist/{chunk-3623PRKE.js → chunk-L6Y4EV6T.js} +2 -2
- package/dist/chunk-L6Y4EV6T.js.map +1 -0
- package/dist/{chunk-FEGMEAEO.mjs → chunk-YGJD3JT6.mjs} +2 -2
- package/dist/chunk-YGJD3JT6.mjs.map +1 -0
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/http.d.ts +11 -5
- package/dist/http.js.map +1 -1
- package/dist/http.mjs.map +1 -1
- package/dist/server.js +5 -5
- package/dist/server.mjs +1 -1
- package/package.json +3 -3
- package/src/http/index.ts +14 -1
- package/src/http/requestHandler/HttpRequestHandlerClient.ts +5 -4
- package/src/http/requestHandler/LocalHttpRequestHandler.ts +2 -2
- package/src/http/requestHandler/RemoteHttpRequestHandler.ts +2 -2
- package/src/http/requestHandler/types/public.ts +5 -3
- package/src/http/requestHandler/types/requests.ts +1 -1
- package/dist/chunk-3623PRKE.js.map +0 -1
- package/dist/chunk-FEGMEAEO.mjs.map +0 -1
package/dist/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpMethodSchema, HttpRequest, HttpHeaders, HttpRequestHeadersSchema, InferPathParams, HttpSearchParams, HttpRequestSearchParamsSchema, HttpRequestBodySchema,
|
|
1
|
+
import { HttpMethodSchema, HttpStatusCode, HttpRequest, HttpHeaders, HttpRequestHeadersSchema, InferPathParams, HttpSearchParams, HttpRequestSearchParamsSchema, HttpRequestBodySchema, HttpResponse, HttpResponseHeadersSchema, HttpResponseBodySchema, HttpResponseSchema, HttpHeadersInit, HttpSchema, HttpBody, HttpSchemaMethod, HttpSchemaPath, HttpHeadersSchema, HttpSearchParamsSchema, HttpFormData, HttpResponseSchemaStatusCode, HttpMethod, LiteralHttpSchemaPathFromNonLiteral } from '@zimic/http';
|
|
2
2
|
|
|
3
3
|
type Default<Type, IfEmpty = never> = [undefined | void] extends [Type] ? IfEmpty : Exclude<Type, undefined | void>;
|
|
4
4
|
type IfNever<Type, Yes, No = Type> = [Type] extends [never] ? Yes : No;
|
|
@@ -73,7 +73,7 @@ interface HttpInterceptorResponse<MethodSchema extends HttpMethodSchema, StatusC
|
|
|
73
73
|
* A strict representation of an intercepted HTTP request, along with its response. The body, search params and path
|
|
74
74
|
* params are already parsed by default.
|
|
75
75
|
*/
|
|
76
|
-
interface
|
|
76
|
+
interface InterceptedHttpInterceptorRequest<Path extends string, MethodSchema extends HttpMethodSchema, StatusCode extends HttpStatusCode = never> extends HttpInterceptorRequest<Path, MethodSchema> {
|
|
77
77
|
/** The response that was returned for the intercepted request. */
|
|
78
78
|
response: StatusCode extends [never] ? never : HttpInterceptorResponse<MethodSchema, StatusCode>;
|
|
79
79
|
}
|
|
@@ -457,7 +457,7 @@ interface LocalHttpRequestHandler<Schema extends HttpSchema, Method extends Http
|
|
|
457
457
|
* @throws {DisabledRequestSavingError} If the interceptor was not created with `saveRequests: true`.
|
|
458
458
|
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerrequests `handler.requests()` API reference}
|
|
459
459
|
*/
|
|
460
|
-
requests: () => readonly
|
|
460
|
+
requests: () => readonly InterceptedHttpInterceptorRequest<Path, Default<Schema[Path][Method]>, StatusCode>[];
|
|
461
461
|
}
|
|
462
462
|
/**
|
|
463
463
|
* A synced remote HTTP request handler. When a remote handler is synced, it is guaranteed that all of the mocking
|
|
@@ -571,7 +571,7 @@ interface SyncedRemoteHttpRequestHandler<Schema extends HttpSchema, Method exten
|
|
|
571
571
|
* @throws {DisabledRequestSavingError} If the interceptor was not created with `saveRequests: true`.
|
|
572
572
|
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerrequests `handler.requests()` API reference}
|
|
573
573
|
*/
|
|
574
|
-
requests: () => Promise<readonly
|
|
574
|
+
requests: () => Promise<readonly InterceptedHttpInterceptorRequest<Path, Default<Schema[Path][Method]>, StatusCode>[]>;
|
|
575
575
|
}
|
|
576
576
|
/**
|
|
577
577
|
* A pending remote HTTP request handler. When a remote handler is pending, it is not guaranteed that all of the mocking
|
|
@@ -1284,6 +1284,12 @@ declare class TimesCheckError extends TypeError {
|
|
|
1284
1284
|
*/
|
|
1285
1285
|
type InferHttpInterceptorSchema<Interceptor> = Interceptor extends LocalHttpInterceptor<infer Schema> ? Schema : Interceptor extends RemoteHttpInterceptor<infer Schema> ? Schema : never;
|
|
1286
1286
|
|
|
1287
|
+
/**
|
|
1288
|
+
* @deprecated This type was renamed to {@link InterceptedHttpInterceptorRequest `InterceptedHttpInterceptorRequest`}.
|
|
1289
|
+
* Please use it instead.
|
|
1290
|
+
*/
|
|
1291
|
+
type TrackedHttpInterceptorRequest<Path extends string, MethodSchema extends HttpMethodSchema, StatusCode extends HttpStatusCode = never> = InterceptedHttpInterceptorRequest<Path, MethodSchema, StatusCode>;
|
|
1292
|
+
|
|
1287
1293
|
/**
|
|
1288
1294
|
* A namespace of interceptor resources for mocking HTTP requests.
|
|
1289
1295
|
*
|
|
@@ -1291,4 +1297,4 @@ type InferHttpInterceptorSchema<Interceptor> = Interceptor extends LocalHttpInte
|
|
|
1291
1297
|
*/
|
|
1292
1298
|
declare const httpInterceptor: Readonly<HttpInterceptorNamespace>;
|
|
1293
1299
|
|
|
1294
|
-
export { DisabledRequestSavingError, type HttpInterceptor, HttpInterceptorNamespace, HttpInterceptorNamespaceDefault, type HttpInterceptorOptions, type HttpInterceptorPlatform, type HttpInterceptorRequest, type HttpInterceptorResponse, type HttpInterceptorType, type HttpRequestHandler, type HttpRequestHandlerBodyStaticRestriction, type HttpRequestHandlerComputedRestriction, type HttpRequestHandlerHeadersStaticRestriction, type HttpRequestHandlerResponseDeclaration, type HttpRequestHandlerResponseDeclarationFactory, type HttpRequestHandlerRestriction, type HttpRequestHandlerSearchParamsStaticRestriction, type HttpRequestHandlerStaticRestriction, type InferHttpInterceptorSchema, InvalidFormDataError, InvalidJSONError, type LocalHttpInterceptor, type LocalHttpInterceptorOptions, type LocalHttpRequestHandler, NotStartedHttpInterceptorError, type PendingRemoteHttpRequestHandler, type RemoteHttpInterceptor, type RemoteHttpInterceptorOptions, type RemoteHttpRequestHandler, type SyncedRemoteHttpRequestHandler, TimesCheckError, type TrackedHttpInterceptorRequest, type UnhandledHttpInterceptorRequest, UnhandledRequestStrategy, UnknownHttpInterceptorPlatformError, UnknownHttpInterceptorTypeError, UnregisteredBrowserServiceWorkerError, httpInterceptor };
|
|
1300
|
+
export { DisabledRequestSavingError, type HttpInterceptor, HttpInterceptorNamespace, HttpInterceptorNamespaceDefault, type HttpInterceptorOptions, type HttpInterceptorPlatform, type HttpInterceptorRequest, type HttpInterceptorResponse, type HttpInterceptorType, type HttpRequestHandler, type HttpRequestHandlerBodyStaticRestriction, type HttpRequestHandlerComputedRestriction, type HttpRequestHandlerHeadersStaticRestriction, type HttpRequestHandlerResponseDeclaration, type HttpRequestHandlerResponseDeclarationFactory, type HttpRequestHandlerRestriction, type HttpRequestHandlerSearchParamsStaticRestriction, type HttpRequestHandlerStaticRestriction, type InferHttpInterceptorSchema, type InterceptedHttpInterceptorRequest, InvalidFormDataError, InvalidJSONError, type LocalHttpInterceptor, type LocalHttpInterceptorOptions, type LocalHttpRequestHandler, NotStartedHttpInterceptorError, type PendingRemoteHttpRequestHandler, type RemoteHttpInterceptor, type RemoteHttpInterceptorOptions, type RemoteHttpRequestHandler, type SyncedRemoteHttpRequestHandler, TimesCheckError, type TrackedHttpInterceptorRequest, type UnhandledHttpInterceptorRequest, UnhandledRequestStrategy, UnknownHttpInterceptorPlatformError, UnknownHttpInterceptorTypeError, UnregisteredBrowserServiceWorkerError, httpInterceptor };
|