@zimic/interceptor 1.5.1 → 1.5.2-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/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/http.d.ts +7 -3
- package/dist/http.js +19 -1
- package/dist/http.js.map +1 -1
- package/dist/http.mjs +19 -1
- package/dist/http.mjs.map +1 -1
- package/package.json +10 -10
- package/src/http/interceptor/errors/UnknownHttpInterceptorPlatformError.ts +3 -1
- package/src/http/interceptor/factory.ts +3 -0
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"api",
|
|
15
15
|
"static"
|
|
16
16
|
],
|
|
17
|
-
"version": "1.5.
|
|
17
|
+
"version": "1.5.2-canary.0",
|
|
18
18
|
"homepage": "https://zimic.dev/docs/interceptor",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -100,29 +100,29 @@
|
|
|
100
100
|
"isomorphic-ws": "5.0.0",
|
|
101
101
|
"msw": "2.15.0",
|
|
102
102
|
"picocolors": "^1.1.1",
|
|
103
|
-
"ws": "8.21.
|
|
103
|
+
"ws": "8.21.3",
|
|
104
104
|
"yargs": "18.1.0",
|
|
105
|
-
"zod": "^4.
|
|
105
|
+
"zod": "^4.5.1"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
|
-
"@types/node": "^26.
|
|
108
|
+
"@types/node": "^26.4.0",
|
|
109
109
|
"@types/ws": "^8.18.1",
|
|
110
110
|
"@types/yargs": "^17.0.35",
|
|
111
111
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
112
|
-
"@vitest/browser": "^4.1.
|
|
113
|
-
"@vitest/browser-playwright": "^4.1.
|
|
114
|
-
"@vitest/coverage-istanbul": "^4.1.
|
|
112
|
+
"@vitest/browser": "^4.1.11",
|
|
113
|
+
"@vitest/browser-playwright": "^4.1.11",
|
|
114
|
+
"@vitest/coverage-istanbul": "^4.1.11",
|
|
115
115
|
"@zimic/eslint-config-node": "workspace:*",
|
|
116
116
|
"@zimic/lint-staged-config": "workspace:*",
|
|
117
117
|
"@zimic/tsconfig": "workspace:*",
|
|
118
118
|
"@zimic/utils": "workspace:*",
|
|
119
|
-
"concurrently": "^10.0.
|
|
119
|
+
"concurrently": "^10.0.5",
|
|
120
120
|
"dotenv-cli": "^11.0.0",
|
|
121
121
|
"eslint": "^9.39.5",
|
|
122
|
-
"playwright": "^1.62.
|
|
122
|
+
"playwright": "^1.62.1",
|
|
123
123
|
"tsup": "^8.5.1",
|
|
124
124
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
125
|
-
"vitest": "^4.1.
|
|
125
|
+
"vitest": "^4.1.11"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
128
|
"@zimic/http": "workspace:^1.2.0",
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { ValidationError } from '@zimic/utils/validation';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* An error thrown when an unknown interceptor platform is detected. Currently, the platforms `node` and `browser` are
|
|
3
5
|
* supported.
|
|
4
6
|
*
|
|
5
7
|
* @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorplatform `interceptor.platform` API reference}
|
|
6
8
|
*/
|
|
7
|
-
class UnknownHttpInterceptorPlatformError extends
|
|
9
|
+
class UnknownHttpInterceptorPlatformError extends ValidationError {
|
|
8
10
|
/* istanbul ignore next -- @preserve
|
|
9
11
|
* Ignoring because checking unknown platforms is currently not possible in our Vitest setup. */
|
|
10
12
|
constructor() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpSchema } from '@zimic/http';
|
|
2
|
+
import { assertTypeOf } from '@zimic/utils/validation';
|
|
2
3
|
|
|
3
4
|
import UnknownHttpInterceptorTypeError from './errors/UnknownHttpInterceptorTypeError';
|
|
4
5
|
import LocalHttpInterceptor from './LocalHttpInterceptor';
|
|
@@ -30,6 +31,8 @@ export function createHttpInterceptor<Schema extends HttpSchema>(
|
|
|
30
31
|
export function createHttpInterceptor<Schema extends HttpSchema>(
|
|
31
32
|
options: HttpInterceptorOptions,
|
|
32
33
|
): PublicLocalHttpInterceptor<Schema> | PublicRemoteHttpInterceptor<Schema> {
|
|
34
|
+
assertTypeOf('options.baseURL', options.baseURL, 'string');
|
|
35
|
+
|
|
33
36
|
const type = options.type;
|
|
34
37
|
|
|
35
38
|
if (isLocalHttpInterceptorOptions(options)) {
|