@kevisual/api 0.0.63 → 0.0.65

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/query-ai.js CHANGED
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
1
+ // ../../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
2
2
  var isTextForContentType = (contentType) => {
3
3
  if (!contentType)
4
4
  return false;
@@ -201,10 +201,6 @@ class Query {
201
201
  });
202
202
  }
203
203
  }
204
- const headers2 = req.headers || {};
205
- if (options?.token && !headers2["Authorization"]) {
206
- headers2["Authorization"] = `Bearer ${options.token}`;
207
- }
208
204
  } catch (e) {
209
205
  console.error("request beforeFn error", e, req);
210
206
  return wrapperError({
@@ -265,20 +261,20 @@ class Query {
265
261
  this.afterResponse = fn;
266
262
  }
267
263
  async fetchText(urlOrOptions, options) {
268
- let _options = { method: "GET", ...options };
264
+ let _options = { ...options };
269
265
  if (typeof urlOrOptions === "string" && !_options.url) {
270
266
  _options.url = urlOrOptions;
271
267
  }
272
268
  if (typeof urlOrOptions === "object") {
273
269
  _options = { ...urlOrOptions, ..._options };
274
270
  }
275
- const headers = { ...this.headers, ..._options.headers };
276
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
277
- headers["Authorization"] = `Bearer ${options.token}`;
278
- }
279
271
  const res = await adapter({
272
+ method: "GET",
280
273
  ..._options,
281
- headers
274
+ headers: {
275
+ ...this.headers,
276
+ ..._options?.headers || {}
277
+ }
282
278
  });
283
279
  if (res && !res.code) {
284
280
  return {
@@ -290,7 +286,7 @@ class Query {
290
286
  }
291
287
  }
292
288
 
293
- // node_modules/.pnpm/@kevisual+router@0.1.1/node_modules/@kevisual/router/dist/router-define.js
289
+ // ../../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-define.js
294
290
  class Chain {
295
291
  object;
296
292
  app;
@@ -424,7 +420,7 @@ var appDefine = QueryUtil.create({
424
420
  }
425
421
  });
426
422
 
427
- // node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query.js
423
+ // ../../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query.js
428
424
  class BaseQuery {
429
425
  query;
430
426
  queryDefine;
package/dist/query-app.js CHANGED
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
1
+ // ../../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
2
2
  var isTextForContentType = (contentType) => {
3
3
  if (!contentType)
4
4
  return false;
@@ -201,10 +201,6 @@ class Query {
201
201
  });
202
202
  }
203
203
  }
204
- const headers2 = req.headers || {};
205
- if (options?.token && !headers2["Authorization"]) {
206
- headers2["Authorization"] = `Bearer ${options.token}`;
207
- }
208
204
  } catch (e) {
209
205
  console.error("request beforeFn error", e, req);
210
206
  return wrapperError({
@@ -265,20 +261,20 @@ class Query {
265
261
  this.afterResponse = fn;
266
262
  }
267
263
  async fetchText(urlOrOptions, options) {
268
- let _options = { method: "GET", ...options };
264
+ let _options = { ...options };
269
265
  if (typeof urlOrOptions === "string" && !_options.url) {
270
266
  _options.url = urlOrOptions;
271
267
  }
272
268
  if (typeof urlOrOptions === "object") {
273
269
  _options = { ...urlOrOptions, ..._options };
274
270
  }
275
- const headers = { ...this.headers, ..._options.headers };
276
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
277
- headers["Authorization"] = `Bearer ${options.token}`;
278
- }
279
271
  const res = await adapter({
272
+ method: "GET",
280
273
  ..._options,
281
- headers
274
+ headers: {
275
+ ...this.headers,
276
+ ..._options?.headers || {}
277
+ }
282
278
  });
283
279
  if (res && !res.code) {
284
280
  return {
@@ -290,7 +286,7 @@ class Query {
290
286
  }
291
287
  }
292
288
 
293
- // node_modules/.pnpm/@kevisual+router@0.1.1/node_modules/@kevisual/router/dist/router-define.js
289
+ // ../../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-define.js
294
290
  class Chain {
295
291
  object;
296
292
  app;
@@ -498,7 +494,7 @@ var userAppDefine = QueryUtil.create({
498
494
  }
499
495
  });
500
496
 
501
- // node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query.js
497
+ // ../../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query.js
502
498
  class BaseQuery {
503
499
  query;
504
500
  queryDefine;
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
1
+ // ../../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
2
2
  var isTextForContentType = (contentType) => {
3
3
  if (!contentType)
4
4
  return false;
@@ -201,10 +201,6 @@ class Query {
201
201
  });
202
202
  }
203
203
  }
204
- const headers2 = req.headers || {};
205
- if (options?.token && !headers2["Authorization"]) {
206
- headers2["Authorization"] = `Bearer ${options.token}`;
207
- }
208
204
  } catch (e) {
209
205
  console.error("request beforeFn error", e, req);
210
206
  return wrapperError({
@@ -265,20 +261,20 @@ class Query {
265
261
  this.afterResponse = fn;
266
262
  }
267
263
  async fetchText(urlOrOptions, options) {
268
- let _options = { method: "GET", ...options };
264
+ let _options = { ...options };
269
265
  if (typeof urlOrOptions === "string" && !_options.url) {
270
266
  _options.url = urlOrOptions;
271
267
  }
272
268
  if (typeof urlOrOptions === "object") {
273
269
  _options = { ...urlOrOptions, ..._options };
274
270
  }
275
- const headers = { ...this.headers, ..._options.headers };
276
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
277
- headers["Authorization"] = `Bearer ${options.token}`;
278
- }
279
271
  const res = await adapter({
272
+ method: "GET",
280
273
  ..._options,
281
- headers
274
+ headers: {
275
+ ...this.headers,
276
+ ..._options?.headers || {}
277
+ }
282
278
  });
283
279
  if (res && !res.code) {
284
280
  return {
@@ -3,20 +3,34 @@ var __getProtoOf = Object.getPrototypeOf;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ function __accessProp(key) {
7
+ return this[key];
8
+ }
9
+ var __toESMCache_node;
10
+ var __toESMCache_esm;
6
11
  var __toESM = (mod, isNodeMode, target) => {
12
+ var canCache = mod != null && typeof mod === "object";
13
+ if (canCache) {
14
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
+ var cached = cache.get(mod);
16
+ if (cached)
17
+ return cached;
18
+ }
7
19
  target = mod != null ? __create(__getProtoOf(mod)) : {};
8
20
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
21
  for (let key of __getOwnPropNames(mod))
10
22
  if (!__hasOwnProp.call(to, key))
11
23
  __defProp(to, key, {
12
- get: () => mod[key],
24
+ get: __accessProp.bind(mod, key),
13
25
  enumerable: true
14
26
  });
27
+ if (canCache)
28
+ cache.set(mod, to);
15
29
  return to;
16
30
  };
17
31
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18
32
 
19
- // node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js
33
+ // ../../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js
20
34
  var require_eventemitter3 = __commonJS((exports, module) => {
21
35
  var has = Object.prototype.hasOwnProperty;
22
36
  var prefix = "~";
@@ -194,7 +208,7 @@ var require_eventemitter3 = __commonJS((exports, module) => {
194
208
  }
195
209
  });
196
210
 
197
- // node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
211
+ // ../../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
198
212
  var isTextForContentType = (contentType) => {
199
213
  if (!contentType)
200
214
  return false;
@@ -397,10 +411,6 @@ class Query {
397
411
  });
398
412
  }
399
413
  }
400
- const headers2 = req.headers || {};
401
- if (options?.token && !headers2["Authorization"]) {
402
- headers2["Authorization"] = `Bearer ${options.token}`;
403
- }
404
414
  } catch (e) {
405
415
  console.error("request beforeFn error", e, req);
406
416
  return wrapperError({
@@ -461,20 +471,20 @@ class Query {
461
471
  this.afterResponse = fn;
462
472
  }
463
473
  async fetchText(urlOrOptions, options) {
464
- let _options = { method: "GET", ...options };
474
+ let _options = { ...options };
465
475
  if (typeof urlOrOptions === "string" && !_options.url) {
466
476
  _options.url = urlOrOptions;
467
477
  }
468
478
  if (typeof urlOrOptions === "object") {
469
479
  _options = { ...urlOrOptions, ..._options };
470
480
  }
471
- const headers = { ...this.headers, ..._options.headers };
472
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
473
- headers["Authorization"] = `Bearer ${options.token}`;
474
- }
475
481
  const res = await adapter({
482
+ method: "GET",
476
483
  ..._options,
477
- headers
484
+ headers: {
485
+ ...this.headers,
486
+ ..._options?.headers || {}
487
+ }
478
488
  });
479
489
  if (res && !res.code) {
480
490
  return {
@@ -629,7 +639,7 @@ class LoginCacheStore {
629
639
  }
630
640
  }
631
641
 
632
- // node_modules/.pnpm/@kevisual+load@0.0.6/node_modules/@kevisual/load/dist/load.js
642
+ // ../../node_modules/.pnpm/@kevisual+load@0.0.6/node_modules/@kevisual/load/dist/load.js
633
643
  function getDefaultExportFromCjs(x) {
634
644
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
635
645
  }
@@ -1079,7 +1089,7 @@ class BaseLoad {
1079
1089
  }
1080
1090
  }
1081
1091
 
1082
- // node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.mjs
1092
+ // ../../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.mjs
1083
1093
  var import__ = __toESM(require_eventemitter3(), 1);
1084
1094
 
1085
1095
  // query/query-login/query-login.ts
@@ -1350,6 +1360,9 @@ class QueryLogin extends BaseQuery {
1350
1360
  const res = await this.refreshLoginUser();
1351
1361
  if (res.code === 200) {
1352
1362
  return res.data?.accessToken || null;
1363
+ } else {
1364
+ this.storage.removeItem("token");
1365
+ await this.cacheStore.clearCurrentUser();
1353
1366
  }
1354
1367
  return null;
1355
1368
  }
@@ -3,20 +3,34 @@ var __getProtoOf = Object.getPrototypeOf;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ function __accessProp(key) {
7
+ return this[key];
8
+ }
9
+ var __toESMCache_node;
10
+ var __toESMCache_esm;
6
11
  var __toESM = (mod, isNodeMode, target) => {
12
+ var canCache = mod != null && typeof mod === "object";
13
+ if (canCache) {
14
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
+ var cached = cache.get(mod);
16
+ if (cached)
17
+ return cached;
18
+ }
7
19
  target = mod != null ? __create(__getProtoOf(mod)) : {};
8
20
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
21
  for (let key of __getOwnPropNames(mod))
10
22
  if (!__hasOwnProp.call(to, key))
11
23
  __defProp(to, key, {
12
- get: () => mod[key],
24
+ get: __accessProp.bind(mod, key),
13
25
  enumerable: true
14
26
  });
27
+ if (canCache)
28
+ cache.set(mod, to);
15
29
  return to;
16
30
  };
17
31
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18
32
 
19
- // node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js
33
+ // ../../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js
20
34
  var require_eventemitter3 = __commonJS((exports, module) => {
21
35
  var has = Object.prototype.hasOwnProperty;
22
36
  var prefix = "~";
@@ -194,7 +208,7 @@ var require_eventemitter3 = __commonJS((exports, module) => {
194
208
  }
195
209
  });
196
210
 
197
- // node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
211
+ // ../../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
198
212
  var isTextForContentType = (contentType) => {
199
213
  if (!contentType)
200
214
  return false;
@@ -397,10 +411,6 @@ class Query {
397
411
  });
398
412
  }
399
413
  }
400
- const headers2 = req.headers || {};
401
- if (options?.token && !headers2["Authorization"]) {
402
- headers2["Authorization"] = `Bearer ${options.token}`;
403
- }
404
414
  } catch (e) {
405
415
  console.error("request beforeFn error", e, req);
406
416
  return wrapperError({
@@ -461,20 +471,20 @@ class Query {
461
471
  this.afterResponse = fn;
462
472
  }
463
473
  async fetchText(urlOrOptions, options) {
464
- let _options = { method: "GET", ...options };
474
+ let _options = { ...options };
465
475
  if (typeof urlOrOptions === "string" && !_options.url) {
466
476
  _options.url = urlOrOptions;
467
477
  }
468
478
  if (typeof urlOrOptions === "object") {
469
479
  _options = { ...urlOrOptions, ..._options };
470
480
  }
471
- const headers = { ...this.headers, ..._options.headers };
472
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
473
- headers["Authorization"] = `Bearer ${options.token}`;
474
- }
475
481
  const res = await adapter({
482
+ method: "GET",
476
483
  ..._options,
477
- headers
484
+ headers: {
485
+ ...this.headers,
486
+ ..._options?.headers || {}
487
+ }
478
488
  });
479
489
  if (res && !res.code) {
480
490
  return {
@@ -629,7 +639,7 @@ class LoginCacheStore {
629
639
  }
630
640
  }
631
641
 
632
- // node_modules/.pnpm/@kevisual+load@0.0.6/node_modules/@kevisual/load/dist/load.js
642
+ // ../../node_modules/.pnpm/@kevisual+load@0.0.6/node_modules/@kevisual/load/dist/load.js
633
643
  function getDefaultExportFromCjs(x) {
634
644
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
635
645
  }
@@ -1079,7 +1089,7 @@ class BaseLoad {
1079
1089
  }
1080
1090
  }
1081
1091
 
1082
- // node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.mjs
1092
+ // ../../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.mjs
1083
1093
  var import__ = __toESM(require_eventemitter3(), 1);
1084
1094
 
1085
1095
  // query/query-login/query-login.ts
@@ -1350,6 +1360,9 @@ class QueryLogin extends BaseQuery {
1350
1360
  const res = await this.refreshLoginUser();
1351
1361
  if (res.code === 200) {
1352
1362
  return res.data?.accessToken || null;
1363
+ } else {
1364
+ this.storage.removeItem("token");
1365
+ await this.cacheStore.clearCurrentUser();
1353
1366
  }
1354
1367
  return null;
1355
1368
  }
@@ -1491,7 +1504,7 @@ class QueryLogin extends BaseQuery {
1491
1504
  }
1492
1505
  }
1493
1506
 
1494
- // node_modules/idb-keyval/dist/index.js
1507
+ // ../../node_modules/.pnpm/idb-keyval@6.2.2/node_modules/idb-keyval/dist/index.js
1495
1508
  function promisifyRequest(request) {
1496
1509
  return new Promise((resolve, reject) => {
1497
1510
  request.oncomplete = request.onsuccess = () => resolve(request.result);
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
1
+ // ../../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
2
2
  var isTextForContentType = (contentType) => {
3
3
  if (!contentType)
4
4
  return false;
@@ -201,10 +201,6 @@ class Query {
201
201
  });
202
202
  }
203
203
  }
204
- const headers2 = req.headers || {};
205
- if (options?.token && !headers2["Authorization"]) {
206
- headers2["Authorization"] = `Bearer ${options.token}`;
207
- }
208
204
  } catch (e) {
209
205
  console.error("request beforeFn error", e, req);
210
206
  return wrapperError({
@@ -265,20 +261,20 @@ class Query {
265
261
  this.afterResponse = fn;
266
262
  }
267
263
  async fetchText(urlOrOptions, options) {
268
- let _options = { method: "GET", ...options };
264
+ let _options = { ...options };
269
265
  if (typeof urlOrOptions === "string" && !_options.url) {
270
266
  _options.url = urlOrOptions;
271
267
  }
272
268
  if (typeof urlOrOptions === "object") {
273
269
  _options = { ...urlOrOptions, ..._options };
274
270
  }
275
- const headers = { ...this.headers, ..._options.headers };
276
- if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
277
- headers["Authorization"] = `Bearer ${options.token}`;
278
- }
279
271
  const res = await adapter({
272
+ method: "GET",
280
273
  ..._options,
281
- headers
274
+ headers: {
275
+ ...this.headers,
276
+ ..._options?.headers || {}
277
+ }
282
278
  });
283
279
  if (res && !res.code) {
284
280
  return {