@wxn0brp/db-core 0.1.1 → 0.1.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.
- package/dist/helpers/CollectionManager.d.ts +8 -8
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/utils/forge.d.ts +2 -0
- package/dist/utils/forge.js +3 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -10,34 +10,34 @@ declare class CollectionManager<D = Data> {
|
|
|
10
10
|
/**
|
|
11
11
|
* Add data to a database.
|
|
12
12
|
*/
|
|
13
|
-
add<T =
|
|
13
|
+
add<T = Data>(data: Arg<T & D>, id_gen?: boolean): Promise<T>;
|
|
14
14
|
/**
|
|
15
15
|
* Find data in a database.
|
|
16
16
|
*/
|
|
17
|
-
find<T =
|
|
17
|
+
find<T = Data>(search?: Search<T & D>, context?: VContext, options?: DbFindOpts<T & Data>, findOpts?: FindOpts<T & Data>): Promise<T[]>;
|
|
18
18
|
/**
|
|
19
19
|
* Find one data entry in a database.
|
|
20
20
|
*/
|
|
21
|
-
findOne<T =
|
|
21
|
+
findOne<T = Data>(search?: Search<T & Data>, context?: VContext, findOpts?: FindOpts<T & Data>): Promise<T>;
|
|
22
22
|
/**
|
|
23
23
|
* Update data in a database.
|
|
24
24
|
*/
|
|
25
|
-
update<T =
|
|
25
|
+
update<T = Data>(search: Search<T & Data>, updater: Updater<T & Data>, context?: VContext): Promise<boolean>;
|
|
26
26
|
/**
|
|
27
27
|
* Update one data entry in a database.
|
|
28
28
|
*/
|
|
29
|
-
updateOne<T =
|
|
29
|
+
updateOne<T = Data>(search: Search<T & Data>, updater: Updater<T & Data>, context?: VContext): Promise<boolean>;
|
|
30
30
|
/**
|
|
31
31
|
* Remove data from a database.
|
|
32
32
|
*/
|
|
33
|
-
remove<T =
|
|
33
|
+
remove<T = Data>(search: Search<T & Data>, context?: VContext): Promise<boolean>;
|
|
34
34
|
/**
|
|
35
35
|
* Remove one data entry from a database.
|
|
36
36
|
*/
|
|
37
|
-
removeOne<T =
|
|
37
|
+
removeOne<T = Data>(search: Search<T & Data>, context?: VContext): Promise<boolean>;
|
|
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 =
|
|
41
|
+
updateOneOrAdd<T = Data>(search: Search<T & Data>, updater: Updater<T & Data>, add_arg?: Arg<T & Data>, context?: VContext, id_gen?: boolean): Promise<boolean>;
|
|
42
42
|
}
|
|
43
43
|
export default CollectionManager;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import Relation from "./helpers/relation.js";
|
|
|
6
6
|
import { ValtheraTypes } from "./types/export.js";
|
|
7
7
|
import { RelationTypes } from "./types/relation.js";
|
|
8
8
|
import { ValtheraCompatible } from "./types/valthera.js";
|
|
9
|
-
import { forgeValthera } from "./utils/forge.js";
|
|
10
|
-
export { createMemoryValthera, CustomFileCpu, forgeValthera, genId, Relation, ValtheraClass, ValtheraMemory };
|
|
11
|
-
export type { RelationTypes, ValtheraCompatible, ValtheraTypes };
|
|
9
|
+
import { forgeTypedValthera, forgeValthera } from "./utils/forge.js";
|
|
10
|
+
export { createMemoryValthera, CustomFileCpu, forgeTypedValthera, forgeValthera, genId, Relation, ValtheraClass, ValtheraMemory, };
|
|
11
|
+
export type { RelationTypes, ValtheraCompatible, ValtheraTypes, };
|
|
12
12
|
export type Id = import("./types/Id.js").Id;
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,5 @@ import ValtheraMemory, { createMemoryValthera } from "./db/memory.js";
|
|
|
3
3
|
import ValtheraClass from "./db/valthera.js";
|
|
4
4
|
import genId from "./helpers/gen.js";
|
|
5
5
|
import Relation from "./helpers/relation.js";
|
|
6
|
-
import { forgeValthera } from "./utils/forge.js";
|
|
7
|
-
export { createMemoryValthera, CustomFileCpu, forgeValthera, genId, Relation, ValtheraClass, ValtheraMemory };
|
|
6
|
+
import { forgeTypedValthera, forgeValthera } from "./utils/forge.js";
|
|
7
|
+
export { createMemoryValthera, CustomFileCpu, forgeTypedValthera, forgeValthera, genId, Relation, ValtheraClass, ValtheraMemory, };
|
package/dist/utils/forge.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import CollectionManager from "../helpers/CollectionManager.js";
|
|
2
|
+
import Data from "../types/data.js";
|
|
2
3
|
import { ValtheraCompatible } from "../types/valthera.js";
|
|
3
4
|
export declare function forgeValthera<T extends string>(target: ValtheraCompatible): ValtheraCompatible & { [K in T]: CollectionManager; };
|
|
5
|
+
export declare function forgeTypedValthera<T extends Record<string, Data>>(target: ValtheraCompatible): ValtheraCompatible & { [K in keyof T]: CollectionManager<T[K]>; };
|
package/dist/utils/forge.js
CHANGED
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.1.
|
|
1
|
+
export const version = "0.1.2";
|