@wxn0brp/db-core 0.12.0-alpha.1 → 0.12.0
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/valthera.d.ts +1 -1
- package/dist/db/valthera.js +2 -1
- package/dist/utils/compare.js +1 -1
- package/dist/utils/updateObject.js +7 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
package/dist/db/valthera.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare class ValtheraClass implements ValtheraCompatible {
|
|
|
81
81
|
*/
|
|
82
82
|
toggleOne<T = Data>(query: VQueryT.ToggleOne<T>): Promise<VQueryT.ToggleOneResult<T>>;
|
|
83
83
|
/**
|
|
84
|
-
* Removes a database collection from the
|
|
84
|
+
* Removes a database collection from the database.
|
|
85
85
|
*/
|
|
86
86
|
removeCollection(collection: string): Promise<boolean>;
|
|
87
87
|
}
|
package/dist/db/valthera.js
CHANGED
|
@@ -196,9 +196,10 @@ export class ValtheraClass {
|
|
|
196
196
|
return this.execute("toggleOne", query);
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
|
-
* Removes a database collection from the
|
|
199
|
+
* Removes a database collection from the database.
|
|
200
200
|
*/
|
|
201
201
|
removeCollection(collection) {
|
|
202
|
+
this._collections.delete(collection);
|
|
202
203
|
return this.execute("removeCollection", collection);
|
|
203
204
|
}
|
|
204
205
|
}
|
package/dist/utils/compare.js
CHANGED
|
@@ -10,7 +10,7 @@ export function compareSafe(a, b) {
|
|
|
10
10
|
const typeA = typeof a;
|
|
11
11
|
const typeB = typeof b;
|
|
12
12
|
if (typeA === "string" && typeB === "string") {
|
|
13
|
-
return a.localeCompare(b);
|
|
13
|
+
return Math.sign(a.localeCompare(b));
|
|
14
14
|
}
|
|
15
15
|
if ((typeA === "number" || a instanceof Date) &&
|
|
16
16
|
(typeB === "number" || b instanceof Date)) {
|
|
@@ -67,7 +67,13 @@ function mainUpdate(obj, fields) {
|
|
|
67
67
|
return item.filter(i => !updater.includes(i));
|
|
68
68
|
},
|
|
69
69
|
merge: (item, updater) => {
|
|
70
|
-
if (
|
|
70
|
+
if (Array.isArray(item) && Array.isArray(updater)) {
|
|
71
|
+
return [...item, ...updater];
|
|
72
|
+
}
|
|
73
|
+
if (typeof item === "object" &&
|
|
74
|
+
typeof updater === "object" &&
|
|
75
|
+
!Array.isArray(item) &&
|
|
76
|
+
!Array.isArray(updater)) {
|
|
71
77
|
Object.assign(item, updater);
|
|
72
78
|
return item;
|
|
73
79
|
}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.12.0
|
|
1
|
+
export const version = "0.12.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/db-core",
|
|
3
|
-
"version": "0.12.0
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "wxn0brP",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/bun": "*",
|
|
20
20
|
"@types/node": "*",
|
|
21
|
+
"fast-check": "^4",
|
|
21
22
|
"tsc-alias": "^1",
|
|
22
23
|
"typescript": "^7"
|
|
23
24
|
},
|