@trust0/ridb-core 1.7.41 → 1.7.42
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 +545 -412
- package/build/ridb_core.js +243 -219
- package/build/ridb_core.mjs +243 -219
- package/build/ridb_core_bg.mjs +1 -1
- package/package.json +1 -1
package/build/ridb_core.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* @returns {boolean}
|
|
5
|
-
*/
|
|
6
|
-
declare function is_debug_mode(): boolean;
|
|
7
|
-
/**
|
|
8
4
|
*/
|
|
9
5
|
declare function main_js(): void;
|
|
10
6
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param {Array<any>} args
|
|
7
|
+
* @returns {boolean}
|
|
13
8
|
*/
|
|
14
|
-
declare function
|
|
9
|
+
declare function is_debug_mode(): boolean;
|
|
15
10
|
/**
|
|
16
|
-
* Handler for `console.
|
|
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
17
|
* @param {Array<any>} args
|
|
18
18
|
*/
|
|
19
|
-
declare function
|
|
19
|
+
declare function __wbgtest_console_log(args: Array<any>): void;
|
|
20
20
|
/**
|
|
21
21
|
* Handler for `console.debug` invocations. See above.
|
|
22
22
|
* @param {Array<any>} args
|
|
23
23
|
*/
|
|
24
24
|
declare function __wbgtest_console_debug(args: Array<any>): void;
|
|
25
25
|
/**
|
|
26
|
-
* Handler for `console.
|
|
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`.
|
|
26
|
+
* Handler for `console.info` invocations. See above.
|
|
32
27
|
* @param {Array<any>} args
|
|
33
28
|
*/
|
|
34
|
-
declare function
|
|
29
|
+
declare function __wbgtest_console_info(args: Array<any>): void;
|
|
35
30
|
/**
|
|
36
31
|
* Handler for `console.error` invocations. See above.
|
|
37
32
|
* @param {Array<any>} args
|
|
38
33
|
*/
|
|
39
34
|
declare function __wbgtest_console_error(args: Array<any>): void;
|
|
40
35
|
/**
|
|
36
|
+
* Handler for `console.warn` invocations. See above.
|
|
37
|
+
* @param {Array<any>} args
|
|
38
|
+
*/
|
|
39
|
+
declare function __wbgtest_console_warn(args: Array<any>): void;
|
|
40
|
+
/**
|
|
41
41
|
* Represents the type of operation to be performed on the collection.
|
|
42
42
|
*/
|
|
43
43
|
declare enum OpType {
|
|
@@ -138,123 +138,257 @@ declare const SchemaFieldType = {
|
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
declare class CoreStorage {
|
|
142
|
+
/**
|
|
143
|
+
* @param {any} document
|
|
144
|
+
* @param {Query} query
|
|
145
|
+
* @returns {boolean}
|
|
146
|
+
*/
|
|
147
|
+
matchesQuery(document: any, query: Query<any>): boolean;
|
|
148
|
+
getPrimaryKeyTyped(value: any): string | number;
|
|
149
|
+
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
141
154
|
/**
|
|
142
|
-
* Represents
|
|
155
|
+
* Represents an IndexDB storage system extending the base storage functionality.
|
|
156
|
+
*
|
|
157
|
+
* @template T - The schema type.
|
|
143
158
|
*/
|
|
144
|
-
|
|
159
|
+
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
145
160
|
/**
|
|
146
|
-
*
|
|
161
|
+
* Frees the resources used by the in-memory storage.
|
|
147
162
|
*/
|
|
148
|
-
|
|
163
|
+
free(): void;
|
|
164
|
+
|
|
165
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
166
|
+
dbName: string,
|
|
167
|
+
schemas: SchemasCreate,
|
|
168
|
+
): Promise<
|
|
169
|
+
IndexDB<
|
|
170
|
+
SchemasCreate
|
|
171
|
+
>
|
|
172
|
+
>;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
type EnumerateUpTo<
|
|
178
|
+
N extends number,
|
|
179
|
+
Acc extends number[] = []
|
|
180
|
+
> = Acc['length'] extends N ?
|
|
181
|
+
Acc[number]:
|
|
182
|
+
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
183
|
+
|
|
184
|
+
type EnumerateFrom1To<
|
|
185
|
+
N extends number
|
|
186
|
+
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
187
|
+
|
|
188
|
+
type IsVersionGreaterThan0<
|
|
189
|
+
V extends number
|
|
190
|
+
> = V extends 0 ? false : true;
|
|
191
|
+
|
|
192
|
+
type AnyVersionGreaterThan1<
|
|
193
|
+
T extends Record<string, SchemaType>
|
|
194
|
+
> = true extends {
|
|
195
|
+
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
196
|
+
} [keyof T] ? true : false;
|
|
197
|
+
|
|
198
|
+
type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
149
199
|
|
|
200
|
+
type MigrationPathsForSchema<
|
|
201
|
+
T extends SchemaType
|
|
202
|
+
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
203
|
+
{
|
|
204
|
+
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
type MigrationPathsForSchemas<
|
|
208
|
+
T extends SchemaTypeRecord
|
|
209
|
+
> = {
|
|
210
|
+
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
type MigrationsParameter<
|
|
214
|
+
T extends SchemaTypeRecord
|
|
215
|
+
> = AnyVersionGreaterThan1<T> extends true ?
|
|
216
|
+
{
|
|
217
|
+
migrations: MigrationPathsForSchemas<T>
|
|
218
|
+
}:
|
|
219
|
+
{
|
|
220
|
+
migrations?: never
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Represents an operation to be performed on a collection.
|
|
227
|
+
*
|
|
228
|
+
* @template T - The schema type of the collection.
|
|
229
|
+
*/
|
|
230
|
+
type Operation<T extends SchemaType = SchemaType> = {
|
|
150
231
|
/**
|
|
151
|
-
* The
|
|
232
|
+
* The name of the collection on which the operation will be performed.
|
|
152
233
|
*/
|
|
153
|
-
|
|
234
|
+
collection: string,
|
|
154
235
|
|
|
155
236
|
/**
|
|
156
|
-
* The type of
|
|
237
|
+
* The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
|
|
157
238
|
*/
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
encrypted?: string[];
|
|
239
|
+
opType: OpType,
|
|
240
|
+
|
|
161
241
|
/**
|
|
162
|
-
* The
|
|
242
|
+
* The data involved in the operation, conforming to the schema type.
|
|
163
243
|
*/
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
244
|
+
data: Doc<T>,
|
|
245
|
+
|
|
246
|
+
primaryKeyField?: string,
|
|
247
|
+
primaryKey?: string
|
|
248
|
+
}
|
|
249
|
+
|
|
168
250
|
|
|
169
251
|
|
|
170
252
|
/**
|
|
171
|
-
* Represents
|
|
172
|
-
*
|
|
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
|
-
*
|
|
253
|
+
* Represents an in-memory storage system extending the base storage functionality.
|
|
254
|
+
*
|
|
184
255
|
* @template T - The schema type.
|
|
185
256
|
*/
|
|
186
|
-
declare class
|
|
257
|
+
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
187
258
|
/**
|
|
188
|
-
*
|
|
259
|
+
* Frees the resources used by the in-memory storage.
|
|
189
260
|
*/
|
|
190
|
-
|
|
261
|
+
free(): void;
|
|
191
262
|
|
|
263
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
264
|
+
dbName: string,
|
|
265
|
+
schemas: SchemasCreate,
|
|
266
|
+
): Promise<
|
|
267
|
+
InMemory<
|
|
268
|
+
SchemasCreate
|
|
269
|
+
>
|
|
270
|
+
>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Represents a property within a schema, including various constraints and nested properties.
|
|
277
|
+
*/
|
|
278
|
+
declare class Property {
|
|
192
279
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* @template TS - The schema type.
|
|
196
|
-
* @param {TS} defi, Debugnition - The schema definition.
|
|
197
|
-
* @returns {Schema<TS>} The created `Schema` instance.
|
|
280
|
+
* The type of the property.
|
|
198
281
|
*/
|
|
199
|
-
|
|
282
|
+
readonly type: SchemaFieldType;
|
|
200
283
|
|
|
201
284
|
/**
|
|
202
|
-
* The version of the
|
|
285
|
+
* The version of the property, if applicable.
|
|
203
286
|
*/
|
|
204
|
-
readonly version
|
|
287
|
+
readonly version?: number;
|
|
205
288
|
|
|
206
289
|
/**
|
|
207
|
-
* The primary key of the
|
|
290
|
+
* The primary key of the property, if applicable.
|
|
208
291
|
*/
|
|
209
|
-
readonly primaryKey
|
|
292
|
+
readonly primaryKey?: string;
|
|
210
293
|
|
|
211
294
|
/**
|
|
212
|
-
*
|
|
295
|
+
* An optional array of nested properties for array-type properties.
|
|
213
296
|
*/
|
|
214
|
-
readonly
|
|
297
|
+
readonly items?: Property;
|
|
215
298
|
|
|
216
299
|
/**
|
|
217
|
-
*
|
|
300
|
+
* The maximum number of items for array-type properties, if applicable.
|
|
218
301
|
*/
|
|
302
|
+
readonly maxItems?: number;
|
|
303
|
+
|
|
219
304
|
/**
|
|
220
|
-
*
|
|
305
|
+
* The minimum number of items for array-type properties, if applicable.
|
|
221
306
|
*/
|
|
222
|
-
readonly
|
|
307
|
+
readonly minItems?: number;
|
|
223
308
|
|
|
224
309
|
/**
|
|
225
|
-
*
|
|
310
|
+
* The maximum length for string-type properties, if applicable.
|
|
226
311
|
*/
|
|
227
|
-
readonly
|
|
312
|
+
readonly maxLength?: number;
|
|
228
313
|
|
|
229
314
|
/**
|
|
230
|
-
* The
|
|
315
|
+
* The minimum length for string-type properties, if applicable.
|
|
231
316
|
*/
|
|
232
|
-
readonly
|
|
233
|
-
|
|
234
|
-
} & {
|
|
235
|
-
[K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
|
|
236
|
-
};
|
|
317
|
+
readonly minLength?: number;
|
|
318
|
+
|
|
237
319
|
/**
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
320
|
+
* Controls requiredness. Two forms are supported and interoperate:
|
|
321
|
+
* - `boolean`: a per-property flag (legacy). `false` forces the property optional,
|
|
322
|
+
* `true` forces it required, overriding any container-level `required` array.
|
|
323
|
+
* - `string[]`: for object-type properties, the JSON Schema list of required
|
|
324
|
+
* nested properties.
|
|
241
325
|
*/
|
|
242
|
-
|
|
326
|
+
readonly required?: boolean | string[];
|
|
243
327
|
|
|
244
|
-
|
|
328
|
+
/**
|
|
329
|
+
* An optional default value for the property.
|
|
330
|
+
*/
|
|
331
|
+
readonly default?: any;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* An optional map of nested properties for object-type properties.
|
|
335
|
+
*/
|
|
336
|
+
readonly properties?: {
|
|
337
|
+
[name: string]: Property;
|
|
338
|
+
};
|
|
245
339
|
}
|
|
246
340
|
|
|
247
341
|
|
|
248
342
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
343
|
+
/**
|
|
344
|
+
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
345
|
+
* @internal
|
|
346
|
+
*/
|
|
347
|
+
type SchemaTypeRecord = {
|
|
348
|
+
[name: string]: SchemaType
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
declare abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
352
|
+
constructor(
|
|
353
|
+
name: string,
|
|
354
|
+
schemas: Schemas
|
|
355
|
+
);
|
|
356
|
+
abstract start(): Promise<void>;
|
|
357
|
+
abstract close(): Promise<void>;
|
|
358
|
+
abstract count(
|
|
359
|
+
colectionName: keyof Schemas,
|
|
360
|
+
query: QueryType<Schemas[keyof Schemas]>,
|
|
361
|
+
options?: QueryOptions
|
|
362
|
+
): Promise<number>;
|
|
363
|
+
abstract findDocumentById(
|
|
364
|
+
collectionName: keyof Schemas,
|
|
365
|
+
id: string
|
|
366
|
+
): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
367
|
+
abstract find(
|
|
368
|
+
collectionName: keyof Schemas,
|
|
369
|
+
query: QueryType<Schemas[keyof Schemas]>,
|
|
370
|
+
options?: QueryOptions
|
|
371
|
+
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
372
|
+
abstract write(
|
|
373
|
+
op: Operation<Schemas[keyof Schemas]>
|
|
374
|
+
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
type Hook = (
|
|
379
|
+
schema: Schema<SchemaType>,
|
|
380
|
+
migration: MigrationPathsForSchema<SchemaType>,
|
|
381
|
+
doc: Doc<SchemaType>
|
|
382
|
+
) => Doc<SchemaType>
|
|
383
|
+
|
|
384
|
+
type BasePluginOptions = {
|
|
385
|
+
docCreateHook?: Hook,
|
|
386
|
+
docRecoverHook?: Hook
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
declare class BasePlugin implements BasePluginOptions {
|
|
390
|
+
docCreateHook?:Hook;
|
|
391
|
+
docRecoverHook?:Hook;
|
|
258
392
|
}
|
|
259
393
|
|
|
260
394
|
|
|
@@ -400,136 +534,6 @@ type RIDBModule = {
|
|
|
400
534
|
|
|
401
535
|
|
|
402
536
|
|
|
403
|
-
/**
|
|
404
|
-
* Represents a property within a schema, including various constraints and nested properties.
|
|
405
|
-
*/
|
|
406
|
-
declare class Property {
|
|
407
|
-
/**
|
|
408
|
-
* The type of the property.
|
|
409
|
-
*/
|
|
410
|
-
readonly type: SchemaFieldType;
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* The version of the property, if applicable.
|
|
414
|
-
*/
|
|
415
|
-
readonly version?: number;
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* The primary key of the property, if applicable.
|
|
419
|
-
*/
|
|
420
|
-
readonly primaryKey?: string;
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* An optional array of nested properties for array-type properties.
|
|
424
|
-
*/
|
|
425
|
-
readonly items?: Property;
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* The maximum number of items for array-type properties, if applicable.
|
|
429
|
-
*/
|
|
430
|
-
readonly maxItems?: number;
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* The minimum number of items for array-type properties, if applicable.
|
|
434
|
-
*/
|
|
435
|
-
readonly minItems?: number;
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* The maximum length for string-type properties, if applicable.
|
|
439
|
-
*/
|
|
440
|
-
readonly maxLength?: number;
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* The minimum length for string-type properties, if applicable.
|
|
444
|
-
*/
|
|
445
|
-
readonly minLength?: number;
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* An optional array of required fields for object-type properties.
|
|
449
|
-
*/
|
|
450
|
-
readonly required?: boolean;
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* An optional default value for the property.
|
|
454
|
-
*/
|
|
455
|
-
readonly default?: any;
|
|
456
|
-
|
|
457
|
-
/**
|
|
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
537
|
type InternalsRecord = {
|
|
534
538
|
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
535
539
|
};
|
|
@@ -545,31 +549,134 @@ type InternalsRecord = {
|
|
|
545
549
|
* type ObjectType = ExtractType<'object'>; // ObjectType is object
|
|
546
550
|
* type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
|
|
547
551
|
*/
|
|
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[] :
|
|
552
|
+
type ExtractType<T extends string> =
|
|
553
|
+
T extends "string" ? string :
|
|
554
|
+
T extends "number" ? number :
|
|
555
|
+
T extends "boolean" ? boolean :
|
|
556
|
+
T extends "object" ? object :
|
|
557
|
+
T extends "array" ? any[] :
|
|
554
558
|
undefined;
|
|
555
559
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
560
|
+
/**
|
|
561
|
+
* ExtractProperty maps a full Property definition to its document type. Unlike
|
|
562
|
+
* {@link ExtractType} (which only looks at the `type` string), it recurses into
|
|
563
|
+
* `items` for arrays and `properties` for objects, producing precise nested types.
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* type Tags = ExtractProperty<{ type: "array"; items: { type: "string" } }>; // string[]
|
|
567
|
+
* type Obj = ExtractProperty<{ type: "object"; properties: { id: { type: "string" } } }>; // { id: string }
|
|
568
|
+
*/
|
|
569
|
+
type ExtractProperty<P> =
|
|
570
|
+
P extends { type: "string" } ? string :
|
|
571
|
+
P extends { type: "number" } ? number :
|
|
572
|
+
P extends { type: "boolean" } ? boolean :
|
|
573
|
+
P extends { type: "array" } ? (P extends { items: infer I } ? ExtractProperty<I>[] : any[]) :
|
|
574
|
+
P extends { type: "object" } ? (P extends { properties: infer PR } ? ExtractObject<PR, NestedRequiredNames<P>> : object) :
|
|
575
|
+
unknown;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* NestedRequiredNames extracts the union of nested property names listed in an object
|
|
579
|
+
* property's `required` array (JSON Schema semantics), or `never` when no array is
|
|
580
|
+
* present. Note it only matches the array form; a boolean `required` flag yields `never`.
|
|
581
|
+
*/
|
|
582
|
+
type NestedRequiredNames<P> =
|
|
583
|
+
P extends { required: infer R }
|
|
584
|
+
? (R extends readonly string[] ? R[number] : never)
|
|
585
|
+
: never;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* FlagRequiredness interprets a property's `required` declaration when it is used as a
|
|
589
|
+
* legacy boolean flag. Because `Property.required` is typed `boolean | string[]`, a
|
|
590
|
+
* schema literal written without `as const` widens `true`/`false` to `boolean`; the
|
|
591
|
+
* tuple-wrapped checks below classify each case:
|
|
592
|
+
* - a literal `false` -> `"optional"`;
|
|
593
|
+
* - a literal `true`, or a widened `boolean` (whose literal was lost) -> `"required"`.
|
|
594
|
+
* Treating the ambiguous `boolean` as required matches the Rust validator and turns a
|
|
595
|
+
* would-be runtime "missing required property" error into a compile-time one instead;
|
|
596
|
+
* - the array form, or no `required` key -> `"defer"` to the container `required` array.
|
|
597
|
+
*/
|
|
598
|
+
type FlagRequiredness<P> =
|
|
599
|
+
P extends { required: infer F }
|
|
600
|
+
? ([F] extends [readonly string[]] ? "defer"
|
|
601
|
+
: [F] extends [false] ? "optional"
|
|
602
|
+
: [true] extends [F] ? "required"
|
|
603
|
+
: "defer")
|
|
604
|
+
: "defer";
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* IsNestedOptional decides whether a nested property `K` (within an object property's
|
|
608
|
+
* `properties` map `PR`, given that object's required-name union `R`) may be omitted.
|
|
609
|
+
* Precedence mirrors the runtime validator and {@link IsCreateOptional}:
|
|
610
|
+
* 1. a declared `default` makes the field optional;
|
|
611
|
+
* 2. a boolean `required` flag wins (`false` -> optional, `true`/`boolean` -> required);
|
|
612
|
+
* 3. otherwise it is required iff listed in the object's `required` array;
|
|
613
|
+
* 4. otherwise it is optional.
|
|
614
|
+
*/
|
|
615
|
+
type IsNestedOptional<PR, K extends keyof PR, R> =
|
|
616
|
+
PR[K] extends { default: unknown } ? true
|
|
617
|
+
: FlagRequiredness<PR[K]> extends "optional" ? true
|
|
618
|
+
: FlagRequiredness<PR[K]> extends "required" ? false
|
|
619
|
+
: K extends R ? false
|
|
620
|
+
: true;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* ExtractObject builds an object document type from a `properties` map `PR` and the
|
|
624
|
+
* owning object's required-name union `R`, applying the correct optional/required
|
|
625
|
+
* modifier to each nested property (see {@link IsNestedOptional}). This keeps `Doc` and
|
|
626
|
+
* `CreateDoc` in step with the runtime validator, which only enforces nested keys named
|
|
627
|
+
* in that object's `required` array.
|
|
628
|
+
*/
|
|
629
|
+
type ExtractObject<PR, R> = {
|
|
630
|
+
[K in keyof PR as IsNestedOptional<PR, K, R> extends true ? never : K]:
|
|
631
|
+
ExtractProperty<PR[K]>
|
|
632
|
+
} & {
|
|
633
|
+
[K in keyof PR as IsNestedOptional<PR, K, R> extends true ? K : never]?:
|
|
634
|
+
ExtractProperty<PR[K]>
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* The union of property names marked required at the schema level (JSON Schema
|
|
639
|
+
* `required` array). Resolves to `never` when no `required` array is present.
|
|
640
|
+
*/
|
|
641
|
+
type RequiredFieldNames<T extends SchemaType> =
|
|
642
|
+
T extends { required: infer R }
|
|
643
|
+
? (R extends readonly string[] ? R[number] : never)
|
|
644
|
+
: never;
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* IsCreateOptional decides whether a property may be omitted when creating a document.
|
|
648
|
+
* Precedence (mirrors the runtime validator):
|
|
649
|
+
* 1. a declared `default` makes the field optional;
|
|
650
|
+
* 2. a boolean `required` flag wins (`false` -> optional, `true`/`boolean` -> required;
|
|
651
|
+
* see {@link FlagRequiredness});
|
|
652
|
+
* 3. otherwise it is required iff listed in the schema-level `required` array;
|
|
653
|
+
* 4. otherwise it is optional.
|
|
654
|
+
*/
|
|
655
|
+
type IsCreateOptional<T extends SchemaType, K extends keyof T["properties"]> =
|
|
656
|
+
T["properties"][K] extends { default: unknown } ? true
|
|
657
|
+
: FlagRequiredness<T["properties"][K]> extends "optional" ? true
|
|
658
|
+
: FlagRequiredness<T["properties"][K]> extends "required" ? false
|
|
659
|
+
: K extends RequiredFieldNames<T> ? false
|
|
561
660
|
: true;
|
|
562
661
|
|
|
563
662
|
/**
|
|
564
|
-
* Doc is a utility type that transforms a schema type into a document type
|
|
663
|
+
* Doc is a utility type that transforms a schema type into a stored-document type. A
|
|
664
|
+
* property is mandatory only when the validator guarantees its presence; properties that
|
|
665
|
+
* are optional at creation (not listed in `required`, flagged `required: false`, or
|
|
666
|
+
* carrying a `default`) may be absent on a stored document, so they are optional here
|
|
667
|
+
* too. This keeps `find`/`findById`/`create` return types from claiming keys that may not
|
|
668
|
+
* exist. Optionality uses the same {@link IsCreateOptional} rules as {@link CreateDoc}.
|
|
565
669
|
*
|
|
566
670
|
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
567
671
|
*
|
|
568
672
|
* type Document = Doc<Schema>; // Document is { name: string; age: number; }
|
|
569
673
|
*/
|
|
570
674
|
type Doc<T extends SchemaType> = {
|
|
571
|
-
[K in keyof T["properties"]]:
|
|
572
|
-
|
|
675
|
+
[K in keyof T["properties"] as IsCreateOptional<T, K> extends true ? never : K]:
|
|
676
|
+
ExtractProperty<T['properties'][K]>
|
|
677
|
+
} & {
|
|
678
|
+
[K in keyof T["properties"] as IsCreateOptional<T, K> extends true ? K : never]?:
|
|
679
|
+
ExtractProperty<T['properties'][K]>
|
|
573
680
|
} & {
|
|
574
681
|
__version?: number;
|
|
575
682
|
createdAt?: number;
|
|
@@ -578,16 +685,17 @@ type Doc<T extends SchemaType> = {
|
|
|
578
685
|
|
|
579
686
|
/**
|
|
580
687
|
* 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
|
|
688
|
+
* during the creation process. Fields with default values, or fields not listed in the schema-level
|
|
689
|
+
* `required` array, become optional.
|
|
582
690
|
*
|
|
583
691
|
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
584
692
|
*/
|
|
585
693
|
type CreateDoc<T extends SchemaType> = {
|
|
586
|
-
[K in keyof T["properties"] as
|
|
587
|
-
|
|
694
|
+
[K in keyof T["properties"] as IsCreateOptional<T, K> extends true ? K : never]?:
|
|
695
|
+
ExtractProperty<T['properties'][K]>
|
|
588
696
|
} & {
|
|
589
|
-
[K in keyof T["properties"] as
|
|
590
|
-
|
|
697
|
+
[K in keyof T["properties"] as IsCreateOptional<T, K> extends true ? never : K]:
|
|
698
|
+
ExtractProperty<T['properties'][K]>
|
|
591
699
|
} & {
|
|
592
700
|
__version?: number;
|
|
593
701
|
createdAt?: number;
|
|
@@ -650,109 +758,123 @@ declare class Collection<T extends SchemaType> {
|
|
|
650
758
|
|
|
651
759
|
|
|
652
760
|
/**
|
|
653
|
-
* Represents
|
|
654
|
-
*
|
|
655
|
-
* @template T - The schema type.
|
|
761
|
+
* Represents the type definition for a schema.
|
|
656
762
|
*/
|
|
657
|
-
|
|
763
|
+
type SchemaType = {
|
|
658
764
|
/**
|
|
659
|
-
*
|
|
765
|
+
* The version of the schema.
|
|
660
766
|
*/
|
|
661
|
-
|
|
767
|
+
version: number;
|
|
662
768
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
InMemory<
|
|
668
|
-
SchemasCreate
|
|
669
|
-
>
|
|
670
|
-
>;
|
|
671
|
-
}
|
|
769
|
+
/**
|
|
770
|
+
* The primary key of the schema.
|
|
771
|
+
*/
|
|
772
|
+
primaryKey: string;
|
|
672
773
|
|
|
774
|
+
/**
|
|
775
|
+
* The type of the schema.
|
|
776
|
+
*/
|
|
777
|
+
type: SchemaFieldType;
|
|
778
|
+
indexes?: string[];
|
|
779
|
+
encrypted?: string[];
|
|
780
|
+
/**
|
|
781
|
+
* The names of the required top-level properties. Follows JSON Schema
|
|
782
|
+
* semantics: only the listed properties are required.
|
|
783
|
+
*/
|
|
784
|
+
required?: string[];
|
|
785
|
+
/**
|
|
786
|
+
* The properties defined in the schema.
|
|
787
|
+
*/
|
|
788
|
+
properties: {
|
|
789
|
+
[name: string]: Property;
|
|
790
|
+
};
|
|
791
|
+
};
|
|
673
792
|
|
|
674
793
|
|
|
675
794
|
/**
|
|
676
|
-
* Represents
|
|
677
|
-
*
|
|
678
|
-
*
|
|
795
|
+
* Represents a schema, including its definition and related methods.
|
|
796
|
+
* You may be trying to build a storage, in any other can u won't need access tho this class.
|
|
797
|
+
* Check this example
|
|
798
|
+
*
|
|
799
|
+
* ```typescript
|
|
800
|
+
* class MyStorage extends <T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
801
|
+
* example() {
|
|
802
|
+
* const schema: Schema<any> = this.getSchema("mySchema")
|
|
803
|
+
* }
|
|
804
|
+
* }
|
|
805
|
+
* ```
|
|
806
|
+
* You alwayswill have access to getSchema through the Storage class.
|
|
807
|
+
*
|
|
808
|
+
* @template T - The schema type.
|
|
679
809
|
*/
|
|
680
|
-
|
|
810
|
+
declare class Schema<T extends SchemaType> {
|
|
681
811
|
/**
|
|
682
|
-
* The
|
|
812
|
+
* The schema definition.
|
|
683
813
|
*/
|
|
684
|
-
|
|
814
|
+
schema: Schema<T>;
|
|
685
815
|
|
|
686
816
|
/**
|
|
687
|
-
*
|
|
817
|
+
* Creates a new `Schema` instance from the provided definition.
|
|
818
|
+
*
|
|
819
|
+
* @template TS - The schema type.
|
|
820
|
+
* @param {TS} defi, Debugnition - The schema definition.
|
|
821
|
+
* @returns {Schema<TS>} The created `Schema` instance.
|
|
688
822
|
*/
|
|
689
|
-
|
|
823
|
+
static create<TS extends SchemaType>(definition: TS): Schema<TS>;
|
|
690
824
|
|
|
691
825
|
/**
|
|
692
|
-
* The
|
|
826
|
+
* The version of the schema.
|
|
693
827
|
*/
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
primaryKeyField?: string,
|
|
697
|
-
primaryKey?: string
|
|
698
|
-
}
|
|
828
|
+
readonly version: number;
|
|
699
829
|
|
|
830
|
+
/**
|
|
831
|
+
* The primary key of the schema.
|
|
832
|
+
*/
|
|
833
|
+
readonly primaryKey: string;
|
|
700
834
|
|
|
835
|
+
/**
|
|
836
|
+
* The type of the schema.
|
|
837
|
+
*/
|
|
838
|
+
readonly type: SchemaFieldType;
|
|
701
839
|
|
|
702
|
-
/**
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
840
|
+
/**
|
|
841
|
+
* An optional array of indexes.
|
|
842
|
+
*/
|
|
843
|
+
/**
|
|
844
|
+
* An optional array of indexes.
|
|
845
|
+
*/
|
|
846
|
+
readonly indexes?: (Extract<keyof T, string>)[];
|
|
709
847
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
-
}
|
|
848
|
+
/**
|
|
849
|
+
* An optional array of encrypted fields.
|
|
850
|
+
*/
|
|
851
|
+
readonly encrypted?: (Extract<keyof T, string>)[];
|
|
735
852
|
|
|
853
|
+
/**
|
|
854
|
+
* The properties defined in the schema.
|
|
855
|
+
*/
|
|
856
|
+
readonly properties: {
|
|
857
|
+
[K in keyof T['properties']]: T['properties'][K];
|
|
858
|
+
};
|
|
736
859
|
|
|
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> {
|
|
743
860
|
/**
|
|
744
|
-
*
|
|
861
|
+
* The names of the required top-level properties.
|
|
745
862
|
*/
|
|
746
|
-
|
|
863
|
+
readonly required?: (Extract<keyof T['properties'], string>)[];
|
|
864
|
+
/**
|
|
865
|
+
* Converts the schema to a JSON representation.
|
|
866
|
+
*
|
|
867
|
+
* @returns {SchemaType} The JSON representation of the schema.
|
|
868
|
+
*/
|
|
869
|
+
toJSON(): SchemaType;
|
|
747
870
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
>;
|
|
871
|
+
/**
|
|
872
|
+
* Validates a document against the schema. The runtime applies the same
|
|
873
|
+
* optional/required rules as creation (only `required` fields, without a `default`,
|
|
874
|
+
* must be present), so the accepted shape is `CreateDoc<T>` rather than a fully-keyed
|
|
875
|
+
* `Doc<T>`.
|
|
876
|
+
*/
|
|
877
|
+
validate(document: CreateDoc<T>): boolean;
|
|
756
878
|
}
|
|
757
879
|
|
|
758
880
|
|
|
@@ -868,35 +990,35 @@ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Modul
|
|
|
868
990
|
interface InitOutput {
|
|
869
991
|
readonly memory: WebAssembly.Memory;
|
|
870
992
|
readonly __wbg_query_free: (a: number) => void;
|
|
871
|
-
readonly
|
|
872
|
-
readonly
|
|
873
|
-
readonly
|
|
874
|
-
readonly
|
|
875
|
-
readonly
|
|
876
|
-
readonly
|
|
877
|
-
readonly
|
|
878
|
-
readonly
|
|
879
|
-
readonly
|
|
880
|
-
readonly
|
|
881
|
-
readonly
|
|
882
|
-
readonly
|
|
883
|
-
readonly
|
|
884
|
-
readonly
|
|
885
|
-
readonly
|
|
886
|
-
readonly
|
|
887
|
-
readonly
|
|
888
|
-
readonly
|
|
889
|
-
readonly
|
|
890
|
-
readonly
|
|
891
|
-
readonly
|
|
892
|
-
readonly
|
|
893
|
-
readonly
|
|
894
|
-
readonly
|
|
895
|
-
readonly
|
|
896
|
-
readonly
|
|
897
|
-
readonly
|
|
898
|
-
readonly
|
|
899
|
-
readonly
|
|
993
|
+
readonly __wbgt_test_get_properties_array_values_20: (a: number) => void;
|
|
994
|
+
readonly __wbgt_test_get_properties_deeply_nested_22: (a: number) => void;
|
|
995
|
+
readonly __wbgt_test_get_properties_empty_query_21: (a: number) => void;
|
|
996
|
+
readonly __wbgt_test_get_properties_nested_operators_19: (a: number) => void;
|
|
997
|
+
readonly __wbgt_test_get_properties_simple_fields_16: (a: number) => void;
|
|
998
|
+
readonly __wbgt_test_get_properties_with_array_at_top_level_24: (a: number) => void;
|
|
999
|
+
readonly __wbgt_test_get_properties_with_logical_operators_18: (a: number) => void;
|
|
1000
|
+
readonly __wbgt_test_get_properties_with_multiple_same_props_23: (a: number) => void;
|
|
1001
|
+
readonly __wbgt_test_get_properties_with_operators_17: (a: number) => void;
|
|
1002
|
+
readonly __wbgt_test_query_get_query_normalization_complex_mixed_32: (a: number) => void;
|
|
1003
|
+
readonly __wbgt_test_query_get_query_normalization_nested_logical_operators_30: (a: number) => void;
|
|
1004
|
+
readonly __wbgt_test_query_get_query_normalization_only_logical_operator_31: (a: number) => void;
|
|
1005
|
+
readonly __wbgt_test_query_get_query_normalization_simple_attributes_28: (a: number) => void;
|
|
1006
|
+
readonly __wbgt_test_query_get_query_normalization_with_logical_operator_29: (a: number) => void;
|
|
1007
|
+
readonly __wbgt_test_query_parse_age_query_34: (a: number) => void;
|
|
1008
|
+
readonly __wbgt_test_query_parse_empty_logical_operators_38: (a: number) => void;
|
|
1009
|
+
readonly __wbgt_test_query_parse_empty_query_33: (a: number) => void;
|
|
1010
|
+
readonly __wbgt_test_query_parse_eq_operator_41: (a: number) => void;
|
|
1011
|
+
readonly __wbgt_test_query_parse_eq_operator_wrong_type_42: (a: number) => void;
|
|
1012
|
+
readonly __wbgt_test_query_parse_in_operator_26: (a: number) => void;
|
|
1013
|
+
readonly __wbgt_test_query_parse_in_operator_wrong_type_27: (a: number) => void;
|
|
1014
|
+
readonly __wbgt_test_query_parse_invalid_in_operator_37: (a: number) => void;
|
|
1015
|
+
readonly __wbgt_test_query_parse_multiple_operators_36: (a: number) => void;
|
|
1016
|
+
readonly __wbgt_test_query_parse_ne_operator_43: (a: number) => void;
|
|
1017
|
+
readonly __wbgt_test_query_parse_ne_operator_wrong_type_44: (a: number) => void;
|
|
1018
|
+
readonly __wbgt_test_query_parse_nin_operator_39: (a: number) => void;
|
|
1019
|
+
readonly __wbgt_test_query_parse_nin_operator_wrong_type_40: (a: number) => void;
|
|
1020
|
+
readonly __wbgt_test_query_parse_non_object_query_35: (a: number) => void;
|
|
1021
|
+
readonly __wbgt_test_query_parse_operator_wrong_type_25: (a: number) => void;
|
|
900
1022
|
readonly query_get: (a: number, b: number, c: number, d: number) => void;
|
|
901
1023
|
readonly query_get_properties: (a: number, b: number) => void;
|
|
902
1024
|
readonly query_has_or_operator: (a: number) => number;
|
|
@@ -904,42 +1026,52 @@ interface InitOutput {
|
|
|
904
1026
|
readonly query_parse: (a: number, b: number) => void;
|
|
905
1027
|
readonly query_process_query: (a: number, b: number, c: number) => void;
|
|
906
1028
|
readonly query_query: (a: number, b: number) => void;
|
|
1029
|
+
readonly __wbg_indexdb_free: (a: number) => void;
|
|
907
1030
|
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
1031
|
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
913
1032
|
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
914
1033
|
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
1034
|
+
readonly indexdb_close: (a: number) => number;
|
|
1035
|
+
readonly indexdb_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
1036
|
+
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
1037
|
+
readonly indexdb_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
1038
|
+
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
1039
|
+
readonly indexdb_get_store: (a: number, b: number, c: number, d: number) => void;
|
|
1040
|
+
readonly indexdb_get_store_readonly: (a: number, b: number, c: number, d: number) => void;
|
|
1041
|
+
readonly indexdb_get_stores: (a: number, b: number) => void;
|
|
1042
|
+
readonly indexdb_start: (a: number) => number;
|
|
1043
|
+
readonly indexdb_write: (a: number, b: number) => number;
|
|
915
1044
|
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
916
1045
|
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
1046
|
readonly corestorage_new: () => number;
|
|
927
1047
|
readonly __wbg_corestorage_free: (a: number) => void;
|
|
928
|
-
readonly
|
|
929
|
-
readonly
|
|
930
|
-
readonly
|
|
931
|
-
readonly
|
|
932
|
-
readonly
|
|
933
|
-
readonly
|
|
934
|
-
readonly
|
|
935
|
-
readonly
|
|
936
|
-
readonly
|
|
937
|
-
readonly
|
|
938
|
-
readonly
|
|
939
|
-
readonly
|
|
940
|
-
readonly
|
|
941
|
-
readonly
|
|
942
|
-
readonly
|
|
1048
|
+
readonly __wbg_operation_free: (a: number) => void;
|
|
1049
|
+
readonly __wbg_ridberror_free: (a: number) => void;
|
|
1050
|
+
readonly operation_collection: (a: number, b: number) => void;
|
|
1051
|
+
readonly operation_data: (a: number) => number;
|
|
1052
|
+
readonly operation_opType: (a: number) => number;
|
|
1053
|
+
readonly operation_primaryKey: (a: number) => number;
|
|
1054
|
+
readonly operation_primaryKeyField: (a: number) => number;
|
|
1055
|
+
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
1056
|
+
readonly ridberror_authentication: (a: number, b: number, c: number) => number;
|
|
1057
|
+
readonly ridberror_code: (a: number) => number;
|
|
1058
|
+
readonly ridberror_error: (a: number, b: number, c: number) => number;
|
|
1059
|
+
readonly ridberror_from: (a: number) => number;
|
|
1060
|
+
readonly ridberror_hook: (a: number, b: number, c: number) => number;
|
|
1061
|
+
readonly ridberror_message: (a: number, b: number) => void;
|
|
1062
|
+
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
1063
|
+
readonly ridberror_query: (a: number, b: number, c: number) => number;
|
|
1064
|
+
readonly ridberror_serialisation: (a: number, b: number, c: number) => number;
|
|
1065
|
+
readonly ridberror_type: (a: number, b: number) => void;
|
|
1066
|
+
readonly ridberror_validation: (a: number, b: number, c: number) => number;
|
|
1067
|
+
readonly __wbg_inmemory_free: (a: number) => void;
|
|
1068
|
+
readonly inmemory_close: (a: number) => number;
|
|
1069
|
+
readonly inmemory_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
1070
|
+
readonly inmemory_create: (a: number, b: number, c: number) => number;
|
|
1071
|
+
readonly inmemory_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
1072
|
+
readonly inmemory_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
1073
|
+
readonly inmemory_start: (a: number) => number;
|
|
1074
|
+
readonly inmemory_write: (a: number, b: number) => number;
|
|
943
1075
|
readonly __wbg_property_free: (a: number) => void;
|
|
944
1076
|
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
945
1077
|
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
@@ -953,16 +1085,40 @@ interface InitOutput {
|
|
|
953
1085
|
readonly property_properties: (a: number, b: number) => void;
|
|
954
1086
|
readonly property_type: (a: number) => number;
|
|
955
1087
|
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
1088
|
+
readonly __wbg_basestorage_free: (a: number) => void;
|
|
1089
|
+
readonly __wbg_database_free: (a: number) => void;
|
|
956
1090
|
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
957
1091
|
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
958
1092
|
readonly baseplugin_name: (a: number) => number;
|
|
959
1093
|
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
960
1094
|
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
961
1095
|
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
1096
|
+
readonly basestorage_addIndexSchemas: (a: number, b: number) => void;
|
|
1097
|
+
readonly basestorage_core: (a: number, b: number) => void;
|
|
1098
|
+
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
1099
|
+
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
1100
|
+
readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1101
|
+
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
1102
|
+
readonly database_close: (a: number) => number;
|
|
1103
|
+
readonly database_collections: (a: number, b: number) => void;
|
|
1104
|
+
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
1105
|
+
readonly database_start: (a: number) => number;
|
|
1106
|
+
readonly database_started: (a: number) => number;
|
|
962
1107
|
readonly __wbg_collection_free: (a: number) => void;
|
|
963
|
-
readonly
|
|
964
|
-
readonly
|
|
965
|
-
readonly
|
|
1108
|
+
readonly __wbg_schema_free: (a: number) => void;
|
|
1109
|
+
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
1110
|
+
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
1111
|
+
readonly __wbgt_test_schema_required_subset_of_properties_6: (a: number) => void;
|
|
1112
|
+
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
1113
|
+
readonly __wbgt_test_validate_document_default_makes_required_optional_15: (a: number) => void;
|
|
1114
|
+
readonly __wbgt_test_validate_document_flag_overrides_array_12: (a: number) => void;
|
|
1115
|
+
readonly __wbgt_test_validate_document_legacy_required_false_11: (a: number) => void;
|
|
1116
|
+
readonly __wbgt_test_validate_document_nested_required_13: (a: number) => void;
|
|
1117
|
+
readonly __wbgt_test_validate_document_no_array_all_optional_9: (a: number) => void;
|
|
1118
|
+
readonly __wbgt_test_validate_document_null_is_type_checked_14: (a: number) => void;
|
|
1119
|
+
readonly __wbgt_test_validate_document_omitted_nested_required_equals_empty_10: (a: number) => void;
|
|
1120
|
+
readonly __wbgt_test_validate_document_required_missing_8: (a: number) => void;
|
|
1121
|
+
readonly __wbgt_test_validate_document_required_present_7: (a: number) => void;
|
|
966
1122
|
readonly collection_count: (a: number, b: number, c: number) => number;
|
|
967
1123
|
readonly collection_create: (a: number, b: number) => number;
|
|
968
1124
|
readonly collection_delete: (a: number, b: number) => number;
|
|
@@ -972,41 +1128,18 @@ interface InitOutput {
|
|
|
972
1128
|
readonly collection_parse_query_options: (a: number, b: number, c: number) => void;
|
|
973
1129
|
readonly collection_schema: (a: number, b: number) => void;
|
|
974
1130
|
readonly collection_update: (a: number, b: number) => number;
|
|
975
|
-
readonly
|
|
976
|
-
readonly
|
|
977
|
-
readonly
|
|
978
|
-
readonly
|
|
979
|
-
readonly
|
|
980
|
-
readonly
|
|
981
|
-
readonly
|
|
982
|
-
readonly
|
|
983
|
-
readonly
|
|
984
|
-
readonly
|
|
985
|
-
readonly
|
|
986
|
-
readonly
|
|
987
|
-
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
988
|
-
readonly ridberror_authentication: (a: number, b: number, c: number) => number;
|
|
989
|
-
readonly ridberror_code: (a: number) => number;
|
|
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;
|
|
995
|
-
readonly ridberror_query: (a: number, b: number, c: number) => number;
|
|
996
|
-
readonly ridberror_serialisation: (a: number, b: number, c: number) => number;
|
|
997
|
-
readonly ridberror_type: (a: number, b: number) => void;
|
|
998
|
-
readonly ridberror_validation: (a: number, b: number, c: number) => number;
|
|
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;
|
|
1131
|
+
readonly schema_create: (a: number, b: number) => void;
|
|
1132
|
+
readonly schema_encrypted: (a: number, b: number) => void;
|
|
1133
|
+
readonly schema_indexes: (a: number, b: number) => void;
|
|
1134
|
+
readonly schema_is_valid: (a: number, b: number) => void;
|
|
1135
|
+
readonly schema_primaryKey: (a: number, b: number) => void;
|
|
1136
|
+
readonly schema_properties: (a: number, b: number) => void;
|
|
1137
|
+
readonly schema_required: (a: number, b: number) => void;
|
|
1138
|
+
readonly schema_type: (a: number, b: number) => void;
|
|
1139
|
+
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
1140
|
+
readonly schema_version: (a: number) => number;
|
|
1141
|
+
readonly is_debug_mode: () => number;
|
|
1142
|
+
readonly main_js: () => void;
|
|
1010
1143
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
1011
1144
|
readonly __wbgtest_console_debug: (a: number) => void;
|
|
1012
1145
|
readonly __wbgtest_console_error: (a: number) => void;
|
|
@@ -1019,15 +1152,15 @@ interface InitOutput {
|
|
|
1019
1152
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
1020
1153
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
1021
1154
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
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;
|
|
1023
1155
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
1024
|
-
readonly
|
|
1025
|
-
readonly
|
|
1156
|
+
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf68407c2d58ea7a7: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1157
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h20b808fdb8c77f5d: (a: number, b: number, c: number) => void;
|
|
1158
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__haaaa8b1463560632: (a: number, b: number, c: number) => void;
|
|
1026
1159
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
1027
1160
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
1028
|
-
readonly
|
|
1029
|
-
readonly
|
|
1030
|
-
readonly
|
|
1161
|
+
readonly wasm_bindgen__convert__closures__invoke0_mut__h637bbedf1d05ab65: (a: number, b: number) => void;
|
|
1162
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h413cfbf41bd786a3: (a: number, b: number, c: number, d: number) => void;
|
|
1163
|
+
readonly wasm_bindgen__convert__closures__invoke3_mut__h4efafefcae80b4ef: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1031
1164
|
readonly __wbindgen_start: () => void;
|
|
1032
1165
|
}
|
|
1033
1166
|
|
|
@@ -1052,4 +1185,4 @@ declare function initSync(module: SyncInitInput): InitOutput;
|
|
|
1052
1185
|
*/
|
|
1053
1186
|
declare function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
1054
1187
|
|
|
1055
|
-
export { type AnyVersionGreaterThan1, BasePlugin, BaseStorage, type BaseStorageOptions, Collection, CoreStorage, type CreateDoc, type CreateStorage, Database, type Doc, type EnumerateFrom1To, type EnumerateUpTo, Errors, type ExtractType, InMemory, type InOperator, IndexDB, type InitInput, type InitOutput, type InternalsRecord, type
|
|
1188
|
+
export { type AnyVersionGreaterThan1, BasePlugin, BaseStorage, type BaseStorageOptions, Collection, CoreStorage, type CreateDoc, type CreateStorage, Database, type Doc, type EnumerateFrom1To, type EnumerateUpTo, Errors, type ExtractObject, type ExtractProperty, type ExtractType, type FlagRequiredness, InMemory, type InOperator, IndexDB, type InitInput, type InitOutput, type InternalsRecord, type IsCreateOptional, type IsNestedOptional, type IsVersionGreaterThan0, type LogicalOperators, type MigrationFunction, type MigrationPathsForSchema, type MigrationPathsForSchemas, type MigrationsParameter, type NInOperator, type NestedRequiredNames, OpType, type Operation, type OperatorOrType, type Operators, Property, Query, type QueryOptions, type QueryType, RIDBError, type RIDBModule, type RequiredFieldNames, Schema, SchemaFieldType, type SchemaType, type SchemaTypeRecord, StorageInternal, type SyncInitInput, WasmBindgenTestContext, __wbgtest_console_debug, __wbgtest_console_error, __wbgtest_console_info, __wbgtest_console_log, __wbgtest_console_warn, __wbg_init as default, initSync, is_debug_mode, main_js };
|