@naturalcycles/db-lib 10.16.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.
|
@@ -106,7 +106,19 @@ 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?: 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;
|
|
110
122
|
/**
|
|
111
123
|
* Defaults to true.
|
|
112
124
|
* If set to false - load (read) operations will skip validation (and conversion).
|
|
@@ -174,6 +186,23 @@ export interface CommonDaoCfg<BM extends BaseDBEntity, DBM extends BaseDBEntity
|
|
|
174
186
|
*/
|
|
175
187
|
patchInTransaction?: boolean;
|
|
176
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>;
|
|
195
|
+
export interface CommonDaoIndex<DBM extends BaseDBEntity> {
|
|
196
|
+
/**
|
|
197
|
+
* Name of the property to index.
|
|
198
|
+
*/
|
|
199
|
+
name: keyof DBM;
|
|
200
|
+
/**
|
|
201
|
+
* Defaults to ['asc']
|
|
202
|
+
*/
|
|
203
|
+
order?: CommonDaoIndexOrder[];
|
|
204
|
+
}
|
|
205
|
+
export type CommonDaoIndexOrder = 'asc' | 'desc' | 'array-contains';
|
|
177
206
|
/**
|
|
178
207
|
* All properties default to undefined.
|
|
179
208
|
*/
|
package/package.json
CHANGED
|
@@ -131,8 +131,21 @@ 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?: 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
|
|
148
|
+
|
|
136
149
|
/**
|
|
137
150
|
* Defaults to true.
|
|
138
151
|
* If set to false - load (read) operations will skip validation (and conversion).
|
|
@@ -214,6 +227,26 @@ export interface CommonDaoCfg<
|
|
|
214
227
|
patchInTransaction?: boolean
|
|
215
228
|
}
|
|
216
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
|
+
|
|
237
|
+
export interface CommonDaoIndex<DBM extends BaseDBEntity> {
|
|
238
|
+
/**
|
|
239
|
+
* Name of the property to index.
|
|
240
|
+
*/
|
|
241
|
+
name: keyof DBM
|
|
242
|
+
/**
|
|
243
|
+
* Defaults to ['asc']
|
|
244
|
+
*/
|
|
245
|
+
order?: CommonDaoIndexOrder[]
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export type CommonDaoIndexOrder = 'asc' | 'desc' | 'array-contains'
|
|
249
|
+
|
|
217
250
|
/**
|
|
218
251
|
* All properties default to undefined.
|
|
219
252
|
*/
|