@naturalcycles/db-lib 10.17.0 → 10.17.1
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,8 +113,12 @@ export interface CommonDaoCfg<BM extends BaseDBEntity, DBM extends BaseDBEntity
|
|
|
113
113
|
/**
|
|
114
114
|
* Used by e.g Firestore.
|
|
115
115
|
*/
|
|
116
|
-
indexes?:
|
|
117
|
-
|
|
116
|
+
indexes?: CommonDaoIndexDefinition<DBM>[];
|
|
117
|
+
/**
|
|
118
|
+
* Defines the property that is used for TTL (auto-cleanup by the DB,
|
|
119
|
+
* e.g Datastore/Firestore).
|
|
120
|
+
*/
|
|
121
|
+
ttl?: keyof DBM;
|
|
118
122
|
/**
|
|
119
123
|
* Defaults to true.
|
|
120
124
|
* If set to false - load (read) operations will skip validation (and conversion).
|
|
@@ -182,6 +186,12 @@ export interface CommonDaoCfg<BM extends BaseDBEntity, DBM extends BaseDBEntity
|
|
|
182
186
|
*/
|
|
183
187
|
patchInTransaction?: boolean;
|
|
184
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Index can be defined in simple form, just as a property name: `abc`
|
|
191
|
+
*
|
|
192
|
+
* or as an object, when non-standard index order(s) are needed.
|
|
193
|
+
*/
|
|
194
|
+
export type CommonDaoIndexDefinition<DBM extends BaseDBEntity> = keyof DBM | CommonDaoIndex<DBM>;
|
|
185
195
|
export interface CommonDaoIndex<DBM extends BaseDBEntity> {
|
|
186
196
|
/**
|
|
187
197
|
* Name of the property to index.
|
|
@@ -193,17 +203,6 @@ export interface CommonDaoIndex<DBM extends BaseDBEntity> {
|
|
|
193
203
|
order?: CommonDaoIndexOrder[];
|
|
194
204
|
}
|
|
195
205
|
export type CommonDaoIndexOrder = 'asc' | 'desc' | 'array-contains';
|
|
196
|
-
/**
|
|
197
|
-
* TTL definition - a map from Table name to an array of properties that should be used for TTL.
|
|
198
|
-
* Example:
|
|
199
|
-
*
|
|
200
|
-
* {
|
|
201
|
-
* myTable: ['deleteAt']
|
|
202
|
-
* }
|
|
203
|
-
*/
|
|
204
|
-
export interface CommonDaoTTL<DBM extends BaseDBEntity> {
|
|
205
|
-
[table: string]: (keyof DBM)[];
|
|
206
|
-
}
|
|
207
206
|
/**
|
|
208
207
|
* All properties default to undefined.
|
|
209
208
|
*/
|
package/package.json
CHANGED
|
@@ -139,9 +139,12 @@ export interface CommonDaoCfg<
|
|
|
139
139
|
/**
|
|
140
140
|
* Used by e.g Firestore.
|
|
141
141
|
*/
|
|
142
|
-
indexes?:
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
indexes?: CommonDaoIndexDefinition<DBM>[]
|
|
143
|
+
/**
|
|
144
|
+
* Defines the property that is used for TTL (auto-cleanup by the DB,
|
|
145
|
+
* e.g Datastore/Firestore).
|
|
146
|
+
*/
|
|
147
|
+
ttl?: keyof DBM
|
|
145
148
|
|
|
146
149
|
/**
|
|
147
150
|
* Defaults to true.
|
|
@@ -224,6 +227,13 @@ export interface CommonDaoCfg<
|
|
|
224
227
|
patchInTransaction?: boolean
|
|
225
228
|
}
|
|
226
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Index can be defined in simple form, just as a property name: `abc`
|
|
232
|
+
*
|
|
233
|
+
* or as an object, when non-standard index order(s) are needed.
|
|
234
|
+
*/
|
|
235
|
+
export type CommonDaoIndexDefinition<DBM extends BaseDBEntity> = keyof DBM | CommonDaoIndex<DBM>
|
|
236
|
+
|
|
227
237
|
export interface CommonDaoIndex<DBM extends BaseDBEntity> {
|
|
228
238
|
/**
|
|
229
239
|
* Name of the property to index.
|
|
@@ -237,18 +247,6 @@ export interface CommonDaoIndex<DBM extends BaseDBEntity> {
|
|
|
237
247
|
|
|
238
248
|
export type CommonDaoIndexOrder = 'asc' | 'desc' | 'array-contains'
|
|
239
249
|
|
|
240
|
-
/**
|
|
241
|
-
* TTL definition - a map from Table name to an array of properties that should be used for TTL.
|
|
242
|
-
* Example:
|
|
243
|
-
*
|
|
244
|
-
* {
|
|
245
|
-
* myTable: ['deleteAt']
|
|
246
|
-
* }
|
|
247
|
-
*/
|
|
248
|
-
export interface CommonDaoTTL<DBM extends BaseDBEntity> {
|
|
249
|
-
[table: string]: (keyof DBM)[]
|
|
250
|
-
}
|
|
251
|
-
|
|
252
250
|
/**
|
|
253
251
|
* All properties default to undefined.
|
|
254
252
|
*/
|