@trust0/ridb-core 1.5.0 → 1.5.1-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 +1 -1
- package/pkg/ridb_core.d.ts +122 -125
- package/pkg/ridb_core.js +17 -27
- package/pkg/ridb_core_bg.wasm +0 -0
package/package.json
CHANGED
package/pkg/ridb_core.d.ts
CHANGED
|
@@ -38,16 +38,6 @@ export function __wbgtest_console_warn(args: Array<any>): void;
|
|
|
38
38
|
*/
|
|
39
39
|
export function __wbgtest_console_error(args: Array<any>): void;
|
|
40
40
|
/**
|
|
41
|
-
*/
|
|
42
|
-
export enum Errors {
|
|
43
|
-
Error = 0,
|
|
44
|
-
HookError = 1,
|
|
45
|
-
QueryError = 2,
|
|
46
|
-
SerializationError = 3,
|
|
47
|
-
ValidationError = 4,
|
|
48
|
-
AuthenticationError = 5,
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
41
|
* Represents the type of operation to be performed on the collection.
|
|
52
42
|
*/
|
|
53
43
|
export enum OpType {
|
|
@@ -72,6 +62,16 @@ export enum OpType {
|
|
|
72
62
|
*/
|
|
73
63
|
COUNT = 4,
|
|
74
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
*/
|
|
67
|
+
export enum Errors {
|
|
68
|
+
Error = 0,
|
|
69
|
+
HookError = 1,
|
|
70
|
+
QueryError = 2,
|
|
71
|
+
SerializationError = 3,
|
|
72
|
+
ValidationError = 4,
|
|
73
|
+
AuthenticationError = 5,
|
|
74
|
+
}
|
|
75
75
|
|
|
76
76
|
export type Operators<T> = {
|
|
77
77
|
$gte?: number,
|
|
@@ -187,7 +187,7 @@ export class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageIntern
|
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
|
-
* Represents a database containing collections
|
|
190
|
+
* Represents a database containing collections.
|
|
191
191
|
* RIDB extends from this class and is used to expose collections.
|
|
192
192
|
*
|
|
193
193
|
* So if you specify:
|
|
@@ -238,8 +238,6 @@ export class Database<T extends SchemaTypeRecord> {
|
|
|
238
238
|
storage?: BaseStorage<TS>
|
|
239
239
|
): Promise<Database<TS>>;
|
|
240
240
|
|
|
241
|
-
authenticate(password: string): Promise<boolean>;
|
|
242
|
-
|
|
243
241
|
/**
|
|
244
242
|
* The collections in the database.
|
|
245
243
|
*
|
|
@@ -267,7 +265,7 @@ export class Database<T extends SchemaTypeRecord> {
|
|
|
267
265
|
}
|
|
268
266
|
|
|
269
267
|
/**
|
|
270
|
-
* Represents a function
|
|
268
|
+
* Represents a function for creating storage with the provided schema type records.
|
|
271
269
|
*
|
|
272
270
|
* @template T - The schema type record.
|
|
273
271
|
* @param {T} records - The schema type records.
|
|
@@ -354,6 +352,70 @@ export class BasePlugin implements BasePluginOptions {
|
|
|
354
352
|
|
|
355
353
|
|
|
356
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Represents a property within a schema, including various constraints and nested properties.
|
|
357
|
+
*/
|
|
358
|
+
export class Property {
|
|
359
|
+
/**
|
|
360
|
+
* The type of the property.
|
|
361
|
+
*/
|
|
362
|
+
readonly type: string;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* The version of the property, if applicable.
|
|
366
|
+
*/
|
|
367
|
+
readonly version?: number;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* The primary key of the property, if applicable.
|
|
371
|
+
*/
|
|
372
|
+
readonly primaryKey?: string;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* An optional array of nested properties for array-type properties.
|
|
376
|
+
*/
|
|
377
|
+
readonly items?: Property;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* The maximum number of items for array-type properties, if applicable.
|
|
381
|
+
*/
|
|
382
|
+
readonly maxItems?: number;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* The minimum number of items for array-type properties, if applicable.
|
|
386
|
+
*/
|
|
387
|
+
readonly minItems?: number;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The maximum length for string-type properties, if applicable.
|
|
391
|
+
*/
|
|
392
|
+
readonly maxLength?: number;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* The minimum length for string-type properties, if applicable.
|
|
396
|
+
*/
|
|
397
|
+
readonly minLength?: number;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* An optional array of required fields for object-type properties.
|
|
401
|
+
*/
|
|
402
|
+
readonly required?: boolean;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* An optional default value for the property.
|
|
406
|
+
*/
|
|
407
|
+
readonly default?: any;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* An optional map of nested properties for object-type properties.
|
|
411
|
+
*/
|
|
412
|
+
readonly properties?: {
|
|
413
|
+
[name: string]: Property;
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
357
419
|
/**
|
|
358
420
|
* Represents the type definition for a schema.
|
|
359
421
|
*/
|
|
@@ -561,6 +623,40 @@ export class Collection<T extends SchemaType> {
|
|
|
561
623
|
|
|
562
624
|
|
|
563
625
|
|
|
626
|
+
/**
|
|
627
|
+
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
628
|
+
*/
|
|
629
|
+
export type SchemaTypeRecord = {
|
|
630
|
+
[name: string]: SchemaType
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
634
|
+
constructor(
|
|
635
|
+
name: string,
|
|
636
|
+
schemas: Schemas
|
|
637
|
+
);
|
|
638
|
+
abstract start(): Promise<void>;
|
|
639
|
+
abstract close(): Promise<void>;
|
|
640
|
+
abstract count(
|
|
641
|
+
colectionName: keyof Schemas,
|
|
642
|
+
query: QueryType<Schemas[keyof Schemas]>,
|
|
643
|
+
options?: QueryOptions
|
|
644
|
+
): Promise<number>;
|
|
645
|
+
abstract findDocumentById(
|
|
646
|
+
collectionName: keyof Schemas,
|
|
647
|
+
id: string
|
|
648
|
+
): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
649
|
+
abstract find(
|
|
650
|
+
collectionName: keyof Schemas,
|
|
651
|
+
query: QueryType<Schemas[keyof Schemas]>,
|
|
652
|
+
options?: QueryOptions
|
|
653
|
+
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
654
|
+
abstract write(
|
|
655
|
+
op: Operation<Schemas[keyof Schemas]>
|
|
656
|
+
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
|
|
564
660
|
export type EnumerateUpTo<
|
|
565
661
|
N extends number,
|
|
566
662
|
Acc extends number[] = []
|
|
@@ -608,104 +704,6 @@ export type MigrationsParameter<
|
|
|
608
704
|
};
|
|
609
705
|
|
|
610
706
|
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Represents a property within a schema, including various constraints and nested properties.
|
|
614
|
-
*/
|
|
615
|
-
export class Property {
|
|
616
|
-
/**
|
|
617
|
-
* The type of the property.
|
|
618
|
-
*/
|
|
619
|
-
readonly type: string;
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* The version of the property, if applicable.
|
|
623
|
-
*/
|
|
624
|
-
readonly version?: number;
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* The primary key of the property, if applicable.
|
|
628
|
-
*/
|
|
629
|
-
readonly primaryKey?: string;
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* An optional array of nested properties for array-type properties.
|
|
633
|
-
*/
|
|
634
|
-
readonly items?: Property;
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* The maximum number of items for array-type properties, if applicable.
|
|
638
|
-
*/
|
|
639
|
-
readonly maxItems?: number;
|
|
640
|
-
|
|
641
|
-
/**
|
|
642
|
-
* The minimum number of items for array-type properties, if applicable.
|
|
643
|
-
*/
|
|
644
|
-
readonly minItems?: number;
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* The maximum length for string-type properties, if applicable.
|
|
648
|
-
*/
|
|
649
|
-
readonly maxLength?: number;
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* The minimum length for string-type properties, if applicable.
|
|
653
|
-
*/
|
|
654
|
-
readonly minLength?: number;
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* An optional array of required fields for object-type properties.
|
|
658
|
-
*/
|
|
659
|
-
readonly required?: boolean;
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* An optional default value for the property.
|
|
663
|
-
*/
|
|
664
|
-
readonly default?: any;
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* An optional map of nested properties for object-type properties.
|
|
668
|
-
*/
|
|
669
|
-
readonly properties?: {
|
|
670
|
-
[name: string]: Property;
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
|
|
678
|
-
*/
|
|
679
|
-
export type SchemaTypeRecord = {
|
|
680
|
-
[name: string]: SchemaType
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
|
|
684
|
-
constructor(
|
|
685
|
-
name: string,
|
|
686
|
-
schemas: Schemas
|
|
687
|
-
);
|
|
688
|
-
abstract start(): Promise<void>;
|
|
689
|
-
abstract close(): Promise<void>;
|
|
690
|
-
abstract count(
|
|
691
|
-
colectionName: keyof Schemas,
|
|
692
|
-
query: QueryType<Schemas[keyof Schemas]>,
|
|
693
|
-
options?: QueryOptions
|
|
694
|
-
): Promise<number>;
|
|
695
|
-
abstract findDocumentById(
|
|
696
|
-
collectionName: keyof Schemas,
|
|
697
|
-
id: string
|
|
698
|
-
): Promise<Doc<Schemas[keyof Schemas]> | null>;
|
|
699
|
-
abstract find(
|
|
700
|
-
collectionName: keyof Schemas,
|
|
701
|
-
query: QueryType<Schemas[keyof Schemas]>,
|
|
702
|
-
options?: QueryOptions
|
|
703
|
-
): Promise<Doc<Schemas[keyof Schemas]>[]>;
|
|
704
|
-
abstract write(
|
|
705
|
-
op: Operation<Schemas[keyof Schemas]>
|
|
706
|
-
): Promise<Doc<Schemas[keyof Schemas]>>;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
707
|
/**
|
|
710
708
|
*/
|
|
711
709
|
export class RIDBError {
|
|
@@ -889,7 +887,6 @@ export interface InitOutput {
|
|
|
889
887
|
readonly database_start: (a: number) => number;
|
|
890
888
|
readonly database_close: (a: number) => number;
|
|
891
889
|
readonly database_started: (a: number) => number;
|
|
892
|
-
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
893
890
|
readonly database_collections: (a: number, b: number) => void;
|
|
894
891
|
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
895
892
|
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
@@ -920,6 +917,18 @@ export interface InitOutput {
|
|
|
920
917
|
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
921
918
|
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
922
919
|
readonly baseplugin_set_doc_recover_hook: (a: number, b: number) => void;
|
|
920
|
+
readonly __wbg_property_free: (a: number) => void;
|
|
921
|
+
readonly property_is_valid: (a: number, b: number) => void;
|
|
922
|
+
readonly property_type: (a: number) => number;
|
|
923
|
+
readonly property_items: (a: number, b: number) => void;
|
|
924
|
+
readonly property_maxItems: (a: number, b: number) => void;
|
|
925
|
+
readonly property_minItems: (a: number, b: number) => void;
|
|
926
|
+
readonly property_maxLength: (a: number, b: number) => void;
|
|
927
|
+
readonly property_minLength: (a: number, b: number) => void;
|
|
928
|
+
readonly property_properties: (a: number, b: number) => void;
|
|
929
|
+
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
930
|
+
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
931
|
+
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
923
932
|
readonly __wbg_schema_free: (a: number) => void;
|
|
924
933
|
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
925
934
|
readonly schema_is_valid: (a: number, b: number) => void;
|
|
@@ -943,18 +952,6 @@ export interface InitOutput {
|
|
|
943
952
|
readonly collection_update: (a: number, b: number) => number;
|
|
944
953
|
readonly collection_create: (a: number, b: number) => number;
|
|
945
954
|
readonly collection_delete: (a: number, b: number) => number;
|
|
946
|
-
readonly __wbg_property_free: (a: number) => void;
|
|
947
|
-
readonly property_is_valid: (a: number, b: number) => void;
|
|
948
|
-
readonly property_type: (a: number) => number;
|
|
949
|
-
readonly property_items: (a: number, b: number) => void;
|
|
950
|
-
readonly property_maxItems: (a: number, b: number) => void;
|
|
951
|
-
readonly property_minItems: (a: number, b: number) => void;
|
|
952
|
-
readonly property_maxLength: (a: number, b: number) => void;
|
|
953
|
-
readonly property_minLength: (a: number, b: number) => void;
|
|
954
|
-
readonly property_properties: (a: number, b: number) => void;
|
|
955
|
-
readonly __wbgt_test_property_creation_0: (a: number) => void;
|
|
956
|
-
readonly __wbgt_test_property_validation_1: (a: number) => void;
|
|
957
|
-
readonly __wbgt_test_invalid_property_2: (a: number) => void;
|
|
958
955
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
959
956
|
readonly wasmbindgentestcontext_new: () => number;
|
|
960
957
|
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
package/pkg/ridb_core.js
CHANGED
|
@@ -409,21 +409,18 @@ export function __wbgtest_console_error(args) {
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
function
|
|
412
|
+
function __wbg_adapter_295(arg0, arg1) {
|
|
413
413
|
wasm.wasm_bindgen__convert__closures__invoke0_mut__hf4bced6426ca6f31(arg0, arg1);
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
function
|
|
416
|
+
function __wbg_adapter_338(arg0, arg1, arg2, arg3, arg4) {
|
|
417
417
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h425269a7185d1f5b(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
function
|
|
420
|
+
function __wbg_adapter_389(arg0, arg1, arg2, arg3) {
|
|
421
421
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h1b9fff078715ef14(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
/**
|
|
425
|
-
*/
|
|
426
|
-
export const 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", });
|
|
427
424
|
/**
|
|
428
425
|
* Represents the type of operation to be performed on the collection.
|
|
429
426
|
*/
|
|
@@ -448,6 +445,9 @@ QUERY:3,"3":"QUERY",
|
|
|
448
445
|
* Count Operation.
|
|
449
446
|
*/
|
|
450
447
|
COUNT:4,"4":"COUNT", });
|
|
448
|
+
/**
|
|
449
|
+
*/
|
|
450
|
+
export const 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", });
|
|
451
451
|
|
|
452
452
|
const BasePluginFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
453
453
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -977,16 +977,6 @@ export class Database {
|
|
|
977
977
|
return ret !== 0;
|
|
978
978
|
}
|
|
979
979
|
/**
|
|
980
|
-
* @param {string} password
|
|
981
|
-
* @returns {Promise<boolean>}
|
|
982
|
-
*/
|
|
983
|
-
authenticate(password) {
|
|
984
|
-
const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
985
|
-
const len0 = WASM_VECTOR_LEN;
|
|
986
|
-
const ret = wasm.database_authenticate(this.__wbg_ptr, ptr0, len0);
|
|
987
|
-
return takeObject(ret);
|
|
988
|
-
}
|
|
989
|
-
/**
|
|
990
980
|
* Retrieves the collections in the database.
|
|
991
981
|
*
|
|
992
982
|
* This function returns an `Object` containing the collections.
|
|
@@ -2713,7 +2703,7 @@ function __wbg_get_imports() {
|
|
|
2713
2703
|
const a = state0.a;
|
|
2714
2704
|
state0.a = 0;
|
|
2715
2705
|
try {
|
|
2716
|
-
return
|
|
2706
|
+
return __wbg_adapter_295(a, state0.b, );
|
|
2717
2707
|
} finally {
|
|
2718
2708
|
state0.a = a;
|
|
2719
2709
|
}
|
|
@@ -2878,7 +2868,7 @@ function __wbg_get_imports() {
|
|
|
2878
2868
|
const a = state0.a;
|
|
2879
2869
|
state0.a = 0;
|
|
2880
2870
|
try {
|
|
2881
|
-
return
|
|
2871
|
+
return __wbg_adapter_338(a, state0.b, arg0, arg1, arg2);
|
|
2882
2872
|
} finally {
|
|
2883
2873
|
state0.a = a;
|
|
2884
2874
|
}
|
|
@@ -2957,7 +2947,7 @@ function __wbg_get_imports() {
|
|
|
2957
2947
|
const a = state0.a;
|
|
2958
2948
|
state0.a = 0;
|
|
2959
2949
|
try {
|
|
2960
|
-
return
|
|
2950
|
+
return __wbg_adapter_389(a, state0.b, arg0, arg1);
|
|
2961
2951
|
} finally {
|
|
2962
2952
|
state0.a = a;
|
|
2963
2953
|
}
|
|
@@ -3057,20 +3047,20 @@ function __wbg_get_imports() {
|
|
|
3057
3047
|
const ret = wasm.memory;
|
|
3058
3048
|
return addHeapObject(ret);
|
|
3059
3049
|
};
|
|
3060
|
-
imports.wbg.
|
|
3061
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3050
|
+
imports.wbg.__wbindgen_closure_wrapper495 = function(arg0, arg1, arg2) {
|
|
3051
|
+
const ret = makeMutClosure(arg0, arg1, 177, __wbg_adapter_56);
|
|
3062
3052
|
return addHeapObject(ret);
|
|
3063
3053
|
};
|
|
3064
|
-
imports.wbg.
|
|
3065
|
-
const ret = makeClosure(arg0, arg1,
|
|
3054
|
+
imports.wbg.__wbindgen_closure_wrapper497 = function(arg0, arg1, arg2) {
|
|
3055
|
+
const ret = makeClosure(arg0, arg1, 177, __wbg_adapter_59);
|
|
3066
3056
|
return addHeapObject(ret);
|
|
3067
3057
|
};
|
|
3068
|
-
imports.wbg.
|
|
3069
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3058
|
+
imports.wbg.__wbindgen_closure_wrapper499 = function(arg0, arg1, arg2) {
|
|
3059
|
+
const ret = makeMutClosure(arg0, arg1, 177, __wbg_adapter_62);
|
|
3070
3060
|
return addHeapObject(ret);
|
|
3071
3061
|
};
|
|
3072
|
-
imports.wbg.
|
|
3073
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3062
|
+
imports.wbg.__wbindgen_closure_wrapper1619 = function(arg0, arg1, arg2) {
|
|
3063
|
+
const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_65);
|
|
3074
3064
|
return addHeapObject(ret);
|
|
3075
3065
|
};
|
|
3076
3066
|
|
package/pkg/ridb_core_bg.wasm
CHANGED
|
Binary file
|