@trust0/ridb-core 1.5.1-rc.2 → 1.5.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 +7 -1
- package/pkg/ridb_core.d.ts +115 -112
- package/pkg/ridb_core.js +24 -14
- package/pkg/ridb_core_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -5,12 +5,18 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.5.
|
|
8
|
+
"version": "1.5.2",
|
|
9
9
|
"main": "./pkg/ridb_core.js",
|
|
10
10
|
"types": "./pkg/ridb_core.d.ts",
|
|
11
11
|
"sideEffects": [
|
|
12
12
|
"./pkg/snippets/*"
|
|
13
13
|
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"clean": "rm -rf build node_modules",
|
|
16
|
+
"test": "sh test.sh",
|
|
17
|
+
"build": "sh build.sh",
|
|
18
|
+
"docs": "echo 'No docs for this package'"
|
|
19
|
+
},
|
|
14
20
|
"files": [
|
|
15
21
|
"./pkg/ridb_core_bg.wasm",
|
|
16
22
|
"./pkg/ridb_core.js",
|
package/pkg/ridb_core.d.ts
CHANGED
|
@@ -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 of documents.
|
|
191
191
|
* RIDB extends from this class and is used to expose collections.
|
|
192
192
|
*
|
|
193
193
|
* So if you specify:
|
|
@@ -238,6 +238,8 @@ 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
|
+
|
|
241
243
|
/**
|
|
242
244
|
* The collections in the database.
|
|
243
245
|
*
|
|
@@ -265,7 +267,7 @@ export class Database<T extends SchemaTypeRecord> {
|
|
|
265
267
|
}
|
|
266
268
|
|
|
267
269
|
/**
|
|
268
|
-
* Represents a function for creating storage with the provided schema type records.
|
|
270
|
+
* Represents a function type for creating storage with the provided schema type records.
|
|
269
271
|
*
|
|
270
272
|
* @template T - The schema type record.
|
|
271
273
|
* @param {T} records - The schema type records.
|
|
@@ -352,70 +354,6 @@ export class BasePlugin implements BasePluginOptions {
|
|
|
352
354
|
|
|
353
355
|
|
|
354
356
|
|
|
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
|
-
|
|
419
357
|
/**
|
|
420
358
|
* Represents the type definition for a schema.
|
|
421
359
|
*/
|
|
@@ -623,40 +561,6 @@ export class Collection<T extends SchemaType> {
|
|
|
623
561
|
|
|
624
562
|
|
|
625
563
|
|
|
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
|
-
|
|
660
564
|
export type EnumerateUpTo<
|
|
661
565
|
N extends number,
|
|
662
566
|
Acc extends number[] = []
|
|
@@ -704,6 +608,104 @@ export type MigrationsParameter<
|
|
|
704
608
|
};
|
|
705
609
|
|
|
706
610
|
|
|
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
|
+
|
|
707
709
|
/**
|
|
708
710
|
*/
|
|
709
711
|
export class RIDBError {
|
|
@@ -887,6 +889,7 @@ export interface InitOutput {
|
|
|
887
889
|
readonly database_start: (a: number) => number;
|
|
888
890
|
readonly database_close: (a: number) => number;
|
|
889
891
|
readonly database_started: (a: number) => number;
|
|
892
|
+
readonly database_authenticate: (a: number, b: number, c: number) => number;
|
|
890
893
|
readonly database_collections: (a: number, b: number) => void;
|
|
891
894
|
readonly database_create: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
892
895
|
readonly __wbg_queryoptions_free: (a: number) => void;
|
|
@@ -917,18 +920,6 @@ export interface InitOutput {
|
|
|
917
920
|
readonly baseplugin_get_doc_recover_hook: (a: number) => number;
|
|
918
921
|
readonly baseplugin_set_doc_create_hook: (a: number, b: number) => void;
|
|
919
922
|
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;
|
|
932
923
|
readonly __wbg_schema_free: (a: number) => void;
|
|
933
924
|
readonly schema_validate: (a: number, b: number, c: number) => void;
|
|
934
925
|
readonly schema_is_valid: (a: number, b: number) => void;
|
|
@@ -952,6 +943,18 @@ export interface InitOutput {
|
|
|
952
943
|
readonly collection_update: (a: number, b: number) => number;
|
|
953
944
|
readonly collection_create: (a: number, b: number) => number;
|
|
954
945
|
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;
|
|
955
958
|
readonly __wbg_wasmbindgentestcontext_free: (a: number) => void;
|
|
956
959
|
readonly wasmbindgentestcontext_new: () => number;
|
|
957
960
|
readonly wasmbindgentestcontext_args: (a: number, b: number, c: number) => void;
|
package/pkg/ridb_core.js
CHANGED
|
@@ -409,15 +409,15 @@ export function __wbgtest_console_error(args) {
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
function
|
|
412
|
+
function __wbg_adapter_296(arg0, arg1) {
|
|
413
413
|
wasm.wasm_bindgen__convert__closures__invoke0_mut__hf4bced6426ca6f31(arg0, arg1);
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
function
|
|
416
|
+
function __wbg_adapter_339(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_390(arg0, arg1, arg2, arg3) {
|
|
421
421
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h1b9fff078715ef14(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
422
422
|
}
|
|
423
423
|
|
|
@@ -977,6 +977,16 @@ 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
|
+
/**
|
|
980
990
|
* Retrieves the collections in the database.
|
|
981
991
|
*
|
|
982
992
|
* This function returns an `Object` containing the collections.
|
|
@@ -2703,7 +2713,7 @@ function __wbg_get_imports() {
|
|
|
2703
2713
|
const a = state0.a;
|
|
2704
2714
|
state0.a = 0;
|
|
2705
2715
|
try {
|
|
2706
|
-
return
|
|
2716
|
+
return __wbg_adapter_296(a, state0.b, );
|
|
2707
2717
|
} finally {
|
|
2708
2718
|
state0.a = a;
|
|
2709
2719
|
}
|
|
@@ -2868,7 +2878,7 @@ function __wbg_get_imports() {
|
|
|
2868
2878
|
const a = state0.a;
|
|
2869
2879
|
state0.a = 0;
|
|
2870
2880
|
try {
|
|
2871
|
-
return
|
|
2881
|
+
return __wbg_adapter_339(a, state0.b, arg0, arg1, arg2);
|
|
2872
2882
|
} finally {
|
|
2873
2883
|
state0.a = a;
|
|
2874
2884
|
}
|
|
@@ -2947,7 +2957,7 @@ function __wbg_get_imports() {
|
|
|
2947
2957
|
const a = state0.a;
|
|
2948
2958
|
state0.a = 0;
|
|
2949
2959
|
try {
|
|
2950
|
-
return
|
|
2960
|
+
return __wbg_adapter_390(a, state0.b, arg0, arg1);
|
|
2951
2961
|
} finally {
|
|
2952
2962
|
state0.a = a;
|
|
2953
2963
|
}
|
|
@@ -3047,20 +3057,20 @@ function __wbg_get_imports() {
|
|
|
3047
3057
|
const ret = wasm.memory;
|
|
3048
3058
|
return addHeapObject(ret);
|
|
3049
3059
|
};
|
|
3050
|
-
imports.wbg.
|
|
3051
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3060
|
+
imports.wbg.__wbindgen_closure_wrapper499 = function(arg0, arg1, arg2) {
|
|
3061
|
+
const ret = makeMutClosure(arg0, arg1, 181, __wbg_adapter_56);
|
|
3052
3062
|
return addHeapObject(ret);
|
|
3053
3063
|
};
|
|
3054
|
-
imports.wbg.
|
|
3055
|
-
const ret = makeClosure(arg0, arg1,
|
|
3064
|
+
imports.wbg.__wbindgen_closure_wrapper501 = function(arg0, arg1, arg2) {
|
|
3065
|
+
const ret = makeClosure(arg0, arg1, 181, __wbg_adapter_59);
|
|
3056
3066
|
return addHeapObject(ret);
|
|
3057
3067
|
};
|
|
3058
|
-
imports.wbg.
|
|
3059
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3068
|
+
imports.wbg.__wbindgen_closure_wrapper503 = function(arg0, arg1, arg2) {
|
|
3069
|
+
const ret = makeMutClosure(arg0, arg1, 181, __wbg_adapter_62);
|
|
3060
3070
|
return addHeapObject(ret);
|
|
3061
3071
|
};
|
|
3062
|
-
imports.wbg.
|
|
3063
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3072
|
+
imports.wbg.__wbindgen_closure_wrapper1625 = function(arg0, arg1, arg2) {
|
|
3073
|
+
const ret = makeMutClosure(arg0, arg1, 453, __wbg_adapter_65);
|
|
3064
3074
|
return addHeapObject(ret);
|
|
3065
3075
|
};
|
|
3066
3076
|
|
package/pkg/ridb_core_bg.wasm
CHANGED
|
Binary file
|