@wxn0brp/db-core 0.10.0 → 0.10.1
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/base/actions.d.ts +10 -10
- package/dist/base/custom.d.ts +8 -8
- package/dist/customFileCpu.d.ts +6 -6
- package/dist/db/multiStorage.d.ts +8 -8
- package/dist/db/routedStorage.d.ts +12 -12
- package/dist/db/valthera.d.ts +10 -10
- package/dist/helpers/collection.d.ts +3 -3
- package/dist/types/action.d.ts +10 -10
- package/dist/types/fileCpu.d.ts +6 -6
- package/dist/types/query.d.ts +27 -15
- package/dist/types/query.js +5 -3
- package/dist/types/valthera.d.ts +10 -10
- package/dist/utils/action.d.ts +2 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/base/actions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionsBaseInterface } from "../types/action.js";
|
|
2
2
|
import { DataInternal } from "../types/data.js";
|
|
3
|
-
import
|
|
3
|
+
import { VQueryT } from "../types/query.js";
|
|
4
4
|
export declare abstract class ActionsBase implements ActionsBaseInterface {
|
|
5
5
|
_inited: boolean;
|
|
6
6
|
numberId: boolean;
|
|
@@ -9,13 +9,13 @@ export declare abstract class ActionsBase implements ActionsBaseInterface {
|
|
|
9
9
|
abstract ensureCollection(collection: string): Promise<boolean>;
|
|
10
10
|
abstract issetCollection(collection: string): Promise<boolean>;
|
|
11
11
|
abstract removeCollection(collection: string): Promise<boolean>;
|
|
12
|
-
abstract add(config:
|
|
13
|
-
abstract find(config:
|
|
14
|
-
abstract findOne(config:
|
|
15
|
-
abstract update(config:
|
|
16
|
-
abstract updateOne(config:
|
|
17
|
-
abstract remove(config:
|
|
18
|
-
abstract removeOne(config:
|
|
19
|
-
updateOneOrAdd(config:
|
|
20
|
-
toggleOne(config:
|
|
12
|
+
abstract add(config: VQueryT.Add): Promise<DataInternal>;
|
|
13
|
+
abstract find(config: VQueryT.Find): Promise<DataInternal[]>;
|
|
14
|
+
abstract findOne(config: VQueryT.FindOne): Promise<DataInternal | null>;
|
|
15
|
+
abstract update(config: VQueryT.Update): Promise<DataInternal[]>;
|
|
16
|
+
abstract updateOne(config: VQueryT.Update): Promise<DataInternal | null>;
|
|
17
|
+
abstract remove(config: VQueryT.Remove): Promise<DataInternal[]>;
|
|
18
|
+
abstract removeOne(config: VQueryT.Remove): Promise<DataInternal | null>;
|
|
19
|
+
updateOneOrAdd(config: VQueryT.UpdateOneOrAdd): Promise<VQueryT.UpdateOneOrAddResult<DataInternal>>;
|
|
20
|
+
toggleOne(config: VQueryT.ToggleOne): Promise<VQueryT.ToggleOneResult<DataInternal>>;
|
|
21
21
|
}
|
package/dist/base/custom.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomFileCpu } from "../customFileCpu.js";
|
|
2
2
|
import { Data } from "../types/data.js";
|
|
3
|
-
import
|
|
3
|
+
import { VQueryT } from "../types/query.js";
|
|
4
4
|
import { ActionsBase } from "./actions.js";
|
|
5
5
|
export declare abstract class CustomActionsBase extends ActionsBase {
|
|
6
6
|
fileCpu: CustomFileCpu;
|
|
@@ -8,29 +8,29 @@ export declare abstract class CustomActionsBase extends ActionsBase {
|
|
|
8
8
|
/**
|
|
9
9
|
* Add a new entry to the specified database.
|
|
10
10
|
*/
|
|
11
|
-
add(query:
|
|
11
|
+
add(query: VQueryT.Add): Promise<import("../types/arg.js").Arg<Data>>;
|
|
12
12
|
/**
|
|
13
13
|
* Find entries in the specified database based on search criteria.
|
|
14
14
|
*/
|
|
15
|
-
find(query:
|
|
15
|
+
find(query: VQueryT.Find): Promise<Data[]>;
|
|
16
16
|
/**
|
|
17
17
|
* Find the first matching entry in the specified database based on search criteria.
|
|
18
18
|
*/
|
|
19
|
-
findOne(query:
|
|
19
|
+
findOne(query: VQueryT.FindOne): Promise<Data>;
|
|
20
20
|
/**
|
|
21
21
|
* Update entries in the specified database based on search criteria and an updater function or object.
|
|
22
22
|
*/
|
|
23
|
-
update(query:
|
|
23
|
+
update(query: VQueryT.Update): Promise<Data[]>;
|
|
24
24
|
/**
|
|
25
25
|
* Update the first matching entry in the specified database based on search criteria and an updater function or object.
|
|
26
26
|
*/
|
|
27
|
-
updateOne(query:
|
|
27
|
+
updateOne(query: VQueryT.Update): Promise<Data>;
|
|
28
28
|
/**
|
|
29
29
|
* Remove entries from the specified database based on search criteria.
|
|
30
30
|
*/
|
|
31
|
-
remove(query:
|
|
31
|
+
remove(query: VQueryT.Remove): Promise<Data[]>;
|
|
32
32
|
/**
|
|
33
33
|
* Remove the first matching entry from the specified database based on search criteria.
|
|
34
34
|
*/
|
|
35
|
-
removeOne(query:
|
|
35
|
+
removeOne(query: VQueryT.Remove): Promise<Data>;
|
|
36
36
|
}
|
package/dist/customFileCpu.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Data } from "./types/data.js";
|
|
2
2
|
import { FileCpu } from "./types/fileCpu.js";
|
|
3
|
-
import
|
|
3
|
+
import { VQueryT } from "./types/query.js";
|
|
4
4
|
export type WriteFile = (file: string, data: any[]) => Promise<void>;
|
|
5
5
|
export type ReadFile = (file: string) => Promise<any[]>;
|
|
6
6
|
export declare function pathRepair(path: string): string;
|
|
@@ -8,9 +8,9 @@ export declare class CustomFileCpu implements FileCpu {
|
|
|
8
8
|
_readFile: ReadFile;
|
|
9
9
|
_writeFile: WriteFile;
|
|
10
10
|
constructor(readFile: ReadFile, writeFile: WriteFile);
|
|
11
|
-
add(file: string, config:
|
|
12
|
-
find(file: string, config:
|
|
13
|
-
findOne(file: string, config:
|
|
14
|
-
remove(file: string, config:
|
|
15
|
-
update(file: string, config:
|
|
11
|
+
add(file: string, config: VQueryT.Add): Promise<void>;
|
|
12
|
+
find(file: string, config: VQueryT.Find): Promise<Data[]>;
|
|
13
|
+
findOne(file: string, config: VQueryT.FindOne): Promise<Data | false>;
|
|
14
|
+
remove(file: string, config: VQueryT.Remove, one: boolean): Promise<Data[]>;
|
|
15
|
+
update(file: string, config: VQueryT.Update, one: boolean): Promise<Data[]>;
|
|
16
16
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ActionsBase } from "../base/actions.js";
|
|
2
|
-
import
|
|
2
|
+
import { VQueryT } from "../types/query.js";
|
|
3
3
|
export declare class MultiBackend extends ActionsBase {
|
|
4
4
|
backends: ActionsBase[];
|
|
5
5
|
primaryBackend: ActionsBase;
|
|
6
6
|
constructor(backends: ActionsBase[], primaryIndex?: number);
|
|
7
7
|
init(...args: any[]): Promise<void>;
|
|
8
|
-
add(config:
|
|
9
|
-
find(config:
|
|
10
|
-
findOne(config:
|
|
11
|
-
update(config:
|
|
12
|
-
updateOne(config:
|
|
13
|
-
remove(config:
|
|
14
|
-
removeOne(config:
|
|
8
|
+
add(config: VQueryT.Add): Promise<import("../types/data.js").DataInternal>;
|
|
9
|
+
find(config: VQueryT.Find): Promise<import("../types/data.js").DataInternal[]>;
|
|
10
|
+
findOne(config: VQueryT.FindOne): Promise<import("../types/data.js").DataInternal>;
|
|
11
|
+
update(config: VQueryT.Update): Promise<import("../types/data.js").DataInternal[]>;
|
|
12
|
+
updateOne(config: VQueryT.Update): Promise<import("../types/data.js").DataInternal>;
|
|
13
|
+
remove(config: VQueryT.Remove): Promise<import("../types/data.js").DataInternal[]>;
|
|
14
|
+
removeOne(config: VQueryT.Remove): Promise<import("../types/data.js").DataInternal>;
|
|
15
15
|
ensureCollection(collection: string): Promise<boolean>;
|
|
16
16
|
issetCollection(collection: string): Promise<boolean>;
|
|
17
17
|
removeCollection(collection: string): Promise<boolean>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionsBase } from "../base/actions.js";
|
|
2
|
-
import
|
|
3
|
-
export type MatchRule = string | RegExp | ((config:
|
|
2
|
+
import { VQueryT, VQuery } from "../types/query.js";
|
|
3
|
+
export type MatchRule = string | RegExp | ((config: VQuery) => boolean);
|
|
4
4
|
export interface RouteEntry {
|
|
5
5
|
match: MatchRule;
|
|
6
6
|
backends: ActionsBase[];
|
|
@@ -9,17 +9,17 @@ export declare class RoutedStorage extends ActionsBase {
|
|
|
9
9
|
rules: RouteEntry[];
|
|
10
10
|
defaultBackend: ActionsBase[];
|
|
11
11
|
constructor(rules: RouteEntry[], defaultBackend: ActionsBase | ActionsBase[]);
|
|
12
|
-
_matchBackends(config:
|
|
13
|
-
_withAll<T>(config:
|
|
14
|
-
_withFirst<T>(config:
|
|
12
|
+
_matchBackends(config: VQuery): ActionsBase[];
|
|
13
|
+
_withAll<T>(config: VQuery | string, fn: (b: ActionsBase) => Promise<T>, gather?: boolean): Promise<T>;
|
|
14
|
+
_withFirst<T>(config: VQuery | string, fn: (b: ActionsBase) => Promise<T>): Promise<T>;
|
|
15
15
|
init(...args: any[]): Promise<void>;
|
|
16
|
-
add(config:
|
|
17
|
-
find(config:
|
|
18
|
-
findOne(config:
|
|
19
|
-
update(config:
|
|
20
|
-
updateOne(config:
|
|
21
|
-
remove(config:
|
|
22
|
-
removeOne(config:
|
|
16
|
+
add(config: VQueryT.Add): Promise<import("../types/data.js").DataInternal>;
|
|
17
|
+
find(config: VQueryT.Find): Promise<import("../types/data.js").DataInternal[]>;
|
|
18
|
+
findOne(config: VQueryT.FindOne): Promise<import("../types/data.js").DataInternal>;
|
|
19
|
+
update(config: VQueryT.Update): Promise<import("../types/data.js").DataInternal[]>;
|
|
20
|
+
updateOne(config: VQueryT.Update): Promise<import("../types/data.js").DataInternal>;
|
|
21
|
+
remove(config: VQueryT.Remove): Promise<import("../types/data.js").DataInternal[]>;
|
|
22
|
+
removeOne(config: VQueryT.Remove): Promise<import("../types/data.js").DataInternal>;
|
|
23
23
|
ensureCollection(collection: string): Promise<boolean>;
|
|
24
24
|
issetCollection(collection: string): Promise<boolean>;
|
|
25
25
|
removeCollection(collection: string): Promise<boolean>;
|
package/dist/db/valthera.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Collection } from "../helpers/collection.js";
|
|
|
4
4
|
import { Executor } from "../helpers/executor.js";
|
|
5
5
|
import { Data } from "../types/data.js";
|
|
6
6
|
import { DbOpts } from "../types/options.js";
|
|
7
|
-
import {
|
|
7
|
+
import { VQueryT, VQuery } from "../types/query.js";
|
|
8
8
|
import { ValtheraCompatible } from "../types/valthera.js";
|
|
9
9
|
/**
|
|
10
10
|
* Represents a database management class for performing CRUD operations.
|
|
@@ -41,42 +41,42 @@ export declare class ValtheraClass implements ValtheraCompatible {
|
|
|
41
41
|
/**
|
|
42
42
|
* Add data to a database.
|
|
43
43
|
*/
|
|
44
|
-
add<T = Data>(query:
|
|
44
|
+
add<T = Data>(query: VQueryT.Add<T>): Promise<T>;
|
|
45
45
|
/**
|
|
46
46
|
* Find data in a database.
|
|
47
47
|
*/
|
|
48
|
-
find<T = Data>(query:
|
|
48
|
+
find<T = Data>(query: VQueryT.Find<T>): Promise<T[]>;
|
|
49
49
|
/**
|
|
50
50
|
* Find one data entry in a database.
|
|
51
51
|
*/
|
|
52
|
-
findOne<T = Data>(query:
|
|
52
|
+
findOne<T = Data>(query: VQueryT.FindOne<T>): Promise<T>;
|
|
53
53
|
/**
|
|
54
54
|
* Update data in a database.
|
|
55
55
|
*/
|
|
56
|
-
update<T = Data>(query:
|
|
56
|
+
update<T = Data>(query: VQueryT.Update<T>): Promise<T[]>;
|
|
57
57
|
/**
|
|
58
58
|
* Update one data entry in a database.
|
|
59
59
|
*/
|
|
60
|
-
updateOne<T = Data>(query:
|
|
60
|
+
updateOne<T = Data>(query: VQueryT.Update<T>): Promise<T>;
|
|
61
61
|
/**
|
|
62
62
|
* Remove data from a database.
|
|
63
63
|
*/
|
|
64
|
-
remove<T = Data>(query:
|
|
64
|
+
remove<T = Data>(query: VQueryT.Remove<T>): Promise<T[]>;
|
|
65
65
|
/**
|
|
66
66
|
* Remove one data entry from a database.
|
|
67
67
|
*/
|
|
68
|
-
removeOne<T = Data>(query:
|
|
68
|
+
removeOne<T = Data>(query: VQueryT.Remove<T>): Promise<T>;
|
|
69
69
|
/**
|
|
70
70
|
* Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
|
|
71
71
|
*/
|
|
72
|
-
updateOneOrAdd<T = Data>(query:
|
|
72
|
+
updateOneOrAdd<T = Data>(query: VQueryT.UpdateOneOrAdd<T>): Promise<VQueryT.UpdateOneOrAddResult<T>>;
|
|
73
73
|
/**
|
|
74
74
|
* Asynchronously removes one entry in a database or adds a new one if it doesn't exist. Usage e.g. for toggling a flag.
|
|
75
75
|
* Returns a promise resolving to `false` if the entry was found and removed,
|
|
76
76
|
* or `true` if the entry was added. The returned value reflects the state of the database
|
|
77
77
|
* after the operation.
|
|
78
78
|
*/
|
|
79
|
-
toggleOne<T = Data>(query:
|
|
79
|
+
toggleOne<T = Data>(query: VQueryT.ToggleOne<T>): Promise<VQueryT.ToggleOneResult<T>>;
|
|
80
80
|
/**
|
|
81
81
|
* Removes a database collection from the file system.
|
|
82
82
|
*/
|
|
@@ -2,7 +2,7 @@ import { Arg, Search, Updater } from "../types/arg.js";
|
|
|
2
2
|
import { UpdateOneOrAdd } from "../types/collection.js";
|
|
3
3
|
import { Data } from "../types/data.js";
|
|
4
4
|
import { DbFindOpts, FindOpts } from "../types/options.js";
|
|
5
|
-
import {
|
|
5
|
+
import { VQueryT } from "../types/query.js";
|
|
6
6
|
import { VContext } from "../types/types.js";
|
|
7
7
|
import { ValtheraCompatible } from "../types/valthera.js";
|
|
8
8
|
export declare class Collection<D = Data> {
|
|
@@ -43,12 +43,12 @@ export declare class Collection<D = Data> {
|
|
|
43
43
|
/**
|
|
44
44
|
* Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
|
|
45
45
|
*/
|
|
46
|
-
updateOneOrAdd(search: Search<D>, updater: Updater<D>, { add_arg, context, id_gen }?: UpdateOneOrAdd<D>): Promise<UpdateOneOrAddResult<D>>;
|
|
46
|
+
updateOneOrAdd(search: Search<D>, updater: Updater<D>, { add_arg, context, id_gen }?: UpdateOneOrAdd<D>): Promise<VQueryT.UpdateOneOrAddResult<D>>;
|
|
47
47
|
/**
|
|
48
48
|
* Asynchronously removes one entry in a database or adds a new one if it doesn't exist. Usage e.g. for toggling a flag.
|
|
49
49
|
* Returns a promise resolving to `false` if the entry was found and removed,
|
|
50
50
|
* or `true` if the entry was added. The returned value reflects the state of the database
|
|
51
51
|
* after the operation.
|
|
52
52
|
*/
|
|
53
|
-
toggleOne(search: Search<D>, data?: Arg<D>, context?: VContext): Promise<ToggleOneResult<D>>;
|
|
53
|
+
toggleOne(search: Search<D>, data?: Arg<D>, context?: VContext): Promise<VQueryT.ToggleOneResult<D>>;
|
|
54
54
|
}
|
package/dist/types/action.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataInternal } from "./data.js";
|
|
2
|
-
import
|
|
2
|
+
import { VQueryT } from "./query.js";
|
|
3
3
|
export interface ActionsBaseInterface {
|
|
4
4
|
_inited: boolean;
|
|
5
5
|
numberId: boolean;
|
|
@@ -8,13 +8,13 @@ export interface ActionsBaseInterface {
|
|
|
8
8
|
ensureCollection(collection: string): Promise<boolean>;
|
|
9
9
|
issetCollection(collection: string): Promise<boolean>;
|
|
10
10
|
removeCollection(collection: string): Promise<boolean>;
|
|
11
|
-
add(query:
|
|
12
|
-
find(query:
|
|
13
|
-
findOne(query:
|
|
14
|
-
update(query:
|
|
15
|
-
updateOne(query:
|
|
16
|
-
remove(query:
|
|
17
|
-
removeOne(query:
|
|
18
|
-
updateOneOrAdd(query:
|
|
19
|
-
toggleOne(query:
|
|
11
|
+
add(query: VQueryT.Add): Promise<DataInternal>;
|
|
12
|
+
find(query: VQueryT.Find): Promise<DataInternal[]>;
|
|
13
|
+
findOne(query: VQueryT.FindOne): Promise<DataInternal | null>;
|
|
14
|
+
update(query: VQueryT.Update): Promise<DataInternal[]>;
|
|
15
|
+
updateOne(query: VQueryT.Update): Promise<DataInternal | null>;
|
|
16
|
+
remove(query: VQueryT.Remove): Promise<DataInternal[]>;
|
|
17
|
+
removeOne(query: VQueryT.Remove): Promise<DataInternal | null>;
|
|
18
|
+
updateOneOrAdd(query: VQueryT.UpdateOneOrAdd): Promise<VQueryT.UpdateOneOrAddResult<DataInternal>>;
|
|
19
|
+
toggleOne(query: VQueryT.ToggleOne): Promise<VQueryT.ToggleOneResult<DataInternal>>;
|
|
20
20
|
}
|
package/dist/types/fileCpu.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { DataInternal } from "./data.js";
|
|
2
|
-
import
|
|
2
|
+
import { VQueryT } from "./query.js";
|
|
3
3
|
export interface FileCpu {
|
|
4
4
|
/**
|
|
5
5
|
* Asynchronously adds an entry to a file.
|
|
6
6
|
* @returns A promise resolving to `void`.
|
|
7
7
|
*/
|
|
8
|
-
add(file: string, config:
|
|
8
|
+
add(file: string, config: VQueryT.Add): Promise<void>;
|
|
9
9
|
/**
|
|
10
10
|
* Asynchronously finds multiple entries in a file based on search criteria.
|
|
11
11
|
* @returns A promise resolving to an array of found entries, or `false` if the file does not exist.
|
|
12
12
|
*/
|
|
13
|
-
find(file: string, config:
|
|
13
|
+
find(file: string, config: VQueryT.Find): Promise<DataInternal[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Asynchronously finds one entry in a file based on search criteria.
|
|
16
16
|
* @returns A promise resolving to the found entry or `false` if not found.
|
|
17
17
|
*/
|
|
18
|
-
findOne(file: string, config:
|
|
18
|
+
findOne(file: string, config: VQueryT.FindOne): Promise<DataInternal | false>;
|
|
19
19
|
/**
|
|
20
20
|
* Asynchronously removes entries from a file based on search criteria.
|
|
21
21
|
* @param one If `true`, removes only the first matching entry.
|
|
22
22
|
* @returns A promise resolving to `true` if at least one entry was removed, otherwise `false`.
|
|
23
23
|
*/
|
|
24
|
-
remove(file: string, config:
|
|
24
|
+
remove(file: string, config: VQueryT.Remove, one: boolean): Promise<DataInternal[]>;
|
|
25
25
|
/**
|
|
26
26
|
* Asynchronously updates entries in a file based on search criteria and an updater function or object.
|
|
27
27
|
* @param one If `true`, updates only the first matching entry.
|
|
28
28
|
* @returns A promise resolving to `true` if at least one entry was updated, otherwise `false`.
|
|
29
29
|
*/
|
|
30
|
-
update(file: string, config:
|
|
30
|
+
update(file: string, config: VQueryT.Update, one: boolean): Promise<DataInternal[]>;
|
|
31
31
|
}
|
package/dist/types/query.d.ts
CHANGED
|
@@ -26,19 +26,31 @@ export interface VQuery<T = Data> {
|
|
|
26
26
|
updater?: Updater<T>;
|
|
27
27
|
control?: VQuery_Control;
|
|
28
28
|
}
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
export declare namespace VQueryT {
|
|
30
|
+
type QueryBase<T = Data> = Required<Pick<VQuery<T>, "collection" | "search">> & Pick<VQuery<T>, "control">;
|
|
31
|
+
type Add<T = Data> = Required<Pick<VQuery<T>, "data" | "collection">> & Pick<VQuery<T>, "id_gen" | "control">;
|
|
32
|
+
type Find<T = Data> = Omit<QueryBase, "search"> & Pick<VQuery<T>, "search"> & Pick<VQuery<T>, "findOpts" | "dbFindOpts" | "context">;
|
|
33
|
+
type FindOne<T = Data> = QueryBase & Pick<VQuery<T>, "findOpts" | "context">;
|
|
34
|
+
type Update<T = Data> = QueryBase & Required<Pick<VQuery<T>, "updater">> & Pick<VQuery<T>, "context">;
|
|
35
|
+
type Remove<T = Data> = QueryBase & Pick<VQuery<T>, "context">;
|
|
36
|
+
type UpdateOneOrAdd<T = Data> = QueryBase & Update & Pick<VQuery<T>, "add_arg" | "id_gen">;
|
|
37
|
+
type ToggleOne<T = Data> = QueryBase & Pick<VQuery<T>, "data" | "context">;
|
|
38
|
+
interface UpdateOneOrAddResult<T> {
|
|
39
|
+
data: T;
|
|
40
|
+
type: "added" | "updated";
|
|
41
|
+
}
|
|
42
|
+
interface ToggleOneResult<T> {
|
|
43
|
+
data: T;
|
|
44
|
+
type: "added" | "removed";
|
|
45
|
+
}
|
|
44
46
|
}
|
|
47
|
+
export type QueryBase<T = Data> = VQueryT.QueryBase<T>;
|
|
48
|
+
export type AddQuery<T = Data> = VQueryT.Add<T>;
|
|
49
|
+
export type FindQuery<T = Data> = VQueryT.Find<T>;
|
|
50
|
+
export type FindOneQuery<T = Data> = VQueryT.FindOne<T>;
|
|
51
|
+
export type UpdateQuery<T = Data> = VQueryT.Update<T>;
|
|
52
|
+
export type RemoveQuery<T = Data> = VQueryT.Remove<T>;
|
|
53
|
+
export type UpdateOneOrAddQuery<T = Data> = VQueryT.UpdateOneOrAdd<T>;
|
|
54
|
+
export type ToggleOneQuery<T = Data> = VQueryT.ToggleOne<T>;
|
|
55
|
+
export type UpdateOneOrAddResult<T> = VQueryT.UpdateOneOrAddResult<T>;
|
|
56
|
+
export type ToggleOneResult<T> = VQueryT.ToggleOneResult<T>;
|
package/dist/types/query.js
CHANGED
package/dist/types/valthera.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Collection } from "../helpers/collection.js";
|
|
2
2
|
import { Data } from "./data.js";
|
|
3
|
-
import
|
|
3
|
+
import { VQueryT } from "./query.js";
|
|
4
4
|
export interface ValtheraCompatible {
|
|
5
5
|
c<T = Data>(collection: string): Collection<T>;
|
|
6
6
|
getCollections(): Promise<string[]>;
|
|
7
7
|
ensureCollection(collection: string): Promise<boolean>;
|
|
8
8
|
issetCollection(collection: string): Promise<boolean>;
|
|
9
|
-
add<T = Data>(query:
|
|
10
|
-
find<T = Data>(query:
|
|
11
|
-
findOne<T = Data>(query:
|
|
12
|
-
update<T = Data>(query:
|
|
13
|
-
updateOne<T = Data>(query:
|
|
14
|
-
remove<T = Data>(query:
|
|
15
|
-
removeOne<T = Data>(query:
|
|
9
|
+
add<T = Data>(query: VQueryT.Add<T>): Promise<T>;
|
|
10
|
+
find<T = Data>(query: VQueryT.Find<T>): Promise<T[]>;
|
|
11
|
+
findOne<T = Data>(query: VQueryT.FindOne<T>): Promise<T | null>;
|
|
12
|
+
update<T = Data>(query: VQueryT.Update<T>): Promise<T[]>;
|
|
13
|
+
updateOne<T = Data>(query: VQueryT.Update<T>): Promise<T | null>;
|
|
14
|
+
remove<T = Data>(query: VQueryT.Remove<T>): Promise<T[]>;
|
|
15
|
+
removeOne<T = Data>(query: VQueryT.Remove<T>): Promise<T | null>;
|
|
16
16
|
removeCollection(collection: string): Promise<boolean>;
|
|
17
|
-
updateOneOrAdd<T = Data>(query:
|
|
18
|
-
toggleOne<T = Data>(query:
|
|
17
|
+
updateOneOrAdd<T = Data>(query: VQueryT.UpdateOneOrAdd<T>): Promise<VQueryT.UpdateOneOrAddResult<T>>;
|
|
18
|
+
toggleOne<T = Data>(query: VQueryT.ToggleOne<T>): Promise<VQueryT.ToggleOneResult<T>>;
|
|
19
19
|
}
|
package/dist/utils/action.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Data } from "../types/data.js";
|
|
2
2
|
import { FileCpu } from "../types/fileCpu.js";
|
|
3
|
-
import {
|
|
4
|
-
export declare function findUtil(query:
|
|
3
|
+
import { VQueryT } from "../types/query.js";
|
|
4
|
+
export declare function findUtil(query: VQueryT.Find, fileCpu: FileCpu, files: string[]): Promise<Data[]>;
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.10.
|
|
1
|
+
export const version = "0.10.1";
|