@trust0/ridb-core 1.6.1 → 1.7.0-rc.11
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/{pkg → build}/ridb_core.d.ts +202 -198
- package/build/ridb_core.js +3057 -0
- package/build/ridb_core_bg.d.ts +2 -0
- package/build/ridb_core_bg.js +10 -0
- package/package.json +24 -9
- package/pkg/ridb_core.js +0 -3125
- package/pkg/ridb_core_bg.wasm +0 -0
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
declare function main_js(): void;
|
|
6
6
|
/**
|
|
7
7
|
* @returns {boolean}
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
declare function is_debug_mode(): boolean;
|
|
10
10
|
/**
|
|
11
11
|
* Handler for `console.log` invocations.
|
|
12
12
|
*
|
|
@@ -16,31 +16,31 @@ export function is_debug_mode(): boolean;
|
|
|
16
16
|
* `original`.
|
|
17
17
|
* @param {Array<any>} args
|
|
18
18
|
*/
|
|
19
|
-
|
|
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
26
|
* Handler for `console.info` invocations. See above.
|
|
27
27
|
* @param {Array<any>} args
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
declare function __wbgtest_console_info(args: Array<any>): void;
|
|
30
30
|
/**
|
|
31
31
|
* Handler for `console.warn` invocations. See above.
|
|
32
32
|
* @param {Array<any>} args
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
declare function __wbgtest_console_warn(args: Array<any>): void;
|
|
35
35
|
/**
|
|
36
36
|
* Handler for `console.error` invocations. See above.
|
|
37
37
|
* @param {Array<any>} args
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
declare function __wbgtest_console_error(args: Array<any>): void;
|
|
40
40
|
/**
|
|
41
41
|
* Represents the type of operation to be performed on the collection.
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
declare enum OpType {
|
|
44
44
|
/**
|
|
45
45
|
* Create operation.
|
|
46
46
|
*/
|
|
@@ -64,7 +64,7 @@ export enum OpType {
|
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
declare enum Errors {
|
|
68
68
|
Error = 0,
|
|
69
69
|
HookError = 1,
|
|
70
70
|
QueryError = 2,
|
|
@@ -73,7 +73,7 @@ export enum Errors {
|
|
|
73
73
|
AuthenticationError = 5,
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
type Operators<T> = {
|
|
77
77
|
$gte?: number,
|
|
78
78
|
$gt?: number
|
|
79
79
|
$lt?: number,
|
|
@@ -82,19 +82,19 @@ export type Operators<T> = {
|
|
|
82
82
|
$ne?: T
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
type InOperator<T> = { $in?: T[] };
|
|
86
|
+
type NInOperator<T> = { $nin?: T[] };
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
type OperatorOrType<T> = T extends number ?
|
|
89
89
|
T | Operators<T> | InOperator<T> | NInOperator<T> :
|
|
90
90
|
T | InOperator<T> | NInOperator<T>;
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
type LogicalOperators<T extends SchemaType> = {
|
|
93
93
|
$and?: Partial<QueryType<T>>[];
|
|
94
94
|
$or?: Partial<QueryType<T>>[];
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
type QueryType<T extends SchemaType> = Partial<{
|
|
98
98
|
[K in keyof T['properties']]: OperatorOrType<
|
|
99
99
|
ExtractType<
|
|
100
100
|
T['properties'][K]['type']
|
|
@@ -102,54 +102,14 @@ export type QueryType<T extends SchemaType> = Partial<{
|
|
|
102
102
|
>
|
|
103
103
|
}> & LogicalOperators<T> | LogicalOperators<T>[];
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
declare class Query<T extends SchemaType> {
|
|
106
106
|
constructor(query: QueryType<T>, schema:Schema<T>);
|
|
107
107
|
readonly query: QueryType<T>;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @param {any} document
|
|
115
|
-
* @param {Query} query
|
|
116
|
-
* @returns {boolean}
|
|
117
|
-
*/
|
|
118
|
-
matchesQuery(document: any, query: Query<any>): boolean;
|
|
119
|
-
getPrimaryKeyTyped(value: any): string | number;
|
|
120
|
-
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Represents an operation to be performed on a collection.
|
|
127
|
-
*
|
|
128
|
-
* @template T - The schema type of the collection.
|
|
129
|
-
*/
|
|
130
|
-
export type Operation<T extends SchemaType = SchemaType> = {
|
|
131
|
-
/**
|
|
132
|
-
* The name of the collection on which the operation will be performed.
|
|
133
|
-
*/
|
|
134
|
-
collection: string,
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
|
|
138
|
-
*/
|
|
139
|
-
opType: OpType,
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* The data involved in the operation, conforming to the schema type.
|
|
143
|
-
*/
|
|
144
|
-
data: Doc<T>,
|
|
145
|
-
|
|
146
|
-
primaryKeyField?: string,
|
|
147
|
-
primaryKey?: string
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
export type InternalsRecord = {
|
|
112
|
+
type InternalsRecord = {
|
|
153
113
|
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
154
114
|
};
|
|
155
115
|
/**
|
|
@@ -164,7 +124,7 @@ export type InternalsRecord = {
|
|
|
164
124
|
* type ObjectType = ExtractType<'object'>; // ObjectType is object
|
|
165
125
|
* type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
|
|
166
126
|
*/
|
|
167
|
-
|
|
127
|
+
type ExtractType<T extends string> =
|
|
168
128
|
T extends "string" ? string :
|
|
169
129
|
T extends "number" ? number :
|
|
170
130
|
T extends "boolean" ? boolean :
|
|
@@ -172,7 +132,7 @@ export type ExtractType<T extends string> =
|
|
|
172
132
|
T extends "array" ? any[] :
|
|
173
133
|
never;
|
|
174
134
|
|
|
175
|
-
|
|
135
|
+
type IsOptional<T> = T extends { required: false } ? true :
|
|
176
136
|
T extends { default: any } ? true : false;
|
|
177
137
|
|
|
178
138
|
/**
|
|
@@ -182,7 +142,7 @@ export type IsOptional<T> = T extends { required: false } ? true :
|
|
|
182
142
|
*
|
|
183
143
|
* type Document = Doc<Schema>; // Document is { name: string; age: number; }
|
|
184
144
|
*/
|
|
185
|
-
|
|
145
|
+
type Doc<T extends SchemaType> = {
|
|
186
146
|
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
|
|
187
147
|
ExtractType<T["properties"][K]["type"]>
|
|
188
148
|
} & {
|
|
@@ -190,9 +150,11 @@ export type Doc<T extends SchemaType> = {
|
|
|
190
150
|
ExtractType<T["properties"][K]["type"]>
|
|
191
151
|
} & {
|
|
192
152
|
__version?: number;
|
|
153
|
+
createdAt?: number;
|
|
154
|
+
updatedAt?: number;
|
|
193
155
|
};
|
|
194
156
|
|
|
195
|
-
|
|
157
|
+
type QueryOptions = {
|
|
196
158
|
limit?: number;
|
|
197
159
|
offset?: number;
|
|
198
160
|
}
|
|
@@ -201,7 +163,7 @@ export type QueryOptions = {
|
|
|
201
163
|
* Collection is a class that represents a collection of documents in a database.
|
|
202
164
|
* @template T - A schema type defining the structure of the documents in the collection.
|
|
203
165
|
*/
|
|
204
|
-
|
|
166
|
+
declare class Collection<T extends SchemaType> {
|
|
205
167
|
/**
|
|
206
168
|
* Finds all documents in the collection.
|
|
207
169
|
*
|
|
@@ -253,7 +215,7 @@ export class Collection<T extends SchemaType> {
|
|
|
253
215
|
*
|
|
254
216
|
* @template T - The schema type.
|
|
255
217
|
*/
|
|
256
|
-
|
|
218
|
+
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
257
219
|
/**
|
|
258
220
|
* Frees the resources used by the in-memory storage.
|
|
259
221
|
*/
|
|
@@ -271,95 +233,23 @@ export class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
|
271
233
|
|
|
272
234
|
|
|
273
235
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
): Promise<
|
|
284
|
-
BaseStorage<
|
|
285
|
-
SchemasCreate
|
|
286
|
-
>
|
|
287
|
-
>;
|
|
288
|
-
constructor(
|
|
289
|
-
dbName: string,
|
|
290
|
-
schemas: Schemas,
|
|
291
|
-
options?: BaseStorageOptions
|
|
292
|
-
);
|
|
293
|
-
readonly dbName: string;
|
|
294
|
-
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
295
|
-
readonly options: BaseStorageOptions;
|
|
296
|
-
readonly core: CoreStorage;
|
|
297
|
-
start(): Promise<void>;
|
|
298
|
-
close(): Promise<void>;
|
|
299
|
-
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<number>;
|
|
300
|
-
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
301
|
-
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
302
|
-
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
303
|
-
getOption(name: string): string | boolean | number | undefined;
|
|
304
|
-
getSchema(name: string): Schema<any>;
|
|
305
|
-
//Call addIndexSchemas if you need extra indexing schemas for your database
|
|
306
|
-
addIndexSchemas(): null
|
|
236
|
+
declare class CoreStorage {
|
|
237
|
+
/**
|
|
238
|
+
* @param {any} document
|
|
239
|
+
* @param {Query} query
|
|
240
|
+
* @returns {boolean}
|
|
241
|
+
*/
|
|
242
|
+
matchesQuery(document: any, query: Query<any>): boolean;
|
|
243
|
+
getPrimaryKeyTyped(value: any): string | number;
|
|
244
|
+
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
307
245
|
}
|
|
308
246
|
|
|
309
247
|
|
|
310
248
|
|
|
311
|
-
export type EnumerateUpTo<
|
|
312
|
-
N extends number,
|
|
313
|
-
Acc extends number[] = []
|
|
314
|
-
> = Acc['length'] extends N ?
|
|
315
|
-
Acc[number]:
|
|
316
|
-
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
317
|
-
|
|
318
|
-
export type EnumerateFrom1To<
|
|
319
|
-
N extends number
|
|
320
|
-
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
321
|
-
|
|
322
|
-
export type IsVersionGreaterThan0<
|
|
323
|
-
V extends number
|
|
324
|
-
> = V extends 0 ? false : true;
|
|
325
|
-
|
|
326
|
-
export type AnyVersionGreaterThan1<
|
|
327
|
-
T extends Record<string, SchemaType>
|
|
328
|
-
> = true extends {
|
|
329
|
-
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
330
|
-
} [keyof T] ? true : false;
|
|
331
|
-
|
|
332
|
-
export type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
333
|
-
|
|
334
|
-
export type MigrationPathsForSchema<
|
|
335
|
-
T extends SchemaType
|
|
336
|
-
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
337
|
-
{
|
|
338
|
-
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
export type MigrationPathsForSchemas<
|
|
342
|
-
T extends SchemaTypeRecord
|
|
343
|
-
> = {
|
|
344
|
-
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
export type MigrationsParameter<
|
|
348
|
-
T extends SchemaTypeRecord
|
|
349
|
-
> = AnyVersionGreaterThan1<T> extends true ?
|
|
350
|
-
{
|
|
351
|
-
migrations: MigrationPathsForSchemas<T>
|
|
352
|
-
}:
|
|
353
|
-
{
|
|
354
|
-
migrations?: never
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
249
|
/**
|
|
360
250
|
* Represents a property within a schema, including various constraints and nested properties.
|
|
361
251
|
*/
|
|
362
|
-
|
|
252
|
+
declare class Property {
|
|
363
253
|
/**
|
|
364
254
|
* The type of the property.
|
|
365
255
|
*/
|
|
@@ -423,7 +313,7 @@ export class Property {
|
|
|
423
313
|
/**
|
|
424
314
|
* Represents the type definition for a schema.
|
|
425
315
|
*/
|
|
426
|
-
|
|
316
|
+
type SchemaType = {
|
|
427
317
|
/**
|
|
428
318
|
* The version of the schema.
|
|
429
319
|
*/
|
|
@@ -465,7 +355,7 @@ export type SchemaType = {
|
|
|
465
355
|
*
|
|
466
356
|
* @template T - The schema type.
|
|
467
357
|
*/
|
|
468
|
-
|
|
358
|
+
declare class Schema<T extends SchemaType> {
|
|
469
359
|
/**
|
|
470
360
|
* The schema definition.
|
|
471
361
|
*/
|
|
@@ -533,7 +423,7 @@ export class Schema<T extends SchemaType> {
|
|
|
533
423
|
*
|
|
534
424
|
* @template T - The schema type.
|
|
535
425
|
*/
|
|
536
|
-
|
|
426
|
+
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
537
427
|
/**
|
|
538
428
|
* Frees the resources used by the in-memory storage.
|
|
539
429
|
*/
|
|
@@ -551,6 +441,81 @@ export class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
|
551
441
|
|
|
552
442
|
|
|
553
443
|
|
|
444
|
+
type EnumerateUpTo<
|
|
445
|
+
N extends number,
|
|
446
|
+
Acc extends number[] = []
|
|
447
|
+
> = Acc['length'] extends N ?
|
|
448
|
+
Acc[number]:
|
|
449
|
+
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
450
|
+
|
|
451
|
+
type EnumerateFrom1To<
|
|
452
|
+
N extends number
|
|
453
|
+
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
454
|
+
|
|
455
|
+
type IsVersionGreaterThan0<
|
|
456
|
+
V extends number
|
|
457
|
+
> = V extends 0 ? false : true;
|
|
458
|
+
|
|
459
|
+
type AnyVersionGreaterThan1<
|
|
460
|
+
T extends Record<string, SchemaType>
|
|
461
|
+
> = true extends {
|
|
462
|
+
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
463
|
+
} [keyof T] ? true : false;
|
|
464
|
+
|
|
465
|
+
type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
466
|
+
|
|
467
|
+
type MigrationPathsForSchema<
|
|
468
|
+
T extends SchemaType
|
|
469
|
+
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
470
|
+
{
|
|
471
|
+
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
type MigrationPathsForSchemas<
|
|
475
|
+
T extends SchemaTypeRecord
|
|
476
|
+
> = {
|
|
477
|
+
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
type MigrationsParameter<
|
|
481
|
+
T extends SchemaTypeRecord
|
|
482
|
+
> = AnyVersionGreaterThan1<T> extends true ?
|
|
483
|
+
{
|
|
484
|
+
migrations: MigrationPathsForSchemas<T>
|
|
485
|
+
}:
|
|
486
|
+
{
|
|
487
|
+
migrations?: never
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Represents an operation to be performed on a collection.
|
|
494
|
+
*
|
|
495
|
+
* @template T - The schema type of the collection.
|
|
496
|
+
*/
|
|
497
|
+
type Operation<T extends SchemaType = SchemaType> = {
|
|
498
|
+
/**
|
|
499
|
+
* The name of the collection on which the operation will be performed.
|
|
500
|
+
*/
|
|
501
|
+
collection: string,
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
|
|
505
|
+
*/
|
|
506
|
+
opType: OpType,
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* The data involved in the operation, conforming to the schema type.
|
|
510
|
+
*/
|
|
511
|
+
data: Doc<T>,
|
|
512
|
+
|
|
513
|
+
primaryKeyField?: string,
|
|
514
|
+
primaryKey?: string
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
554
519
|
type Hook = (
|
|
555
520
|
schema: Schema<SchemaType>,
|
|
556
521
|
migration: MigrationPathsForSchema<SchemaType>,
|
|
@@ -562,7 +527,7 @@ type BasePluginOptions = {
|
|
|
562
527
|
docRecoverHook?: Hook
|
|
563
528
|
}
|
|
564
529
|
|
|
565
|
-
|
|
530
|
+
declare class BasePlugin implements BasePluginOptions {
|
|
566
531
|
docCreateHook?:Hook;
|
|
567
532
|
docRecoverHook?:Hook;
|
|
568
533
|
}
|
|
@@ -572,11 +537,11 @@ export class BasePlugin implements BasePluginOptions {
|
|
|
572
537
|
/**
|
|
573
538
|
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
574
539
|
*/
|
|
575
|
-
|
|
540
|
+
type SchemaTypeRecord = {
|
|
576
541
|
[name: string]: SchemaType
|
|
577
542
|
};
|
|
578
543
|
|
|
579
|
-
|
|
544
|
+
declare abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
580
545
|
constructor(
|
|
581
546
|
name: string,
|
|
582
547
|
schemas: Schemas
|
|
@@ -603,6 +568,43 @@ export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
|
603
568
|
}
|
|
604
569
|
|
|
605
570
|
|
|
571
|
+
type BaseStorageOptions = {
|
|
572
|
+
[name:string]:string | boolean | number
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
declare class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
|
|
576
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
577
|
+
dbName: string,
|
|
578
|
+
schemas: SchemasCreate,
|
|
579
|
+
options?: BaseStorageOptions
|
|
580
|
+
): Promise<
|
|
581
|
+
BaseStorage<
|
|
582
|
+
SchemasCreate
|
|
583
|
+
>
|
|
584
|
+
>;
|
|
585
|
+
constructor(
|
|
586
|
+
dbName: string,
|
|
587
|
+
schemas: Schemas,
|
|
588
|
+
options?: BaseStorageOptions
|
|
589
|
+
);
|
|
590
|
+
readonly dbName: string;
|
|
591
|
+
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
592
|
+
readonly options: BaseStorageOptions;
|
|
593
|
+
readonly core: CoreStorage;
|
|
594
|
+
start(): Promise<void>;
|
|
595
|
+
close(): Promise<void>;
|
|
596
|
+
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<number>;
|
|
597
|
+
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
598
|
+
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
599
|
+
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
600
|
+
getOption(name: string): string | boolean | number | undefined;
|
|
601
|
+
getSchema(name: string): Schema<any>;
|
|
602
|
+
//Call addIndexSchemas if you need extra indexing schemas for your database
|
|
603
|
+
addIndexSchemas(): null
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
606
608
|
/**
|
|
607
609
|
* Represents a database containing collections of documents.
|
|
608
610
|
* RIDB extends from this class and is used to expose collections.
|
|
@@ -632,7 +634,7 @@ export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
|
632
634
|
*
|
|
633
635
|
* @template T - A record of schema types.
|
|
634
636
|
*/
|
|
635
|
-
|
|
637
|
+
declare class Database<T extends SchemaTypeRecord> {
|
|
636
638
|
|
|
637
639
|
/**
|
|
638
640
|
* Creates a new `Database` instance with the provided schemas and storage module.
|
|
@@ -690,14 +692,14 @@ export class Database<T extends SchemaTypeRecord> {
|
|
|
690
692
|
* @param {T} records - The schema type records.
|
|
691
693
|
* @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
|
|
692
694
|
*/
|
|
693
|
-
|
|
695
|
+
type CreateStorage = <T extends SchemaTypeRecord>(
|
|
694
696
|
records: T
|
|
695
697
|
) => Promise<BaseStorage<T>>;
|
|
696
698
|
|
|
697
699
|
/**
|
|
698
700
|
* Represents a storage module with a method for creating storage.
|
|
699
701
|
*/
|
|
700
|
-
|
|
702
|
+
type RIDBModule = {
|
|
701
703
|
|
|
702
704
|
/**
|
|
703
705
|
* Plugin constructors array
|
|
@@ -708,7 +710,7 @@ export type RIDBModule = {
|
|
|
708
710
|
|
|
709
711
|
/**
|
|
710
712
|
*/
|
|
711
|
-
|
|
713
|
+
declare class RIDBError {
|
|
712
714
|
/**
|
|
713
715
|
** Return copy of self without private attributes.
|
|
714
716
|
*/
|
|
@@ -781,7 +783,7 @@ export class RIDBError {
|
|
|
781
783
|
* The node.js entry script instantiates a `Context` here which is used to
|
|
782
784
|
* drive test execution.
|
|
783
785
|
*/
|
|
784
|
-
|
|
786
|
+
declare class WasmBindgenTestContext {
|
|
785
787
|
free(): void;
|
|
786
788
|
/**
|
|
787
789
|
* Creates a new context ready to run tests.
|
|
@@ -813,9 +815,9 @@ export class WasmBindgenTestContext {
|
|
|
813
815
|
run(tests: any[]): Promise<any>;
|
|
814
816
|
}
|
|
815
817
|
|
|
816
|
-
|
|
818
|
+
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
817
819
|
|
|
818
|
-
|
|
820
|
+
interface InitOutput {
|
|
819
821
|
readonly memory: WebAssembly.Memory;
|
|
820
822
|
readonly __wbg_query_free: (a: number) => void;
|
|
821
823
|
readonly query_new: (a: number, b: number, c: number) => void;
|
|
@@ -853,23 +855,6 @@ export interface InitOutput {
|
|
|
853
855
|
readonly __wbgt_test_query_parse_eq_operator_wrong_type_32: (a: number) => void;
|
|
854
856
|
readonly __wbgt_test_query_parse_ne_operator_33: (a: number) => void;
|
|
855
857
|
readonly __wbgt_test_query_parse_ne_operator_wrong_type_34: (a: number) => void;
|
|
856
|
-
readonly corestorage_new: () => number;
|
|
857
|
-
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
858
|
-
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
859
|
-
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
860
|
-
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
861
|
-
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
862
|
-
readonly queryoptions_offset: (a: number, b: number) => void;
|
|
863
|
-
readonly __wbg_operation_free: (a: number) => void;
|
|
864
|
-
readonly operation_collection: (a: number, b: number) => void;
|
|
865
|
-
readonly operation_opType: (a: number) => number;
|
|
866
|
-
readonly operation_data: (a: number) => number;
|
|
867
|
-
readonly operation_primaryKeyField: (a: number) => number;
|
|
868
|
-
readonly operation_primaryKey: (a: number) => number;
|
|
869
|
-
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
870
|
-
readonly main_js: () => void;
|
|
871
|
-
readonly is_debug_mode: () => number;
|
|
872
|
-
readonly __wbg_corestorage_free: (a: number) => void;
|
|
873
858
|
readonly __wbg_collection_free: (a: number) => void;
|
|
874
859
|
readonly collection_name: (a: number, b: number) => void;
|
|
875
860
|
readonly collection_schema: (a: number, b: number) => void;
|
|
@@ -888,12 +873,14 @@ export interface InitOutput {
|
|
|
888
873
|
readonly inmemory_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
889
874
|
readonly inmemory_close: (a: number) => number;
|
|
890
875
|
readonly inmemory_start: (a: number) => number;
|
|
891
|
-
readonly
|
|
892
|
-
readonly
|
|
893
|
-
readonly
|
|
894
|
-
readonly
|
|
895
|
-
readonly
|
|
896
|
-
readonly
|
|
876
|
+
readonly corestorage_new: () => number;
|
|
877
|
+
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
878
|
+
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
879
|
+
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
880
|
+
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
881
|
+
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
882
|
+
readonly queryoptions_offset: (a: number, b: number) => void;
|
|
883
|
+
readonly __wbg_corestorage_free: (a: number) => void;
|
|
897
884
|
readonly __wbg_property_free: (a: number) => void;
|
|
898
885
|
readonly property_is_valid: (a: number, b: number) => void;
|
|
899
886
|
readonly property_type: (a: number) => number;
|
|
@@ -929,13 +916,6 @@ export interface InitOutput {
|
|
|
929
916
|
readonly indexdb_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
930
917
|
readonly indexdb_close: (a: number) => number;
|
|
931
918
|
readonly indexdb_start: (a: number) => number;
|
|
932
|
-
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
933
|
-
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
934
|
-
readonly baseplugin_name: (a: number) => number;
|
|
935
|
-
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
936
|
-
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
937
|
-
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
938
|
-
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
939
919
|
readonly __wbg_ridberror_free: (a: number) => void;
|
|
940
920
|
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
941
921
|
readonly ridberror_type: (a: number, b: number) => void;
|
|
@@ -948,6 +928,28 @@ export interface InitOutput {
|
|
|
948
928
|
readonly ridberror_serialisation: (a: number, b: number, c: number) => number;
|
|
949
929
|
readonly ridberror_validation: (a: number, b: number, c: number) => number;
|
|
950
930
|
readonly ridberror_hook: (a: number, b: number, c: number) => number;
|
|
931
|
+
readonly __wbg_operation_free: (a: number) => void;
|
|
932
|
+
readonly operation_collection: (a: number, b: number) => void;
|
|
933
|
+
readonly operation_opType: (a: number) => number;
|
|
934
|
+
readonly operation_data: (a: number) => number;
|
|
935
|
+
readonly operation_primaryKeyField: (a: number) => number;
|
|
936
|
+
readonly operation_primaryKey: (a: number) => number;
|
|
937
|
+
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
938
|
+
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
939
|
+
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
940
|
+
readonly baseplugin_name: (a: number) => number;
|
|
941
|
+
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
942
|
+
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
943
|
+
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
944
|
+
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
945
|
+
readonly main_js: () => void;
|
|
946
|
+
readonly is_debug_mode: () => number;
|
|
947
|
+
readonly __wbg_basestorage_free: (a: number) => void;
|
|
948
|
+
readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
949
|
+
readonly basestorage_addIndexSchemas: (a: number, b: number) => void;
|
|
950
|
+
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
951
|
+
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
952
|
+
readonly basestorage_core: (a: number, b: number) => void;
|
|
951
953
|
readonly __wbg_database_free: (a: number) => void;
|
|
952
954
|
readonly database_start: (a: number) => number;
|
|
953
955
|
readonly database_close: (a: number) => number;
|
|
@@ -967,20 +969,20 @@ export interface InitOutput {
|
|
|
967
969
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
968
970
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
969
971
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
972
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fda0c55cc3a81de: (a: number, b: number, c: number) => void;
|
|
970
973
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
971
|
-
readonly
|
|
972
|
-
readonly
|
|
973
|
-
readonly
|
|
974
|
-
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h80ee32fc34c22e0b: (a: number, b: number, c: number) => void;
|
|
974
|
+
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd6d7e1645277db8b: (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__hb8ff6b112b411818: (a: number, b: number, c: number) => number;
|
|
976
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha88f7e4598f57d81: (a: number, b: number, c: number) => void;
|
|
975
977
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
976
978
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
977
|
-
readonly
|
|
978
|
-
readonly
|
|
979
|
-
readonly
|
|
979
|
+
readonly wasm_bindgen__convert__closures__invoke0_mut__h99a9f0884c9cd22a: (a: number, b: number) => void;
|
|
980
|
+
readonly wasm_bindgen__convert__closures__invoke3_mut__h07c8feee2a4f48f8: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
981
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h424d8c39cf909020: (a: number, b: number, c: number, d: number) => void;
|
|
980
982
|
readonly __wbindgen_start: () => void;
|
|
981
983
|
}
|
|
982
984
|
|
|
983
|
-
|
|
985
|
+
type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
984
986
|
/**
|
|
985
987
|
* Instantiates the given `module`, which can either be bytes or
|
|
986
988
|
* a precompiled `WebAssembly.Module`.
|
|
@@ -989,7 +991,7 @@ export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
|
989
991
|
*
|
|
990
992
|
* @returns {InitOutput}
|
|
991
993
|
*/
|
|
992
|
-
|
|
994
|
+
declare function initSync(module: SyncInitInput): InitOutput;
|
|
993
995
|
|
|
994
996
|
/**
|
|
995
997
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
@@ -999,4 +1001,6 @@ export function initSync(module: SyncInitInput): InitOutput;
|
|
|
999
1001
|
*
|
|
1000
1002
|
* @returns {Promise<InitOutput>}
|
|
1001
1003
|
*/
|
|
1002
|
-
|
|
1004
|
+
declare function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
1005
|
+
|
|
1006
|
+
export { type AnyVersionGreaterThan1, BasePlugin, BaseStorage, type BaseStorageOptions, Collection, CoreStorage, 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, 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 };
|