@wxn0brp/vql-client 0.2.9 → 0.2.10
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/vql.d.ts +36 -30
- package/package.json +3 -3
package/dist/vql.d.ts
CHANGED
|
@@ -25,10 +25,10 @@ export type ComparisonOperators<T = any> = {
|
|
|
25
25
|
number,
|
|
26
26
|
number
|
|
27
27
|
], number>;
|
|
28
|
-
$in?:
|
|
28
|
+
$in?: {
|
|
29
29
|
[K in keyof T]?: T[K] extends any[] ? T[K] : T[K][];
|
|
30
30
|
};
|
|
31
|
-
$nin?:
|
|
31
|
+
$nin?: {
|
|
32
32
|
[K in keyof T]?: T[K] extends any[] ? T[K] : T[K][];
|
|
33
33
|
};
|
|
34
34
|
$idGt?: NestedValue<T, string | number, string | number>;
|
|
@@ -41,8 +41,12 @@ export type TypeAndExistenceOperators<T = any> = {
|
|
|
41
41
|
$type?: NestedValue<T, JSPrimitiveType, any>;
|
|
42
42
|
};
|
|
43
43
|
export type ArrayOperators<T = any> = {
|
|
44
|
-
$arrinc?:
|
|
45
|
-
|
|
44
|
+
$arrinc?: {
|
|
45
|
+
[K in keyof T]?: T[K] extends any[] ? T[K][number][] : T[K][];
|
|
46
|
+
};
|
|
47
|
+
$arrincall?: {
|
|
48
|
+
[K in keyof T]?: T[K] extends any[] ? T[K][number][] : T[K][];
|
|
49
|
+
};
|
|
46
50
|
$size?: NestedValue<T, number>;
|
|
47
51
|
};
|
|
48
52
|
export type StringOperators<T = any> = {
|
|
@@ -102,21 +106,23 @@ export interface VQuery<T = Data> {
|
|
|
102
106
|
updater?: Updater<T>;
|
|
103
107
|
control?: VQuery_Control;
|
|
104
108
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
declare namespace VQueryT {
|
|
110
|
+
type QueryBase<T = Data> = Required<Pick<VQuery<T>, "collection" | "search">> & Pick<VQuery<T>, "control">;
|
|
111
|
+
type Add<T = Data> = Required<Pick<VQuery<T>, "data" | "collection">> & Pick<VQuery<T>, "id_gen" | "control">;
|
|
112
|
+
type Find<T = Data> = Omit<QueryBase, "search"> & Pick<VQuery<T>, "search"> & Pick<VQuery<T>, "findOpts" | "dbFindOpts" | "context">;
|
|
113
|
+
type FindOne<T = Data> = QueryBase & Pick<VQuery<T>, "findOpts" | "context">;
|
|
114
|
+
type Update<T = Data> = QueryBase & Required<Pick<VQuery<T>, "updater">> & Pick<VQuery<T>, "context">;
|
|
115
|
+
type Remove<T = Data> = QueryBase & Pick<VQuery<T>, "context">;
|
|
116
|
+
type UpdateOneOrAdd<T = Data> = QueryBase & Update & Pick<VQuery<T>, "add_arg" | "id_gen">;
|
|
117
|
+
type ToggleOne<T = Data> = QueryBase & Pick<VQuery<T>, "data" | "context">;
|
|
118
|
+
interface UpdateOneOrAddResult<T> {
|
|
119
|
+
data: T;
|
|
120
|
+
type: "added" | "updated";
|
|
121
|
+
}
|
|
122
|
+
interface ToggleOneResult<T> {
|
|
123
|
+
data: T;
|
|
124
|
+
type: "added" | "removed";
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
127
|
export interface DbFindOpts<T = any> {
|
|
122
128
|
reverse?: boolean;
|
|
@@ -144,24 +150,24 @@ declare class Collection<D = Data> {
|
|
|
144
150
|
updateOne(search: Search<D>, updater: Updater<D>, context?: VContext): Promise<D | null>;
|
|
145
151
|
remove(search: Search<D>, context?: VContext): Promise<D[]>;
|
|
146
152
|
removeOne(search: Search<D>, context?: VContext): Promise<D | null>;
|
|
147
|
-
updateOneOrAdd(search: Search<D>, updater: Updater<D>, { add_arg, context, id_gen }?: UpdateOneOrAdd<D>): Promise<UpdateOneOrAddResult<D>>;
|
|
148
|
-
toggleOne(search: Search<D>, data?: Arg<D>, context?: VContext): Promise<ToggleOneResult<D>>;
|
|
153
|
+
updateOneOrAdd(search: Search<D>, updater: Updater<D>, { add_arg, context, id_gen }?: UpdateOneOrAdd<D>): Promise<VQueryT.UpdateOneOrAddResult<D>>;
|
|
154
|
+
toggleOne(search: Search<D>, data?: Arg<D>, context?: VContext): Promise<VQueryT.ToggleOneResult<D>>;
|
|
149
155
|
}
|
|
150
156
|
export interface ValtheraCompatible {
|
|
151
157
|
c<T = Data>(collection: string): Collection<T>;
|
|
152
158
|
getCollections(): Promise<string[]>;
|
|
153
159
|
ensureCollection(collection: string): Promise<boolean>;
|
|
154
160
|
issetCollection(collection: string): Promise<boolean>;
|
|
155
|
-
add<T = Data>(query:
|
|
156
|
-
find<T = Data>(query:
|
|
157
|
-
findOne<T = Data>(query:
|
|
158
|
-
update<T = Data>(query:
|
|
159
|
-
updateOne<T = Data>(query:
|
|
160
|
-
remove<T = Data>(query:
|
|
161
|
-
removeOne<T = Data>(query:
|
|
161
|
+
add<T = Data>(query: VQueryT.Add<T>): Promise<T>;
|
|
162
|
+
find<T = Data>(query: VQueryT.Find<T>): Promise<T[]>;
|
|
163
|
+
findOne<T = Data>(query: VQueryT.FindOne<T>): Promise<T | null>;
|
|
164
|
+
update<T = Data>(query: VQueryT.Update<T>): Promise<T[]>;
|
|
165
|
+
updateOne<T = Data>(query: VQueryT.Update<T>): Promise<T | null>;
|
|
166
|
+
remove<T = Data>(query: VQueryT.Remove<T>): Promise<T[]>;
|
|
167
|
+
removeOne<T = Data>(query: VQueryT.Remove<T>): Promise<T | null>;
|
|
162
168
|
removeCollection(collection: string): Promise<boolean>;
|
|
163
|
-
updateOneOrAdd<T = Data>(query:
|
|
164
|
-
toggleOne<T = Data>(query:
|
|
169
|
+
updateOneOrAdd<T = Data>(query: VQueryT.UpdateOneOrAdd<T>): Promise<VQueryT.UpdateOneOrAddResult<T>>;
|
|
170
|
+
toggleOne<T = Data>(query: VQueryT.ToggleOne<T>): Promise<VQueryT.ToggleOneResult<T>>;
|
|
165
171
|
}
|
|
166
172
|
export interface VQuery_Control {
|
|
167
173
|
dir?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/vql-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"description": "VQL Client",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"type": "module",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"esbuild": "
|
|
30
|
-
"typescript": "
|
|
29
|
+
"esbuild": "^0.28",
|
|
30
|
+
"typescript": "^6"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist"
|