@trust0/ridb-core 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pkg/ridb_core.d.ts +435 -413
- package/pkg/ridb_core.js +404 -231
- package/pkg/ridb_core_bg.wasm +0 -0
package/pkg/ridb_core.d.ts
CHANGED
|
@@ -63,125 +63,172 @@ export enum OpType {
|
|
|
63
63
|
COUNT = 4,
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
export type Operators = {
|
|
67
|
+
$gte?: number,
|
|
68
|
+
$gt?: number
|
|
69
|
+
$lt?: number,
|
|
70
|
+
$lte?: number
|
|
71
|
+
};
|
|
72
|
+
export type InOperator<T> = { $in?: T[] };
|
|
73
|
+
export type OperatorOrType<T> = T extends number ? T | Operators | InOperator<T> : T | InOperator<T>;
|
|
74
|
+
export type LogicalOperators<T extends SchemaType> = {
|
|
75
|
+
$and?: Partial<QueryType<T>>[];
|
|
76
|
+
$or?: Partial<QueryType<T>>[];
|
|
77
|
+
};
|
|
78
|
+
export type QueryType<T extends SchemaType> = Partial<{
|
|
79
|
+
[K in keyof T['properties']]: OperatorOrType<
|
|
80
|
+
ExtractType<
|
|
81
|
+
T['properties'][K]['type']
|
|
82
|
+
>
|
|
83
|
+
>
|
|
84
|
+
}> & LogicalOperators<T> | LogicalOperators<T>[];
|
|
85
|
+
export class Query<T extends SchemaType> {
|
|
86
|
+
constructor(query: QueryType<T>, schema:Schema<T>);
|
|
87
|
+
readonly query: QueryType<T>;
|
|
88
|
+
}
|
|
89
|
+
//test
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
export type BaseStorageOptions = {
|
|
94
|
+
[name:string]:string | boolean | number
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
|
|
98
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
99
|
+
dbName: string,
|
|
100
|
+
schemas: SchemasCreate,
|
|
101
|
+
options?: BaseStorageOptions
|
|
102
|
+
): Promise<
|
|
103
|
+
BaseStorage<
|
|
104
|
+
SchemasCreate
|
|
105
|
+
>
|
|
106
|
+
>;
|
|
107
|
+
constructor(
|
|
108
|
+
dbName: string,
|
|
109
|
+
schemas: Schemas,
|
|
110
|
+
options?: BaseStorageOptions
|
|
111
|
+
);
|
|
112
|
+
readonly dbName: string;
|
|
113
|
+
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
114
|
+
readonly options: BaseStorageOptions;
|
|
115
|
+
readonly core: CoreStorage;
|
|
116
|
+
start(): Promise<void>;
|
|
117
|
+
close(): Promise<void>;
|
|
118
|
+
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>): Promise<number>;
|
|
119
|
+
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null | undefined>;
|
|
120
|
+
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
121
|
+
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
122
|
+
getOption(name: string): string | boolean | number | undefined;
|
|
123
|
+
getSchema(name: string): Schema<any>;
|
|
124
|
+
//Call addIndexSchemas if you need extra indexing schemas for your database
|
|
125
|
+
addIndexSchemas(): null
|
|
73
126
|
}
|
|
74
127
|
|
|
75
128
|
|
|
76
129
|
|
|
77
130
|
/**
|
|
78
|
-
* Represents a
|
|
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.
|
|
131
|
+
* Represents a property within a schema, including various constraints and nested properties.
|
|
105
132
|
*/
|
|
106
|
-
export class
|
|
133
|
+
export class Property {
|
|
134
|
+
/**
|
|
135
|
+
* The type of the property.
|
|
136
|
+
*/
|
|
137
|
+
readonly type: string;
|
|
107
138
|
|
|
108
139
|
/**
|
|
109
|
-
*
|
|
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.
|
|
140
|
+
* The version of the property, if applicable.
|
|
118
141
|
*/
|
|
119
|
-
|
|
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>>;
|
|
142
|
+
readonly version?: number;
|
|
128
143
|
|
|
129
144
|
/**
|
|
130
|
-
* The
|
|
131
|
-
*
|
|
132
|
-
* This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
|
|
145
|
+
* The primary key of the property, if applicable.
|
|
133
146
|
*/
|
|
134
|
-
readonly
|
|
135
|
-
[name in keyof T]: Collection<Schema<T[name]>>
|
|
136
|
-
}
|
|
147
|
+
readonly primaryKey?: string;
|
|
137
148
|
|
|
138
|
-
|
|
149
|
+
/**
|
|
150
|
+
* An optional array of nested properties for array-type properties.
|
|
151
|
+
*/
|
|
152
|
+
readonly items?: Property;
|
|
139
153
|
|
|
140
154
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* @returns {Promise<void>} A promise that resolves when the database is started.
|
|
155
|
+
* The maximum number of items for array-type properties, if applicable.
|
|
144
156
|
*/
|
|
145
|
-
|
|
157
|
+
readonly maxItems?: number;
|
|
146
158
|
|
|
147
159
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* @returns {Promise<void>} A promise that resolves when the database is closed.
|
|
160
|
+
* The minimum number of items for array-type properties, if applicable.
|
|
151
161
|
*/
|
|
152
|
-
|
|
153
|
-
}
|
|
162
|
+
readonly minItems?: number;
|
|
154
163
|
|
|
155
|
-
/**
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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>>;
|
|
164
|
+
/**
|
|
165
|
+
* The maximum length for string-type properties, if applicable.
|
|
166
|
+
*/
|
|
167
|
+
readonly maxLength?: number;
|
|
165
168
|
|
|
166
|
-
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
/**
|
|
170
|
+
* The minimum length for string-type properties, if applicable.
|
|
171
|
+
*/
|
|
172
|
+
readonly minLength?: number;
|
|
170
173
|
|
|
171
174
|
/**
|
|
172
|
-
*
|
|
175
|
+
* An optional array of required fields for object-type properties.
|
|
173
176
|
*/
|
|
174
|
-
|
|
177
|
+
readonly required?: boolean;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* An optional default value for the property.
|
|
181
|
+
*/
|
|
182
|
+
readonly default?: any;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* An optional map of nested properties for object-type properties.
|
|
186
|
+
*/
|
|
187
|
+
readonly properties?: {
|
|
188
|
+
[name: string]: Property;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
196
|
+
*/
|
|
197
|
+
export type SchemaTypeRecord = {
|
|
198
|
+
[name: string]: SchemaType
|
|
175
199
|
};
|
|
176
200
|
|
|
201
|
+
export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
202
|
+
constructor(
|
|
203
|
+
name: string,
|
|
204
|
+
schemas: Schemas
|
|
205
|
+
);
|
|
206
|
+
abstract start(): Promise<void>;
|
|
207
|
+
abstract close(): Promise<void>;
|
|
208
|
+
abstract count(
|
|
209
|
+
colectionName: keyof Schemas,
|
|
210
|
+
query: QueryType<Schemas[keyof Schemas]>
|
|
211
|
+
): Promise<number>;
|
|
212
|
+
abstract findDocumentById(
|
|
213
|
+
collectionName: keyof Schemas,
|
|
214
|
+
id: string
|
|
215
|
+
): Promise<Doc<Schemas[keyof Schemas]> | undefined | null>;
|
|
216
|
+
abstract find(
|
|
217
|
+
collectionName: keyof Schemas,
|
|
218
|
+
query: QueryType<Schemas[keyof Schemas]>
|
|
219
|
+
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
220
|
+
abstract write(
|
|
221
|
+
op: Operation<Schemas[keyof Schemas]>
|
|
222
|
+
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
223
|
+
}
|
|
177
224
|
|
|
178
225
|
|
|
179
226
|
/**
|
|
180
|
-
* Represents an
|
|
227
|
+
* Represents an IndexDB storage system extending the base storage functionality.
|
|
181
228
|
*
|
|
182
229
|
* @template T - The schema type.
|
|
183
230
|
*/
|
|
184
|
-
export class
|
|
231
|
+
export class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
185
232
|
/**
|
|
186
233
|
* Frees the resources used by the in-memory storage.
|
|
187
234
|
*/
|
|
@@ -191,49 +238,10 @@ export class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
|
191
238
|
dbName: string,
|
|
192
239
|
schemas: SchemasCreate,
|
|
193
240
|
): Promise<
|
|
194
|
-
|
|
195
|
-
SchemasCreate
|
|
196
|
-
>
|
|
197
|
-
>;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
export type BaseStorageOptions = {
|
|
203
|
-
[name:string]:string | boolean | number
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
|
|
207
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
208
|
-
dbName: string,
|
|
209
|
-
schemas: SchemasCreate,
|
|
210
|
-
options?: BaseStorageOptions
|
|
211
|
-
): Promise<
|
|
212
|
-
BaseStorage<
|
|
241
|
+
IndexDB<
|
|
213
242
|
SchemasCreate
|
|
214
243
|
>
|
|
215
244
|
>;
|
|
216
|
-
|
|
217
|
-
constructor(
|
|
218
|
-
dbName: string,
|
|
219
|
-
schemas: Schemas,
|
|
220
|
-
options?: BaseStorageOptions
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
readonly dbName: string;
|
|
224
|
-
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
225
|
-
readonly options: BaseStorageOptions;
|
|
226
|
-
readonly core: CoreStorage;
|
|
227
|
-
start(): Promise<void>;
|
|
228
|
-
close(): Promise<void>;
|
|
229
|
-
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>): Promise<number>;
|
|
230
|
-
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null | undefined>;
|
|
231
|
-
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
232
|
-
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
233
|
-
|
|
234
|
-
getOption(name: string): string | boolean | number | undefined;
|
|
235
|
-
getSchema(name: string): Schema<any>;
|
|
236
|
-
|
|
237
245
|
}
|
|
238
246
|
|
|
239
247
|
|
|
@@ -269,7 +277,18 @@ export type SchemaType = {
|
|
|
269
277
|
|
|
270
278
|
/**
|
|
271
279
|
* Represents a schema, including its definition and related methods.
|
|
272
|
-
*
|
|
280
|
+
* You may be trying to build a storage, in any other can u won't need access tho this class.
|
|
281
|
+
* Check this example
|
|
282
|
+
*
|
|
283
|
+
* ```typescript
|
|
284
|
+
* class MyStorage extends <T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
285
|
+
* example() {
|
|
286
|
+
* const schema: Schema<any> = this.getSchema("mySchema")
|
|
287
|
+
* }
|
|
288
|
+
* }
|
|
289
|
+
* ```
|
|
290
|
+
* You alwayswill have access to getSchema through the Storage class.
|
|
291
|
+
*
|
|
273
292
|
* @template T - The schema type.
|
|
274
293
|
*/
|
|
275
294
|
export class Schema<T extends SchemaType> {
|
|
@@ -335,100 +354,29 @@ export class Schema<T extends SchemaType> {
|
|
|
335
354
|
|
|
336
355
|
|
|
337
356
|
|
|
338
|
-
export type InternalsRecord = {
|
|
339
|
-
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
340
|
-
};
|
|
341
357
|
/**
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
* @template T - A string literal type representing the basic data type ('string', 'number', 'boolean', 'object', 'array').
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* type StringType = ExtractType<'string'>; // StringType is string
|
|
348
|
-
* type NumberType = ExtractType<'number'>; // NumberType is number
|
|
349
|
-
* type BooleanType = ExtractType<'boolean'>; // BooleanType is boolean
|
|
350
|
-
* type ObjectType = ExtractType<'object'>; // ObjectType is object
|
|
351
|
-
* type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
|
|
352
|
-
*/
|
|
353
|
-
export type ExtractType<T extends string> =
|
|
354
|
-
T extends "string" ? string :
|
|
355
|
-
T extends "number" ? number :
|
|
356
|
-
T extends "boolean" ? boolean :
|
|
357
|
-
T extends "object" ? object :
|
|
358
|
-
T extends "array" ? any[] :
|
|
359
|
-
never;
|
|
360
|
-
|
|
361
|
-
export type IsOptional<T> = T extends { required: false } ? true :
|
|
362
|
-
T extends { default: any } ? true : false;
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Doc is a utility type that transforms a schema type into a document type where each property is mapped to its extracted type.
|
|
366
|
-
*
|
|
367
|
-
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
358
|
+
* Represents an in-memory storage system extending the base storage functionality.
|
|
368
359
|
*
|
|
369
|
-
*
|
|
360
|
+
* @template T - The schema type.
|
|
370
361
|
*/
|
|
371
|
-
export
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
ExtractType<T["properties"][K]["type"]>
|
|
377
|
-
} & {
|
|
378
|
-
__version?: number;
|
|
379
|
-
};
|
|
362
|
+
export class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
363
|
+
/**
|
|
364
|
+
* Frees the resources used by the in-memory storage.
|
|
365
|
+
*/
|
|
366
|
+
free(): void;
|
|
380
367
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
* @returns A promise that resolves to an array of documents.
|
|
390
|
-
*/
|
|
391
|
-
find(query: QueryType<T>): Promise<Doc<T>[]>;
|
|
392
|
-
/**
|
|
393
|
-
* count all documents in the collection.
|
|
394
|
-
*
|
|
395
|
-
* @returns A promise that resolves to an array of documents.
|
|
396
|
-
*/
|
|
397
|
-
count(query: QueryType<T>): Promise<number>;
|
|
398
|
-
/**
|
|
399
|
-
* Finds a single document in the collection by its ID.
|
|
400
|
-
*
|
|
401
|
-
* @param id - The ID of the document to find.
|
|
402
|
-
* @returns A promise that resolves to the found document.
|
|
403
|
-
*/
|
|
404
|
-
findById(id: string): Promise<Doc<T>>;
|
|
405
|
-
/**
|
|
406
|
-
* Updates a document in the collection by its ID.
|
|
407
|
-
*
|
|
408
|
-
* @param id - The ID of the document to update.
|
|
409
|
-
* @param document - A partial document containing the fields to update.
|
|
410
|
-
* @returns A promise that resolves when the update is complete.
|
|
411
|
-
*/
|
|
412
|
-
update(document: Partial<Doc<T>>): Promise<void>;
|
|
413
|
-
/**
|
|
414
|
-
* Creates a new document in the collection.
|
|
415
|
-
*
|
|
416
|
-
* @param document - The document to create.
|
|
417
|
-
* @returns A promise that resolves to the created document.
|
|
418
|
-
*/
|
|
419
|
-
create(document: Doc<T>): Promise<Doc<T>>;
|
|
420
|
-
/**
|
|
421
|
-
* Deletes a document in the collection by its ID.
|
|
422
|
-
*
|
|
423
|
-
* @param id - The ID of the document to delete.
|
|
424
|
-
* @returns A promise that resolves when the deletion is complete.
|
|
425
|
-
*/
|
|
426
|
-
delete(id: string): Promise<void>;
|
|
368
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
369
|
+
dbName: string,
|
|
370
|
+
schemas: SchemasCreate,
|
|
371
|
+
): Promise<
|
|
372
|
+
InMemory<
|
|
373
|
+
SchemasCreate
|
|
374
|
+
>
|
|
375
|
+
>;
|
|
427
376
|
}
|
|
428
377
|
|
|
429
378
|
|
|
430
379
|
|
|
431
|
-
|
|
432
380
|
export type EnumerateUpTo<
|
|
433
381
|
N extends number,
|
|
434
382
|
Acc extends number[] = []
|
|
@@ -496,120 +444,210 @@ export class BasePlugin implements BasePluginOptions {
|
|
|
496
444
|
|
|
497
445
|
|
|
498
446
|
/**
|
|
499
|
-
* Represents
|
|
447
|
+
* Represents a database containing collections of documents.
|
|
448
|
+
* RIDB extends from this class and is used to expose collections.
|
|
449
|
+
*
|
|
450
|
+
* So if you specify:
|
|
451
|
+
* ```typescript
|
|
452
|
+
* const db = new RIDB(
|
|
453
|
+
* {
|
|
454
|
+
* schemas: {
|
|
455
|
+
* demo: {
|
|
456
|
+
* version: 0,
|
|
457
|
+
* primaryKey: 'id',
|
|
458
|
+
* type: SchemaFieldType.object,
|
|
459
|
+
* properties: {
|
|
460
|
+
* id: {
|
|
461
|
+
* type: SchemaFieldType.string,
|
|
462
|
+
* maxLength: 60
|
|
463
|
+
* }
|
|
464
|
+
* }
|
|
465
|
+
* }
|
|
466
|
+
* } as const
|
|
467
|
+
* }
|
|
468
|
+
* )
|
|
469
|
+
* ```
|
|
470
|
+
*
|
|
471
|
+
* 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.
|
|
500
472
|
*
|
|
501
|
-
* @template T -
|
|
502
|
-
*/
|
|
503
|
-
export class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
504
|
-
/**
|
|
505
|
-
* Frees the resources used by the in-memory storage.
|
|
506
|
-
*/
|
|
507
|
-
free(): void;
|
|
508
|
-
|
|
509
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
510
|
-
dbName: string,
|
|
511
|
-
schemas: SchemasCreate,
|
|
512
|
-
): Promise<
|
|
513
|
-
IndexDB<
|
|
514
|
-
SchemasCreate
|
|
515
|
-
>
|
|
516
|
-
>;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
473
|
+
* @template T - A record of schema types.
|
|
523
474
|
*/
|
|
524
|
-
export
|
|
525
|
-
[name: string]: SchemaType
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
529
|
-
constructor(
|
|
530
|
-
name: string,
|
|
531
|
-
schemas: Schemas
|
|
532
|
-
);
|
|
533
|
-
abstract start(): Promise<void>;
|
|
534
|
-
abstract close(): Promise<void>;
|
|
535
|
-
abstract count(
|
|
536
|
-
colectionName: keyof Schemas,
|
|
537
|
-
query: QueryType<Schemas[keyof Schemas]>
|
|
538
|
-
): Promise<number>;
|
|
539
|
-
abstract findDocumentById(
|
|
540
|
-
collectionName: keyof Schemas,
|
|
541
|
-
id: string
|
|
542
|
-
): Promise<Doc<Schemas[keyof Schemas]> | undefined | null>;
|
|
543
|
-
abstract find(
|
|
544
|
-
collectionName: keyof Schemas,
|
|
545
|
-
query: QueryType<Schemas[keyof Schemas]>
|
|
546
|
-
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
547
|
-
abstract write(
|
|
548
|
-
op: Operation<Schemas[keyof Schemas]>
|
|
549
|
-
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
550
|
-
}
|
|
551
|
-
|
|
475
|
+
export class Database<T extends SchemaTypeRecord> {
|
|
552
476
|
|
|
553
|
-
/**
|
|
554
|
-
* Represents a property within a schema, including various constraints and nested properties.
|
|
555
|
-
*/
|
|
556
|
-
export class Property {
|
|
557
477
|
/**
|
|
558
|
-
*
|
|
478
|
+
* Creates a new `Database` instance with the provided schemas and storage module.
|
|
479
|
+
*
|
|
480
|
+
* @template TS - A record of schema types.
|
|
481
|
+
* @param {TS} schemas - The schemas to use for the collections.
|
|
482
|
+
* @param migrations
|
|
483
|
+
* @param plugins
|
|
484
|
+
* @param options
|
|
485
|
+
* @param password
|
|
486
|
+
* @returns {Promise<Database<TS>>} A promise that resolves to the created `Database` instance.
|
|
559
487
|
*/
|
|
560
|
-
|
|
488
|
+
static create<TS extends SchemaTypeRecord>(
|
|
489
|
+
db_name: string,
|
|
490
|
+
schemas: TS,
|
|
491
|
+
migrations: MigrationPathsForSchemas<TS> | MigrationPathsForSchema<TS[string]>,
|
|
492
|
+
plugins:Array<typeof BasePlugin>,
|
|
493
|
+
options: RIDBModule,
|
|
494
|
+
password?:string,
|
|
495
|
+
storage?: BaseStorage<TS>
|
|
496
|
+
): Promise<Database<TS>>;
|
|
561
497
|
|
|
562
498
|
/**
|
|
563
|
-
* The
|
|
499
|
+
* The collections in the database.
|
|
500
|
+
*
|
|
501
|
+
* This is a read-only property where the key is the name of the collection and the value is a `Collection` instance.
|
|
564
502
|
*/
|
|
565
|
-
readonly
|
|
503
|
+
readonly collections: {
|
|
504
|
+
[name in keyof T]: Collection<Schema<T[name]>>
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
readonly started: boolean;
|
|
566
508
|
|
|
567
509
|
/**
|
|
568
|
-
*
|
|
510
|
+
* Starts the database.
|
|
511
|
+
*
|
|
512
|
+
* @returns {Promise<void>} A promise that resolves when the database is started.
|
|
569
513
|
*/
|
|
570
|
-
|
|
514
|
+
start(): Promise<void>;
|
|
571
515
|
|
|
572
516
|
/**
|
|
573
|
-
*
|
|
517
|
+
* Closes the database.
|
|
518
|
+
*
|
|
519
|
+
* @returns {Promise<void>} A promise that resolves when the database is closed.
|
|
574
520
|
*/
|
|
575
|
-
|
|
521
|
+
close(): Promise<void>;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Represents a function type for creating storage with the provided schema type records.
|
|
526
|
+
*
|
|
527
|
+
* @template T - The schema type record.
|
|
528
|
+
* @param {T} records - The schema type records.
|
|
529
|
+
* @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
|
|
530
|
+
*/
|
|
531
|
+
export type CreateStorage = <T extends SchemaTypeRecord>(
|
|
532
|
+
records: T
|
|
533
|
+
) => Promise<BaseStorage<T>>;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Represents a storage module with a method for creating storage.
|
|
537
|
+
*/
|
|
538
|
+
export type RIDBModule = {
|
|
576
539
|
|
|
577
540
|
/**
|
|
578
|
-
*
|
|
541
|
+
* Plugin constructors array
|
|
579
542
|
*/
|
|
580
|
-
|
|
543
|
+
apply: (plugins:Array<typeof BasePlugin>) => Array<BasePlugin>;
|
|
544
|
+
};
|
|
581
545
|
|
|
582
|
-
/**
|
|
583
|
-
* The minimum number of items for array-type properties, if applicable.
|
|
584
|
-
*/
|
|
585
|
-
readonly minItems?: number;
|
|
586
546
|
|
|
587
|
-
/**
|
|
588
|
-
* The maximum length for string-type properties, if applicable.
|
|
589
|
-
*/
|
|
590
|
-
readonly maxLength?: number;
|
|
591
547
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
548
|
+
export type InternalsRecord = {
|
|
549
|
+
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* ExtractType is a utility type that maps a string representing a basic data type to the actual TypeScript type.
|
|
553
|
+
*
|
|
554
|
+
* @template T - A string literal type representing the basic data type ('string', 'number', 'boolean', 'object', 'array').
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* type StringType = ExtractType<'string'>; // StringType is string
|
|
558
|
+
* type NumberType = ExtractType<'number'>; // NumberType is number
|
|
559
|
+
* type BooleanType = ExtractType<'boolean'>; // BooleanType is boolean
|
|
560
|
+
* type ObjectType = ExtractType<'object'>; // ObjectType is object
|
|
561
|
+
* type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
|
|
562
|
+
*/
|
|
563
|
+
export type ExtractType<T extends string> =
|
|
564
|
+
T extends "string" ? string :
|
|
565
|
+
T extends "number" ? number :
|
|
566
|
+
T extends "boolean" ? boolean :
|
|
567
|
+
T extends "object" ? object :
|
|
568
|
+
T extends "array" ? any[] :
|
|
569
|
+
never;
|
|
596
570
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
571
|
+
export type IsOptional<T> = T extends { required: false } ? true :
|
|
572
|
+
T extends { default: any } ? true : false;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Doc is a utility type that transforms a schema type into a document type where each property is mapped to its extracted type.
|
|
576
|
+
*
|
|
577
|
+
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
578
|
+
*
|
|
579
|
+
* type Document = Doc<Schema>; // Document is { name: string; age: number; }
|
|
580
|
+
*/
|
|
581
|
+
export type Doc<T extends SchemaType> = {
|
|
582
|
+
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
|
|
583
|
+
ExtractType<T["properties"][K]["type"]>
|
|
584
|
+
} & {
|
|
585
|
+
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends false ? K : never]:
|
|
586
|
+
ExtractType<T["properties"][K]["type"]>
|
|
587
|
+
} & {
|
|
588
|
+
__version?: number;
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Collection is a class that represents a collection of documents in a database.
|
|
593
|
+
* @template T - A schema type defining the structure of the documents in the collection.
|
|
594
|
+
*/
|
|
595
|
+
export class Collection<T extends SchemaType> {
|
|
596
|
+
/**
|
|
597
|
+
* Finds all documents in the collection.
|
|
598
|
+
*
|
|
599
|
+
* @returns A promise that resolves to an array of documents.
|
|
600
|
+
*/
|
|
601
|
+
find(query: QueryType<T>): Promise<Doc<T>[]>;
|
|
602
|
+
/**
|
|
603
|
+
* count all documents in the collection.
|
|
604
|
+
*
|
|
605
|
+
* @returns A promise that resolves to an array of documents.
|
|
606
|
+
*/
|
|
607
|
+
count(query: QueryType<T>): Promise<number>;
|
|
608
|
+
/**
|
|
609
|
+
* Finds a single document in the collection by its ID.
|
|
610
|
+
*
|
|
611
|
+
* @param id - The ID of the document to find.
|
|
612
|
+
* @returns A promise that resolves to the found document.
|
|
613
|
+
*/
|
|
614
|
+
findById(id: string): Promise<Doc<T>>;
|
|
615
|
+
/**
|
|
616
|
+
* Updates a document in the collection by its ID.
|
|
617
|
+
*
|
|
618
|
+
* @param id - The ID of the document to update.
|
|
619
|
+
* @param document - A partial document containing the fields to update.
|
|
620
|
+
* @returns A promise that resolves when the update is complete.
|
|
621
|
+
*/
|
|
622
|
+
update(document: Partial<Doc<T>>): Promise<void>;
|
|
623
|
+
/**
|
|
624
|
+
* Creates a new document in the collection.
|
|
625
|
+
*
|
|
626
|
+
* @param document - The document to create.
|
|
627
|
+
* @returns A promise that resolves to the created document.
|
|
628
|
+
*/
|
|
629
|
+
create(document: Doc<T>): Promise<Doc<T>>;
|
|
630
|
+
/**
|
|
631
|
+
* Deletes a document in the collection by its ID.
|
|
632
|
+
*
|
|
633
|
+
* @param id - The ID of the document to delete.
|
|
634
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
635
|
+
*/
|
|
636
|
+
delete(id: string): Promise<void>;
|
|
637
|
+
}
|
|
601
638
|
|
|
602
|
-
/**
|
|
603
|
-
* An optional default value for the property.
|
|
604
|
-
*/
|
|
605
|
-
readonly default?: any;
|
|
606
639
|
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
export class CoreStorage {
|
|
607
643
|
/**
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
644
|
+
* @param {any} document
|
|
645
|
+
* @param {Query} query
|
|
646
|
+
* @returns {boolean}
|
|
647
|
+
*/
|
|
648
|
+
matchesQuery(document: any, query: Query<any>): boolean;
|
|
649
|
+
getPrimaryKeyTyped(value: any): string | number;
|
|
650
|
+
getIndexes(schema: Schema<any>, op: Operation): string[];
|
|
613
651
|
}
|
|
614
652
|
|
|
615
653
|
|
|
@@ -635,38 +673,9 @@ export type Operation<T extends SchemaType> = {
|
|
|
635
673
|
*/
|
|
636
674
|
data: Doc<T>,
|
|
637
675
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
*/
|
|
641
|
-
indexes: Array<string>
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
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>
|
|
676
|
+
primaryKeyField?: string,
|
|
677
|
+
primaryKey?: string
|
|
668
678
|
}
|
|
669
|
-
//test
|
|
670
679
|
|
|
671
680
|
|
|
672
681
|
/**
|
|
@@ -711,32 +720,64 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
711
720
|
|
|
712
721
|
export interface InitOutput {
|
|
713
722
|
readonly memory: WebAssembly.Memory;
|
|
714
|
-
readonly
|
|
715
|
-
readonly
|
|
716
|
-
readonly
|
|
717
|
-
readonly
|
|
718
|
-
readonly
|
|
719
|
-
readonly
|
|
720
|
-
readonly
|
|
721
|
-
readonly
|
|
722
|
-
readonly
|
|
723
|
-
readonly
|
|
724
|
-
readonly
|
|
725
|
-
readonly
|
|
726
|
-
readonly
|
|
727
|
-
readonly
|
|
728
|
-
readonly
|
|
729
|
-
readonly
|
|
730
|
-
readonly
|
|
731
|
-
readonly
|
|
732
|
-
readonly
|
|
733
|
-
readonly
|
|
734
|
-
readonly
|
|
723
|
+
readonly __wbg_query_free: (a: number) => void;
|
|
724
|
+
readonly query_new: (a: number, b: number, c: number) => void;
|
|
725
|
+
readonly query_query: (a: number, b: number) => void;
|
|
726
|
+
readonly query_get_properties: (a: number, b: number) => void;
|
|
727
|
+
readonly query_parse: (a: number, b: number) => void;
|
|
728
|
+
readonly query_process_query: (a: number, b: number, c: number) => void;
|
|
729
|
+
readonly query_get: (a: number, b: number, c: number, d: number) => void;
|
|
730
|
+
readonly __wbgt_test_get_properties_simple_fields_6: (a: number) => void;
|
|
731
|
+
readonly __wbgt_test_get_properties_with_operators_7: (a: number) => void;
|
|
732
|
+
readonly __wbgt_test_get_properties_with_logical_operators_8: (a: number) => void;
|
|
733
|
+
readonly __wbgt_test_get_properties_nested_operators_9: (a: number) => void;
|
|
734
|
+
readonly __wbgt_test_get_properties_array_values_10: (a: number) => void;
|
|
735
|
+
readonly __wbgt_test_get_properties_empty_query_11: (a: number) => void;
|
|
736
|
+
readonly __wbgt_test_get_properties_deeply_nested_12: (a: number) => void;
|
|
737
|
+
readonly __wbgt_test_get_properties_with_multiple_same_props_13: (a: number) => void;
|
|
738
|
+
readonly __wbgt_test_get_properties_with_array_at_top_level_14: (a: number) => void;
|
|
739
|
+
readonly __wbgt_test_query_parse_operator_wrong_type_15: (a: number) => void;
|
|
740
|
+
readonly __wbgt_test_query_parse_in_operator_16: (a: number) => void;
|
|
741
|
+
readonly __wbgt_test_query_parse_in_operator_wrong_type_17: (a: number) => void;
|
|
742
|
+
readonly __wbgt_test_query_get_query_normalization_simple_attributes_18: (a: number) => void;
|
|
743
|
+
readonly __wbgt_test_query_get_query_normalization_with_logical_operator_19: (a: number) => void;
|
|
744
|
+
readonly __wbgt_test_query_get_query_normalization_nested_logical_operators_20: (a: number) => void;
|
|
745
|
+
readonly __wbgt_test_query_get_query_normalization_only_logical_operator_21: (a: number) => void;
|
|
746
|
+
readonly __wbgt_test_query_get_query_normalization_complex_mixed_22: (a: number) => void;
|
|
747
|
+
readonly __wbgt_test_query_parse_empty_query_23: (a: number) => void;
|
|
748
|
+
readonly __wbgt_test_query_parse_age_query_24: (a: number) => void;
|
|
749
|
+
readonly __wbgt_test_query_parse_non_object_query_25: (a: number) => void;
|
|
750
|
+
readonly __wbgt_test_query_parse_multiple_operators_26: (a: number) => void;
|
|
751
|
+
readonly __wbgt_test_query_parse_invalid_in_operator_27: (a: number) => void;
|
|
752
|
+
readonly __wbgt_test_query_parse_empty_logical_operators_28: (a: number) => void;
|
|
735
753
|
readonly __wbg_basestorage_free: (a: number) => void;
|
|
736
754
|
readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
755
|
+
readonly basestorage_addIndexSchemas: (a: number, b: number) => void;
|
|
737
756
|
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
738
757
|
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
739
758
|
readonly basestorage_core: (a: number, b: number) => void;
|
|
759
|
+
readonly __wbg_property_free: (a: number) => void;
|
|
760
|
+
readonly property_is_valid: (a: number, b: number) => void;
|
|
761
|
+
readonly property_type: (a: number) => number;
|
|
762
|
+
readonly property_items: (a: number, b: number) => void;
|
|
763
|
+
readonly property_maxItems: (a: number, b: number) => void;
|
|
764
|
+
readonly property_minItems: (a: number, b: number) => void;
|
|
765
|
+
readonly property_maxLength: (a: number, b: number) => void;
|
|
766
|
+
readonly property_minLength: (a: number, b: number) => void;
|
|
767
|
+
readonly property_properties: (a: number, b: number) => void;
|
|
768
|
+
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
769
|
+
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
770
|
+
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
771
|
+
readonly __wbg_indexdb_free: (a: number) => void;
|
|
772
|
+
readonly indexdb_get_stores: (a: number, b: number) => void;
|
|
773
|
+
readonly indexdb_get_store: (a: number, b: number, c: number, d: number) => void;
|
|
774
|
+
readonly indexdb_create: (a: number, b: number, c: number) => number;
|
|
775
|
+
readonly indexdb_write: (a: number, b: number) => number;
|
|
776
|
+
readonly indexdb_find: (a: number, b: number, c: number, d: number) => number;
|
|
777
|
+
readonly indexdb_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
778
|
+
readonly indexdb_count: (a: number, b: number, c: number, d: number) => number;
|
|
779
|
+
readonly indexdb_close: (a: number) => number;
|
|
780
|
+
readonly indexdb_start: (a: number) => number;
|
|
740
781
|
readonly __wbg_schema_free: (a: number) => void;
|
|
741
782
|
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
742
783
|
readonly schema_is_valid: (a: number, b: number) => void;
|
|
@@ -750,6 +791,27 @@ export interface InitOutput {
|
|
|
750
791
|
readonly __wbgt_test_schema_creation_3: (a: number) => void;
|
|
751
792
|
readonly __wbgt_test_schema_validation_4: (a: number) => void;
|
|
752
793
|
readonly __wbgt_test_invalid_schema_5: (a: number) => void;
|
|
794
|
+
readonly __wbg_inmemory_free: (a: number) => void;
|
|
795
|
+
readonly inmemory_create: (a: number, b: number, c: number) => number;
|
|
796
|
+
readonly inmemory_write: (a: number, b: number) => number;
|
|
797
|
+
readonly inmemory_find: (a: number, b: number, c: number, d: number) => number;
|
|
798
|
+
readonly inmemory_findDocumentById: (a: number, b: number, c: number, d: number) => number;
|
|
799
|
+
readonly inmemory_count: (a: number, b: number, c: number, d: number) => number;
|
|
800
|
+
readonly inmemory_close: (a: number) => number;
|
|
801
|
+
readonly inmemory_start: (a: number) => number;
|
|
802
|
+
readonly __wbg_baseplugin_free: (a: number) => void;
|
|
803
|
+
readonly baseplugin_new: (a: number, b: number, c: number) => void;
|
|
804
|
+
readonly baseplugin_name: (a: number) => number;
|
|
805
|
+
readonly baseplugin_get_doc_create_hook: (a: number) => number;
|
|
806
|
+
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
807
|
+
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
808
|
+
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
809
|
+
readonly __wbg_database_free: (a: number) => void;
|
|
810
|
+
readonly database_start: (a: number) => number;
|
|
811
|
+
readonly database_close: (a: number) => number;
|
|
812
|
+
readonly database_started: (a: number) => number;
|
|
813
|
+
readonly database_collections: (a: number, b: number) => void;
|
|
814
|
+
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
753
815
|
readonly __wbg_collection_free: (a: number) => void;
|
|
754
816
|
readonly collection_name: (a: number, b: number) => void;
|
|
755
817
|
readonly collection_schema: (a: number, b: number) => void;
|
|
@@ -759,60 +821,20 @@ export interface InitOutput {
|
|
|
759
821
|
readonly collection_update: (a: number, b: number) => number;
|
|
760
822
|
readonly collection_create: (a: number, b: number) => number;
|
|
761
823
|
readonly collection_delete: (a: number, b: number) => number;
|
|
762
|
-
readonly
|
|
763
|
-
readonly
|
|
764
|
-
readonly
|
|
765
|
-
readonly
|
|
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;
|
|
777
|
-
readonly __wbg_property_free: (a: number) => void;
|
|
778
|
-
readonly property_is_valid: (a: number, b: number) => void;
|
|
779
|
-
readonly property_type: (a: number) => number;
|
|
780
|
-
readonly property_items: (a: number, b: number) => void;
|
|
781
|
-
readonly property_maxItems: (a: number, b: number) => void;
|
|
782
|
-
readonly property_minItems: (a: number, b: number) => void;
|
|
783
|
-
readonly property_maxLength: (a: number, b: number) => void;
|
|
784
|
-
readonly property_minLength: (a: number, b: number) => void;
|
|
785
|
-
readonly property_properties: (a: number, b: number) => void;
|
|
786
|
-
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
787
|
-
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
788
|
-
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
824
|
+
readonly corestorage_new: () => number;
|
|
825
|
+
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
826
|
+
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
827
|
+
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
789
828
|
readonly __wbg_operation_free: (a: number) => void;
|
|
790
829
|
readonly operation_collection: (a: number, b: number) => void;
|
|
791
830
|
readonly operation_opType: (a: number) => number;
|
|
792
831
|
readonly operation_data: (a: number) => number;
|
|
793
|
-
readonly
|
|
794
|
-
readonly
|
|
795
|
-
readonly
|
|
796
|
-
readonly
|
|
797
|
-
readonly
|
|
798
|
-
readonly
|
|
799
|
-
readonly __wbgt_test_query_parse_invalid_property_7: (a: number) => void;
|
|
800
|
-
readonly __wbgt_test_query_parse_invalid_type_8: (a: number) => void;
|
|
801
|
-
readonly __wbgt_test_query_parse_logical_operators_9: (a: number) => void;
|
|
802
|
-
readonly __wbgt_test_query_parse_invalid_operator_10: (a: number) => void;
|
|
803
|
-
readonly __wbgt_test_query_parse_operator_wrong_type_11: (a: number) => void;
|
|
804
|
-
readonly __wbgt_test_query_parse_in_operator_12: (a: number) => void;
|
|
805
|
-
readonly __wbgt_test_query_parse_in_operator_wrong_type_13: (a: number) => void;
|
|
806
|
-
readonly __wbgt_test_query_get_query_normalization_simple_attributes_14: (a: number) => void;
|
|
807
|
-
readonly __wbgt_test_query_get_query_normalization_with_logical_operator_15: (a: number) => void;
|
|
808
|
-
readonly __wbgt_test_query_get_query_normalization_nested_logical_operators_16: (a: number) => void;
|
|
809
|
-
readonly __wbgt_test_query_get_query_normalization_only_logical_operator_17: (a: number) => void;
|
|
810
|
-
readonly __wbgt_test_query_get_query_normalization_complex_mixed_18: (a: number) => void;
|
|
811
|
-
readonly __wbgt_test_query_parse_empty_query_19: (a: number) => void;
|
|
812
|
-
readonly __wbgt_test_query_parse_non_object_query_20: (a: number) => void;
|
|
813
|
-
readonly __wbgt_test_query_parse_multiple_operators_21: (a: number) => void;
|
|
814
|
-
readonly __wbgt_test_query_parse_invalid_in_operator_22: (a: number) => void;
|
|
815
|
-
readonly __wbgt_test_query_parse_empty_logical_operators_23: (a: number) => void;
|
|
832
|
+
readonly operation_primaryKeyField: (a: number) => number;
|
|
833
|
+
readonly operation_primaryKey: (a: number) => number;
|
|
834
|
+
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
835
|
+
readonly __wbg_corestorage_free: (a: number) => void;
|
|
836
|
+
readonly main_js: () => void;
|
|
837
|
+
readonly is_debug_mode: () => number;
|
|
816
838
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
817
839
|
readonly wasmbindgentestcontext_new: () => number;
|
|
818
840
|
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
|
@@ -825,16 +847,16 @@ export interface InitOutput {
|
|
|
825
847
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
826
848
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
827
849
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
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
850
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
831
|
-
readonly
|
|
832
|
-
readonly
|
|
851
|
+
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb43f4ea73c3b7f8b: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
852
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h57c5f273361b47b1: (a: number, b: number, c: number) => void;
|
|
853
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hfb3063b9244661be: (a: number, b: number, c: number) => number;
|
|
854
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc0ac713d063ee923: (a: number, b: number, c: number) => void;
|
|
833
855
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
834
856
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
835
|
-
readonly
|
|
836
|
-
readonly
|
|
837
|
-
readonly
|
|
857
|
+
readonly wasm_bindgen__convert__closures__invoke0_mut__haf3b101083ea1baf: (a: number, b: number) => void;
|
|
858
|
+
readonly wasm_bindgen__convert__closures__invoke3_mut__h2c719ebcebf5f8cb: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
859
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h1ff4641e5edbc834: (a: number, b: number, c: number, d: number) => void;
|
|
838
860
|
readonly __wbindgen_start: () => void;
|
|
839
861
|
}
|
|
840
862
|
|