@kevisual/api 0.0.50 → 0.0.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/api",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "description": "",
5
5
  "main": "mod.ts",
6
6
  "scripts": {
@@ -18,14 +18,14 @@
18
18
  "keywords": [],
19
19
  "author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
20
20
  "license": "MIT",
21
- "packageManager": "pnpm@10.29.3",
21
+ "packageManager": "pnpm@10.30.0",
22
22
  "type": "module",
23
23
  "devDependencies": {
24
24
  "@kevisual/cache": "^0.0.5",
25
25
  "@kevisual/code-builder": "^0.0.6",
26
- "@kevisual/query": "^0.0.40",
26
+ "@kevisual/query": "^0.0.47",
27
27
  "@kevisual/remote-app": "^0.0.4",
28
- "@kevisual/router": "^0.0.70",
28
+ "@kevisual/router": "^0.0.75",
29
29
  "@kevisual/types": "^0.0.12",
30
30
  "@kevisual/use-config": "^1.0.30",
31
31
  "@types/bun": "^1.3.9",
@@ -39,6 +39,7 @@
39
39
  "@kevisual/context": "^0.0.6",
40
40
  "@kevisual/js-filter": "^0.0.5",
41
41
  "@kevisual/load": "^0.0.6",
42
+ "@paralleldrive/cuid2": "^3.3.0",
42
43
  "es-toolkit": "^1.44.0",
43
44
  "eventemitter3": "^5.0.4",
44
45
  "fuse.js": "^7.1.0",
@@ -56,6 +57,7 @@
56
57
  "./proxy": "./query/query-proxy/index.ts",
57
58
  "./secret": "./query/query-secret/index.ts",
58
59
  "./resources": "./query/query-resources/index.ts",
60
+ "./utils-node": "./dist/utils-node.js",
59
61
  "./utils": "./dist/utils.js",
60
62
  "./query-secret": "./dist/query-secret.js",
61
63
  "./query-mark": "./dist/query-mark.js",
@@ -1,6 +1,5 @@
1
1
  import { Query, BaseQuery } from '@kevisual/query';
2
2
  import type { Result, DataOpts } from '@kevisual/query/query';
3
- import { setBaseResponse } from '@kevisual/query/query';
4
3
  import { LoginCacheStore, CacheStore } from './login-cache.ts';
5
4
  import { Cache } from './login-cache.ts';
6
5
  import { BaseLoad } from '@kevisual/load';
@@ -166,7 +165,6 @@ export class QueryLogin extends BaseQuery {
166
165
  { key: 'refreshToken', data },
167
166
  {
168
167
  afterResponse: async (response, ctx) => {
169
- setBaseResponse(response);
170
168
  return response as any;
171
169
  },
172
170
  },
@@ -200,7 +198,6 @@ export class QueryLogin extends BaseQuery {
200
198
  body: body,
201
199
  headers: { ...headers, Authorization: `Bearer ${accessToken}` },
202
200
  });
203
- setBaseResponse(res);
204
201
  return res;
205
202
  }
206
203
  } else {
@@ -47,7 +47,7 @@ export const initApi = async (opts: {
47
47
  metadata: metadata,
48
48
  }).define(async (ctx) => {
49
49
  const msg = { ...ctx.query };
50
- if (msg.token === undefined && token !== undefined) {
50
+ if (msg.token === undefined && token !== undefined && !_isBrowser) {
51
51
  msg.token = token;
52
52
  }
53
53
  const res = await query.post<any>({ path: r.path, key: r.key, ...msg });
@@ -1,9 +1,12 @@
1
1
  import { customAlphabet } from 'nanoid';
2
+ import { createId } from '@paralleldrive/cuid2';
2
3
 
3
4
  export const letter = 'abcdefghijklmnopqrstuvwxyz';
4
5
  export const number = '0123456789';
5
6
  const alphanumeric = `${letter}${number}`;
6
7
  export const alphanumericWithDash = `${alphanumeric}-`;
8
+
9
+ export const cuid2 = createId;
7
10
  /**
8
11
  * 创建一个随机的字母字符串
9
12
  */
@@ -12,12 +15,12 @@ export const uuid = customAlphabet(letter);
12
15
  /**
13
16
  * 创建一个随机的 id,包含字母和数字
14
17
  */
15
- export const nanoid = customAlphabet(alphanumeric, 10);
18
+ export const nanoid = customAlphabet(alphanumeric, 16);
16
19
 
17
20
  /**
18
21
  * 创建一个随机的 id,包含字母、数字和短横线
19
22
  */
20
- export const nanoidWithDash = customAlphabet(alphanumericWithDash, 10);
23
+ export const nanoidWithDash = customAlphabet(alphanumericWithDash, 16);
21
24
 
22
25
  /**
23
26
  * 创建一个随机的 id,以字母开头的字符串