@wxn0brp/db-core 0.2.11 → 0.2.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.
|
@@ -39,5 +39,9 @@ declare class CollectionManager<D = Data> {
|
|
|
39
39
|
* Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
|
|
40
40
|
*/
|
|
41
41
|
updateOneOrAdd<T = Data>(search: Search<T & Data>, updater: Updater<T & Data>, { add_arg, context, id_gen }: UpdateOneOrAdd<T & Data>): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Asynchronously removes one entry in a database or adds a new one if it doesn't exist. Usage e.g. for toggling a flag.
|
|
44
|
+
*/
|
|
45
|
+
toggleOne<T = Data>(search: Search<T & Data>, data?: Arg<T & Data>, context?: VContext): Promise<boolean>;
|
|
42
46
|
}
|
|
43
47
|
export default CollectionManager;
|
|
@@ -53,5 +53,11 @@ class CollectionManager {
|
|
|
53
53
|
async updateOneOrAdd(search, updater, { add_arg = {}, context = {}, id_gen = true }) {
|
|
54
54
|
return await this.db.updateOneOrAdd(this.collection, search, updater, { add_arg, context, id_gen });
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Asynchronously removes one entry in a database or adds a new one if it doesn't exist. Usage e.g. for toggling a flag.
|
|
58
|
+
*/
|
|
59
|
+
async toggleOne(search, data = {}, context = {}) {
|
|
60
|
+
return await this.db.toggleOne(this.collection, search, data, context);
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
export default CollectionManager;
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.2.
|
|
1
|
+
export const version = "0.2.12";
|