@kevisual/api 0.0.61 → 0.0.63
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 +13 -9
- package/dist/query-app.js +13 -9
- package/dist/query-config.js +11 -7
- package/dist/query-login-node.d.ts +5 -2
- package/dist/query-login-node.js +243 -21
- package/dist/query-login.d.ts +5 -2
- package/dist/query-login.js +248 -25
- package/dist/query-mark.js +11 -7
- package/dist/query-proxy.d.ts +20 -0
- package/dist/query-proxy.js +270 -31
- package/dist/query-remote.js +36 -5
- package/dist/query-resources.d.ts +10 -0
- package/dist/query-resources.js +7 -1
- package/dist/query-secret.js +11 -7
- package/dist/query-shop.js +13 -9
- package/dist/store-mark.js +11 -7
- package/package.json +9 -9
- package/query/query-resources/index.ts +15 -0
package/dist/query-shop.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/@kevisual/query/dist/query-browser.js
|
|
1
|
+
// node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
|
|
2
2
|
var isTextForContentType = (contentType) => {
|
|
3
3
|
if (!contentType)
|
|
4
4
|
return false;
|
|
@@ -201,6 +201,10 @@ 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
|
+
}
|
|
204
208
|
} catch (e) {
|
|
205
209
|
console.error("request beforeFn error", e, req);
|
|
206
210
|
return wrapperError({
|
|
@@ -261,20 +265,20 @@ class Query {
|
|
|
261
265
|
this.afterResponse = fn;
|
|
262
266
|
}
|
|
263
267
|
async fetchText(urlOrOptions, options) {
|
|
264
|
-
let _options = { ...options };
|
|
268
|
+
let _options = { method: "GET", ...options };
|
|
265
269
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
266
270
|
_options.url = urlOrOptions;
|
|
267
271
|
}
|
|
268
272
|
if (typeof urlOrOptions === "object") {
|
|
269
273
|
_options = { ...urlOrOptions, ..._options };
|
|
270
274
|
}
|
|
275
|
+
const headers = { ...this.headers, ..._options.headers };
|
|
276
|
+
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
277
|
+
headers["Authorization"] = `Bearer ${options.token}`;
|
|
278
|
+
}
|
|
271
279
|
const res = await adapter({
|
|
272
|
-
method: "GET",
|
|
273
280
|
..._options,
|
|
274
|
-
headers
|
|
275
|
-
...this.headers,
|
|
276
|
-
..._options?.headers || {}
|
|
277
|
-
}
|
|
281
|
+
headers
|
|
278
282
|
});
|
|
279
283
|
if (res && !res.code) {
|
|
280
284
|
return {
|
|
@@ -286,7 +290,7 @@ class Query {
|
|
|
286
290
|
}
|
|
287
291
|
}
|
|
288
292
|
|
|
289
|
-
// node_modules/@kevisual/router/dist/router-define.js
|
|
293
|
+
// node_modules/.pnpm/@kevisual+router@0.1.1/node_modules/@kevisual/router/dist/router-define.js
|
|
290
294
|
class Chain {
|
|
291
295
|
object;
|
|
292
296
|
app;
|
|
@@ -435,7 +439,7 @@ var shopDefine = QueryUtil.create({
|
|
|
435
439
|
}
|
|
436
440
|
});
|
|
437
441
|
|
|
438
|
-
// node_modules/@kevisual/query/dist/query.js
|
|
442
|
+
// node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query.js
|
|
439
443
|
class BaseQuery {
|
|
440
444
|
query;
|
|
441
445
|
queryDefine;
|
package/dist/store-mark.js
CHANGED
|
@@ -204,6 +204,10 @@ class Query {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
+
const headers2 = req.headers || {};
|
|
208
|
+
if (options?.token && !headers2["Authorization"]) {
|
|
209
|
+
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
210
|
+
}
|
|
207
211
|
} catch (e) {
|
|
208
212
|
console.error("request beforeFn error", e, req);
|
|
209
213
|
return wrapperError({
|
|
@@ -264,20 +268,20 @@ class Query {
|
|
|
264
268
|
this.afterResponse = fn;
|
|
265
269
|
}
|
|
266
270
|
async fetchText(urlOrOptions, options) {
|
|
267
|
-
let _options = { ...options };
|
|
271
|
+
let _options = { method: "GET", ...options };
|
|
268
272
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
269
273
|
_options.url = urlOrOptions;
|
|
270
274
|
}
|
|
271
275
|
if (typeof urlOrOptions === "object") {
|
|
272
276
|
_options = { ...urlOrOptions, ..._options };
|
|
273
277
|
}
|
|
278
|
+
const headers = { ...this.headers, ..._options.headers };
|
|
279
|
+
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
280
|
+
headers["Authorization"] = `Bearer ${options.token}`;
|
|
281
|
+
}
|
|
274
282
|
const res = await adapter({
|
|
275
|
-
method: "GET",
|
|
276
283
|
..._options,
|
|
277
|
-
headers
|
|
278
|
-
...this.headers,
|
|
279
|
-
..._options?.headers || {}
|
|
280
|
-
}
|
|
284
|
+
headers
|
|
281
285
|
});
|
|
282
286
|
if (res && !res.code) {
|
|
283
287
|
return {
|
|
@@ -364,7 +368,7 @@ class QueryMark extends QueryMarkBase {
|
|
|
364
368
|
}
|
|
365
369
|
}
|
|
366
370
|
|
|
367
|
-
// node_modules/.pnpm/es-toolkit@1.
|
|
371
|
+
// node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/uniqBy.mjs
|
|
368
372
|
function uniqBy(arr, mapper) {
|
|
369
373
|
const map = new Map;
|
|
370
374
|
for (let i = 0;i < arr.length; i++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.63",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "mod.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
"keywords": [],
|
|
19
19
|
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"packageManager": "pnpm@10.
|
|
21
|
+
"packageManager": "pnpm@10.32.1",
|
|
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.
|
|
27
|
-
"@kevisual/remote-app": "^0.0.
|
|
28
|
-
"@kevisual/router": "^0.
|
|
26
|
+
"@kevisual/query": "^0.0.53",
|
|
27
|
+
"@kevisual/remote-app": "^0.0.6",
|
|
28
|
+
"@kevisual/router": "^0.1.1",
|
|
29
29
|
"@kevisual/types": "^0.0.12",
|
|
30
30
|
"@kevisual/use-config": "^1.0.30",
|
|
31
|
-
"@types/bun": "^1.3.
|
|
32
|
-
"@types/node": "^25.
|
|
31
|
+
"@types/bun": "^1.3.10",
|
|
32
|
+
"@types/node": "^25.4.0",
|
|
33
33
|
"@types/spark-md5": "^3.0.5",
|
|
34
34
|
"dotenv": "^17.3.1",
|
|
35
35
|
"fast-glob": "^3.3.3",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@kevisual/context": "^0.0.8",
|
|
40
|
-
"@kevisual/js-filter": "^0.0.
|
|
40
|
+
"@kevisual/js-filter": "^0.0.6",
|
|
41
41
|
"@kevisual/load": "^0.0.6",
|
|
42
42
|
"@paralleldrive/cuid2": "^3.3.0",
|
|
43
|
-
"es-toolkit": "^1.
|
|
43
|
+
"es-toolkit": "^1.45.1",
|
|
44
44
|
"eventemitter3": "^5.0.4",
|
|
45
45
|
"fuse.js": "^7.1.0",
|
|
46
46
|
"nanoid": "^5.1.6",
|
|
@@ -26,6 +26,10 @@ export class QueryResources {
|
|
|
26
26
|
setUsername(username: string) {
|
|
27
27
|
this.prefix = `/${username}/resources/`;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* 设置prefix,类似 /{username}/resources/;
|
|
31
|
+
* @param prefix
|
|
32
|
+
*/
|
|
29
33
|
setPrefix(prefix: string) {
|
|
30
34
|
this.prefix = prefix;
|
|
31
35
|
}
|
|
@@ -166,6 +170,17 @@ export class QueryResources {
|
|
|
166
170
|
this.onProcess?.({ type: 'uploadFinish', filename, size: file.size, process: 100 });
|
|
167
171
|
return { code: 200, message: '上传成功' };
|
|
168
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* 移除 prefix,获取相对路径
|
|
175
|
+
* @param filepath
|
|
176
|
+
* @returns
|
|
177
|
+
*/
|
|
178
|
+
getRelativePath(filepath: string): string {
|
|
179
|
+
if (filepath.startsWith(this.prefix)) {
|
|
180
|
+
return filepath.slice(this.prefix.length);
|
|
181
|
+
}
|
|
182
|
+
return filepath;
|
|
183
|
+
}
|
|
169
184
|
|
|
170
185
|
async getStat(filepath: string, opts?: DataOpts): Promise<Result<Stat>> {
|
|
171
186
|
const url = `${this.prefix}${filepath}`;
|