@wxn0brp/db-core 0.10.1 → 0.10.3
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/db/memory.js +4 -2
- package/dist/db/valthera.d.ts +2 -2
- package/dist/db/valthera.js +4 -4
- package/dist/helpers/executor.d.ts +0 -6
- package/dist/helpers/executor.js +2 -11
- package/dist/types/query.d.ts +10 -0
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/db/memory.js
CHANGED
|
@@ -22,8 +22,8 @@ export class MemoryAction extends CustomActionsBase {
|
|
|
22
22
|
return collections;
|
|
23
23
|
}
|
|
24
24
|
async ensureCollection(collection) {
|
|
25
|
-
if (this.
|
|
26
|
-
return;
|
|
25
|
+
if (this.memory.has(collection))
|
|
26
|
+
return false;
|
|
27
27
|
this.memory.set(collection, []);
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
@@ -31,6 +31,8 @@ export class MemoryAction extends CustomActionsBase {
|
|
|
31
31
|
return this.memory.has(collection);
|
|
32
32
|
}
|
|
33
33
|
async removeCollection(collection) {
|
|
34
|
+
if (!this.memory.has(collection))
|
|
35
|
+
return false;
|
|
34
36
|
this.memory.delete(collection);
|
|
35
37
|
return true;
|
|
36
38
|
}
|
package/dist/db/valthera.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export declare class ValtheraClass implements ValtheraCompatible {
|
|
|
21
21
|
version: string;
|
|
22
22
|
constructor(options: DbOpts);
|
|
23
23
|
init(...args: any[]): Promise<unknown>;
|
|
24
|
-
execute<T>(name: keyof ValtheraCompatible, query: VQuery<any>): Promise<T>;
|
|
24
|
+
execute<T>(name: keyof ValtheraCompatible, query: VQuery<any> | string): Promise<T>;
|
|
25
25
|
/**
|
|
26
|
-
* Create a new instance of a
|
|
26
|
+
* Create a new instance of a Collection class.
|
|
27
27
|
*/
|
|
28
28
|
c<T = Data>(collection: string): Collection<T>;
|
|
29
29
|
/**
|
package/dist/db/valthera.js
CHANGED
|
@@ -35,7 +35,7 @@ export class ValtheraClass {
|
|
|
35
35
|
return result;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* Create a new instance of a
|
|
38
|
+
* Create a new instance of a Collection class.
|
|
39
39
|
*/
|
|
40
40
|
c(collection) {
|
|
41
41
|
return new Collection(this, collection);
|
|
@@ -50,13 +50,13 @@ export class ValtheraClass {
|
|
|
50
50
|
* Check and create the specified collection if it doesn't exist.
|
|
51
51
|
*/
|
|
52
52
|
async ensureCollection(collection) {
|
|
53
|
-
return await this.execute("ensureCollection",
|
|
53
|
+
return await this.execute("ensureCollection", collection);
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Check if a collection exists.
|
|
57
57
|
*/
|
|
58
58
|
async issetCollection(collection) {
|
|
59
|
-
return await this.execute("issetCollection",
|
|
59
|
+
return await this.execute("issetCollection", collection);
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Add data to a database.
|
|
@@ -144,6 +144,6 @@ export class ValtheraClass {
|
|
|
144
144
|
* Removes a database collection from the file system.
|
|
145
145
|
*/
|
|
146
146
|
removeCollection(collection) {
|
|
147
|
-
return this.execute("removeCollection",
|
|
147
|
+
return this.execute("removeCollection", collection);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
@@ -6,16 +6,10 @@ export interface Task {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* A simple executor for queuing and executing asynchronous operations sequentially.
|
|
9
|
-
* @class
|
|
10
9
|
*/
|
|
11
10
|
export declare class Executor {
|
|
12
11
|
quote: Task[];
|
|
13
12
|
isExecuting: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Create a new executor instance.
|
|
16
|
-
* @constructor
|
|
17
|
-
*/
|
|
18
|
-
constructor();
|
|
19
13
|
/**
|
|
20
14
|
* Add an asynchronous operation to the execution queue.
|
|
21
15
|
*/
|
package/dist/helpers/executor.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A simple executor for queuing and executing asynchronous operations sequentially.
|
|
3
|
-
* @class
|
|
4
3
|
*/
|
|
5
4
|
export class Executor {
|
|
6
|
-
quote;
|
|
7
|
-
isExecuting;
|
|
8
|
-
/**
|
|
9
|
-
* Create a new executor instance.
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
constructor() {
|
|
13
|
-
this.quote = [];
|
|
14
|
-
this.isExecuting = false;
|
|
15
|
-
}
|
|
5
|
+
quote = [];
|
|
6
|
+
isExecuting = false;
|
|
16
7
|
/**
|
|
17
8
|
* Add an asynchronous operation to the execution queue.
|
|
18
9
|
*/
|
package/dist/types/query.d.ts
CHANGED
|
@@ -44,13 +44,23 @@ export declare namespace VQueryT {
|
|
|
44
44
|
type: "added" | "removed";
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
/** @deprecated */
|
|
47
48
|
export type QueryBase<T = Data> = VQueryT.QueryBase<T>;
|
|
49
|
+
/** @deprecated */
|
|
48
50
|
export type AddQuery<T = Data> = VQueryT.Add<T>;
|
|
51
|
+
/** @deprecated */
|
|
49
52
|
export type FindQuery<T = Data> = VQueryT.Find<T>;
|
|
53
|
+
/** @deprecated */
|
|
50
54
|
export type FindOneQuery<T = Data> = VQueryT.FindOne<T>;
|
|
55
|
+
/** @deprecated */
|
|
51
56
|
export type UpdateQuery<T = Data> = VQueryT.Update<T>;
|
|
57
|
+
/** @deprecated */
|
|
52
58
|
export type RemoveQuery<T = Data> = VQueryT.Remove<T>;
|
|
59
|
+
/** @deprecated */
|
|
53
60
|
export type UpdateOneOrAddQuery<T = Data> = VQueryT.UpdateOneOrAdd<T>;
|
|
61
|
+
/** @deprecated */
|
|
54
62
|
export type ToggleOneQuery<T = Data> = VQueryT.ToggleOne<T>;
|
|
63
|
+
/** @deprecated */
|
|
55
64
|
export type UpdateOneOrAddResult<T> = VQueryT.UpdateOneOrAddResult<T>;
|
|
65
|
+
/** @deprecated */
|
|
56
66
|
export type ToggleOneResult<T> = VQueryT.ToggleOneResult<T>;
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.10.
|
|
1
|
+
export const version = "0.10.3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/db-core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "wxn0brP",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/bun": "*",
|
|
20
20
|
"@types/node": "*",
|
|
21
|
-
"tsc-alias": "
|
|
22
|
-
"typescript": "
|
|
21
|
+
"tsc-alias": "^1",
|
|
22
|
+
"typescript": "^6"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|