@trust0/ridb-core 1.0.0 → 1.1.0-rc.2
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 +2 -2
- package/pkg/ridb_core.d.ts +339 -339
- package/pkg/ridb_core.js +128 -129
- package/pkg/ridb_core_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trust0/ridb-core",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "RIDB core.",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.1.0-rc.2",
|
|
9
9
|
"main": "./pkg/ridb_core.js",
|
|
10
10
|
"types": "./pkg/ridb_core.d.ts",
|
|
11
11
|
"sideEffects": [
|
package/pkg/ridb_core.d.ts
CHANGED
|
@@ -63,6 +63,119 @@ export enum OpType {
|
|
|
63
63
|
COUNT = 4,
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
export class CoreStorage {
|
|
67
|
+
/**
|
|
68
|
+
* @param {any} document
|
|
69
|
+
* @param {Query} query
|
|
70
|
+
* @returns {boolean}
|
|
71
|
+
*/
|
|
72
|
+
matchesQuery(document: any, query: Query<any>): boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Represents a database containing collections of documents.
|
|
79
|
+
* RIDB extends from this class and is used to expose collections.
|
|
80
|
+
*
|
|
81
|
+
* So if you specify:
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const db = new RIDB(
|
|
84
|
+
* {
|
|
85
|
+
* schemas: {
|
|
86
|
+
* demo: {
|
|
87
|
+
* version: 0,
|
|
88
|
+
* primaryKey: 'id',
|
|
89
|
+
* type: SchemaFieldType.object,
|
|
90
|
+
* properties: {
|
|
91
|
+
* id: {
|
|
92
|
+
* type: SchemaFieldType.string,
|
|
93
|
+
* maxLength: 60
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
* } as const
|
|
98
|
+
* }
|
|
99
|
+
* )
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* 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.
|
|
103
|
+
*
|
|
104
|
+
* @template T - A record of schema types.
|
|
105
|
+
*/
|
|
106
|
+
export class Database<T extends SchemaTypeRecord> {
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Creates a new `Database` instance with the provided schemas and storage module.
|
|
110
|
+
*
|
|
111
|
+
* @template TS - A record of schema types.
|
|
112
|
+
* @param {TS} schemas - The schemas to use for the collections.
|
|
113
|
+
* @param migrations
|
|
114
|
+
* @param plugins
|
|
115
|
+
* @param options
|
|
116
|
+
* @param password
|
|
117
|
+
* @returns {Promise<Database<TS>>} A promise that resolves to the created `Database` instance.
|
|
118
|
+
*/
|
|
119
|
+
static create<TS extends SchemaTypeRecord>(
|
|
120
|
+
db_name: string,
|
|
121
|
+
schemas: TS,
|
|
122
|
+
migrations: MigrationPathsForSchemas<TS> | MigrationPathsForSchema<TS[string]>,
|
|
123
|
+
plugins:Array<typeof BasePlugin>,
|
|
124
|
+
options: RIDBModule,
|
|
125
|
+
password?:string,
|
|
126
|
+
storage?: BaseStorage<TS>
|
|
127
|
+
): Promise<Database<TS>>;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The collections in the database.
|
|
131
|
+
*
|
|
132
|
+
* This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
|
|
133
|
+
*/
|
|
134
|
+
readonly collections: {
|
|
135
|
+
[name in keyof T]: Collection<Schema<T[name]>>
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
readonly started: boolean;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Starts the database.
|
|
142
|
+
*
|
|
143
|
+
* @returns {Promise<void>} A promise that resolves when the database is started.
|
|
144
|
+
*/
|
|
145
|
+
start(): Promise<void>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Closes the database.
|
|
149
|
+
*
|
|
150
|
+
* @returns {Promise<void>} A promise that resolves when the database is closed.
|
|
151
|
+
*/
|
|
152
|
+
close(): Promise<void>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Represents a function type for creating storage with the provided schema type records.
|
|
157
|
+
*
|
|
158
|
+
* @template T - The schema type record.
|
|
159
|
+
* @param {T} records - The schema type records.
|
|
160
|
+
* @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
|
|
161
|
+
*/
|
|
162
|
+
export type CreateStorage = <T extends SchemaTypeRecord>(
|
|
163
|
+
records: T
|
|
164
|
+
) => Promise<BaseStorage<T>>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Represents a storage module with a method for creating storage.
|
|
168
|
+
*/
|
|
169
|
+
export type RIDBModule = {
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Plugin constructors array
|
|
173
|
+
*/
|
|
174
|
+
apply: (plugins:Array<typeof BasePlugin>) => Array<BasePlugin>;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
66
179
|
/**
|
|
67
180
|
* Represents an in-memory storage system extending the base storage functionality.
|
|
68
181
|
*
|
|
@@ -126,65 +239,98 @@ export class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageIntern
|
|
|
126
239
|
|
|
127
240
|
|
|
128
241
|
/**
|
|
129
|
-
* Represents
|
|
242
|
+
* Represents the type definition for a schema.
|
|
130
243
|
*/
|
|
131
|
-
export
|
|
244
|
+
export type SchemaType = {
|
|
132
245
|
/**
|
|
133
|
-
* The
|
|
246
|
+
* The version of the schema.
|
|
134
247
|
*/
|
|
135
|
-
|
|
248
|
+
version: number;
|
|
136
249
|
|
|
137
250
|
/**
|
|
138
|
-
* The
|
|
251
|
+
* The primary key of the schema.
|
|
139
252
|
*/
|
|
140
|
-
|
|
253
|
+
primaryKey: string;
|
|
141
254
|
|
|
142
255
|
/**
|
|
143
|
-
* The
|
|
256
|
+
* The type of the schema.
|
|
144
257
|
*/
|
|
145
|
-
|
|
258
|
+
type: string;
|
|
259
|
+
indexes?: string[];
|
|
260
|
+
encrypted?: string[];
|
|
261
|
+
/**
|
|
262
|
+
* The properties defined in the schema.
|
|
263
|
+
*/
|
|
264
|
+
properties: {
|
|
265
|
+
[name: string]: Property;
|
|
266
|
+
};
|
|
267
|
+
};
|
|
146
268
|
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Represents a schema, including its definition and related methods.
|
|
272
|
+
*
|
|
273
|
+
* @template T - The schema type.
|
|
274
|
+
*/
|
|
275
|
+
export class Schema<T extends SchemaType> {
|
|
147
276
|
/**
|
|
148
|
-
*
|
|
277
|
+
* The schema definition.
|
|
149
278
|
*/
|
|
150
|
-
|
|
279
|
+
schema: Schema<T>;
|
|
151
280
|
|
|
152
281
|
/**
|
|
153
|
-
*
|
|
282
|
+
* Creates a new `Schema` instance from the provided definition.
|
|
283
|
+
*
|
|
284
|
+
* @template TS - The schema type.
|
|
285
|
+
* @param {TS} defi, Debugnition - The schema definition.
|
|
286
|
+
* @returns {Schema<TS>} The created `Schema` instance.
|
|
154
287
|
*/
|
|
155
|
-
|
|
288
|
+
static create<TS extends SchemaType>(definition: TS): Schema<TS>;
|
|
156
289
|
|
|
157
290
|
/**
|
|
158
|
-
* The
|
|
291
|
+
* The version of the schema.
|
|
159
292
|
*/
|
|
160
|
-
readonly
|
|
293
|
+
readonly version: number;
|
|
161
294
|
|
|
162
295
|
/**
|
|
163
|
-
* The
|
|
296
|
+
* The primary key of the schema.
|
|
164
297
|
*/
|
|
165
|
-
readonly
|
|
298
|
+
readonly primaryKey: string;
|
|
166
299
|
|
|
167
300
|
/**
|
|
168
|
-
* The
|
|
301
|
+
* The type of the schema.
|
|
169
302
|
*/
|
|
170
|
-
readonly
|
|
303
|
+
readonly type: string;
|
|
171
304
|
|
|
172
305
|
/**
|
|
173
|
-
* An optional array of
|
|
306
|
+
* An optional array of indexes.
|
|
174
307
|
*/
|
|
175
|
-
|
|
308
|
+
/**
|
|
309
|
+
* An optional array of indexes.
|
|
310
|
+
*/
|
|
311
|
+
readonly indexes?: (Extract<keyof T, string>)[];
|
|
176
312
|
|
|
177
313
|
/**
|
|
178
|
-
* An optional
|
|
314
|
+
* An optional array of encrypted fields.
|
|
179
315
|
*/
|
|
180
|
-
readonly
|
|
316
|
+
readonly encrypted?: (Extract<keyof T, string>)[];
|
|
181
317
|
|
|
182
318
|
/**
|
|
183
|
-
*
|
|
319
|
+
* The properties defined in the schema.
|
|
184
320
|
*/
|
|
185
|
-
readonly properties
|
|
186
|
-
[
|
|
321
|
+
readonly properties: {
|
|
322
|
+
[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];
|
|
323
|
+
} & {
|
|
324
|
+
[K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
|
|
187
325
|
};
|
|
326
|
+
/**
|
|
327
|
+
* Converts the schema to a JSON representation.
|
|
328
|
+
*
|
|
329
|
+
* @returns {SchemaType} The JSON representation of the schema.
|
|
330
|
+
*/
|
|
331
|
+
toJSON(): SchemaType;
|
|
332
|
+
|
|
333
|
+
validate(document: Doc<Schema<T>>): boolean;
|
|
188
334
|
}
|
|
189
335
|
|
|
190
336
|
|
|
@@ -283,181 +429,28 @@ export class Collection<T extends SchemaType> {
|
|
|
283
429
|
|
|
284
430
|
|
|
285
431
|
|
|
286
|
-
export type
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
export type InOperator<T> = { $in?: T[] };
|
|
293
|
-
export type OperatorOrType<T> = T extends number ? T | Operators | InOperator<T> : T | InOperator<T>;
|
|
294
|
-
export type LogicalOperators<T extends SchemaType> = {
|
|
295
|
-
$and?: Partial<QueryType<T>>[];
|
|
296
|
-
$or?: Partial<QueryType<T>>[];
|
|
297
|
-
};
|
|
298
|
-
export type QueryType<T extends SchemaType> = Partial<{
|
|
299
|
-
[K in keyof T['properties']]: OperatorOrType<
|
|
300
|
-
ExtractType<
|
|
301
|
-
T['properties'][K]['type']
|
|
302
|
-
>
|
|
303
|
-
>
|
|
304
|
-
}> & LogicalOperators<T> | LogicalOperators<T>[];
|
|
305
|
-
export class Query<T extends SchemaType> {
|
|
306
|
-
constructor(query: QueryType<T>, schema:Schema<T>)
|
|
307
|
-
readonly query: QueryType<T>
|
|
308
|
-
}
|
|
309
|
-
//test
|
|
432
|
+
export type EnumerateUpTo<
|
|
433
|
+
N extends number,
|
|
434
|
+
Acc extends number[] = []
|
|
435
|
+
> = Acc['length'] extends N ?
|
|
436
|
+
Acc[number]:
|
|
437
|
+
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
310
438
|
|
|
439
|
+
export type EnumerateFrom1To<
|
|
440
|
+
N extends number
|
|
441
|
+
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
311
442
|
|
|
443
|
+
export type IsVersionGreaterThan0<
|
|
444
|
+
V extends number
|
|
445
|
+
> = V extends 0 ? false : true;
|
|
312
446
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
* The version of the schema.
|
|
319
|
-
*/
|
|
320
|
-
version: number;
|
|
447
|
+
export type AnyVersionGreaterThan1<
|
|
448
|
+
T extends Record<string, SchemaType>
|
|
449
|
+
> = true extends {
|
|
450
|
+
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
451
|
+
} [keyof T] ? true : false;
|
|
321
452
|
|
|
322
|
-
|
|
323
|
-
* The primary key of the schema.
|
|
324
|
-
*/
|
|
325
|
-
primaryKey: string;
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* The type of the schema.
|
|
329
|
-
*/
|
|
330
|
-
type: string;
|
|
331
|
-
indexes?: string[];
|
|
332
|
-
encrypted?: string[];
|
|
333
|
-
/**
|
|
334
|
-
* The properties defined in the schema.
|
|
335
|
-
*/
|
|
336
|
-
properties: {
|
|
337
|
-
[name: string]: Property;
|
|
338
|
-
};
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Represents a schema, including its definition and related methods.
|
|
344
|
-
*
|
|
345
|
-
* @template T - The schema type.
|
|
346
|
-
*/
|
|
347
|
-
export class Schema<T extends SchemaType> {
|
|
348
|
-
/**
|
|
349
|
-
* The schema definition.
|
|
350
|
-
*/
|
|
351
|
-
schema: Schema<T>;
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Creates a new `Schema` instance from the provided definition.
|
|
355
|
-
*
|
|
356
|
-
* @template TS - The schema type.
|
|
357
|
-
* @param {TS} defi, Debugnition - The schema definition.
|
|
358
|
-
* @returns {Schema<TS>} The created `Schema` instance.
|
|
359
|
-
*/
|
|
360
|
-
static create<TS extends SchemaType>(definition: TS): Schema<TS>;
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* The version of the schema.
|
|
364
|
-
*/
|
|
365
|
-
readonly version: number;
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* The primary key of the schema.
|
|
369
|
-
*/
|
|
370
|
-
readonly primaryKey: string;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* The type of the schema.
|
|
374
|
-
*/
|
|
375
|
-
readonly type: string;
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* An optional array of indexes.
|
|
379
|
-
*/
|
|
380
|
-
/**
|
|
381
|
-
* An optional array of indexes.
|
|
382
|
-
*/
|
|
383
|
-
readonly indexes?: (Extract<keyof T, string>)[];
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* An optional array of encrypted fields.
|
|
387
|
-
*/
|
|
388
|
-
readonly encrypted?: (Extract<keyof T, string>)[];
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* The properties defined in the schema.
|
|
392
|
-
*/
|
|
393
|
-
readonly properties: {
|
|
394
|
-
[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];
|
|
395
|
-
} & {
|
|
396
|
-
[K in keyof T['properties'] as T['properties'][K]['required'] extends false ? never : K]: T['properties'][K];
|
|
397
|
-
};
|
|
398
|
-
/**
|
|
399
|
-
* Converts the schema to a JSON representation.
|
|
400
|
-
*
|
|
401
|
-
* @returns {SchemaType} The JSON representation of the schema.
|
|
402
|
-
*/
|
|
403
|
-
toJSON(): SchemaType;
|
|
404
|
-
|
|
405
|
-
validate(document: Doc<Schema<T>>): boolean;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Represents an operation to be performed on a collection.
|
|
412
|
-
*
|
|
413
|
-
* @template T - The schema type of the collection.
|
|
414
|
-
*/
|
|
415
|
-
export type Operation<T extends SchemaType> = {
|
|
416
|
-
/**
|
|
417
|
-
* The name of the collection on which the operation will be performed.
|
|
418
|
-
*/
|
|
419
|
-
collection: string,
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
|
|
423
|
-
*/
|
|
424
|
-
opType: OpType,
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* The data involved in the operation, conforming to the schema type.
|
|
428
|
-
*/
|
|
429
|
-
data: Doc<T>,
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* An array of indexes related to the operation.
|
|
433
|
-
*/
|
|
434
|
-
indexes: Array<string>
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
export type EnumerateUpTo<
|
|
440
|
-
N extends number,
|
|
441
|
-
Acc extends number[] = []
|
|
442
|
-
> = Acc['length'] extends N ?
|
|
443
|
-
Acc[number]:
|
|
444
|
-
EnumerateUpTo<N, [...Acc, Acc['length']]> ;
|
|
445
|
-
|
|
446
|
-
export type EnumerateFrom1To<
|
|
447
|
-
N extends number
|
|
448
|
-
> = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
|
|
449
|
-
|
|
450
|
-
export type IsVersionGreaterThan0<
|
|
451
|
-
V extends number
|
|
452
|
-
> = V extends 0 ? false : true;
|
|
453
|
-
|
|
454
|
-
export type AnyVersionGreaterThan1<
|
|
455
|
-
T extends Record<string, SchemaType>
|
|
456
|
-
> = true extends {
|
|
457
|
-
[K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
|
|
458
|
-
} [keyof T] ? true : false;
|
|
459
|
-
|
|
460
|
-
export type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
453
|
+
export type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
|
|
461
454
|
|
|
462
455
|
export type MigrationPathsForSchema<
|
|
463
456
|
T extends SchemaType
|
|
@@ -558,115 +551,122 @@ export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
|
558
551
|
|
|
559
552
|
|
|
560
553
|
/**
|
|
561
|
-
* Represents a
|
|
562
|
-
* RIDB extends from this class and is used to expose collections.
|
|
563
|
-
*
|
|
564
|
-
* So if you specify:
|
|
565
|
-
* ```typescript
|
|
566
|
-
* const db = new RIDB(
|
|
567
|
-
* {
|
|
568
|
-
* schemas: {
|
|
569
|
-
* demo: {
|
|
570
|
-
* version: 0,
|
|
571
|
-
* primaryKey: 'id',
|
|
572
|
-
* type: SchemaFieldType.object,
|
|
573
|
-
* properties: {
|
|
574
|
-
* id: {
|
|
575
|
-
* type: SchemaFieldType.string,
|
|
576
|
-
* maxLength: 60
|
|
577
|
-
* }
|
|
578
|
-
* }
|
|
579
|
-
* }
|
|
580
|
-
* } as const
|
|
581
|
-
* }
|
|
582
|
-
* )
|
|
583
|
-
* ```
|
|
584
|
-
*
|
|
585
|
-
* 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.
|
|
586
|
-
*
|
|
587
|
-
* @template T - A record of schema types.
|
|
554
|
+
* Represents a property within a schema, including various constraints and nested properties.
|
|
588
555
|
*/
|
|
589
|
-
export class
|
|
556
|
+
export class Property {
|
|
557
|
+
/**
|
|
558
|
+
* The type of the property.
|
|
559
|
+
*/
|
|
560
|
+
readonly type: string;
|
|
590
561
|
|
|
591
562
|
/**
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
* @template TS - A record of schema types.
|
|
595
|
-
* @param {TS} schemas - The schemas to use for the collections.
|
|
596
|
-
* @param migrations
|
|
597
|
-
* @param plugins
|
|
598
|
-
* @param options
|
|
599
|
-
* @param password
|
|
600
|
-
* @returns {Promise<Database<TS>>} A promise that resolves to the created `Database` instance.
|
|
563
|
+
* The version of the property, if applicable.
|
|
601
564
|
*/
|
|
602
|
-
|
|
603
|
-
db_name: string,
|
|
604
|
-
schemas: TS,
|
|
605
|
-
migrations: MigrationPathsForSchemas<TS> | MigrationPathsForSchema<TS[string]>,
|
|
606
|
-
plugins:Array<typeof BasePlugin>,
|
|
607
|
-
options: RIDBModule,
|
|
608
|
-
password?:string,
|
|
609
|
-
storage?: BaseStorage<TS>
|
|
610
|
-
): Promise<Database<TS>>;
|
|
565
|
+
readonly version?: number;
|
|
611
566
|
|
|
612
567
|
/**
|
|
613
|
-
* The
|
|
614
|
-
*
|
|
615
|
-
* This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
|
|
568
|
+
* The primary key of the property, if applicable.
|
|
616
569
|
*/
|
|
617
|
-
readonly
|
|
618
|
-
[name in keyof T]: Collection<Schema<T[name]>>
|
|
619
|
-
}
|
|
570
|
+
readonly primaryKey?: string;
|
|
620
571
|
|
|
621
|
-
|
|
572
|
+
/**
|
|
573
|
+
* An optional array of nested properties for array-type properties.
|
|
574
|
+
*/
|
|
575
|
+
readonly items?: Property;
|
|
622
576
|
|
|
623
577
|
/**
|
|
624
|
-
*
|
|
625
|
-
*
|
|
626
|
-
* @returns {Promise<void>} A promise that resolves when the database is started.
|
|
578
|
+
* The maximum number of items for array-type properties, if applicable.
|
|
627
579
|
*/
|
|
628
|
-
|
|
580
|
+
readonly maxItems?: number;
|
|
629
581
|
|
|
630
582
|
/**
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
* @returns {Promise<void>} A promise that resolves when the database is closed.
|
|
583
|
+
* The minimum number of items for array-type properties, if applicable.
|
|
634
584
|
*/
|
|
635
|
-
|
|
585
|
+
readonly minItems?: number;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The maximum length for string-type properties, if applicable.
|
|
589
|
+
*/
|
|
590
|
+
readonly maxLength?: number;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* The minimum length for string-type properties, if applicable.
|
|
594
|
+
*/
|
|
595
|
+
readonly minLength?: number;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* An optional array of required fields for object-type properties.
|
|
599
|
+
*/
|
|
600
|
+
readonly required?: boolean;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* An optional default value for the property.
|
|
604
|
+
*/
|
|
605
|
+
readonly default?: any;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* An optional map of nested properties for object-type properties.
|
|
609
|
+
*/
|
|
610
|
+
readonly properties?: {
|
|
611
|
+
[name: string]: Property;
|
|
612
|
+
};
|
|
636
613
|
}
|
|
637
614
|
|
|
615
|
+
|
|
616
|
+
|
|
638
617
|
/**
|
|
639
|
-
* Represents
|
|
618
|
+
* Represents an operation to be performed on a collection.
|
|
640
619
|
*
|
|
641
|
-
* @template T - The schema type
|
|
642
|
-
* @param {T} records - The schema type records.
|
|
643
|
-
* @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
|
|
620
|
+
* @template T - The schema type of the collection.
|
|
644
621
|
*/
|
|
645
|
-
export type
|
|
646
|
-
|
|
647
|
-
|
|
622
|
+
export type Operation<T extends SchemaType> = {
|
|
623
|
+
/**
|
|
624
|
+
* The name of the collection on which the operation will be performed.
|
|
625
|
+
*/
|
|
626
|
+
collection: string,
|
|
648
627
|
|
|
649
|
-
/**
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
628
|
+
/**
|
|
629
|
+
* The type of operation to be performed (e.g., CREATE, UPDATE, DELETE).
|
|
630
|
+
*/
|
|
631
|
+
opType: OpType,
|
|
653
632
|
|
|
654
633
|
/**
|
|
655
|
-
*
|
|
634
|
+
* The data involved in the operation, conforming to the schema type.
|
|
656
635
|
*/
|
|
657
|
-
|
|
658
|
-
|
|
636
|
+
data: Doc<T>,
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* An array of indexes related to the operation.
|
|
640
|
+
*/
|
|
641
|
+
indexes: Array<string>
|
|
642
|
+
}
|
|
659
643
|
|
|
660
644
|
|
|
661
645
|
|
|
662
|
-
export
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
646
|
+
export type Operators = {
|
|
647
|
+
$gte?: number,
|
|
648
|
+
$gt?: number
|
|
649
|
+
$lt?: number,
|
|
650
|
+
$lte?: number
|
|
651
|
+
};
|
|
652
|
+
export type InOperator<T> = { $in?: T[] };
|
|
653
|
+
export type OperatorOrType<T> = T extends number ? T | Operators | InOperator<T> : T | InOperator<T>;
|
|
654
|
+
export type LogicalOperators<T extends SchemaType> = {
|
|
655
|
+
$and?: Partial<QueryType<T>>[];
|
|
656
|
+
$or?: Partial<QueryType<T>>[];
|
|
657
|
+
};
|
|
658
|
+
export type QueryType<T extends SchemaType> = Partial<{
|
|
659
|
+
[K in keyof T['properties']]: OperatorOrType<
|
|
660
|
+
ExtractType<
|
|
661
|
+
T['properties'][K]['type']
|
|
662
|
+
>
|
|
663
|
+
>
|
|
664
|
+
}> & LogicalOperators<T> | LogicalOperators<T>[];
|
|
665
|
+
export class Query<T extends SchemaType> {
|
|
666
|
+
constructor(query: QueryType<T>, schema:Schema<T>)
|
|
667
|
+
readonly query: QueryType<T>
|
|
669
668
|
}
|
|
669
|
+
//test
|
|
670
670
|
|
|
671
671
|
|
|
672
672
|
/**
|
|
@@ -711,6 +711,18 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
711
711
|
|
|
712
712
|
export interface InitOutput {
|
|
713
713
|
readonly memory: WebAssembly.Memory;
|
|
714
|
+
readonly corestorage_new: () => number;
|
|
715
|
+
readonly corestorage_getPrimaryKey: (a: number, b: number, c: number) => void;
|
|
716
|
+
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
717
|
+
readonly __wbg_database_free: (a: number) => void;
|
|
718
|
+
readonly database_start: (a: number) => number;
|
|
719
|
+
readonly database_close: (a: number) => number;
|
|
720
|
+
readonly database_started: (a: number) => number;
|
|
721
|
+
readonly database_collections: (a: number, b: number) => void;
|
|
722
|
+
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
723
|
+
readonly main_js: () => void;
|
|
724
|
+
readonly is_debug_mode: () => number;
|
|
725
|
+
readonly __wbg_corestorage_free: (a: number) => void;
|
|
714
726
|
readonly __wbg_inmemory_free: (a: number) => void;
|
|
715
727
|
readonly inmemory_create: (a: number, b: number, c: number) => number;
|
|
716
728
|
readonly inmemory_by_index: (a: number, b: number) => void;
|
|
@@ -725,6 +737,43 @@ export interface InitOutput {
|
|
|
725
737
|
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
726
738
|
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
727
739
|
readonly basestorage_core: (a: number, b: number) => void;
|
|
740
|
+
readonly __wbg_schema_free: (a: number) => void;
|
|
741
|
+
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
742
|
+
readonly schema_is_valid: (a: number, b: number) => void;
|
|
743
|
+
readonly schema_create: (a: number, b: number) => void;
|
|
744
|
+
readonly schema_version: (a: number) => number;
|
|
745
|
+
readonly schema_primaryKey: (a: number, b: number) => void;
|
|
746
|
+
readonly schema_type: (a: number, b: number) => void;
|
|
747
|
+
readonly schema_indexes: (a: number, b: number) => void;
|
|
748
|
+
readonly schema_encrypted: (a: number, b: number) => void;
|
|
749
|
+
readonly schema_properties: (a: number, b: number) => void;
|
|
750
|
+
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
751
|
+
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
752
|
+
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
753
|
+
readonly __wbg_collection_free: (a: number) => void;
|
|
754
|
+
readonly collection_name: (a: number, b: number) => void;
|
|
755
|
+
readonly collection_schema: (a: number, b: number) => void;
|
|
756
|
+
readonly collection_find: (a: number, b: number) => number;
|
|
757
|
+
readonly collection_count: (a: number, b: number) => number;
|
|
758
|
+
readonly collection_findById: (a: number, b: number) => number;
|
|
759
|
+
readonly collection_update: (a: number, b: number) => number;
|
|
760
|
+
readonly collection_create: (a: number, b: number) => number;
|
|
761
|
+
readonly collection_delete: (a: number, b: number) => number;
|
|
762
|
+
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
763
|
+
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
764
|
+
readonly baseplugin_name: (a: number) => number;
|
|
765
|
+
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
766
|
+
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
767
|
+
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
768
|
+
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
769
|
+
readonly __wbg_indexdb_free: (a: number) => void;
|
|
770
|
+
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
771
|
+
readonly indexdb_write: (a: number, b: number) => number;
|
|
772
|
+
readonly indexdb_find: (a: number, b: number, c: number, d: number) => number;
|
|
773
|
+
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
774
|
+
readonly indexdb_count: (a: number, b: number, c: number, d: number) => number;
|
|
775
|
+
readonly indexdb_close: (a: number) => number;
|
|
776
|
+
readonly indexdb_start: (a: number) => number;
|
|
728
777
|
readonly __wbg_property_free: (a: number) => void;
|
|
729
778
|
readonly property_is_valid: (a: number, b: number) => void;
|
|
730
779
|
readonly property_type: (a: number) => number;
|
|
@@ -737,15 +786,11 @@ export interface InitOutput {
|
|
|
737
786
|
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
738
787
|
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
739
788
|
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
740
|
-
readonly
|
|
741
|
-
readonly
|
|
742
|
-
readonly
|
|
743
|
-
readonly
|
|
744
|
-
readonly
|
|
745
|
-
readonly collection_findById: (a: number, b: number) => number;
|
|
746
|
-
readonly collection_update: (a: number, b: number) => number;
|
|
747
|
-
readonly collection_create: (a: number, b: number) => number;
|
|
748
|
-
readonly collection_delete: (a: number, b: number) => number;
|
|
789
|
+
readonly __wbg_operation_free: (a: number) => void;
|
|
790
|
+
readonly operation_collection: (a: number, b: number) => void;
|
|
791
|
+
readonly operation_opType: (a: number) => number;
|
|
792
|
+
readonly operation_data: (a: number) => number;
|
|
793
|
+
readonly operation_indexes: (a: number, b: number) => void;
|
|
749
794
|
readonly __wbg_query_free: (a: number) => void;
|
|
750
795
|
readonly query_new: (a: number, b: number, c: number) => void;
|
|
751
796
|
readonly query_query: (a: number, b: number) => void;
|
|
@@ -768,51 +813,6 @@ export interface InitOutput {
|
|
|
768
813
|
readonly __wbgt_test_query_parse_multiple_operators_21: (a: number) => void;
|
|
769
814
|
readonly __wbgt_test_query_parse_invalid_in_operator_22: (a: number) => void;
|
|
770
815
|
readonly __wbgt_test_query_parse_empty_logical_operators_23: (a: number) => void;
|
|
771
|
-
readonly __wbg_schema_free: (a: number) => void;
|
|
772
|
-
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
773
|
-
readonly schema_is_valid: (a: number, b: number) => void;
|
|
774
|
-
readonly schema_create: (a: number, b: number) => void;
|
|
775
|
-
readonly schema_version: (a: number) => number;
|
|
776
|
-
readonly schema_primaryKey: (a: number, b: number) => void;
|
|
777
|
-
readonly schema_type: (a: number, b: number) => void;
|
|
778
|
-
readonly schema_indexes: (a: number, b: number) => void;
|
|
779
|
-
readonly schema_encrypted: (a: number, b: number) => void;
|
|
780
|
-
readonly schema_properties: (a: number, b: number) => void;
|
|
781
|
-
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
782
|
-
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
783
|
-
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
784
|
-
readonly __wbg_operation_free: (a: number) => void;
|
|
785
|
-
readonly operation_collection: (a: number, b: number) => void;
|
|
786
|
-
readonly operation_opType: (a: number) => number;
|
|
787
|
-
readonly operation_data: (a: number) => number;
|
|
788
|
-
readonly operation_indexes: (a: number, b: number) => void;
|
|
789
|
-
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
790
|
-
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
791
|
-
readonly baseplugin_name: (a: number) => number;
|
|
792
|
-
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
793
|
-
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
794
|
-
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
795
|
-
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
796
|
-
readonly __wbg_indexdb_free: (a: number) => void;
|
|
797
|
-
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
798
|
-
readonly indexdb_write: (a: number, b: number) => number;
|
|
799
|
-
readonly indexdb_find: (a: number, b: number, c: number, d: number) => number;
|
|
800
|
-
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
801
|
-
readonly indexdb_count: (a: number, b: number, c: number, d: number) => number;
|
|
802
|
-
readonly indexdb_close: (a: number) => number;
|
|
803
|
-
readonly indexdb_start: (a: number) => number;
|
|
804
|
-
readonly __wbg_database_free: (a: number) => void;
|
|
805
|
-
readonly database_start: (a: number) => number;
|
|
806
|
-
readonly database_close: (a: number) => number;
|
|
807
|
-
readonly database_started: (a: number) => number;
|
|
808
|
-
readonly database_collections: (a: number, b: number) => void;
|
|
809
|
-
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
810
|
-
readonly corestorage_new: () => number;
|
|
811
|
-
readonly corestorage_getPrimaryKey: (a: number, b: number, c: number) => void;
|
|
812
|
-
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
813
|
-
readonly main_js: () => void;
|
|
814
|
-
readonly is_debug_mode: () => number;
|
|
815
|
-
readonly __wbg_corestorage_free: (a: number) => void;
|
|
816
816
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
817
817
|
readonly wasmbindgentestcontext_new: () => number;
|
|
818
818
|
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
|
@@ -825,16 +825,16 @@ export interface InitOutput {
|
|
|
825
825
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
826
826
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
827
827
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
828
|
-
readonly
|
|
829
|
-
readonly
|
|
828
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4279c525cebb26f2: (a: number, b: number, c: number) => void;
|
|
829
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fc6c6f4e4fe440c: (a: number, b: number, c: number) => number;
|
|
830
830
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
831
|
-
readonly
|
|
832
|
-
readonly
|
|
831
|
+
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h80335dc7fe1c3f7e: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
832
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha1155a5e1cc6e1e8: (a: number, b: number, c: number) => void;
|
|
833
833
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
834
834
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
835
|
-
readonly
|
|
836
|
-
readonly
|
|
837
|
-
readonly
|
|
835
|
+
readonly wasm_bindgen__convert__closures__invoke0_mut__h19fc1620bec787be: (a: number, b: number) => void;
|
|
836
|
+
readonly wasm_bindgen__convert__closures__invoke3_mut__h7b738c7e28e951e8: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
837
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h3a3f5f08be32a04a: (a: number, b: number, c: number, d: number) => void;
|
|
838
838
|
readonly __wbindgen_start: () => void;
|
|
839
839
|
}
|
|
840
840
|
|
package/pkg/ridb_core.js
CHANGED
|
@@ -230,11 +230,11 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
230
230
|
return real;
|
|
231
231
|
}
|
|
232
232
|
function __wbg_adapter_56(arg0, arg1, arg2) {
|
|
233
|
-
wasm.
|
|
233
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4279c525cebb26f2(arg0, arg1, addHeapObject(arg2));
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
function __wbg_adapter_61(arg0, arg1, arg2) {
|
|
237
|
-
const ret = wasm.
|
|
237
|
+
const ret = wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fc6c6f4e4fe440c(arg0, arg1, addHeapObject(arg2));
|
|
238
238
|
return takeObject(ret);
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -262,7 +262,7 @@ function makeClosure(arg0, arg1, dtor, f) {
|
|
|
262
262
|
function __wbg_adapter_64(arg0, arg1, arg2, arg3, arg4) {
|
|
263
263
|
try {
|
|
264
264
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
265
|
-
wasm.
|
|
265
|
+
wasm._dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h80335dc7fe1c3f7e(retptr, arg0, arg1, addHeapObject(arg2), addHeapObject(arg3), addHeapObject(arg4));
|
|
266
266
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
267
267
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
268
268
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -276,7 +276,15 @@ function __wbg_adapter_64(arg0, arg1, arg2, arg3, arg4) {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
function __wbg_adapter_67(arg0, arg1, arg2) {
|
|
279
|
-
wasm.
|
|
279
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha1155a5e1cc6e1e8(arg0, arg1, addHeapObject(arg2));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
let stack_pointer = 128;
|
|
283
|
+
|
|
284
|
+
function addBorrowedObject(obj) {
|
|
285
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
286
|
+
heap[--stack_pointer] = obj;
|
|
287
|
+
return stack_pointer;
|
|
280
288
|
}
|
|
281
289
|
|
|
282
290
|
function _assertClass(instance, klass) {
|
|
@@ -295,25 +303,6 @@ function getUint32Memory0() {
|
|
|
295
303
|
return cachedUint32Memory0;
|
|
296
304
|
}
|
|
297
305
|
|
|
298
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
299
|
-
ptr = ptr >>> 0;
|
|
300
|
-
const mem = getUint32Memory0();
|
|
301
|
-
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
|
302
|
-
const result = [];
|
|
303
|
-
for (let i = 0; i < slice.length; i++) {
|
|
304
|
-
result.push(takeObject(slice[i]));
|
|
305
|
-
}
|
|
306
|
-
return result;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
function handleError(f, args) {
|
|
310
|
-
try {
|
|
311
|
-
return f.apply(this, args);
|
|
312
|
-
} catch (e) {
|
|
313
|
-
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
306
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
318
307
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
319
308
|
const mem = getUint32Memory0();
|
|
@@ -324,12 +313,12 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
324
313
|
return ptr;
|
|
325
314
|
}
|
|
326
315
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
316
|
+
function handleError(f, args) {
|
|
317
|
+
try {
|
|
318
|
+
return f.apply(this, args);
|
|
319
|
+
} catch (e) {
|
|
320
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
321
|
+
}
|
|
333
322
|
}
|
|
334
323
|
/**
|
|
335
324
|
*/
|
|
@@ -345,6 +334,16 @@ export function is_debug_mode() {
|
|
|
345
334
|
return ret !== 0;
|
|
346
335
|
}
|
|
347
336
|
|
|
337
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
338
|
+
ptr = ptr >>> 0;
|
|
339
|
+
const mem = getUint32Memory0();
|
|
340
|
+
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
|
341
|
+
const result = [];
|
|
342
|
+
for (let i = 0; i < slice.length; i++) {
|
|
343
|
+
result.push(takeObject(slice[i]));
|
|
344
|
+
}
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
348
347
|
/**
|
|
349
348
|
* Handler for `console.log` invocations.
|
|
350
349
|
*
|
|
@@ -411,15 +410,15 @@ export function __wbgtest_console_error(args) {
|
|
|
411
410
|
}
|
|
412
411
|
|
|
413
412
|
function __wbg_adapter_253(arg0, arg1) {
|
|
414
|
-
wasm.
|
|
413
|
+
wasm.wasm_bindgen__convert__closures__invoke0_mut__h19fc1620bec787be(arg0, arg1);
|
|
415
414
|
}
|
|
416
415
|
|
|
417
416
|
function __wbg_adapter_296(arg0, arg1, arg2, arg3, arg4) {
|
|
418
|
-
wasm.
|
|
417
|
+
wasm.wasm_bindgen__convert__closures__invoke3_mut__h7b738c7e28e951e8(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
419
418
|
}
|
|
420
419
|
|
|
421
420
|
function __wbg_adapter_349(arg0, arg1, arg2, arg3) {
|
|
422
|
-
wasm.
|
|
421
|
+
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3a3f5f08be32a04a(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
423
422
|
}
|
|
424
423
|
|
|
425
424
|
/**
|
|
@@ -1854,14 +1853,6 @@ function __wbg_get_imports() {
|
|
|
1854
1853
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
1855
1854
|
takeObject(arg0);
|
|
1856
1855
|
};
|
|
1857
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
1858
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
1859
|
-
return addHeapObject(ret);
|
|
1860
|
-
};
|
|
1861
|
-
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
1862
|
-
const ret = getObject(arg0);
|
|
1863
|
-
return addHeapObject(ret);
|
|
1864
|
-
};
|
|
1865
1856
|
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
1866
1857
|
const ret = getObject(arg0) === undefined;
|
|
1867
1858
|
return ret;
|
|
@@ -1870,32 +1861,32 @@ function __wbg_get_imports() {
|
|
|
1870
1861
|
const ret = getObject(arg0) === null;
|
|
1871
1862
|
return ret;
|
|
1872
1863
|
};
|
|
1873
|
-
imports.wbg.
|
|
1874
|
-
const ret =
|
|
1864
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
1865
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1875
1866
|
return addHeapObject(ret);
|
|
1876
|
-
}
|
|
1867
|
+
};
|
|
1868
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
1869
|
+
const ret = getObject(arg0);
|
|
1870
|
+
return addHeapObject(ret);
|
|
1871
|
+
};
|
|
1877
1872
|
imports.wbg.__wbg_close_b18eee4bcb7def21 = function() { return handleError(function (arg0) {
|
|
1878
1873
|
const ret = getObject(arg0).close();
|
|
1879
1874
|
return addHeapObject(ret);
|
|
1880
1875
|
}, arguments) };
|
|
1881
|
-
imports.wbg.
|
|
1882
|
-
const ret = getObject(arg0).
|
|
1876
|
+
imports.wbg.__wbg_count_431f5e9ed174125c = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1877
|
+
const ret = getObject(arg0).count(getStringFromWasm0(arg1, arg2), takeObject(arg3));
|
|
1883
1878
|
return addHeapObject(ret);
|
|
1884
1879
|
}, arguments) };
|
|
1885
|
-
imports.wbg.
|
|
1886
|
-
const ret =
|
|
1880
|
+
imports.wbg.__wbg_indexdb_new = function(arg0) {
|
|
1881
|
+
const ret = IndexDB.__wrap(arg0);
|
|
1887
1882
|
return addHeapObject(ret);
|
|
1888
1883
|
};
|
|
1889
|
-
imports.wbg.
|
|
1890
|
-
const ret = getObject(arg0).
|
|
1891
|
-
return addHeapObject(ret);
|
|
1892
|
-
}, arguments) };
|
|
1893
|
-
imports.wbg.__wbg_count_431f5e9ed174125c = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1894
|
-
const ret = getObject(arg0).count(getStringFromWasm0(arg1, arg2), takeObject(arg3));
|
|
1884
|
+
imports.wbg.__wbg_start_65a59f7936d1615b = function() { return handleError(function (arg0) {
|
|
1885
|
+
const ret = getObject(arg0).start();
|
|
1895
1886
|
return addHeapObject(ret);
|
|
1896
1887
|
}, arguments) };
|
|
1897
|
-
imports.wbg.
|
|
1898
|
-
const ret = arg0;
|
|
1888
|
+
imports.wbg.__wbg_inmemory_new = function(arg0) {
|
|
1889
|
+
const ret = InMemory.__wrap(arg0);
|
|
1899
1890
|
return addHeapObject(ret);
|
|
1900
1891
|
};
|
|
1901
1892
|
imports.wbg.__wbg_apply_69a38b2b812c92ba = function() { return handleError(function (arg0, arg1, arg2) {
|
|
@@ -1913,14 +1904,22 @@ function __wbg_get_imports() {
|
|
|
1913
1904
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
1914
1905
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
1915
1906
|
};
|
|
1907
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
1908
|
+
const ret = arg0;
|
|
1909
|
+
return addHeapObject(ret);
|
|
1910
|
+
};
|
|
1916
1911
|
imports.wbg.__wbg_database_new = function(arg0) {
|
|
1917
1912
|
const ret = Database.__wrap(arg0);
|
|
1918
1913
|
return addHeapObject(ret);
|
|
1919
1914
|
};
|
|
1920
|
-
imports.wbg.
|
|
1921
|
-
const ret =
|
|
1915
|
+
imports.wbg.__wbg_write_ca9bab98548a9017 = function() { return handleError(function (arg0, arg1) {
|
|
1916
|
+
const ret = getObject(arg0).write(Operation.__wrap(arg1));
|
|
1922
1917
|
return addHeapObject(ret);
|
|
1923
|
-
};
|
|
1918
|
+
}, arguments) };
|
|
1919
|
+
imports.wbg.__wbg_find_f9ccdf6abdbe1b6b = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1920
|
+
const ret = getObject(arg0).find(getStringFromWasm0(arg1, arg2), takeObject(arg3));
|
|
1921
|
+
return addHeapObject(ret);
|
|
1922
|
+
}, arguments) };
|
|
1924
1923
|
imports.wbg.__wbg_findDocumentById_709034599222e0b9 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1925
1924
|
const ret = getObject(arg0).findDocumentById(getStringFromWasm0(arg1, arg2), takeObject(arg3));
|
|
1926
1925
|
return addHeapObject(ret);
|
|
@@ -1931,10 +1930,9 @@ function __wbg_get_imports() {
|
|
|
1931
1930
|
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
1932
1931
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
1933
1932
|
};
|
|
1934
|
-
imports.wbg.
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1937
|
-
return ret;
|
|
1933
|
+
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
1934
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
1935
|
+
return addHeapObject(ret);
|
|
1938
1936
|
};
|
|
1939
1937
|
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
1940
1938
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
@@ -1948,34 +1946,31 @@ function __wbg_get_imports() {
|
|
|
1948
1946
|
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
1949
1947
|
return ret;
|
|
1950
1948
|
};
|
|
1951
|
-
imports.wbg.
|
|
1952
|
-
const
|
|
1953
|
-
|
|
1954
|
-
obj.a = 0;
|
|
1955
|
-
return true;
|
|
1956
|
-
}
|
|
1957
|
-
const ret = false;
|
|
1949
|
+
imports.wbg.__wbindgen_is_object = function(arg0) {
|
|
1950
|
+
const val = getObject(arg0);
|
|
1951
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1958
1952
|
return ret;
|
|
1959
1953
|
};
|
|
1960
|
-
imports.wbg.
|
|
1961
|
-
const ret = getObject(arg0)
|
|
1954
|
+
imports.wbg.__wbindgen_is_falsy = function(arg0) {
|
|
1955
|
+
const ret = !getObject(arg0);
|
|
1956
|
+
return ret;
|
|
1957
|
+
};
|
|
1958
|
+
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
|
1959
|
+
const v = getObject(arg0);
|
|
1960
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
1962
1961
|
return ret;
|
|
1963
1962
|
};
|
|
1964
1963
|
imports.wbg.__wbg_collection_new = function(arg0) {
|
|
1965
1964
|
const ret = Collection.__wrap(arg0);
|
|
1966
1965
|
return addHeapObject(ret);
|
|
1967
1966
|
};
|
|
1968
|
-
imports.wbg.
|
|
1969
|
-
const
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
const ret =
|
|
1975
|
-
return ret;
|
|
1976
|
-
};
|
|
1977
|
-
imports.wbg.__wbindgen_is_falsy = function(arg0) {
|
|
1978
|
-
const ret = !getObject(arg0);
|
|
1967
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
1968
|
+
const obj = takeObject(arg0).original;
|
|
1969
|
+
if (obj.cnt-- == 1) {
|
|
1970
|
+
obj.a = 0;
|
|
1971
|
+
return true;
|
|
1972
|
+
}
|
|
1973
|
+
const ret = false;
|
|
1979
1974
|
return ret;
|
|
1980
1975
|
};
|
|
1981
1976
|
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
@@ -1990,6 +1985,10 @@ function __wbg_get_imports() {
|
|
|
1990
1985
|
const ret = arg0;
|
|
1991
1986
|
return addHeapObject(ret);
|
|
1992
1987
|
};
|
|
1988
|
+
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
|
|
1989
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
1990
|
+
return ret;
|
|
1991
|
+
};
|
|
1993
1992
|
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
1994
1993
|
const ret = BigInt.asUintN(64, arg0);
|
|
1995
1994
|
return addHeapObject(ret);
|
|
@@ -2042,10 +2041,6 @@ function __wbg_get_imports() {
|
|
|
2042
2041
|
const ret = getObject(arg0).indexedDB;
|
|
2043
2042
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
2044
2043
|
}, arguments) };
|
|
2045
|
-
imports.wbg.__wbg_open_f0d7259fd7e689ce = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
2046
|
-
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
|
|
2047
|
-
return addHeapObject(ret);
|
|
2048
|
-
}, arguments) };
|
|
2049
2044
|
imports.wbg.__wbg_getItem_164e8e5265095b87 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
2050
2045
|
const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));
|
|
2051
2046
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -2059,25 +2054,10 @@ function __wbg_get_imports() {
|
|
|
2059
2054
|
imports.wbg.__wbg_log_5bb5f88f245d7762 = function(arg0) {
|
|
2060
2055
|
console.log(getObject(arg0));
|
|
2061
2056
|
};
|
|
2062
|
-
imports.wbg.
|
|
2063
|
-
const ret = getObject(arg0).
|
|
2064
|
-
return ret;
|
|
2065
|
-
};
|
|
2066
|
-
imports.wbg.__wbg_contains_c65b44400b549286 = function(arg0, arg1, arg2) {
|
|
2067
|
-
const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
|
|
2068
|
-
return ret;
|
|
2069
|
-
};
|
|
2070
|
-
imports.wbg.__wbg_get_910bbb94abdcf488 = function(arg0, arg1, arg2) {
|
|
2071
|
-
const ret = getObject(arg1)[arg2 >>> 0];
|
|
2072
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2073
|
-
var len1 = WASM_VECTOR_LEN;
|
|
2074
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
2075
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
2076
|
-
};
|
|
2077
|
-
imports.wbg.__wbg_target_2fc177e386c8b7b0 = function(arg0) {
|
|
2078
|
-
const ret = getObject(arg0).target;
|
|
2079
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
2080
|
-
};
|
|
2057
|
+
imports.wbg.__wbg_open_f0d7259fd7e689ce = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
2058
|
+
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
|
|
2059
|
+
return addHeapObject(ret);
|
|
2060
|
+
}, arguments) };
|
|
2081
2061
|
imports.wbg.__wbg_instanceof_IdbOpenDbRequest_3f4a166bc0340578 = function(arg0) {
|
|
2082
2062
|
let result;
|
|
2083
2063
|
try {
|
|
@@ -2125,6 +2105,25 @@ function __wbg_get_imports() {
|
|
|
2125
2105
|
const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
|
|
2126
2106
|
return addHeapObject(ret);
|
|
2127
2107
|
}, arguments) };
|
|
2108
|
+
imports.wbg.__wbg_length_9ae5daf9a690cba9 = function(arg0) {
|
|
2109
|
+
const ret = getObject(arg0).length;
|
|
2110
|
+
return ret;
|
|
2111
|
+
};
|
|
2112
|
+
imports.wbg.__wbg_contains_c65b44400b549286 = function(arg0, arg1, arg2) {
|
|
2113
|
+
const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
|
|
2114
|
+
return ret;
|
|
2115
|
+
};
|
|
2116
|
+
imports.wbg.__wbg_get_910bbb94abdcf488 = function(arg0, arg1, arg2) {
|
|
2117
|
+
const ret = getObject(arg1)[arg2 >>> 0];
|
|
2118
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2119
|
+
var len1 = WASM_VECTOR_LEN;
|
|
2120
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
2121
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
2122
|
+
};
|
|
2123
|
+
imports.wbg.__wbg_target_2fc177e386c8b7b0 = function(arg0) {
|
|
2124
|
+
const ret = getObject(arg0).target;
|
|
2125
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
2126
|
+
};
|
|
2128
2127
|
imports.wbg.__wbg_instanceof_IdbDatabase_db671cf2454a9542 = function(arg0) {
|
|
2129
2128
|
let result;
|
|
2130
2129
|
try {
|
|
@@ -2226,24 +2225,10 @@ function __wbg_get_imports() {
|
|
|
2226
2225
|
state0.a = state0.b = 0;
|
|
2227
2226
|
}
|
|
2228
2227
|
}, arguments) };
|
|
2229
|
-
imports.wbg.__wbg_wbgtestoutputwriteln_4db3bd64914ec955 = function(arg0) {
|
|
2230
|
-
__wbg_test_output_writeln(takeObject(arg0));
|
|
2231
|
-
};
|
|
2232
|
-
imports.wbg.__wbg_stack_436273c21658169b = function(arg0) {
|
|
2233
|
-
const ret = getObject(arg0).stack;
|
|
2234
|
-
return addHeapObject(ret);
|
|
2235
|
-
};
|
|
2236
2228
|
imports.wbg.__wbg_static_accessor_document_d4b6ae7f5578480f = function() {
|
|
2237
2229
|
const ret = document;
|
|
2238
2230
|
return addHeapObject(ret);
|
|
2239
2231
|
};
|
|
2240
|
-
imports.wbg.__wbg_stack_17c77e9f5bfe6714 = function(arg0, arg1) {
|
|
2241
|
-
const ret = getObject(arg1).stack;
|
|
2242
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2243
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2244
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
2245
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
2246
|
-
};
|
|
2247
2232
|
imports.wbg.__wbg_self_55106357ec10ecd4 = function(arg0) {
|
|
2248
2233
|
const ret = getObject(arg0).self;
|
|
2249
2234
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
@@ -2259,6 +2244,13 @@ function __wbg_get_imports() {
|
|
|
2259
2244
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
2260
2245
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
2261
2246
|
};
|
|
2247
|
+
imports.wbg.__wbg_stack_17c77e9f5bfe6714 = function(arg0, arg1) {
|
|
2248
|
+
const ret = getObject(arg1).stack;
|
|
2249
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2250
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2251
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
2252
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
2253
|
+
};
|
|
2262
2254
|
imports.wbg.__wbg_textcontent_67e4e811cbdf00fc = function(arg0, arg1) {
|
|
2263
2255
|
const ret = getObject(arg1).textContent;
|
|
2264
2256
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -2270,6 +2262,13 @@ function __wbg_get_imports() {
|
|
|
2270
2262
|
const ret = getObject(arg0).stack;
|
|
2271
2263
|
return addHeapObject(ret);
|
|
2272
2264
|
};
|
|
2265
|
+
imports.wbg.__wbg_wbgtestoutputwriteln_4db3bd64914ec955 = function(arg0) {
|
|
2266
|
+
__wbg_test_output_writeln(takeObject(arg0));
|
|
2267
|
+
};
|
|
2268
|
+
imports.wbg.__wbg_stack_436273c21658169b = function(arg0) {
|
|
2269
|
+
const ret = getObject(arg0).stack;
|
|
2270
|
+
return addHeapObject(ret);
|
|
2271
|
+
};
|
|
2273
2272
|
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
2274
2273
|
const ret = new Error();
|
|
2275
2274
|
return addHeapObject(ret);
|
|
@@ -2564,24 +2563,24 @@ function __wbg_get_imports() {
|
|
|
2564
2563
|
const ret = wasm.memory;
|
|
2565
2564
|
return addHeapObject(ret);
|
|
2566
2565
|
};
|
|
2567
|
-
imports.wbg.
|
|
2568
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2566
|
+
imports.wbg.__wbindgen_closure_wrapper567 = function(arg0, arg1, arg2) {
|
|
2567
|
+
const ret = makeMutClosure(arg0, arg1, 241, __wbg_adapter_56);
|
|
2569
2568
|
return addHeapObject(ret);
|
|
2570
2569
|
};
|
|
2571
|
-
imports.wbg.
|
|
2572
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2570
|
+
imports.wbg.__wbindgen_closure_wrapper569 = function(arg0, arg1, arg2) {
|
|
2571
|
+
const ret = makeMutClosure(arg0, arg1, 241, __wbg_adapter_56);
|
|
2573
2572
|
return addHeapObject(ret);
|
|
2574
2573
|
};
|
|
2575
|
-
imports.wbg.
|
|
2576
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2574
|
+
imports.wbg.__wbindgen_closure_wrapper571 = function(arg0, arg1, arg2) {
|
|
2575
|
+
const ret = makeMutClosure(arg0, arg1, 241, __wbg_adapter_61);
|
|
2577
2576
|
return addHeapObject(ret);
|
|
2578
2577
|
};
|
|
2579
|
-
imports.wbg.
|
|
2580
|
-
const ret = makeClosure(arg0, arg1,
|
|
2578
|
+
imports.wbg.__wbindgen_closure_wrapper573 = function(arg0, arg1, arg2) {
|
|
2579
|
+
const ret = makeClosure(arg0, arg1, 241, __wbg_adapter_64);
|
|
2581
2580
|
return addHeapObject(ret);
|
|
2582
2581
|
};
|
|
2583
|
-
imports.wbg.
|
|
2584
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2582
|
+
imports.wbg.__wbindgen_closure_wrapper1374 = function(arg0, arg1, arg2) {
|
|
2583
|
+
const ret = makeMutClosure(arg0, arg1, 375, __wbg_adapter_67);
|
|
2585
2584
|
return addHeapObject(ret);
|
|
2586
2585
|
};
|
|
2587
2586
|
|
package/pkg/ridb_core_bg.wasm
CHANGED
|
Binary file
|