@wxn0brp/db-core 0.3.0 → 0.3.2

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.
@@ -38,7 +38,7 @@ declare class CollectionManager<D = Data> {
38
38
  /**
39
39
  * Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
40
40
  */
41
- updateOneOrAdd<T = Data>(search: Search<T & D>, updater: Updater<T & D>, { add_arg, context, id_gen }: UpdateOneOrAdd<T & D>): Promise<boolean>;
41
+ updateOneOrAdd<T = Data>(search: Search<T & D>, updater: Updater<T & D>, { add_arg, context, id_gen }?: UpdateOneOrAdd<T & D>): Promise<boolean>;
42
42
  /**
43
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
44
  */
@@ -50,7 +50,7 @@ class CollectionManager {
50
50
  /**
51
51
  * Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
52
52
  */
53
- async updateOneOrAdd(search, updater, { add_arg = {}, context = {}, id_gen = true }) {
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
56
  /**
@@ -1,4 +1,5 @@
1
1
  import { DeepPartial, NestedValue } from "./utils.js";
2
+ export type JSPrimitiveType = "string" | "number" | "boolean" | "bigint" | "symbol" | "undefined" | "function" | "object";
2
3
  /** Logical Operators */
3
4
  export type LogicalOperators<T = any> = {
4
5
  /**
@@ -49,9 +50,9 @@ export type ComparisonOperators<T = any> = {
49
50
  /** Type and Existence Operators with nested support */
50
51
  export type TypeAndExistenceOperators<T = any> = {
51
52
  /** "name" in { name: "John" } */
52
- $exists?: NestedValue<T, boolean>;
53
+ $exists?: NestedValue<T, boolean, any>;
53
54
  /** "name" == "string" in { name: "John" } */
54
- $type?: NestedValue<T, string>;
55
+ $type?: NestedValue<T, JSPrimitiveType, any>;
55
56
  };
56
57
  /** Array Operators with nested support */
57
58
  export type ArrayOperators<T = any> = {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.3.0";
1
+ export const version = "0.3.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-core",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "author": "wxn0brP",