@trust0/ridb-core 1.7.40 → 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.
@@ -1,52 +1,42 @@
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
- * Handler for `console.info` invocations. See above.
12
- * @param {Array<any>} args
7
+ * @returns {boolean}
13
8
  */
14
- declare function __wbgtest_console_info(args: Array<any>): void;
9
+ declare function is_debug_mode(): boolean;
15
10
  /**
16
- * Handler for `console.warn` invocations. See above.
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 __wbgtest_console_warn(args: Array<any>): void;
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.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`.
26
+ * Handler for `console.info` invocations. See above.
32
27
  * @param {Array<any>} args
33
28
  */
34
- declare function __wbgtest_console_log(args: Array<any>): void;
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
41
38
  */
42
- declare enum Errors {
43
- Error = 0,
44
- HookError = 1,
45
- QueryError = 2,
46
- SerializationError = 3,
47
- ValidationError = 4,
48
- AuthenticationError = 5,
49
- }
39
+ declare function __wbgtest_console_warn(args: Array<any>): void;
50
40
  /**
51
41
  * Represents the type of operation to be performed on the collection.
52
42
  */
@@ -72,6 +62,16 @@ declare enum OpType {
72
62
  */
73
63
  COUNT = 4,
74
64
  }
65
+ /**
66
+ */
67
+ declare enum Errors {
68
+ Error = 0,
69
+ HookError = 1,
70
+ QueryError = 2,
71
+ SerializationError = 3,
72
+ ValidationError = 4,
73
+ AuthenticationError = 5,
74
+ }
75
75
 
76
76
  type Operators<T> = {
77
77
  $gte?: number,
@@ -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 the type definition for a schema.
155
+ * Represents an IndexDB storage system extending the base storage functionality.
156
+ *
157
+ * @template T - The schema type.
143
158
  */
144
- type SchemaType = {
159
+ declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
145
160
  /**
146
- * The version of the schema.
161
+ * Frees the resources used by the in-memory storage.
147
162
  */
148
- version: number;
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 primary key of the schema.
232
+ * The name of the collection on which the operation will be performed.
152
233
  */
153
- primaryKey: string;
234
+ collection: string,
154
235
 
155
236
  /**
156
- * The type of the schema.
237
+ * The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
157
238
  */
158
- type: SchemaFieldType;
159
- indexes?: string[];
160
- encrypted?: string[];
239
+ opType: OpType,
240
+
161
241
  /**
162
- * The properties defined in the schema.
242
+ * The data involved in the operation, conforming to the schema type.
163
243
  */
164
- properties: {
165
- [name: string]: Property;
166
- };
167
- };
244
+ data: Doc<T>,
245
+
246
+ primaryKeyField?: string,
247
+ primaryKey?: string
248
+ }
249
+
168
250
 
169
251
 
170
252
  /**
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
- *
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 Schema<T extends SchemaType> {
257
+ declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
187
258
  /**
188
- * The schema definition.
259
+ * Frees the resources used by the in-memory storage.
189
260
  */
190
- schema: Schema<T>;
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
- * 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.
280
+ * The type of the property.
198
281
  */
199
- static create<TS extends SchemaType>(definition: TS): Schema<TS>;
282
+ readonly type: SchemaFieldType;
200
283
 
201
284
  /**
202
- * The version of the schema.
285
+ * The version of the property, if applicable.
203
286
  */
204
- readonly version: number;
287
+ readonly version?: number;
205
288
 
206
289
  /**
207
- * The primary key of the schema.
290
+ * The primary key of the property, if applicable.
208
291
  */
209
- readonly primaryKey: string;
292
+ readonly primaryKey?: string;
210
293
 
211
294
  /**
212
- * The type of the schema.
295
+ * An optional array of nested properties for array-type properties.
213
296
  */
214
- readonly type: SchemaFieldType;
297
+ readonly items?: Property;
215
298
 
216
299
  /**
217
- * An optional array of indexes.
300
+ * The maximum number of items for array-type properties, if applicable.
218
301
  */
302
+ readonly maxItems?: number;
303
+
219
304
  /**
220
- * An optional array of indexes.
305
+ * The minimum number of items for array-type properties, if applicable.
221
306
  */
222
- readonly indexes?: (Extract<keyof T, string>)[];
307
+ readonly minItems?: number;
223
308
 
224
309
  /**
225
- * An optional array of encrypted fields.
310
+ * The maximum length for string-type properties, if applicable.
226
311
  */
227
- readonly encrypted?: (Extract<keyof T, string>)[];
312
+ readonly maxLength?: number;
228
313
 
229
314
  /**
230
- * The properties defined in the schema.
315
+ * The minimum length for string-type properties, if applicable.
231
316
  */
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];
236
- };
317
+ readonly minLength?: number;
318
+
237
319
  /**
238
- * Converts the schema to a JSON representation.
239
- *
240
- * @returns {SchemaType} The JSON representation of the schema.
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
- toJSON(): SchemaType;
326
+ readonly required?: boolean | string[];
243
327
 
244
- validate(document: Doc<Schema<T>>): boolean;
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
- 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[];
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
- type IsOptional<T> =
557
- T extends { required: true }
558
- ? T extends { default: never }
559
- ? false
560
- : true
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
561
620
  : true;
562
621
 
563
622
  /**
564
- * Doc is a utility type that transforms a schema type into a document type where each property is mapped to its extracted type.
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
660
+ : true;
661
+
662
+ /**
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
- ExtractType<T['properties'][K]['type']>
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 required: false become optional.
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 IsOptional<T["properties"][K]> extends true ? K : never]?:
587
- ExtractType<T['properties'][K]['type']>
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 IsOptional<T["properties"][K]> extends true ? never : K]:
590
- ExtractType<T['properties'][K]['type']>
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 an in-memory storage system extending the base storage functionality.
654
- *
655
- * @template T - The schema type.
761
+ * Represents the type definition for a schema.
656
762
  */
657
- declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
763
+ type SchemaType = {
658
764
  /**
659
- * Frees the resources used by the in-memory storage.
765
+ * The version of the schema.
660
766
  */
661
- free(): void;
767
+ version: number;
662
768
 
663
- static create<SchemasCreate extends SchemaTypeRecord>(
664
- dbName: string,
665
- schemas: SchemasCreate,
666
- ): Promise<
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 an operation to be performed on a collection.
677
- *
678
- * @template T - The schema type of the collection.
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
- type Operation<T extends SchemaType = SchemaType> = {
810
+ declare class Schema<T extends SchemaType> {
681
811
  /**
682
- * The name of the collection on which the operation will be performed.
812
+ * The schema definition.
683
813
  */
684
- collection: string,
814
+ schema: Schema<T>;
685
815
 
686
816
  /**
687
- * The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
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
- opType: OpType,
823
+ static create<TS extends SchemaType>(definition: TS): Schema<TS>;
690
824
 
691
825
  /**
692
- * The data involved in the operation, conforming to the schema type.
826
+ * The version of the schema.
693
827
  */
694
- data: Doc<T>,
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
- * 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
- };
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
- 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
- }
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
- * Frees the resources used by the in-memory storage.
861
+ * The names of the required top-level properties.
745
862
  */
746
- free(): void;
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
- static create<SchemasCreate extends SchemaTypeRecord>(
749
- dbName: string,
750
- schemas: SchemasCreate,
751
- ): Promise<
752
- IndexDB<
753
- SchemasCreate
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 __wbgt_test_get_properties_array_values_10: (a: number) => void;
872
- readonly __wbgt_test_get_properties_deeply_nested_12: (a: number) => void;
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;
876
- readonly __wbgt_test_get_properties_with_array_at_top_level_14: (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;
881
- readonly __wbgt_test_query_get_query_normalization_nested_logical_operators_20: (a: number) => void;
882
- readonly __wbgt_test_query_get_query_normalization_only_logical_operator_21: (a: number) => void;
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;
885
- readonly __wbgt_test_query_parse_age_query_24: (a: number) => void;
886
- readonly __wbgt_test_query_parse_empty_logical_operators_28: (a: number) => void;
887
- readonly __wbgt_test_query_parse_empty_query_23: (a: number) => void;
888
- readonly __wbgt_test_query_parse_eq_operator_31: (a: number) => void;
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;
894
- readonly __wbgt_test_query_parse_ne_operator_33: (a: number) => void;
895
- readonly __wbgt_test_query_parse_ne_operator_wrong_type_34: (a: number) => void;
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;
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 __wbg_basestorage_free: (a: number) => void;
929
- readonly __wbg_database_free: (a: number) => void;
930
- readonly basestorage_addIndexSchemas: (a: number, b: number) => void;
931
- readonly basestorage_core: (a: number, b: number) => void;
932
- readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
933
- readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
934
- readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
935
- readonly database_authenticate: (a: number, b: number, c: number) => number;
936
- readonly database_close: (a: number) => number;
937
- readonly database_collections: (a: number, b: number) => void;
938
- readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
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;
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 __wbg_inmemory_free: (a: number) => void;
964
- readonly __wbg_operation_free: (a: number) => void;
965
- readonly __wbg_ridberror_free: (a: number) => void;
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 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;
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 _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;
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 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;
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 IsOptional, type IsVersionGreaterThan0, type LogicalOperators, type MigrationFunction, type MigrationPathsForSchema, type MigrationPathsForSchemas, type MigrationsParameter, type NInOperator, OpType, type Operation, type OperatorOrType, type Operators, Property, Query, type QueryOptions, type QueryType, RIDBError, type RIDBModule, 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 };
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 };