@wxn0brp/db-storage-bin 0.0.10 → 0.0.12
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/actions.d.ts +2 -33
- package/dist/actions.js +2 -58
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/actions.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Data from "@wxn0brp/db-core/types/data";
|
|
3
|
-
import FileCpu from "@wxn0brp/db-core/types/fileCpu";
|
|
1
|
+
import { CustomActionsBase } from "@wxn0brp/db-core/base/custom";
|
|
4
2
|
import { DbOpts } from "@wxn0brp/db-core/types/options";
|
|
5
3
|
import { VQuery } from "@wxn0brp/db-core/types/query";
|
|
6
4
|
import { BinManager } from "./bin/index.js";
|
|
7
|
-
export declare class BinFileAction extends
|
|
5
|
+
export declare class BinFileAction extends CustomActionsBase {
|
|
8
6
|
private mgr;
|
|
9
7
|
folder: string;
|
|
10
8
|
options: DbOpts;
|
|
11
|
-
fileCpu: FileCpu;
|
|
12
9
|
/**
|
|
13
10
|
* Creates a new instance of dbActionC.
|
|
14
11
|
* @constructor
|
|
@@ -29,34 +26,6 @@ export declare class BinFileAction extends dbActionBase {
|
|
|
29
26
|
* Check if a collection exists.
|
|
30
27
|
*/
|
|
31
28
|
issetCollection({ collection }: VQuery): Promise<boolean>;
|
|
32
|
-
/**
|
|
33
|
-
* Add a new entry to the specified database.
|
|
34
|
-
*/
|
|
35
|
-
add(query: VQuery): Promise<import("@wxn0brp/db-core/types/arg").Arg>;
|
|
36
|
-
/**
|
|
37
|
-
* Find entries in the specified database based on search criteria.
|
|
38
|
-
*/
|
|
39
|
-
find(query: VQuery): Promise<Data[]>;
|
|
40
|
-
/**
|
|
41
|
-
* Find the first matching entry in the specified database based on search criteria.
|
|
42
|
-
*/
|
|
43
|
-
findOne({ collection, search, context, findOpts }: VQuery): Promise<Data>;
|
|
44
|
-
/**
|
|
45
|
-
* Update entries in the specified database based on search criteria and an updater function or object.
|
|
46
|
-
*/
|
|
47
|
-
update({ collection, search, updater, context }: VQuery): Promise<boolean>;
|
|
48
|
-
/**
|
|
49
|
-
* Update the first matching entry in the specified database based on search criteria and an updater function or object.
|
|
50
|
-
*/
|
|
51
|
-
updateOne({ collection, search, updater, context }: VQuery): Promise<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* Remove entries from the specified database based on search criteria.
|
|
54
|
-
*/
|
|
55
|
-
remove({ collection, search, context }: VQuery): Promise<boolean>;
|
|
56
|
-
/**
|
|
57
|
-
* Remove the first matching entry from the specified database based on search criteria.
|
|
58
|
-
*/
|
|
59
|
-
removeOne({ collection, search, context }: VQuery): Promise<boolean>;
|
|
60
29
|
/**
|
|
61
30
|
* Removes a database collection from the file system.
|
|
62
31
|
*/
|
package/dist/actions.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { CustomFileCpu } from "@wxn0brp/db-core";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { findUtil } from "@wxn0brp/db-core/utils/action";
|
|
5
|
-
export class BinFileAction extends dbActionBase {
|
|
2
|
+
import { CustomActionsBase } from "@wxn0brp/db-core/base/custom";
|
|
3
|
+
export class BinFileAction extends CustomActionsBase {
|
|
6
4
|
mgr;
|
|
7
5
|
folder;
|
|
8
6
|
options;
|
|
9
|
-
fileCpu;
|
|
10
7
|
/**
|
|
11
8
|
* Creates a new instance of dbActionC.
|
|
12
9
|
* @constructor
|
|
@@ -44,59 +41,6 @@ export class BinFileAction extends dbActionBase {
|
|
|
44
41
|
const collections = await this.getCollections();
|
|
45
42
|
return collections.includes(collection);
|
|
46
43
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Add a new entry to the specified database.
|
|
49
|
-
*/
|
|
50
|
-
async add(query) {
|
|
51
|
-
await this.ensureCollection(arguments[0]);
|
|
52
|
-
await addId(query, this);
|
|
53
|
-
const { collection, data } = query;
|
|
54
|
-
await this.fileCpu.add(collection, data);
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Find entries in the specified database based on search criteria.
|
|
59
|
-
*/
|
|
60
|
-
async find(query) {
|
|
61
|
-
await this.ensureCollection(query);
|
|
62
|
-
return await findUtil(query, this.fileCpu, [query.collection]);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Find the first matching entry in the specified database based on search criteria.
|
|
66
|
-
*/
|
|
67
|
-
async findOne({ collection, search, context = {}, findOpts = {} }) {
|
|
68
|
-
await this.ensureCollection(arguments[0]);
|
|
69
|
-
let data = await this.fileCpu.findOne(collection, search, context, findOpts);
|
|
70
|
-
return data || null;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Update entries in the specified database based on search criteria and an updater function or object.
|
|
74
|
-
*/
|
|
75
|
-
async update({ collection, search, updater, context = {} }) {
|
|
76
|
-
await this.ensureCollection(arguments[0]);
|
|
77
|
-
return await this.fileCpu.update(collection, false, search, updater, context);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Update the first matching entry in the specified database based on search criteria and an updater function or object.
|
|
81
|
-
*/
|
|
82
|
-
async updateOne({ collection, search, updater, context = {} }) {
|
|
83
|
-
await this.ensureCollection(arguments[0]);
|
|
84
|
-
return await this.fileCpu.update(collection, true, search, updater, context);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Remove entries from the specified database based on search criteria.
|
|
88
|
-
*/
|
|
89
|
-
async remove({ collection, search, context = {} }) {
|
|
90
|
-
await this.ensureCollection(arguments[0]);
|
|
91
|
-
return await this.fileCpu.remove(collection, false, search, context);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Remove the first matching entry from the specified database based on search criteria.
|
|
95
|
-
*/
|
|
96
|
-
async removeOne({ collection, search, context = {} }) {
|
|
97
|
-
await this.ensureCollection(arguments[0]);
|
|
98
|
-
return await this.fileCpu.remove(collection, true, search, context);
|
|
99
|
-
}
|
|
100
44
|
/**
|
|
101
45
|
* Removes a database collection from the file system.
|
|
102
46
|
*/
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.0.
|
|
1
|
+
export const version = "0.0.12";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/db-storage-bin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "wxn0brP",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "*",
|
|
22
|
-
"@wxn0brp/db-core": "^0.
|
|
22
|
+
"@wxn0brp/db-core": "^0.7.0",
|
|
23
23
|
"tsc-alias": "*",
|
|
24
24
|
"typescript": "*"
|
|
25
25
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@msgpack/msgpack": "^3.1.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@wxn0brp/db-core": ">=0.
|
|
30
|
+
"@wxn0brp/db-core": ">=0.7.0"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist"
|