@trust0/ridb-core 1.7.21 → 1.7.23

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.
@@ -113,6 +113,35 @@ type Operation<T extends SchemaType = SchemaType> = {
113
113
 
114
114
 
115
115
 
116
+ declare const SchemaFieldType = {
117
+ /**
118
+ * String type for text data
119
+ */
120
+ string: 'string' as const,
121
+
122
+ /**
123
+ * Number type for numeric data (integers and floats)
124
+ */
125
+ number: 'number' as const,
126
+
127
+ /**
128
+ * Boolean type for true/false values
129
+ */
130
+ boolean: 'boolean' as const,
131
+
132
+ /**
133
+ * Array type for ordered collections of items
134
+ */
135
+ array: 'array' as const,
136
+
137
+ /**
138
+ * Object type for nested document structures
139
+ */
140
+ object: 'object' as const,
141
+ };
142
+
143
+
144
+
116
145
  /**
117
146
  * Represents a property within a schema, including various constraints and nested properties.
118
147
  */
@@ -120,7 +149,7 @@ declare class Property {
120
149
  /**
121
150
  * The type of the property.
122
151
  */
123
- readonly type: string;
152
+ readonly type: SchemaFieldType;
124
153
 
125
154
  /**
126
155
  * The version of the property, if applicable.
@@ -238,9 +267,9 @@ type ExtractType<T extends string> =
238
267
 
239
268
  type IsOptional<T> =
240
269
  T extends { required: true }
241
- ? T extends { default: any }
242
- ? true
243
- : false
270
+ ? T extends { default: never }
271
+ ? false
272
+ : true
244
273
  : true;
245
274
 
246
275
  /**
@@ -251,10 +280,7 @@ type IsOptional<T> =
251
280
  * type Document = Doc<Schema>; // Document is { name: string; age: number; }
252
281
  */
253
282
  type Doc<T extends SchemaType> = {
254
- [K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
255
- ExtractType<T['properties'][K]['type']>
256
- } & {
257
- [K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? never : K]:
283
+ [K in keyof T["properties"]]:
258
284
  ExtractType<T['properties'][K]['type']>
259
285
  } & {
260
286
  __version?: number;
@@ -454,7 +480,7 @@ type SchemaType = {
454
480
  /**
455
481
  * The type of the schema.
456
482
  */
457
- type: string;
483
+ type: SchemaFieldType;
458
484
  indexes?: string[];
459
485
  encrypted?: string[];
460
486
  /**
@@ -510,7 +536,7 @@ declare class Schema<T extends SchemaType> {
510
536
  /**
511
537
  * The type of the schema.
512
538
  */
513
- readonly type: string;
539
+ readonly type: SchemaFieldType;
514
540
 
515
541
  /**
516
542
  * An optional array of indexes.
@@ -1025,4 +1051,4 @@ declare function initSync(module: SyncInitInput): InitOutput;
1025
1051
  */
1026
1052
  declare function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
1027
1053
 
1028
- export { type AnyVersionGreaterThan1, BasePlugin, BaseStorage, type BaseStorageOptions, Collection, CoreStorage, type CreateDoc, 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 };
1054
+ export { type AnyVersionGreaterThan1, BasePlugin, BaseStorage, type BaseStorageOptions, Collection, CoreStorage, type CreateDoc, 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, SchemaFieldType, 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 };
@@ -1,3 +1,29 @@
1
+ module.exports.SchemaFieldType = {
2
+ /**
3
+ * String type for text data
4
+ */
5
+ string: 'string',
6
+
7
+ /**
8
+ * Number type for numeric data (integers and floats)
9
+ */
10
+ number: 'number',
11
+
12
+ /**
13
+ * Boolean type for true/false values
14
+ */
15
+ boolean: 'boolean',
16
+
17
+ /**
18
+ * Array type for ordered collections of items
19
+ */
20
+ array: 'array',
21
+
22
+ /**
23
+ * Object type for nested document structures
24
+ */
25
+ object: 'object',
26
+ };
1
27
  "use strict";
2
28
  var __defProp = Object.defineProperty;
3
29
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -2287,10 +2313,6 @@ function __wbg_get_imports() {
2287
2313
  const ret = Collection.__wrap(arg0);
2288
2314
  return addHeapObject(ret);
2289
2315
  };
2290
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2291
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2292
- return addHeapObject(ret);
2293
- };
2294
2316
  imports.wbg.__wbindgen_is_array = function(arg0) {
2295
2317
  const ret = Array.isArray(getObject(arg0));
2296
2318
  return ret;
@@ -2315,6 +2337,10 @@ function __wbg_get_imports() {
2315
2337
  const ret = BigInt.asUintN(64, arg0);
2316
2338
  return addHeapObject(ret);
2317
2339
  };
2340
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2341
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2342
+ return addHeapObject(ret);
2343
+ };
2318
2344
  imports.wbg.__wbg_indexdb_new = function(arg0) {
2319
2345
  const ret = IndexDB.__wrap(arg0);
2320
2346
  return addHeapObject(ret);
@@ -1,3 +1,30 @@
1
+ export const SchemaFieldType = {
2
+ /**
3
+ * String type for text data
4
+ */
5
+ string: 'string',
6
+
7
+ /**
8
+ * Number type for numeric data (integers and floats)
9
+ */
10
+ number: 'number',
11
+
12
+ /**
13
+ * Boolean type for true/false values
14
+ */
15
+ boolean: 'boolean',
16
+
17
+ /**
18
+ * Array type for ordered collections of items
19
+ */
20
+ array: 'array',
21
+
22
+ /**
23
+ * Object type for nested document structures
24
+ */
25
+ object: 'object',
26
+ };
27
+
1
28
  // pkg/ridb_core.js
2
29
  var wasm;
3
30
  var heap = new Array(128).fill(void 0);
@@ -2239,10 +2266,6 @@ function __wbg_get_imports() {
2239
2266
  const ret = Collection.__wrap(arg0);
2240
2267
  return addHeapObject(ret);
2241
2268
  };
2242
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2243
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2244
- return addHeapObject(ret);
2245
- };
2246
2269
  imports.wbg.__wbindgen_is_array = function(arg0) {
2247
2270
  const ret = Array.isArray(getObject(arg0));
2248
2271
  return ret;
@@ -2267,6 +2290,10 @@ function __wbg_get_imports() {
2267
2290
  const ret = BigInt.asUintN(64, arg0);
2268
2291
  return addHeapObject(ret);
2269
2292
  };
2293
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2294
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2295
+ return addHeapObject(ret);
2296
+ };
2270
2297
  imports.wbg.__wbg_indexdb_new = function(arg0) {
2271
2298
  const ret = IndexDB.__wrap(arg0);
2272
2299
  return addHeapObject(ret);