@wxn0brp/vql-client 0.2.12 → 0.2.13
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 +37 -48
- package/package.json +1 -1
package/dist/vql.d.ts
CHANGED
|
@@ -84,13 +84,25 @@ export type Arg<T = any> = {
|
|
|
84
84
|
[K in keyof T]?: any;
|
|
85
85
|
} & Record<string, any>;
|
|
86
86
|
export type SearchFunc<T = any> = (data: T, context: VContext) => boolean;
|
|
87
|
-
export type UpdaterFunc<T = any> = (data: T, context: VContext) =>
|
|
87
|
+
export type UpdaterFunc<T = any> = (data: T, context: VContext) => Data | void;
|
|
88
88
|
export type Search<T = any> = SearchOptions<T> | SearchFunc<T>;
|
|
89
|
-
export type Updater<T = any> = UpdaterArg<T> |
|
|
90
|
-
export interface
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
export type Updater<T = any> = UpdaterArg<T> | UpdaterFunc<T>;
|
|
90
|
+
export interface DbFindOpts<T = any> {
|
|
91
|
+
reverse?: boolean;
|
|
92
|
+
limit?: number;
|
|
93
|
+
offset?: number;
|
|
94
|
+
sortBy?: KeysMatching<T, any>;
|
|
95
|
+
sortAsc?: boolean;
|
|
96
|
+
min?: Record<string, KeysMatching<T, number>>;
|
|
97
|
+
max?: Record<string, KeysMatching<T, number>>;
|
|
98
|
+
avg?: Record<string, KeysMatching<T, number>>;
|
|
99
|
+
groupBy?: KeysMatching<T, any> | KeysMatching<T, any>[];
|
|
100
|
+
count?: Record<string, string>;
|
|
101
|
+
}
|
|
102
|
+
export interface FindOpts<T = any> {
|
|
103
|
+
select?: KeysMatching<T, any>[];
|
|
104
|
+
exclude?: KeysMatching<T, any>[];
|
|
105
|
+
transform?: Function;
|
|
94
106
|
}
|
|
95
107
|
export interface VQuery_Control {
|
|
96
108
|
}
|
|
@@ -124,27 +136,26 @@ export declare namespace VQueryT {
|
|
|
124
136
|
type: "added" | "removed";
|
|
125
137
|
}
|
|
126
138
|
}
|
|
127
|
-
export
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
export type UpdateQuery<T = Data> = VQueryT.Update<T>;
|
|
132
|
-
export type RemoveQuery<T = Data> = VQueryT.Remove<T>;
|
|
133
|
-
export type UpdateOneOrAddQuery<T = Data> = VQueryT.UpdateOneOrAdd<T>;
|
|
134
|
-
export type ToggleOneQuery<T = Data> = VQueryT.ToggleOne<T>;
|
|
135
|
-
export type UpdateOneOrAddResult<T> = VQueryT.UpdateOneOrAddResult<T>;
|
|
136
|
-
export type ToggleOneResult<T> = VQueryT.ToggleOneResult<T>;
|
|
137
|
-
export interface DbFindOpts<T = any> {
|
|
138
|
-
reverse?: boolean;
|
|
139
|
-
limit?: number;
|
|
140
|
-
offset?: number;
|
|
141
|
-
sortBy?: KeysMatching<T, any>;
|
|
142
|
-
sortAsc?: boolean;
|
|
139
|
+
export interface UpdateOneOrAdd<T> {
|
|
140
|
+
add_arg?: Arg<T>;
|
|
141
|
+
id_gen?: boolean;
|
|
142
|
+
context?: VContext;
|
|
143
143
|
}
|
|
144
|
-
export interface
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
export interface ValtheraCompatible {
|
|
145
|
+
c<T = Data>(collection: string): Collection<T>;
|
|
146
|
+
getCollections(): Promise<string[]>;
|
|
147
|
+
ensureCollection(collection: string): Promise<boolean>;
|
|
148
|
+
issetCollection(collection: string): Promise<boolean>;
|
|
149
|
+
add<T = Data>(query: VQueryT.Add<T>): Promise<T>;
|
|
150
|
+
find<T = Data>(query: VQueryT.Find<T>): Promise<T[]>;
|
|
151
|
+
findOne<T = Data>(query: VQueryT.FindOne<T>): Promise<T | null>;
|
|
152
|
+
update<T = Data>(query: VQueryT.Update<T>): Promise<T[]>;
|
|
153
|
+
updateOne<T = Data>(query: VQueryT.Update<T>): Promise<T | null>;
|
|
154
|
+
remove<T = Data>(query: VQueryT.Remove<T>): Promise<T[]>;
|
|
155
|
+
removeOne<T = Data>(query: VQueryT.Remove<T>): Promise<T | null>;
|
|
156
|
+
removeCollection(collection: string): Promise<boolean>;
|
|
157
|
+
updateOneOrAdd<T = Data>(query: VQueryT.UpdateOneOrAdd<T>): Promise<VQueryT.UpdateOneOrAddResult<T>>;
|
|
158
|
+
toggleOne<T = Data>(query: VQueryT.ToggleOne<T>): Promise<VQueryT.ToggleOneResult<T>>;
|
|
148
159
|
}
|
|
149
160
|
declare class Collection<D = Data> {
|
|
150
161
|
db: ValtheraCompatible;
|
|
@@ -163,28 +174,6 @@ declare class Collection<D = Data> {
|
|
|
163
174
|
updateOneOrAdd(search: Search<D>, updater: Updater<D>, { add_arg, context, id_gen }?: UpdateOneOrAdd<D>): Promise<VQueryT.UpdateOneOrAddResult<D>>;
|
|
164
175
|
toggleOne(search: Search<D>, data?: Arg<D>, context?: VContext): Promise<VQueryT.ToggleOneResult<D>>;
|
|
165
176
|
}
|
|
166
|
-
export interface ValtheraCompatible {
|
|
167
|
-
c<T = Data>(collection: string): Collection<T>;
|
|
168
|
-
getCollections(): Promise<string[]>;
|
|
169
|
-
ensureCollection(collection: string): Promise<boolean>;
|
|
170
|
-
issetCollection(collection: string): Promise<boolean>;
|
|
171
|
-
add<T = Data>(query: VQueryT.Add<T>): Promise<T>;
|
|
172
|
-
find<T = Data>(query: VQueryT.Find<T>): Promise<T[]>;
|
|
173
|
-
findOne<T = Data>(query: VQueryT.FindOne<T>): Promise<T | null>;
|
|
174
|
-
update<T = Data>(query: VQueryT.Update<T>): Promise<T[]>;
|
|
175
|
-
updateOne<T = Data>(query: VQueryT.Update<T>): Promise<T | null>;
|
|
176
|
-
remove<T = Data>(query: VQueryT.Remove<T>): Promise<T[]>;
|
|
177
|
-
removeOne<T = Data>(query: VQueryT.Remove<T>): Promise<T | null>;
|
|
178
|
-
removeCollection(collection: string): Promise<boolean>;
|
|
179
|
-
updateOneOrAdd<T = Data>(query: VQueryT.UpdateOneOrAdd<T>): Promise<VQueryT.UpdateOneOrAddResult<T>>;
|
|
180
|
-
toggleOne<T = Data>(query: VQueryT.ToggleOne<T>): Promise<VQueryT.ToggleOneResult<T>>;
|
|
181
|
-
}
|
|
182
|
-
export interface VQuery_Control {
|
|
183
|
-
dir?: {
|
|
184
|
-
lastFileNum?: number;
|
|
185
|
-
sortedFiles?: string[];
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
177
|
declare namespace RelationTypes {
|
|
189
178
|
type Path = [
|
|
190
179
|
string,
|