@naturalcycles/db-lib 8.28.1 → 8.28.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.
|
@@ -13,7 +13,7 @@ import { CommonDaoCfg, CommonDaoCreateOptions, CommonDaoOptions, CommonDaoSaveOp
|
|
|
13
13
|
export declare class CommonDao<BM extends Partial<ObjectWithId>, DBM extends ObjectWithId = Saved<BM>, TM = BM> {
|
|
14
14
|
cfg: CommonDaoCfg<BM, DBM, TM>;
|
|
15
15
|
constructor(cfg: CommonDaoCfg<BM, DBM, TM>);
|
|
16
|
-
create(part
|
|
16
|
+
create(part?: Partial<BM>, opt?: CommonDaoOptions): Saved<BM>;
|
|
17
17
|
getById(id: undefined, opt?: CommonDaoOptions): Promise<null>;
|
|
18
18
|
getById(id?: string, opt?: CommonDaoOptions): Promise<Saved<BM> | null>;
|
|
19
19
|
getByIdOrEmpty(id: string, part?: Partial<BM>, opt?: CommonDaoOptions): Promise<Saved<BM>>;
|
|
@@ -44,7 +44,7 @@ class CommonDao {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
// CREATE
|
|
47
|
-
create(part, opt = {}) {
|
|
47
|
+
create(part = {}, opt = {}) {
|
|
48
48
|
let bm = this.cfg.hooks.beforeCreate(part);
|
|
49
49
|
bm = this.validateAndConvert(bm, this.cfg.bmSchema, db_model_1.DBModelType.BM, opt);
|
|
50
50
|
// If no SCHEMA - return as is
|
package/package.json
CHANGED
|
@@ -88,7 +88,7 @@ export class CommonDao<
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// CREATE
|
|
91
|
-
create(part: Partial<BM
|
|
91
|
+
create(part: Partial<BM> = {}, opt: CommonDaoOptions = {}): Saved<BM> {
|
|
92
92
|
let bm = this.cfg.hooks!.beforeCreate!(part) as BM
|
|
93
93
|
bm = this.validateAndConvert(bm, this.cfg.bmSchema, DBModelType.BM, opt)
|
|
94
94
|
|