@trust0/ridb-core 1.7.11 → 1.7.13
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/README.md +2 -8
- package/build/ridb_core.d.ts +222 -222
- package/build/ridb_core.js +48 -47
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -15,14 +15,8 @@
|
|
|
15
15
|
RIDB secure database wrapper for the web with multiple storage engines, written in rust.
|
|
16
16
|
This package serves as wasm wrapper for the [RIDB](https://github.com/trust0-project/RIDB) project, providing a secure and lightweight database solution for the web.
|
|
17
17
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
Building the project is pretty straight forward.
|
|
21
|
-
|
|
22
|
-
### Requirements
|
|
23
|
-
* Bash
|
|
24
|
-
* Have Rust ([cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html)) and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)) installed.
|
|
25
|
-
* Node JS Version (20/LTS Recommended)
|
|
18
|
+
## Documentation
|
|
19
|
+
Complete type structure and sdk docs can be found [here](./docs/README.md)
|
|
26
20
|
|
|
27
21
|
### Building the source code
|
|
28
22
|
Building the source code will compile the rust code into wasm and then bundle the Javascript code using esbuild, the output will be located in ./ts/build.
|
package/build/ridb_core.d.ts
CHANGED
|
@@ -73,6 +73,144 @@ declare enum OpType {
|
|
|
73
73
|
COUNT = 4,
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
type InternalsRecord = {
|
|
77
|
+
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* ExtractType is a utility type that maps a string representing a basic data type to the actual TypeScript type.
|
|
81
|
+
*
|
|
82
|
+
* @template T - A string literal type representing the basic data type ('string', 'number', 'boolean', 'object', 'array').
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* type StringType = ExtractType<'string'>; // StringType is string
|
|
86
|
+
* type NumberType = ExtractType<'number'>; // NumberType is number
|
|
87
|
+
* type BooleanType = ExtractType<'boolean'>; // BooleanType is boolean
|
|
88
|
+
* type ObjectType = ExtractType<'object'>; // ObjectType is object
|
|
89
|
+
* type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
|
|
90
|
+
*/
|
|
91
|
+
type ExtractType<T extends string> =
|
|
92
|
+
T extends "string" ? string :
|
|
93
|
+
T extends "number" ? number :
|
|
94
|
+
T extends "boolean" ? boolean :
|
|
95
|
+
T extends "object" ? object :
|
|
96
|
+
T extends "array" ? any[] :
|
|
97
|
+
never;
|
|
98
|
+
|
|
99
|
+
type IsOptional<T> = T extends { required: false } ? true :
|
|
100
|
+
T extends { default: any } ? true : false;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Doc is a utility type that transforms a schema type into a document type where each property is mapped to its extracted type.
|
|
104
|
+
*
|
|
105
|
+
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
106
|
+
*
|
|
107
|
+
* type Document = Doc<Schema>; // Document is { name: string; age: number; }
|
|
108
|
+
*/
|
|
109
|
+
type Doc<T extends SchemaType> = {
|
|
110
|
+
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
|
|
111
|
+
ExtractType<T["properties"][K]["type"]>
|
|
112
|
+
} & {
|
|
113
|
+
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends false ? K : never]:
|
|
114
|
+
ExtractType<T["properties"][K]["type"]>
|
|
115
|
+
} & {
|
|
116
|
+
__version?: number;
|
|
117
|
+
createdAt?: number;
|
|
118
|
+
updatedAt?: number;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type QueryOptions = {
|
|
122
|
+
limit?: number;
|
|
123
|
+
offset?: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Collection is a class that represents a collection of documents in a database.
|
|
128
|
+
* @template T - A schema type defining the structure of the documents in the collection.
|
|
129
|
+
*/
|
|
130
|
+
declare class Collection<T extends SchemaType> {
|
|
131
|
+
/**
|
|
132
|
+
* Finds all documents in the collection.
|
|
133
|
+
*
|
|
134
|
+
* @returns A promise that resolves to an array of documents.
|
|
135
|
+
*/
|
|
136
|
+
find(query: QueryType<T>, options?: QueryOptions): Promise<Doc<T>[]>;
|
|
137
|
+
/**
|
|
138
|
+
* count all documents in the collection.
|
|
139
|
+
*
|
|
140
|
+
* @returns A promise that resolves to an array of documents.
|
|
141
|
+
*/
|
|
142
|
+
count(query: QueryType<T>, options?: QueryOptions): Promise<number>;
|
|
143
|
+
/**
|
|
144
|
+
* Finds a single document in the collection by its ID.
|
|
145
|
+
*
|
|
146
|
+
* @param id - The ID of the document to find.
|
|
147
|
+
* @returns A promise that resolves to the found document.
|
|
148
|
+
*/
|
|
149
|
+
findById(id: string): Promise<Doc<T>>;
|
|
150
|
+
/**
|
|
151
|
+
* Updates a document in the collection by its ID.
|
|
152
|
+
*
|
|
153
|
+
* @param id - The ID of the document to update.
|
|
154
|
+
* @param document - A partial document containing the fields to update.
|
|
155
|
+
* @returns A promise that resolves when the update is complete.
|
|
156
|
+
*/
|
|
157
|
+
update(document: Partial<Doc<T>>): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Creates a new document in the collection.
|
|
160
|
+
*
|
|
161
|
+
* @param document - The document to create.
|
|
162
|
+
* @returns A promise that resolves to the created document.
|
|
163
|
+
*/
|
|
164
|
+
create(document: Doc<T>): Promise<Doc<T>>;
|
|
165
|
+
/**
|
|
166
|
+
* Deletes a document in the collection by its ID.
|
|
167
|
+
*
|
|
168
|
+
* @param id - The ID of the document to delete.
|
|
169
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
170
|
+
*/
|
|
171
|
+
delete(id: string): Promise<void>;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
type BaseStorageOptions = {
|
|
178
|
+
[name:string]:string | boolean | number
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
|
|
182
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
183
|
+
dbName: string,
|
|
184
|
+
schemas: SchemasCreate,
|
|
185
|
+
options?: BaseStorageOptions
|
|
186
|
+
): Promise<
|
|
187
|
+
BaseStorage<
|
|
188
|
+
SchemasCreate
|
|
189
|
+
>
|
|
190
|
+
>;
|
|
191
|
+
constructor(
|
|
192
|
+
dbName: string,
|
|
193
|
+
schemas: Schemas,
|
|
194
|
+
options?: BaseStorageOptions
|
|
195
|
+
);
|
|
196
|
+
readonly dbName: string;
|
|
197
|
+
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
198
|
+
readonly options: BaseStorageOptions;
|
|
199
|
+
readonly core: CoreStorage;
|
|
200
|
+
start(): Promise<void>;
|
|
201
|
+
close(): Promise<void>;
|
|
202
|
+
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<number>;
|
|
203
|
+
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
204
|
+
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
205
|
+
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
206
|
+
getOption(name: string): string | boolean | number | undefined;
|
|
207
|
+
getSchema(name: string): Schema<any>;
|
|
208
|
+
//Call addIndexSchemas if you need extra indexing schemas for your database
|
|
209
|
+
addIndexSchemas(): null
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
76
214
|
/**
|
|
77
215
|
* Represents a property within a schema, including various constraints and nested properties.
|
|
78
216
|
*/
|
|
@@ -347,190 +485,6 @@ declare class BasePlugin implements BasePluginOptions {
|
|
|
347
485
|
|
|
348
486
|
|
|
349
487
|
|
|
350
|
-
type InternalsRecord = {
|
|
351
|
-
[name: string]: BaseStorage<SchemaTypeRecord>
|
|
352
|
-
};
|
|
353
|
-
/**
|
|
354
|
-
* ExtractType is a utility type that maps a string representing a basic data type to the actual TypeScript type.
|
|
355
|
-
*
|
|
356
|
-
* @template T - A string literal type representing the basic data type ('string', 'number', 'boolean', 'object', 'array').
|
|
357
|
-
*
|
|
358
|
-
* @example
|
|
359
|
-
* type StringType = ExtractType<'string'>; // StringType is string
|
|
360
|
-
* type NumberType = ExtractType<'number'>; // NumberType is number
|
|
361
|
-
* type BooleanType = ExtractType<'boolean'>; // BooleanType is boolean
|
|
362
|
-
* type ObjectType = ExtractType<'object'>; // ObjectType is object
|
|
363
|
-
* type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
|
|
364
|
-
*/
|
|
365
|
-
type ExtractType<T extends string> =
|
|
366
|
-
T extends "string" ? string :
|
|
367
|
-
T extends "number" ? number :
|
|
368
|
-
T extends "boolean" ? boolean :
|
|
369
|
-
T extends "object" ? object :
|
|
370
|
-
T extends "array" ? any[] :
|
|
371
|
-
never;
|
|
372
|
-
|
|
373
|
-
type IsOptional<T> = T extends { required: false } ? true :
|
|
374
|
-
T extends { default: any } ? true : false;
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Doc is a utility type that transforms a schema type into a document type where each property is mapped to its extracted type.
|
|
378
|
-
*
|
|
379
|
-
* @template T - A schema type with a 'properties' field where each property's type is represented as a string.
|
|
380
|
-
*
|
|
381
|
-
* type Document = Doc<Schema>; // Document is { name: string; age: number; }
|
|
382
|
-
*/
|
|
383
|
-
type Doc<T extends SchemaType> = {
|
|
384
|
-
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
|
|
385
|
-
ExtractType<T["properties"][K]["type"]>
|
|
386
|
-
} & {
|
|
387
|
-
[K in keyof T["properties"] as IsOptional<T["properties"][K]> extends false ? K : never]:
|
|
388
|
-
ExtractType<T["properties"][K]["type"]>
|
|
389
|
-
} & {
|
|
390
|
-
__version?: number;
|
|
391
|
-
createdAt?: number;
|
|
392
|
-
updatedAt?: number;
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
type QueryOptions = {
|
|
396
|
-
limit?: number;
|
|
397
|
-
offset?: number;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Collection is a class that represents a collection of documents in a database.
|
|
402
|
-
* @template T - A schema type defining the structure of the documents in the collection.
|
|
403
|
-
*/
|
|
404
|
-
declare class Collection<T extends SchemaType> {
|
|
405
|
-
/**
|
|
406
|
-
* Finds all documents in the collection.
|
|
407
|
-
*
|
|
408
|
-
* @returns A promise that resolves to an array of documents.
|
|
409
|
-
*/
|
|
410
|
-
find(query: QueryType<T>, options?: QueryOptions): Promise<Doc<T>[]>;
|
|
411
|
-
/**
|
|
412
|
-
* count all documents in the collection.
|
|
413
|
-
*
|
|
414
|
-
* @returns A promise that resolves to an array of documents.
|
|
415
|
-
*/
|
|
416
|
-
count(query: QueryType<T>, options?: QueryOptions): Promise<number>;
|
|
417
|
-
/**
|
|
418
|
-
* Finds a single document in the collection by its ID.
|
|
419
|
-
*
|
|
420
|
-
* @param id - The ID of the document to find.
|
|
421
|
-
* @returns A promise that resolves to the found document.
|
|
422
|
-
*/
|
|
423
|
-
findById(id: string): Promise<Doc<T>>;
|
|
424
|
-
/**
|
|
425
|
-
* Updates a document in the collection by its ID.
|
|
426
|
-
*
|
|
427
|
-
* @param id - The ID of the document to update.
|
|
428
|
-
* @param document - A partial document containing the fields to update.
|
|
429
|
-
* @returns A promise that resolves when the update is complete.
|
|
430
|
-
*/
|
|
431
|
-
update(document: Partial<Doc<T>>): Promise<void>;
|
|
432
|
-
/**
|
|
433
|
-
* Creates a new document in the collection.
|
|
434
|
-
*
|
|
435
|
-
* @param document - The document to create.
|
|
436
|
-
* @returns A promise that resolves to the created document.
|
|
437
|
-
*/
|
|
438
|
-
create(document: Doc<T>): Promise<Doc<T>>;
|
|
439
|
-
/**
|
|
440
|
-
* Deletes a document in the collection by its ID.
|
|
441
|
-
*
|
|
442
|
-
* @param id - The ID of the document to delete.
|
|
443
|
-
* @returns A promise that resolves when the deletion is complete.
|
|
444
|
-
*/
|
|
445
|
-
delete(id: string): Promise<void>;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
type BaseStorageOptions = {
|
|
452
|
-
[name:string]:string | boolean | number
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
declare class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
|
|
456
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
457
|
-
dbName: string,
|
|
458
|
-
schemas: SchemasCreate,
|
|
459
|
-
options?: BaseStorageOptions
|
|
460
|
-
): Promise<
|
|
461
|
-
BaseStorage<
|
|
462
|
-
SchemasCreate
|
|
463
|
-
>
|
|
464
|
-
>;
|
|
465
|
-
constructor(
|
|
466
|
-
dbName: string,
|
|
467
|
-
schemas: Schemas,
|
|
468
|
-
options?: BaseStorageOptions
|
|
469
|
-
);
|
|
470
|
-
readonly dbName: string;
|
|
471
|
-
readonly schemas: Record<keyof Schemas, Schema<Schemas[keyof Schemas]>>;
|
|
472
|
-
readonly options: BaseStorageOptions;
|
|
473
|
-
readonly core: CoreStorage;
|
|
474
|
-
start(): Promise<void>;
|
|
475
|
-
close(): Promise<void>;
|
|
476
|
-
count(colectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<number>;
|
|
477
|
-
findDocumentById(collectionName: keyof Schemas, id: string): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
478
|
-
find(collectionName: keyof Schemas, query: QueryType<Schemas[keyof Schemas]>, options?: QueryOptions): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
479
|
-
write(op: Operation<Schemas[keyof Schemas]>): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
480
|
-
getOption(name: string): string | boolean | number | undefined;
|
|
481
|
-
getSchema(name: string): Schema<any>;
|
|
482
|
-
//Call addIndexSchemas if you need extra indexing schemas for your database
|
|
483
|
-
addIndexSchemas(): null
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
/**
|
|
489
|
-
* Represents an IndexDB storage system extending the base storage functionality.
|
|
490
|
-
*
|
|
491
|
-
* @template T - The schema type.
|
|
492
|
-
*/
|
|
493
|
-
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
494
|
-
/**
|
|
495
|
-
* Frees the resources used by the in-memory storage.
|
|
496
|
-
*/
|
|
497
|
-
free(): void;
|
|
498
|
-
|
|
499
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
500
|
-
dbName: string,
|
|
501
|
-
schemas: SchemasCreate,
|
|
502
|
-
): Promise<
|
|
503
|
-
IndexDB<
|
|
504
|
-
SchemasCreate
|
|
505
|
-
>
|
|
506
|
-
>;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Represents an in-memory storage system extending the base storage functionality.
|
|
513
|
-
*
|
|
514
|
-
* @template T - The schema type.
|
|
515
|
-
*/
|
|
516
|
-
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
517
|
-
/**
|
|
518
|
-
* Frees the resources used by the in-memory storage.
|
|
519
|
-
*/
|
|
520
|
-
free(): void;
|
|
521
|
-
|
|
522
|
-
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
523
|
-
dbName: string,
|
|
524
|
-
schemas: SchemasCreate,
|
|
525
|
-
): Promise<
|
|
526
|
-
InMemory<
|
|
527
|
-
SchemasCreate
|
|
528
|
-
>
|
|
529
|
-
>;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
488
|
declare class CoreStorage {
|
|
535
489
|
/**
|
|
536
490
|
* @param {any} document
|
|
@@ -708,6 +662,52 @@ declare abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
|
708
662
|
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
709
663
|
}
|
|
710
664
|
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Represents an IndexDB storage system extending the base storage functionality.
|
|
668
|
+
*
|
|
669
|
+
* @template T - The schema type.
|
|
670
|
+
*/
|
|
671
|
+
declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
672
|
+
/**
|
|
673
|
+
* Frees the resources used by the in-memory storage.
|
|
674
|
+
*/
|
|
675
|
+
free(): void;
|
|
676
|
+
|
|
677
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
678
|
+
dbName: string,
|
|
679
|
+
schemas: SchemasCreate,
|
|
680
|
+
): Promise<
|
|
681
|
+
IndexDB<
|
|
682
|
+
SchemasCreate
|
|
683
|
+
>
|
|
684
|
+
>;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Represents an in-memory storage system extending the base storage functionality.
|
|
691
|
+
*
|
|
692
|
+
* @template T - The schema type.
|
|
693
|
+
*/
|
|
694
|
+
declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
|
|
695
|
+
/**
|
|
696
|
+
* Frees the resources used by the in-memory storage.
|
|
697
|
+
*/
|
|
698
|
+
free(): void;
|
|
699
|
+
|
|
700
|
+
static create<SchemasCreate extends SchemaTypeRecord>(
|
|
701
|
+
dbName: string,
|
|
702
|
+
schemas: SchemasCreate,
|
|
703
|
+
): Promise<
|
|
704
|
+
InMemory<
|
|
705
|
+
SchemasCreate
|
|
706
|
+
>
|
|
707
|
+
>;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
|
|
711
711
|
/**
|
|
712
712
|
*/
|
|
713
713
|
declare class RIDBError {
|
|
@@ -819,6 +819,25 @@ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Modul
|
|
|
819
819
|
|
|
820
820
|
interface InitOutput {
|
|
821
821
|
readonly memory: WebAssembly.Memory;
|
|
822
|
+
readonly __wbg_collection_free: (a: number) => void;
|
|
823
|
+
readonly collection_name: (a: number, b: number) => void;
|
|
824
|
+
readonly collection_schema: (a: number, b: number) => void;
|
|
825
|
+
readonly collection_find: (a: number, b: number, c: number) => number;
|
|
826
|
+
readonly collection_parse_query_options: (a: number, b: number, c: number) => void;
|
|
827
|
+
readonly collection_count: (a: number, b: number, c: number) => number;
|
|
828
|
+
readonly collection_findById: (a: number, b: number) => number;
|
|
829
|
+
readonly collection_update: (a: number, b: number) => number;
|
|
830
|
+
readonly collection_create: (a: number, b: number) => number;
|
|
831
|
+
readonly collection_delete: (a: number, b: number) => number;
|
|
832
|
+
readonly __wbg_basestorage_free: (a: number) => void;
|
|
833
|
+
readonly basestorage_new: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
834
|
+
readonly basestorage_addIndexSchemas: (a: number, b: number) => void;
|
|
835
|
+
readonly basestorage_getOption: (a: number, b: number, c: number, d: number) => void;
|
|
836
|
+
readonly basestorage_getSchema: (a: number, b: number, c: number, d: number) => void;
|
|
837
|
+
readonly basestorage_core: (a: number, b: number) => void;
|
|
838
|
+
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
839
|
+
readonly queryoptions_limit: (a: number, b: number) => void;
|
|
840
|
+
readonly queryoptions_offset: (a: number, b: number) => void;
|
|
822
841
|
readonly __wbg_property_free: (a: number) => void;
|
|
823
842
|
readonly property_is_valid: (a: number, b: number) => void;
|
|
824
843
|
readonly property_type: (a: number) => number;
|
|
@@ -889,25 +908,25 @@ interface InitOutput {
|
|
|
889
908
|
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
890
909
|
readonly main_js: () => void;
|
|
891
910
|
readonly is_debug_mode: () => number;
|
|
892
|
-
readonly
|
|
893
|
-
readonly
|
|
894
|
-
readonly
|
|
895
|
-
readonly
|
|
896
|
-
readonly
|
|
897
|
-
readonly
|
|
898
|
-
readonly
|
|
899
|
-
readonly
|
|
900
|
-
readonly
|
|
901
|
-
readonly
|
|
902
|
-
readonly
|
|
903
|
-
readonly
|
|
904
|
-
readonly
|
|
905
|
-
readonly
|
|
906
|
-
readonly
|
|
907
|
-
readonly
|
|
908
|
-
readonly
|
|
909
|
-
readonly
|
|
910
|
-
readonly
|
|
911
|
+
readonly corestorage_new: () => number;
|
|
912
|
+
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
913
|
+
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
914
|
+
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
915
|
+
readonly __wbg_database_free: (a: number) => void;
|
|
916
|
+
readonly database_start: (a: number) => number;
|
|
917
|
+
readonly database_close: (a: number) => number;
|
|
918
|
+
readonly database_started: (a: number) => number;
|
|
919
|
+
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
920
|
+
readonly database_collections: (a: number, b: number) => void;
|
|
921
|
+
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
922
|
+
readonly __wbg_operation_free: (a: number) => void;
|
|
923
|
+
readonly operation_collection: (a: number, b: number) => void;
|
|
924
|
+
readonly operation_opType: (a: number) => number;
|
|
925
|
+
readonly operation_data: (a: number) => number;
|
|
926
|
+
readonly operation_primaryKeyField: (a: number) => number;
|
|
927
|
+
readonly operation_primaryKey: (a: number) => number;
|
|
928
|
+
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
929
|
+
readonly __wbg_corestorage_free: (a: number) => void;
|
|
911
930
|
readonly __wbg_ridberror_free: (a: number) => void;
|
|
912
931
|
readonly ridberror_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
913
932
|
readonly ridberror_type: (a: number, b: number) => void;
|
|
@@ -938,25 +957,6 @@ interface InitOutput {
|
|
|
938
957
|
readonly inmemory_count: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
939
958
|
readonly inmemory_close: (a: number) => number;
|
|
940
959
|
readonly inmemory_start: (a: number) => number;
|
|
941
|
-
readonly corestorage_new: () => number;
|
|
942
|
-
readonly corestorage_getPrimaryKeyTyped: (a: number, b: number, c: number) => void;
|
|
943
|
-
readonly corestorage_getIndexes: (a: number, b: number, c: number, d: number) => void;
|
|
944
|
-
readonly corestorage_matchesQuery: (a: number, b: number, c: number, d: number) => void;
|
|
945
|
-
readonly __wbg_database_free: (a: number) => void;
|
|
946
|
-
readonly database_start: (a: number) => number;
|
|
947
|
-
readonly database_close: (a: number) => number;
|
|
948
|
-
readonly database_started: (a: number) => number;
|
|
949
|
-
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
950
|
-
readonly database_collections: (a: number, b: number) => void;
|
|
951
|
-
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
952
|
-
readonly __wbg_operation_free: (a: number) => void;
|
|
953
|
-
readonly operation_collection: (a: number, b: number) => void;
|
|
954
|
-
readonly operation_opType: (a: number) => number;
|
|
955
|
-
readonly operation_data: (a: number) => number;
|
|
956
|
-
readonly operation_primaryKeyField: (a: number) => number;
|
|
957
|
-
readonly operation_primaryKey: (a: number) => number;
|
|
958
|
-
readonly operation_primaryKeyIndex: (a: number, b: number) => void;
|
|
959
|
-
readonly __wbg_corestorage_free: (a: number) => void;
|
|
960
960
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
961
961
|
readonly wasmbindgentestcontext_new: () => number;
|
|
962
962
|
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
package/build/ridb_core.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
*
|
|
4
|
-
* <p align="center">
|
|
5
|
-
* <img src="https://cdn.jsdelivr.net/gh/trust0-project/ridb@latest/docs/logo.svg" alt="JavaScript Database" />
|
|
6
|
-
* <br />
|
|
7
|
-
* <br />
|
|
8
|
-
* <h3 align="center">A secure light-weight and dependency free database wrapper for the web.</h3>
|
|
9
|
-
* </p>
|
|
10
|
-
* <p align="center">
|
|
11
|
-
* <a href="https://github.com/trust0-project/RIDB/releases"><img src="https://img.shields.io/github/v/release/trust0-project/ridb?color=%23ff00a0&include_prereleases&label=version&sort=semver&style=flat-square"></a>
|
|
12
|
-
* <a href="#"><img src="https://img.shields.io/npm/types/rxdb?style=flat-square"></a>
|
|
13
|
-
* <a href="https://raw.githubusercontent.com/trust0-project/RIDB/refs/heads/main/LICENSE"><img src="https://img.shields.io/github/license/trust0-project/ridb?style=flat-square"></a>
|
|
14
|
-
* <a href="https://www.npmjs.com/package/@trust0/ridb"><img src="https://img.shields.io/npm/dm/@trust0/ridb?color=c63a3b&style=flat-square"></a>
|
|
15
|
-
* </p>
|
|
16
|
-
* <h1>Introduction</h1>
|
|
17
|
-
*/
|
|
18
1
|
"use strict";
|
|
19
2
|
var __defProp = Object.defineProperty;
|
|
20
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -385,13 +368,13 @@ function __wbgtest_console_error(args) {
|
|
|
385
368
|
heap[stack_pointer++] = void 0;
|
|
386
369
|
}
|
|
387
370
|
}
|
|
388
|
-
function
|
|
371
|
+
function __wbg_adapter_296(arg0, arg1) {
|
|
389
372
|
wasm.wasm_bindgen__convert__closures__invoke0_mut__h99a9f0884c9cd22a(arg0, arg1);
|
|
390
373
|
}
|
|
391
|
-
function
|
|
374
|
+
function __wbg_adapter_339(arg0, arg1, arg2, arg3, arg4) {
|
|
392
375
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h07c8feee2a4f48f8(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
393
376
|
}
|
|
394
|
-
function
|
|
377
|
+
function __wbg_adapter_396(arg0, arg1, arg2, arg3) {
|
|
395
378
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h424d8c39cf909020(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
396
379
|
}
|
|
397
380
|
var Errors = Object.freeze({ Error: 0, "0": "Error", HookError: 1, "1": "HookError", QueryError: 2, "2": "QueryError", SerializationError: 3, "3": "SerializationError", ValidationError: 4, "4": "ValidationError", AuthenticationError: 5, "5": "AuthenticationError" });
|
|
@@ -2278,6 +2261,18 @@ function __wbg_get_imports() {
|
|
|
2278
2261
|
return addHeapObject(ret);
|
|
2279
2262
|
}, arguments);
|
|
2280
2263
|
};
|
|
2264
|
+
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
2265
|
+
const ret = typeof getObject(arg0) === "function";
|
|
2266
|
+
return ret;
|
|
2267
|
+
};
|
|
2268
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
2269
|
+
const ret = typeof getObject(arg0) === "string";
|
|
2270
|
+
return ret;
|
|
2271
|
+
};
|
|
2272
|
+
imports.wbg.__wbindgen_is_bigint = function(arg0) {
|
|
2273
|
+
const ret = typeof getObject(arg0) === "bigint";
|
|
2274
|
+
return ret;
|
|
2275
|
+
};
|
|
2281
2276
|
imports.wbg.__wbg_collection_new = function(arg0) {
|
|
2282
2277
|
const ret = Collection.__wrap(arg0);
|
|
2283
2278
|
return addHeapObject(ret);
|
|
@@ -2303,10 +2298,6 @@ function __wbg_get_imports() {
|
|
|
2303
2298
|
const ret = typeof val === "object" && val !== null;
|
|
2304
2299
|
return ret;
|
|
2305
2300
|
};
|
|
2306
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
2307
|
-
const ret = typeof getObject(arg0) === "string";
|
|
2308
|
-
return ret;
|
|
2309
|
-
};
|
|
2310
2301
|
imports.wbg.__wbindgen_is_falsy = function(arg0) {
|
|
2311
2302
|
const ret = !getObject(arg0);
|
|
2312
2303
|
return ret;
|
|
@@ -2316,18 +2307,6 @@ function __wbg_get_imports() {
|
|
|
2316
2307
|
const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;
|
|
2317
2308
|
return ret;
|
|
2318
2309
|
};
|
|
2319
|
-
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
2320
|
-
const ret = typeof getObject(arg0) === "function";
|
|
2321
|
-
return ret;
|
|
2322
|
-
};
|
|
2323
|
-
imports.wbg.__wbindgen_is_bigint = function(arg0) {
|
|
2324
|
-
const ret = typeof getObject(arg0) === "bigint";
|
|
2325
|
-
return ret;
|
|
2326
|
-
};
|
|
2327
|
-
imports.wbg.__wbg_indexdb_new = function(arg0) {
|
|
2328
|
-
const ret = IndexDB.__wrap(arg0);
|
|
2329
|
-
return addHeapObject(ret);
|
|
2330
|
-
};
|
|
2331
2310
|
imports.wbg.__wbindgen_in = function(arg0, arg1) {
|
|
2332
2311
|
const ret = getObject(arg0) in getObject(arg1);
|
|
2333
2312
|
return ret;
|
|
@@ -2340,6 +2319,10 @@ function __wbg_get_imports() {
|
|
|
2340
2319
|
const ret = BigInt.asUintN(64, arg0);
|
|
2341
2320
|
return addHeapObject(ret);
|
|
2342
2321
|
};
|
|
2322
|
+
imports.wbg.__wbg_indexdb_new = function(arg0) {
|
|
2323
|
+
const ret = IndexDB.__wrap(arg0);
|
|
2324
|
+
return addHeapObject(ret);
|
|
2325
|
+
};
|
|
2343
2326
|
imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
|
|
2344
2327
|
const ret = getObject(arg0).crypto;
|
|
2345
2328
|
return addHeapObject(ret);
|
|
@@ -2386,6 +2369,12 @@ function __wbg_get_imports() {
|
|
|
2386
2369
|
const ret = result;
|
|
2387
2370
|
return ret;
|
|
2388
2371
|
};
|
|
2372
|
+
imports.wbg.__wbg_localStorage_e381d34d0c40c761 = function() {
|
|
2373
|
+
return handleError(function(arg0) {
|
|
2374
|
+
const ret = getObject(arg0).localStorage;
|
|
2375
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
2376
|
+
}, arguments);
|
|
2377
|
+
};
|
|
2389
2378
|
imports.wbg.__wbg_indexedDB_7c51d9056667f4e0 = function() {
|
|
2390
2379
|
return handleError(function(arg0) {
|
|
2391
2380
|
const ret = getObject(arg0).indexedDB;
|
|
@@ -2408,6 +2397,9 @@ function __wbg_get_imports() {
|
|
|
2408
2397
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
2409
2398
|
}, arguments);
|
|
2410
2399
|
};
|
|
2400
|
+
imports.wbg.__wbg_debug_5fb96680aecf5dc8 = function(arg0) {
|
|
2401
|
+
console.debug(getObject(arg0));
|
|
2402
|
+
};
|
|
2411
2403
|
imports.wbg.__wbg_log_5bb5f88f245d7762 = function(arg0) {
|
|
2412
2404
|
console.log(getObject(arg0));
|
|
2413
2405
|
};
|
|
@@ -2597,6 +2589,15 @@ function __wbg_get_imports() {
|
|
|
2597
2589
|
return addHeapObject(ret);
|
|
2598
2590
|
}, arguments);
|
|
2599
2591
|
};
|
|
2592
|
+
imports.wbg.__wbg_getItem_164e8e5265095b87 = function() {
|
|
2593
|
+
return handleError(function(arg0, arg1, arg2, arg3) {
|
|
2594
|
+
const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));
|
|
2595
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2596
|
+
var len1 = WASM_VECTOR_LEN;
|
|
2597
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
2598
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
2599
|
+
}, arguments);
|
|
2600
|
+
};
|
|
2600
2601
|
imports.wbg.__wbg_continue_f1c3e0815924de62 = function() {
|
|
2601
2602
|
return handleError(function(arg0) {
|
|
2602
2603
|
getObject(arg0).continue();
|
|
@@ -2649,7 +2650,7 @@ function __wbg_get_imports() {
|
|
|
2649
2650
|
const a = state0.a;
|
|
2650
2651
|
state0.a = 0;
|
|
2651
2652
|
try {
|
|
2652
|
-
return
|
|
2653
|
+
return __wbg_adapter_296(a, state0.b);
|
|
2653
2654
|
} finally {
|
|
2654
2655
|
state0.a = a;
|
|
2655
2656
|
}
|
|
@@ -2829,7 +2830,7 @@ function __wbg_get_imports() {
|
|
|
2829
2830
|
const a = state0.a;
|
|
2830
2831
|
state0.a = 0;
|
|
2831
2832
|
try {
|
|
2832
|
-
return
|
|
2833
|
+
return __wbg_adapter_339(a, state0.b, arg02, arg12, arg22);
|
|
2833
2834
|
} finally {
|
|
2834
2835
|
state0.a = a;
|
|
2835
2836
|
}
|
|
@@ -2930,7 +2931,7 @@ function __wbg_get_imports() {
|
|
|
2930
2931
|
const a = state0.a;
|
|
2931
2932
|
state0.a = 0;
|
|
2932
2933
|
try {
|
|
2933
|
-
return
|
|
2934
|
+
return __wbg_adapter_396(a, state0.b, arg02, arg12);
|
|
2934
2935
|
} finally {
|
|
2935
2936
|
state0.a = a;
|
|
2936
2937
|
}
|
|
@@ -3046,20 +3047,20 @@ function __wbg_get_imports() {
|
|
|
3046
3047
|
const ret = wasm.memory;
|
|
3047
3048
|
return addHeapObject(ret);
|
|
3048
3049
|
};
|
|
3049
|
-
imports.wbg.
|
|
3050
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3050
|
+
imports.wbg.__wbindgen_closure_wrapper960 = function(arg0, arg1, arg2) {
|
|
3051
|
+
const ret = makeMutClosure(arg0, arg1, 342, __wbg_adapter_56);
|
|
3051
3052
|
return addHeapObject(ret);
|
|
3052
3053
|
};
|
|
3053
|
-
imports.wbg.
|
|
3054
|
-
const ret = makeClosure(arg0, arg1,
|
|
3054
|
+
imports.wbg.__wbindgen_closure_wrapper962 = function(arg0, arg1, arg2) {
|
|
3055
|
+
const ret = makeClosure(arg0, arg1, 342, __wbg_adapter_59);
|
|
3055
3056
|
return addHeapObject(ret);
|
|
3056
3057
|
};
|
|
3057
|
-
imports.wbg.
|
|
3058
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3058
|
+
imports.wbg.__wbindgen_closure_wrapper964 = function(arg0, arg1, arg2) {
|
|
3059
|
+
const ret = makeMutClosure(arg0, arg1, 342, __wbg_adapter_62);
|
|
3059
3060
|
return addHeapObject(ret);
|
|
3060
3061
|
};
|
|
3061
|
-
imports.wbg.
|
|
3062
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3062
|
+
imports.wbg.__wbindgen_closure_wrapper1629 = function(arg0, arg1, arg2) {
|
|
3063
|
+
const ret = makeMutClosure(arg0, arg1, 444, __wbg_adapter_65);
|
|
3063
3064
|
return addHeapObject(ret);
|
|
3064
3065
|
};
|
|
3065
3066
|
return imports;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.7.
|
|
7
|
+
"version": "1.7.13",
|
|
8
8
|
"main": "./build/ridb_core.js",
|
|
9
9
|
"module": "./build/ridb_core.mjs",
|
|
10
10
|
"types": "./build/ridb_core.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"default": "./build/ridb_core.mjs"
|
|
17
17
|
},
|
|
18
18
|
"./wasm": {
|
|
19
|
-
"types": "./build/ridb_core_bg.d.
|
|
19
|
+
"types": "./build/ridb_core_bg.d.mts",
|
|
20
20
|
"import": "./build/ridb_core_bg.mjs",
|
|
21
21
|
"default": "./build/ridb_core_bg.mjs"
|
|
22
22
|
}
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
"clean": "rm -rf build node_modules",
|
|
26
26
|
"test": "sh test.sh",
|
|
27
27
|
"build": "rm -rf build && sh build.sh",
|
|
28
|
+
"lint": "npx eslint .",
|
|
28
29
|
"docs": "npx typedoc"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@esbuild-plugins/node-resolve": "^0.2.2",
|
|
32
|
-
"@trust0/ridb-build": "^0.0.
|
|
33
|
+
"@trust0/ridb-build": "^0.0.9",
|
|
33
34
|
"esbuild": "^0.25.4"
|
|
34
35
|
},
|
|
35
36
|
"files": [
|