@trust0/ridb-core 1.7.35 → 1.7.38
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/build/ridb_core.d.ts +582 -581
- package/build/ridb_core.js +934 -941
- package/build/ridb_core.mjs +934 -941
- package/build/ridb_core_bg.mjs +1 -1
- package/package.json +6 -2
package/build/ridb_core.d.ts
CHANGED
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*/
|
|
5
|
-
declare function main_js(): void;
|
|
6
|
-
/**
|
|
7
4
|
* @returns {boolean}
|
|
8
5
|
*/
|
|
9
6
|
declare function is_debug_mode(): boolean;
|
|
10
7
|
/**
|
|
11
|
-
* Handler for `console.log` invocations.
|
|
12
|
-
*
|
|
13
|
-
* If a test is currently running it takes the `args` array and stringifies
|
|
14
|
-
* it and appends it to the current output of the test. Otherwise it passes
|
|
15
|
-
* the arguments to the original `console.log` function, psased as
|
|
16
|
-
* `original`.
|
|
17
|
-
* @param {Array<any>} args
|
|
18
|
-
*/
|
|
19
|
-
declare function __wbgtest_console_log(args: Array<any>): void;
|
|
20
|
-
/**
|
|
21
|
-
* Handler for `console.debug` invocations. See above.
|
|
22
|
-
* @param {Array<any>} args
|
|
23
8
|
*/
|
|
24
|
-
declare function
|
|
9
|
+
declare function main_js(): void;
|
|
25
10
|
/**
|
|
26
11
|
* Handler for `console.info` invocations. See above.
|
|
27
12
|
* @param {Array<any>} args
|
|
@@ -33,6 +18,21 @@ declare function __wbgtest_console_info(args: Array<any>): void;
|
|
|
33
18
|
*/
|
|
34
19
|
declare function __wbgtest_console_warn(args: Array<any>): void;
|
|
35
20
|
/**
|
|
21
|
+
* Handler for `console.debug` invocations. See above.
|
|
22
|
+
* @param {Array<any>} args
|
|
23
|
+
*/
|
|
24
|
+
declare function __wbgtest_console_debug(args: Array<any>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Handler for `console.log` invocations.
|
|
27
|
+
*
|
|
28
|
+
* If a test is currently running it takes the `args` array and stringifies
|
|
29
|
+
* it and appends it to the current output of the test. Otherwise it passes
|
|
30
|
+
* the arguments to the original `console.log` function, psased as
|
|
31
|
+
* `original`.
|
|
32
|
+
* @param {Array<any>} args
|
|
33
|
+
*/
|
|
34
|
+
declare function __wbgtest_console_log(args: Array<any>): void;
|
|
35
|
+
/**
|
|
36
36
|
* Handler for `console.error` invocations. See above.
|
|
37
37
|
* @param {Array<any>} args
|
|
38
38
|
*/
|
|
@@ -73,66 +73,38 @@ declare enum Errors {
|
|
|
73
73
|
AuthenticationError = 5,
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The version of the property, if applicable.
|
|
87
|
-
*/
|
|
88
|
-
readonly version?: number;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* The primary key of the property, if applicable.
|
|
92
|
-
*/
|
|
93
|
-
readonly primaryKey?: string;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* An optional array of nested properties for array-type properties.
|
|
97
|
-
*/
|
|
98
|
-
readonly items?: Property;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* The maximum number of items for array-type properties, if applicable.
|
|
102
|
-
*/
|
|
103
|
-
readonly maxItems?: number;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* The minimum number of items for array-type properties, if applicable.
|
|
107
|
-
*/
|
|
108
|
-
readonly minItems?: number;
|
|
76
|
+
type Operators<T> = {
|
|
77
|
+
$gte?: number,
|
|
78
|
+
$gt?: number
|
|
79
|
+
$lt?: number,
|
|
80
|
+
$lte?: number,
|
|
81
|
+
$eq?: T,
|
|
82
|
+
$ne?: T
|
|
83
|
+
};
|
|
109
84
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*/
|
|
113
|
-
readonly maxLength?: number;
|
|
85
|
+
type InOperator<T> = { $in?: T[] };
|
|
86
|
+
type NInOperator<T> = { $nin?: T[] };
|
|
114
87
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
readonly minLength?: number;
|
|
88
|
+
type OperatorOrType<T> = T extends number ?
|
|
89
|
+
T | Operators<T> | InOperator<T> | NInOperator<T> :
|
|
90
|
+
T | InOperator<T> | NInOperator<T>;
|
|
119
91
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
92
|
+
type LogicalOperators<T extends SchemaType> = {
|
|
93
|
+
$and?: Partial<QueryType<T>>[];
|
|
94
|
+
$or?: Partial<QueryType<T>>[];
|
|
95
|
+
};
|
|
124
96
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
97
|
+
type QueryType<T extends SchemaType> = ({
|
|
98
|
+
[K in keyof T['properties']as ExtractType<T['properties'][K]['type']> extends undefined ? never : K]?: OperatorOrType<
|
|
99
|
+
ExtractType<
|
|
100
|
+
T['properties'][K]['type']
|
|
101
|
+
>
|
|
102
|
+
>
|
|
103
|
+
} & LogicalOperators<T>) | LogicalOperators<T>[];
|
|
129
104
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
readonly properties?: {
|
|
134
|
-
[name: string]: Property;
|
|
135
|
-
};
|
|
105
|
+
declare class Query<T extends SchemaType> {
|
|
106
|
+
constructor(query: QueryType<T>, schema:Schema<T>);
|
|
107
|
+
readonly query: QueryType<T>;
|
|
136
108
|
}
|
|
137
109
|
|
|
138
110
|
|
|
@@ -167,329 +139,126 @@ declare const SchemaFieldType = {
|
|
|
167
139
|
|
|
168
140
|
|
|
169
141
|
/**
|
|
170
|
-
* Represents
|
|
171
|
-
*
|
|
172
|
-
* @template T - The schema type.
|
|
142
|
+
* Represents the type definition for a schema.
|
|
173
143
|
*/
|
|
174
|
-
|
|
144
|
+
type SchemaType = {
|
|
175
145
|
/**
|
|
176
|
-
*
|
|
146
|
+
* The version of the schema.
|
|
177
147
|
*/
|
|
178
|
-
|
|
148
|
+
version: number;
|
|
179
149
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
IndexDB<
|
|
185
|
-
SchemasCreate
|
|
186
|
-
>
|
|
187
|
-
>;
|
|
188
|
-
}
|
|
150
|
+
/**
|
|
151
|
+
* The primary key of the schema.
|
|
152
|
+
*/
|
|
153
|
+
primaryKey: string;
|
|
189
154
|
|
|
155
|
+
/**
|
|
156
|
+
* The type of the schema.
|
|
157
|
+
*/
|
|
158
|
+
type: SchemaFieldType;
|
|
159
|
+
indexes?: string[];
|
|
160
|
+
encrypted?: string[];
|
|
161
|
+
/**
|
|
162
|
+
* The properties defined in the schema.
|
|
163
|
+
*/
|
|
164
|
+
properties: {
|
|
165
|
+
[name: string]: Property;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
190
168
|
|
|
191
169
|
|
|
192
|
-
type InternalsRecord = {
|
|
193
|
-
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
194
|
-
};
|
|
195
170
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
171
|
+
* Represents a schema, including its definition and related methods.
|
|
172
|
+
* You may be trying to build a storage, in any other can u won't need access tho this class.
|
|
173
|
+
* Check this example
|
|
174
|
+
*
|
|
175
|
+
* ```typescript
|
|
176
|
+
* class MyStorage extends <T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
177
|
+
* example() {
|
|
178
|
+
* const schema: Schema<any> = this.getSchema("mySchema")
|
|
179
|
+
* }
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
* You alwayswill have access to getSchema through the Storage class.
|
|
183
|
+
*
|
|
184
|
+
* @template T - The schema type.
|
|
206
185
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
T extends "array" ? any[] :
|
|
213
|
-
undefined;
|
|
186
|
+
declare class Schema<T extends SchemaType> {
|
|
187
|
+
/**
|
|
188
|
+
* The schema definition.
|
|
189
|
+
*/
|
|
190
|
+
schema: Schema<T>;
|
|
214
191
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Creates a new `Schema` instance from the provided definition.
|
|
194
|
+
*
|
|
195
|
+
* @template TS - The schema type.
|
|
196
|
+
* @param {TS} defi, Debugnition - The schema definition.
|
|
197
|
+
* @returns {Schema<TS>} The created `Schema` instance.
|
|
198
|
+
*/
|
|
199
|
+
static create<TS extends SchemaType>(definition: TS): Schema<TS>;
|
|
221
200
|
|
|
222
|
-
/**
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
* type Document = Doc<Schema>; // Document is { name: string; age: number; }
|
|
228
|
-
*/
|
|
229
|
-
type Doc<T extends SchemaType> = {
|
|
230
|
-
[K in keyof T["properties"]]:
|
|
231
|
-
ExtractType<T['properties'][K]['type']>
|
|
232
|
-
} & {
|
|
233
|
-
__version?: number;
|
|
234
|
-
createdAt?: number;
|
|
235
|
-
updatedAt?: number;
|
|
236
|
-
};
|
|
201
|
+
/**
|
|
202
|
+
* The version of the schema.
|
|
203
|
+
*/
|
|
204
|
+
readonly version: number;
|
|
237
205
|
|
|
238
|
-
/**
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
243
|
-
*/
|
|
244
|
-
type CreateDoc<T extends SchemaType> = {
|
|
245
|
-
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
|
|
246
|
-
ExtractType<T['properties'][K]['type']>
|
|
247
|
-
} & {
|
|
248
|
-
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? never : K]:
|
|
249
|
-
ExtractType<T['properties'][K]['type']>
|
|
250
|
-
} & {
|
|
251
|
-
__version?: number;
|
|
252
|
-
createdAt?: number;
|
|
253
|
-
updatedAt?: number;
|
|
254
|
-
};
|
|
206
|
+
/**
|
|
207
|
+
* The primary key of the schema.
|
|
208
|
+
*/
|
|
209
|
+
readonly primaryKey: string;
|
|
255
210
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
211
|
+
/**
|
|
212
|
+
* The type of the schema.
|
|
213
|
+
*/
|
|
214
|
+
readonly type: SchemaFieldType;
|
|
260
215
|
|
|
261
|
-
/**
|
|
262
|
-
* Collection is a class that represents a collection of documents in a database.
|
|
263
|
-
* @template T - A schema type defining the structure of the documents in the collection.
|
|
264
|
-
*/
|
|
265
|
-
declare class Collection<T extends SchemaType> {
|
|
266
|
-
/**
|
|
267
|
-
* Finds all documents in the collection.
|
|
268
|
-
*
|
|
269
|
-
* @returns A promise that resolves to an array of documents.
|
|
270
|
-
*/
|
|
271
|
-
find(query: QueryType<T>, options?: QueryOptions): Promise<Doc<T>[]>;
|
|
272
|
-
/**
|
|
273
|
-
* count all documents in the collection.
|
|
274
|
-
*
|
|
275
|
-
* @returns A promise that resolves to an array of documents.
|
|
276
|
-
*/
|
|
277
|
-
count(query: QueryType<T>, options?: QueryOptions): Promise<number>;
|
|
278
|
-
/**
|
|
279
|
-
* Finds a single document in the collection by its ID.
|
|
280
|
-
*
|
|
281
|
-
* @param id - The ID of the document to find.
|
|
282
|
-
* @returns A promise that resolves to the found document.
|
|
283
|
-
*/
|
|
284
|
-
findById(id: string): Promise<Doc<T>>;
|
|
285
|
-
/**
|
|
286
|
-
* Updates a document in the collection by its ID.
|
|
287
|
-
*
|
|
288
|
-
* @param document - A partial document containing the fields to update.
|
|
289
|
-
* @returns A promise that resolves when the update is complete.
|
|
290
|
-
*/
|
|
291
|
-
update(document: Partial<Doc<T>>): Promise<void>;
|
|
292
|
-
/**
|
|
293
|
-
* Creates a new document in the collection.
|
|
294
|
-
*
|
|
295
|
-
* @param document - The document to create.
|
|
296
|
-
* @returns A promise that resolves to the created document.
|
|
297
|
-
*/
|
|
298
|
-
create(document: CreateDoc<T>): Promise<Doc<T>>;
|
|
299
|
-
/**
|
|
300
|
-
* Deletes a document in the collection by its ID.
|
|
301
|
-
*
|
|
302
|
-
* @param id - The ID of the document to delete.
|
|
303
|
-
* @returns A promise that resolves when the deletion is complete.
|
|
304
|
-
*/
|
|
305
|
-
delete(id: string): Promise<void>;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
declare class CoreStorage {
|
|
312
216
|
/**
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
* @returns {boolean}
|
|
316
|
-
*/
|
|
317
|
-
matchesQuery(document: any, query: Query<any>): boolean;
|
|
318
|
-
getPrimaryKeyTyped(value: any): string | number;
|
|
319
|
-
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Represents an operation to be performed on a collection.
|
|
326
|
-
*
|
|
327
|
-
* @template T - The schema type of the collection.
|
|
328
|
-
*/
|
|
329
|
-
type Operation<T extends SchemaType = SchemaType> = {
|
|
217
|
+
* An optional array of indexes.
|
|
218
|
+
*/
|
|
330
219
|
/**
|
|
331
|
-
*
|
|
220
|
+
* An optional array of indexes.
|
|
332
221
|
*/
|
|
333
|
-
|
|
222
|
+
readonly indexes?: (Extract<keyof T, string>)[];
|
|
334
223
|
|
|
335
224
|
/**
|
|
336
|
-
*
|
|
225
|
+
* An optional array of encrypted fields.
|
|
337
226
|
*/
|
|
338
|
-
|
|
227
|
+
readonly encrypted?: (Extract<keyof T, string>)[];
|
|
339
228
|
|
|
340
229
|
/**
|
|
341
|
-
* The
|
|
230
|
+
* The properties defined in the schema.
|
|
342
231
|
*/
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
type Operators<T> = {
|
|
352
|
-
$gte?: number,
|
|
353
|
-
$gt?: number
|
|
354
|
-
$lt?: number,
|
|
355
|
-
$lte?: number,
|
|
356
|
-
$eq?: T,
|
|
357
|
-
$ne?: T
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
type InOperator<T> = { $in?: T[] };
|
|
361
|
-
type NInOperator<T> = { $nin?: T[] };
|
|
362
|
-
|
|
363
|
-
type OperatorOrType<T> = T extends number ?
|
|
364
|
-
T | Operators<T> | InOperator<T> | NInOperator<T> :
|
|
365
|
-
T | InOperator<T> | NInOperator<T>;
|
|
366
|
-
|
|
367
|
-
type LogicalOperators<T extends SchemaType> = {
|
|
368
|
-
$and?: Partial<QueryType<T>>[];
|
|
369
|
-
$or?: Partial<QueryType<T>>[];
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
type QueryType<T extends SchemaType> = ({
|
|
373
|
-
[K in keyof T['properties']as ExtractType<T['properties'][K]['type']> extends undefined ? never : K]?: OperatorOrType<
|
|
374
|
-
ExtractType<
|
|
375
|
-
T['properties'][K]['type']
|
|
376
|
-
>
|
|
377
|
-
>
|
|
378
|
-
} & LogicalOperators<T>) | LogicalOperators<T>[];
|
|
379
|
-
|
|
380
|
-
declare class Query<T extends SchemaType> {
|
|
381
|
-
constructor(query: QueryType<T>, schema:Schema<T>);
|
|
382
|
-
readonly query: QueryType<T>;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
type EnumerateUpTo<
|
|
388
|
-
N extends number,
|
|
389
|
-
Acc extends number[] = []
|
|
390
|
-
> = Acc['length'] extends N ?
|
|
391
|
-
Acc[number]:
|
|
392
|
-
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
393
|
-
|
|
394
|
-
type EnumerateFrom1To<
|
|
395
|
-
N extends number
|
|
396
|
-
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
397
|
-
|
|
398
|
-
type IsVersionGreaterThan0<
|
|
399
|
-
V extends number
|
|
400
|
-
> = V extends 0 ? false : true;
|
|
401
|
-
|
|
402
|
-
type AnyVersionGreaterThan1<
|
|
403
|
-
T extends Record<string, SchemaType>
|
|
404
|
-
> = true extends {
|
|
405
|
-
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
406
|
-
} [keyof T] ? true : false;
|
|
407
|
-
|
|
408
|
-
type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
409
|
-
|
|
410
|
-
type MigrationPathsForSchema<
|
|
411
|
-
T extends SchemaType
|
|
412
|
-
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
413
|
-
{
|
|
414
|
-
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
type MigrationPathsForSchemas<
|
|
418
|
-
T extends SchemaTypeRecord
|
|
419
|
-
> = {
|
|
420
|
-
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
type MigrationsParameter<
|
|
424
|
-
T extends SchemaTypeRecord
|
|
425
|
-
> = AnyVersionGreaterThan1<T> extends true ?
|
|
426
|
-
{
|
|
427
|
-
migrations: MigrationPathsForSchemas<T>
|
|
428
|
-
}:
|
|
429
|
-
{
|
|
430
|
-
migrations?: never
|
|
232
|
+
readonly properties: {
|
|
233
|
+
[K in keyof T['properties'] as T['properties'][K]['required'] extends false | (T['properties'][K]['default'] extends undefined ? true: false) ? K : never]?: T['properties'][K];
|
|
234
|
+
} & {
|
|
235
|
+
[K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
|
|
431
236
|
};
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Represents an in-memory storage system extending the base storage functionality.
|
|
437
|
-
*
|
|
438
|
-
* @template T - The schema type.
|
|
439
|
-
*/
|
|
440
|
-
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
441
237
|
/**
|
|
442
|
-
*
|
|
238
|
+
* Converts the schema to a JSON representation.
|
|
239
|
+
*
|
|
240
|
+
* @returns {SchemaType} The JSON representation of the schema.
|
|
443
241
|
*/
|
|
444
|
-
|
|
242
|
+
toJSON(): SchemaType;
|
|
445
243
|
|
|
446
|
-
|
|
447
|
-
dbName: string,
|
|
448
|
-
schemas: SchemasCreate,
|
|
449
|
-
): Promise<
|
|
450
|
-
InMemory<
|
|
451
|
-
SchemasCreate
|
|
452
|
-
>
|
|
453
|
-
>;
|
|
244
|
+
validate(document: Doc<Schema<T>>): boolean;
|
|
454
245
|
}
|
|
455
246
|
|
|
456
247
|
|
|
457
248
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
constructor(
|
|
468
|
-
name: string,
|
|
469
|
-
schemas: Schemas
|
|
470
|
-
);
|
|
471
|
-
abstract start(): Promise<void>;
|
|
472
|
-
abstract close(): Promise<void>;
|
|
473
|
-
abstract count(
|
|
474
|
-
colectionName: keyof Schemas,
|
|
475
|
-
query: QueryType<Schemas[keyof Schemas]>,
|
|
476
|
-
options?: QueryOptions
|
|
477
|
-
): Promise<number>;
|
|
478
|
-
abstract findDocumentById(
|
|
479
|
-
collectionName: keyof Schemas,
|
|
480
|
-
id: string
|
|
481
|
-
): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
482
|
-
abstract find(
|
|
483
|
-
collectionName: keyof Schemas,
|
|
484
|
-
query: QueryType<Schemas[keyof Schemas]>,
|
|
485
|
-
options?: QueryOptions
|
|
486
|
-
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
487
|
-
abstract write(
|
|
488
|
-
op: Operation<Schemas[keyof Schemas]>
|
|
489
|
-
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
249
|
+
declare class CoreStorage {
|
|
250
|
+
/**
|
|
251
|
+
* @param {any} document
|
|
252
|
+
* @param {Query} query
|
|
253
|
+
* @returns {boolean}
|
|
254
|
+
*/
|
|
255
|
+
matchesQuery(document: any, query: Query<any>): boolean;
|
|
256
|
+
getPrimaryKeyTyped(value: any): string | number;
|
|
257
|
+
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
490
258
|
}
|
|
491
259
|
|
|
492
260
|
|
|
261
|
+
|
|
493
262
|
type BaseStorageOptions = {
|
|
494
263
|
[name:string]:string | boolean | number
|
|
495
264
|
}
|
|
@@ -631,128 +400,359 @@ type RIDBModule = {
|
|
|
631
400
|
|
|
632
401
|
|
|
633
402
|
|
|
634
|
-
type Hook = (
|
|
635
|
-
schema: Schema<SchemaType>,
|
|
636
|
-
migration: MigrationPathsForSchema<SchemaType>,
|
|
637
|
-
doc: Doc<SchemaType>
|
|
638
|
-
) => Doc<SchemaType>
|
|
639
|
-
|
|
640
|
-
type BasePluginOptions = {
|
|
641
|
-
docCreateHook?: Hook,
|
|
642
|
-
docRecoverHook?: Hook
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
declare class BasePlugin implements BasePluginOptions {
|
|
646
|
-
docCreateHook?:Hook;
|
|
647
|
-
docRecoverHook?:Hook;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
403
|
/**
|
|
653
|
-
* Represents
|
|
404
|
+
* Represents a property within a schema, including various constraints and nested properties.
|
|
654
405
|
*/
|
|
655
|
-
|
|
406
|
+
declare class Property {
|
|
656
407
|
/**
|
|
657
|
-
* The
|
|
408
|
+
* The type of the property.
|
|
658
409
|
*/
|
|
659
|
-
|
|
410
|
+
readonly type: SchemaFieldType;
|
|
660
411
|
|
|
661
412
|
/**
|
|
662
|
-
* The
|
|
413
|
+
* The version of the property, if applicable.
|
|
663
414
|
*/
|
|
664
|
-
|
|
415
|
+
readonly version?: number;
|
|
665
416
|
|
|
666
417
|
/**
|
|
667
|
-
* The
|
|
418
|
+
* The primary key of the property, if applicable.
|
|
668
419
|
*/
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
encrypted?: string[];
|
|
420
|
+
readonly primaryKey?: string;
|
|
421
|
+
|
|
672
422
|
/**
|
|
673
|
-
*
|
|
423
|
+
* An optional array of nested properties for array-type properties.
|
|
674
424
|
*/
|
|
675
|
-
|
|
676
|
-
[name: string]: Property;
|
|
677
|
-
};
|
|
678
|
-
};
|
|
425
|
+
readonly items?: Property;
|
|
679
426
|
|
|
427
|
+
/**
|
|
428
|
+
* The maximum number of items for array-type properties, if applicable.
|
|
429
|
+
*/
|
|
430
|
+
readonly maxItems?: number;
|
|
680
431
|
|
|
681
|
-
/**
|
|
682
|
-
* Represents a schema, including its definition and related methods.
|
|
683
|
-
* You may be trying to build a storage, in any other can u won't need access tho this class.
|
|
684
|
-
* Check this example
|
|
685
|
-
*
|
|
686
|
-
* ```typescript
|
|
687
|
-
* class MyStorage extends <T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
688
|
-
* example() {
|
|
689
|
-
* const schema: Schema<any> = this.getSchema("mySchema")
|
|
690
|
-
* }
|
|
691
|
-
* }
|
|
692
|
-
* ```
|
|
693
|
-
* You alwayswill have access to getSchema through the Storage class.
|
|
694
|
-
*
|
|
695
|
-
* @template T - The schema type.
|
|
696
|
-
*/
|
|
697
|
-
declare class Schema<T extends SchemaType> {
|
|
698
432
|
/**
|
|
699
|
-
* The
|
|
433
|
+
* The minimum number of items for array-type properties, if applicable.
|
|
700
434
|
*/
|
|
701
|
-
|
|
435
|
+
readonly minItems?: number;
|
|
702
436
|
|
|
703
437
|
/**
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
* @template TS - The schema type.
|
|
707
|
-
* @param {TS} defi, Debugnition - The schema definition.
|
|
708
|
-
* @returns {Schema<TS>} The created `Schema` instance.
|
|
438
|
+
* The maximum length for string-type properties, if applicable.
|
|
709
439
|
*/
|
|
710
|
-
|
|
440
|
+
readonly maxLength?: number;
|
|
711
441
|
|
|
712
442
|
/**
|
|
713
|
-
* The
|
|
443
|
+
* The minimum length for string-type properties, if applicable.
|
|
714
444
|
*/
|
|
715
|
-
readonly
|
|
445
|
+
readonly minLength?: number;
|
|
716
446
|
|
|
717
447
|
/**
|
|
718
|
-
*
|
|
448
|
+
* An optional array of required fields for object-type properties.
|
|
719
449
|
*/
|
|
720
|
-
readonly
|
|
450
|
+
readonly required?: boolean;
|
|
721
451
|
|
|
722
452
|
/**
|
|
723
|
-
*
|
|
453
|
+
* An optional default value for the property.
|
|
724
454
|
*/
|
|
725
|
-
readonly
|
|
455
|
+
readonly default?: any;
|
|
726
456
|
|
|
727
457
|
/**
|
|
728
|
-
* An optional
|
|
458
|
+
* An optional map of nested properties for object-type properties.
|
|
459
|
+
*/
|
|
460
|
+
readonly properties?: {
|
|
461
|
+
[name: string]: Property;
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
type EnumerateUpTo<
|
|
468
|
+
N extends number,
|
|
469
|
+
Acc extends number[] = []
|
|
470
|
+
> = Acc['length'] extends N ?
|
|
471
|
+
Acc[number]:
|
|
472
|
+
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
473
|
+
|
|
474
|
+
type EnumerateFrom1To<
|
|
475
|
+
N extends number
|
|
476
|
+
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
477
|
+
|
|
478
|
+
type IsVersionGreaterThan0<
|
|
479
|
+
V extends number
|
|
480
|
+
> = V extends 0 ? false : true;
|
|
481
|
+
|
|
482
|
+
type AnyVersionGreaterThan1<
|
|
483
|
+
T extends Record<string, SchemaType>
|
|
484
|
+
> = true extends {
|
|
485
|
+
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
486
|
+
} [keyof T] ? true : false;
|
|
487
|
+
|
|
488
|
+
type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
489
|
+
|
|
490
|
+
type MigrationPathsForSchema<
|
|
491
|
+
T extends SchemaType
|
|
492
|
+
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
493
|
+
{
|
|
494
|
+
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
type MigrationPathsForSchemas<
|
|
498
|
+
T extends SchemaTypeRecord
|
|
499
|
+
> = {
|
|
500
|
+
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
type MigrationsParameter<
|
|
504
|
+
T extends SchemaTypeRecord
|
|
505
|
+
> = AnyVersionGreaterThan1<T> extends true ?
|
|
506
|
+
{
|
|
507
|
+
migrations: MigrationPathsForSchemas<T>
|
|
508
|
+
}:
|
|
509
|
+
{
|
|
510
|
+
migrations?: never
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
type Hook = (
|
|
516
|
+
schema: Schema<SchemaType>,
|
|
517
|
+
migration: MigrationPathsForSchema<SchemaType>,
|
|
518
|
+
doc: Doc<SchemaType>
|
|
519
|
+
) => Doc<SchemaType>
|
|
520
|
+
|
|
521
|
+
type BasePluginOptions = {
|
|
522
|
+
docCreateHook?: Hook,
|
|
523
|
+
docRecoverHook?: Hook
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
declare class BasePlugin implements BasePluginOptions {
|
|
527
|
+
docCreateHook?:Hook;
|
|
528
|
+
docRecoverHook?:Hook;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
type InternalsRecord = {
|
|
534
|
+
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* ExtractType is a utility type that maps a string representing a basic data type to the actual TypeScript type.
|
|
538
|
+
*
|
|
539
|
+
* @template T - A string literal type representing the basic data type ('string', 'number', 'boolean', 'object', 'array').
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* type StringType = ExtractType<'string'>; // StringType is string
|
|
543
|
+
* type NumberType = ExtractType<'number'>; // NumberType is number
|
|
544
|
+
* type BooleanType = ExtractType<'boolean'>; // BooleanType is boolean
|
|
545
|
+
* type ObjectType = ExtractType<'object'>; // ObjectType is object
|
|
546
|
+
* type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
|
|
547
|
+
*/
|
|
548
|
+
type ExtractType<T extends string> =
|
|
549
|
+
T extends "string" ? string :
|
|
550
|
+
T extends "number" ? number :
|
|
551
|
+
T extends "boolean" ? boolean :
|
|
552
|
+
T extends "object" ? object :
|
|
553
|
+
T extends "array" ? any[] :
|
|
554
|
+
undefined;
|
|
555
|
+
|
|
556
|
+
type IsOptional<T> =
|
|
557
|
+
T extends { required: true }
|
|
558
|
+
? T extends { default: never }
|
|
559
|
+
? false
|
|
560
|
+
: true
|
|
561
|
+
: true;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Doc is a utility type that transforms a schema type into a document type where each property is mapped to its extracted type.
|
|
565
|
+
*
|
|
566
|
+
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
567
|
+
*
|
|
568
|
+
* type Document = Doc<Schema>; // Document is { name: string; age: number; }
|
|
569
|
+
*/
|
|
570
|
+
type Doc<T extends SchemaType> = {
|
|
571
|
+
[K in keyof T["properties"]]:
|
|
572
|
+
ExtractType<T['properties'][K]['type']>
|
|
573
|
+
} & {
|
|
574
|
+
__version?: number;
|
|
575
|
+
createdAt?: number;
|
|
576
|
+
updatedAt?: number;
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* CreateDoc is a utility type for document creation that properly handles required vs optional fields
|
|
581
|
+
* during the creation process. Fields with default values or required: false become optional.
|
|
582
|
+
*
|
|
583
|
+
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
584
|
+
*/
|
|
585
|
+
type CreateDoc<T extends SchemaType> = {
|
|
586
|
+
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
|
|
587
|
+
ExtractType<T['properties'][K]['type']>
|
|
588
|
+
} & {
|
|
589
|
+
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? never : K]:
|
|
590
|
+
ExtractType<T['properties'][K]['type']>
|
|
591
|
+
} & {
|
|
592
|
+
__version?: number;
|
|
593
|
+
createdAt?: number;
|
|
594
|
+
updatedAt?: number;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
type QueryOptions = {
|
|
598
|
+
limit?: number;
|
|
599
|
+
offset?: number;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Collection is a class that represents a collection of documents in a database.
|
|
604
|
+
* @template T - A schema type defining the structure of the documents in the collection.
|
|
605
|
+
*/
|
|
606
|
+
declare class Collection<T extends SchemaType> {
|
|
607
|
+
/**
|
|
608
|
+
* Finds all documents in the collection.
|
|
609
|
+
*
|
|
610
|
+
* @returns A promise that resolves to an array of documents.
|
|
611
|
+
*/
|
|
612
|
+
find(query: QueryType<T>, options?: QueryOptions): Promise<Doc<T>[]>;
|
|
613
|
+
/**
|
|
614
|
+
* count all documents in the collection.
|
|
615
|
+
*
|
|
616
|
+
* @returns A promise that resolves to an array of documents.
|
|
617
|
+
*/
|
|
618
|
+
count(query: QueryType<T>, options?: QueryOptions): Promise<number>;
|
|
619
|
+
/**
|
|
620
|
+
* Finds a single document in the collection by its ID.
|
|
621
|
+
*
|
|
622
|
+
* @param id - The ID of the document to find.
|
|
623
|
+
* @returns A promise that resolves to the found document.
|
|
624
|
+
*/
|
|
625
|
+
findById(id: string): Promise<Doc<T>>;
|
|
626
|
+
/**
|
|
627
|
+
* Updates a document in the collection by its ID.
|
|
628
|
+
*
|
|
629
|
+
* @param document - A partial document containing the fields to update.
|
|
630
|
+
* @returns A promise that resolves when the update is complete.
|
|
631
|
+
*/
|
|
632
|
+
update(document: Partial<Doc<T>>): Promise<void>;
|
|
633
|
+
/**
|
|
634
|
+
* Creates a new document in the collection.
|
|
635
|
+
*
|
|
636
|
+
* @param document - The document to create.
|
|
637
|
+
* @returns A promise that resolves to the created document.
|
|
638
|
+
*/
|
|
639
|
+
create(document: CreateDoc<T>): Promise<Doc<T>>;
|
|
640
|
+
/**
|
|
641
|
+
* Deletes a document in the collection by its ID.
|
|
642
|
+
*
|
|
643
|
+
* @param id - The ID of the document to delete.
|
|
644
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
645
|
+
*/
|
|
646
|
+
delete(id: string): Promise<void>;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Represents an in-memory storage system extending the base storage functionality.
|
|
654
|
+
*
|
|
655
|
+
* @template T - The schema type.
|
|
656
|
+
*/
|
|
657
|
+
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
658
|
+
/**
|
|
659
|
+
* Frees the resources used by the in-memory storage.
|
|
729
660
|
*/
|
|
661
|
+
free(): void;
|
|
662
|
+
|
|
663
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
664
|
+
dbName: string,
|
|
665
|
+
schemas: SchemasCreate,
|
|
666
|
+
): Promise<
|
|
667
|
+
InMemory<
|
|
668
|
+
SchemasCreate
|
|
669
|
+
>
|
|
670
|
+
>;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Represents an operation to be performed on a collection.
|
|
677
|
+
*
|
|
678
|
+
* @template T - The schema type of the collection.
|
|
679
|
+
*/
|
|
680
|
+
type Operation<T extends SchemaType = SchemaType> = {
|
|
730
681
|
/**
|
|
731
|
-
*
|
|
682
|
+
* The name of the collection on which the operation will be performed.
|
|
732
683
|
*/
|
|
733
|
-
|
|
684
|
+
collection: string,
|
|
734
685
|
|
|
735
686
|
/**
|
|
736
|
-
*
|
|
687
|
+
* The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
|
|
737
688
|
*/
|
|
738
|
-
|
|
689
|
+
opType: OpType,
|
|
739
690
|
|
|
740
691
|
/**
|
|
741
|
-
* The
|
|
692
|
+
* The data involved in the operation, conforming to the schema type.
|
|
742
693
|
*/
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
694
|
+
data: Doc<T>,
|
|
695
|
+
|
|
696
|
+
primaryKeyField?: string,
|
|
697
|
+
primaryKey?: string
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
704
|
+
* @internal
|
|
705
|
+
*/
|
|
706
|
+
type SchemaTypeRecord = {
|
|
707
|
+
[name: string]: SchemaType
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
declare abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
711
|
+
constructor(
|
|
712
|
+
name: string,
|
|
713
|
+
schemas: Schemas
|
|
714
|
+
);
|
|
715
|
+
abstract start(): Promise<void>;
|
|
716
|
+
abstract close(): Promise<void>;
|
|
717
|
+
abstract count(
|
|
718
|
+
colectionName: keyof Schemas,
|
|
719
|
+
query: QueryType<Schemas[keyof Schemas]>,
|
|
720
|
+
options?: QueryOptions
|
|
721
|
+
): Promise<number>;
|
|
722
|
+
abstract findDocumentById(
|
|
723
|
+
collectionName: keyof Schemas,
|
|
724
|
+
id: string
|
|
725
|
+
): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
726
|
+
abstract find(
|
|
727
|
+
collectionName: keyof Schemas,
|
|
728
|
+
query: QueryType<Schemas[keyof Schemas]>,
|
|
729
|
+
options?: QueryOptions
|
|
730
|
+
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
731
|
+
abstract write(
|
|
732
|
+
op: Operation<Schemas[keyof Schemas]>
|
|
733
|
+
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Represents an IndexDB storage system extending the base storage functionality.
|
|
739
|
+
*
|
|
740
|
+
* @template T - The schema type.
|
|
741
|
+
*/
|
|
742
|
+
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
748
743
|
/**
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
* @returns {SchemaType} The JSON representation of the schema.
|
|
744
|
+
* Frees the resources used by the in-memory storage.
|
|
752
745
|
*/
|
|
753
|
-
|
|
746
|
+
free(): void;
|
|
754
747
|
|
|
755
|
-
|
|
748
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
749
|
+
dbName: string,
|
|
750
|
+
schemas: SchemasCreate,
|
|
751
|
+
): Promise<
|
|
752
|
+
IndexDB<
|
|
753
|
+
SchemasCreate
|
|
754
|
+
>
|
|
755
|
+
>;
|
|
756
756
|
}
|
|
757
757
|
|
|
758
758
|
|
|
@@ -769,52 +769,52 @@ declare class RIDBError {
|
|
|
769
769
|
toString(): string;
|
|
770
770
|
free(): void;
|
|
771
771
|
/**
|
|
772
|
-
* @param {string}
|
|
773
|
-
* @param {string} message
|
|
772
|
+
* @param {string} err
|
|
774
773
|
* @param {number} code
|
|
774
|
+
* @returns {RIDBError}
|
|
775
775
|
*/
|
|
776
|
-
|
|
776
|
+
static validation(err: string, code: number): RIDBError;
|
|
777
777
|
/**
|
|
778
|
-
* @param {
|
|
778
|
+
* @param {string} err
|
|
779
|
+
* @param {number} code
|
|
779
780
|
* @returns {RIDBError}
|
|
780
781
|
*/
|
|
781
|
-
static
|
|
782
|
+
static serialisation(err: string, code: number): RIDBError;
|
|
782
783
|
/**
|
|
783
784
|
* @param {string} err
|
|
784
785
|
* @param {number} code
|
|
785
786
|
* @returns {RIDBError}
|
|
786
787
|
*/
|
|
787
|
-
static
|
|
788
|
+
static authentication(err: string, code: number): RIDBError;
|
|
788
789
|
/**
|
|
789
|
-
* @param {string}
|
|
790
|
+
* @param {string} err_type
|
|
791
|
+
* @param {string} message
|
|
790
792
|
* @param {number} code
|
|
791
|
-
* @returns {RIDBError}
|
|
792
793
|
*/
|
|
793
|
-
|
|
794
|
+
constructor(err_type: string, message: string, code: number);
|
|
794
795
|
/**
|
|
795
796
|
* @param {string} err
|
|
796
797
|
* @param {number} code
|
|
797
798
|
* @returns {RIDBError}
|
|
798
799
|
*/
|
|
799
|
-
static
|
|
800
|
+
static hook(err: string, code: number): RIDBError;
|
|
800
801
|
/**
|
|
801
802
|
* @param {string} err
|
|
802
803
|
* @param {number} code
|
|
803
804
|
* @returns {RIDBError}
|
|
804
805
|
*/
|
|
805
|
-
static
|
|
806
|
+
static error(err: string, code: number): RIDBError;
|
|
806
807
|
/**
|
|
807
808
|
* @param {string} err
|
|
808
809
|
* @param {number} code
|
|
809
810
|
* @returns {RIDBError}
|
|
810
811
|
*/
|
|
811
|
-
static
|
|
812
|
+
static query(err: string, code: number): RIDBError;
|
|
812
813
|
/**
|
|
813
|
-
* @param {
|
|
814
|
-
* @param {number} code
|
|
814
|
+
* @param {any} err
|
|
815
815
|
* @returns {RIDBError}
|
|
816
816
|
*/
|
|
817
|
-
static
|
|
817
|
+
static from(err: any): RIDBError;
|
|
818
818
|
/**
|
|
819
819
|
*/
|
|
820
820
|
readonly code: any;
|
|
@@ -842,12 +842,6 @@ declare class WasmBindgenTestContext {
|
|
|
842
842
|
*/
|
|
843
843
|
constructor();
|
|
844
844
|
/**
|
|
845
|
-
* Inform this context about runtime arguments passed to the test
|
|
846
|
-
* harness.
|
|
847
|
-
* @param {any[]} args
|
|
848
|
-
*/
|
|
849
|
-
args(args: any[]): void;
|
|
850
|
-
/**
|
|
851
845
|
* Executes a list of tests, returning a promise representing their
|
|
852
846
|
* eventual completion.
|
|
853
847
|
*
|
|
@@ -861,172 +855,179 @@ declare class WasmBindgenTestContext {
|
|
|
861
855
|
* @returns {Promise<any>}
|
|
862
856
|
*/
|
|
863
857
|
run(tests: any[]): Promise<any>;
|
|
858
|
+
/**
|
|
859
|
+
* Inform this context about runtime arguments passed to the test
|
|
860
|
+
* harness.
|
|
861
|
+
* @param {any[]} args
|
|
862
|
+
*/
|
|
863
|
+
args(args: any[]): void;
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
867
867
|
|
|
868
868
|
interface InitOutput {
|
|
869
869
|
readonly memory: WebAssembly.Memory;
|
|
870
|
-
readonly __wbg_property_free: (a: number) => void;
|
|
871
|
-
readonly property_is_valid: (a: number, b: number) => void;
|
|
872
|
-
readonly property_type: (a: number) => number;
|
|
873
|
-
readonly property_items: (a: number, b: number) => void;
|
|
874
|
-
readonly property_maxItems: (a: number, b: number) => void;
|
|
875
|
-
readonly property_minItems: (a: number, b: number) => void;
|
|
876
|
-
readonly property_maxLength: (a: number, b: number) => void;
|
|
877
|
-
readonly property_minLength: (a: number, b: number) => void;
|
|
878
|
-
readonly property_properties: (a: number, b: number) => void;
|
|
879
|
-
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
880
|
-
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
881
|
-
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
882
|
-
readonly __wbg_indexdb_free: (a: number) => void;
|
|
883
|
-
readonly indexdb_get_stores: (a: number, b: number) => void;
|
|
884
|
-
readonly indexdb_get_store: (a: number, b: number, c: number, d: number) => void;
|
|
885
|
-
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
886
|
-
readonly indexdb_write: (a: number, b: number) => number;
|
|
887
|
-
readonly indexdb_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
888
|
-
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
889
|
-
readonly indexdb_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
890
|
-
readonly indexdb_close: (a: number) => number;
|
|
891
|
-
readonly indexdb_start: (a: number) => number;
|
|
892
|
-
readonly __wbg_collection_free: (a: number) => void;
|
|
893
|
-
readonly collection_name: (a: number, b: number) => void;
|
|
894
|
-
readonly collection_schema: (a: number, b: number) => void;
|
|
895
|
-
readonly collection_find: (a: number, b: number, c: number) => number;
|
|
896
|
-
readonly collection_parse_query_options: (a: number, b: number, c: number) => void;
|
|
897
|
-
readonly collection_count: (a: number, b: number, c: number) => number;
|
|
898
|
-
readonly collection_findById: (a: number, b: number) => number;
|
|
899
|
-
readonly collection_update: (a: number, b: number) => number;
|
|
900
|
-
readonly collection_create: (a: number, b: number) => number;
|
|
901
|
-
readonly collection_delete: (a: number, b: number) => number;
|
|
902
|
-
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
903
|
-
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
904
|
-
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
905
|
-
readonly __wbg_operation_free: (a: number) => void;
|
|
906
|
-
readonly operation_collection: (a: number, b: number) => void;
|
|
907
|
-
readonly operation_opType: (a: number) => number;
|
|
908
|
-
readonly operation_data: (a: number) => number;
|
|
909
|
-
readonly operation_primaryKeyField: (a: number) => number;
|
|
910
|
-
readonly operation_primaryKey: (a: number) => number;
|
|
911
|
-
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
912
|
-
readonly corestorage_new: () => number;
|
|
913
|
-
readonly __wbg_corestorage_free: (a: number) => void;
|
|
914
870
|
readonly __wbg_query_free: (a: number) => void;
|
|
915
|
-
readonly query_new: (a: number, b: number, c: number) => void;
|
|
916
|
-
readonly query_query: (a: number, b: number) => void;
|
|
917
|
-
readonly query_get_properties: (a: number, b: number) => void;
|
|
918
|
-
readonly query_parse: (a: number, b: number) => void;
|
|
919
|
-
readonly query_process_query: (a: number, b: number, c: number) => void;
|
|
920
|
-
readonly query_get: (a: number, b: number, c: number, d: number) => void;
|
|
921
|
-
readonly query_has_or_operator: (a: number) => number;
|
|
922
|
-
readonly __wbgt_test_get_properties_simple_fields_6: (a: number) => void;
|
|
923
|
-
readonly __wbgt_test_get_properties_with_operators_7: (a: number) => void;
|
|
924
|
-
readonly __wbgt_test_get_properties_with_logical_operators_8: (a: number) => void;
|
|
925
|
-
readonly __wbgt_test_get_properties_nested_operators_9: (a: number) => void;
|
|
926
871
|
readonly __wbgt_test_get_properties_array_values_10: (a: number) => void;
|
|
927
|
-
readonly __wbgt_test_get_properties_empty_query_11: (a: number) => void;
|
|
928
872
|
readonly __wbgt_test_get_properties_deeply_nested_12: (a: number) => void;
|
|
929
|
-
readonly
|
|
873
|
+
readonly __wbgt_test_get_properties_empty_query_11: (a: number) => void;
|
|
874
|
+
readonly __wbgt_test_get_properties_nested_operators_9: (a: number) => void;
|
|
875
|
+
readonly __wbgt_test_get_properties_simple_fields_6: (a: number) => void;
|
|
930
876
|
readonly __wbgt_test_get_properties_with_array_at_top_level_14: (a: number) => void;
|
|
931
|
-
readonly
|
|
932
|
-
readonly
|
|
933
|
-
readonly
|
|
934
|
-
readonly
|
|
935
|
-
readonly __wbgt_test_query_get_query_normalization_with_logical_operator_19: (a: number) => void;
|
|
877
|
+
readonly __wbgt_test_get_properties_with_logical_operators_8: (a: number) => void;
|
|
878
|
+
readonly __wbgt_test_get_properties_with_multiple_same_props_13: (a: number) => void;
|
|
879
|
+
readonly __wbgt_test_get_properties_with_operators_7: (a: number) => void;
|
|
880
|
+
readonly __wbgt_test_query_get_query_normalization_complex_mixed_22: (a: number) => void;
|
|
936
881
|
readonly __wbgt_test_query_get_query_normalization_nested_logical_operators_20: (a: number) => void;
|
|
937
882
|
readonly __wbgt_test_query_get_query_normalization_only_logical_operator_21: (a: number) => void;
|
|
938
|
-
readonly
|
|
939
|
-
readonly
|
|
883
|
+
readonly __wbgt_test_query_get_query_normalization_simple_attributes_18: (a: number) => void;
|
|
884
|
+
readonly __wbgt_test_query_get_query_normalization_with_logical_operator_19: (a: number) => void;
|
|
940
885
|
readonly __wbgt_test_query_parse_age_query_24: (a: number) => void;
|
|
941
|
-
readonly __wbgt_test_query_parse_non_object_query_25: (a: number) => void;
|
|
942
|
-
readonly __wbgt_test_query_parse_multiple_operators_26: (a: number) => void;
|
|
943
|
-
readonly __wbgt_test_query_parse_invalid_in_operator_27: (a: number) => void;
|
|
944
886
|
readonly __wbgt_test_query_parse_empty_logical_operators_28: (a: number) => void;
|
|
945
|
-
readonly
|
|
946
|
-
readonly __wbgt_test_query_parse_nin_operator_wrong_type_30: (a: number) => void;
|
|
887
|
+
readonly __wbgt_test_query_parse_empty_query_23: (a: number) => void;
|
|
947
888
|
readonly __wbgt_test_query_parse_eq_operator_31: (a: number) => void;
|
|
948
889
|
readonly __wbgt_test_query_parse_eq_operator_wrong_type_32: (a: number) => void;
|
|
890
|
+
readonly __wbgt_test_query_parse_in_operator_16: (a: number) => void;
|
|
891
|
+
readonly __wbgt_test_query_parse_in_operator_wrong_type_17: (a: number) => void;
|
|
892
|
+
readonly __wbgt_test_query_parse_invalid_in_operator_27: (a: number) => void;
|
|
893
|
+
readonly __wbgt_test_query_parse_multiple_operators_26: (a: number) => void;
|
|
949
894
|
readonly __wbgt_test_query_parse_ne_operator_33: (a: number) => void;
|
|
950
895
|
readonly __wbgt_test_query_parse_ne_operator_wrong_type_34: (a: number) => void;
|
|
951
|
-
readonly
|
|
952
|
-
readonly
|
|
953
|
-
readonly
|
|
954
|
-
readonly
|
|
955
|
-
readonly
|
|
956
|
-
readonly
|
|
957
|
-
readonly
|
|
958
|
-
readonly
|
|
959
|
-
readonly
|
|
960
|
-
readonly
|
|
896
|
+
readonly __wbgt_test_query_parse_nin_operator_29: (a: number) => void;
|
|
897
|
+
readonly __wbgt_test_query_parse_nin_operator_wrong_type_30: (a: number) => void;
|
|
898
|
+
readonly __wbgt_test_query_parse_non_object_query_25: (a: number) => void;
|
|
899
|
+
readonly __wbgt_test_query_parse_operator_wrong_type_15: (a: number) => void;
|
|
900
|
+
readonly query_get: (a: number, b: number, c: number, d: number) => void;
|
|
901
|
+
readonly query_get_properties: (a: number, b: number) => void;
|
|
902
|
+
readonly query_has_or_operator: (a: number) => number;
|
|
903
|
+
readonly query_new: (a: number, b: number, c: number) => void;
|
|
904
|
+
readonly query_parse: (a: number, b: number) => void;
|
|
905
|
+
readonly query_process_query: (a: number, b: number, c: number) => void;
|
|
906
|
+
readonly query_query: (a: number, b: number) => void;
|
|
907
|
+
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
908
|
+
readonly __wbg_schema_free: (a: number) => void;
|
|
909
|
+
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
910
|
+
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
911
|
+
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
912
|
+
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
913
|
+
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
914
|
+
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
915
|
+
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
916
|
+
readonly queryoptions_offset: (a: number, b: number) => void;
|
|
917
|
+
readonly schema_create: (a: number, b: number) => void;
|
|
918
|
+
readonly schema_encrypted: (a: number, b: number) => void;
|
|
919
|
+
readonly schema_indexes: (a: number, b: number) => void;
|
|
920
|
+
readonly schema_is_valid: (a: number, b: number) => void;
|
|
921
|
+
readonly schema_primaryKey: (a: number, b: number) => void;
|
|
922
|
+
readonly schema_properties: (a: number, b: number) => void;
|
|
923
|
+
readonly schema_type: (a: number, b: number) => void;
|
|
924
|
+
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
925
|
+
readonly schema_version: (a: number) => number;
|
|
926
|
+
readonly corestorage_new: () => number;
|
|
927
|
+
readonly __wbg_corestorage_free: (a: number) => void;
|
|
961
928
|
readonly __wbg_basestorage_free: (a: number) => void;
|
|
962
|
-
readonly
|
|
929
|
+
readonly __wbg_database_free: (a: number) => void;
|
|
963
930
|
readonly basestorage_addIndexSchemas: (a: number, b: number) => void;
|
|
931
|
+
readonly basestorage_core: (a: number, b: number) => void;
|
|
964
932
|
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
965
933
|
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
966
|
-
readonly
|
|
967
|
-
readonly __wbg_database_free: (a: number) => void;
|
|
968
|
-
readonly database_start: (a: number) => number;
|
|
969
|
-
readonly database_close: (a: number) => number;
|
|
970
|
-
readonly database_started: (a: number) => number;
|
|
934
|
+
readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
971
935
|
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
936
|
+
readonly database_close: (a: number) => number;
|
|
972
937
|
readonly database_collections: (a: number, b: number) => void;
|
|
973
938
|
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
974
|
-
readonly
|
|
975
|
-
readonly
|
|
976
|
-
readonly
|
|
939
|
+
readonly database_start: (a: number) => number;
|
|
940
|
+
readonly database_started: (a: number) => number;
|
|
941
|
+
readonly is_debug_mode: () => number;
|
|
942
|
+
readonly main_js: () => void;
|
|
943
|
+
readonly __wbg_property_free: (a: number) => void;
|
|
944
|
+
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
945
|
+
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
946
|
+
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
947
|
+
readonly property_is_valid: (a: number, b: number) => void;
|
|
948
|
+
readonly property_items: (a: number, b: number) => void;
|
|
949
|
+
readonly property_maxItems: (a: number, b: number) => void;
|
|
950
|
+
readonly property_maxLength: (a: number, b: number) => void;
|
|
951
|
+
readonly property_minItems: (a: number, b: number) => void;
|
|
952
|
+
readonly property_minLength: (a: number, b: number) => void;
|
|
953
|
+
readonly property_properties: (a: number, b: number) => void;
|
|
954
|
+
readonly property_type: (a: number) => number;
|
|
977
955
|
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
978
|
-
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
979
|
-
readonly baseplugin_name: (a: number) => number;
|
|
980
956
|
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
981
957
|
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
958
|
+
readonly baseplugin_name: (a: number) => number;
|
|
959
|
+
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
982
960
|
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
983
961
|
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
962
|
+
readonly __wbg_collection_free: (a: number) => void;
|
|
963
|
+
readonly __wbg_inmemory_free: (a: number) => void;
|
|
964
|
+
readonly __wbg_operation_free: (a: number) => void;
|
|
984
965
|
readonly __wbg_ridberror_free: (a: number) => void;
|
|
985
|
-
readonly
|
|
986
|
-
readonly
|
|
966
|
+
readonly collection_count: (a: number, b: number, c: number) => number;
|
|
967
|
+
readonly collection_create: (a: number, b: number) => number;
|
|
968
|
+
readonly collection_delete: (a: number, b: number) => number;
|
|
969
|
+
readonly collection_find: (a: number, b: number, c: number) => number;
|
|
970
|
+
readonly collection_findById: (a: number, b: number) => number;
|
|
971
|
+
readonly collection_name: (a: number, b: number) => void;
|
|
972
|
+
readonly collection_parse_query_options: (a: number, b: number, c: number) => void;
|
|
973
|
+
readonly collection_schema: (a: number, b: number) => void;
|
|
974
|
+
readonly collection_update: (a: number, b: number) => number;
|
|
975
|
+
readonly inmemory_close: (a: number) => number;
|
|
976
|
+
readonly inmemory_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
977
|
+
readonly inmemory_create: (a: number, b: number, c: number) => number;
|
|
978
|
+
readonly inmemory_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
979
|
+
readonly inmemory_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
980
|
+
readonly inmemory_start: (a: number) => number;
|
|
981
|
+
readonly inmemory_write: (a: number, b: number) => number;
|
|
982
|
+
readonly operation_collection: (a: number, b: number) => void;
|
|
983
|
+
readonly operation_data: (a: number) => number;
|
|
984
|
+
readonly operation_opType: (a: number) => number;
|
|
985
|
+
readonly operation_primaryKey: (a: number) => number;
|
|
986
|
+
readonly operation_primaryKeyField: (a: number) => number;
|
|
987
|
+
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
988
|
+
readonly ridberror_authentication: (a: number, b: number, c: number) => number;
|
|
987
989
|
readonly ridberror_code: (a: number) => number;
|
|
988
|
-
readonly ridberror_message: (a: number, b: number) => void;
|
|
989
|
-
readonly ridberror_from: (a: number) => number;
|
|
990
990
|
readonly ridberror_error: (a: number, b: number, c: number) => number;
|
|
991
|
+
readonly ridberror_from: (a: number) => number;
|
|
992
|
+
readonly ridberror_hook: (a: number, b: number, c: number) => number;
|
|
993
|
+
readonly ridberror_message: (a: number, b: number) => void;
|
|
994
|
+
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
991
995
|
readonly ridberror_query: (a: number, b: number, c: number) => number;
|
|
992
|
-
readonly ridberror_authentication: (a: number, b: number, c: number) => number;
|
|
993
996
|
readonly ridberror_serialisation: (a: number, b: number, c: number) => number;
|
|
997
|
+
readonly ridberror_type: (a: number, b: number) => void;
|
|
994
998
|
readonly ridberror_validation: (a: number, b: number, c: number) => number;
|
|
995
|
-
readonly
|
|
996
|
-
readonly
|
|
997
|
-
readonly
|
|
998
|
-
readonly
|
|
999
|
-
readonly
|
|
1000
|
-
readonly
|
|
1001
|
-
readonly
|
|
1002
|
-
readonly
|
|
1003
|
-
readonly
|
|
1004
|
-
readonly
|
|
1005
|
-
readonly
|
|
1006
|
-
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
1007
|
-
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
1008
|
-
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
999
|
+
readonly __wbg_indexdb_free: (a: number) => void;
|
|
1000
|
+
readonly indexdb_close: (a: number) => number;
|
|
1001
|
+
readonly indexdb_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
1002
|
+
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
1003
|
+
readonly indexdb_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
1004
|
+
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
1005
|
+
readonly indexdb_get_store: (a: number, b: number, c: number, d: number) => void;
|
|
1006
|
+
readonly indexdb_get_store_readonly: (a: number, b: number, c: number, d: number) => void;
|
|
1007
|
+
readonly indexdb_get_stores: (a: number, b: number) => void;
|
|
1008
|
+
readonly indexdb_start: (a: number) => number;
|
|
1009
|
+
readonly indexdb_write: (a: number, b: number) => number;
|
|
1009
1010
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
1010
|
-
readonly wasmbindgentestcontext_new: () => number;
|
|
1011
|
-
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
|
1012
|
-
readonly wasmbindgentestcontext_run: (a: number, b: number, c: number) => number;
|
|
1013
|
-
readonly __wbgtest_console_log: (a: number) => void;
|
|
1014
1011
|
readonly __wbgtest_console_debug: (a: number) => void;
|
|
1012
|
+
readonly __wbgtest_console_error: (a: number) => void;
|
|
1015
1013
|
readonly __wbgtest_console_info: (a: number) => void;
|
|
1014
|
+
readonly __wbgtest_console_log: (a: number) => void;
|
|
1016
1015
|
readonly __wbgtest_console_warn: (a: number) => void;
|
|
1017
|
-
readonly
|
|
1016
|
+
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
|
1017
|
+
readonly wasmbindgentestcontext_new: () => number;
|
|
1018
|
+
readonly wasmbindgentestcontext_run: (a: number, b: number, c: number) => number;
|
|
1018
1019
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
1019
1020
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
1020
1021
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
1021
|
-
readonly
|
|
1022
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7bc4bff3dafa2ad: (a: number, b: number, c: number) => void;
|
|
1022
1023
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
1023
|
-
readonly
|
|
1024
|
-
readonly
|
|
1024
|
+
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h804a1f09b692c771: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1025
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd4647cb021495324: (a: number, b: number, c: number) => void;
|
|
1025
1026
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
1026
1027
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
1027
|
-
readonly
|
|
1028
|
-
readonly
|
|
1029
|
-
readonly
|
|
1028
|
+
readonly wasm_bindgen__convert__closures__invoke0_mut__hc6452fdbb8c4addc: (a: number, b: number) => void;
|
|
1029
|
+
readonly wasm_bindgen__convert__closures__invoke3_mut__h2f203dbfa61ca113: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1030
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h42aa995f02b6fdcb: (a: number, b: number, c: number, d: number) => void;
|
|
1030
1031
|
readonly __wbindgen_start: () => void;
|
|
1031
1032
|
}
|
|
1032
1033
|
|