@kevisual/router 0.2.5 → 0.2.6

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.
@@ -18980,7 +18980,7 @@ var listenProcess = async ({ app, mockProcess, params = {}, timeout: timeout2 =
18980
18980
  const ctx = mergeParams?.context || {};
18981
18981
  if (!msg.path && !msg.id) {
18982
18982
  const route = app.routes.find((r) => r.path !== "router");
18983
- msg.id = route?.id;
18983
+ msg.id = route?.rid;
18984
18984
  }
18985
18985
  const result = await app.run(msg, ctx);
18986
18986
  const response = {
@@ -32971,9 +32971,9 @@ class QueryRouter {
32971
32971
  if (!message?.path) {
32972
32972
  return Promise.resolve({ code: 404, body: null, message: "Not found path" });
32973
32973
  }
32974
- const { path, key = "", payload = {}, ...query } = message;
32974
+ const { path, key = "", payload = {}, args = {}, ...query } = message;
32975
32975
  ctx = ctx || {};
32976
- ctx.query = { ...ctx.query, ...query, ...payload };
32976
+ ctx.query = { ...ctx.query, ...query, ...payload, ...args };
32977
32977
  ctx.args = ctx.query;
32978
32978
  ctx.state = { ...ctx?.state };
32979
32979
  ctx.throw = this.throw;
@@ -33183,7 +33183,8 @@ class QueryRouterServer extends QueryRouter {
33183
33183
  const { path, key, rid } = api2;
33184
33184
  return this.run({ path, key, rid, payload }, ctx);
33185
33185
  }
33186
- async createAuth(fun) {
33186
+ async createAuth(fun, opts) {
33187
+ const overwrite = opts?.overwrite ?? false;
33187
33188
  this.route({
33188
33189
  path: "auth",
33189
33190
  key: "auth",
@@ -33193,7 +33194,7 @@ class QueryRouterServer extends QueryRouter {
33193
33194
  if (fun) {
33194
33195
  await fun(ctx, "auth");
33195
33196
  }
33196
- }).addTo(this, { overwrite: false });
33197
+ }).addTo(this, { overwrite });
33197
33198
  this.route({
33198
33199
  path: "auth-admin",
33199
33200
  key: "auth-admin",
@@ -33204,7 +33205,7 @@ class QueryRouterServer extends QueryRouter {
33204
33205
  if (fun) {
33205
33206
  await fun(ctx, "auth-admin");
33206
33207
  }
33207
- }).addTo(this, { overwrite: false });
33208
+ }).addTo(this, { overwrite });
33208
33209
  this.route({
33209
33210
  path: "auth-can",
33210
33211
  key: "auth-can",
@@ -33214,7 +33215,7 @@ class QueryRouterServer extends QueryRouter {
33214
33215
  if (fun) {
33215
33216
  await fun(ctx, "auth-can");
33216
33217
  }
33217
- }).addTo(this, { overwrite: false });
33218
+ }).addTo(this, { overwrite });
33218
33219
  }
33219
33220
  }
33220
33221
 
@@ -33409,7 +33410,6 @@ export {
33409
33410
  QueryUtil,
33410
33411
  QueryRouterServer,
33411
33412
  QueryRouter,
33412
- MockProcess,
33413
33413
  Mini,
33414
33414
  CustomError,
33415
33415
  App
@@ -168,7 +168,7 @@ declare class Route<M extends SimpleObject$1 = SimpleObject$1, U extends SimpleO
168
168
  description?: string;
169
169
  metadata?: M;
170
170
  middleware?: RouteMiddleware[];
171
- type?: string | undefined;
171
+ type?: string;
172
172
  /**
173
173
  * 是否开启debug,开启后会打印错误信息
174
174
  */
@@ -244,6 +244,7 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
244
244
  path: string;
245
245
  key?: string;
246
246
  payload?: any;
247
+ args?: any;
247
248
  }, ctx?: RouteContext<T> & {
248
249
  [key: string]: any;
249
250
  }): Promise<RouteContext<T, {}, {
@@ -260,13 +261,14 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
260
261
  path?: string;
261
262
  key?: string;
262
263
  payload?: any;
264
+ args?: any;
263
265
  }, ctx?: RouteContext<T> & {
264
266
  [key: string]: any;
265
267
  }): Promise<RouteContext<T, {}, {
266
268
  [key: string]: any;
267
269
  }> | {
268
270
  code: number;
269
- body: null;
271
+ body: any;
270
272
  message: string;
271
273
  }>;
272
274
  /**
@@ -281,12 +283,13 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
281
283
  path: string;
282
284
  key?: string;
283
285
  payload?: any;
286
+ args?: any;
284
287
  }, ctx?: RouteContext & {
285
288
  [key: string]: any;
286
289
  }): Promise<{
287
- code: number | undefined;
288
- data: string | number | Object | null | undefined;
289
- message: string | undefined;
290
+ code: number;
291
+ data: any;
292
+ message: string;
290
293
  }>;
291
294
  /**
292
295
  * Router Run获取数据
@@ -299,12 +302,13 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
299
302
  path?: string;
300
303
  key?: string;
301
304
  payload?: any;
305
+ args?: any;
302
306
  }, ctx?: RouteContext<T> & {
303
307
  [key: string]: any;
304
308
  }): Promise<{
305
- code: number | undefined;
306
- data: string | number | Object | null | undefined;
307
- message: string | undefined;
309
+ code: number;
310
+ data: any;
311
+ message: string;
308
312
  }>;
309
313
  /**
310
314
  * 设置上下文
@@ -339,12 +343,12 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
339
343
  importRoutes(routes: Route[]): void;
340
344
  importRouter(router: QueryRouter): void;
341
345
  throw(...args: any[]): void;
342
- hasRoute(path: string, key?: string): Route<SimpleObject$1, SimpleObject$1> | undefined;
346
+ hasRoute(path: string, key?: string): Route<SimpleObject$1, SimpleObject$1>;
343
347
  findRoute(opts?: {
344
348
  path?: string;
345
349
  key?: string;
346
350
  rid?: string;
347
- }): Route<SimpleObject$1, SimpleObject$1> | undefined;
351
+ }): Route<SimpleObject$1, SimpleObject$1>;
348
352
  createRouteList(opts?: {
349
353
  force?: boolean;
350
354
  filter?: (route: Route) => boolean;
@@ -438,6 +442,7 @@ declare class QueryRouterServer<C extends SimpleObject$1 = SimpleObject$1> exten
438
442
  path?: string;
439
443
  key?: string;
440
444
  payload?: any;
445
+ args?: any;
441
446
  token?: string;
442
447
  data?: any;
443
448
  }, ctx?: Partial<RouteContext<C>>): Promise<any>;
@@ -453,7 +458,9 @@ declare class QueryRouterServer<C extends SimpleObject$1 = SimpleObject$1> exten
453
458
  * 创建认证相关的中间件,默认是 auth, auth-admin, auth-can 三个中间件
454
459
  * @param fun 认证函数,接收 RouteContext 和认证类型
455
460
  */
456
- createAuth(fun: (ctx: RouteContext<C>, type?: 'auth' | 'auth-admin' | 'auth-can') => any): Promise<void>;
461
+ createAuth(fun?: (ctx: RouteContext<C>, type?: 'auth' | 'auth-admin' | 'auth-can') => any, opts?: {
462
+ overwrite?: boolean;
463
+ }): Promise<void>;
457
464
  }
458
465
  /** JSON Schema 基本类型映射到 TypeScript 类型 */
459
466
  type JsonSchemaTypeToTS<T> = T extends {
@@ -508,8 +515,8 @@ declare class Chain {
508
515
  object: RouteOpts;
509
516
  app?: QueryRouterServer;
510
517
  constructor(object: RouteOpts, opts?: ChainOptions);
511
- get key(): string | undefined;
512
- get path(): string | undefined;
518
+ get key(): string;
519
+ get path(): string;
513
520
  setDescription(desc: string): this;
514
521
  setMeta(metadata: {
515
522
  [key: string]: any;
@@ -1,3 +1,4 @@
1
+ import * as node_querystring from 'node:querystring';
1
2
  import { Key } from 'path-to-regexp';
2
3
  import { IncomingMessage, ServerResponse, Server } from 'node:http';
3
4
  import { ListenOptions } from 'node:net';
@@ -24,7 +25,7 @@ declare class SimpleRouter {
24
25
  exclude?: string[];
25
26
  });
26
27
  getBody(req: Req): Promise<Record<string, any>>;
27
- getSearch(req: Req): any;
28
+ getSearch(req: Req): node_querystring.ParsedUrlQuery;
28
29
  parseSearchValue: (value?: string, opts?: {
29
30
  decode?: boolean;
30
31
  }) => any;
@@ -102,7 +103,7 @@ declare class HttpChain {
102
103
  listenCallBack?: () => void;
103
104
  }): () => void;
104
105
  getString(value: string | SimpleObject): string;
105
- sse(value: string | SimpleObject): this | undefined;
106
+ sse(value: string | SimpleObject): this;
106
107
  close(): this;
107
108
  }
108
109
 
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => {
30
30
  };
31
31
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
32
32
 
33
- // ../../node_modules/.pnpm/path-to-regexp@8.4.0/node_modules/path-to-regexp/dist/index.js
33
+ // ../../node_modules/.pnpm/path-to-regexp@8.4.2/node_modules/path-to-regexp/dist/index.js
34
34
  var require_dist = __commonJS((exports) => {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.PathError = exports.TokenData = undefined;
@@ -44,7 +44,6 @@ var require_dist = __commonJS((exports) => {
44
44
  var ID_START = /^[$_\p{ID_Start}]$/u;
45
45
  var ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u;
46
46
  var ID = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
47
- var SIMPLE_TOKENS = "{}()[]+?!";
48
47
  function escapeText(str) {
49
48
  return str.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
50
49
  }
@@ -74,96 +73,90 @@ var require_dist = __commonJS((exports) => {
74
73
  function parse(str, options = {}) {
75
74
  const { encodePath = NOOP_VALUE } = options;
76
75
  const chars = [...str];
77
- const tokens = [];
78
76
  let index = 0;
79
- let pos = 0;
80
- function name() {
81
- let value = "";
82
- if (ID_START.test(chars[index])) {
83
- do {
84
- value += chars[index++];
85
- } while (ID_CONTINUE.test(chars[index]));
86
- } else if (chars[index] === '"') {
87
- let quoteStart = index;
88
- while (index < chars.length) {
89
- if (chars[++index] === '"') {
90
- index++;
91
- quoteStart = 0;
92
- break;
93
- }
94
- if (chars[index] === "\\")
95
- index++;
96
- value += chars[index];
97
- }
98
- if (quoteStart) {
99
- throw new PathError(`Unterminated quote at index ${quoteStart}`, str);
100
- }
101
- }
102
- if (!value) {
103
- throw new PathError(`Missing parameter name at index ${index}`, str);
104
- }
105
- return value;
106
- }
107
- while (index < chars.length) {
108
- const value = chars[index++];
109
- if (SIMPLE_TOKENS.includes(value)) {
110
- tokens.push({ type: value, index, value });
111
- } else if (value === "\\") {
112
- tokens.push({ type: "escape", index, value: chars[index++] });
113
- } else if (value === ":") {
114
- tokens.push({ type: "param", index, value: name() });
115
- } else if (value === "*") {
116
- tokens.push({ type: "wildcard", index, value: name() });
117
- } else {
118
- tokens.push({ type: "char", index, value });
119
- }
120
- }
121
- tokens.push({ type: "end", index, value: "" });
122
- function consumeUntil(endType) {
77
+ function consumeUntil(end) {
123
78
  const output = [];
124
- while (true) {
125
- const token = tokens[pos++];
126
- if (token.type === endType)
127
- break;
128
- if (token.type === "char" || token.type === "escape") {
129
- let path = token.value;
130
- let cur = tokens[pos];
131
- while (cur.type === "char" || cur.type === "escape") {
132
- path += cur.value;
133
- cur = tokens[++pos];
79
+ let path = "";
80
+ function writePath() {
81
+ if (!path)
82
+ return;
83
+ output.push({
84
+ type: "text",
85
+ value: encodePath(path)
86
+ });
87
+ path = "";
88
+ }
89
+ while (index < chars.length) {
90
+ const value = chars[index++];
91
+ if (value === end) {
92
+ writePath();
93
+ return output;
94
+ }
95
+ if (value === "\\") {
96
+ if (index === chars.length) {
97
+ throw new PathError(`Unexpected end after \\ at index ${index}`, str);
134
98
  }
135
- output.push({
136
- type: "text",
137
- value: encodePath(path)
138
- });
99
+ path += chars[index++];
139
100
  continue;
140
101
  }
141
- if (token.type === "param" || token.type === "wildcard") {
142
- output.push({
143
- type: token.type,
144
- name: token.value
145
- });
102
+ if (value === ":" || value === "*") {
103
+ const type = value === ":" ? "param" : "wildcard";
104
+ let name = "";
105
+ if (ID_START.test(chars[index])) {
106
+ do {
107
+ name += chars[index++];
108
+ } while (ID_CONTINUE.test(chars[index]));
109
+ } else if (chars[index] === '"') {
110
+ let quoteStart = index;
111
+ while (index < chars.length) {
112
+ if (chars[++index] === '"') {
113
+ index++;
114
+ quoteStart = 0;
115
+ break;
116
+ }
117
+ if (chars[index] === "\\")
118
+ index++;
119
+ name += chars[index];
120
+ }
121
+ if (quoteStart) {
122
+ throw new PathError(`Unterminated quote at index ${quoteStart}`, str);
123
+ }
124
+ }
125
+ if (!name) {
126
+ throw new PathError(`Missing parameter name at index ${index}`, str);
127
+ }
128
+ writePath();
129
+ output.push({ type, name });
146
130
  continue;
147
131
  }
148
- if (token.type === "{") {
132
+ if (value === "{") {
133
+ writePath();
149
134
  output.push({
150
135
  type: "group",
151
136
  tokens: consumeUntil("}")
152
137
  });
153
138
  continue;
154
139
  }
155
- throw new PathError(`Unexpected ${token.type} at index ${token.index}, expected ${endType}`, str);
140
+ if (value === "}" || value === "(" || value === ")" || value === "[" || value === "]" || value === "+" || value === "?" || value === "!") {
141
+ throw new PathError(`Unexpected ${value} at index ${index - 1}`, str);
142
+ }
143
+ path += value;
156
144
  }
145
+ if (end) {
146
+ throw new PathError(`Unexpected end at index ${index}, expected ${end}`, str);
147
+ }
148
+ writePath();
157
149
  return output;
158
150
  }
159
- return new TokenData(consumeUntil("end"), str);
151
+ return new TokenData(consumeUntil(""), str);
160
152
  }
161
153
  function compile(path, options = {}) {
162
154
  const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
163
155
  const data = typeof path === "object" ? path : parse(path, options);
164
156
  const fn = tokensToFunction(data.tokens, delimiter, encode);
165
157
  return function path2(params = {}) {
166
- const [path3, ...missing] = fn(params);
158
+ const missing = [];
159
+ const path3 = fn(params, missing);
167
160
  if (missing.length) {
168
161
  throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
169
162
  }
@@ -172,55 +165,61 @@ var require_dist = __commonJS((exports) => {
172
165
  }
173
166
  function tokensToFunction(tokens, delimiter, encode) {
174
167
  const encoders = tokens.map((token) => tokenToFunction(token, delimiter, encode));
175
- return (data) => {
176
- const result = [""];
168
+ return (data, missing) => {
169
+ let result = "";
177
170
  for (const encoder of encoders) {
178
- const [value, ...extras] = encoder(data);
179
- result[0] += value;
180
- result.push(...extras);
171
+ result += encoder(data, missing);
181
172
  }
182
173
  return result;
183
174
  };
184
175
  }
185
176
  function tokenToFunction(token, delimiter, encode) {
186
177
  if (token.type === "text")
187
- return () => [token.value];
178
+ return () => token.value;
188
179
  if (token.type === "group") {
189
180
  const fn = tokensToFunction(token.tokens, delimiter, encode);
190
- return (data) => {
191
- const [value, ...missing] = fn(data);
192
- if (!missing.length)
193
- return [value];
194
- return [""];
181
+ return (data, missing) => {
182
+ const len = missing.length;
183
+ const value = fn(data, missing);
184
+ if (missing.length === len)
185
+ return value;
186
+ missing.length = len;
187
+ return "";
195
188
  };
196
189
  }
197
190
  const encodeValue = encode || NOOP_VALUE;
198
191
  if (token.type === "wildcard" && encode !== false) {
199
- return (data) => {
192
+ return (data, missing) => {
200
193
  const value = data[token.name];
201
- if (value == null)
202
- return ["", token.name];
194
+ if (value == null) {
195
+ missing.push(token.name);
196
+ return "";
197
+ }
203
198
  if (!Array.isArray(value) || value.length === 0) {
204
199
  throw new TypeError(`Expected "${token.name}" to be a non-empty array`);
205
200
  }
206
- return [
207
- value.map((value2, index) => {
208
- if (typeof value2 !== "string") {
209
- throw new TypeError(`Expected "${token.name}/${index}" to be a string`);
210
- }
211
- return encodeValue(value2);
212
- }).join(delimiter)
213
- ];
201
+ let result = "";
202
+ for (let i = 0;i < value.length; i++) {
203
+ if (typeof value[i] !== "string") {
204
+ throw new TypeError(`Expected "${token.name}/${i}" to be a string`);
205
+ }
206
+ if (i > 0)
207
+ result += delimiter;
208
+ result += encodeValue(value[i]);
209
+ }
210
+ return result;
214
211
  };
215
212
  }
216
- return (data) => {
213
+ return (data, missing) => {
217
214
  const value = data[token.name];
218
- if (value == null)
219
- return ["", token.name];
215
+ if (value == null) {
216
+ missing.push(token.name);
217
+ return "";
218
+ }
220
219
  if (typeof value !== "string") {
221
220
  throw new TypeError(`Expected "${token.name}" to be a string`);
222
221
  }
223
- return [encodeValue(value)];
222
+ return encodeValue(value);
224
223
  };
225
224
  }
226
225
  function match(path, options = {}) {
@@ -251,67 +250,48 @@ var require_dist = __commonJS((exports) => {
251
250
  }
252
251
  function pathToRegexp(path, options = {}) {
253
252
  const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
254
- const root = new SourceNode("^");
255
- const paths = [path];
253
+ const keys = [];
254
+ let source = "";
256
255
  let combinations = 0;
257
- while (paths.length) {
258
- const path2 = paths.shift();
256
+ function process2(path2) {
259
257
  if (Array.isArray(path2)) {
260
- paths.push(...path2);
261
- continue;
258
+ for (const p of path2)
259
+ process2(p);
260
+ return;
262
261
  }
263
262
  const data = typeof path2 === "object" ? path2 : parse(path2, options);
264
263
  flatten(data.tokens, 0, [], (tokens) => {
265
- if (combinations++ >= 256) {
264
+ if (combinations >= 256) {
266
265
  throw new PathError("Too many path combinations", data.originalPath);
267
266
  }
268
- let node = root;
269
- for (const part of toRegExpSource(tokens, delimiter, data.originalPath)) {
270
- node = node.add(part.source, part.key);
271
- }
272
- node.add("");
267
+ if (combinations > 0)
268
+ source += "|";
269
+ source += toRegExpSource(tokens, delimiter, keys, data.originalPath);
270
+ combinations++;
273
271
  });
274
272
  }
275
- const keys = [];
276
- let pattern = toRegExp(root, keys);
273
+ process2(path);
274
+ let pattern = `^(?:${source})`;
277
275
  if (trailing)
278
276
  pattern += "(?:" + escape(delimiter) + "$)?";
279
277
  pattern += end ? "$" : "(?=" + escape(delimiter) + "|$)";
280
278
  return { regexp: new RegExp(pattern, sensitive ? "" : "i"), keys };
281
279
  }
282
- function toRegExp(node, keys) {
283
- if (node.key)
284
- keys.push(node.key);
285
- const children = Object.keys(node.children);
286
- const text = children.map((id) => toRegExp(node.children[id], keys)).join("|");
287
- return node.source + (children.length < 2 ? text : `(?:${text})`);
288
- }
289
-
290
- class SourceNode {
291
- constructor(source, key) {
292
- this.source = source;
293
- this.key = key;
294
- this.children = Object.create(null);
295
- }
296
- add(source, key) {
297
- var _a;
298
- const id = source + ":" + (key ? key.name : "");
299
- return (_a = this.children)[id] || (_a[id] = new SourceNode(source, key));
300
- }
301
- }
302
280
  function flatten(tokens, index, result, callback) {
303
281
  while (index < tokens.length) {
304
282
  const token = tokens[index++];
305
283
  if (token.type === "group") {
306
- flatten(token.tokens, 0, result.slice(), (seq) => flatten(tokens, index, seq, callback));
284
+ const len = result.length;
285
+ flatten(token.tokens, 0, result, (seq) => flatten(tokens, index, seq, callback));
286
+ result.length = len;
307
287
  continue;
308
288
  }
309
289
  result.push(token);
310
290
  }
311
291
  callback(result);
312
292
  }
313
- function toRegExpSource(tokens, delimiter, originalPath) {
314
- let result = [];
293
+ function toRegExpSource(tokens, delimiter, keys, originalPath) {
294
+ let result = "";
315
295
  let backtrack = "";
316
296
  let wildcardBacktrack = "";
317
297
  let prevCaptureType = 0;
@@ -342,7 +322,7 @@ var require_dist = __commonJS((exports) => {
342
322
  while (index < tokens.length) {
343
323
  const token = tokens[index++];
344
324
  if (token.type === "text") {
345
- result.push({ source: escape(token.value) });
325
+ result += escape(token.value);
346
326
  backtrack += token.value;
347
327
  if (prevCaptureType === 2)
348
328
  wildcardBacktrack += token.value;
@@ -355,19 +335,14 @@ var require_dist = __commonJS((exports) => {
355
335
  throw new PathError(`Missing text before "${token.name}" ${token.type}`, originalPath);
356
336
  }
357
337
  if (token.type === "param") {
358
- result.push({
359
- source: hasSegmentCapture ? `(${negate(delimiter, backtrack)}+?)` : hasInSegment(index, "wildcard") ? `(${negate(delimiter, peekText(index))}+?)` : `(${negate(delimiter, "")}+?)`,
360
- key: token
361
- });
338
+ result += hasSegmentCapture & 2 ? `(${negate(delimiter, backtrack)}+)` : hasInSegment(index, "wildcard") ? `(${negate(delimiter, peekText(index))}+)` : hasSegmentCapture & 1 ? `(${negate(delimiter, backtrack)}+|${escape(backtrack)})` : `(${negate(delimiter, "")}+)`;
362
339
  hasSegmentCapture |= prevCaptureType = 1;
363
340
  } else {
364
- result.push({
365
- source: hasSegmentCapture & 2 ? `(${negate(backtrack, "")}+?)` : hasSegmentCapture & 1 ? `(${negate(wildcardBacktrack, "")}+?)` : wildcardBacktrack ? `(${negate(wildcardBacktrack, "")}+?|${negate(delimiter, "")}+?)` : `([^]+?)`,
366
- key: token
367
- });
341
+ result += hasSegmentCapture & 2 ? `(${negate(backtrack, "")}+)` : wildcardBacktrack ? `(${negate(wildcardBacktrack, "")}+|${negate(delimiter, "")}+)` : `([^]+)`;
368
342
  wildcardBacktrack = "";
369
343
  hasSegmentCapture |= prevCaptureType = 2;
370
344
  }
345
+ keys.push(token);
371
346
  backtrack = "";
372
347
  continue;
373
348
  }
@@ -725,7 +700,7 @@ class HttpChain {
725
700
  setInterval(() => {
726
701
  res.write(`
727
702
  `);
728
- }, 3000);
703
+ }, 3000).unref?.();
729
704
  req.on("close", () => {
730
705
  clearInterval(intervalId);
731
706
  res.end();