@naturalcycles/db-lib 10.16.0 → 10.17.0
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.
|
@@ -106,7 +106,15 @@ export interface CommonDaoCfg<BM extends BaseDBEntity, DBM extends BaseDBEntity
|
|
|
106
106
|
* and abstracts it away.
|
|
107
107
|
*/
|
|
108
108
|
validateBM?: ValidationFunction<BM, any>;
|
|
109
|
+
/**
|
|
110
|
+
* Used by e.g Datastore.
|
|
111
|
+
*/
|
|
109
112
|
excludeFromIndexes?: (keyof DBM)[];
|
|
113
|
+
/**
|
|
114
|
+
* Used by e.g Firestore.
|
|
115
|
+
*/
|
|
116
|
+
indexes?: CommonDaoIndex<DBM>[];
|
|
117
|
+
ttl?: CommonDaoTTL<DBM>;
|
|
110
118
|
/**
|
|
111
119
|
* Defaults to true.
|
|
112
120
|
* If set to false - load (read) operations will skip validation (and conversion).
|
|
@@ -174,6 +182,28 @@ export interface CommonDaoCfg<BM extends BaseDBEntity, DBM extends BaseDBEntity
|
|
|
174
182
|
*/
|
|
175
183
|
patchInTransaction?: boolean;
|
|
176
184
|
}
|
|
185
|
+
export interface CommonDaoIndex<DBM extends BaseDBEntity> {
|
|
186
|
+
/**
|
|
187
|
+
* Name of the property to index.
|
|
188
|
+
*/
|
|
189
|
+
name: keyof DBM;
|
|
190
|
+
/**
|
|
191
|
+
* Defaults to ['asc']
|
|
192
|
+
*/
|
|
193
|
+
order?: CommonDaoIndexOrder[];
|
|
194
|
+
}
|
|
195
|
+
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
|
+
}
|
|
177
207
|
/**
|
|
178
208
|
* All properties default to undefined.
|
|
179
209
|
*/
|
package/package.json
CHANGED
|
@@ -131,8 +131,18 @@ export interface CommonDaoCfg<
|
|
|
131
131
|
*/
|
|
132
132
|
validateBM?: ValidationFunction<BM, any>
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Used by e.g Datastore.
|
|
136
|
+
*/
|
|
134
137
|
excludeFromIndexes?: (keyof DBM)[]
|
|
135
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Used by e.g Firestore.
|
|
141
|
+
*/
|
|
142
|
+
indexes?: CommonDaoIndex<DBM>[]
|
|
143
|
+
|
|
144
|
+
ttl?: CommonDaoTTL<DBM>
|
|
145
|
+
|
|
136
146
|
/**
|
|
137
147
|
* Defaults to true.
|
|
138
148
|
* If set to false - load (read) operations will skip validation (and conversion).
|
|
@@ -214,6 +224,31 @@ export interface CommonDaoCfg<
|
|
|
214
224
|
patchInTransaction?: boolean
|
|
215
225
|
}
|
|
216
226
|
|
|
227
|
+
export interface CommonDaoIndex<DBM extends BaseDBEntity> {
|
|
228
|
+
/**
|
|
229
|
+
* Name of the property to index.
|
|
230
|
+
*/
|
|
231
|
+
name: keyof DBM
|
|
232
|
+
/**
|
|
233
|
+
* Defaults to ['asc']
|
|
234
|
+
*/
|
|
235
|
+
order?: CommonDaoIndexOrder[]
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type CommonDaoIndexOrder = 'asc' | 'desc' | 'array-contains'
|
|
239
|
+
|
|
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
|
+
|
|
217
252
|
/**
|
|
218
253
|
* All properties default to undefined.
|
|
219
254
|
*/
|