@trust0/ridb-core 1.7.17 → 1.7.19
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 +319 -319
- package/build/ridb_core.js +144 -147
- package/build/ridb_core.mjs +144 -147
- package/build/ridb_core_bg.mjs +1 -1
- package/package.json +1 -1
package/build/ridb_core.d.ts
CHANGED
|
@@ -38,6 +38,16 @@ declare function __wbgtest_console_warn(args: Array<any>): void;
|
|
|
38
38
|
*/
|
|
39
39
|
declare function __wbgtest_console_error(args: Array<any>): void;
|
|
40
40
|
/**
|
|
41
|
+
*/
|
|
42
|
+
declare enum Errors {
|
|
43
|
+
Error = 0,
|
|
44
|
+
HookError = 1,
|
|
45
|
+
QueryError = 2,
|
|
46
|
+
SerializationError = 3,
|
|
47
|
+
ValidationError = 4,
|
|
48
|
+
AuthenticationError = 5,
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
41
51
|
* Represents the type of operation to be performed on the collection.
|
|
42
52
|
*/
|
|
43
53
|
declare enum OpType {
|
|
@@ -62,17 +72,147 @@ declare enum OpType {
|
|
|
62
72
|
*/
|
|
63
73
|
COUNT = 4,
|
|
64
74
|
}
|
|
75
|
+
|
|
76
|
+
declare class CoreStorage {
|
|
77
|
+
/**
|
|
78
|
+
* @param {any} document
|
|
79
|
+
* @param {Query} query
|
|
80
|
+
* @returns {boolean}
|
|
81
|
+
*/
|
|
82
|
+
matchesQuery(document: any, query: Query<any>): boolean;
|
|
83
|
+
getPrimaryKeyTyped(value: any): string | number;
|
|
84
|
+
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
65
89
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
90
|
+
* Represents an operation to be performed on a collection.
|
|
91
|
+
*
|
|
92
|
+
* @template T - The schema type of the collection.
|
|
93
|
+
*/
|
|
94
|
+
type Operation<T extends SchemaType = SchemaType> = {
|
|
95
|
+
/**
|
|
96
|
+
* The name of the collection on which the operation will be performed.
|
|
97
|
+
*/
|
|
98
|
+
collection: string,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
|
|
102
|
+
*/
|
|
103
|
+
opType: OpType,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The data involved in the operation, conforming to the schema type.
|
|
107
|
+
*/
|
|
108
|
+
data: Doc<T>,
|
|
109
|
+
|
|
110
|
+
primaryKeyField?: string,
|
|
111
|
+
primaryKey?: string
|
|
74
112
|
}
|
|
75
113
|
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Represents a property within a schema, including various constraints and nested properties.
|
|
118
|
+
*/
|
|
119
|
+
declare class Property {
|
|
120
|
+
/**
|
|
121
|
+
* The type of the property.
|
|
122
|
+
*/
|
|
123
|
+
readonly type: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The version of the property, if applicable.
|
|
127
|
+
*/
|
|
128
|
+
readonly version?: number;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The primary key of the property, if applicable.
|
|
132
|
+
*/
|
|
133
|
+
readonly primaryKey?: string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* An optional array of nested properties for array-type properties.
|
|
137
|
+
*/
|
|
138
|
+
readonly items?: Property;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The maximum number of items for array-type properties, if applicable.
|
|
142
|
+
*/
|
|
143
|
+
readonly maxItems?: number;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The minimum number of items for array-type properties, if applicable.
|
|
147
|
+
*/
|
|
148
|
+
readonly minItems?: number;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The maximum length for string-type properties, if applicable.
|
|
152
|
+
*/
|
|
153
|
+
readonly maxLength?: number;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The minimum length for string-type properties, if applicable.
|
|
157
|
+
*/
|
|
158
|
+
readonly minLength?: number;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* An optional array of required fields for object-type properties.
|
|
162
|
+
*/
|
|
163
|
+
readonly required?: boolean;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* An optional default value for the property.
|
|
167
|
+
*/
|
|
168
|
+
readonly default?: any;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* An optional map of nested properties for object-type properties.
|
|
172
|
+
*/
|
|
173
|
+
readonly properties?: {
|
|
174
|
+
[name: string]: Property;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
type Operators<T> = {
|
|
181
|
+
$gte?: number,
|
|
182
|
+
$gt?: number
|
|
183
|
+
$lt?: number,
|
|
184
|
+
$lte?: number,
|
|
185
|
+
$eq?: T,
|
|
186
|
+
$ne?: T
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
type InOperator<T> = { $in?: T[] };
|
|
190
|
+
type NInOperator<T> = { $nin?: T[] };
|
|
191
|
+
|
|
192
|
+
type OperatorOrType<T> = T extends number ?
|
|
193
|
+
T | Operators<T> | InOperator<T> | NInOperator<T> :
|
|
194
|
+
T | InOperator<T> | NInOperator<T>;
|
|
195
|
+
|
|
196
|
+
type LogicalOperators<T extends SchemaType> = {
|
|
197
|
+
$and?: Partial<QueryType<T>>[];
|
|
198
|
+
$or?: Partial<QueryType<T>>[];
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
type QueryType<T extends SchemaType> = ({
|
|
202
|
+
[K in keyof T['properties']as ExtractType<T['properties'][K]['type']> extends undefined ? never : K]?: OperatorOrType<
|
|
203
|
+
ExtractType<
|
|
204
|
+
T['properties'][K]['type']
|
|
205
|
+
>
|
|
206
|
+
>
|
|
207
|
+
} & LogicalOperators<T>) | LogicalOperators<T>[];
|
|
208
|
+
|
|
209
|
+
declare class Query<T extends SchemaType> {
|
|
210
|
+
constructor(query: QueryType<T>, schema:Schema<T>);
|
|
211
|
+
readonly query: QueryType<T>;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
76
216
|
type InternalsRecord = {
|
|
77
217
|
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
78
218
|
};
|
|
@@ -211,102 +351,66 @@ declare class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInter
|
|
|
211
351
|
|
|
212
352
|
|
|
213
353
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
* The type of the property.
|
|
220
|
-
*/
|
|
221
|
-
readonly type: string;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* The version of the property, if applicable.
|
|
225
|
-
*/
|
|
226
|
-
readonly version?: number;
|
|
354
|
+
type Hook = (
|
|
355
|
+
schema: Schema<SchemaType>,
|
|
356
|
+
migration: MigrationPathsForSchema<SchemaType>,
|
|
357
|
+
doc: Doc<SchemaType>
|
|
358
|
+
) => Doc<SchemaType>
|
|
227
359
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
360
|
+
type BasePluginOptions = {
|
|
361
|
+
docCreateHook?: Hook,
|
|
362
|
+
docRecoverHook?: Hook
|
|
363
|
+
}
|
|
232
364
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
365
|
+
declare class BasePlugin implements BasePluginOptions {
|
|
366
|
+
docCreateHook?:Hook;
|
|
367
|
+
docRecoverHook?:Hook;
|
|
368
|
+
}
|
|
237
369
|
|
|
238
|
-
/**
|
|
239
|
-
* The maximum number of items for array-type properties, if applicable.
|
|
240
|
-
*/
|
|
241
|
-
readonly maxItems?: number;
|
|
242
370
|
|
|
243
|
-
/**
|
|
244
|
-
* The minimum number of items for array-type properties, if applicable.
|
|
245
|
-
*/
|
|
246
|
-
readonly minItems?: number;
|
|
247
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Represents an IndexDB storage system extending the base storage functionality.
|
|
374
|
+
*
|
|
375
|
+
* @template T - The schema type.
|
|
376
|
+
*/
|
|
377
|
+
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
248
378
|
/**
|
|
249
|
-
*
|
|
379
|
+
* Frees the resources used by the in-memory storage.
|
|
250
380
|
*/
|
|
251
|
-
|
|
381
|
+
free(): void;
|
|
252
382
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
383
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
384
|
+
dbName: string,
|
|
385
|
+
schemas: SchemasCreate,
|
|
386
|
+
): Promise<
|
|
387
|
+
IndexDB<
|
|
388
|
+
SchemasCreate
|
|
389
|
+
>
|
|
390
|
+
>;
|
|
391
|
+
}
|
|
257
392
|
|
|
258
|
-
/**
|
|
259
|
-
* An optional array of required fields for object-type properties.
|
|
260
|
-
*/
|
|
261
|
-
readonly required?: boolean;
|
|
262
393
|
|
|
263
|
-
/**
|
|
264
|
-
* An optional default value for the property.
|
|
265
|
-
*/
|
|
266
|
-
readonly default?: any;
|
|
267
394
|
|
|
395
|
+
/**
|
|
396
|
+
* Represents an in-memory storage system extending the base storage functionality.
|
|
397
|
+
*
|
|
398
|
+
* @template T - The schema type.
|
|
399
|
+
*/
|
|
400
|
+
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
268
401
|
/**
|
|
269
|
-
*
|
|
402
|
+
* Frees the resources used by the in-memory storage.
|
|
270
403
|
*/
|
|
271
|
-
|
|
272
|
-
[name: string]: Property;
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
type Operators<T> = {
|
|
279
|
-
$gte?: number,
|
|
280
|
-
$gt?: number
|
|
281
|
-
$lt?: number,
|
|
282
|
-
$lte?: number,
|
|
283
|
-
$eq?: T,
|
|
284
|
-
$ne?: T
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
type InOperator<T> = { $in?: T[] };
|
|
288
|
-
type NInOperator<T> = { $nin?: T[] };
|
|
289
|
-
|
|
290
|
-
type OperatorOrType<T> = T extends number ?
|
|
291
|
-
T | Operators<T> | InOperator<T> | NInOperator<T> :
|
|
292
|
-
T | InOperator<T> | NInOperator<T>;
|
|
293
|
-
|
|
294
|
-
type LogicalOperators<T extends SchemaType> = {
|
|
295
|
-
$and?: Partial<QueryType<T>>[];
|
|
296
|
-
$or?: Partial<QueryType<T>>[];
|
|
297
|
-
};
|
|
404
|
+
free(): void;
|
|
298
405
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
406
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
407
|
+
dbName: string,
|
|
408
|
+
schemas: SchemasCreate,
|
|
409
|
+
): Promise<
|
|
410
|
+
InMemory<
|
|
411
|
+
SchemasCreate
|
|
303
412
|
>
|
|
304
|
-
|
|
305
|
-
}> & LogicalOperators<T> | LogicalOperators<T>[];
|
|
306
|
-
|
|
307
|
-
declare class Query<T extends SchemaType> {
|
|
308
|
-
constructor(query: QueryType<T>, schema:Schema<T>);
|
|
309
|
-
readonly query: QueryType<T>;
|
|
413
|
+
>;
|
|
310
414
|
}
|
|
311
415
|
|
|
312
416
|
|
|
@@ -419,85 +523,40 @@ declare class Schema<T extends SchemaType> {
|
|
|
419
523
|
|
|
420
524
|
|
|
421
525
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
428
|
-
|
|
429
|
-
type EnumerateFrom1To<
|
|
430
|
-
N extends number
|
|
431
|
-
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
432
|
-
|
|
433
|
-
type IsVersionGreaterThan0<
|
|
434
|
-
V extends number
|
|
435
|
-
> = V extends 0 ? false : true;
|
|
436
|
-
|
|
437
|
-
type AnyVersionGreaterThan1<
|
|
438
|
-
T extends Record<string, SchemaType>
|
|
439
|
-
> = true extends {
|
|
440
|
-
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
441
|
-
} [keyof T] ? true : false;
|
|
442
|
-
|
|
443
|
-
type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
444
|
-
|
|
445
|
-
type MigrationPathsForSchema<
|
|
446
|
-
T extends SchemaType
|
|
447
|
-
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
448
|
-
{
|
|
449
|
-
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
type MigrationPathsForSchemas<
|
|
453
|
-
T extends SchemaTypeRecord
|
|
454
|
-
> = {
|
|
455
|
-
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
526
|
+
/**
|
|
527
|
+
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
528
|
+
*/
|
|
529
|
+
type SchemaTypeRecord = {
|
|
530
|
+
[name: string]: SchemaType
|
|
456
531
|
};
|
|
457
532
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
docCreateHook?:Hook;
|
|
483
|
-
docRecoverHook?:Hook;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
declare class CoreStorage {
|
|
489
|
-
/**
|
|
490
|
-
* @param {any} document
|
|
491
|
-
* @param {Query} query
|
|
492
|
-
* @returns {boolean}
|
|
493
|
-
*/
|
|
494
|
-
matchesQuery(document: any, query: Query<any>): boolean;
|
|
495
|
-
getPrimaryKeyTyped(value: any): string | number;
|
|
496
|
-
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
533
|
+
declare abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
534
|
+
constructor(
|
|
535
|
+
name: string,
|
|
536
|
+
schemas: Schemas
|
|
537
|
+
);
|
|
538
|
+
abstract start(): Promise<void>;
|
|
539
|
+
abstract close(): Promise<void>;
|
|
540
|
+
abstract count(
|
|
541
|
+
colectionName: keyof Schemas,
|
|
542
|
+
query: QueryType<Schemas[keyof Schemas]>,
|
|
543
|
+
options?: QueryOptions
|
|
544
|
+
): Promise<number>;
|
|
545
|
+
abstract findDocumentById(
|
|
546
|
+
collectionName: keyof Schemas,
|
|
547
|
+
id: string
|
|
548
|
+
): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
549
|
+
abstract find(
|
|
550
|
+
collectionName: keyof Schemas,
|
|
551
|
+
query: QueryType<Schemas[keyof Schemas]>,
|
|
552
|
+
options?: QueryOptions
|
|
553
|
+
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
554
|
+
abstract write(
|
|
555
|
+
op: Operation<Schemas[keyof Schemas]>
|
|
556
|
+
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
497
557
|
}
|
|
498
558
|
|
|
499
559
|
|
|
500
|
-
|
|
501
560
|
/**
|
|
502
561
|
* Represents a database containing collections of documents.
|
|
503
562
|
* RIDB extends from this class and is used to expose collections.
|
|
@@ -602,110 +661,51 @@ type RIDBModule = {
|
|
|
602
661
|
|
|
603
662
|
|
|
604
663
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* The name of the collection on which the operation will be performed.
|
|
613
|
-
*/
|
|
614
|
-
collection: string,
|
|
664
|
+
type EnumerateUpTo<
|
|
665
|
+
N extends number,
|
|
666
|
+
Acc extends number[] = []
|
|
667
|
+
> = Acc['length'] extends N ?
|
|
668
|
+
Acc[number]:
|
|
669
|
+
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
615
670
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
opType: OpType,
|
|
671
|
+
type EnumerateFrom1To<
|
|
672
|
+
N extends number
|
|
673
|
+
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
620
674
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
data: Doc<T>,
|
|
675
|
+
type IsVersionGreaterThan0<
|
|
676
|
+
V extends number
|
|
677
|
+
> = V extends 0 ? false : true;
|
|
625
678
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
679
|
+
type AnyVersionGreaterThan1<
|
|
680
|
+
T extends Record<string, SchemaType>
|
|
681
|
+
> = true extends {
|
|
682
|
+
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
683
|
+
} [keyof T] ? true : false;
|
|
629
684
|
|
|
685
|
+
type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
630
686
|
|
|
687
|
+
type MigrationPathsForSchema<
|
|
688
|
+
T extends SchemaType
|
|
689
|
+
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
690
|
+
{
|
|
691
|
+
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
692
|
+
};
|
|
631
693
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
[name: string]: SchemaType
|
|
694
|
+
type MigrationPathsForSchemas<
|
|
695
|
+
T extends SchemaTypeRecord
|
|
696
|
+
> = {
|
|
697
|
+
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
637
698
|
};
|
|
638
699
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
query: QueryType<Schemas[keyof Schemas]>,
|
|
649
|
-
options?: QueryOptions
|
|
650
|
-
): Promise<number>;
|
|
651
|
-
abstract findDocumentById(
|
|
652
|
-
collectionName: keyof Schemas,
|
|
653
|
-
id: string
|
|
654
|
-
): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
655
|
-
abstract find(
|
|
656
|
-
collectionName: keyof Schemas,
|
|
657
|
-
query: QueryType<Schemas[keyof Schemas]>,
|
|
658
|
-
options?: QueryOptions
|
|
659
|
-
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
660
|
-
abstract write(
|
|
661
|
-
op: Operation<Schemas[keyof Schemas]>
|
|
662
|
-
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* Represents an IndexDB storage system extending the base storage functionality.
|
|
668
|
-
*
|
|
669
|
-
* @template T - The schema type.
|
|
670
|
-
*/
|
|
671
|
-
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
672
|
-
/**
|
|
673
|
-
* Frees the resources used by the in-memory storage.
|
|
674
|
-
*/
|
|
675
|
-
free(): void;
|
|
676
|
-
|
|
677
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
678
|
-
dbName: string,
|
|
679
|
-
schemas: SchemasCreate,
|
|
680
|
-
): Promise<
|
|
681
|
-
IndexDB<
|
|
682
|
-
SchemasCreate
|
|
683
|
-
>
|
|
684
|
-
>;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Represents an in-memory storage system extending the base storage functionality.
|
|
691
|
-
*
|
|
692
|
-
* @template T - The schema type.
|
|
693
|
-
*/
|
|
694
|
-
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
695
|
-
/**
|
|
696
|
-
* Frees the resources used by the in-memory storage.
|
|
697
|
-
*/
|
|
698
|
-
free(): void;
|
|
699
|
-
|
|
700
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
701
|
-
dbName: string,
|
|
702
|
-
schemas: SchemasCreate,
|
|
703
|
-
): Promise<
|
|
704
|
-
InMemory<
|
|
705
|
-
SchemasCreate
|
|
706
|
-
>
|
|
707
|
-
>;
|
|
708
|
-
}
|
|
700
|
+
type MigrationsParameter<
|
|
701
|
+
T extends SchemaTypeRecord
|
|
702
|
+
> = AnyVersionGreaterThan1<T> extends true ?
|
|
703
|
+
{
|
|
704
|
+
migrations: MigrationPathsForSchemas<T>
|
|
705
|
+
}:
|
|
706
|
+
{
|
|
707
|
+
migrations?: never
|
|
708
|
+
};
|
|
709
709
|
|
|
710
710
|
|
|
711
711
|
/**
|
|
@@ -819,25 +819,20 @@ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Modul
|
|
|
819
819
|
|
|
820
820
|
interface InitOutput {
|
|
821
821
|
readonly memory: WebAssembly.Memory;
|
|
822
|
-
readonly
|
|
823
|
-
readonly
|
|
824
|
-
readonly
|
|
825
|
-
readonly
|
|
826
|
-
readonly
|
|
827
|
-
readonly
|
|
828
|
-
readonly
|
|
829
|
-
readonly
|
|
830
|
-
readonly
|
|
831
|
-
readonly
|
|
832
|
-
readonly
|
|
833
|
-
readonly
|
|
834
|
-
readonly
|
|
835
|
-
readonly
|
|
836
|
-
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
837
|
-
readonly basestorage_core: (a: number, b: number) => void;
|
|
838
|
-
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
839
|
-
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
840
|
-
readonly queryoptions_offset: (a: number, b: number) => void;
|
|
822
|
+
readonly corestorage_new: () => number;
|
|
823
|
+
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
824
|
+
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
825
|
+
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
826
|
+
readonly __wbg_operation_free: (a: number) => void;
|
|
827
|
+
readonly operation_collection: (a: number, b: number) => void;
|
|
828
|
+
readonly operation_opType: (a: number) => number;
|
|
829
|
+
readonly operation_data: (a: number) => number;
|
|
830
|
+
readonly operation_primaryKeyField: (a: number) => number;
|
|
831
|
+
readonly operation_primaryKey: (a: number) => number;
|
|
832
|
+
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
833
|
+
readonly __wbg_corestorage_free: (a: number) => void;
|
|
834
|
+
readonly main_js: () => void;
|
|
835
|
+
readonly is_debug_mode: () => number;
|
|
841
836
|
readonly __wbg_property_free: (a: number) => void;
|
|
842
837
|
readonly property_is_valid: (a: number, b: number) => void;
|
|
843
838
|
readonly property_type: (a: number) => number;
|
|
@@ -886,19 +881,22 @@ interface InitOutput {
|
|
|
886
881
|
readonly __wbgt_test_query_parse_eq_operator_wrong_type_32: (a: number) => void;
|
|
887
882
|
readonly __wbgt_test_query_parse_ne_operator_33: (a: number) => void;
|
|
888
883
|
readonly __wbgt_test_query_parse_ne_operator_wrong_type_34: (a: number) => void;
|
|
889
|
-
readonly
|
|
890
|
-
readonly
|
|
891
|
-
readonly
|
|
892
|
-
readonly
|
|
893
|
-
readonly
|
|
894
|
-
readonly
|
|
895
|
-
readonly
|
|
896
|
-
readonly
|
|
897
|
-
readonly
|
|
898
|
-
readonly
|
|
899
|
-
readonly
|
|
900
|
-
readonly
|
|
901
|
-
readonly
|
|
884
|
+
readonly __wbg_collection_free: (a: number) => void;
|
|
885
|
+
readonly collection_name: (a: number, b: number) => void;
|
|
886
|
+
readonly collection_schema: (a: number, b: number) => void;
|
|
887
|
+
readonly collection_find: (a: number, b: number, c: number) => number;
|
|
888
|
+
readonly collection_parse_query_options: (a: number, b: number, c: number) => void;
|
|
889
|
+
readonly collection_count: (a: number, b: number, c: number) => number;
|
|
890
|
+
readonly collection_findById: (a: number, b: number) => number;
|
|
891
|
+
readonly collection_update: (a: number, b: number) => number;
|
|
892
|
+
readonly collection_create: (a: number, b: number) => number;
|
|
893
|
+
readonly collection_delete: (a: number, b: number) => number;
|
|
894
|
+
readonly __wbg_basestorage_free: (a: number) => void;
|
|
895
|
+
readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
896
|
+
readonly basestorage_addIndexSchemas: (a: number, b: number) => void;
|
|
897
|
+
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
898
|
+
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
899
|
+
readonly basestorage_core: (a: number, b: number) => void;
|
|
902
900
|
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
903
901
|
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
904
902
|
readonly baseplugin_name: (a: number) => number;
|
|
@@ -906,27 +904,6 @@ interface InitOutput {
|
|
|
906
904
|
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
907
905
|
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
908
906
|
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
909
|
-
readonly main_js: () => void;
|
|
910
|
-
readonly is_debug_mode: () => number;
|
|
911
|
-
readonly corestorage_new: () => number;
|
|
912
|
-
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
913
|
-
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
914
|
-
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
915
|
-
readonly __wbg_database_free: (a: number) => void;
|
|
916
|
-
readonly database_start: (a: number) => number;
|
|
917
|
-
readonly database_close: (a: number) => number;
|
|
918
|
-
readonly database_started: (a: number) => number;
|
|
919
|
-
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
920
|
-
readonly database_collections: (a: number, b: number) => void;
|
|
921
|
-
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
922
|
-
readonly __wbg_operation_free: (a: number) => void;
|
|
923
|
-
readonly operation_collection: (a: number, b: number) => void;
|
|
924
|
-
readonly operation_opType: (a: number) => number;
|
|
925
|
-
readonly operation_data: (a: number) => number;
|
|
926
|
-
readonly operation_primaryKeyField: (a: number) => number;
|
|
927
|
-
readonly operation_primaryKey: (a: number) => number;
|
|
928
|
-
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
929
|
-
readonly __wbg_corestorage_free: (a: number) => void;
|
|
930
907
|
readonly __wbg_ridberror_free: (a: number) => void;
|
|
931
908
|
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
932
909
|
readonly ridberror_type: (a: number, b: number) => void;
|
|
@@ -957,6 +934,29 @@ interface InitOutput {
|
|
|
957
934
|
readonly inmemory_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
958
935
|
readonly inmemory_close: (a: number) => number;
|
|
959
936
|
readonly inmemory_start: (a: number) => number;
|
|
937
|
+
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
938
|
+
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
939
|
+
readonly queryoptions_offset: (a: number, b: number) => void;
|
|
940
|
+
readonly __wbg_schema_free: (a: number) => void;
|
|
941
|
+
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
942
|
+
readonly schema_is_valid: (a: number, b: number) => void;
|
|
943
|
+
readonly schema_create: (a: number, b: number) => void;
|
|
944
|
+
readonly schema_version: (a: number) => number;
|
|
945
|
+
readonly schema_primaryKey: (a: number, b: number) => void;
|
|
946
|
+
readonly schema_type: (a: number, b: number) => void;
|
|
947
|
+
readonly schema_indexes: (a: number, b: number) => void;
|
|
948
|
+
readonly schema_encrypted: (a: number, b: number) => void;
|
|
949
|
+
readonly schema_properties: (a: number, b: number) => void;
|
|
950
|
+
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
951
|
+
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
952
|
+
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
953
|
+
readonly __wbg_database_free: (a: number) => void;
|
|
954
|
+
readonly database_start: (a: number) => number;
|
|
955
|
+
readonly database_close: (a: number) => number;
|
|
956
|
+
readonly database_started: (a: number) => number;
|
|
957
|
+
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
958
|
+
readonly database_collections: (a: number, b: number) => void;
|
|
959
|
+
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
960
960
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
961
961
|
readonly wasmbindgentestcontext_new: () => number;
|
|
962
962
|
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
|
@@ -969,16 +969,16 @@ interface InitOutput {
|
|
|
969
969
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
970
970
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
971
971
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
972
|
-
readonly
|
|
972
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h07337a613af73c1c: (a: number, b: number, c: number) => number;
|
|
973
973
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
974
|
-
readonly
|
|
975
|
-
readonly
|
|
976
|
-
readonly
|
|
974
|
+
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8ff44d1dd2af116f: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
975
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hef5fe0a25bd463e1: (a: number, b: number, c: number) => void;
|
|
976
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6fc97b853dde6831: (a: number, b: number, c: number) => void;
|
|
977
977
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
978
978
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
979
|
-
readonly
|
|
980
|
-
readonly
|
|
981
|
-
readonly
|
|
979
|
+
readonly wasm_bindgen__convert__closures__invoke0_mut__h2cca5e72c8e71f77: (a: number, b: number) => void;
|
|
980
|
+
readonly wasm_bindgen__convert__closures__invoke3_mut__h3e319120fb66fb1e: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
981
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h5f5731f0f637befa: (a: number, b: number, c: number, d: number) => void;
|
|
982
982
|
readonly __wbindgen_start: () => void;
|
|
983
983
|
}
|
|
984
984
|
|