@naturalcycles/db-lib 10.20.0 → 10.20.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.
|
@@ -160,8 +160,8 @@ export declare class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity
|
|
|
160
160
|
ping(): Promise<void>;
|
|
161
161
|
withId(id: ID): DaoWithId<typeof this>;
|
|
162
162
|
withIds(ids: ID[]): DaoWithIds<typeof this>;
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
withRowsToSave(rows: Unsaved<BM>[]): DaoWithRows<typeof this>;
|
|
164
|
+
withRowToSave(row: Unsaved<BM>, opt?: DaoWithRowOptions<BM>): DaoWithRow<typeof this>;
|
|
165
165
|
/**
|
|
166
166
|
* Load rows (by their ids) from Multiple tables at once.
|
|
167
167
|
* An optimized way to load data, minimizing DB round-trips.
|
|
@@ -209,20 +209,19 @@ export interface DaoWithId<DAO extends AnyDao> {
|
|
|
209
209
|
dao: DAO;
|
|
210
210
|
id: string;
|
|
211
211
|
}
|
|
212
|
-
export interface DaoWithRows<DAO extends AnyDao
|
|
212
|
+
export interface DaoWithRows<DAO extends AnyDao, BM = InferBM<DAO>> {
|
|
213
213
|
dao: DAO;
|
|
214
|
-
rows:
|
|
214
|
+
rows: Unsaved<BM>[];
|
|
215
215
|
}
|
|
216
|
-
export interface DaoWithRow<DAO extends AnyDao
|
|
216
|
+
export interface DaoWithRow<DAO extends AnyDao, BM = InferBM<DAO>> {
|
|
217
217
|
dao: DAO;
|
|
218
|
-
row:
|
|
219
|
-
opt?: DaoWithRowOptions<
|
|
218
|
+
row: Unsaved<BM>;
|
|
219
|
+
opt?: DaoWithRowOptions<BM>;
|
|
220
220
|
}
|
|
221
|
-
interface DaoWithRowOptions<BM
|
|
221
|
+
export interface DaoWithRowOptions<BM> {
|
|
222
222
|
skipIfEquals?: BM;
|
|
223
223
|
}
|
|
224
224
|
export type InferBM<DAO> = DAO extends CommonDao<infer BM> ? BM : never;
|
|
225
225
|
export type InferDBM<DAO> = DAO extends CommonDao<any, infer DBM> ? DBM : never;
|
|
226
226
|
export type InferID<DAO> = DAO extends CommonDao<any, any, infer ID> ? ID : never;
|
|
227
227
|
export type AnyDao = CommonDao<any>;
|
|
228
|
-
export {};
|
|
@@ -779,13 +779,13 @@ export class CommonDao {
|
|
|
779
779
|
ids,
|
|
780
780
|
};
|
|
781
781
|
}
|
|
782
|
-
|
|
782
|
+
withRowsToSave(rows) {
|
|
783
783
|
return {
|
|
784
784
|
dao: this,
|
|
785
785
|
rows: rows,
|
|
786
786
|
};
|
|
787
787
|
}
|
|
788
|
-
|
|
788
|
+
withRowToSave(row, opt) {
|
|
789
789
|
return {
|
|
790
790
|
dao: this,
|
|
791
791
|
row: row,
|
package/package.json
CHANGED
|
@@ -1049,14 +1049,14 @@ export class CommonDao<
|
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
|
|
1052
|
-
|
|
1052
|
+
withRowsToSave(rows: Unsaved<BM>[]): DaoWithRows<typeof this> {
|
|
1053
1053
|
return {
|
|
1054
1054
|
dao: this,
|
|
1055
1055
|
rows: rows as any,
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
1058
|
|
|
1059
|
-
|
|
1059
|
+
withRowToSave(row: Unsaved<BM>, opt?: DaoWithRowOptions<BM>): DaoWithRow<typeof this> {
|
|
1060
1060
|
return {
|
|
1061
1061
|
dao: this,
|
|
1062
1062
|
row: row as any,
|
|
@@ -1307,18 +1307,18 @@ export interface DaoWithId<DAO extends AnyDao> {
|
|
|
1307
1307
|
id: string
|
|
1308
1308
|
}
|
|
1309
1309
|
|
|
1310
|
-
export interface DaoWithRows<DAO extends AnyDao
|
|
1310
|
+
export interface DaoWithRows<DAO extends AnyDao, BM = InferBM<DAO>> {
|
|
1311
1311
|
dao: DAO
|
|
1312
|
-
rows:
|
|
1312
|
+
rows: Unsaved<BM>[]
|
|
1313
1313
|
}
|
|
1314
1314
|
|
|
1315
|
-
export interface DaoWithRow<DAO extends AnyDao
|
|
1315
|
+
export interface DaoWithRow<DAO extends AnyDao, BM = InferBM<DAO>> {
|
|
1316
1316
|
dao: DAO
|
|
1317
|
-
row:
|
|
1318
|
-
opt?: DaoWithRowOptions<
|
|
1317
|
+
row: Unsaved<BM>
|
|
1318
|
+
opt?: DaoWithRowOptions<BM>
|
|
1319
1319
|
}
|
|
1320
1320
|
|
|
1321
|
-
interface DaoWithRowOptions<BM
|
|
1321
|
+
export interface DaoWithRowOptions<BM> {
|
|
1322
1322
|
skipIfEquals?: BM
|
|
1323
1323
|
}
|
|
1324
1324
|
|