feat: 更新版本至 0.0.63,升级依赖项并添加 setPrefix 和 getRelativePath 方法
This commit is contained in:
14
package.json
14
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kevisual/api",
|
||||
"version": "0.0.62",
|
||||
"version": "0.0.63",
|
||||
"description": "",
|
||||
"main": "mod.ts",
|
||||
"scripts": {
|
||||
@@ -18,18 +18,18 @@
|
||||
"keywords": [],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||
"license": "MIT",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
"packageManager": "pnpm@10.32.1",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@kevisual/cache": "^0.0.5",
|
||||
"@kevisual/code-builder": "^0.0.6",
|
||||
"@kevisual/query": "^0.0.52",
|
||||
"@kevisual/remote-app": "^0.0.4",
|
||||
"@kevisual/router": "^0.0.85",
|
||||
"@kevisual/query": "^0.0.53",
|
||||
"@kevisual/remote-app": "^0.0.6",
|
||||
"@kevisual/router": "^0.1.1",
|
||||
"@kevisual/types": "^0.0.12",
|
||||
"@kevisual/use-config": "^1.0.30",
|
||||
"@types/bun": "^1.3.10",
|
||||
"@types/node": "^25.3.3",
|
||||
"@types/node": "^25.4.0",
|
||||
"@types/spark-md5": "^3.0.5",
|
||||
"dotenv": "^17.3.1",
|
||||
"fast-glob": "^3.3.3",
|
||||
@@ -37,7 +37,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@kevisual/context": "^0.0.8",
|
||||
"@kevisual/js-filter": "^0.0.5",
|
||||
"@kevisual/js-filter": "^0.0.6",
|
||||
"@kevisual/load": "^0.0.6",
|
||||
"@paralleldrive/cuid2": "^3.3.0",
|
||||
"es-toolkit": "^1.45.1",
|
||||
|
||||
52
pnpm-lock.yaml
generated
52
pnpm-lock.yaml
generated
@@ -12,8 +12,8 @@ importers:
|
||||
specifier: ^0.0.8
|
||||
version: 0.0.8
|
||||
'@kevisual/js-filter':
|
||||
specifier: ^0.0.5
|
||||
version: 0.0.5
|
||||
specifier: ^0.0.6
|
||||
version: 0.0.6
|
||||
'@kevisual/load':
|
||||
specifier: ^0.0.6
|
||||
version: 0.0.6
|
||||
@@ -52,14 +52,14 @@ importers:
|
||||
specifier: ^0.0.6
|
||||
version: 0.0.6
|
||||
'@kevisual/query':
|
||||
specifier: ^0.0.52
|
||||
version: 0.0.52
|
||||
specifier: ^0.0.53
|
||||
version: 0.0.53
|
||||
'@kevisual/remote-app':
|
||||
specifier: ^0.0.4
|
||||
version: 0.0.4
|
||||
specifier: ^0.0.6
|
||||
version: 0.0.6
|
||||
'@kevisual/router':
|
||||
specifier: ^0.0.85
|
||||
version: 0.0.85
|
||||
specifier: ^0.1.1
|
||||
version: 0.1.1
|
||||
'@kevisual/types':
|
||||
specifier: ^0.0.12
|
||||
version: 0.0.12
|
||||
@@ -70,8 +70,8 @@ importers:
|
||||
specifier: ^1.3.10
|
||||
version: 1.3.10
|
||||
'@types/node':
|
||||
specifier: ^25.3.3
|
||||
version: 25.3.3
|
||||
specifier: ^25.4.0
|
||||
version: 25.4.0
|
||||
'@types/spark-md5':
|
||||
specifier: ^3.0.5
|
||||
version: 3.0.5
|
||||
@@ -117,8 +117,8 @@ packages:
|
||||
'@kevisual/context@0.0.8':
|
||||
resolution: {integrity: sha512-DTJpyHI34NE76B7g6f+QlIqiCCyqI2qkBMQE736dzeRDGxOjnbe2iQY9W+Rt2PE6kmymM3qyOmSfNovyWyWrkA==}
|
||||
|
||||
'@kevisual/js-filter@0.0.5':
|
||||
resolution: {integrity: sha512-+S+Sf3K/aP6XtZI2s7TgKOr35UuvUvtpJ9YDW30a+mY0/N8gRuzyKhieBzQN7Ykayzz70uoMavBXut2rUlLgzw==}
|
||||
'@kevisual/js-filter@0.0.6':
|
||||
resolution: {integrity: sha512-FcbOsmS1inhwrfgXMM/XLFTGTHUxBCss32JEMYdEFWQDYCar5rN8cxD1W8FuKDTVRlpA+zBpQ/BE6XT4UaeljA==}
|
||||
|
||||
'@kevisual/load@0.0.6':
|
||||
resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==}
|
||||
@@ -126,17 +126,17 @@ packages:
|
||||
'@kevisual/query@0.0.18':
|
||||
resolution: {integrity: sha512-I2vHTu0I6AyD9PJyr+vxyp9jIJ6rd2EZqLVHTv/+zrVKVc2SS76Tg7aGNkmAFqqLSCB8kLLsmMGtSJU1Qb8VVg==}
|
||||
|
||||
'@kevisual/query@0.0.52':
|
||||
resolution: {integrity: sha512-m1UbyDTIxtfAQXM+EqhXA4ytE2V8rV8mXTZVBwzfW9O6+gtvAcRY7K1YYxfewTSXLVh9nwvfHe0KQ8MDL5ukyw==}
|
||||
'@kevisual/query@0.0.53':
|
||||
resolution: {integrity: sha512-PAhpCLBr0emz0lGNlTVHMbJiC5wrtGLbInPddRzgKE35fiyNt+SWSsUWABiD0DeNrLN/OxWyAFobt880Z/e5MQ==}
|
||||
|
||||
'@kevisual/remote-app@0.0.4':
|
||||
resolution: {integrity: sha512-2yIlWY98pLCcxG+DJsqXXkd5YYEgymuOsyElH+31AoEPb7mlNREnYS81zN0KM9nvdSmU2G51vV4UVirJlYBZCQ==}
|
||||
'@kevisual/remote-app@0.0.6':
|
||||
resolution: {integrity: sha512-yc3BKAhtY+SzrvQSebeyR/QR93nPctndNMnW6ne1YPK+Kfpuf8gi7W4zlg18EJh7FEpDuDVHKqVp1klsWjESqQ==}
|
||||
|
||||
'@kevisual/router@0.0.20':
|
||||
resolution: {integrity: sha512-uSwDYWh+kvAu6i0m0SJVgcLR/CYz7WvIWGz0nSF8Vg6smJuAgI+laHR4ESO8Fbz+Xn8bPHuSwmM//HHLMLx2FA==}
|
||||
|
||||
'@kevisual/router@0.0.85':
|
||||
resolution: {integrity: sha512-ihSzPXHOMSOnZD/+Eso4yZMt4MoUXyLdfRHhXJGg90+sJBr/BjsmgAokit4pI9gWU+Rs/3JqQ2/aqA43FHtGoA==}
|
||||
'@kevisual/router@0.1.1':
|
||||
resolution: {integrity: sha512-+uaJc+Bf/T1mfxyfy9PmwuxJGPOLhVqrmsli2xUPqkkFvizrFIGB1vBTITuo5XP/FnwGqxgbjsitG57AMubm3w==}
|
||||
|
||||
'@kevisual/types@0.0.10':
|
||||
resolution: {integrity: sha512-Q73uzzjk9UidumnmCvOpgzqDDvQxsblz22bIFuoiioUFJWwaparx8bpd8ArRyFojicYL1YJoFDzDZ9j9NN8grA==}
|
||||
@@ -188,8 +188,8 @@ packages:
|
||||
'@types/node@22.15.27':
|
||||
resolution: {integrity: sha512-5fF+eu5mwihV2BeVtX5vijhdaZOfkQTATrePEaXTcKqI16LhJ7gi2/Vhd9OZM0UojcdmiOCVg5rrax+i1MdoQQ==}
|
||||
|
||||
'@types/node@25.3.3':
|
||||
resolution: {integrity: sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ==}
|
||||
'@types/node@25.4.0':
|
||||
resolution: {integrity: sha512-9wLpoeWuBlcbBpOY3XmzSTG3oscB6xjBEEtn+pYXTfhyXhIxC5FsBer2KTopBlvKEiW9l13po9fq+SJY/5lkhw==}
|
||||
|
||||
'@types/spark-md5@3.0.5':
|
||||
resolution: {integrity: sha512-lWf05dnD42DLVKQJZrDHtWFidcLrHuip01CtnC2/S6AMhX4t9ZlEUj4iuRlAnts0PQk7KESOqKxeGE/b6sIPGg==}
|
||||
@@ -503,7 +503,7 @@ snapshots:
|
||||
|
||||
'@kevisual/context@0.0.8': {}
|
||||
|
||||
'@kevisual/js-filter@0.0.5': {}
|
||||
'@kevisual/js-filter@0.0.6': {}
|
||||
|
||||
'@kevisual/load@0.0.6':
|
||||
dependencies:
|
||||
@@ -517,16 +517,16 @@ snapshots:
|
||||
- ws
|
||||
- zod
|
||||
|
||||
'@kevisual/query@0.0.52': {}
|
||||
'@kevisual/query@0.0.53': {}
|
||||
|
||||
'@kevisual/remote-app@0.0.4': {}
|
||||
'@kevisual/remote-app@0.0.6': {}
|
||||
|
||||
'@kevisual/router@0.0.20':
|
||||
dependencies:
|
||||
path-to-regexp: 8.2.0
|
||||
selfsigned: 2.4.1
|
||||
|
||||
'@kevisual/router@0.0.85':
|
||||
'@kevisual/router@0.1.1':
|
||||
dependencies:
|
||||
es-toolkit: 1.45.1
|
||||
|
||||
@@ -582,7 +582,7 @@ snapshots:
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
'@types/node@25.3.3':
|
||||
'@types/node@25.4.0':
|
||||
dependencies:
|
||||
undici-types: 7.18.2
|
||||
|
||||
@@ -606,7 +606,7 @@ snapshots:
|
||||
|
||||
bun-types@1.3.10:
|
||||
dependencies:
|
||||
'@types/node': 25.3.3
|
||||
'@types/node': 25.4.0
|
||||
|
||||
call-bind-apply-helpers@1.0.2:
|
||||
dependencies:
|
||||
|
||||
@@ -26,6 +26,10 @@ export class QueryResources {
|
||||
setUsername(username: string) {
|
||||
this.prefix = `/${username}/resources/`;
|
||||
}
|
||||
/**
|
||||
* 设置prefix,类似 /{username}/resources/;
|
||||
* @param prefix
|
||||
*/
|
||||
setPrefix(prefix: string) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
@@ -166,6 +170,17 @@ export class QueryResources {
|
||||
this.onProcess?.({ type: 'uploadFinish', filename, size: file.size, process: 100 });
|
||||
return { code: 200, message: '上传成功' };
|
||||
}
|
||||
/**
|
||||
* 移除 prefix,获取相对路径
|
||||
* @param filepath
|
||||
* @returns
|
||||
*/
|
||||
getRelativePath(filepath: string): string {
|
||||
if (filepath.startsWith(this.prefix)) {
|
||||
return filepath.slice(this.prefix.length);
|
||||
}
|
||||
return filepath;
|
||||
}
|
||||
|
||||
async getStat(filepath: string, opts?: DataOpts): Promise<Result<Stat>> {
|
||||
const url = `${this.prefix}${filepath}`;
|
||||
|
||||
Reference in New Issue
Block a user