@zimic/interceptor 0.16.0-canary.2 → 0.16.0-canary.3

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/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "api",
15
15
  "static"
16
16
  ],
17
- "version": "0.16.0-canary.2",
17
+ "version": "0.16.0-canary.3",
18
18
  "repository": {
19
19
  "type": "git",
20
20
  "url": "https://github.com/zimicjs/zimic.git",
@@ -97,10 +97,10 @@
97
97
  "tsup": "^8.4.0",
98
98
  "typescript": "^5.8.2",
99
99
  "vitest": "^3.0.8",
100
- "@zimic/eslint-config-node": "0.0.0",
101
100
  "@zimic/lint-staged-config": "0.0.0",
102
101
  "@zimic/tsconfig": "0.0.0",
103
- "@zimic/utils": "0.0.0"
102
+ "@zimic/utils": "0.0.0",
103
+ "@zimic/eslint-config-node": "0.0.0"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "@zimic/http": "^0.1.0 || ^0.1.0-canary.0",
package/src/http/index.ts CHANGED
@@ -1,5 +1,3 @@
1
- import HttpInterceptorNamespace from './namespace/HttpInterceptorNamespace';
2
-
3
1
  export { default as InvalidJSONError } from './interceptorWorker/errors/InvalidJSONError';
4
2
  export { default as InvalidFormDataError } from './interceptorWorker/errors/InvalidFormDataError';
5
3
  export { default as RunningHttpInterceptorError } from './interceptor/errors/RunningHttpInterceptorError';
@@ -49,11 +47,4 @@ export type { InferHttpInterceptorSchema } from './interceptor/types/schema';
49
47
 
50
48
  export type { LocalHttpInterceptor, RemoteHttpInterceptor, HttpInterceptor } from './interceptor/types/public';
51
49
 
52
- /**
53
- * A namespace of interceptor resources for mocking HTTP requests.
54
- *
55
- * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptor `HttpInterceptor` API reference}
56
- */
57
- export const httpInterceptor = Object.freeze(new HttpInterceptorNamespace());
58
-
59
- export type { default as HttpInterceptorNamespace } from './namespace/HttpInterceptorNamespace';
50
+ export { createHttpInterceptor } from './interceptor/factory';
@@ -24,7 +24,7 @@ function isRemoteHttpInterceptorOptions(options: HttpInterceptorOptions) {
24
24
  * @returns The created HTTP interceptor.
25
25
  * @throws {InvalidURLError} If the base URL is invalid.
26
26
  * @throws {UnsupportedURLProtocolError} If the base URL protocol is not either `http` or `https`.
27
- * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions `httpInterceptor.create(options)` API reference}
27
+ * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions `createHttpInterceptor(options)` API reference}
28
28
  */
29
29
  export function createHttpInterceptor<Schema extends HttpSchema>(
30
30
  options: LocalHttpInterceptorOptions,
@@ -177,6 +177,6 @@ export interface RemoteHttpInterceptorOptions extends SharedHttpInterceptorOptio
177
177
  * The options to create an
178
178
  * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptor HTTP interceptor}.
179
179
  *
180
- * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions `httpInterceptor.create(options)` API reference}
180
+ * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions `createHttpInterceptor(options)` API reference}
181
181
  */
182
182
  export type HttpInterceptorOptions = LocalHttpInterceptorOptions | RemoteHttpInterceptorOptions;
@@ -86,7 +86,7 @@ export interface HttpInterceptor<_Schema extends HttpSchema> {
86
86
  * of each test.
87
87
  *
88
88
  * When
89
- * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions `saveRequests: true`}
89
+ * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions `saveRequests: true`}
90
90
  * is enabled in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
91
91
  * expected and received data. This is useful for debugging requests that did not match a handler with
92
92
  * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction restrictions}.
@@ -5,9 +5,9 @@ import { LocalHttpInterceptor, RemoteHttpInterceptor } from './public';
5
5
  * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptor `HttpInterceptor`}.
6
6
  *
7
7
  * @example
8
- * import { httpInterceptor, type InferHttpInterceptorSchema } from '@zimic/http';
8
+ * import { type InferHttpInterceptorSchema } from '@zimic/http';
9
9
  *
10
- * const interceptor = httpInterceptor.create<{
10
+ * const interceptor = createHttpInterceptor<{
11
11
  * '/users': {
12
12
  * GET: {
13
13
  * response: { 200: { body: User[] } };
@@ -147,7 +147,7 @@ export interface LocalHttpRequestHandler<
147
147
  * that was not satisfied.
148
148
  *
149
149
  * When
150
- * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions `saveRequests: true`}
150
+ * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions `saveRequests: true`}
151
151
  * is enabled in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
152
152
  * expected and received data. This is useful for debugging requests that did not match a handler with
153
153
  * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction restrictions}.
@@ -284,7 +284,7 @@ export interface SyncedRemoteHttpRequestHandler<
284
284
  * that was not satisfied.
285
285
  *
286
286
  * When
287
- * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions `saveRequests: true`}
287
+ * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions `saveRequests: true`}
288
288
  * is enabled in your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the
289
289
  * expected and received data. This is useful for debugging requests that did not match a handler with
290
290
  * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#http-handlerwithrestriction restrictions}.
@@ -1,21 +0,0 @@
1
- import { createHttpInterceptor } from '../interceptor/factory';
2
-
3
- /**
4
- * A namespace of interceptor resources for mocking HTTP requests.
5
- *
6
- * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptor `HttpInterceptor` API reference}
7
- */
8
- class HttpInterceptorNamespace {
9
- /**
10
- * Creates an HTTP interceptor.
11
- *
12
- * @param options The options for the interceptor.
13
- * @returns The created HTTP interceptor.
14
- * @throws {InvalidURLError} If the base URL is invalid.
15
- * @throws {UnsupportedURLProtocolError} If the base URL protocol is not either `http` or `https`.
16
- * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions `httpInterceptor.create(options)` API reference}
17
- */
18
- create = createHttpInterceptor;
19
- }
20
-
21
- export default HttpInterceptorNamespace;