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

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 CHANGED
@@ -141,12 +141,12 @@ Check our [getting started guide](https://github.com/zimicjs/zimic/wiki/getting
141
141
  generate types for your HTTP schema.
142
142
 
143
143
  2. Create your
144
- [interceptor](https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#httpinterceptorcreateoptions):
144
+ [interceptor](https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http#createhttpinterceptoroptions):
145
145
 
146
146
  ```ts
147
- import { httpInterceptor } from '@zimic/interceptor/http';
147
+ import { createHttpInterceptor } from '@zimic/interceptor/http';
148
148
 
149
- const interceptor = httpInterceptor.create<Schema>({
149
+ const interceptor = createHttpInterceptor<Schema>({
150
150
  type: 'local',
151
151
  baseURL: 'http://localhost:3000',
152
152
  saveRequests: true, // Allow access to `handler.requests`
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkWCQVDF3K_js = require('./chunk-WCQVDF3K.js');
4
+ var http = require('@zimic/http');
4
5
  var server = require('@whatwg-node/server');
5
6
  var http$1 = require('http');
6
- var http = require('@zimic/http');
7
7
  var chalk2 = require('chalk');
8
8
  var ClientSocket = require('isomorphic-ws');
9
9
 
@@ -12,6 +12,247 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
  var chalk2__default = /*#__PURE__*/_interopDefault(chalk2);
13
13
  var ClientSocket__default = /*#__PURE__*/_interopDefault(ClientSocket);
14
14
 
15
+ // src/server/errors/RunningInterceptorServerError.ts
16
+ var RunningInterceptorServerError = class extends Error {
17
+ static {
18
+ chunkWCQVDF3K_js.__name(this, "RunningInterceptorServerError");
19
+ }
20
+ constructor(additionalMessage) {
21
+ super(`The interceptor server is running.${additionalMessage}`);
22
+ this.name = "RunningInterceptorServerError";
23
+ }
24
+ };
25
+ var RunningInterceptorServerError_default = RunningInterceptorServerError;
26
+
27
+ // src/server/errors/NotRunningInterceptorServerError.ts
28
+ var NotRunningInterceptorServerError = class extends Error {
29
+ static {
30
+ chunkWCQVDF3K_js.__name(this, "NotRunningInterceptorServerError");
31
+ }
32
+ constructor() {
33
+ super("The interceptor server is not running. Did you forget to start it?");
34
+ this.name = "NotRunningInterceptorServerError";
35
+ }
36
+ };
37
+ var NotRunningInterceptorServerError_default = NotRunningInterceptorServerError;
38
+ var HttpServerTimeoutError = class extends Error {
39
+ static {
40
+ chunkWCQVDF3K_js.__name(this, "HttpServerTimeoutError");
41
+ }
42
+ };
43
+ var HttpServerStartTimeoutError = class extends HttpServerTimeoutError {
44
+ static {
45
+ chunkWCQVDF3K_js.__name(this, "HttpServerStartTimeoutError");
46
+ }
47
+ constructor(reachedTimeout) {
48
+ super(`HTTP server start timed out after ${reachedTimeout}ms.`);
49
+ this.name = "HttpServerStartTimeout";
50
+ }
51
+ };
52
+ var HttpServerStopTimeoutError = class extends HttpServerTimeoutError {
53
+ static {
54
+ chunkWCQVDF3K_js.__name(this, "HttpServerStopTimeoutError");
55
+ }
56
+ constructor(reachedTimeout) {
57
+ super(`HTTP server stop timed out after ${reachedTimeout}ms.`);
58
+ this.name = "HttpServerStopTimeout";
59
+ }
60
+ };
61
+ var DEFAULT_HTTP_SERVER_LIFECYCLE_TIMEOUT = 60 * 1e3;
62
+ async function startHttpServer(server, options = {}) {
63
+ const { hostname, port, timeout: timeoutDuration = DEFAULT_HTTP_SERVER_LIFECYCLE_TIMEOUT } = options;
64
+ await new Promise((resolve, reject) => {
65
+ function handleStartError(error) {
66
+ server.off("listening", handleStartSuccess);
67
+ reject(error);
68
+ }
69
+ chunkWCQVDF3K_js.__name(handleStartError, "handleStartError");
70
+ const startTimeout = setTimeout(() => {
71
+ const timeoutError = new HttpServerStartTimeoutError(timeoutDuration);
72
+ handleStartError(timeoutError);
73
+ }, timeoutDuration);
74
+ function handleStartSuccess() {
75
+ server.off("error", handleStartError);
76
+ clearTimeout(startTimeout);
77
+ resolve();
78
+ }
79
+ chunkWCQVDF3K_js.__name(handleStartSuccess, "handleStartSuccess");
80
+ server.once("error", handleStartError);
81
+ server.listen(port, hostname, handleStartSuccess);
82
+ });
83
+ }
84
+ chunkWCQVDF3K_js.__name(startHttpServer, "startHttpServer");
85
+ async function stopHttpServer(server, options = {}) {
86
+ const { timeout: timeoutDuration = DEFAULT_HTTP_SERVER_LIFECYCLE_TIMEOUT } = options;
87
+ if (!server.listening) {
88
+ return;
89
+ }
90
+ await new Promise((resolve, reject) => {
91
+ const stopTimeout = setTimeout(() => {
92
+ const timeoutError = new HttpServerStopTimeoutError(timeoutDuration);
93
+ reject(timeoutError);
94
+ }, timeoutDuration);
95
+ server.close((error) => {
96
+ clearTimeout(stopTimeout);
97
+ if (error) {
98
+ reject(error);
99
+ } else {
100
+ resolve();
101
+ }
102
+ });
103
+ server.closeAllConnections();
104
+ });
105
+ }
106
+ chunkWCQVDF3K_js.__name(stopHttpServer, "stopHttpServer");
107
+ function getHttpServerPort(server) {
108
+ const address = server.address();
109
+ if (typeof address === "string") {
110
+ return void 0;
111
+ } else {
112
+ return address?.port;
113
+ }
114
+ }
115
+ chunkWCQVDF3K_js.__name(getHttpServerPort, "getHttpServerPort");
116
+ function methodCanHaveResponseBody(method) {
117
+ const methodsToCompare = http.HTTP_METHODS_WITH_RESPONSE_BODY;
118
+ return methodsToCompare.includes(method);
119
+ }
120
+ chunkWCQVDF3K_js.__name(methodCanHaveResponseBody, "methodCanHaveResponseBody");
121
+
122
+ // src/utils/webSocket.ts
123
+ var WebSocketTimeoutError = class extends Error {
124
+ static {
125
+ chunkWCQVDF3K_js.__name(this, "WebSocketTimeoutError");
126
+ }
127
+ };
128
+ var WebSocketOpenTimeoutError = class extends WebSocketTimeoutError {
129
+ static {
130
+ chunkWCQVDF3K_js.__name(this, "WebSocketOpenTimeoutError");
131
+ }
132
+ constructor(reachedTimeout) {
133
+ super(`Web socket open timed out after ${reachedTimeout}ms.`);
134
+ this.name = "WebSocketOpenTimeout";
135
+ }
136
+ };
137
+ var WebSocketMessageTimeoutError = class extends WebSocketTimeoutError {
138
+ static {
139
+ chunkWCQVDF3K_js.__name(this, "WebSocketMessageTimeoutError");
140
+ }
141
+ constructor(reachedTimeout) {
142
+ super(`Web socket message timed out after ${reachedTimeout}ms.`);
143
+ this.name = "WebSocketMessageTimeout";
144
+ }
145
+ };
146
+ var WebSocketMessageAbortError = class extends WebSocketTimeoutError {
147
+ static {
148
+ chunkWCQVDF3K_js.__name(this, "WebSocketMessageAbortError");
149
+ }
150
+ constructor() {
151
+ super("Web socket message was aborted.");
152
+ this.name = "WebSocketMessageAbortError";
153
+ }
154
+ };
155
+ var WebSocketCloseTimeoutError = class extends WebSocketTimeoutError {
156
+ static {
157
+ chunkWCQVDF3K_js.__name(this, "WebSocketCloseTimeoutError");
158
+ }
159
+ constructor(reachedTimeout) {
160
+ super(`Web socket close timed out after ${reachedTimeout}ms.`);
161
+ this.name = "WebSocketCloseTimeout";
162
+ }
163
+ };
164
+ var DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT = 60 * 1e3;
165
+ var DEFAULT_WEB_SOCKET_MESSAGE_TIMEOUT = 3 * 60 * 1e3;
166
+ async function waitForOpenClientSocket(socket, options = {}) {
167
+ const { timeout: timeoutDuration = DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT } = options;
168
+ const isAlreadyOpen = socket.readyState === socket.OPEN;
169
+ if (isAlreadyOpen) {
170
+ return;
171
+ }
172
+ await new Promise((resolve, reject) => {
173
+ function handleOpenError(error) {
174
+ socket.removeEventListener("open", handleOpenSuccess);
175
+ reject(error);
176
+ }
177
+ chunkWCQVDF3K_js.__name(handleOpenError, "handleOpenError");
178
+ const openTimeout = setTimeout(() => {
179
+ const timeoutError = new WebSocketOpenTimeoutError(timeoutDuration);
180
+ handleOpenError(timeoutError);
181
+ }, timeoutDuration);
182
+ function handleOpenSuccess() {
183
+ socket.removeEventListener("error", handleOpenError);
184
+ clearTimeout(openTimeout);
185
+ resolve();
186
+ }
187
+ chunkWCQVDF3K_js.__name(handleOpenSuccess, "handleOpenSuccess");
188
+ socket.addEventListener("open", handleOpenSuccess);
189
+ socket.addEventListener("error", handleOpenError);
190
+ });
191
+ }
192
+ chunkWCQVDF3K_js.__name(waitForOpenClientSocket, "waitForOpenClientSocket");
193
+ async function closeClientSocket(socket, options = {}) {
194
+ const { timeout: timeoutDuration = DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT } = options;
195
+ const isAlreadyClosed = socket.readyState === socket.CLOSED;
196
+ if (isAlreadyClosed) {
197
+ return;
198
+ }
199
+ await new Promise((resolve, reject) => {
200
+ function handleCloseError(error) {
201
+ socket.removeEventListener("close", handleCloseSuccess);
202
+ reject(error);
203
+ }
204
+ chunkWCQVDF3K_js.__name(handleCloseError, "handleCloseError");
205
+ const closeTimeout = setTimeout(() => {
206
+ const timeoutError = new WebSocketCloseTimeoutError(timeoutDuration);
207
+ handleCloseError(timeoutError);
208
+ }, timeoutDuration);
209
+ function handleCloseSuccess() {
210
+ socket.removeEventListener("error", handleCloseError);
211
+ clearTimeout(closeTimeout);
212
+ resolve();
213
+ }
214
+ chunkWCQVDF3K_js.__name(handleCloseSuccess, "handleCloseSuccess");
215
+ socket.addEventListener("error", handleCloseError);
216
+ socket.addEventListener("close", handleCloseSuccess);
217
+ socket.close();
218
+ });
219
+ }
220
+ chunkWCQVDF3K_js.__name(closeClientSocket, "closeClientSocket");
221
+ async function closeServerSocket(socket, options = {}) {
222
+ const { timeout: timeoutDuration = DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT } = options;
223
+ await new Promise((resolve, reject) => {
224
+ const closeTimeout = setTimeout(() => {
225
+ const timeoutError = new WebSocketCloseTimeoutError(timeoutDuration);
226
+ reject(timeoutError);
227
+ }, timeoutDuration);
228
+ for (const client of socket.clients) {
229
+ client.terminate();
230
+ }
231
+ socket.close((error) => {
232
+ clearTimeout(closeTimeout);
233
+ if (error) {
234
+ reject(error);
235
+ } else {
236
+ resolve();
237
+ }
238
+ });
239
+ });
240
+ }
241
+ chunkWCQVDF3K_js.__name(closeServerSocket, "closeServerSocket");
242
+
243
+ // src/server/constants.ts
244
+ var ALLOWED_ACCESS_CONTROL_HTTP_METHODS = http.HTTP_METHODS.join(",");
245
+ var DEFAULT_ACCESS_CONTROL_HEADERS = Object.freeze({
246
+ "access-control-allow-origin": "*",
247
+ "access-control-allow-methods": ALLOWED_ACCESS_CONTROL_HTTP_METHODS,
248
+ "access-control-allow-headers": "*",
249
+ "access-control-expose-headers": "*",
250
+ "access-control-max-age": ""
251
+ });
252
+ var DEFAULT_PREFLIGHT_STATUS_CODE = 204;
253
+ var DEFAULT_HOSTNAME = "localhost";
254
+ var DEFAULT_LOG_UNHANDLED_REQUESTS = true;
255
+
15
256
  // ../zimic-utils/dist/chunk-PAWJFY3S.mjs
16
257
  var __defProp = Object.defineProperty;
17
258
  var __name2 = /* @__PURE__ */ chunkWCQVDF3K_js.__name((target, value) => __defProp(target, "name", { value, configurable: true }), "__name");
@@ -114,89 +355,6 @@ function logWithPrefix(messageOrMessages, options = {}) {
114
355
  console[method](chalk2__default.default.cyan("[@zimic/interceptor]"), ...messages);
115
356
  }
116
357
  chunkWCQVDF3K_js.__name(logWithPrefix, "logWithPrefix");
117
- var HttpServerTimeoutError = class extends Error {
118
- static {
119
- chunkWCQVDF3K_js.__name(this, "HttpServerTimeoutError");
120
- }
121
- };
122
- var HttpServerStartTimeoutError = class extends HttpServerTimeoutError {
123
- static {
124
- chunkWCQVDF3K_js.__name(this, "HttpServerStartTimeoutError");
125
- }
126
- constructor(reachedTimeout) {
127
- super(`HTTP server start timed out after ${reachedTimeout}ms.`);
128
- this.name = "HttpServerStartTimeout";
129
- }
130
- };
131
- var HttpServerStopTimeoutError = class extends HttpServerTimeoutError {
132
- static {
133
- chunkWCQVDF3K_js.__name(this, "HttpServerStopTimeoutError");
134
- }
135
- constructor(reachedTimeout) {
136
- super(`HTTP server stop timed out after ${reachedTimeout}ms.`);
137
- this.name = "HttpServerStopTimeout";
138
- }
139
- };
140
- var DEFAULT_HTTP_SERVER_LIFECYCLE_TIMEOUT = 60 * 1e3;
141
- async function startHttpServer(server, options = {}) {
142
- const { hostname, port, timeout: timeoutDuration = DEFAULT_HTTP_SERVER_LIFECYCLE_TIMEOUT } = options;
143
- await new Promise((resolve, reject) => {
144
- function handleStartError(error) {
145
- server.off("listening", handleStartSuccess);
146
- reject(error);
147
- }
148
- chunkWCQVDF3K_js.__name(handleStartError, "handleStartError");
149
- const startTimeout = setTimeout(() => {
150
- const timeoutError = new HttpServerStartTimeoutError(timeoutDuration);
151
- handleStartError(timeoutError);
152
- }, timeoutDuration);
153
- function handleStartSuccess() {
154
- server.off("error", handleStartError);
155
- clearTimeout(startTimeout);
156
- resolve();
157
- }
158
- chunkWCQVDF3K_js.__name(handleStartSuccess, "handleStartSuccess");
159
- server.once("error", handleStartError);
160
- server.listen(port, hostname, handleStartSuccess);
161
- });
162
- }
163
- chunkWCQVDF3K_js.__name(startHttpServer, "startHttpServer");
164
- async function stopHttpServer(server, options = {}) {
165
- const { timeout: timeoutDuration = DEFAULT_HTTP_SERVER_LIFECYCLE_TIMEOUT } = options;
166
- if (!server.listening) {
167
- return;
168
- }
169
- await new Promise((resolve, reject) => {
170
- const stopTimeout = setTimeout(() => {
171
- const timeoutError = new HttpServerStopTimeoutError(timeoutDuration);
172
- reject(timeoutError);
173
- }, timeoutDuration);
174
- server.close((error) => {
175
- clearTimeout(stopTimeout);
176
- if (error) {
177
- reject(error);
178
- } else {
179
- resolve();
180
- }
181
- });
182
- server.closeAllConnections();
183
- });
184
- }
185
- chunkWCQVDF3K_js.__name(stopHttpServer, "stopHttpServer");
186
- function getHttpServerPort(server) {
187
- const address = server.address();
188
- if (typeof address === "string") {
189
- return void 0;
190
- } else {
191
- return address?.port;
192
- }
193
- }
194
- chunkWCQVDF3K_js.__name(getHttpServerPort, "getHttpServerPort");
195
- function methodCanHaveResponseBody(method) {
196
- const methodsToCompare = http.HTTP_METHODS_WITH_RESPONSE_BODY;
197
- return methodsToCompare.includes(method);
198
- }
199
- chunkWCQVDF3K_js.__name(methodCanHaveResponseBody, "methodCanHaveResponseBody");
200
358
 
201
359
  // src/http/requestHandler/types/requests.ts
202
360
  var HTTP_INTERCEPTOR_REQUEST_HIDDEN_PROPERTIES = Object.freeze(
@@ -633,127 +791,6 @@ function deserializeResponse(serializedResponse) {
633
791
  }
634
792
  chunkWCQVDF3K_js.__name(deserializeResponse, "deserializeResponse");
635
793
 
636
- // src/utils/webSocket.ts
637
- var WebSocketTimeoutError = class extends Error {
638
- static {
639
- chunkWCQVDF3K_js.__name(this, "WebSocketTimeoutError");
640
- }
641
- };
642
- var WebSocketOpenTimeoutError = class extends WebSocketTimeoutError {
643
- static {
644
- chunkWCQVDF3K_js.__name(this, "WebSocketOpenTimeoutError");
645
- }
646
- constructor(reachedTimeout) {
647
- super(`Web socket open timed out after ${reachedTimeout}ms.`);
648
- this.name = "WebSocketOpenTimeout";
649
- }
650
- };
651
- var WebSocketMessageTimeoutError = class extends WebSocketTimeoutError {
652
- static {
653
- chunkWCQVDF3K_js.__name(this, "WebSocketMessageTimeoutError");
654
- }
655
- constructor(reachedTimeout) {
656
- super(`Web socket message timed out after ${reachedTimeout}ms.`);
657
- this.name = "WebSocketMessageTimeout";
658
- }
659
- };
660
- var WebSocketMessageAbortError = class extends WebSocketTimeoutError {
661
- static {
662
- chunkWCQVDF3K_js.__name(this, "WebSocketMessageAbortError");
663
- }
664
- constructor() {
665
- super("Web socket message was aborted.");
666
- this.name = "WebSocketMessageAbortError";
667
- }
668
- };
669
- var WebSocketCloseTimeoutError = class extends WebSocketTimeoutError {
670
- static {
671
- chunkWCQVDF3K_js.__name(this, "WebSocketCloseTimeoutError");
672
- }
673
- constructor(reachedTimeout) {
674
- super(`Web socket close timed out after ${reachedTimeout}ms.`);
675
- this.name = "WebSocketCloseTimeout";
676
- }
677
- };
678
- var DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT = 60 * 1e3;
679
- var DEFAULT_WEB_SOCKET_MESSAGE_TIMEOUT = 3 * 60 * 1e3;
680
- async function waitForOpenClientSocket(socket, options = {}) {
681
- const { timeout: timeoutDuration = DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT } = options;
682
- const isAlreadyOpen = socket.readyState === socket.OPEN;
683
- if (isAlreadyOpen) {
684
- return;
685
- }
686
- await new Promise((resolve, reject) => {
687
- function handleOpenError(error) {
688
- socket.removeEventListener("open", handleOpenSuccess);
689
- reject(error);
690
- }
691
- chunkWCQVDF3K_js.__name(handleOpenError, "handleOpenError");
692
- const openTimeout = setTimeout(() => {
693
- const timeoutError = new WebSocketOpenTimeoutError(timeoutDuration);
694
- handleOpenError(timeoutError);
695
- }, timeoutDuration);
696
- function handleOpenSuccess() {
697
- socket.removeEventListener("error", handleOpenError);
698
- clearTimeout(openTimeout);
699
- resolve();
700
- }
701
- chunkWCQVDF3K_js.__name(handleOpenSuccess, "handleOpenSuccess");
702
- socket.addEventListener("open", handleOpenSuccess);
703
- socket.addEventListener("error", handleOpenError);
704
- });
705
- }
706
- chunkWCQVDF3K_js.__name(waitForOpenClientSocket, "waitForOpenClientSocket");
707
- async function closeClientSocket(socket, options = {}) {
708
- const { timeout: timeoutDuration = DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT } = options;
709
- const isAlreadyClosed = socket.readyState === socket.CLOSED;
710
- if (isAlreadyClosed) {
711
- return;
712
- }
713
- await new Promise((resolve, reject) => {
714
- function handleCloseError(error) {
715
- socket.removeEventListener("close", handleCloseSuccess);
716
- reject(error);
717
- }
718
- chunkWCQVDF3K_js.__name(handleCloseError, "handleCloseError");
719
- const closeTimeout = setTimeout(() => {
720
- const timeoutError = new WebSocketCloseTimeoutError(timeoutDuration);
721
- handleCloseError(timeoutError);
722
- }, timeoutDuration);
723
- function handleCloseSuccess() {
724
- socket.removeEventListener("error", handleCloseError);
725
- clearTimeout(closeTimeout);
726
- resolve();
727
- }
728
- chunkWCQVDF3K_js.__name(handleCloseSuccess, "handleCloseSuccess");
729
- socket.addEventListener("error", handleCloseError);
730
- socket.addEventListener("close", handleCloseSuccess);
731
- socket.close();
732
- });
733
- }
734
- chunkWCQVDF3K_js.__name(closeClientSocket, "closeClientSocket");
735
- async function closeServerSocket(socket, options = {}) {
736
- const { timeout: timeoutDuration = DEFAULT_WEB_SOCKET_LIFECYCLE_TIMEOUT } = options;
737
- await new Promise((resolve, reject) => {
738
- const closeTimeout = setTimeout(() => {
739
- const timeoutError = new WebSocketCloseTimeoutError(timeoutDuration);
740
- reject(timeoutError);
741
- }, timeoutDuration);
742
- for (const client of socket.clients) {
743
- client.terminate();
744
- }
745
- socket.close((error) => {
746
- clearTimeout(closeTimeout);
747
- if (error) {
748
- reject(error);
749
- } else {
750
- resolve();
751
- }
752
- });
753
- });
754
- }
755
- chunkWCQVDF3K_js.__name(closeServerSocket, "closeServerSocket");
756
-
757
794
  // src/utils/crypto.ts
758
795
  var importCrypto = createCachedDynamicImport_default(async () => {
759
796
  const globalCrypto = globalThis.crypto;
@@ -1072,41 +1109,6 @@ var WebSocketServer = class extends WebSocketHandler_default {
1072
1109
  }
1073
1110
  };
1074
1111
  var WebSocketServer_default = WebSocketServer;
1075
- var ALLOWED_ACCESS_CONTROL_HTTP_METHODS = http.HTTP_METHODS.join(",");
1076
- var DEFAULT_ACCESS_CONTROL_HEADERS = Object.freeze({
1077
- "access-control-allow-origin": "*",
1078
- "access-control-allow-methods": ALLOWED_ACCESS_CONTROL_HTTP_METHODS,
1079
- "access-control-allow-headers": "*",
1080
- "access-control-expose-headers": "*",
1081
- "access-control-max-age": ""
1082
- });
1083
- var DEFAULT_PREFLIGHT_STATUS_CODE = 204;
1084
- var DEFAULT_HOSTNAME = "localhost";
1085
- var DEFAULT_LOG_UNHANDLED_REQUESTS = true;
1086
-
1087
- // src/server/errors/NotRunningInterceptorServerError.ts
1088
- var NotRunningInterceptorServerError = class extends Error {
1089
- static {
1090
- chunkWCQVDF3K_js.__name(this, "NotRunningInterceptorServerError");
1091
- }
1092
- constructor() {
1093
- super("The interceptor server is not running. Did you forget to start it?");
1094
- this.name = "NotRunningInterceptorServerError";
1095
- }
1096
- };
1097
- var NotRunningInterceptorServerError_default = NotRunningInterceptorServerError;
1098
-
1099
- // src/server/errors/RunningInterceptorServerError.ts
1100
- var RunningInterceptorServerError = class extends Error {
1101
- static {
1102
- chunkWCQVDF3K_js.__name(this, "RunningInterceptorServerError");
1103
- }
1104
- constructor(additionalMessage) {
1105
- super(`The interceptor server is running.${additionalMessage}`);
1106
- this.name = "RunningInterceptorServerError";
1107
- }
1108
- };
1109
- var RunningInterceptorServerError_default = RunningInterceptorServerError;
1110
1112
 
1111
1113
  // src/server/utils/fetch.ts
1112
1114
  async function getFetchAPI() {
@@ -1391,26 +1393,7 @@ function createInterceptorServer(options = {}) {
1391
1393
  return new InterceptorServer_default(options);
1392
1394
  }
1393
1395
  chunkWCQVDF3K_js.__name(createInterceptorServer, "createInterceptorServer");
1394
-
1395
- // src/server/namespace/InterceptorServerNamespace.ts
1396
- var InterceptorServerNamespace = class {
1397
- static {
1398
- chunkWCQVDF3K_js.__name(this, "InterceptorServerNamespace");
1399
- }
1400
- /**
1401
- * Creates an {@link https://github.com/zimicjs/zimic/wiki/cli‐zimic‐server#zimic-server interceptor server}.
1402
- *
1403
- * @param options The options to create the server.
1404
- * @returns The created server.
1405
- * @see {@link https://github.com/zimicjs/zimic/wiki/cli‐zimic‐server#zimic-server-programmatic-usage `zimic-interceptor server` programmatic usage}
1406
- * @see {@link https://github.com/zimicjs/zimic/wiki/getting‐started#remote-http-interceptors Remote HTTP Interceptors} .
1407
- */
1408
- create = createInterceptorServer;
1409
- };
1410
- var InterceptorServerNamespace_default = InterceptorServerNamespace;
1411
-
1412
- // src/server/index.ts
1413
- var interceptorServer = Object.freeze(new InterceptorServerNamespace_default());
1396
+ /* istanbul ignore next -- @preserve */
1414
1397
  /* istanbul ignore if -- @preserve
1415
1398
  * This is expected not to happen since the servers are not stopped unless they are running. */
1416
1399
  /* istanbul ignore if -- @preserve
@@ -1426,7 +1409,6 @@ var interceptorServer = Object.freeze(new InterceptorServerNamespace_default());
1426
1409
  /* istanbul ignore next -- @preserve
1427
1410
  * Reply listeners are always present when notified in normal conditions. If they were not present, the request
1428
1411
  * would reach a timeout and not be responded. The empty set serves as a fallback. */
1429
- /* istanbul ignore next -- @preserve */
1430
1412
  /* istanbul ignore if -- @preserve
1431
1413
  * The HTTP server is initialized before using this method in normal conditions. */
1432
1414
  /* istanbul ignore if -- @preserve
@@ -1442,7 +1424,7 @@ exports.DEFAULT_PREFLIGHT_STATUS_CODE = DEFAULT_PREFLIGHT_STATUS_CODE;
1442
1424
  exports.NotRunningInterceptorServerError_default = NotRunningInterceptorServerError_default;
1443
1425
  exports.RunningInterceptorServerError_default = RunningInterceptorServerError_default;
1444
1426
  exports.createCachedDynamicImport_default = createCachedDynamicImport_default;
1445
- exports.interceptorServer = interceptorServer;
1427
+ exports.createInterceptorServer = createInterceptorServer;
1446
1428
  exports.logWithPrefix = logWithPrefix;
1447
- //# sourceMappingURL=chunk-D7CDDSQE.js.map
1448
- //# sourceMappingURL=chunk-D7CDDSQE.js.map
1429
+ //# sourceMappingURL=chunk-HYJ5EZ6I.js.map
1430
+ //# sourceMappingURL=chunk-HYJ5EZ6I.js.map