@kevisual/api 0.0.39 → 0.0.41

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.39",
3
+ "version": "0.0.41",
4
4
  "description": "",
5
5
  "main": "mod.ts",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  "type": "module",
23
23
  "devDependencies": {
24
24
  "@kevisual/cache": "^0.0.5",
25
- "@kevisual/query": "^0.0.38",
26
- "@kevisual/router": "^0.0.63",
25
+ "@kevisual/query": "^0.0.39",
26
+ "@kevisual/router": "^0.0.66",
27
27
  "@kevisual/types": "^0.0.12",
28
28
  "@kevisual/use-config": "^1.0.28",
29
29
  "@types/bun": "^1.3.8",
@@ -54,4 +54,4 @@
54
54
  "./resources": "./query/query-resources/index.ts",
55
55
  "./query/*": "./query/*"
56
56
  }
57
- }
57
+ }
@@ -156,6 +156,27 @@ export class QueryResources {
156
156
 
157
157
  return { code: 200, message: '上传成功' };
158
158
  }
159
+
160
+ async getStat(filepath: string, opts?: DataOpts): Promise<Result<Stat>> {
161
+ const url = `${this.prefix}${filepath}`;
162
+ return adapter({
163
+ url,
164
+ params: {
165
+ stat: '1',
166
+ },
167
+ method: 'GET' as any,
168
+ headers: this.header(opts?.headers),
169
+ });
170
+ }
171
+ /**
172
+ * @deprecated use getStat instead
173
+ * @param filepath
174
+ * @param opts
175
+ * @returns
176
+ */
177
+ async getState(filepath: string, opts?: DataOpts): Promise<Result<Stat>> {
178
+ return this.getStat(filepath, opts);
179
+ }
159
180
  async createFolder(folderpath: string, opts?: DataOpts): Promise<Result<any>> {
160
181
  const filepath = folderpath.endsWith('/') ? `${folderpath}keep.txt` : `${folderpath}/keep.txt`;
161
182
  return this.uploadFile(filepath, '文件夹占位,其他文件不存在,文件夹不存在,如果有其他文件夹,删除当前文件夹占位文件即可', opts);
@@ -252,3 +273,17 @@ export const getContentType = (filename: string): string => {
252
273
 
253
274
  return type;
254
275
  };
276
+
277
+ type Stat = {
278
+ "standardHeaders": any,
279
+ "size": string,
280
+ "etag": string,
281
+ "lastModified": string,
282
+ "metaData": {
283
+ "app-source": string,
284
+ "cache-control": string,
285
+ "content-type": string,
286
+ "share"?: string
287
+ },
288
+ "versionId": null
289
+ }