@spica-devkit/storage 0.18.9 → 0.18.11
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/index.d.ts +78 -1
- package/package.json +1 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/interface.d.ts +0 -14
- package/dist/src/storage.d.ts +0 -30
- package/dist/src/utility.d.ts +0 -11
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
interface SuccessResponse<P, R = P> {
|
|
2
|
+
request: P;
|
|
3
|
+
response: R;
|
|
4
|
+
}
|
|
5
|
+
interface FailureResponse<P> {
|
|
6
|
+
request: P;
|
|
7
|
+
response: {
|
|
8
|
+
message: string;
|
|
9
|
+
error: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
interface ManyResponse<P, R> {
|
|
13
|
+
successes: SuccessResponse<P, R>[];
|
|
14
|
+
failures: FailureResponse<P>[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface StorageObject {
|
|
18
|
+
_id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
url: string;
|
|
21
|
+
content: {
|
|
22
|
+
type: string;
|
|
23
|
+
size: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface BufferWithMeta {
|
|
27
|
+
data: any;
|
|
28
|
+
name: string;
|
|
29
|
+
contentType: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface PublicInitialization {
|
|
33
|
+
publicUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
interface ApikeyInitialization extends PublicInitialization {
|
|
36
|
+
apikey: string;
|
|
37
|
+
}
|
|
38
|
+
interface IdentityInitialization extends PublicInitialization {
|
|
39
|
+
identity: string;
|
|
40
|
+
}
|
|
41
|
+
interface IndexResult<T> {
|
|
42
|
+
meta: {
|
|
43
|
+
total: number;
|
|
44
|
+
};
|
|
45
|
+
data: T[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare function initialize(options: ApikeyInitialization | IdentityInitialization): void;
|
|
49
|
+
declare function insert(object: File | BufferWithMeta, onUploadProgress?: (progress: ProgressEvent) => void, headers?: object): Promise<StorageObject>;
|
|
50
|
+
declare function insertMany(objects: FileList | (File | BufferWithMeta)[], onUploadProgress?: (progress: ProgressEvent) => void, headers?: object): Promise<StorageObject[]>;
|
|
51
|
+
declare function get(id: string, headers?: object): Promise<StorageObject>;
|
|
52
|
+
declare function download(id: string, options?: {
|
|
53
|
+
headers?: any;
|
|
54
|
+
onDownloadProgress?: (progress: ProgressEvent) => void;
|
|
55
|
+
}): Promise<unknown>;
|
|
56
|
+
declare function getAll(queryParams?: {
|
|
57
|
+
filter?: object;
|
|
58
|
+
paginate?: false;
|
|
59
|
+
limit?: number;
|
|
60
|
+
skip?: number;
|
|
61
|
+
sort?: object;
|
|
62
|
+
}, headers?: object): Promise<StorageObject[]>;
|
|
63
|
+
declare function getAll(queryParams?: {
|
|
64
|
+
filter?: object;
|
|
65
|
+
paginate?: true;
|
|
66
|
+
limit?: number;
|
|
67
|
+
skip?: number;
|
|
68
|
+
sort?: object;
|
|
69
|
+
}, headers?: object): Promise<IndexResult<StorageObject>>;
|
|
70
|
+
declare function update(id: string, object: File | BufferWithMeta, onUploadProgress?: (progress: ProgressEvent) => void, headers?: object): Promise<StorageObject>;
|
|
71
|
+
declare function updateMeta(id: string, meta: {
|
|
72
|
+
name: string;
|
|
73
|
+
}, headers?: object): Promise<StorageObject>;
|
|
74
|
+
declare function remove(id: string, headers?: object): any;
|
|
75
|
+
declare function removeMany(ids: string[], headers?: object): Promise<ManyResponse<string, string>>;
|
|
76
|
+
|
|
77
|
+
export { download, get, getAll, initialize, insert, insertMany, remove, removeMany, update, updateMeta };
|
|
78
|
+
export type { BufferWithMeta, StorageObject };
|
package/package.json
CHANGED
package/dist/src/index.d.ts
DELETED
package/dist/src/interface.d.ts
DELETED
package/dist/src/storage.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { StorageObject, BufferWithMeta } from "./interface";
|
|
2
|
-
import { ApikeyInitialization, IdentityInitialization, IndexResult } from "@spica-server/interface/function/packages";
|
|
3
|
-
export declare function initialize(options: ApikeyInitialization | IdentityInitialization): void;
|
|
4
|
-
export declare function insert(object: File | BufferWithMeta, onUploadProgress?: (progress: ProgressEvent) => void, headers?: object): Promise<StorageObject>;
|
|
5
|
-
export declare function insertMany(objects: FileList | (File | BufferWithMeta)[], onUploadProgress?: (progress: ProgressEvent) => void, headers?: object): Promise<StorageObject[]>;
|
|
6
|
-
export declare function get(id: string, headers?: object): Promise<StorageObject>;
|
|
7
|
-
export declare function download(id: string, options?: {
|
|
8
|
-
headers?: any;
|
|
9
|
-
onDownloadProgress?: (progress: ProgressEvent) => void;
|
|
10
|
-
}): Promise<unknown>;
|
|
11
|
-
export declare function getAll(queryParams?: {
|
|
12
|
-
filter?: object;
|
|
13
|
-
paginate?: false;
|
|
14
|
-
limit?: number;
|
|
15
|
-
skip?: number;
|
|
16
|
-
sort?: object;
|
|
17
|
-
}, headers?: object): Promise<StorageObject[]>;
|
|
18
|
-
export declare function getAll(queryParams?: {
|
|
19
|
-
filter?: object;
|
|
20
|
-
paginate?: true;
|
|
21
|
-
limit?: number;
|
|
22
|
-
skip?: number;
|
|
23
|
-
sort?: object;
|
|
24
|
-
}, headers?: object): Promise<IndexResult<StorageObject>>;
|
|
25
|
-
export declare function update(id: string, object: File | BufferWithMeta, onUploadProgress?: (progress: ProgressEvent) => void, headers?: object): Promise<StorageObject>;
|
|
26
|
-
export declare function updateMeta(id: string, meta: {
|
|
27
|
-
name: string;
|
|
28
|
-
}, headers?: object): Promise<StorageObject>;
|
|
29
|
-
export declare function remove(id: string, headers?: object): any;
|
|
30
|
-
export declare function removeMany(ids: string[], headers?: object): Promise<import("@spica-server/interface/batch").ManyResponse<string, string>>;
|
package/dist/src/utility.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BufferWithMeta } from "./interface";
|
|
2
|
-
import form from "form-data";
|
|
3
|
-
export declare function fileToBuffer(file: File): Promise<any>;
|
|
4
|
-
export declare function preparePostBody(objects: FileList | (BufferWithMeta | File)[]): Promise<{
|
|
5
|
-
body: form | FormData;
|
|
6
|
-
headers: any;
|
|
7
|
-
}>;
|
|
8
|
-
export declare function preparePutBody(object: File | BufferWithMeta): Promise<{
|
|
9
|
-
body: form | FormData;
|
|
10
|
-
headers: any;
|
|
11
|
-
}>;
|