@tblabs/storage 5.12.4 → 5.12.6
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/Datasets/Dataset.js +1 -1
- package/Datasets/PicturesDataset/PicturesDataset.d.ts +3 -3
- package/Datasets/PicturesDataset/PicturesDataset.js +5 -5
- package/Datasets/RawTextDataset.js +1 -1
- package/Services/DatasetType.d.ts +4 -4
- package/Services/DatasetType.js +4 -4
- package/package.json +1 -1
- package/tblabs-storage-5.12.6.tgz +0 -0
- package/tblabs-storage-5.12.4.tgz +0 -0
package/Datasets/Dataset.js
CHANGED
|
@@ -12,9 +12,9 @@ export declare class PicturesDataset extends DatasetBase {
|
|
|
12
12
|
Type: DatasetType;
|
|
13
13
|
constructor(_db: OnlineStorage, dataset: dir, picsConfig?: PicsConfig);
|
|
14
14
|
GetAllIds(): Promise<string[]>;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
GetOne(id: string): Promise<PicturePack>;
|
|
16
|
+
GetAll(): Promise<PicturePack[]>;
|
|
17
|
+
Add(files: File[]): Promise<PicturesUploadResult>;
|
|
18
18
|
Delete(id: string): Promise<void>;
|
|
19
19
|
Drop(): Promise<void>;
|
|
20
20
|
}
|
|
@@ -11,7 +11,7 @@ export class PicturesDataset extends DatasetBase {
|
|
|
11
11
|
_db;
|
|
12
12
|
dataset;
|
|
13
13
|
picsConfig;
|
|
14
|
-
Type = DatasetType.
|
|
14
|
+
Type = DatasetType.Picture;
|
|
15
15
|
constructor(_db, dataset, picsConfig = DefaultPicsConfig) {
|
|
16
16
|
super(_db, dataset);
|
|
17
17
|
this._db = _db;
|
|
@@ -25,21 +25,21 @@ export class PicturesDataset extends DatasetBase {
|
|
|
25
25
|
}
|
|
26
26
|
return result.Result;
|
|
27
27
|
}
|
|
28
|
-
async
|
|
28
|
+
async GetOne(id) {
|
|
29
29
|
const result = await this._db.Send(new GetPictureQuery(this._db.DatabaseDir, this.dataset, id));
|
|
30
30
|
if (!result.IsSuccess) {
|
|
31
31
|
throw new Error("Failed to get picture: " + result.ErrorMessage);
|
|
32
32
|
}
|
|
33
33
|
return result.Result;
|
|
34
34
|
}
|
|
35
|
-
async
|
|
35
|
+
async GetAll() {
|
|
36
36
|
const result = await this._db.Send(new ListPicturesQuery(this._db.DatabaseDir, this.dataset));
|
|
37
37
|
if (!result.IsSuccess) {
|
|
38
38
|
throw new Error("Failed to list picture packs: " + result.ErrorMessage);
|
|
39
39
|
}
|
|
40
40
|
return result.Result;
|
|
41
41
|
}
|
|
42
|
-
async
|
|
42
|
+
async Add(files) {
|
|
43
43
|
try {
|
|
44
44
|
if (!files) {
|
|
45
45
|
return PicturesUploadResult.Failure("No files provided");
|
|
@@ -56,7 +56,7 @@ export class PicturesDataset extends DatasetBase {
|
|
|
56
56
|
{
|
|
57
57
|
serverUrl = serverUrl.slice(0, -1);
|
|
58
58
|
}
|
|
59
|
-
const response = await fetch(serverUrl + "/
|
|
59
|
+
const response = await fetch(serverUrl + "/pictures-upload", {
|
|
60
60
|
method: 'POST',
|
|
61
61
|
body: formData,
|
|
62
62
|
});
|
package/Services/DatasetType.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export var DatasetType;
|
|
2
2
|
(function (DatasetType) {
|
|
3
|
-
DatasetType["Unknown"] = "
|
|
4
|
-
DatasetType["
|
|
5
|
-
DatasetType["
|
|
6
|
-
DatasetType["
|
|
3
|
+
DatasetType["Unknown"] = "Unknown";
|
|
4
|
+
DatasetType["Object"] = "Object";
|
|
5
|
+
DatasetType["Text"] = "Text";
|
|
6
|
+
DatasetType["Picture"] = "Picture";
|
|
7
7
|
})(DatasetType || (DatasetType = {}));
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|