@kevisual/cli 0.1.29 → 0.1.31

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.
@@ -23714,7 +23714,7 @@ var require_lib2 = __commonJS((exports, module) => {
23714
23714
  };
23715
23715
  });
23716
23716
 
23717
- // ../node_modules/.pnpm/@kevisual+router@0.1.5/node_modules/@kevisual/router/dist/router.js
23717
+ // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router.js
23718
23718
  import { createRequire as createRequire2 } from "node:module";
23719
23719
  import { webcrypto as crypto2 } from "node:crypto";
23720
23720
  import http from "node:http";
@@ -41232,7 +41232,7 @@ class QueryRouter {
41232
41232
  console.error("=====debug====:", e);
41233
41233
  console.error("=====debug====:[path:key]:", `${route.path}-${route.key}`);
41234
41234
  }
41235
- if (e instanceof CustomError) {
41235
+ if (e instanceof CustomError || e?.code) {
41236
41236
  ctx.code = e.code;
41237
41237
  ctx.message = e.message;
41238
41238
  } else {
@@ -41495,6 +41495,39 @@ class QueryRouterServer extends QueryRouter {
41495
41495
  const { path, key, id } = api2;
41496
41496
  return this.run({ path, key, id, payload }, ctx);
41497
41497
  }
41498
+ async createAuth(fun) {
41499
+ this.route({
41500
+ path: "auth",
41501
+ key: "auth",
41502
+ id: "auth",
41503
+ description: "token验证"
41504
+ }).define(async (ctx) => {
41505
+ if (fun) {
41506
+ await fun(ctx, "auth");
41507
+ }
41508
+ }).addTo(this, { overwrite: false });
41509
+ this.route({
41510
+ path: "auth-admin",
41511
+ key: "auth-admin",
41512
+ id: "auth-admin",
41513
+ description: "admin token验证",
41514
+ middleware: ["auth"]
41515
+ }).define(async (ctx) => {
41516
+ if (fun) {
41517
+ await fun(ctx, "auth-admin");
41518
+ }
41519
+ }).addTo(this, { overwrite: false });
41520
+ this.route({
41521
+ path: "auth-can",
41522
+ key: "auth-can",
41523
+ id: "auth-can",
41524
+ description: "权限验证"
41525
+ }).define(async (ctx) => {
41526
+ if (fun) {
41527
+ await fun(ctx, "auth-can");
41528
+ }
41529
+ }).addTo(this, { overwrite: false });
41530
+ }
41498
41531
  }
41499
41532
  var isNode2 = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
41500
41533
  var isBrowser2 = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
@@ -42419,7 +42452,7 @@ class App extends QueryRouterServer {
42419
42452
  }
42420
42453
  }
42421
42454
 
42422
- // ../node_modules/.pnpm/@kevisual+router@0.1.5/node_modules/@kevisual/router/dist/router-simple.js
42455
+ // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-simple.js
42423
42456
  import url3 from "node:url";
42424
42457
  var __create3 = Object.create;
42425
42458
  var __getProtoOf3 = Object.getPrototypeOf;
@@ -44586,7 +44619,7 @@ class AssistantConfig {
44586
44619
  const routes = ["@kevisual/cnb/routes"];
44587
44620
  if (isCNB) {
44588
44621
  routes.push("@kevisual/project-search/routes");
44589
- id = "cnb-dev";
44622
+ id = "dev-cnb";
44590
44623
  }
44591
44624
  return {
44592
44625
  app: {
@@ -52670,7 +52703,7 @@ class RemoteApp {
52670
52703
  }
52671
52704
  }
52672
52705
 
52673
- // ../node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
52706
+ // ../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
52674
52707
  var isTextForContentType = (contentType) => {
52675
52708
  if (!contentType)
52676
52709
  return false;
@@ -52873,10 +52906,6 @@ class Query {
52873
52906
  });
52874
52907
  }
52875
52908
  }
52876
- const headers2 = req.headers || {};
52877
- if (options?.token && !headers2["Authorization"]) {
52878
- headers2["Authorization"] = `Bearer ${options.token}`;
52879
- }
52880
52909
  } catch (e) {
52881
52910
  console.error("request beforeFn error", e, req);
52882
52911
  return wrapperError({
@@ -52937,20 +52966,20 @@ class Query {
52937
52966
  this.afterResponse = fn;
52938
52967
  }
52939
52968
  async fetchText(urlOrOptions, options) {
52940
- let _options = { method: "GET", ...options };
52969
+ let _options = { ...options };
52941
52970
  if (typeof urlOrOptions === "string" && !_options.url) {
52942
52971
  _options.url = urlOrOptions;
52943
52972
  }
52944
52973
  if (typeof urlOrOptions === "object") {
52945
52974
  _options = { ...urlOrOptions, ..._options };
52946
52975
  }
52947
- const headers = { ...this.headers, ..._options.headers };
52948
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
52949
- headers["Authorization"] = `Bearer ${options.token}`;
52950
- }
52951
52976
  const res = await adapter({
52977
+ method: "GET",
52952
52978
  ..._options,
52953
- headers
52979
+ headers: {
52980
+ ...this.headers,
52981
+ ..._options?.headers || {}
52982
+ }
52954
52983
  });
52955
52984
  if (res && !res.code) {
52956
52985
  return {
@@ -52962,7 +52991,7 @@ class Query {
52962
52991
  }
52963
52992
  }
52964
52993
 
52965
- // ../node_modules/.pnpm/@kevisual+router@0.1.5/node_modules/@kevisual/router/dist/router-browser.js
52994
+ // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-browser.js
52966
52995
  var __create5 = Object.create;
52967
52996
  var __getProtoOf5 = Object.getPrototypeOf;
52968
52997
  var __defProp5 = Object.defineProperty;
@@ -100609,7 +100638,7 @@ var checkLocalUser = async (opts) => {
100609
100638
  }
100610
100639
  }
100611
100640
  };
100612
- // ../node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query.js
100641
+ // ../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query.js
100613
100642
  var isTextForContentType2 = (contentType) => {
100614
100643
  if (!contentType)
100615
100644
  return false;
@@ -100812,10 +100841,6 @@ class Query2 {
100812
100841
  });
100813
100842
  }
100814
100843
  }
100815
- const headers2 = req.headers || {};
100816
- if (options?.token && !headers2["Authorization"]) {
100817
- headers2["Authorization"] = `Bearer ${options.token}`;
100818
- }
100819
100844
  } catch (e) {
100820
100845
  console.error("request beforeFn error", e, req);
100821
100846
  return wrapperError2({
@@ -100876,20 +100901,20 @@ class Query2 {
100876
100901
  this.afterResponse = fn;
100877
100902
  }
100878
100903
  async fetchText(urlOrOptions, options) {
100879
- let _options = { method: "GET", ...options };
100904
+ let _options = { ...options };
100880
100905
  if (typeof urlOrOptions === "string" && !_options.url) {
100881
100906
  _options.url = urlOrOptions;
100882
100907
  }
100883
100908
  if (typeof urlOrOptions === "object") {
100884
100909
  _options = { ...urlOrOptions, ..._options };
100885
100910
  }
100886
- const headers = { ...this.headers, ..._options.headers };
100887
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
100888
- headers["Authorization"] = `Bearer ${options.token}`;
100889
- }
100890
100911
  const res = await adapter2({
100912
+ method: "GET",
100891
100913
  ..._options,
100892
- headers
100914
+ headers: {
100915
+ ...this.headers,
100916
+ ..._options?.headers || {}
100917
+ }
100893
100918
  });
100894
100919
  if (res && !res.code) {
100895
100920
  return {
@@ -103445,7 +103470,7 @@ var simpleRouter = useContextKey("simpleRouter", () => {
103445
103470
  });
103446
103471
  app.createRouteList();
103447
103472
 
103448
- // ../node_modules/.pnpm/@kevisual+router@0.1.5/node_modules/@kevisual/router/dist/opencode.js
103473
+ // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/opencode.js
103449
103474
  import { createRequire as createRequire4 } from "node:module";
103450
103475
  import { webcrypto as crypto4 } from "node:crypto";
103451
103476
  var __create7 = Object.create;
@@ -123001,7 +123026,7 @@ var createOSInfo = (more = false) => {
123001
123026
  return labels;
123002
123027
  };
123003
123028
 
123004
- // src/routes/cnb-board/cnb-dev-env.ts
123029
+ // src/routes/cnb-board/dev-cnb-env.ts
123005
123030
  var notCNBCheck = (ctx) => {
123006
123031
  const isCNB = useKey2("CNB");
123007
123032
  if (!isCNB) {
@@ -124157,7 +124182,7 @@ var import_busboy = __toESM(require_lib2(), 1);
124157
124182
  import path16 from "path";
124158
124183
  import fs19 from "fs";
124159
124184
 
124160
- // ../node_modules/.pnpm/@kevisual+router@0.1.5/node_modules/@kevisual/router/src/server/cookie.ts
124185
+ // ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/src/server/cookie.ts
124161
124186
  var NullObject2 = /* @__PURE__ */ (() => {
124162
124187
  const C2 = function() {};
124163
124188
  C2.prototype = Object.create(null);