@trust0/ridb-core 1.7.0-rc.6 → 1.7.0-rc.9

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.
@@ -2,11 +2,11 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  */
5
- export function main_js(): void;
5
+ declare function main_js(): void;
6
6
  /**
7
7
  * @returns {boolean}
8
8
  */
9
- export function is_debug_mode(): boolean;
9
+ declare function is_debug_mode(): boolean;
10
10
  /**
11
11
  * Handler for `console.log` invocations.
12
12
  *
@@ -16,31 +16,31 @@ export function is_debug_mode(): boolean;
16
16
  * `original`.
17
17
  * @param {Array<any>} args
18
18
  */
19
- export function __wbgtest_console_log(args: Array<any>): void;
19
+ declare function __wbgtest_console_log(args: Array<any>): void;
20
20
  /**
21
21
  * Handler for `console.debug` invocations. See above.
22
22
  * @param {Array<any>} args
23
23
  */
24
- export function __wbgtest_console_debug(args: Array<any>): void;
24
+ declare function __wbgtest_console_debug(args: Array<any>): void;
25
25
  /**
26
26
  * Handler for `console.info` invocations. See above.
27
27
  * @param {Array<any>} args
28
28
  */
29
- export function __wbgtest_console_info(args: Array<any>): void;
29
+ declare function __wbgtest_console_info(args: Array<any>): void;
30
30
  /**
31
31
  * Handler for `console.warn` invocations. See above.
32
32
  * @param {Array<any>} args
33
33
  */
34
- export function __wbgtest_console_warn(args: Array<any>): void;
34
+ declare function __wbgtest_console_warn(args: Array<any>): void;
35
35
  /**
36
36
  * Handler for `console.error` invocations. See above.
37
37
  * @param {Array<any>} args
38
38
  */
39
- export function __wbgtest_console_error(args: Array<any>): void;
39
+ declare function __wbgtest_console_error(args: Array<any>): void;
40
40
  /**
41
41
  * Represents the type of operation to be performed on the collection.
42
42
  */
43
- export enum OpType {
43
+ declare enum OpType {
44
44
  /**
45
45
  * Create operation.
46
46
  */
@@ -64,7 +64,7 @@ export enum OpType {
64
64
  }
65
65
  /**
66
66
  */
67
- export enum Errors {
67
+ declare enum Errors {
68
68
  Error = 0,
69
69
  HookError = 1,
70
70
  QueryError = 2,
@@ -73,7 +73,7 @@ export enum Errors {
73
73
  AuthenticationError = 5,
74
74
  }
75
75
 
76
- export type Operators<T> = {
76
+ type Operators<T> = {
77
77
  $gte?: number,
78
78
  $gt?: number
79
79
  $lt?: number,
@@ -82,19 +82,19 @@ export type Operators<T> = {
82
82
  $ne?: T
83
83
  };
84
84
 
85
- export type InOperator<T> = { $in?: T[] };
86
- export type NInOperator<T> = { $nin?: T[] };
85
+ type InOperator<T> = { $in?: T[] };
86
+ type NInOperator<T> = { $nin?: T[] };
87
87
 
88
- export type OperatorOrType<T> = T extends number ?
88
+ type OperatorOrType<T> = T extends number ?
89
89
  T | Operators<T> | InOperator<T> | NInOperator<T> :
90
90
  T | InOperator<T> | NInOperator<T>;
91
91
 
92
- export type LogicalOperators<T extends SchemaType> = {
92
+ type LogicalOperators<T extends SchemaType> = {
93
93
  $and?: Partial<QueryType<T>>[];
94
94
  $or?: Partial<QueryType<T>>[];
95
95
  };
96
96
 
97
- export type QueryType<T extends SchemaType> = Partial<{
97
+ type QueryType<T extends SchemaType> = Partial<{
98
98
  [K in keyof T['properties']]: OperatorOrType<
99
99
  ExtractType<
100
100
  T['properties'][K]['type']
@@ -102,14 +102,14 @@ export type QueryType<T extends SchemaType> = Partial<{
102
102
  >
103
103
  }> & LogicalOperators<T> | LogicalOperators<T>[];
104
104
 
105
- export class Query<T extends SchemaType> {
105
+ declare class Query<T extends SchemaType> {
106
106
  constructor(query: QueryType<T>, schema:Schema<T>);
107
107
  readonly query: QueryType<T>;
108
108
  }
109
109
 
110
110
 
111
111
 
112
- export type InternalsRecord = {
112
+ type InternalsRecord = {
113
113
  [name: string]: BaseStorage<SchemaTypeRecord>
114
114
  };
115
115
  /**
@@ -124,7 +124,7 @@ export type InternalsRecord = {
124
124
  * type ObjectType = ExtractType<'object'>; // ObjectType is object
125
125
  * type ArrayType = ExtractType<'array'>; // ArrayType is Array<any>
126
126
  */
127
- export type ExtractType<T extends string> =
127
+ type ExtractType<T extends string> =
128
128
  T extends "string" ? string :
129
129
  T extends "number" ? number :
130
130
  T extends "boolean" ? boolean :
@@ -132,7 +132,7 @@ export type ExtractType<T extends string> =
132
132
  T extends "array" ? any[] :
133
133
  never;
134
134
 
135
- export type IsOptional<T> = T extends { required: false } ? true :
135
+ type IsOptional<T> = T extends { required: false } ? true :
136
136
  T extends { default: any } ? true : false;
137
137
 
138
138
  /**
@@ -142,7 +142,7 @@ export type IsOptional<T> = T extends { required: false } ? true :
142
142
  *
143
143
  * type Document = Doc<Schema>; // Document is { name: string; age: number; }
144
144
  */
145
- export type Doc<T extends SchemaType> = {
145
+ type Doc<T extends SchemaType> = {
146
146
  [K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
147
147
  ExtractType<T["properties"][K]["type"]>
148
148
  } & {
@@ -154,7 +154,7 @@ export type Doc<T extends SchemaType> = {
154
154
  updatedAt?: number;
155
155
  };
156
156
 
157
- export type QueryOptions = {
157
+ type QueryOptions = {
158
158
  limit?: number;
159
159
  offset?: number;
160
160
  }
@@ -163,7 +163,7 @@ export type QueryOptions = {
163
163
  * Collection is a class that represents a collection of documents in a database.
164
164
  * @template T - A schema type defining the structure of the documents in the collection.
165
165
  */
166
- export class Collection<T extends SchemaType> {
166
+ declare class Collection<T extends SchemaType> {
167
167
  /**
168
168
  * Finds all documents in the collection.
169
169
  *
@@ -215,7 +215,7 @@ export class Collection<T extends SchemaType> {
215
215
  *
216
216
  * @template T - The schema type.
217
217
  */
218
- export class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
218
+ declare class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
219
219
  /**
220
220
  * Frees the resources used by the in-memory storage.
221
221
  */
@@ -233,7 +233,7 @@ export class InMemory<T extends SchemaTypeRecord> extends BaseStorage<T> {
233
233
 
234
234
 
235
235
 
236
- export class CoreStorage {
236
+ declare class CoreStorage {
237
237
  /**
238
238
  * @param {any} document
239
239
  * @param {Query} query
@@ -249,7 +249,7 @@ export class CoreStorage {
249
249
  /**
250
250
  * Represents a property within a schema, including various constraints and nested properties.
251
251
  */
252
- export class Property {
252
+ declare class Property {
253
253
  /**
254
254
  * The type of the property.
255
255
  */
@@ -313,7 +313,7 @@ export class Property {
313
313
  /**
314
314
  * Represents the type definition for a schema.
315
315
  */
316
- export type SchemaType = {
316
+ type SchemaType = {
317
317
  /**
318
318
  * The version of the schema.
319
319
  */
@@ -355,7 +355,7 @@ export type SchemaType = {
355
355
  *
356
356
  * @template T - The schema type.
357
357
  */
358
- export class Schema<T extends SchemaType> {
358
+ declare class Schema<T extends SchemaType> {
359
359
  /**
360
360
  * The schema definition.
361
361
  */
@@ -423,7 +423,7 @@ export class Schema<T extends SchemaType> {
423
423
  *
424
424
  * @template T - The schema type.
425
425
  */
426
- export class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
426
+ declare class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
427
427
  /**
428
428
  * Frees the resources used by the in-memory storage.
429
429
  */
@@ -441,43 +441,43 @@ export class IndexDB<T extends SchemaTypeRecord> extends BaseStorage<T> {
441
441
 
442
442
 
443
443
 
444
- export type EnumerateUpTo<
444
+ type EnumerateUpTo<
445
445
  N extends number,
446
446
  Acc extends number[] = []
447
447
  > = Acc['length'] extends N ?
448
448
  Acc[number]:
449
449
  EnumerateUpTo<N, [...Acc, Acc['length']]> ;
450
450
 
451
- export type EnumerateFrom1To<
451
+ type EnumerateFrom1To<
452
452
  N extends number
453
453
  > = Exclude<EnumerateUpTo<N>,0> | (N extends 0 ? never : N);
454
454
 
455
- export type IsVersionGreaterThan0<
455
+ type IsVersionGreaterThan0<
456
456
  V extends number
457
457
  > = V extends 0 ? false : true;
458
458
 
459
- export type AnyVersionGreaterThan1<
459
+ type AnyVersionGreaterThan1<
460
460
  T extends Record<string, SchemaType>
461
461
  > = true extends {
462
462
  [K in keyof T]: IsVersionGreaterThan0<T[K]['version']>;
463
463
  } [keyof T] ? true : false;
464
464
 
465
- export type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
465
+ type MigrationFunction<T extends SchemaType> = (doc: Doc <T> ) => Doc <T>
466
466
 
467
- export type MigrationPathsForSchema<
467
+ type MigrationPathsForSchema<
468
468
  T extends SchemaType
469
469
  > = T['version'] extends 0 ? {}: // No migrations needed for version 1
470
470
  {
471
471
  [K in EnumerateFrom1To < T['version'] > ]: MigrationFunction<T> ;
472
472
  };
473
473
 
474
- export type MigrationPathsForSchemas<
474
+ type MigrationPathsForSchemas<
475
475
  T extends SchemaTypeRecord
476
476
  > = {
477
477
  [K in keyof T]: MigrationPathsForSchema<T[K]>;
478
478
  };
479
479
 
480
- export type MigrationsParameter<
480
+ type MigrationsParameter<
481
481
  T extends SchemaTypeRecord
482
482
  > = AnyVersionGreaterThan1<T> extends true ?
483
483
  {
@@ -494,7 +494,7 @@ export type MigrationsParameter<
494
494
  *
495
495
  * @template T - The schema type of the collection.
496
496
  */
497
- export type Operation<T extends SchemaType = SchemaType> = {
497
+ type Operation<T extends SchemaType = SchemaType> = {
498
498
  /**
499
499
  * The name of the collection on which the operation will be performed.
500
500
  */
@@ -527,7 +527,7 @@ type BasePluginOptions = {
527
527
  docRecoverHook?: Hook
528
528
  }
529
529
 
530
- export class BasePlugin implements BasePluginOptions {
530
+ declare class BasePlugin implements BasePluginOptions {
531
531
  docCreateHook?:Hook;
532
532
  docRecoverHook?:Hook;
533
533
  }
@@ -537,11 +537,11 @@ export class BasePlugin implements BasePluginOptions {
537
537
  /**
538
538
  * Represents a record of schema types, where each key is a string and the value is a `SchemaType`.
539
539
  */
540
- export type SchemaTypeRecord = {
540
+ type SchemaTypeRecord = {
541
541
  [name: string]: SchemaType
542
542
  };
543
543
 
544
- export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
544
+ declare abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
545
545
  constructor(
546
546
  name: string,
547
547
  schemas: Schemas
@@ -568,11 +568,11 @@ export abstract class StorageInternal<Schemas extends SchemaTypeRecord> {
568
568
  }
569
569
 
570
570
 
571
- export type BaseStorageOptions = {
571
+ type BaseStorageOptions = {
572
572
  [name:string]:string | boolean | number
573
573
  }
574
574
 
575
- export class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
575
+ declare class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageInternal<Schemas> {
576
576
  static create<SchemasCreate extends SchemaTypeRecord>(
577
577
  dbName: string,
578
578
  schemas: SchemasCreate,
@@ -634,7 +634,7 @@ export class BaseStorage<Schemas extends SchemaTypeRecord> extends StorageIntern
634
634
  *
635
635
  * @template T - A record of schema types.
636
636
  */
637
- export class Database<T extends SchemaTypeRecord> {
637
+ declare class Database<T extends SchemaTypeRecord> {
638
638
 
639
639
  /**
640
640
  * Creates a new `Database` instance with the provided schemas and storage module.
@@ -692,14 +692,14 @@ export class Database<T extends SchemaTypeRecord> {
692
692
  * @param {T} records - The schema type records.
693
693
  * @returns {Promise<InternalsRecord>} A promise that resolves to the created internals record.
694
694
  */
695
- export type CreateStorage = <T extends SchemaTypeRecord>(
695
+ type CreateStorage = <T extends SchemaTypeRecord>(
696
696
  records: T
697
697
  ) => Promise<BaseStorage<T>>;
698
698
 
699
699
  /**
700
700
  * Represents a storage module with a method for creating storage.
701
701
  */
702
- export type RIDBModule = {
702
+ type RIDBModule = {
703
703
 
704
704
  /**
705
705
  * Plugin constructors array
@@ -710,7 +710,7 @@ export type RIDBModule = {
710
710
 
711
711
  /**
712
712
  */
713
- export class RIDBError {
713
+ declare class RIDBError {
714
714
  /**
715
715
  ** Return copy of self without private attributes.
716
716
  */
@@ -783,7 +783,7 @@ export class RIDBError {
783
783
  * The node.js entry script instantiates a `Context` here which is used to
784
784
  * drive test execution.
785
785
  */
786
- export class WasmBindgenTestContext {
786
+ declare class WasmBindgenTestContext {
787
787
  free(): void;
788
788
  /**
789
789
  * Creates a new context ready to run tests.
@@ -815,9 +815,9 @@ export class WasmBindgenTestContext {
815
815
  run(tests: any[]): Promise<any>;
816
816
  }
817
817
 
818
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
818
+ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
819
819
 
820
- export interface InitOutput {
820
+ interface InitOutput {
821
821
  readonly memory: WebAssembly.Memory;
822
822
  readonly __wbg_query_free: (a: number) => void;
823
823
  readonly query_new: (a: number, b: number, c: number) => void;
@@ -982,7 +982,7 @@ export interface InitOutput {
982
982
  readonly __wbindgen_start: () => void;
983
983
  }
984
984
 
985
- export type SyncInitInput = BufferSource | WebAssembly.Module;
985
+ type SyncInitInput = BufferSource | WebAssembly.Module;
986
986
  /**
987
987
  * Instantiates the given `module`, which can either be bytes or
988
988
  * a precompiled `WebAssembly.Module`.
@@ -991,7 +991,7 @@ export type SyncInitInput = BufferSource | WebAssembly.Module;
991
991
  *
992
992
  * @returns {InitOutput}
993
993
  */
994
- export function initSync(module: SyncInitInput): InitOutput;
994
+ declare function initSync(module: SyncInitInput): InitOutput;
995
995
 
996
996
  /**
997
997
  * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
@@ -1001,4 +1001,6 @@ export function initSync(module: SyncInitInput): InitOutput;
1001
1001
  *
1002
1002
  * @returns {Promise<InitOutput>}
1003
1003
  */
1004
- export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
1004
+ declare function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
1005
+
1006
+ export { type AnyVersionGreaterThan1, BasePlugin, BaseStorage, type BaseStorageOptions, Collection, CoreStorage, type CreateStorage, Database, type Doc, type EnumerateFrom1To, type EnumerateUpTo, Errors, type ExtractType, InMemory, type InOperator, IndexDB, type InitInput, type InitOutput, type InternalsRecord, type IsOptional, type IsVersionGreaterThan0, type LogicalOperators, type MigrationFunction, type MigrationPathsForSchema, type MigrationPathsForSchemas, type MigrationsParameter, type NInOperator, OpType, type Operation, type OperatorOrType, type Operators, Property, Query, type QueryOptions, type QueryType, RIDBError, type RIDBModule, Schema, type SchemaType, type SchemaTypeRecord, StorageInternal, type SyncInitInput, WasmBindgenTestContext, __wbgtest_console_debug, __wbgtest_console_error, __wbgtest_console_info, __wbgtest_console_log, __wbgtest_console_warn, __wbg_init as default, initSync, is_debug_mode, main_js };