@trust0/ridb-core 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pkg/ridb_core.d.ts +502 -502
- package/pkg/ridb_core.js +123 -121
- package/pkg/ridb_core_bg.wasm +0 -0
package/pkg/ridb_core.d.ts
CHANGED
|
@@ -38,16 +38,6 @@ export function __wbgtest_console_warn(args: Array<any>): void;
|
|
|
38
38
|
*/
|
|
39
39
|
export function __wbgtest_console_error(args: Array<any>): void;
|
|
40
40
|
/**
|
|
41
|
-
*/
|
|
42
|
-
export enum Errors {
|
|
43
|
-
Error = 0,
|
|
44
|
-
HookError = 1,
|
|
45
|
-
QueryError = 2,
|
|
46
|
-
SerializationError = 3,
|
|
47
|
-
ValidationError = 4,
|
|
48
|
-
AuthenticationError = 5,
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
41
|
* Represents the type of operation to be performed on the collection.
|
|
52
42
|
*/
|
|
53
43
|
export enum OpType {
|
|
@@ -72,202 +62,17 @@ export enum OpType {
|
|
|
72
62
|
*/
|
|
73
63
|
COUNT = 4,
|
|
74
64
|
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Represents a property within a schema, including various constraints and nested properties.
|
|
78
|
-
*/
|
|
79
|
-
export class Property {
|
|
80
|
-
/**
|
|
81
|
-
* The type of the property.
|
|
82
|
-
*/
|
|
83
|
-
readonly type: string;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The version of the property, if applicable.
|
|
87
|
-
*/
|
|
88
|
-
readonly version?: number;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* The primary key of the property, if applicable.
|
|
92
|
-
*/
|
|
93
|
-
readonly primaryKey?: string;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* An optional array of nested properties for array-type properties.
|
|
97
|
-
*/
|
|
98
|
-
readonly items?: Property;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* The maximum number of items for array-type properties, if applicable.
|
|
102
|
-
*/
|
|
103
|
-
readonly maxItems?: number;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* The minimum number of items for array-type properties, if applicable.
|
|
107
|
-
*/
|
|
108
|
-
readonly minItems?: number;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* The maximum length for string-type properties, if applicable.
|
|
112
|
-
*/
|
|
113
|
-
readonly maxLength?: number;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* The minimum length for string-type properties, if applicable.
|
|
117
|
-
*/
|
|
118
|
-
readonly minLength?: number;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* An optional array of required fields for object-type properties.
|
|
122
|
-
*/
|
|
123
|
-
readonly required?: boolean;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* An optional default value for the property.
|
|
127
|
-
*/
|
|
128
|
-
readonly default?: any;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* An optional map of nested properties for object-type properties.
|
|
132
|
-
*/
|
|
133
|
-
readonly properties?: {
|
|
134
|
-
[name: string]: Property;
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Represents the type definition for a schema.
|
|
142
|
-
*/
|
|
143
|
-
export type SchemaType = {
|
|
144
|
-
/**
|
|
145
|
-
* The version of the schema.
|
|
146
|
-
*/
|
|
147
|
-
version: number;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* The primary key of the schema.
|
|
151
|
-
*/
|
|
152
|
-
primaryKey: string;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* The type of the schema.
|
|
156
|
-
*/
|
|
157
|
-
type: string;
|
|
158
|
-
indexes?: string[];
|
|
159
|
-
encrypted?: string[];
|
|
160
|
-
/**
|
|
161
|
-
* The properties defined in the schema.
|
|
162
|
-
*/
|
|
163
|
-
properties: {
|
|
164
|
-
[name: string]: Property;
|
|
165
|
-
};
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Represents a schema, including its definition and related methods.
|
|
171
|
-
* You may be trying to build a storage, in any other can u won't need access tho this class.
|
|
172
|
-
* Check this example
|
|
173
|
-
*
|
|
174
|
-
* ```typescript
|
|
175
|
-
* class MyStorage extends <T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
176
|
-
* example() {
|
|
177
|
-
* const schema: Schema<any> = this.getSchema("mySchema")
|
|
178
|
-
* }
|
|
179
|
-
* }
|
|
180
|
-
* ```
|
|
181
|
-
* You alwayswill have access to getSchema through the Storage class.
|
|
182
|
-
*
|
|
183
|
-
* @template T - The schema type.
|
|
184
|
-
*/
|
|
185
|
-
export class Schema<T extends SchemaType> {
|
|
186
|
-
/**
|
|
187
|
-
* The schema definition.
|
|
188
|
-
*/
|
|
189
|
-
schema: Schema<T>;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Creates a new `Schema` instance from the provided definition.
|
|
193
|
-
*
|
|
194
|
-
* @template TS - The schema type.
|
|
195
|
-
* @param {TS} defi, Debugnition - The schema definition.
|
|
196
|
-
* @returns {Schema<TS>} The created `Schema` instance.
|
|
197
|
-
*/
|
|
198
|
-
static create<TS extends SchemaType>(definition: TS): Schema<TS>;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* The version of the schema.
|
|
202
|
-
*/
|
|
203
|
-
readonly version: number;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* The primary key of the schema.
|
|
207
|
-
*/
|
|
208
|
-
readonly primaryKey: string;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* The type of the schema.
|
|
212
|
-
*/
|
|
213
|
-
readonly type: string;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* An optional array of indexes.
|
|
217
|
-
*/
|
|
218
|
-
/**
|
|
219
|
-
* An optional array of indexes.
|
|
220
|
-
*/
|
|
221
|
-
readonly indexes?: (Extract<keyof T, string>)[];
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* An optional array of encrypted fields.
|
|
225
|
-
*/
|
|
226
|
-
readonly encrypted?: (Extract<keyof T, string>)[];
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* The properties defined in the schema.
|
|
230
|
-
*/
|
|
231
|
-
readonly properties: {
|
|
232
|
-
[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];
|
|
233
|
-
} & {
|
|
234
|
-
[K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
|
|
235
|
-
};
|
|
236
|
-
/**
|
|
237
|
-
* Converts the schema to a JSON representation.
|
|
238
|
-
*
|
|
239
|
-
* @returns {SchemaType} The JSON representation of the schema.
|
|
240
|
-
*/
|
|
241
|
-
toJSON(): SchemaType;
|
|
242
|
-
|
|
243
|
-
validate(document: Doc<Schema<T>>): boolean;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
65
|
/**
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
free(): void;
|
|
258
|
-
|
|
259
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
260
|
-
dbName: string,
|
|
261
|
-
schemas: SchemasCreate,
|
|
262
|
-
): Promise<
|
|
263
|
-
IndexDB<
|
|
264
|
-
SchemasCreate
|
|
265
|
-
>
|
|
266
|
-
>;
|
|
66
|
+
*/
|
|
67
|
+
export enum Errors {
|
|
68
|
+
Error = 0,
|
|
69
|
+
HookError = 1,
|
|
70
|
+
QueryError = 2,
|
|
71
|
+
SerializationError = 3,
|
|
72
|
+
ValidationError = 4,
|
|
73
|
+
AuthenticationError = 5,
|
|
267
74
|
}
|
|
268
75
|
|
|
269
|
-
|
|
270
|
-
|
|
271
76
|
export type Operators<T> = {
|
|
272
77
|
$gte?: number,
|
|
273
78
|
$gt?: number
|
|
@@ -304,147 +109,25 @@ export class Query<T extends SchemaType> {
|
|
|
304
109
|
|
|
305
110
|
|
|
306
111
|
|
|
112
|
+
export class CoreStorage {
|
|
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
|
+
|
|
307
125
|
/**
|
|
308
|
-
* Represents
|
|
309
|
-
* RIDB extends from this class and is used to expose collections.
|
|
310
|
-
*
|
|
311
|
-
* So if you specify:
|
|
312
|
-
* ```typescript
|
|
313
|
-
* const db = new RIDB(
|
|
314
|
-
* {
|
|
315
|
-
* schemas: {
|
|
316
|
-
* demo: {
|
|
317
|
-
* version: 0,
|
|
318
|
-
* primaryKey: 'id',
|
|
319
|
-
* type: SchemaFieldType.object,
|
|
320
|
-
* properties: {
|
|
321
|
-
* id: {
|
|
322
|
-
* type: SchemaFieldType.string,
|
|
323
|
-
* maxLength: 60
|
|
324
|
-
* }
|
|
325
|
-
* }
|
|
326
|
-
* }
|
|
327
|
-
* } as const
|
|
328
|
-
* }
|
|
329
|
-
* )
|
|
330
|
-
* ```
|
|
331
|
-
*
|
|
332
|
-
* The collection will be available as `db.collections.demo` and all the methods for the collection (find, count, findById, update, create, delete) will be available.
|
|
126
|
+
* Represents an operation to be performed on a collection.
|
|
333
127
|
*
|
|
334
|
-
* @template T -
|
|
128
|
+
* @template T - The schema type of the collection.
|
|
335
129
|
*/
|
|
336
|
-
export
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Creates a new `Database` instance with the provided schemas and storage module.
|
|
340
|
-
*
|
|
341
|
-
* @template TS - A record of schema types.
|
|
342
|
-
* @param {TS} schemas - The schemas to use for the collections.
|
|
343
|
-
* @param migrations
|
|
344
|
-
* @param plugins
|
|
345
|
-
* @param options
|
|
346
|
-
* @param password
|
|
347
|
-
* @returns {Promise<Database<TS>>} A promise that resolves to the created `Database` instance.
|
|
348
|
-
*/
|
|
349
|
-
static create<TS extends SchemaTypeRecord>(
|
|
350
|
-
db_name: string,
|
|
351
|
-
schemas: TS,
|
|
352
|
-
migrations: MigrationPathsForSchemas<TS> | MigrationPathsForSchema<TS[string]>,
|
|
353
|
-
plugins:Array<typeof BasePlugin>,
|
|
354
|
-
options: RIDBModule,
|
|
355
|
-
password?:string,
|
|
356
|
-
storage?: BaseStorage<TS>
|
|
357
|
-
): Promise<Database<TS>>;
|
|
358
|
-
|
|
359
|
-
authenticate(password: string): Promise<boolean>;
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* The collections in the database.
|
|
363
|
-
*
|
|
364
|
-
* This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
|
|
365
|
-
*/
|
|
366
|
-
readonly collections: {
|
|
367
|
-
[name in keyof T]: Collection<Schema<T[name]>>
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
readonly started: boolean;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Starts the database.
|
|
374
|
-
*
|
|
375
|
-
* @returns {Promise<void>} A promise that resolves when the database is started.
|
|
376
|
-
*/
|
|
377
|
-
start(): Promise<void>;
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Closes the database.
|
|
381
|
-
*
|
|
382
|
-
* @returns {Promise<void>} A promise that resolves when the database is closed.
|
|
383
|
-
*/
|
|
384
|
-
close(): Promise<void>;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Represents a function type for creating storage with the provided schema type records.
|
|
389
|
-
*
|
|
390
|
-
* @template T - The schema type record.
|
|
391
|
-
* @param {T} records - The schema type records.
|
|
392
|
-
* @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
|
|
393
|
-
*/
|
|
394
|
-
export type CreateStorage = <T extends SchemaTypeRecord>(
|
|
395
|
-
records: T
|
|
396
|
-
) => Promise<BaseStorage<T>>;
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Represents a storage module with a method for creating storage.
|
|
400
|
-
*/
|
|
401
|
-
export type RIDBModule = {
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Plugin constructors array
|
|
405
|
-
*/
|
|
406
|
-
apply: (plugins:Array<typeof BasePlugin>) => Array<BasePlugin>;
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
type Hook = (
|
|
412
|
-
schema: Schema<SchemaType>,
|
|
413
|
-
migration: MigrationPathsForSchema<SchemaType>,
|
|
414
|
-
doc: Doc<SchemaType>
|
|
415
|
-
) => Doc<SchemaType>
|
|
416
|
-
|
|
417
|
-
type BasePluginOptions = {
|
|
418
|
-
docCreateHook?: Hook,
|
|
419
|
-
docRecoverHook?: Hook
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
export class BasePlugin implements BasePluginOptions {
|
|
423
|
-
docCreateHook?:Hook;
|
|
424
|
-
docRecoverHook?:Hook;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
export class CoreStorage {
|
|
430
|
-
/**
|
|
431
|
-
* @param {any} document
|
|
432
|
-
* @param {Query} query
|
|
433
|
-
* @returns {boolean}
|
|
434
|
-
*/
|
|
435
|
-
matchesQuery(document: any, query: Query<any>): boolean;
|
|
436
|
-
getPrimaryKeyTyped(value: any): string | number;
|
|
437
|
-
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Represents an operation to be performed on a collection.
|
|
444
|
-
*
|
|
445
|
-
* @template T - The schema type of the collection.
|
|
446
|
-
*/
|
|
447
|
-
export type Operation<T extends SchemaType = SchemaType> = {
|
|
130
|
+
export type Operation<T extends SchemaType = SchemaType> = {
|
|
448
131
|
/**
|
|
449
132
|
* The name of the collection on which the operation will be performed.
|
|
450
133
|
*/
|
|
@@ -466,54 +149,6 @@ export type Operation<T extends SchemaType = SchemaType> = {
|
|
|
466
149
|
|
|
467
150
|
|
|
468
151
|
|
|
469
|
-
export type EnumerateUpTo<
|
|
470
|
-
N extends number,
|
|
471
|
-
Acc extends number[] = []
|
|
472
|
-
> = Acc['length'] extends N ?
|
|
473
|
-
Acc[number]:
|
|
474
|
-
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
475
|
-
|
|
476
|
-
export type EnumerateFrom1To<
|
|
477
|
-
N extends number
|
|
478
|
-
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
479
|
-
|
|
480
|
-
export type IsVersionGreaterThan0<
|
|
481
|
-
V extends number
|
|
482
|
-
> = V extends 0 ? false : true;
|
|
483
|
-
|
|
484
|
-
export type AnyVersionGreaterThan1<
|
|
485
|
-
T extends Record<string, SchemaType>
|
|
486
|
-
> = true extends {
|
|
487
|
-
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
488
|
-
} [keyof T] ? true : false;
|
|
489
|
-
|
|
490
|
-
export type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
491
|
-
|
|
492
|
-
export type MigrationPathsForSchema<
|
|
493
|
-
T extends SchemaType
|
|
494
|
-
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
495
|
-
{
|
|
496
|
-
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
export type MigrationPathsForSchemas<
|
|
500
|
-
T extends SchemaTypeRecord
|
|
501
|
-
> = {
|
|
502
|
-
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
export type MigrationsParameter<
|
|
506
|
-
T extends SchemaTypeRecord
|
|
507
|
-
> = AnyVersionGreaterThan1<T> extends true ?
|
|
508
|
-
{
|
|
509
|
-
migrations: MigrationPathsForSchemas<T>
|
|
510
|
-
}:
|
|
511
|
-
{
|
|
512
|
-
migrations?: never
|
|
513
|
-
};
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
152
|
export type InternalsRecord = {
|
|
518
153
|
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
519
154
|
};
|
|
@@ -613,6 +248,327 @@ export class Collection<T extends SchemaType> {
|
|
|
613
248
|
|
|
614
249
|
|
|
615
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Represents an in-memory storage system extending the base storage functionality.
|
|
253
|
+
*
|
|
254
|
+
* @template T - The schema type.
|
|
255
|
+
*/
|
|
256
|
+
export class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
257
|
+
/**
|
|
258
|
+
* Frees the resources used by the in-memory storage.
|
|
259
|
+
*/
|
|
260
|
+
free(): void;
|
|
261
|
+
|
|
262
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
263
|
+
dbName: string,
|
|
264
|
+
schemas: SchemasCreate,
|
|
265
|
+
): Promise<
|
|
266
|
+
InMemory<
|
|
267
|
+
SchemasCreate
|
|
268
|
+
>
|
|
269
|
+
>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
export type BaseStorageOptions = {
|
|
275
|
+
[name:string]:string | boolean | number
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
|
|
279
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
280
|
+
dbName: string,
|
|
281
|
+
schemas: SchemasCreate,
|
|
282
|
+
options?: BaseStorageOptions
|
|
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
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
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
|
+
/**
|
|
360
|
+
* Represents a property within a schema, including various constraints and nested properties.
|
|
361
|
+
*/
|
|
362
|
+
export class Property {
|
|
363
|
+
/**
|
|
364
|
+
* The type of the property.
|
|
365
|
+
*/
|
|
366
|
+
readonly type: string;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The version of the property, if applicable.
|
|
370
|
+
*/
|
|
371
|
+
readonly version?: number;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* The primary key of the property, if applicable.
|
|
375
|
+
*/
|
|
376
|
+
readonly primaryKey?: string;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* An optional array of nested properties for array-type properties.
|
|
380
|
+
*/
|
|
381
|
+
readonly items?: Property;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* The maximum number of items for array-type properties, if applicable.
|
|
385
|
+
*/
|
|
386
|
+
readonly maxItems?: number;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* The minimum number of items for array-type properties, if applicable.
|
|
390
|
+
*/
|
|
391
|
+
readonly minItems?: number;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* The maximum length for string-type properties, if applicable.
|
|
395
|
+
*/
|
|
396
|
+
readonly maxLength?: number;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* The minimum length for string-type properties, if applicable.
|
|
400
|
+
*/
|
|
401
|
+
readonly minLength?: number;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* An optional array of required fields for object-type properties.
|
|
405
|
+
*/
|
|
406
|
+
readonly required?: boolean;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* An optional default value for the property.
|
|
410
|
+
*/
|
|
411
|
+
readonly default?: any;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* An optional map of nested properties for object-type properties.
|
|
415
|
+
*/
|
|
416
|
+
readonly properties?: {
|
|
417
|
+
[name: string]: Property;
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Represents the type definition for a schema.
|
|
425
|
+
*/
|
|
426
|
+
export type SchemaType = {
|
|
427
|
+
/**
|
|
428
|
+
* The version of the schema.
|
|
429
|
+
*/
|
|
430
|
+
version: number;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* The primary key of the schema.
|
|
434
|
+
*/
|
|
435
|
+
primaryKey: string;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* The type of the schema.
|
|
439
|
+
*/
|
|
440
|
+
type: string;
|
|
441
|
+
indexes?: string[];
|
|
442
|
+
encrypted?: string[];
|
|
443
|
+
/**
|
|
444
|
+
* The properties defined in the schema.
|
|
445
|
+
*/
|
|
446
|
+
properties: {
|
|
447
|
+
[name: string]: Property;
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Represents a schema, including its definition and related methods.
|
|
454
|
+
* You may be trying to build a storage, in any other can u won't need access tho this class.
|
|
455
|
+
* Check this example
|
|
456
|
+
*
|
|
457
|
+
* ```typescript
|
|
458
|
+
* class MyStorage extends <T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
459
|
+
* example() {
|
|
460
|
+
* const schema: Schema<any> = this.getSchema("mySchema")
|
|
461
|
+
* }
|
|
462
|
+
* }
|
|
463
|
+
* ```
|
|
464
|
+
* You alwayswill have access to getSchema through the Storage class.
|
|
465
|
+
*
|
|
466
|
+
* @template T - The schema type.
|
|
467
|
+
*/
|
|
468
|
+
export class Schema<T extends SchemaType> {
|
|
469
|
+
/**
|
|
470
|
+
* The schema definition.
|
|
471
|
+
*/
|
|
472
|
+
schema: Schema<T>;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Creates a new `Schema` instance from the provided definition.
|
|
476
|
+
*
|
|
477
|
+
* @template TS - The schema type.
|
|
478
|
+
* @param {TS} defi, Debugnition - The schema definition.
|
|
479
|
+
* @returns {Schema<TS>} The created `Schema` instance.
|
|
480
|
+
*/
|
|
481
|
+
static create<TS extends SchemaType>(definition: TS): Schema<TS>;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* The version of the schema.
|
|
485
|
+
*/
|
|
486
|
+
readonly version: number;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* The primary key of the schema.
|
|
490
|
+
*/
|
|
491
|
+
readonly primaryKey: string;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* The type of the schema.
|
|
495
|
+
*/
|
|
496
|
+
readonly type: string;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* An optional array of indexes.
|
|
500
|
+
*/
|
|
501
|
+
/**
|
|
502
|
+
* An optional array of indexes.
|
|
503
|
+
*/
|
|
504
|
+
readonly indexes?: (Extract<keyof T, string>)[];
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* An optional array of encrypted fields.
|
|
508
|
+
*/
|
|
509
|
+
readonly encrypted?: (Extract<keyof T, string>)[];
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* The properties defined in the schema.
|
|
513
|
+
*/
|
|
514
|
+
readonly properties: {
|
|
515
|
+
[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];
|
|
516
|
+
} & {
|
|
517
|
+
[K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
|
|
518
|
+
};
|
|
519
|
+
/**
|
|
520
|
+
* Converts the schema to a JSON representation.
|
|
521
|
+
*
|
|
522
|
+
* @returns {SchemaType} The JSON representation of the schema.
|
|
523
|
+
*/
|
|
524
|
+
toJSON(): SchemaType;
|
|
525
|
+
|
|
526
|
+
validate(document: Doc<Schema<T>>): boolean;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Represents an IndexDB storage system extending the base storage functionality.
|
|
533
|
+
*
|
|
534
|
+
* @template T - The schema type.
|
|
535
|
+
*/
|
|
536
|
+
export class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
537
|
+
/**
|
|
538
|
+
* Frees the resources used by the in-memory storage.
|
|
539
|
+
*/
|
|
540
|
+
free(): void;
|
|
541
|
+
|
|
542
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
543
|
+
dbName: string,
|
|
544
|
+
schemas: SchemasCreate,
|
|
545
|
+
): Promise<
|
|
546
|
+
IndexDB<
|
|
547
|
+
SchemasCreate
|
|
548
|
+
>
|
|
549
|
+
>;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
type Hook = (
|
|
555
|
+
schema: Schema<SchemaType>,
|
|
556
|
+
migration: MigrationPathsForSchema<SchemaType>,
|
|
557
|
+
doc: Doc<SchemaType>
|
|
558
|
+
) => Doc<SchemaType>
|
|
559
|
+
|
|
560
|
+
type BasePluginOptions = {
|
|
561
|
+
docCreateHook?: Hook,
|
|
562
|
+
docRecoverHook?: Hook
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export class BasePlugin implements BasePluginOptions {
|
|
566
|
+
docCreateHook?:Hook;
|
|
567
|
+
docRecoverHook?:Hook;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
|
|
616
572
|
/**
|
|
617
573
|
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
618
574
|
*/
|
|
@@ -648,63 +604,107 @@ export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
|
648
604
|
|
|
649
605
|
|
|
650
606
|
/**
|
|
651
|
-
* Represents
|
|
607
|
+
* Represents a database containing collections of documents.
|
|
608
|
+
* RIDB extends from this class and is used to expose collections.
|
|
609
|
+
*
|
|
610
|
+
* So if you specify:
|
|
611
|
+
* ```typescript
|
|
612
|
+
* const db = new RIDB(
|
|
613
|
+
* {
|
|
614
|
+
* schemas: {
|
|
615
|
+
* demo: {
|
|
616
|
+
* version: 0,
|
|
617
|
+
* primaryKey: 'id',
|
|
618
|
+
* type: SchemaFieldType.object,
|
|
619
|
+
* properties: {
|
|
620
|
+
* id: {
|
|
621
|
+
* type: SchemaFieldType.string,
|
|
622
|
+
* maxLength: 60
|
|
623
|
+
* }
|
|
624
|
+
* }
|
|
625
|
+
* }
|
|
626
|
+
* } as const
|
|
627
|
+
* }
|
|
628
|
+
* )
|
|
629
|
+
* ```
|
|
630
|
+
*
|
|
631
|
+
* The collection will be available as `db.collections.demo` and all the methods for the collection (find, count, findById, update, create, delete) will be available.
|
|
652
632
|
*
|
|
653
|
-
* @template T -
|
|
633
|
+
* @template T - A record of schema types.
|
|
654
634
|
*/
|
|
655
|
-
export class
|
|
635
|
+
export class Database<T extends SchemaTypeRecord> {
|
|
636
|
+
|
|
656
637
|
/**
|
|
657
|
-
*
|
|
638
|
+
* Creates a new `Database` instance with the provided schemas and storage module.
|
|
639
|
+
*
|
|
640
|
+
* @template TS - A record of schema types.
|
|
641
|
+
* @param {TS} schemas - The schemas to use for the collections.
|
|
642
|
+
* @param migrations
|
|
643
|
+
* @param plugins
|
|
644
|
+
* @param options
|
|
645
|
+
* @param password
|
|
646
|
+
* @returns {Promise<Database<TS>>} A promise that resolves to the created `Database` instance.
|
|
658
647
|
*/
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
>;
|
|
669
|
-
}
|
|
648
|
+
static create<TS extends SchemaTypeRecord>(
|
|
649
|
+
db_name: string,
|
|
650
|
+
schemas: TS,
|
|
651
|
+
migrations: MigrationPathsForSchemas<TS> | MigrationPathsForSchema<TS[string]>,
|
|
652
|
+
plugins:Array<typeof BasePlugin>,
|
|
653
|
+
options: RIDBModule,
|
|
654
|
+
password?:string,
|
|
655
|
+
storage?: BaseStorage<TS>
|
|
656
|
+
): Promise<Database<TS>>;
|
|
670
657
|
|
|
658
|
+
authenticate(password: string): Promise<boolean>;
|
|
671
659
|
|
|
660
|
+
/**
|
|
661
|
+
* The collections in the database.
|
|
662
|
+
*
|
|
663
|
+
* This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
|
|
664
|
+
*/
|
|
665
|
+
readonly collections: {
|
|
666
|
+
[name in keyof T]: Collection<Schema<T[name]>>
|
|
667
|
+
}
|
|
672
668
|
|
|
673
|
-
|
|
674
|
-
[name:string]:string | boolean | number
|
|
675
|
-
}
|
|
669
|
+
readonly started: boolean;
|
|
676
670
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
): Promise<
|
|
683
|
-
BaseStorage<
|
|
684
|
-
SchemasCreate
|
|
685
|
-
>
|
|
686
|
-
>;
|
|
687
|
-
constructor(
|
|
688
|
-
dbName: string,
|
|
689
|
-
schemas: Schemas,
|
|
690
|
-
options?: BaseStorageOptions
|
|
691
|
-
);
|
|
692
|
-
readonly dbName: string;
|
|
693
|
-
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
694
|
-
readonly options: BaseStorageOptions;
|
|
695
|
-
readonly core: CoreStorage;
|
|
671
|
+
/**
|
|
672
|
+
* Starts the database.
|
|
673
|
+
*
|
|
674
|
+
* @returns {Promise<void>} A promise that resolves when the database is started.
|
|
675
|
+
*/
|
|
696
676
|
start(): Promise<void>;
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Closes the database.
|
|
680
|
+
*
|
|
681
|
+
* @returns {Promise<void>} A promise that resolves when the database is closed.
|
|
682
|
+
*/
|
|
697
683
|
close(): Promise<void>;
|
|
698
|
-
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<number>;
|
|
699
|
-
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
700
|
-
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
701
|
-
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
702
|
-
getOption(name: string): string | boolean | number | undefined;
|
|
703
|
-
getSchema(name: string): Schema<any>;
|
|
704
|
-
//Call addIndexSchemas if you need extra indexing schemas for your database
|
|
705
|
-
addIndexSchemas(): null
|
|
706
684
|
}
|
|
707
685
|
|
|
686
|
+
/**
|
|
687
|
+
* Represents a function type for creating storage with the provided schema type records.
|
|
688
|
+
*
|
|
689
|
+
* @template T - The schema type record.
|
|
690
|
+
* @param {T} records - The schema type records.
|
|
691
|
+
* @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
|
|
692
|
+
*/
|
|
693
|
+
export type CreateStorage = <T extends SchemaTypeRecord>(
|
|
694
|
+
records: T
|
|
695
|
+
) => Promise<BaseStorage<T>>;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Represents a storage module with a method for creating storage.
|
|
699
|
+
*/
|
|
700
|
+
export type RIDBModule = {
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Plugin constructors array
|
|
704
|
+
*/
|
|
705
|
+
apply: (plugins:Array<typeof BasePlugin>) => Array<BasePlugin>;
|
|
706
|
+
};
|
|
707
|
+
|
|
708
708
|
|
|
709
709
|
/**
|
|
710
710
|
*/
|
|
@@ -817,41 +817,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
817
817
|
|
|
818
818
|
export interface InitOutput {
|
|
819
819
|
readonly memory: WebAssembly.Memory;
|
|
820
|
-
readonly __wbg_property_free: (a: number) => void;
|
|
821
|
-
readonly property_is_valid: (a: number, b: number) => void;
|
|
822
|
-
readonly property_type: (a: number) => number;
|
|
823
|
-
readonly property_items: (a: number, b: number) => void;
|
|
824
|
-
readonly property_maxItems: (a: number, b: number) => void;
|
|
825
|
-
readonly property_minItems: (a: number, b: number) => void;
|
|
826
|
-
readonly property_maxLength: (a: number, b: number) => void;
|
|
827
|
-
readonly property_minLength: (a: number, b: number) => void;
|
|
828
|
-
readonly property_properties: (a: number, b: number) => void;
|
|
829
|
-
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
830
|
-
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
831
|
-
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
832
|
-
readonly __wbg_schema_free: (a: number) => void;
|
|
833
|
-
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
834
|
-
readonly schema_is_valid: (a: number, b: number) => void;
|
|
835
|
-
readonly schema_create: (a: number, b: number) => void;
|
|
836
|
-
readonly schema_version: (a: number) => number;
|
|
837
|
-
readonly schema_primaryKey: (a: number, b: number) => void;
|
|
838
|
-
readonly schema_type: (a: number, b: number) => void;
|
|
839
|
-
readonly schema_indexes: (a: number, b: number) => void;
|
|
840
|
-
readonly schema_encrypted: (a: number, b: number) => void;
|
|
841
|
-
readonly schema_properties: (a: number, b: number) => void;
|
|
842
|
-
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
843
|
-
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
844
|
-
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
845
|
-
readonly __wbg_indexdb_free: (a: number) => void;
|
|
846
|
-
readonly indexdb_get_stores: (a: number, b: number) => void;
|
|
847
|
-
readonly indexdb_get_store: (a: number, b: number, c: number, d: number) => void;
|
|
848
|
-
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
849
|
-
readonly indexdb_write: (a: number, b: number) => number;
|
|
850
|
-
readonly indexdb_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
851
|
-
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
852
|
-
readonly indexdb_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
853
|
-
readonly indexdb_close: (a: number) => number;
|
|
854
|
-
readonly indexdb_start: (a: number) => number;
|
|
855
820
|
readonly __wbg_query_free: (a: number) => void;
|
|
856
821
|
readonly query_new: (a: number, b: number, c: number) => void;
|
|
857
822
|
readonly query_query: (a: number, b: number) => void;
|
|
@@ -888,32 +853,6 @@ export interface InitOutput {
|
|
|
888
853
|
readonly __wbgt_test_query_parse_eq_operator_wrong_type_32: (a: number) => void;
|
|
889
854
|
readonly __wbgt_test_query_parse_ne_operator_33: (a: number) => void;
|
|
890
855
|
readonly __wbgt_test_query_parse_ne_operator_wrong_type_34: (a: number) => void;
|
|
891
|
-
readonly __wbg_ridberror_free: (a: number) => void;
|
|
892
|
-
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
893
|
-
readonly ridberror_type: (a: number, b: number) => void;
|
|
894
|
-
readonly ridberror_code: (a: number) => number;
|
|
895
|
-
readonly ridberror_message: (a: number, b: number) => void;
|
|
896
|
-
readonly ridberror_from: (a: number) => number;
|
|
897
|
-
readonly ridberror_error: (a: number, b: number, c: number) => number;
|
|
898
|
-
readonly ridberror_query: (a: number, b: number, c: number) => number;
|
|
899
|
-
readonly ridberror_authentication: (a: number, b: number, c: number) => number;
|
|
900
|
-
readonly ridberror_serialisation: (a: number, b: number, c: number) => number;
|
|
901
|
-
readonly ridberror_validation: (a: number, b: number, c: number) => number;
|
|
902
|
-
readonly ridberror_hook: (a: number, b: number, c: number) => number;
|
|
903
|
-
readonly __wbg_database_free: (a: number) => void;
|
|
904
|
-
readonly database_start: (a: number) => number;
|
|
905
|
-
readonly database_close: (a: number) => number;
|
|
906
|
-
readonly database_started: (a: number) => number;
|
|
907
|
-
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
908
|
-
readonly database_collections: (a: number, b: number) => void;
|
|
909
|
-
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
910
|
-
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
911
|
-
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
912
|
-
readonly baseplugin_name: (a: number) => number;
|
|
913
|
-
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
914
|
-
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
915
|
-
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
916
|
-
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
917
856
|
readonly corestorage_new: () => number;
|
|
918
857
|
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
919
858
|
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -955,6 +894,67 @@ export interface InitOutput {
|
|
|
955
894
|
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
956
895
|
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
957
896
|
readonly basestorage_core: (a: number, b: number) => void;
|
|
897
|
+
readonly __wbg_property_free: (a: number) => void;
|
|
898
|
+
readonly property_is_valid: (a: number, b: number) => void;
|
|
899
|
+
readonly property_type: (a: number) => number;
|
|
900
|
+
readonly property_items: (a: number, b: number) => void;
|
|
901
|
+
readonly property_maxItems: (a: number, b: number) => void;
|
|
902
|
+
readonly property_minItems: (a: number, b: number) => void;
|
|
903
|
+
readonly property_maxLength: (a: number, b: number) => void;
|
|
904
|
+
readonly property_minLength: (a: number, b: number) => void;
|
|
905
|
+
readonly property_properties: (a: number, b: number) => void;
|
|
906
|
+
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
907
|
+
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
908
|
+
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
909
|
+
readonly __wbg_schema_free: (a: number) => void;
|
|
910
|
+
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
911
|
+
readonly schema_is_valid: (a: number, b: number) => void;
|
|
912
|
+
readonly schema_create: (a: number, b: number) => void;
|
|
913
|
+
readonly schema_version: (a: number) => number;
|
|
914
|
+
readonly schema_primaryKey: (a: number, b: number) => void;
|
|
915
|
+
readonly schema_type: (a: number, b: number) => void;
|
|
916
|
+
readonly schema_indexes: (a: number, b: number) => void;
|
|
917
|
+
readonly schema_encrypted: (a: number, b: number) => void;
|
|
918
|
+
readonly schema_properties: (a: number, b: number) => void;
|
|
919
|
+
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
920
|
+
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
921
|
+
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
922
|
+
readonly __wbg_indexdb_free: (a: number) => void;
|
|
923
|
+
readonly indexdb_get_stores: (a: number, b: number) => void;
|
|
924
|
+
readonly indexdb_get_store: (a: number, b: number, c: number, d: number) => void;
|
|
925
|
+
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
926
|
+
readonly indexdb_write: (a: number, b: number) => number;
|
|
927
|
+
readonly indexdb_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
928
|
+
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
929
|
+
readonly indexdb_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
930
|
+
readonly indexdb_close: (a: number) => number;
|
|
931
|
+
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
|
+
readonly __wbg_ridberror_free: (a: number) => void;
|
|
940
|
+
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
941
|
+
readonly ridberror_type: (a: number, b: number) => void;
|
|
942
|
+
readonly ridberror_code: (a: number) => number;
|
|
943
|
+
readonly ridberror_message: (a: number, b: number) => void;
|
|
944
|
+
readonly ridberror_from: (a: number) => number;
|
|
945
|
+
readonly ridberror_error: (a: number, b: number, c: number) => number;
|
|
946
|
+
readonly ridberror_query: (a: number, b: number, c: number) => number;
|
|
947
|
+
readonly ridberror_authentication: (a: number, b: number, c: number) => number;
|
|
948
|
+
readonly ridberror_serialisation: (a: number, b: number, c: number) => number;
|
|
949
|
+
readonly ridberror_validation: (a: number, b: number, c: number) => number;
|
|
950
|
+
readonly ridberror_hook: (a: number, b: number, c: number) => number;
|
|
951
|
+
readonly __wbg_database_free: (a: number) => void;
|
|
952
|
+
readonly database_start: (a: number) => number;
|
|
953
|
+
readonly database_close: (a: number) => number;
|
|
954
|
+
readonly database_started: (a: number) => number;
|
|
955
|
+
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
956
|
+
readonly database_collections: (a: number, b: number) => void;
|
|
957
|
+
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
958
958
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
959
959
|
readonly wasmbindgentestcontext_new: () => number;
|
|
960
960
|
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
|
@@ -967,16 +967,16 @@ export interface InitOutput {
|
|
|
967
967
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
968
968
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
969
969
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
970
|
-
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7b5749f7e109cebe: (a: number, b: number, c: number) => number;
|
|
971
|
-
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf7f5c1429da4fe71: (a: number, b: number, c: number) => void;
|
|
972
970
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
973
|
-
readonly
|
|
974
|
-
readonly
|
|
971
|
+
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbbd70d909398e1ba: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
972
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc5f5145da16b26e4: (a: number, b: number, c: number) => number;
|
|
973
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbe98bae341e12bb6: (a: number, b: number, c: number) => void;
|
|
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;
|
|
975
975
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
976
976
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
977
|
-
readonly
|
|
978
|
-
readonly
|
|
979
|
-
readonly
|
|
977
|
+
readonly wasm_bindgen__convert__closures__invoke0_mut__h84bd533389574f4d: (a: number, b: number) => void;
|
|
978
|
+
readonly wasm_bindgen__convert__closures__invoke3_mut__h3608a0bbf7229368: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
979
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h0b860a6b6d5d8826: (a: number, b: number, c: number, d: number) => void;
|
|
980
980
|
readonly __wbindgen_start: () => void;
|
|
981
981
|
}
|
|
982
982
|
|