@trust0/ridb-core 1.7.26 → 1.7.27
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 +501 -501
- package/build/ridb_core.js +73 -65
- package/build/ridb_core.mjs +73 -65
- package/build/ridb_core_bg.mjs +1 -1
- package/package.json +1 -1
package/build/ridb_core.d.ts
CHANGED
|
@@ -73,150 +73,199 @@ declare enum Errors {
|
|
|
73
73
|
AuthenticationError = 5,
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Represents a property within a schema, including various constraints and nested properties.
|
|
78
|
+
*/
|
|
79
|
+
declare class Property {
|
|
77
80
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
*/
|
|
82
|
-
matchesQuery(document: any, query: Query<any>): boolean;
|
|
83
|
-
getPrimaryKeyTyped(value: any): string | number;
|
|
84
|
-
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
85
|
-
}
|
|
81
|
+
* The type of the property.
|
|
82
|
+
*/
|
|
83
|
+
readonly type: SchemaFieldType;
|
|
86
84
|
|
|
85
|
+
/**
|
|
86
|
+
* The version of the property, if applicable.
|
|
87
|
+
*/
|
|
88
|
+
readonly version?: number;
|
|
87
89
|
|
|
90
|
+
/**
|
|
91
|
+
* The primary key of the property, if applicable.
|
|
92
|
+
*/
|
|
93
|
+
readonly primaryKey?: string;
|
|
88
94
|
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
* So if you specify:
|
|
94
|
-
* ```typescript
|
|
95
|
-
* const db = new RIDB(
|
|
96
|
-
* {
|
|
97
|
-
* schemas: {
|
|
98
|
-
* demo: {
|
|
99
|
-
* version: 0,
|
|
100
|
-
* primaryKey: 'id',
|
|
101
|
-
* type: SchemaFieldType.object,
|
|
102
|
-
* properties: {
|
|
103
|
-
* id: {
|
|
104
|
-
* type: SchemaFieldType.string,
|
|
105
|
-
* maxLength: 60
|
|
106
|
-
* }
|
|
107
|
-
* }
|
|
108
|
-
* }
|
|
109
|
-
* } as const
|
|
110
|
-
* }
|
|
111
|
-
* )
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* 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.
|
|
115
|
-
*
|
|
116
|
-
* @template T - A record of schema types.
|
|
117
|
-
*/
|
|
118
|
-
declare class Database<T extends SchemaTypeRecord> {
|
|
95
|
+
/**
|
|
96
|
+
* An optional array of nested properties for array-type properties.
|
|
97
|
+
*/
|
|
98
|
+
readonly items?: Property;
|
|
119
99
|
|
|
120
100
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* @template TS - A record of schema types.
|
|
124
|
-
* @param {TS} schemas - The schemas to use for the collections.
|
|
125
|
-
* @param migrations
|
|
126
|
-
* @param plugins
|
|
127
|
-
* @param options
|
|
128
|
-
* @param password
|
|
129
|
-
* @returns {Promise<Database<TS>>} A promise that resolves to the created `Database` instance.
|
|
101
|
+
* The maximum number of items for array-type properties, if applicable.
|
|
130
102
|
*/
|
|
131
|
-
|
|
132
|
-
db_name: string,
|
|
133
|
-
schemas: TS,
|
|
134
|
-
migrations: MigrationPathsForSchemas<TS> | MigrationPathsForSchema<TS[string]>,
|
|
135
|
-
plugins:Array<typeof BasePlugin>,
|
|
136
|
-
options: RIDBModule,
|
|
137
|
-
password?:string,
|
|
138
|
-
storage?: BaseStorage<TS>
|
|
139
|
-
): Promise<Database<TS>>;
|
|
103
|
+
readonly maxItems?: number;
|
|
140
104
|
|
|
141
|
-
|
|
105
|
+
/**
|
|
106
|
+
* The minimum number of items for array-type properties, if applicable.
|
|
107
|
+
*/
|
|
108
|
+
readonly minItems?: number;
|
|
142
109
|
|
|
143
110
|
/**
|
|
144
|
-
* The
|
|
145
|
-
*
|
|
146
|
-
* This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
|
|
111
|
+
* The maximum length for string-type properties, if applicable.
|
|
147
112
|
*/
|
|
148
|
-
readonly
|
|
149
|
-
[name in keyof T]: Collection<Schema<T[name]>>
|
|
150
|
-
}
|
|
113
|
+
readonly maxLength?: number;
|
|
151
114
|
|
|
152
|
-
|
|
115
|
+
/**
|
|
116
|
+
* The minimum length for string-type properties, if applicable.
|
|
117
|
+
*/
|
|
118
|
+
readonly minLength?: number;
|
|
153
119
|
|
|
154
120
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @returns {Promise<void>} A promise that resolves when the database is started.
|
|
121
|
+
* An optional array of required fields for object-type properties.
|
|
158
122
|
*/
|
|
159
|
-
|
|
123
|
+
readonly required?: boolean;
|
|
160
124
|
|
|
161
125
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* @returns {Promise<void>} A promise that resolves when the database is closed.
|
|
126
|
+
* An optional default value for the property.
|
|
165
127
|
*/
|
|
166
|
-
|
|
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
|
+
};
|
|
167
136
|
}
|
|
168
137
|
|
|
169
|
-
|
|
170
|
-
* Represents a function type for creating storage with the provided schema type records.
|
|
171
|
-
*
|
|
172
|
-
* @template T - The schema type record.
|
|
173
|
-
* @param {T} records - The schema type records.
|
|
174
|
-
* @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
|
|
175
|
-
*/
|
|
176
|
-
type CreateStorage = <T extends SchemaTypeRecord>(
|
|
177
|
-
records: T
|
|
178
|
-
) => Promise<BaseStorage<T>>;
|
|
138
|
+
|
|
179
139
|
|
|
180
140
|
/**
|
|
181
|
-
* Represents
|
|
141
|
+
* Represents an IndexDB storage system extending the base storage functionality.
|
|
142
|
+
*
|
|
143
|
+
* @template T - The schema type.
|
|
182
144
|
*/
|
|
183
|
-
|
|
184
|
-
|
|
145
|
+
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
185
146
|
/**
|
|
186
|
-
*
|
|
147
|
+
* Frees the resources used by the in-memory storage.
|
|
187
148
|
*/
|
|
188
|
-
|
|
189
|
-
|
|
149
|
+
free(): void;
|
|
150
|
+
|
|
151
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
152
|
+
dbName: string,
|
|
153
|
+
schemas: SchemasCreate,
|
|
154
|
+
): Promise<
|
|
155
|
+
IndexDB<
|
|
156
|
+
SchemasCreate
|
|
157
|
+
>
|
|
158
|
+
>;
|
|
159
|
+
}
|
|
190
160
|
|
|
191
161
|
|
|
192
162
|
|
|
193
163
|
/**
|
|
194
|
-
* Represents an
|
|
164
|
+
* Represents an in-memory storage system extending the base storage functionality.
|
|
195
165
|
*
|
|
196
|
-
* @template T - The schema type
|
|
166
|
+
* @template T - The schema type.
|
|
197
167
|
*/
|
|
198
|
-
|
|
168
|
+
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
199
169
|
/**
|
|
200
|
-
*
|
|
170
|
+
* Frees the resources used by the in-memory storage.
|
|
201
171
|
*/
|
|
202
|
-
|
|
172
|
+
free(): void;
|
|
203
173
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
174
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
175
|
+
dbName: string,
|
|
176
|
+
schemas: SchemasCreate,
|
|
177
|
+
): Promise<
|
|
178
|
+
InMemory<
|
|
179
|
+
SchemasCreate
|
|
180
|
+
>
|
|
181
|
+
>;
|
|
182
|
+
}
|
|
208
183
|
|
|
209
|
-
/**
|
|
210
|
-
* The data involved in the operation, conforming to the schema type.
|
|
211
|
-
*/
|
|
212
|
-
data: Doc<T>,
|
|
213
184
|
|
|
214
|
-
|
|
215
|
-
|
|
185
|
+
|
|
186
|
+
type Hook = (
|
|
187
|
+
schema: Schema<SchemaType>,
|
|
188
|
+
migration: MigrationPathsForSchema<SchemaType>,
|
|
189
|
+
doc: Doc<SchemaType>
|
|
190
|
+
) => Doc<SchemaType>
|
|
191
|
+
|
|
192
|
+
type BasePluginOptions = {
|
|
193
|
+
docCreateHook?: Hook,
|
|
194
|
+
docRecoverHook?: Hook
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
declare class BasePlugin implements BasePluginOptions {
|
|
198
|
+
docCreateHook?:Hook;
|
|
199
|
+
docRecoverHook?:Hook;
|
|
216
200
|
}
|
|
217
201
|
|
|
218
202
|
|
|
219
203
|
|
|
204
|
+
type Operators<T> = {
|
|
205
|
+
$gte?: number,
|
|
206
|
+
$gt?: number
|
|
207
|
+
$lt?: number,
|
|
208
|
+
$lte?: number,
|
|
209
|
+
$eq?: T,
|
|
210
|
+
$ne?: T
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
type InOperator<T> = { $in?: T[] };
|
|
214
|
+
type NInOperator<T> = { $nin?: T[] };
|
|
215
|
+
|
|
216
|
+
type OperatorOrType<T> = T extends number ?
|
|
217
|
+
T | Operators<T> | InOperator<T> | NInOperator<T> :
|
|
218
|
+
T | InOperator<T> | NInOperator<T>;
|
|
219
|
+
|
|
220
|
+
type LogicalOperators<T extends SchemaType> = {
|
|
221
|
+
$and?: Partial<QueryType<T>>[];
|
|
222
|
+
$or?: Partial<QueryType<T>>[];
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
type QueryType<T extends SchemaType> = ({
|
|
226
|
+
[K in keyof T['properties']as ExtractType<T['properties'][K]['type']> extends undefined ? never : K]?: OperatorOrType<
|
|
227
|
+
ExtractType<
|
|
228
|
+
T['properties'][K]['type']
|
|
229
|
+
>
|
|
230
|
+
>
|
|
231
|
+
} & LogicalOperators<T>) | LogicalOperators<T>[];
|
|
232
|
+
|
|
233
|
+
declare class Query<T extends SchemaType> {
|
|
234
|
+
constructor(query: QueryType<T>, schema:Schema<T>);
|
|
235
|
+
readonly query: QueryType<T>;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
declare const SchemaFieldType = {
|
|
241
|
+
/**
|
|
242
|
+
* String type for text data
|
|
243
|
+
*/
|
|
244
|
+
string: 'string' as const,
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Number type for numeric data (integers and floats)
|
|
248
|
+
*/
|
|
249
|
+
number: 'number' as const,
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Boolean type for true/false values
|
|
253
|
+
*/
|
|
254
|
+
boolean: 'boolean' as const,
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Array type for ordered collections of items
|
|
258
|
+
*/
|
|
259
|
+
array: 'array' as const,
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Object type for nested document structures
|
|
263
|
+
*/
|
|
264
|
+
object: 'object' as const,
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
220
269
|
type InternalsRecord = {
|
|
221
270
|
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
222
271
|
};
|
|
@@ -336,302 +385,147 @@ declare class Collection<T extends SchemaType> {
|
|
|
336
385
|
|
|
337
386
|
|
|
338
387
|
|
|
339
|
-
|
|
340
|
-
[name:string]:string | boolean | number
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
declare class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
|
|
344
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
345
|
-
dbName: string,
|
|
346
|
-
schemas: SchemasCreate,
|
|
347
|
-
options?: BaseStorageOptions
|
|
348
|
-
): Promise<
|
|
349
|
-
BaseStorage<
|
|
350
|
-
SchemasCreate
|
|
351
|
-
>
|
|
352
|
-
>;
|
|
353
|
-
constructor(
|
|
354
|
-
dbName: string,
|
|
355
|
-
schemas: Schemas,
|
|
356
|
-
options?: BaseStorageOptions
|
|
357
|
-
);
|
|
358
|
-
readonly dbName: string;
|
|
359
|
-
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
360
|
-
readonly options: BaseStorageOptions;
|
|
361
|
-
readonly core: CoreStorage;
|
|
362
|
-
start(): Promise<void>;
|
|
363
|
-
close(): Promise<void>;
|
|
364
|
-
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<number>;
|
|
365
|
-
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
366
|
-
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
367
|
-
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
368
|
-
getOption(name: string): string | boolean | number | undefined;
|
|
369
|
-
getSchema(name: string): Schema<any>;
|
|
370
|
-
//Call addIndexSchemas if you need extra indexing schemas for your database
|
|
371
|
-
addIndexSchemas(): null
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
type Operators<T> = {
|
|
377
|
-
$gte?: number,
|
|
378
|
-
$gt?: number
|
|
379
|
-
$lt?: number,
|
|
380
|
-
$lte?: number,
|
|
381
|
-
$eq?: T,
|
|
382
|
-
$ne?: T
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
type InOperator<T> = { $in?: T[] };
|
|
386
|
-
type NInOperator<T> = { $nin?: T[] };
|
|
387
|
-
|
|
388
|
-
type OperatorOrType<T> = T extends number ?
|
|
389
|
-
T | Operators<T> | InOperator<T> | NInOperator<T> :
|
|
390
|
-
T | InOperator<T> | NInOperator<T>;
|
|
391
|
-
|
|
392
|
-
type LogicalOperators<T extends SchemaType> = {
|
|
393
|
-
$and?: Partial<QueryType<T>>[];
|
|
394
|
-
$or?: Partial<QueryType<T>>[];
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
type QueryType<T extends SchemaType> = ({
|
|
398
|
-
[K in keyof T['properties']as ExtractType<T['properties'][K]['type']> extends undefined ? never : K]?: OperatorOrType<
|
|
399
|
-
ExtractType<
|
|
400
|
-
T['properties'][K]['type']
|
|
401
|
-
>
|
|
402
|
-
>
|
|
403
|
-
} & LogicalOperators<T>) | LogicalOperators<T>[];
|
|
404
|
-
|
|
405
|
-
declare class Query<T extends SchemaType> {
|
|
406
|
-
constructor(query: QueryType<T>, schema:Schema<T>);
|
|
407
|
-
readonly query: QueryType<T>;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Represents the type definition for a schema.
|
|
414
|
-
*/
|
|
415
|
-
type SchemaType = {
|
|
416
|
-
/**
|
|
417
|
-
* The version of the schema.
|
|
418
|
-
*/
|
|
419
|
-
version: number;
|
|
420
|
-
|
|
388
|
+
declare class CoreStorage {
|
|
421
389
|
/**
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
390
|
+
* @param {any} document
|
|
391
|
+
* @param {Query} query
|
|
392
|
+
* @returns {boolean}
|
|
393
|
+
*/
|
|
394
|
+
matchesQuery(document: any, query: Query<any>): boolean;
|
|
395
|
+
getPrimaryKeyTyped(value: any): string | number;
|
|
396
|
+
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
397
|
+
}
|
|
425
398
|
|
|
426
|
-
/**
|
|
427
|
-
* The type of the schema.
|
|
428
|
-
*/
|
|
429
|
-
type: SchemaFieldType;
|
|
430
|
-
indexes?: string[];
|
|
431
|
-
encrypted?: string[];
|
|
432
|
-
/**
|
|
433
|
-
* The properties defined in the schema.
|
|
434
|
-
*/
|
|
435
|
-
properties: {
|
|
436
|
-
[name: string]: Property;
|
|
437
|
-
};
|
|
438
|
-
};
|
|
439
399
|
|
|
440
400
|
|
|
441
401
|
/**
|
|
442
|
-
* Represents
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
* ```typescript
|
|
447
|
-
* class MyStorage extends <T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
448
|
-
* example() {
|
|
449
|
-
* const schema: Schema<any> = this.getSchema("mySchema")
|
|
450
|
-
* }
|
|
451
|
-
* }
|
|
452
|
-
* ```
|
|
453
|
-
* You alwayswill have access to getSchema through the Storage class.
|
|
454
|
-
*
|
|
455
|
-
* @template T - The schema type.
|
|
402
|
+
* Represents an operation to be performed on a collection.
|
|
403
|
+
*
|
|
404
|
+
* @template T - The schema type of the collection.
|
|
456
405
|
*/
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* The schema definition.
|
|
460
|
-
*/
|
|
461
|
-
schema: Schema<T>;
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* Creates a new `Schema` instance from the provided definition.
|
|
465
|
-
*
|
|
466
|
-
* @template TS - The schema type.
|
|
467
|
-
* @param {TS} defi, Debugnition - The schema definition.
|
|
468
|
-
* @returns {Schema<TS>} The created `Schema` instance.
|
|
469
|
-
*/
|
|
470
|
-
static create<TS extends SchemaType>(definition: TS): Schema<TS>;
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* The version of the schema.
|
|
474
|
-
*/
|
|
475
|
-
readonly version: number;
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* The primary key of the schema.
|
|
479
|
-
*/
|
|
480
|
-
readonly primaryKey: string;
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* The type of the schema.
|
|
484
|
-
*/
|
|
485
|
-
readonly type: SchemaFieldType;
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* An optional array of indexes.
|
|
489
|
-
*/
|
|
490
|
-
/**
|
|
491
|
-
* An optional array of indexes.
|
|
492
|
-
*/
|
|
493
|
-
readonly indexes?: (Extract<keyof T, string>)[];
|
|
494
|
-
|
|
406
|
+
type Operation<T extends SchemaType = SchemaType> = {
|
|
495
407
|
/**
|
|
496
|
-
*
|
|
408
|
+
* The name of the collection on which the operation will be performed.
|
|
497
409
|
*/
|
|
498
|
-
|
|
410
|
+
collection: string,
|
|
499
411
|
|
|
500
412
|
/**
|
|
501
|
-
* The
|
|
502
|
-
*/
|
|
503
|
-
|
|
504
|
-
[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];
|
|
505
|
-
} & {
|
|
506
|
-
[K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
|
|
507
|
-
};
|
|
508
|
-
/**
|
|
509
|
-
* Converts the schema to a JSON representation.
|
|
510
|
-
*
|
|
511
|
-
* @returns {SchemaType} The JSON representation of the schema.
|
|
512
|
-
*/
|
|
513
|
-
toJSON(): SchemaType;
|
|
514
|
-
|
|
515
|
-
validate(document: Doc<Schema<T>>): boolean;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
type EnumerateUpTo<
|
|
521
|
-
N extends number,
|
|
522
|
-
Acc extends number[] = []
|
|
523
|
-
> = Acc['length'] extends N ?
|
|
524
|
-
Acc[number]:
|
|
525
|
-
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
526
|
-
|
|
527
|
-
type EnumerateFrom1To<
|
|
528
|
-
N extends number
|
|
529
|
-
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
530
|
-
|
|
531
|
-
type IsVersionGreaterThan0<
|
|
532
|
-
V extends number
|
|
533
|
-
> = V extends 0 ? false : true;
|
|
534
|
-
|
|
535
|
-
type AnyVersionGreaterThan1<
|
|
536
|
-
T extends Record<string, SchemaType>
|
|
537
|
-
> = true extends {
|
|
538
|
-
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
539
|
-
} [keyof T] ? true : false;
|
|
540
|
-
|
|
541
|
-
type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
542
|
-
|
|
543
|
-
type MigrationPathsForSchema<
|
|
544
|
-
T extends SchemaType
|
|
545
|
-
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
546
|
-
{
|
|
547
|
-
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
type MigrationPathsForSchemas<
|
|
551
|
-
T extends SchemaTypeRecord
|
|
552
|
-
> = {
|
|
553
|
-
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
type MigrationsParameter<
|
|
557
|
-
T extends SchemaTypeRecord
|
|
558
|
-
> = AnyVersionGreaterThan1<T> extends true ?
|
|
559
|
-
{
|
|
560
|
-
migrations: MigrationPathsForSchemas<T>
|
|
561
|
-
}:
|
|
562
|
-
{
|
|
563
|
-
migrations?: never
|
|
564
|
-
};
|
|
413
|
+
* The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
|
|
414
|
+
*/
|
|
415
|
+
opType: OpType,
|
|
565
416
|
|
|
417
|
+
/**
|
|
418
|
+
* The data involved in the operation, conforming to the schema type.
|
|
419
|
+
*/
|
|
420
|
+
data: Doc<T>,
|
|
566
421
|
|
|
422
|
+
primaryKeyField?: string,
|
|
423
|
+
primaryKey?: string
|
|
424
|
+
}
|
|
567
425
|
|
|
568
|
-
type Hook = (
|
|
569
|
-
schema: Schema<SchemaType>,
|
|
570
|
-
migration: MigrationPathsForSchema<SchemaType>,
|
|
571
|
-
doc: Doc<SchemaType>
|
|
572
|
-
) => Doc<SchemaType>
|
|
573
426
|
|
|
574
|
-
type BasePluginOptions = {
|
|
575
|
-
docCreateHook?: Hook,
|
|
576
|
-
docRecoverHook?: Hook
|
|
577
|
-
}
|
|
578
427
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
428
|
+
/**
|
|
429
|
+
* Represents a database containing collections of documents.
|
|
430
|
+
* RIDB extends from this class and is used to expose collections.
|
|
431
|
+
*
|
|
432
|
+
* So if you specify:
|
|
433
|
+
* ```typescript
|
|
434
|
+
* const db = new RIDB(
|
|
435
|
+
* {
|
|
436
|
+
* schemas: {
|
|
437
|
+
* demo: {
|
|
438
|
+
* version: 0,
|
|
439
|
+
* primaryKey: 'id',
|
|
440
|
+
* type: SchemaFieldType.object,
|
|
441
|
+
* properties: {
|
|
442
|
+
* id: {
|
|
443
|
+
* type: SchemaFieldType.string,
|
|
444
|
+
* maxLength: 60
|
|
445
|
+
* }
|
|
446
|
+
* }
|
|
447
|
+
* }
|
|
448
|
+
* } as const
|
|
449
|
+
* }
|
|
450
|
+
* )
|
|
451
|
+
* ```
|
|
452
|
+
*
|
|
453
|
+
* 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.
|
|
454
|
+
*
|
|
455
|
+
* @template T - A record of schema types.
|
|
456
|
+
*/
|
|
457
|
+
declare class Database<T extends SchemaTypeRecord> {
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Creates a new `Database` instance with the provided schemas and storage module.
|
|
461
|
+
*
|
|
462
|
+
* @template TS - A record of schema types.
|
|
463
|
+
* @param {TS} schemas - The schemas to use for the collections.
|
|
464
|
+
* @param migrations
|
|
465
|
+
* @param plugins
|
|
466
|
+
* @param options
|
|
467
|
+
* @param password
|
|
468
|
+
* @returns {Promise<Database<TS>>} A promise that resolves to the created `Database` instance.
|
|
469
|
+
*/
|
|
470
|
+
static create<TS extends SchemaTypeRecord>(
|
|
471
|
+
db_name: string,
|
|
472
|
+
schemas: TS,
|
|
473
|
+
migrations: MigrationPathsForSchemas<TS> | MigrationPathsForSchema<TS[string]>,
|
|
474
|
+
plugins:Array<typeof BasePlugin>,
|
|
475
|
+
options: RIDBModule,
|
|
476
|
+
password?:string,
|
|
477
|
+
storage?: BaseStorage<TS>
|
|
478
|
+
): Promise<Database<TS>>;
|
|
583
479
|
|
|
480
|
+
authenticate(password: string): Promise<boolean>;
|
|
584
481
|
|
|
482
|
+
/**
|
|
483
|
+
* The collections in the database.
|
|
484
|
+
*
|
|
485
|
+
* This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
|
|
486
|
+
*/
|
|
487
|
+
readonly collections: {
|
|
488
|
+
[name in keyof T]: Collection<Schema<T[name]>>
|
|
489
|
+
}
|
|
585
490
|
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* String type for text data
|
|
589
|
-
*/
|
|
590
|
-
string: 'string' as const,
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Number type for numeric data (integers and floats)
|
|
594
|
-
*/
|
|
595
|
-
number: 'number' as const,
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Boolean type for true/false values
|
|
599
|
-
*/
|
|
600
|
-
boolean: 'boolean' as const,
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Array type for ordered collections of items
|
|
604
|
-
*/
|
|
605
|
-
array: 'array' as const,
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* Object type for nested document structures
|
|
609
|
-
*/
|
|
610
|
-
object: 'object' as const,
|
|
611
|
-
};
|
|
491
|
+
readonly started: boolean;
|
|
612
492
|
|
|
493
|
+
/**
|
|
494
|
+
* Starts the database.
|
|
495
|
+
*
|
|
496
|
+
* @returns {Promise<void>} A promise that resolves when the database is started.
|
|
497
|
+
*/
|
|
498
|
+
start(): Promise<void>;
|
|
613
499
|
|
|
500
|
+
/**
|
|
501
|
+
* Closes the database.
|
|
502
|
+
*
|
|
503
|
+
* @returns {Promise<void>} A promise that resolves when the database is closed.
|
|
504
|
+
*/
|
|
505
|
+
close(): Promise<void>;
|
|
506
|
+
}
|
|
614
507
|
|
|
615
508
|
/**
|
|
616
|
-
* Represents
|
|
509
|
+
* Represents a function type for creating storage with the provided schema type records.
|
|
617
510
|
*
|
|
618
|
-
* @template T - The schema type.
|
|
511
|
+
* @template T - The schema type record.
|
|
512
|
+
* @param {T} records - The schema type records.
|
|
513
|
+
* @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
|
|
619
514
|
*/
|
|
620
|
-
|
|
515
|
+
type CreateStorage = <T extends SchemaTypeRecord>(
|
|
516
|
+
records: T
|
|
517
|
+
) => Promise<BaseStorage<T>>;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Represents a storage module with a method for creating storage.
|
|
521
|
+
*/
|
|
522
|
+
type RIDBModule = {
|
|
523
|
+
|
|
621
524
|
/**
|
|
622
|
-
*
|
|
525
|
+
* Plugin constructors array
|
|
623
526
|
*/
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
627
|
-
dbName: string,
|
|
628
|
-
schemas: SchemasCreate,
|
|
629
|
-
): Promise<
|
|
630
|
-
InMemory<
|
|
631
|
-
SchemasCreate
|
|
632
|
-
>
|
|
633
|
-
>;
|
|
634
|
-
}
|
|
527
|
+
apply: (plugins:Array<typeof BasePlugin>) => Array<BasePlugin>;
|
|
528
|
+
};
|
|
635
529
|
|
|
636
530
|
|
|
637
531
|
|
|
@@ -670,92 +564,198 @@ declare abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
|
670
564
|
}
|
|
671
565
|
|
|
672
566
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
* @template T - The schema type.
|
|
677
|
-
*/
|
|
678
|
-
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
679
|
-
/**
|
|
680
|
-
* Frees the resources used by the in-memory storage.
|
|
681
|
-
*/
|
|
682
|
-
free(): void;
|
|
567
|
+
type BaseStorageOptions = {
|
|
568
|
+
[name:string]:string | boolean | number
|
|
569
|
+
}
|
|
683
570
|
|
|
571
|
+
declare class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
|
|
684
572
|
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
685
573
|
dbName: string,
|
|
686
574
|
schemas: SchemasCreate,
|
|
575
|
+
options?: BaseStorageOptions
|
|
687
576
|
): Promise<
|
|
688
|
-
|
|
577
|
+
BaseStorage<
|
|
689
578
|
SchemasCreate
|
|
690
579
|
>
|
|
691
580
|
>;
|
|
581
|
+
constructor(
|
|
582
|
+
dbName: string,
|
|
583
|
+
schemas: Schemas,
|
|
584
|
+
options?: BaseStorageOptions
|
|
585
|
+
);
|
|
586
|
+
readonly dbName: string;
|
|
587
|
+
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
588
|
+
readonly options: BaseStorageOptions;
|
|
589
|
+
readonly core: CoreStorage;
|
|
590
|
+
start(): Promise<void>;
|
|
591
|
+
close(): Promise<void>;
|
|
592
|
+
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<number>;
|
|
593
|
+
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
594
|
+
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
595
|
+
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
596
|
+
getOption(name: string): string | boolean | number | undefined;
|
|
597
|
+
getSchema(name: string): Schema<any>;
|
|
598
|
+
//Call addIndexSchemas if you need extra indexing schemas for your database
|
|
599
|
+
addIndexSchemas(): null
|
|
692
600
|
}
|
|
693
601
|
|
|
694
602
|
|
|
695
603
|
|
|
696
604
|
/**
|
|
697
|
-
* Represents
|
|
605
|
+
* Represents the type definition for a schema.
|
|
698
606
|
*/
|
|
699
|
-
|
|
607
|
+
type SchemaType = {
|
|
700
608
|
/**
|
|
701
|
-
* The
|
|
609
|
+
* The version of the schema.
|
|
702
610
|
*/
|
|
703
|
-
|
|
611
|
+
version: number;
|
|
704
612
|
|
|
705
613
|
/**
|
|
706
|
-
* The
|
|
614
|
+
* The primary key of the schema.
|
|
707
615
|
*/
|
|
708
|
-
|
|
616
|
+
primaryKey: string;
|
|
709
617
|
|
|
710
618
|
/**
|
|
711
|
-
* The
|
|
619
|
+
* The type of the schema.
|
|
712
620
|
*/
|
|
713
|
-
|
|
621
|
+
type: SchemaFieldType;
|
|
622
|
+
indexes?: string[];
|
|
623
|
+
encrypted?: string[];
|
|
624
|
+
/**
|
|
625
|
+
* The properties defined in the schema.
|
|
626
|
+
*/
|
|
627
|
+
properties: {
|
|
628
|
+
[name: string]: Property;
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Represents a schema, including its definition and related methods.
|
|
635
|
+
* You may be trying to build a storage, in any other can u won't need access tho this class.
|
|
636
|
+
* Check this example
|
|
637
|
+
*
|
|
638
|
+
* ```typescript
|
|
639
|
+
* class MyStorage extends <T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
640
|
+
* example() {
|
|
641
|
+
* const schema: Schema<any> = this.getSchema("mySchema")
|
|
642
|
+
* }
|
|
643
|
+
* }
|
|
644
|
+
* ```
|
|
645
|
+
* You alwayswill have access to getSchema through the Storage class.
|
|
646
|
+
*
|
|
647
|
+
* @template T - The schema type.
|
|
648
|
+
*/
|
|
649
|
+
declare class Schema<T extends SchemaType> {
|
|
650
|
+
/**
|
|
651
|
+
* The schema definition.
|
|
652
|
+
*/
|
|
653
|
+
schema: Schema<T>;
|
|
714
654
|
|
|
715
655
|
/**
|
|
716
|
-
*
|
|
656
|
+
* Creates a new `Schema` instance from the provided definition.
|
|
657
|
+
*
|
|
658
|
+
* @template TS - The schema type.
|
|
659
|
+
* @param {TS} defi, Debugnition - The schema definition.
|
|
660
|
+
* @returns {Schema<TS>} The created `Schema` instance.
|
|
717
661
|
*/
|
|
718
|
-
|
|
662
|
+
static create<TS extends SchemaType>(definition: TS): Schema<TS>;
|
|
719
663
|
|
|
720
664
|
/**
|
|
721
|
-
* The
|
|
665
|
+
* The version of the schema.
|
|
722
666
|
*/
|
|
723
|
-
readonly
|
|
667
|
+
readonly version: number;
|
|
724
668
|
|
|
725
669
|
/**
|
|
726
|
-
* The
|
|
670
|
+
* The primary key of the schema.
|
|
727
671
|
*/
|
|
728
|
-
readonly
|
|
672
|
+
readonly primaryKey: string;
|
|
729
673
|
|
|
730
674
|
/**
|
|
731
|
-
* The
|
|
675
|
+
* The type of the schema.
|
|
732
676
|
*/
|
|
733
|
-
readonly
|
|
677
|
+
readonly type: SchemaFieldType;
|
|
734
678
|
|
|
735
679
|
/**
|
|
736
|
-
*
|
|
680
|
+
* An optional array of indexes.
|
|
737
681
|
*/
|
|
738
|
-
readonly minLength?: number;
|
|
739
|
-
|
|
740
682
|
/**
|
|
741
|
-
* An optional array of
|
|
683
|
+
* An optional array of indexes.
|
|
742
684
|
*/
|
|
743
|
-
readonly
|
|
685
|
+
readonly indexes?: (Extract<keyof T, string>)[];
|
|
744
686
|
|
|
745
687
|
/**
|
|
746
|
-
* An optional
|
|
688
|
+
* An optional array of encrypted fields.
|
|
747
689
|
*/
|
|
748
|
-
readonly
|
|
690
|
+
readonly encrypted?: (Extract<keyof T, string>)[];
|
|
749
691
|
|
|
750
692
|
/**
|
|
751
|
-
*
|
|
693
|
+
* The properties defined in the schema.
|
|
752
694
|
*/
|
|
753
|
-
readonly properties
|
|
754
|
-
[
|
|
695
|
+
readonly properties: {
|
|
696
|
+
[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];
|
|
697
|
+
} & {
|
|
698
|
+
[K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
|
|
755
699
|
};
|
|
700
|
+
/**
|
|
701
|
+
* Converts the schema to a JSON representation.
|
|
702
|
+
*
|
|
703
|
+
* @returns {SchemaType} The JSON representation of the schema.
|
|
704
|
+
*/
|
|
705
|
+
toJSON(): SchemaType;
|
|
706
|
+
|
|
707
|
+
validate(document: Doc<Schema<T>>): boolean;
|
|
756
708
|
}
|
|
757
709
|
|
|
758
710
|
|
|
711
|
+
|
|
712
|
+
type EnumerateUpTo<
|
|
713
|
+
N extends number,
|
|
714
|
+
Acc extends number[] = []
|
|
715
|
+
> = Acc['length'] extends N ?
|
|
716
|
+
Acc[number]:
|
|
717
|
+
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
718
|
+
|
|
719
|
+
type EnumerateFrom1To<
|
|
720
|
+
N extends number
|
|
721
|
+
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
722
|
+
|
|
723
|
+
type IsVersionGreaterThan0<
|
|
724
|
+
V extends number
|
|
725
|
+
> = V extends 0 ? false : true;
|
|
726
|
+
|
|
727
|
+
type AnyVersionGreaterThan1<
|
|
728
|
+
T extends Record<string, SchemaType>
|
|
729
|
+
> = true extends {
|
|
730
|
+
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
731
|
+
} [keyof T] ? true : false;
|
|
732
|
+
|
|
733
|
+
type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
734
|
+
|
|
735
|
+
type MigrationPathsForSchema<
|
|
736
|
+
T extends SchemaType
|
|
737
|
+
> = T['version'] extends 0 ? {}: // No migrations needed for version 1
|
|
738
|
+
{
|
|
739
|
+
[K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
type MigrationPathsForSchemas<
|
|
743
|
+
T extends SchemaTypeRecord
|
|
744
|
+
> = {
|
|
745
|
+
[K in keyof T]: MigrationPathsForSchema<T[K]>;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
type MigrationsParameter<
|
|
749
|
+
T extends SchemaTypeRecord
|
|
750
|
+
> = AnyVersionGreaterThan1<T> extends true ?
|
|
751
|
+
{
|
|
752
|
+
migrations: MigrationPathsForSchemas<T>
|
|
753
|
+
}:
|
|
754
|
+
{
|
|
755
|
+
migrations?: never
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
|
|
759
759
|
/**
|
|
760
760
|
*/
|
|
761
761
|
declare class RIDBError {
|
|
@@ -867,43 +867,55 @@ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Modul
|
|
|
867
867
|
|
|
868
868
|
interface InitOutput {
|
|
869
869
|
readonly memory: WebAssembly.Memory;
|
|
870
|
-
readonly
|
|
871
|
-
readonly
|
|
872
|
-
readonly
|
|
873
|
-
readonly
|
|
874
|
-
readonly
|
|
875
|
-
readonly
|
|
876
|
-
readonly
|
|
877
|
-
readonly
|
|
878
|
-
readonly
|
|
879
|
-
readonly
|
|
880
|
-
readonly
|
|
881
|
-
readonly
|
|
882
|
-
readonly
|
|
883
|
-
readonly
|
|
884
|
-
readonly
|
|
885
|
-
readonly
|
|
886
|
-
readonly
|
|
887
|
-
readonly
|
|
888
|
-
readonly
|
|
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
|
|
902
|
-
readonly
|
|
903
|
-
readonly
|
|
904
|
-
readonly
|
|
905
|
-
readonly
|
|
906
|
-
readonly
|
|
870
|
+
readonly __wbg_property_free: (a: number) => void;
|
|
871
|
+
readonly property_is_valid: (a: number, b: number) => void;
|
|
872
|
+
readonly property_type: (a: number) => number;
|
|
873
|
+
readonly property_items: (a: number, b: number) => void;
|
|
874
|
+
readonly property_maxItems: (a: number, b: number) => void;
|
|
875
|
+
readonly property_minItems: (a: number, b: number) => void;
|
|
876
|
+
readonly property_maxLength: (a: number, b: number) => void;
|
|
877
|
+
readonly property_minLength: (a: number, b: number) => void;
|
|
878
|
+
readonly property_properties: (a: number, b: number) => void;
|
|
879
|
+
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
880
|
+
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
881
|
+
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
882
|
+
readonly __wbg_ridberror_free: (a: number) => void;
|
|
883
|
+
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
884
|
+
readonly ridberror_type: (a: number, b: number) => void;
|
|
885
|
+
readonly ridberror_code: (a: number) => number;
|
|
886
|
+
readonly ridberror_message: (a: number, b: number) => void;
|
|
887
|
+
readonly ridberror_from: (a: number) => number;
|
|
888
|
+
readonly ridberror_error: (a: number, b: number, c: number) => number;
|
|
889
|
+
readonly ridberror_query: (a: number, b: number, c: number) => number;
|
|
890
|
+
readonly ridberror_authentication: (a: number, b: number, c: number) => number;
|
|
891
|
+
readonly ridberror_serialisation: (a: number, b: number, c: number) => number;
|
|
892
|
+
readonly ridberror_validation: (a: number, b: number, c: number) => number;
|
|
893
|
+
readonly ridberror_hook: (a: number, b: number, c: number) => number;
|
|
894
|
+
readonly __wbg_indexdb_free: (a: number) => void;
|
|
895
|
+
readonly indexdb_get_stores: (a: number, b: number) => void;
|
|
896
|
+
readonly indexdb_get_store: (a: number, b: number, c: number, d: number) => void;
|
|
897
|
+
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
898
|
+
readonly indexdb_write: (a: number, b: number) => number;
|
|
899
|
+
readonly indexdb_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
900
|
+
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
901
|
+
readonly indexdb_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
902
|
+
readonly indexdb_close: (a: number) => number;
|
|
903
|
+
readonly indexdb_start: (a: number) => number;
|
|
904
|
+
readonly __wbg_inmemory_free: (a: number) => void;
|
|
905
|
+
readonly inmemory_create: (a: number, b: number, c: number) => number;
|
|
906
|
+
readonly inmemory_write: (a: number, b: number) => number;
|
|
907
|
+
readonly inmemory_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
908
|
+
readonly inmemory_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
909
|
+
readonly inmemory_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
910
|
+
readonly inmemory_close: (a: number) => number;
|
|
911
|
+
readonly inmemory_start: (a: number) => number;
|
|
912
|
+
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
913
|
+
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
914
|
+
readonly baseplugin_name: (a: number) => number;
|
|
915
|
+
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
916
|
+
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
917
|
+
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
918
|
+
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
907
919
|
readonly __wbg_query_free: (a: number) => void;
|
|
908
920
|
readonly query_new: (a: number, b: number, c: number) => void;
|
|
909
921
|
readonly query_query: (a: number, b: number) => void;
|
|
@@ -940,6 +952,46 @@ interface InitOutput {
|
|
|
940
952
|
readonly __wbgt_test_query_parse_eq_operator_wrong_type_32: (a: number) => void;
|
|
941
953
|
readonly __wbgt_test_query_parse_ne_operator_33: (a: number) => void;
|
|
942
954
|
readonly __wbgt_test_query_parse_ne_operator_wrong_type_34: (a: number) => void;
|
|
955
|
+
readonly main_js: () => void;
|
|
956
|
+
readonly is_debug_mode: () => number;
|
|
957
|
+
readonly __wbg_collection_free: (a: number) => void;
|
|
958
|
+
readonly collection_name: (a: number, b: number) => void;
|
|
959
|
+
readonly collection_schema: (a: number, b: number) => void;
|
|
960
|
+
readonly collection_find: (a: number, b: number, c: number) => number;
|
|
961
|
+
readonly collection_parse_query_options: (a: number, b: number, c: number) => void;
|
|
962
|
+
readonly collection_count: (a: number, b: number, c: number) => number;
|
|
963
|
+
readonly collection_findById: (a: number, b: number) => number;
|
|
964
|
+
readonly collection_update: (a: number, b: number) => number;
|
|
965
|
+
readonly collection_create: (a: number, b: number) => number;
|
|
966
|
+
readonly collection_delete: (a: number, b: number) => number;
|
|
967
|
+
readonly corestorage_new: () => number;
|
|
968
|
+
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
969
|
+
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
970
|
+
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
971
|
+
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
972
|
+
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
973
|
+
readonly queryoptions_offset: (a: number, b: number) => void;
|
|
974
|
+
readonly __wbg_operation_free: (a: number) => void;
|
|
975
|
+
readonly operation_collection: (a: number, b: number) => void;
|
|
976
|
+
readonly operation_opType: (a: number) => number;
|
|
977
|
+
readonly operation_data: (a: number) => number;
|
|
978
|
+
readonly operation_primaryKeyField: (a: number) => number;
|
|
979
|
+
readonly operation_primaryKey: (a: number) => number;
|
|
980
|
+
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
981
|
+
readonly __wbg_corestorage_free: (a: number) => void;
|
|
982
|
+
readonly __wbg_database_free: (a: number) => void;
|
|
983
|
+
readonly database_start: (a: number) => number;
|
|
984
|
+
readonly database_close: (a: number) => number;
|
|
985
|
+
readonly database_started: (a: number) => number;
|
|
986
|
+
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
987
|
+
readonly database_collections: (a: number, b: number) => void;
|
|
988
|
+
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
989
|
+
readonly __wbg_basestorage_free: (a: number) => void;
|
|
990
|
+
readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
991
|
+
readonly basestorage_addIndexSchemas: (a: number, b: number) => void;
|
|
992
|
+
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
993
|
+
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
994
|
+
readonly basestorage_core: (a: number, b: number) => void;
|
|
943
995
|
readonly __wbg_schema_free: (a: number) => void;
|
|
944
996
|
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
945
997
|
readonly schema_is_valid: (a: number, b: number) => void;
|
|
@@ -953,58 +1005,6 @@ interface InitOutput {
|
|
|
953
1005
|
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
954
1006
|
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
955
1007
|
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
956
|
-
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
957
|
-
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
958
|
-
readonly baseplugin_name: (a: number) => number;
|
|
959
|
-
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
960
|
-
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
961
|
-
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
962
|
-
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
963
|
-
readonly __wbg_inmemory_free: (a: number) => void;
|
|
964
|
-
readonly inmemory_create: (a: number, b: number, c: number) => number;
|
|
965
|
-
readonly inmemory_write: (a: number, b: number) => number;
|
|
966
|
-
readonly inmemory_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
967
|
-
readonly inmemory_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
968
|
-
readonly inmemory_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
969
|
-
readonly inmemory_close: (a: number) => number;
|
|
970
|
-
readonly inmemory_start: (a: number) => number;
|
|
971
|
-
readonly __wbg_ridberror_free: (a: number) => void;
|
|
972
|
-
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
973
|
-
readonly ridberror_type: (a: number, b: number) => void;
|
|
974
|
-
readonly ridberror_code: (a: number) => number;
|
|
975
|
-
readonly ridberror_message: (a: number, b: number) => void;
|
|
976
|
-
readonly ridberror_from: (a: number) => number;
|
|
977
|
-
readonly ridberror_error: (a: number, b: number, c: number) => number;
|
|
978
|
-
readonly ridberror_query: (a: number, b: number, c: number) => number;
|
|
979
|
-
readonly ridberror_authentication: (a: number, b: number, c: number) => number;
|
|
980
|
-
readonly ridberror_serialisation: (a: number, b: number, c: number) => number;
|
|
981
|
-
readonly ridberror_validation: (a: number, b: number, c: number) => number;
|
|
982
|
-
readonly ridberror_hook: (a: number, b: number, c: number) => number;
|
|
983
|
-
readonly __wbg_indexdb_free: (a: number) => void;
|
|
984
|
-
readonly indexdb_get_stores: (a: number, b: number) => void;
|
|
985
|
-
readonly indexdb_get_store: (a: number, b: number, c: number, d: number) => void;
|
|
986
|
-
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
987
|
-
readonly indexdb_write: (a: number, b: number) => number;
|
|
988
|
-
readonly indexdb_find: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
989
|
-
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
990
|
-
readonly indexdb_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
991
|
-
readonly indexdb_close: (a: number) => number;
|
|
992
|
-
readonly indexdb_start: (a: number) => number;
|
|
993
|
-
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
994
|
-
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
995
|
-
readonly queryoptions_offset: (a: number, b: number) => void;
|
|
996
|
-
readonly __wbg_property_free: (a: number) => void;
|
|
997
|
-
readonly property_is_valid: (a: number, b: number) => void;
|
|
998
|
-
readonly property_type: (a: number) => number;
|
|
999
|
-
readonly property_items: (a: number, b: number) => void;
|
|
1000
|
-
readonly property_maxItems: (a: number, b: number) => void;
|
|
1001
|
-
readonly property_minItems: (a: number, b: number) => void;
|
|
1002
|
-
readonly property_maxLength: (a: number, b: number) => void;
|
|
1003
|
-
readonly property_minLength: (a: number, b: number) => void;
|
|
1004
|
-
readonly property_properties: (a: number, b: number) => void;
|
|
1005
|
-
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
1006
|
-
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
1007
|
-
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
1008
1008
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
1009
1009
|
readonly wasmbindgentestcontext_new: () => number;
|
|
1010
1010
|
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
|
@@ -1020,7 +1020,7 @@ interface InitOutput {
|
|
|
1020
1020
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
1021
1021
|
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1d7727fe9471ac49: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1022
1022
|
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4e550b82c2b30c7a: (a: number, b: number, c: number) => void;
|
|
1023
|
-
readonly
|
|
1023
|
+
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hec0cc069f718ed78: (a: number, b: number) => void;
|
|
1024
1024
|
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf401bdfdf8c9bdd9: (a: number, b: number, c: number) => void;
|
|
1025
1025
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
1026
1026
|
readonly __wbindgen_exn_store: (a: number) => void;
|