@trust0/ridb-core 1.7.18 → 1.7.20

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.
@@ -38,6 +38,16 @@ declare function __wbgtest_console_warn(args: Array<any>): void;
38
38
  */
39
39
  declare function __wbgtest_console_error(args: Array<any>): void;
40
40
  /**
41
+ */
42
+ declare enum Errors {
43
+ Error = 0,
44
+ HookError = 1,
45
+ QueryError = 2,
46
+ SerializationError = 3,
47
+ ValidationError = 4,
48
+ AuthenticationError = 5,
49
+ }
50
+ /**
41
51
  * Represents the type of operation to be performed on the collection.
42
52
  */
43
53
  declare enum OpType {
@@ -62,16 +72,6 @@ declare enum OpType {
62
72
  */
63
73
  COUNT = 4,
64
74
  }
65
- /**
66
- */
67
- declare 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
  declare class CoreStorage {
77
77
  /**
@@ -198,13 +198,13 @@ type LogicalOperators<T extends SchemaType> = {
198
198
  $or?: Partial<QueryType<T>>[];
199
199
  };
200
200
 
201
- type QueryType<T extends SchemaType> = Partial<{
202
- [K in keyof T['properties']]: OperatorOrType<
201
+ type QueryType<T extends SchemaType> = ({
202
+ [K in keyof T['properties']as ExtractType<T['properties'][K]['type']> extends undefined ? never : K]?: OperatorOrType<
203
203
  ExtractType<
204
204
  T['properties'][K]['type']
205
205
  >
206
206
  >
207
- }> & LogicalOperators<T> | LogicalOperators<T>[];
207
+ } & LogicalOperators<T>) | LogicalOperators<T>[];
208
208
 
209
209
  declare class Query<T extends SchemaType> {
210
210
  constructor(query: QueryType<T>, schema:Schema<T>);
@@ -236,8 +236,8 @@ type ExtractType<T extends string> =
236
236
  T extends "array" ? any[] :
237
237
  never;
238
238
 
239
- type IsOptional<T> = T extends { required: false } ? true :
240
- T extends { default: any } ? true : false;
239
+ type IsOptional<T> =
240
+ T extends { required: false } | { required: true, default: never } ? true : false;
241
241
 
242
242
  /**
243
243
  * Doc is a utility type that transforms a schema type into a document type where each property is mapped to its extracted type.
@@ -248,10 +248,12 @@ type IsOptional<T> = T extends { required: false } ? true :
248
248
  */
249
249
  type Doc<T extends SchemaType> = {
250
250
  [K in keyof T["properties"] as IsOptional<T["properties"][K]> extends true ? K : never]?:
251
- ExtractType<T["properties"][K]["type"]>
251
+ ExtractType<T['properties'][K]['type']> extends undefined ? `${T['properties'][K]['type']}` : ExtractType<T['properties'][K]['type']>
252
+
252
253
  } & {
253
- [K in keyof T["properties"] as IsOptional<T["properties"][K]> extends false ? K : never]:
254
- ExtractType<T["properties"][K]["type"]>
254
+ [K in keyof T["properties"]]:
255
+ ExtractType<T['properties'][K]['type']> extends undefined ? `${T['properties'][K]['type']}` : ExtractType<T['properties'][K]['type']>
256
+
255
257
  } & {
256
258
  __version?: number;
257
259
  createdAt?: number;
@@ -301,7 +303,7 @@ declare class Collection<T extends SchemaType> {
301
303
  * @param document - The document to create.
302
304
  * @returns A promise that resolves to the created document.
303
305
  */
304
- create(document: Doc<T>): Promise<Doc<T>>;
306
+ create(document: Partial<Doc<T>>): Promise<Doc<T>>;
305
307
  /**
306
308
  * Deletes a document in the collection by its ID.
307
309
  *
@@ -377,6 +377,7 @@ function __wbg_adapter_337(arg0, arg1, arg2, arg3, arg4) {
377
377
  function __wbg_adapter_394(arg0, arg1, arg2, arg3) {
378
378
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h5f5731f0f637befa(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
379
379
  }
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" });
380
381
  var OpType = Object.freeze({
381
382
  /**
382
383
  * Create operation.
@@ -404,7 +405,6 @@ var OpType = Object.freeze({
404
405
  COUNT: 4,
405
406
  "4": "COUNT"
406
407
  });
407
- 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" });
408
408
  var BasePluginFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
409
409
  }, unregister: () => {
410
410
  } } : new FinalizationRegistry((ptr) => wasm.__wbg_baseplugin_free(ptr >>> 0));
@@ -329,6 +329,7 @@ function __wbg_adapter_337(arg0, arg1, arg2, arg3, arg4) {
329
329
  function __wbg_adapter_394(arg0, arg1, arg2, arg3) {
330
330
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h5f5731f0f637befa(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
331
331
  }
332
+ 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" });
332
333
  var OpType = Object.freeze({
333
334
  /**
334
335
  * Create operation.
@@ -356,7 +357,6 @@ var OpType = Object.freeze({
356
357
  COUNT: 4,
357
358
  "4": "COUNT"
358
359
  });
359
- 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" });
360
360
  var BasePluginFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
361
361
  }, unregister: () => {
362
362
  } } : new FinalizationRegistry((ptr) => wasm.__wbg_baseplugin_free(ptr >>> 0));