@kevisual/router 0.2.5 → 0.2.7

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
@@ -24,6 +24,11 @@ app
24
24
  })
25
25
  .addTo(app);
26
26
  ```
27
+ ## 浏览器模块使用 router
28
+
29
+ ```ts
30
+ import { App } from '@kevisual/router/browser';
31
+ ```
27
32
 
28
33
  ## 核心概念
29
34
 
@@ -112,7 +117,7 @@ app
112
117
  .define(async (ctx) => {
113
118
  const { id } = ctx.query;
114
119
  if (!id) {
115
- ctx.throw(400, '缺少参数', 'id is required');
120
+ ctx.throw(400, '缺少参数:id is required');
116
121
  }
117
122
  ctx.body = { success: true };
118
123
  })
@@ -129,7 +134,7 @@ const app = new App();
129
134
  // 定义中间件
130
135
  app
131
136
  .route({
132
- rid: 'auth-example',
137
+ rid: 'auth',
133
138
  description: '权限校验中间件',
134
139
  })
135
140
  .define(async (ctx) => {
@@ -144,7 +149,7 @@ app
144
149
 
145
150
  // 使用中间件(通过 rid 引用)
146
151
  app
147
- .route({ path: 'admin', key: 'panel', middleware: ['auth-example'] })
152
+ .route({ path: 'admin', key: 'panel', middleware: ['auth'] })
148
153
  .define(async (ctx) => {
149
154
  // 可以访问中间件设置的 state
150
155
  const { tokenUser } = ctx.state;
@@ -163,18 +168,18 @@ app
163
168
  .router({
164
169
  path: 'dog',
165
170
  key: 'info',
166
- description: '获取狗的信息',
171
+ description: '获取小狗的信息',
167
172
  metadata: {
168
173
  args: {
169
- name: z.string().describe('狗的姓名'),
170
- age: z.number().describe('狗的年龄'),
174
+ name: z.string().describe('小狗的姓名'),
175
+ age: z.number().describe('小狗的年龄'),
171
176
  },
172
177
  },
173
178
  })
174
179
  .define(async (ctx) => {
175
180
  const { name, age } = ctx.query;
176
181
  ctx.body = {
177
- content: `这是一只${age}岁的狗,名字是${name}`,
182
+ content: `这是一只${age}岁的小狗,名字是${name}`,
178
183
  };
179
184
  })
180
185
  .addTo(app);
@@ -184,9 +189,7 @@ app
184
189
 
185
190
  1. **path 和 key 的组合是路由的唯一标识**,同一个 path+key 只能添加一个路由,后添加的会覆盖之前的。
186
191
 
187
- 2. **ctx.call vs ctx.run**:
188
- - `call` 返回完整 context,包含所有属性
189
- - `run` 返回 `{ code, data, message }` 格式,data 即 body
192
+ 2. `ctx.run` 返回 `{ code, data, message }` 格式,data 即 body
190
193
 
191
194
  3. **ctx.throw 会自动结束执行**,抛出自定义错误。
192
195
 
@@ -199,5 +202,3 @@ app
199
202
  7. **needSerialize 默认为 true**,会自动对 body 进行 JSON 序列化和反序列化。
200
203
 
201
204
  8. **progress 记录执行路径**,可用于调试和追踪路由调用链。
202
-
203
- 9. **中间件找不到会返回 404**,错误信息中会包含找不到的中间件列表。
package/dist/app.js CHANGED
@@ -3691,7 +3691,7 @@ var listenProcess = async ({ app, mockProcess, params = {}, timeout: timeout2 =
3691
3691
  const ctx = mergeParams?.context || {};
3692
3692
  if (!msg.path && !msg.id) {
3693
3693
  const route = app.routes.find((r) => r.path !== "router");
3694
- msg.id = route?.id;
3694
+ msg.id = route?.rid;
3695
3695
  }
3696
3696
  const result = await app.run(msg, ctx);
3697
3697
  const response = {
@@ -17707,9 +17707,9 @@ class QueryRouter {
17707
17707
  if (!message?.path) {
17708
17708
  return Promise.resolve({ code: 404, body: null, message: "Not found path" });
17709
17709
  }
17710
- const { path, key = "", payload = {}, ...query } = message;
17710
+ const { path, key = "", payload = {}, args = {}, ...query } = message;
17711
17711
  ctx = ctx || {};
17712
- ctx.query = { ...ctx.query, ...query, ...payload };
17712
+ ctx.query = { ...ctx.query, ...query, ...payload, ...args };
17713
17713
  ctx.args = ctx.query;
17714
17714
  ctx.state = { ...ctx?.state };
17715
17715
  ctx.throw = this.throw;
@@ -17915,11 +17915,15 @@ class QueryRouterServer extends QueryRouter {
17915
17915
  }
17916
17916
  return super.run(msg, ctx);
17917
17917
  }
17918
+ async runLocal(msg, ctx) {
17919
+ return this.run(msg, { ...ctx, appId: this.appId });
17920
+ }
17918
17921
  async runAction(api2, payload, ctx) {
17919
17922
  const { path, key, rid } = api2;
17920
17923
  return this.run({ path, key, rid, payload }, ctx);
17921
17924
  }
17922
- async createAuth(fun) {
17925
+ async createAuth(fun, opts) {
17926
+ const overwrite = opts?.overwrite ?? false;
17923
17927
  this.route({
17924
17928
  path: "auth",
17925
17929
  key: "auth",
@@ -17929,7 +17933,7 @@ class QueryRouterServer extends QueryRouter {
17929
17933
  if (fun) {
17930
17934
  await fun(ctx, "auth");
17931
17935
  }
17932
- }).addTo(this, { overwrite: false });
17936
+ }).addTo(this, { overwrite });
17933
17937
  this.route({
17934
17938
  path: "auth-admin",
17935
17939
  key: "auth-admin",
@@ -17940,7 +17944,7 @@ class QueryRouterServer extends QueryRouter {
17940
17944
  if (fun) {
17941
17945
  await fun(ctx, "auth-admin");
17942
17946
  }
17943
- }).addTo(this, { overwrite: false });
17947
+ }).addTo(this, { overwrite });
17944
17948
  this.route({
17945
17949
  path: "auth-can",
17946
17950
  key: "auth-can",
@@ -17950,7 +17954,7 @@ class QueryRouterServer extends QueryRouter {
17950
17954
  if (fun) {
17951
17955
  await fun(ctx, "auth-can");
17952
17956
  }
17953
- }).addTo(this, { overwrite: false });
17957
+ }).addTo(this, { overwrite });
17954
17958
  }
17955
17959
  }
17956
17960
 
@@ -18899,7 +18903,7 @@ class App extends QueryRouterServer {
18899
18903
  }
18900
18904
  }
18901
18905
 
18902
- // ../../node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
18906
+ // ../../node_modules/.pnpm/@kevisual+context@0.0.10/node_modules/@kevisual/context/dist/app.js
18903
18907
  var isBrowser22 = typeof window !== "undefined" && typeof window.document !== "undefined";
18904
18908
  function getDefaultExportFromCjs(x) {
18905
18909
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -20108,7 +20112,7 @@ app
20108
20112
  10. **中间件找不到会返回 404**,错误信息中会包含找不到的中间件列表。
20109
20113
  `;
20110
20114
  // package.json
20111
- var version2 = "0.2.4";
20115
+ var version2 = "0.2.6";
20112
20116
 
20113
20117
  // agent/routes/route-create.ts
20114
20118
  app.route({
@@ -171,7 +171,7 @@ declare class Route<M extends SimpleObject = SimpleObject, U extends SimpleObjec
171
171
  description?: string;
172
172
  metadata?: M;
173
173
  middleware?: RouteMiddleware[];
174
- type?: string | undefined;
174
+ type?: string;
175
175
  /**
176
176
  * 是否开启debug,开启后会打印错误信息
177
177
  */
@@ -247,6 +247,7 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
247
247
  path: string;
248
248
  key?: string;
249
249
  payload?: any;
250
+ args?: any;
250
251
  }, ctx?: RouteContext<T> & {
251
252
  [key: string]: any;
252
253
  }): Promise<RouteContext<T, {}, {
@@ -263,13 +264,14 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
263
264
  path?: string;
264
265
  key?: string;
265
266
  payload?: any;
267
+ args?: any;
266
268
  }, ctx?: RouteContext<T> & {
267
269
  [key: string]: any;
268
270
  }): Promise<RouteContext<T, {}, {
269
271
  [key: string]: any;
270
272
  }> | {
271
273
  code: number;
272
- body: null;
274
+ body: any;
273
275
  message: string;
274
276
  }>;
275
277
  /**
@@ -284,12 +286,13 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
284
286
  path: string;
285
287
  key?: string;
286
288
  payload?: any;
289
+ args?: any;
287
290
  }, ctx?: RouteContext & {
288
291
  [key: string]: any;
289
292
  }): Promise<{
290
- code: number | undefined;
291
- data: string | number | Object | null | undefined;
292
- message: string | undefined;
293
+ code: number;
294
+ data: any;
295
+ message: string;
293
296
  }>;
294
297
  /**
295
298
  * Router Run获取数据
@@ -302,12 +305,13 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
302
305
  path?: string;
303
306
  key?: string;
304
307
  payload?: any;
308
+ args?: any;
305
309
  }, ctx?: RouteContext<T> & {
306
310
  [key: string]: any;
307
311
  }): Promise<{
308
- code: number | undefined;
309
- data: string | number | Object | null | undefined;
310
- message: string | undefined;
312
+ code: number;
313
+ data: any;
314
+ message: string;
311
315
  }>;
312
316
  /**
313
317
  * 设置上下文
@@ -342,12 +346,12 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
342
346
  importRoutes(routes: Route[]): void;
343
347
  importRouter(router: QueryRouter): void;
344
348
  throw(...args: any[]): void;
345
- hasRoute(path: string, key?: string): Route<SimpleObject, SimpleObject> | undefined;
349
+ hasRoute(path: string, key?: string): Route<SimpleObject, SimpleObject>;
346
350
  findRoute(opts?: {
347
351
  path?: string;
348
352
  key?: string;
349
353
  rid?: string;
350
- }): Route<SimpleObject, SimpleObject> | undefined;
354
+ }): Route<SimpleObject, SimpleObject>;
351
355
  createRouteList(opts?: {
352
356
  force?: boolean;
353
357
  filter?: (route: Route) => boolean;
@@ -441,6 +445,21 @@ declare class QueryRouterServer<C extends SimpleObject = SimpleObject> extends Q
441
445
  path?: string;
442
446
  key?: string;
443
447
  payload?: any;
448
+ args?: any;
449
+ token?: string;
450
+ data?: any;
451
+ }, ctx?: Partial<RouteContext<C>>): Promise<any>;
452
+ /**
453
+ * 调用了handle
454
+ * @param param0
455
+ * @returns
456
+ */
457
+ runLocal(msg: {
458
+ rid?: string;
459
+ path?: string;
460
+ key?: string;
461
+ payload?: any;
462
+ args?: any;
444
463
  token?: string;
445
464
  data?: any;
446
465
  }, ctx?: Partial<RouteContext<C>>): Promise<any>;
@@ -456,7 +475,9 @@ declare class QueryRouterServer<C extends SimpleObject = SimpleObject> extends Q
456
475
  * 创建认证相关的中间件,默认是 auth, auth-admin, auth-can 三个中间件
457
476
  * @param fun 认证函数,接收 RouteContext 和认证类型
458
477
  */
459
- createAuth(fun: (ctx: RouteContext<C>, type?: 'auth' | 'auth-admin' | 'auth-can') => any): Promise<void>;
478
+ createAuth(fun?: (ctx: RouteContext<C>, type?: 'auth' | 'auth-admin' | 'auth-can') => any, opts?: {
479
+ overwrite?: boolean;
480
+ }): Promise<void>;
460
481
  }
461
482
  /** JSON Schema 基本类型映射到 TypeScript 类型 */
462
483
  type JsonSchemaTypeToTS<T> = T extends {
@@ -791,17 +812,25 @@ declare class App<U = {}> extends QueryRouterServer<AppRouteContext<U>> {
791
812
  listen(handle: any, backlog?: number, listeningListener?: () => void): void;
792
813
  listen(handle: any, listeningListener?: () => void): void;
793
814
  Route: typeof Route;
794
- static handleRequest(req: IncomingMessage$1, res: ServerResponse$1): Promise<any>;
815
+ static handleRequest(req: IncomingMessage$1, res: ServerResponse$1): Promise<{
816
+ cookies: Record<string, string>;
817
+ token: string;
818
+ }>;
795
819
  onServerRequest(fn: (req: IncomingMessage$1, res: ServerResponse$1) => void): void;
796
820
  }
797
821
 
798
822
  declare const groupByPath: (routes: App["routes"]) => Record<string, Route<SimpleObject, SimpleObject>[]>;
799
823
  declare const parseArgs: (args: string) => any;
800
824
  declare const parseDescription: (route: App["routes"][number]) => string;
801
- declare const createCommand: (opts: {
825
+ declare const createCommandList: (opts: {
802
826
  app: any;
803
827
  program: Command;
804
828
  }) => void;
829
+ declare const createCommand: (command: Command, opts: {
830
+ description?: string;
831
+ app: App;
832
+ route: any;
833
+ }) => void;
805
834
  declare const parse: (opts: {
806
835
  app: any;
807
836
  description?: string;
@@ -818,4 +847,4 @@ declare const parse: (opts: {
818
847
  exitOnEnd?: boolean;
819
848
  }) => Promise<void>;
820
849
 
821
- export { createCommand, groupByPath, parse, parseArgs, parseDescription };
850
+ export { createCommand, createCommandList, groupByPath, parse, parseArgs, parseDescription };
package/dist/commander.js CHANGED
@@ -16243,51 +16243,61 @@ var parseDescription = (route) => {
16243
16243
  }
16244
16244
  return desc;
16245
16245
  };
16246
- var createCommand2 = (opts) => {
16246
+ var createCommandList = (opts) => {
16247
16247
  const { program: program2 } = opts;
16248
16248
  const app = opts.app;
16249
16249
  const routes = app.routes;
16250
16250
  const groupRoutes = groupByPath(routes);
16251
16251
  for (const path in groupRoutes) {
16252
16252
  const routeList = groupRoutes[path];
16253
- const keys = routeList.map((route) => route.key).filter(Boolean);
16253
+ if (!routeList)
16254
+ continue;
16255
+ const keys = routeList.map((route) => route.key);
16254
16256
  const subProgram = program2.command(path).description(`路由[${path}] ${keys.length > 0 ? ": " + keys.join(", ") : ""}`);
16255
16257
  routeList.forEach((route) => {
16256
- if (!route.key)
16257
- return;
16258
16258
  const description = parseDescription(route);
16259
- subProgram.command(route.key).description(description || "").option("--args <args>", `命令参数,支持 JSON 格式或 key=value 形式,例如: --args '{"a":1}' 或 --args 'a=1 b=2'`).argument("[args...]", `位置参数(推荐通过 -- 分隔传入),支持 JSON 或 key=value 格式,例如: -- a=1 b=2 或 -- '{"a":1}'`).action(async (passedArgs, options, _command) => {
16260
- const output = (data) => {
16261
- if (typeof data === "object") {
16262
- process.stdout.write(JSON.stringify(data, null, 2) + `
16263
- `);
16264
- } else {
16265
- process.stdout.write(String(data) + `
16266
- `);
16267
- }
16268
- };
16269
- try {
16270
- let args = {};
16271
- if (options.args) {
16272
- args = parseArgs(options.args);
16273
- } else if (passedArgs.length > 0) {
16274
- args = parseArgs(passedArgs.join(" "));
16275
- }
16276
- const res = await app.run({ path, key: route.key, payload: args }, { appId: app.appId });
16277
- if (res.code === 200) {
16278
- output(res.data);
16279
- } else {
16280
- output(`Error: ${res.message}`);
16281
- }
16282
- } catch (error48) {
16283
- output(`Execution error: ${error48 instanceof Error ? error48.message : String(error48)}`);
16284
- }
16285
- });
16259
+ if (!route.key) {
16260
+ createCommand2(subProgram, { description, app, route });
16261
+ return;
16262
+ }
16263
+ const _sumCommandy = subProgram.command(route.key);
16264
+ createCommand2(_sumCommandy, { description, app, route });
16286
16265
  });
16287
16266
  }
16288
16267
  };
16268
+ var createCommand2 = (command, opts) => {
16269
+ const { description, app, route } = opts;
16270
+ const path = route.path;
16271
+ command.description(description || "").option("--args <args>", `命令参数,支持 JSON 格式或 key=value 形式,例如: --args '{"a":1}' 或 --args 'a=1 b=2'`).argument("[args...]", `位置参数(推荐通过 -- 分隔传入),支持 JSON 或 key=value 格式,例如: -- a=1 b=2 或 -- '{"a":1}'`).action(async (passedArgs, options, _command) => {
16272
+ const output = (data) => {
16273
+ if (typeof data === "object") {
16274
+ process.stdout.write(JSON.stringify(data, null, 2) + `
16275
+ `);
16276
+ } else {
16277
+ process.stdout.write(String(data) + `
16278
+ `);
16279
+ }
16280
+ };
16281
+ try {
16282
+ let args = {};
16283
+ if (options.args) {
16284
+ args = parseArgs(options.args);
16285
+ } else if (passedArgs.length > 0) {
16286
+ args = parseArgs(passedArgs.join(" "));
16287
+ }
16288
+ const res = await app.run({ path, key: route.key, payload: args }, { appId: app.appId });
16289
+ if (res.code === 200) {
16290
+ output(res.data);
16291
+ } else {
16292
+ output(`Error: ${res.message}`);
16293
+ }
16294
+ } catch (error48) {
16295
+ output(`Execution error: ${error48 instanceof Error ? error48.message : String(error48)}`);
16296
+ }
16297
+ });
16298
+ };
16289
16299
  var parse5 = async (opts) => {
16290
- const { description, parse: parse6 = true, version: version2, exitOnEnd = true } = opts;
16300
+ const { description, parse: parse6 = true, version: version2, exitOnEnd = false } = opts;
16291
16301
  const app = opts.app;
16292
16302
  const _program = opts.program || program;
16293
16303
  _program.description(description || "Router 命令行工具");
@@ -16296,7 +16306,7 @@ var parse5 = async (opts) => {
16296
16306
  }
16297
16307
  app.createRouteList();
16298
16308
  createCliList(app);
16299
- createCommand2({ app, program: _program });
16309
+ createCommandList({ app, program: _program });
16300
16310
  if (opts.remote) {
16301
16311
  const { token, username, id, url: url2 } = opts.remote;
16302
16312
  const remoteApp = new RemoteApp({
@@ -16405,5 +16415,6 @@ export {
16405
16415
  parseArgs,
16406
16416
  parse5 as parse,
16407
16417
  groupByPath,
16418
+ createCommandList,
16408
16419
  createCommand2 as createCommand
16409
16420
  };
@@ -171,7 +171,7 @@ declare class Route<M extends SimpleObject = SimpleObject, U extends SimpleObjec
171
171
  description?: string;
172
172
  metadata?: M;
173
173
  middleware?: RouteMiddleware[];
174
- type?: string | undefined;
174
+ type?: string;
175
175
  /**
176
176
  * 是否开启debug,开启后会打印错误信息
177
177
  */
@@ -247,6 +247,7 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
247
247
  path: string;
248
248
  key?: string;
249
249
  payload?: any;
250
+ args?: any;
250
251
  }, ctx?: RouteContext<T> & {
251
252
  [key: string]: any;
252
253
  }): Promise<RouteContext<T, {}, {
@@ -263,13 +264,14 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
263
264
  path?: string;
264
265
  key?: string;
265
266
  payload?: any;
267
+ args?: any;
266
268
  }, ctx?: RouteContext<T> & {
267
269
  [key: string]: any;
268
270
  }): Promise<RouteContext<T, {}, {
269
271
  [key: string]: any;
270
272
  }> | {
271
273
  code: number;
272
- body: null;
274
+ body: any;
273
275
  message: string;
274
276
  }>;
275
277
  /**
@@ -284,12 +286,13 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
284
286
  path: string;
285
287
  key?: string;
286
288
  payload?: any;
289
+ args?: any;
287
290
  }, ctx?: RouteContext & {
288
291
  [key: string]: any;
289
292
  }): Promise<{
290
- code: number | undefined;
291
- data: string | number | Object | null | undefined;
292
- message: string | undefined;
293
+ code: number;
294
+ data: any;
295
+ message: string;
293
296
  }>;
294
297
  /**
295
298
  * Router Run获取数据
@@ -302,12 +305,13 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
302
305
  path?: string;
303
306
  key?: string;
304
307
  payload?: any;
308
+ args?: any;
305
309
  }, ctx?: RouteContext<T> & {
306
310
  [key: string]: any;
307
311
  }): Promise<{
308
- code: number | undefined;
309
- data: string | number | Object | null | undefined;
310
- message: string | undefined;
312
+ code: number;
313
+ data: any;
314
+ message: string;
311
315
  }>;
312
316
  /**
313
317
  * 设置上下文
@@ -342,12 +346,12 @@ declare class QueryRouter<T extends SimpleObject = SimpleObject> implements thro
342
346
  importRoutes(routes: Route[]): void;
343
347
  importRouter(router: QueryRouter): void;
344
348
  throw(...args: any[]): void;
345
- hasRoute(path: string, key?: string): Route<SimpleObject, SimpleObject> | undefined;
349
+ hasRoute(path: string, key?: string): Route<SimpleObject, SimpleObject>;
346
350
  findRoute(opts?: {
347
351
  path?: string;
348
352
  key?: string;
349
353
  rid?: string;
350
- }): Route<SimpleObject, SimpleObject> | undefined;
354
+ }): Route<SimpleObject, SimpleObject>;
351
355
  createRouteList(opts?: {
352
356
  force?: boolean;
353
357
  filter?: (route: Route) => boolean;
@@ -441,6 +445,21 @@ declare class QueryRouterServer<C extends SimpleObject = SimpleObject> extends Q
441
445
  path?: string;
442
446
  key?: string;
443
447
  payload?: any;
448
+ args?: any;
449
+ token?: string;
450
+ data?: any;
451
+ }, ctx?: Partial<RouteContext<C>>): Promise<any>;
452
+ /**
453
+ * 调用了handle
454
+ * @param param0
455
+ * @returns
456
+ */
457
+ runLocal(msg: {
458
+ rid?: string;
459
+ path?: string;
460
+ key?: string;
461
+ payload?: any;
462
+ args?: any;
444
463
  token?: string;
445
464
  data?: any;
446
465
  }, ctx?: Partial<RouteContext<C>>): Promise<any>;
@@ -456,7 +475,9 @@ declare class QueryRouterServer<C extends SimpleObject = SimpleObject> extends Q
456
475
  * 创建认证相关的中间件,默认是 auth, auth-admin, auth-can 三个中间件
457
476
  * @param fun 认证函数,接收 RouteContext 和认证类型
458
477
  */
459
- createAuth(fun: (ctx: RouteContext<C>, type?: 'auth' | 'auth-admin' | 'auth-can') => any): Promise<void>;
478
+ createAuth(fun?: (ctx: RouteContext<C>, type?: 'auth' | 'auth-admin' | 'auth-can') => any, opts?: {
479
+ overwrite?: boolean;
480
+ }): Promise<void>;
460
481
  }
461
482
  /** JSON Schema 基本类型映射到 TypeScript 类型 */
462
483
  type JsonSchemaTypeToTS<T> = T extends {
@@ -791,7 +812,10 @@ declare class App<U = {}> extends QueryRouterServer<AppRouteContext<U>> {
791
812
  listen(handle: any, backlog?: number, listeningListener?: () => void): void;
792
813
  listen(handle: any, listeningListener?: () => void): void;
793
814
  Route: typeof Route;
794
- static handleRequest(req: IncomingMessage$1, res: ServerResponse$1): Promise<any>;
815
+ static handleRequest(req: IncomingMessage$1, res: ServerResponse$1): Promise<{
816
+ cookies: Record<string, string>;
817
+ token: string;
818
+ }>;
795
819
  onServerRequest(fn: (req: IncomingMessage$1, res: ServerResponse$1) => void): void;
796
820
  }
797
821
 
package/dist/opencode.js CHANGED
@@ -685,7 +685,7 @@ var require_md5 = __commonJS((exports, module) => {
685
685
  });
686
686
  });
687
687
 
688
- // ../../node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
688
+ // ../../node_modules/.pnpm/@kevisual+context@0.0.10/node_modules/@kevisual/context/dist/app.js
689
689
  var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "undefined";
690
690
  function getDefaultExportFromCjs(x) {
691
691
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;