@wxn0brp/db-core 0.5.0-alpha.1 → 0.5.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.
@@ -6,9 +6,6 @@ import { Data } from "../types/data.js";
6
6
  import { DbOpts } from "../types/options.js";
7
7
  import { VQuery } from "../types/query.js";
8
8
  import { AddQuery, FindOneQuery, FindQuery, RemoveQuery, ToggleOneQuery, UpdateOneOrAddQuery, UpdateQuery, ValtheraCompatible } from "../types/valthera.js";
9
- type DbActionsFns = keyof {
10
- [K in keyof ActionsBase as ActionsBase[K] extends (...args: any[]) => any ? K : never]: any;
11
- };
12
9
  /**
13
10
  * Represents a database management class for performing CRUD operations.
14
11
  * @class
@@ -17,14 +14,14 @@ export declare class ValtheraClass implements ValtheraCompatible {
17
14
  dbAction: ActionsBase;
18
15
  executor: Executor;
19
16
  emiter: VEE<{
20
- [K in Exclude<DbActionsFns, "init">]: (query: VQuery, result: Awaited<ReturnType<ValtheraCompatible[K]>>) => void;
17
+ [K in keyof ValtheraCompatible]: (query: VQuery, result: Awaited<ReturnType<ValtheraCompatible[K]>>) => void;
21
18
  } & {
22
- "*": (name: DbActionsFns, query: VQuery, result: any) => void;
19
+ "*": (name: keyof ValtheraCompatible, query: VQuery, result: any) => void;
23
20
  }>;
24
21
  version: string;
25
22
  constructor(options?: DbOpts);
26
23
  init(...args: any[]): Promise<unknown>;
27
- execute<T>(name: DbActionsFns, query: VQuery): Promise<T>;
24
+ execute<T>(name: keyof ValtheraCompatible, query: VQuery): Promise<T>;
28
25
  /**
29
26
  * Create a new instance of a CollectionManager class.
30
27
  */
@@ -82,4 +79,3 @@ export declare class ValtheraClass implements ValtheraCompatible {
82
79
  */
83
80
  removeCollection(collection: string): Promise<boolean>;
84
81
  }
85
- export {};
@@ -10,12 +10,11 @@ import { version } from "../version.js";
10
10
  export class ValtheraClass {
11
11
  dbAction;
12
12
  executor;
13
- emiter;
13
+ emiter = new VEE();
14
14
  version = version;
15
15
  constructor(options = {}) {
16
16
  this.dbAction = options.dbAction || new ActionsBase();
17
17
  this.executor = options.executor || new Executor();
18
- this.emiter = new VEE();
19
18
  if (options.numberId)
20
19
  this.dbAction.numberId = true;
21
20
  }
@@ -34,7 +33,6 @@ export class ValtheraClass {
34
33
  await this.init();
35
34
  const result = await this.executor.addOp(this.dbAction[name].bind(this.dbAction), query);
36
35
  this.emiter.emit(name, query, result);
37
- this.emiter.emit("*", name, query, result);
38
36
  return result;
39
37
  }
40
38
  /**
@@ -4,7 +4,7 @@ import { DbFindOpts, FindOpts } from "./options.js";
4
4
  /**
5
5
  * To extend via adapters
6
6
  * @example
7
- * declare module "@wxn0brp/db-core" {
7
+ * declare module "@wxn0brp/db-core/types/query" {
8
8
  * export interface VQuery_Control {
9
9
  * key?: "value";
10
10
  * }
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.5.0-alpha.1";
1
+ export const version = "0.5.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-core",
3
- "version": "0.5.0-alpha.1",
3
+ "version": "0.5.0",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "author": "wxn0brP",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "homepage": "https://github.com/wxn0brP/ValtheraDB",
15
15
  "dependencies": {
16
- "@wxn0brp/event-emitter": "^0.0.4"
16
+ "@wxn0brp/event-emitter": "0.0.5"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/bun": "*",