@trust0/ridb-core 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,860 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ */
5
+ export function main_js(): void;
6
+ /**
7
+ * @returns {boolean}
8
+ */
9
+ export function is_debug_mode(): boolean;
10
+ /**
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
+ export function __wbgtest_console_log(args: Array<any>): void;
20
+ /**
21
+ * Handler for `console.debug` invocations. See above.
22
+ * @param {Array<any>} args
23
+ */
24
+ export function __wbgtest_console_debug(args: Array<any>): void;
25
+ /**
26
+ * Handler for `console.info` invocations. See above.
27
+ * @param {Array<any>} args
28
+ */
29
+ export function __wbgtest_console_info(args: Array<any>): void;
30
+ /**
31
+ * Handler for `console.warn` invocations. See above.
32
+ * @param {Array<any>} args
33
+ */
34
+ export function __wbgtest_console_warn(args: Array<any>): void;
35
+ /**
36
+ * Handler for `console.error` invocations. See above.
37
+ * @param {Array<any>} args
38
+ */
39
+ export function __wbgtest_console_error(args: Array<any>): void;
40
+ /**
41
+ * Represents the type of operation to be performed on the collection.
42
+ */
43
+ export enum OpType {
44
+ /**
45
+ * Create operation.
46
+ */
47
+ CREATE = 0,
48
+ /**
49
+ * Update operation.
50
+ */
51
+ UPDATE = 1,
52
+ /**
53
+ * Delete operation.
54
+ */
55
+ DELETE = 2,
56
+ /**
57
+ * Query Operation.
58
+ */
59
+ QUERY = 3,
60
+ /**
61
+ * Count Operation.
62
+ */
63
+ COUNT = 4,
64
+ }
65
+
66
+ export class CoreStorage {
67
+ /**
68
+ * @param {any} document
69
+ * @param {Query} query
70
+ * @returns {boolean}
71
+ */
72
+ matchesQuery(document: any, query: Query<any>): boolean;
73
+ }
74
+
75
+
76
+
77
+ /**
78
+ * Represents a database containing collections of documents.
79
+ * RIDB extends from this class and is used to expose collections.
80
+ *
81
+ * So if you specify:
82
+ * ```typescript
83
+ * const db = new RIDB(
84
+ * {
85
+ * schemas: {
86
+ * demo: {
87
+ * version: 0,
88
+ * primaryKey: 'id',
89
+ * type: SchemaFieldType.object,
90
+ * properties: {
91
+ * id: {
92
+ * type: SchemaFieldType.string,
93
+ * maxLength: 60
94
+ * }
95
+ * }
96
+ * }
97
+ * } as const
98
+ * }
99
+ * )
100
+ * ```
101
+ *
102
+ * The collection will be available as `db.collections.demo` and all the methods for the collection (find, count, findById, update, create, delete) will be available.
103
+ *
104
+ * @template T - A record of schema types.
105
+ */
106
+ export class Database<T extends SchemaTypeRecord> {
107
+
108
+ /**
109
+ * Creates a new `Database` instance with the provided schemas and storage module.
110
+ *
111
+ * @template TS - A record of schema types.
112
+ * @param {TS} schemas - The schemas to use for the collections.
113
+ * @param migrations
114
+ * @param plugins
115
+ * @param options
116
+ * @param password
117
+ * @returns {Promise<Database<TS>>} A promise that resolves to the created `Database` instance.
118
+ */
119
+ static create<TS extends SchemaTypeRecord>(
120
+ db_name: string,
121
+ schemas: TS,
122
+ migrations: MigrationPathsForSchemas<TS> | MigrationPathsForSchema<TS[string]>,
123
+ plugins:Array<typeof BasePlugin>,
124
+ options: RIDBModule,
125
+ password?:string,
126
+ storage?: BaseStorage<TS>
127
+ ): Promise<Database<TS>>;
128
+
129
+ /**
130
+ * The collections in the database.
131
+ *
132
+ * This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
133
+ */
134
+ readonly collections: {
135
+ [name in keyof T]: Collection<Schema<T[name]>>
136
+ }
137
+
138
+ readonly started: boolean;
139
+
140
+ /**
141
+ * Starts the database.
142
+ *
143
+ * @returns {Promise<void>} A promise that resolves when the database is started.
144
+ */
145
+ start(): Promise<void>;
146
+
147
+ /**
148
+ * Closes the database.
149
+ *
150
+ * @returns {Promise<void>} A promise that resolves when the database is closed.
151
+ */
152
+ close(): Promise<void>;
153
+ }
154
+
155
+ /**
156
+ * Represents a function type for creating storage with the provided schema type records.
157
+ *
158
+ * @template T - The schema type record.
159
+ * @param {T} records - The schema type records.
160
+ * @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
161
+ */
162
+ export type CreateStorage = <T extends SchemaTypeRecord>(
163
+ records: T
164
+ ) => Promise<BaseStorage<T>>;
165
+
166
+ /**
167
+ * Represents a storage module with a method for creating storage.
168
+ */
169
+ export type RIDBModule = {
170
+
171
+ /**
172
+ * Plugin constructors array
173
+ */
174
+ apply: (plugins:Array<typeof BasePlugin>) => Array<BasePlugin>;
175
+ };
176
+
177
+
178
+
179
+ /**
180
+ * Represents an in-memory storage system extending the base storage functionality.
181
+ *
182
+ * @template T - The schema type.
183
+ */
184
+ export class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
185
+ /**
186
+ * Frees the resources used by the in-memory storage.
187
+ */
188
+ free(): void;
189
+
190
+ static create<SchemasCreate extends SchemaTypeRecord>(
191
+ dbName: string,
192
+ schemas: SchemasCreate,
193
+ ): Promise<
194
+ InMemory<
195
+ SchemasCreate
196
+ >
197
+ >;
198
+ }
199
+
200
+
201
+
202
+ export type BaseStorageOptions = {
203
+ [name:string]:string | boolean | number
204
+ }
205
+
206
+ export class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
207
+ static create<SchemasCreate extends SchemaTypeRecord>(
208
+ dbName: string,
209
+ schemas: SchemasCreate,
210
+ options?: BaseStorageOptions
211
+ ): Promise<
212
+ BaseStorage<
213
+ SchemasCreate
214
+ >
215
+ >;
216
+
217
+ constructor(
218
+ dbName: string,
219
+ schemas: Schemas,
220
+ options?: BaseStorageOptions
221
+ );
222
+
223
+ readonly dbName: string;
224
+ readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
225
+ readonly options: BaseStorageOptions;
226
+ readonly core: CoreStorage;
227
+ start(): Promise<void>;
228
+ close(): Promise<void>;
229
+ count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>): Promise<number>;
230
+ findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null | undefined>;
231
+ find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>[]>;
232
+ write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
233
+
234
+ getOption(name: string): string | boolean | number | undefined;
235
+ getSchema(name: string): Schema<any>;
236
+
237
+ }
238
+
239
+
240
+
241
+ /**
242
+ * Represents the type definition for a schema.
243
+ */
244
+ export type SchemaType = {
245
+ /**
246
+ * The version of the schema.
247
+ */
248
+ version: number;
249
+
250
+ /**
251
+ * The primary key of the schema.
252
+ */
253
+ primaryKey: string;
254
+
255
+ /**
256
+ * The type of the schema.
257
+ */
258
+ type: string;
259
+ indexes?: string[];
260
+ encrypted?: string[];
261
+ /**
262
+ * The properties defined in the schema.
263
+ */
264
+ properties: {
265
+ [name: string]: Property;
266
+ };
267
+ };
268
+
269
+
270
+ /**
271
+ * Represents a schema, including its definition and related methods.
272
+ *
273
+ * @template T - The schema type.
274
+ */
275
+ export class Schema<T extends SchemaType> {
276
+ /**
277
+ * The schema definition.
278
+ */
279
+ schema: Schema<T>;
280
+
281
+ /**
282
+ * Creates a new `Schema` instance from the provided definition.
283
+ *
284
+ * @template TS - The schema type.
285
+ * @param {TS} defi, Debugnition - The schema definition.
286
+ * @returns {Schema<TS>} The created `Schema` instance.
287
+ */
288
+ static create<TS extends SchemaType>(definition: TS): Schema<TS>;
289
+
290
+ /**
291
+ * The version of the schema.
292
+ */
293
+ readonly version: number;
294
+
295
+ /**
296
+ * The primary key of the schema.
297
+ */
298
+ readonly primaryKey: string;
299
+
300
+ /**
301
+ * The type of the schema.
302
+ */
303
+ readonly type: string;
304
+
305
+ /**
306
+ * An optional array of indexes.
307
+ */
308
+ /**
309
+ * An optional array of indexes.
310
+ */
311
+ readonly indexes?: (Extract<keyof T, string>)[];
312
+
313
+ /**
314
+ * An optional array of encrypted fields.
315
+ */
316
+ readonly encrypted?: (Extract<keyof T, string>)[];
317
+
318
+ /**
319
+ * The properties defined in the schema.
320
+ */
321
+ readonly properties: {
322
+ [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];
323
+ } & {
324
+ [K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
325
+ };
326
+ /**
327
+ * Converts the schema to a JSON representation.
328
+ *
329
+ * @returns {SchemaType} The JSON representation of the schema.
330
+ */
331
+ toJSON(): SchemaType;
332
+
333
+ validate(document: Doc<Schema<T>>): boolean;
334
+ }
335
+
336
+
337
+
338
+ export type InternalsRecord = {
339
+ [name: string]: BaseStorage<SchemaTypeRecord>
340
+ };
341
+ /**
342
+ * ExtractType is a utility type that maps a string representing a basic data type to the actual TypeScript type.
343
+ *
344
+ * @template T - A string literal type representing the basic data type ('string', 'number', 'boolean', 'object', 'array').
345
+ *
346
+ * @example
347
+ * type StringType = ExtractType<'string'>; // StringType is string
348
+ * type NumberType = ExtractType<'number'>; // NumberType is number
349
+ * type BooleanType = ExtractType<'boolean'>; // BooleanType is boolean
350
+ * type ObjectType = ExtractType<'object'>; // ObjectType is object
351
+ * type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
352
+ */
353
+ export type ExtractType<T extends string> =
354
+ T extends "string" ? string :
355
+ T extends "number" ? number :
356
+ T extends "boolean" ? boolean :
357
+ T extends "object" ? object :
358
+ T extends "array" ? any[] :
359
+ never;
360
+
361
+ export type IsOptional<T> = T extends { required: false } ? true :
362
+ T extends { default: any } ? true : false;
363
+
364
+ /**
365
+ * Doc is a utility type that transforms a schema type into a document type where each property is mapped to its extracted type.
366
+ *
367
+ * @template T - A schema type with a 'properties' field where each property's type is represented as a string.
368
+ *
369
+ * type Document = Doc<Schema>; // Document is { name: string; age: number; }
370
+ */
371
+ export type Doc<T extends SchemaType> = {
372
+ [K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
373
+ ExtractType<T["properties"][K]["type"]>
374
+ } & {
375
+ [K in keyof T["properties"] as IsOptional<T["properties"][K]> extends false ? K : never]:
376
+ ExtractType<T["properties"][K]["type"]>
377
+ } & {
378
+ __version?: number;
379
+ };
380
+
381
+ /**
382
+ * Collection is a class that represents a collection of documents in a database.
383
+ * @template T - A schema type defining the structure of the documents in the collection.
384
+ */
385
+ export class Collection<T extends SchemaType> {
386
+ /**
387
+ * Finds all documents in the collection.
388
+ *
389
+ * @returns A promise that resolves to an array of documents.
390
+ */
391
+ find(query: QueryType<T>): Promise<Doc<T>[]>;
392
+ /**
393
+ * count all documents in the collection.
394
+ *
395
+ * @returns A promise that resolves to an array of documents.
396
+ */
397
+ count(query: QueryType<T>): Promise<number>;
398
+ /**
399
+ * Finds a single document in the collection by its ID.
400
+ *
401
+ * @param id - The ID of the document to find.
402
+ * @returns A promise that resolves to the found document.
403
+ */
404
+ findById(id: string): Promise<Doc<T>>;
405
+ /**
406
+ * Updates a document in the collection by its ID.
407
+ *
408
+ * @param id - The ID of the document to update.
409
+ * @param document - A partial document containing the fields to update.
410
+ * @returns A promise that resolves when the update is complete.
411
+ */
412
+ update(document: Partial<Doc<T>>): Promise<void>;
413
+ /**
414
+ * Creates a new document in the collection.
415
+ *
416
+ * @param document - The document to create.
417
+ * @returns A promise that resolves to the created document.
418
+ */
419
+ create(document: Doc<T>): Promise<Doc<T>>;
420
+ /**
421
+ * Deletes a document in the collection by its ID.
422
+ *
423
+ * @param id - The ID of the document to delete.
424
+ * @returns A promise that resolves when the deletion is complete.
425
+ */
426
+ delete(id: string): Promise<void>;
427
+ }
428
+
429
+
430
+
431
+
432
+ export type EnumerateUpTo<
433
+ N extends number,
434
+ Acc extends number[] = []
435
+ > = Acc['length'] extends N ?
436
+ Acc[number]:
437
+ EnumerateUpTo<N, [...Acc, Acc['length']]> ;
438
+
439
+ export type EnumerateFrom1To<
440
+ N extends number
441
+ > = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
442
+
443
+ export type IsVersionGreaterThan0<
444
+ V extends number
445
+ > = V extends 0 ? false : true;
446
+
447
+ export type AnyVersionGreaterThan1<
448
+ T extends Record<string, SchemaType>
449
+ > = true extends {
450
+ [K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
451
+ } [keyof T] ? true : false;
452
+
453
+ export type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
454
+
455
+ export type MigrationPathsForSchema<
456
+ T extends SchemaType
457
+ > = T['version'] extends 0 ? {}: // No migrations needed for version 1
458
+ {
459
+ [K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
460
+ };
461
+
462
+ export type MigrationPathsForSchemas<
463
+ T extends SchemaTypeRecord
464
+ > = {
465
+ [K in keyof T]: MigrationPathsForSchema<T[K]>;
466
+ };
467
+
468
+ export type MigrationsParameter<
469
+ T extends SchemaTypeRecord
470
+ > = AnyVersionGreaterThan1<T> extends true ?
471
+ {
472
+ migrations: MigrationPathsForSchemas<T>
473
+ }:
474
+ {
475
+ migrations?: never
476
+ };
477
+
478
+
479
+
480
+ type Hook = (
481
+ schema: Schema<SchemaType>,
482
+ migration: MigrationPathsForSchema<SchemaType>,
483
+ doc: Doc<SchemaType>
484
+ ) => Doc<SchemaType>
485
+
486
+ type BasePluginOptions = {
487
+ docCreateHook?: Hook,
488
+ docRecoverHook?: Hook
489
+ }
490
+
491
+ export class BasePlugin implements BasePluginOptions {
492
+ docCreateHook?:Hook;
493
+ docRecoverHook?:Hook;
494
+ }
495
+
496
+
497
+
498
+ /**
499
+ * Represents an IndexDB storage system extending the base storage functionality.
500
+ *
501
+ * @template T - The schema type.
502
+ */
503
+ export class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
504
+ /**
505
+ * Frees the resources used by the in-memory storage.
506
+ */
507
+ free(): void;
508
+
509
+ static create<SchemasCreate extends SchemaTypeRecord>(
510
+ dbName: string,
511
+ schemas: SchemasCreate,
512
+ ): Promise<
513
+ IndexDB<
514
+ SchemasCreate
515
+ >
516
+ >;
517
+ }
518
+
519
+
520
+
521
+ /**
522
+ * Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
523
+ */
524
+ export type SchemaTypeRecord = {
525
+ [name: string]: SchemaType
526
+ };
527
+
528
+ export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
529
+ constructor(
530
+ name: string,
531
+ schemas: Schemas
532
+ );
533
+ abstract start(): Promise<void>;
534
+ abstract close(): Promise<void>;
535
+ abstract count(
536
+ colectionName: keyof Schemas,
537
+ query: QueryType<Schemas[keyof Schemas]>
538
+ ): Promise<number>;
539
+ abstract findDocumentById(
540
+ collectionName: keyof Schemas,
541
+ id: string
542
+ ): Promise<Doc<Schemas[keyof Schemas]> | undefined | null>;
543
+ abstract find(
544
+ collectionName: keyof Schemas,
545
+ query: QueryType<Schemas[keyof Schemas]>
546
+ ): Promise<Doc<Schemas[keyof Schemas]>[]>;
547
+ abstract write(
548
+ op: Operation<Schemas[keyof Schemas]>
549
+ ): Promise<Doc<Schemas[keyof Schemas]>>;
550
+ }
551
+
552
+
553
+ /**
554
+ * Represents a property within a schema, including various constraints and nested properties.
555
+ */
556
+ export class Property {
557
+ /**
558
+ * The type of the property.
559
+ */
560
+ readonly type: string;
561
+
562
+ /**
563
+ * The version of the property, if applicable.
564
+ */
565
+ readonly version?: number;
566
+
567
+ /**
568
+ * The primary key of the property, if applicable.
569
+ */
570
+ readonly primaryKey?: string;
571
+
572
+ /**
573
+ * An optional array of nested properties for array-type properties.
574
+ */
575
+ readonly items?: Property;
576
+
577
+ /**
578
+ * The maximum number of items for array-type properties, if applicable.
579
+ */
580
+ readonly maxItems?: number;
581
+
582
+ /**
583
+ * The minimum number of items for array-type properties, if applicable.
584
+ */
585
+ readonly minItems?: number;
586
+
587
+ /**
588
+ * The maximum length for string-type properties, if applicable.
589
+ */
590
+ readonly maxLength?: number;
591
+
592
+ /**
593
+ * The minimum length for string-type properties, if applicable.
594
+ */
595
+ readonly minLength?: number;
596
+
597
+ /**
598
+ * An optional array of required fields for object-type properties.
599
+ */
600
+ readonly required?: boolean;
601
+
602
+ /**
603
+ * An optional default value for the property.
604
+ */
605
+ readonly default?: any;
606
+
607
+ /**
608
+ * An optional map of nested properties for object-type properties.
609
+ */
610
+ readonly properties?: {
611
+ [name: string]: Property;
612
+ };
613
+ }
614
+
615
+
616
+
617
+ /**
618
+ * Represents an operation to be performed on a collection.
619
+ *
620
+ * @template T - The schema type of the collection.
621
+ */
622
+ export type Operation<T extends SchemaType> = {
623
+ /**
624
+ * The name of the collection on which the operation will be performed.
625
+ */
626
+ collection: string,
627
+
628
+ /**
629
+ * The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
630
+ */
631
+ opType: OpType,
632
+
633
+ /**
634
+ * The data involved in the operation, conforming to the schema type.
635
+ */
636
+ data: Doc<T>,
637
+
638
+ /**
639
+ * An array of indexes related to the operation.
640
+ */
641
+ indexes: Array<string>
642
+ }
643
+
644
+
645
+
646
+ export type Operators = {
647
+ $gte?: number,
648
+ $gt?: number
649
+ $lt?: number,
650
+ $lte?: number
651
+ };
652
+ export type InOperator<T> = { $in?: T[] };
653
+ export type OperatorOrType<T> = T extends number ? T | Operators | InOperator<T> : T | InOperator<T>;
654
+ export type LogicalOperators<T extends SchemaType> = {
655
+ $and?: Partial<QueryType<T>>[];
656
+ $or?: Partial<QueryType<T>>[];
657
+ };
658
+ export type QueryType<T extends SchemaType> = Partial<{
659
+ [K in keyof T['properties']]: OperatorOrType<
660
+ ExtractType<
661
+ T['properties'][K]['type']
662
+ >
663
+ >
664
+ }> & LogicalOperators<T> | LogicalOperators<T>[];
665
+ export class Query<T extends SchemaType> {
666
+ constructor(query: QueryType<T>, schema:Schema<T>)
667
+ readonly query: QueryType<T>
668
+ }
669
+ //test
670
+
671
+
672
+ /**
673
+ * Runtime test harness support instantiated in JS.
674
+ *
675
+ * The node.js entry script instantiates a `Context` here which is used to
676
+ * drive test execution.
677
+ */
678
+ export class WasmBindgenTestContext {
679
+ free(): void;
680
+ /**
681
+ * Creates a new context ready to run tests.
682
+ *
683
+ * A `Context` is the main structure through which test execution is
684
+ * coordinated, and this will collect output and results for all executed
685
+ * tests.
686
+ */
687
+ constructor();
688
+ /**
689
+ * Inform this context about runtime arguments passed to the test
690
+ * harness.
691
+ * @param {any[]} args
692
+ */
693
+ args(args: any[]): void;
694
+ /**
695
+ * Executes a list of tests, returning a promise representing their
696
+ * eventual completion.
697
+ *
698
+ * This is the main entry point for executing tests. All the tests passed
699
+ * in are the JS `Function` object that was plucked off the
700
+ * `WebAssembly.Instance` exports list.
701
+ *
702
+ * The promise returned resolves to either `true` if all tests passed or
703
+ * `false` if at least one test failed.
704
+ * @param {any[]} tests
705
+ * @returns {Promise<any>}
706
+ */
707
+ run(tests: any[]): Promise<any>;
708
+ }
709
+
710
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
711
+
712
+ export interface InitOutput {
713
+ readonly memory: WebAssembly.Memory;
714
+ readonly corestorage_new: () => number;
715
+ readonly corestorage_getPrimaryKey: (a: number, b: number, c: number) => void;
716
+ readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
717
+ readonly __wbg_database_free: (a: number) => void;
718
+ readonly database_start: (a: number) => number;
719
+ readonly database_close: (a: number) => number;
720
+ readonly database_started: (a: number) => number;
721
+ readonly database_collections: (a: number, b: number) => void;
722
+ readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
723
+ readonly main_js: () => void;
724
+ readonly is_debug_mode: () => number;
725
+ readonly __wbg_corestorage_free: (a: number) => void;
726
+ readonly __wbg_inmemory_free: (a: number) => void;
727
+ readonly inmemory_create: (a: number, b: number, c: number) => number;
728
+ readonly inmemory_by_index: (a: number, b: number) => void;
729
+ readonly inmemory_write: (a: number, b: number) => number;
730
+ readonly inmemory_find: (a: number, b: number, c: number, d: number) => number;
731
+ readonly inmemory_findDocumentById: (a: number, b: number, c: number, d: number) => number;
732
+ readonly inmemory_count: (a: number, b: number, c: number, d: number) => number;
733
+ readonly inmemory_close: (a: number) => number;
734
+ readonly inmemory_start: (a: number) => number;
735
+ readonly __wbg_basestorage_free: (a: number) => void;
736
+ readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
737
+ readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
738
+ readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
739
+ readonly basestorage_core: (a: number, b: number) => void;
740
+ readonly __wbg_schema_free: (a: number) => void;
741
+ readonly schema_validate: (a: number, b: number, c: number) => void;
742
+ readonly schema_is_valid: (a: number, b: number) => void;
743
+ readonly schema_create: (a: number, b: number) => void;
744
+ readonly schema_version: (a: number) => number;
745
+ readonly schema_primaryKey: (a: number, b: number) => void;
746
+ readonly schema_type: (a: number, b: number) => void;
747
+ readonly schema_indexes: (a: number, b: number) => void;
748
+ readonly schema_encrypted: (a: number, b: number) => void;
749
+ readonly schema_properties: (a: number, b: number) => void;
750
+ readonly __wbgt_test_schema_creation_3: (a: number) => void;
751
+ readonly __wbgt_test_schema_validation_4: (a: number) => void;
752
+ readonly __wbgt_test_invalid_schema_5: (a: number) => void;
753
+ readonly __wbg_collection_free: (a: number) => void;
754
+ readonly collection_name: (a: number, b: number) => void;
755
+ readonly collection_schema: (a: number, b: number) => void;
756
+ readonly collection_find: (a: number, b: number) => number;
757
+ readonly collection_count: (a: number, b: number) => number;
758
+ readonly collection_findById: (a: number, b: number) => number;
759
+ readonly collection_update: (a: number, b: number) => number;
760
+ readonly collection_create: (a: number, b: number) => number;
761
+ readonly collection_delete: (a: number, b: number) => number;
762
+ readonly __wbg_baseplugin_free: (a: number) => void;
763
+ readonly baseplugin_new: (a: number, b: number, c: number) => void;
764
+ readonly baseplugin_name: (a: number) => number;
765
+ readonly baseplugin_get_doc_create_hook: (a: number) => number;
766
+ readonly baseplugin_get_doc_recover_hook: (a: number) => number;
767
+ readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
768
+ readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
769
+ readonly __wbg_indexdb_free: (a: number) => void;
770
+ readonly indexdb_create: (a: number, b: number, c: number) => number;
771
+ readonly indexdb_write: (a: number, b: number) => number;
772
+ readonly indexdb_find: (a: number, b: number, c: number, d: number) => number;
773
+ readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
774
+ readonly indexdb_count: (a: number, b: number, c: number, d: number) => number;
775
+ readonly indexdb_close: (a: number) => number;
776
+ readonly indexdb_start: (a: number) => number;
777
+ readonly __wbg_property_free: (a: number) => void;
778
+ readonly property_is_valid: (a: number, b: number) => void;
779
+ readonly property_type: (a: number) => number;
780
+ readonly property_items: (a: number, b: number) => void;
781
+ readonly property_maxItems: (a: number, b: number) => void;
782
+ readonly property_minItems: (a: number, b: number) => void;
783
+ readonly property_maxLength: (a: number, b: number) => void;
784
+ readonly property_minLength: (a: number, b: number) => void;
785
+ readonly property_properties: (a: number, b: number) => void;
786
+ readonly __wbgt_test_property_creation_0: (a: number) => void;
787
+ readonly __wbgt_test_property_validation_1: (a: number) => void;
788
+ readonly __wbgt_test_invalid_property_2: (a: number) => void;
789
+ readonly __wbg_operation_free: (a: number) => void;
790
+ readonly operation_collection: (a: number, b: number) => void;
791
+ readonly operation_opType: (a: number) => number;
792
+ readonly operation_data: (a: number) => number;
793
+ readonly operation_indexes: (a: number, b: number) => void;
794
+ readonly __wbg_query_free: (a: number) => void;
795
+ readonly query_new: (a: number, b: number, c: number) => void;
796
+ readonly query_query: (a: number, b: number) => void;
797
+ readonly query_parse: (a: number, b: number) => void;
798
+ readonly __wbgt_test_query_parse_valid_6: (a: number) => void;
799
+ readonly __wbgt_test_query_parse_invalid_property_7: (a: number) => void;
800
+ readonly __wbgt_test_query_parse_invalid_type_8: (a: number) => void;
801
+ readonly __wbgt_test_query_parse_logical_operators_9: (a: number) => void;
802
+ readonly __wbgt_test_query_parse_invalid_operator_10: (a: number) => void;
803
+ readonly __wbgt_test_query_parse_operator_wrong_type_11: (a: number) => void;
804
+ readonly __wbgt_test_query_parse_in_operator_12: (a: number) => void;
805
+ readonly __wbgt_test_query_parse_in_operator_wrong_type_13: (a: number) => void;
806
+ readonly __wbgt_test_query_get_query_normalization_simple_attributes_14: (a: number) => void;
807
+ readonly __wbgt_test_query_get_query_normalization_with_logical_operator_15: (a: number) => void;
808
+ readonly __wbgt_test_query_get_query_normalization_nested_logical_operators_16: (a: number) => void;
809
+ readonly __wbgt_test_query_get_query_normalization_only_logical_operator_17: (a: number) => void;
810
+ readonly __wbgt_test_query_get_query_normalization_complex_mixed_18: (a: number) => void;
811
+ readonly __wbgt_test_query_parse_empty_query_19: (a: number) => void;
812
+ readonly __wbgt_test_query_parse_non_object_query_20: (a: number) => void;
813
+ readonly __wbgt_test_query_parse_multiple_operators_21: (a: number) => void;
814
+ readonly __wbgt_test_query_parse_invalid_in_operator_22: (a: number) => void;
815
+ readonly __wbgt_test_query_parse_empty_logical_operators_23: (a: number) => void;
816
+ readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
817
+ readonly wasmbindgentestcontext_new: () => number;
818
+ readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
819
+ readonly wasmbindgentestcontext_run: (a: number, b: number, c: number) => number;
820
+ readonly __wbgtest_console_log: (a: number) => void;
821
+ readonly __wbgtest_console_debug: (a: number) => void;
822
+ readonly __wbgtest_console_info: (a: number) => void;
823
+ readonly __wbgtest_console_warn: (a: number) => void;
824
+ readonly __wbgtest_console_error: (a: number) => void;
825
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
826
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
827
+ readonly __wbindgen_export_2: WebAssembly.Table;
828
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4279c525cebb26f2: (a: number, b: number, c: number) => void;
829
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fc6c6f4e4fe440c: (a: number, b: number, c: number) => number;
830
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
831
+ readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h80335dc7fe1c3f7e: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
832
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha1155a5e1cc6e1e8: (a: number, b: number, c: number) => void;
833
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
834
+ readonly __wbindgen_exn_store: (a: number) => void;
835
+ readonly wasm_bindgen__convert__closures__invoke0_mut__h19fc1620bec787be: (a: number, b: number) => void;
836
+ readonly wasm_bindgen__convert__closures__invoke3_mut__h7b738c7e28e951e8: (a: number, b: number, c: number, d: number, e: number) => void;
837
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h3a3f5f08be32a04a: (a: number, b: number, c: number, d: number) => void;
838
+ readonly __wbindgen_start: () => void;
839
+ }
840
+
841
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
842
+ /**
843
+ * Instantiates the given `module`, which can either be bytes or
844
+ * a precompiled `WebAssembly.Module`.
845
+ *
846
+ * @param {SyncInitInput} module
847
+ *
848
+ * @returns {InitOutput}
849
+ */
850
+ export function initSync(module: SyncInitInput): InitOutput;
851
+
852
+ /**
853
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
854
+ * for everything else, calls `WebAssembly.instantiate` directly.
855
+ *
856
+ * @param {InitInput | Promise<InitInput>} module_or_path
857
+ *
858
+ * @returns {Promise<InitOutput>}
859
+ */
860
+ export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;