@trust0/ridb-core 1.7.19 → 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.
- package/build/ridb_core.d.ts +8 -6
- package/build/ridb_core_bg.mjs +1 -1
- package/package.json +1 -1
package/build/ridb_core.d.ts
CHANGED
|
@@ -236,8 +236,8 @@ type ExtractType<T extends string> =
|
|
|
236
236
|
T extends "array" ? any[] :
|
|
237
237
|
never;
|
|
238
238
|
|
|
239
|
-
type IsOptional<T> =
|
|
240
|
-
T extends { default:
|
|
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[
|
|
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"]
|
|
254
|
-
|
|
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
|
|
306
|
+
create(document: Partial<Doc<T>>): Promise<Doc<T>>;
|
|
305
307
|
/**
|
|
306
308
|
* Deletes a document in the collection by its ID.
|
|
307
309
|
*
|