@sofiakb/fireblaze-ts 1.0.0-dev.9 → 2.0.0-dev.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.
- package/lib/commons/index.d.ts +1 -0
- package/lib/commons/index.js +14 -0
- package/lib/commons/index.js.map +1 -0
- package/lib/core/firebase-config.d.ts +7 -0
- package/lib/core/firebase-config.js +1 -1
- package/lib/core/firebase.d.ts +4 -4
- package/lib/core/firebase.js +9 -3
- package/lib/core/firebase.js.map +1 -1
- package/lib/core/firestore-repository.d.ts +324 -0
- package/lib/core/firestore-repository.js +660 -0
- package/lib/core/firestore-repository.js.map +1 -0
- package/lib/core/prepared-data.d.ts +27 -0
- package/lib/core/prepared-data.js +30 -0
- package/lib/core/prepared-data.js.map +1 -0
- package/lib/exceptions/empty-snapshot-exception.d.ts +3 -0
- package/lib/exceptions/empty-snapshot-exception.js +17 -0
- package/lib/exceptions/empty-snapshot-exception.js.map +1 -0
- package/lib/exceptions/no-document-found-exception.d.ts +11 -0
- package/lib/exceptions/no-document-found-exception.js +25 -0
- package/lib/exceptions/no-document-found-exception.js.map +1 -0
- package/lib/exceptions/no-firebase-instance-exception.js +3 -3
- package/lib/exceptions/no-firestore-instance-exception.d.ts +3 -0
- package/lib/exceptions/no-firestore-instance-exception.js +17 -0
- package/lib/exceptions/no-firestore-instance-exception.js.map +1 -0
- package/lib/exceptions/unique-constraint-exception.d.ts +11 -0
- package/lib/exceptions/unique-constraint-exception.js +25 -0
- package/lib/exceptions/unique-constraint-exception.js.map +1 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/types/class-constructor.js +1 -1
- package/lib/types/nullable.d.ts +1 -1
- package/lib/types/nullable.js +1 -1
- package/lib/utils/date.d.ts +12 -1
- package/lib/utils/date.js +27 -14
- package/lib/utils/date.js.map +1 -1
- package/lib/utils/ignored-keys.d.ts +2 -0
- package/lib/utils/ignored-keys.js +12 -0
- package/lib/utils/ignored-keys.js.map +1 -0
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +4 -6
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/paginated-data.d.ts +35 -0
- package/lib/utils/paginated-data.js +49 -0
- package/lib/utils/paginated-data.js.map +1 -0
- package/lib/utils/to-json.d.ts +1 -0
- package/lib/utils/to-json.js +35 -0
- package/lib/utils/to-json.js.map +1 -0
- package/package.json +26 -24
- package/lib/core/firebase-repository.d.ts +0 -60
- package/lib/core/firebase-repository.js +0 -316
- package/lib/core/firebase-repository.js.map +0 -1
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/*
|
|
7
|
+
* @sofiakb/fireblaze-ts
|
|
8
|
+
*
|
|
9
|
+
* (c) Sofiakb <contact.sofiakb@gmail.com>
|
|
10
|
+
*
|
|
11
|
+
* Created by WebStorm on 03/06/2022 at 15:10
|
|
12
|
+
* File src/core/firebase/firebase-repository
|
|
13
|
+
*/
|
|
14
|
+
const firestore_1 = require("firebase/firestore");
|
|
15
|
+
const lodash_1 = require("lodash");
|
|
16
|
+
const moment_1 = __importDefault(require("moment"));
|
|
17
|
+
const local_storage_1 = __importDefault(require("@sofiakb/local-storage"));
|
|
18
|
+
const utils_1 = require("../utils");
|
|
19
|
+
const date_1 = __importDefault(require("../utils/date"));
|
|
20
|
+
const to_json_1 = require("../utils/to-json");
|
|
21
|
+
const no_firebase_instance_exception_1 = __importDefault(require("../exceptions/no-firebase-instance-exception"));
|
|
22
|
+
const firebase_1 = __importDefault(require("./firebase"));
|
|
23
|
+
const prepared_data_1 = __importDefault(require("./prepared-data"));
|
|
24
|
+
const empty_snapshot_exception_1 = __importDefault(require("../exceptions/empty-snapshot-exception"));
|
|
25
|
+
const no_firestore_instance_exception_1 = __importDefault(require("../exceptions/no-firestore-instance-exception"));
|
|
26
|
+
const no_document_found_exception_1 = __importDefault(require("../exceptions/no-document-found-exception"));
|
|
27
|
+
const ignored_keys_1 = __importDefault(require("../utils/ignored-keys"));
|
|
28
|
+
const unique_constraint_exception_1 = __importDefault(require("../exceptions/unique-constraint-exception"));
|
|
29
|
+
class FirestoreRepository {
|
|
30
|
+
model = null;
|
|
31
|
+
without;
|
|
32
|
+
appends;
|
|
33
|
+
softDeletes = false;
|
|
34
|
+
_firestoreLocalStoragePrefix = "firestore:query:";
|
|
35
|
+
#instance;
|
|
36
|
+
#firestore;
|
|
37
|
+
#collection;
|
|
38
|
+
#collectionName;
|
|
39
|
+
#snapshot;
|
|
40
|
+
options;
|
|
41
|
+
constructor(attributes) {
|
|
42
|
+
if (!attributes.firestore && !firebase_1.default.getApp())
|
|
43
|
+
throw new no_firebase_instance_exception_1.default();
|
|
44
|
+
const _firestore = attributes.firestore ?? (0, firestore_1.getFirestore)();
|
|
45
|
+
if (!_firestore)
|
|
46
|
+
throw new no_firestore_instance_exception_1.default();
|
|
47
|
+
this.#instance = _firestore;
|
|
48
|
+
this.#firestore = this.#instance;
|
|
49
|
+
this.#collectionName = attributes.collectionName ?? null;
|
|
50
|
+
this.#collection = attributes.collection ?? (0, firestore_1.collection)(this.firestore, this.collectionName ?? "");
|
|
51
|
+
this.options = attributes.options;
|
|
52
|
+
this._firestoreLocalStoragePrefix = `${this._firestoreLocalStoragePrefix}${this.collection.path}:`;
|
|
53
|
+
this.#snapshot = null;
|
|
54
|
+
const self = this;
|
|
55
|
+
if (typeof window !== "undefined" && this.options?.cache.use) {
|
|
56
|
+
$(window).on("unload", function () {
|
|
57
|
+
return self.clearLocalStorage();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
this.model = attributes.model ?? null;
|
|
61
|
+
this.without = attributes.without ?? [];
|
|
62
|
+
this.appends = attributes.appends ?? [];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @return {CollectionReference}
|
|
67
|
+
*/
|
|
68
|
+
get collection() {
|
|
69
|
+
return this.#collection;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param {CollectionReference} collection
|
|
74
|
+
*/
|
|
75
|
+
set collection(collection) {
|
|
76
|
+
this.#collection = collection;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @return {Nullable<string>}
|
|
81
|
+
*/
|
|
82
|
+
get collectionName() {
|
|
83
|
+
return this.#collectionName ?? this.collection.path;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* @param {Nullable<string>} collectionName
|
|
88
|
+
*/
|
|
89
|
+
set collectionName(collectionName) {
|
|
90
|
+
this.#collectionName = collectionName;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @return {Nullable<Query>}
|
|
94
|
+
*/
|
|
95
|
+
get snapshot() {
|
|
96
|
+
return this.#snapshot;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @param {Nullable<Query>} snapshot
|
|
101
|
+
*/
|
|
102
|
+
set snapshot(snapshot) {
|
|
103
|
+
this.#snapshot = snapshot;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @return {Firestore}
|
|
107
|
+
*/
|
|
108
|
+
get firestore() {
|
|
109
|
+
return this.#firestore;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
* @param {Firestore} firestore
|
|
114
|
+
*/
|
|
115
|
+
set firestore(firestore) {
|
|
116
|
+
this.#firestore = firestore;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @return {Firestore}
|
|
120
|
+
*/
|
|
121
|
+
get instance() {
|
|
122
|
+
return this.#instance;
|
|
123
|
+
}
|
|
124
|
+
static verifyLogin(error) {
|
|
125
|
+
if (error.code === "permission-denied") {
|
|
126
|
+
return error;
|
|
127
|
+
/* cookie.delete(store.getters.TOKEN_NAME)
|
|
128
|
+
return redirect.login.view()*/
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
static _now() {
|
|
135
|
+
return firestore_1.Timestamp.now().toDate();
|
|
136
|
+
}
|
|
137
|
+
clearLocalStorage() {
|
|
138
|
+
const localStorageKeys = Object.keys(localStorage);
|
|
139
|
+
const _firestoreLocalStoragePrefix = this._firestoreLocalStoragePrefix;
|
|
140
|
+
for (const localStorageKey of localStorageKeys)
|
|
141
|
+
if (localStorageKey.startsWith(_firestoreLocalStoragePrefix))
|
|
142
|
+
local_storage_1.default.delete(localStorageKey);
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @method casting
|
|
147
|
+
* @description Cette méthode permet de transformer l'objet retourné par firebase.
|
|
148
|
+
*
|
|
149
|
+
* @param {any} data
|
|
150
|
+
*
|
|
151
|
+
* @return {Promise}
|
|
152
|
+
*/
|
|
153
|
+
async casting(data) {
|
|
154
|
+
if (this.appends.length > 0)
|
|
155
|
+
await Promise.all((0, lodash_1.map)(this.appends, async (item) => {
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
const method = this[`with${item.capitalize()}`];
|
|
158
|
+
return typeof method === "undefined" ? null : (data[item] = await method(data));
|
|
159
|
+
}));
|
|
160
|
+
Object.keys(data).map((key) => (data[key] = data[key] instanceof firestore_1.Timestamp ? (0, moment_1.default)(data[key].toDate()) : data[key]));
|
|
161
|
+
// eslint-disable-next-line new-cap
|
|
162
|
+
return this.model ? new this.model(data) : data;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @method castingAll
|
|
166
|
+
* @description Cette méthode permet de transformer l'objet retourné par firebase.
|
|
167
|
+
*
|
|
168
|
+
* @param {any} values
|
|
169
|
+
*
|
|
170
|
+
* @return {Promise}
|
|
171
|
+
*/
|
|
172
|
+
async castingAll(values) {
|
|
173
|
+
return Array.isArray(values)
|
|
174
|
+
? await Promise.all((0, lodash_1.map)(values, async (item) => await this.casting(item)))
|
|
175
|
+
: await this.casting(values);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @method _castData
|
|
179
|
+
* @description Cette méthode permet de transformer l'objet retourné par firebase.
|
|
180
|
+
*
|
|
181
|
+
* @param {QuerySnapshot} querySnapshot
|
|
182
|
+
*
|
|
183
|
+
* @return {Promise}
|
|
184
|
+
*/
|
|
185
|
+
async _castData(querySnapshot) {
|
|
186
|
+
return await Promise.all(querySnapshot.docs
|
|
187
|
+
.map(async (doc) => await this.casting(doc.data()))
|
|
188
|
+
.filter((item) => item !== null));
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
*
|
|
192
|
+
* @return {Query}
|
|
193
|
+
*/
|
|
194
|
+
_query() {
|
|
195
|
+
return this.#snapshot ?? this.#collection;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* @method all
|
|
199
|
+
* @description Cette méthode prépare la requête afin lister tous les éléments de la collection.
|
|
200
|
+
*
|
|
201
|
+
* @param {object} options
|
|
202
|
+
*
|
|
203
|
+
* @return {this}
|
|
204
|
+
*/
|
|
205
|
+
all(options) {
|
|
206
|
+
this.#snapshot = this.#collection;
|
|
207
|
+
return !this.softDeletes || options?.withSoftDelete === true
|
|
208
|
+
? this
|
|
209
|
+
: this.where((0, firestore_1.where)("deletedAt", "==", null));
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* @method where
|
|
213
|
+
* @description Cette méthode prépare la requête afin rechercher des éléments.
|
|
214
|
+
*
|
|
215
|
+
* @return {this}
|
|
216
|
+
* @param {QueryCompositeFilterConstraint|QueryFieldFilterConstraint} filter
|
|
217
|
+
*/
|
|
218
|
+
where(filter) {
|
|
219
|
+
return this.whereSnapshot(filter);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* @method whereSnapshot
|
|
223
|
+
* @description Cette méthode prépare la requête afin rechercher des éléments.
|
|
224
|
+
*
|
|
225
|
+
* @return {this}
|
|
226
|
+
* @param {QueryCompositeFilterConstraint|QueryFieldFilterConstraint} filter
|
|
227
|
+
*/
|
|
228
|
+
whereSnapshot(filter) {
|
|
229
|
+
if (filter instanceof firestore_1.QueryCompositeFilterConstraint) {
|
|
230
|
+
this.#snapshot = (0, firestore_1.query)(this._query(), filter);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
filter = filter;
|
|
234
|
+
this.#snapshot = (0, firestore_1.query)(this._query(), filter);
|
|
235
|
+
}
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* @method findOneById
|
|
240
|
+
* @description Cette méthode prépare la requête afin rechercher un élément par son ID.
|
|
241
|
+
*
|
|
242
|
+
* @return {Promise<Nullable<T | any>>}
|
|
243
|
+
* @param {string} id
|
|
244
|
+
*/
|
|
245
|
+
async findOneById(id) {
|
|
246
|
+
return this.doc(id);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @method documentReference
|
|
250
|
+
* @description Cette méthode retourne la référence d'un document.
|
|
251
|
+
*
|
|
252
|
+
* @return {Nullable<DocumentReference>}
|
|
253
|
+
* @param {string} docID
|
|
254
|
+
*/
|
|
255
|
+
documentReference(docID) {
|
|
256
|
+
if (docID.trim() === "")
|
|
257
|
+
return null;
|
|
258
|
+
return (0, firestore_1.doc)(this.collection, docID);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* @method doc
|
|
262
|
+
* @description Cette méthode retourne la référence d'un document.
|
|
263
|
+
*
|
|
264
|
+
* @return {Promise}
|
|
265
|
+
* @param {Nullable<string>} docID
|
|
266
|
+
* @param {boolean} cast
|
|
267
|
+
* @param {QueryOptions} options
|
|
268
|
+
*/
|
|
269
|
+
async doc(docID, cast = true, options) {
|
|
270
|
+
if (docID === null || docID.trim() === "")
|
|
271
|
+
return null;
|
|
272
|
+
return new Promise((resolve, reject) => {
|
|
273
|
+
const documentReference = this.documentReference(docID);
|
|
274
|
+
if (documentReference === null)
|
|
275
|
+
return reject(new no_document_found_exception_1.default());
|
|
276
|
+
(0, firestore_1.getDoc)(documentReference)
|
|
277
|
+
.then(async (documentDataResult) => {
|
|
278
|
+
const documentData = documentDataResult;
|
|
279
|
+
return documentData.exists() &&
|
|
280
|
+
((this.softDeletes && (options?.withSoftDelete === true || !documentData.data()?.deletedAt)) ||
|
|
281
|
+
!this.softDeletes)
|
|
282
|
+
? resolve(cast && documentData.data() ? await this.casting(documentData.data()) : documentData)
|
|
283
|
+
: resolve(null);
|
|
284
|
+
})
|
|
285
|
+
.catch((error) => reject(FirestoreRepository.verifyLogin(error)));
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* @method find
|
|
290
|
+
* @description Cette méthode retourne un objet en fonction de son ID.
|
|
291
|
+
*
|
|
292
|
+
* @return {Promise}
|
|
293
|
+
* @param {Nullable<string>} docID
|
|
294
|
+
* @param {QueryOptions} options
|
|
295
|
+
*
|
|
296
|
+
*/
|
|
297
|
+
async find(docID, options) {
|
|
298
|
+
return this.doc(docID, true, options);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* @method id
|
|
302
|
+
* @description Cette méthode permet de créer un identifiant de document.
|
|
303
|
+
*
|
|
304
|
+
* @return {string}
|
|
305
|
+
*/
|
|
306
|
+
id() {
|
|
307
|
+
return (0, firestore_1.doc)(this.collection).id;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* @method orderBy
|
|
311
|
+
* @description Cette méthode ajoute un tri à la requête.
|
|
312
|
+
*
|
|
313
|
+
* @return {this}
|
|
314
|
+
* @param {string | FieldPath} fieldPath
|
|
315
|
+
* @param {OrderByDirection} directionStr
|
|
316
|
+
*/
|
|
317
|
+
orderBy(fieldPath, directionStr) {
|
|
318
|
+
this.#snapshot = (0, firestore_1.query)(this._query(), (0, firestore_1.orderBy)(fieldPath, directionStr));
|
|
319
|
+
return this;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* @method limit
|
|
323
|
+
* @description Cette méthode ajoute une limite.
|
|
324
|
+
*
|
|
325
|
+
* @return {this}
|
|
326
|
+
* @param {number} _limit
|
|
327
|
+
*/
|
|
328
|
+
limit(_limit = 1) {
|
|
329
|
+
this.#snapshot = (0, firestore_1.query)(this._query(), (0, firestore_1.limit)(_limit));
|
|
330
|
+
return this;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* @method limitToLast
|
|
334
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
335
|
+
*
|
|
336
|
+
* @return {this}
|
|
337
|
+
* @param {number} limit
|
|
338
|
+
*/
|
|
339
|
+
limitToLast(limit = 1) {
|
|
340
|
+
this.#snapshot = (0, firestore_1.query)(this._query(), (0, firestore_1.limitToLast)(limit));
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* @method startAfter
|
|
345
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
346
|
+
*
|
|
347
|
+
* @return {this}
|
|
348
|
+
* @param {any} value
|
|
349
|
+
*/
|
|
350
|
+
startAfter(value) {
|
|
351
|
+
this.snapshot = (0, firestore_1.query)(this._query(), (0, firestore_1.startAfter)(value));
|
|
352
|
+
return this;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* @method endBefore
|
|
356
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
357
|
+
*
|
|
358
|
+
* @return {this}
|
|
359
|
+
* @param {any} value
|
|
360
|
+
*/
|
|
361
|
+
endBefore(value) {
|
|
362
|
+
this.snapshot = (0, firestore_1.query)(this._query(), (0, firestore_1.endBefore)(value));
|
|
363
|
+
return this;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* @method startAt
|
|
367
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
368
|
+
*
|
|
369
|
+
* @return {this}
|
|
370
|
+
* @param {any} value
|
|
371
|
+
*/
|
|
372
|
+
startAt(value) {
|
|
373
|
+
this.snapshot = (0, firestore_1.query)(this._query(), (0, firestore_1.startAt)(value));
|
|
374
|
+
return this;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* @method endAt
|
|
378
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
379
|
+
*
|
|
380
|
+
* @return {this}
|
|
381
|
+
* @param {any} value
|
|
382
|
+
*/
|
|
383
|
+
endAt(value) {
|
|
384
|
+
this.snapshot = (0, firestore_1.query)(this._query(), (0, firestore_1.endAt)(value));
|
|
385
|
+
return this;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* @method first
|
|
389
|
+
* @description Cette méthode retourne le premier élément.
|
|
390
|
+
*
|
|
391
|
+
* @return {Promise}
|
|
392
|
+
*/
|
|
393
|
+
async first() {
|
|
394
|
+
return (await this.limit(1).get())[0] ?? null;
|
|
395
|
+
}
|
|
396
|
+
offset(_offset = 1) {
|
|
397
|
+
this.#snapshot = (0, firestore_1.query)(this._query(), (0, firestore_1.startAt)(_offset));
|
|
398
|
+
return this;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* @method prepareData
|
|
402
|
+
* @description Cette méthode permet de mettre à jour un élément en fonction de son ID.
|
|
403
|
+
*
|
|
404
|
+
* @param {any} data
|
|
405
|
+
*
|
|
406
|
+
* @return {PreparedData}
|
|
407
|
+
*/
|
|
408
|
+
prepareData(data) {
|
|
409
|
+
if (!data.id) {
|
|
410
|
+
data.id = "";
|
|
411
|
+
}
|
|
412
|
+
data.createdAt = date_1.default.toMoment(data.createdAt ?? FirestoreRepository._now());
|
|
413
|
+
data.updatedAt = date_1.default.toMoment(data.updatedAt ?? FirestoreRepository._now());
|
|
414
|
+
if (this.softDeletes) {
|
|
415
|
+
data.deletedAt = data.deletedAt ? date_1.default.toMoment(data.deletedAt ?? FirestoreRepository._now()) : null;
|
|
416
|
+
}
|
|
417
|
+
Object.keys(data).map((key) => (data[key] = (0, lodash_1.includes)(this.without, key) ? undefined : data[key]));
|
|
418
|
+
data = (0, lodash_1.pickBy)(data, (v) => v !== undefined);
|
|
419
|
+
Object.keys(data).map((key) => (data[key] =
|
|
420
|
+
data[key] !== null &&
|
|
421
|
+
typeof data[key] === "object" &&
|
|
422
|
+
!(0, lodash_1.includes)(ignored_keys_1.default, data[key]?.constructor?.name)
|
|
423
|
+
? data[key]?.constructor?.name?.toLowerCase() === "moment"
|
|
424
|
+
? data[key].toDate()
|
|
425
|
+
: (0, to_json_1.toJSON)(data[key])
|
|
426
|
+
: data[key]));
|
|
427
|
+
const documentReference = this.documentReference(data.id) ?? (0, firestore_1.doc)(this.collection);
|
|
428
|
+
return prepared_data_1.default.create({ documentReference, data: { ...data, id: documentReference.id } });
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* @method store
|
|
432
|
+
* @description Cette méthode permet d'ajouter un élément.
|
|
433
|
+
*
|
|
434
|
+
* @param {any} data
|
|
435
|
+
*
|
|
436
|
+
* @return {Promise}
|
|
437
|
+
*/
|
|
438
|
+
async store(data) {
|
|
439
|
+
const prepared = this.prepareData(data);
|
|
440
|
+
await (0, firestore_1.setDoc)(prepared.documentReference, { ...prepared.data, id: prepared.documentReference.id });
|
|
441
|
+
return await this.casting({ ...data, id: prepared.documentReference.id });
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* @method storeUnique
|
|
445
|
+
*
|
|
446
|
+
* @param {any} data
|
|
447
|
+
* @param {string[]} uniqueKeys
|
|
448
|
+
*
|
|
449
|
+
* @return {Promise<Nullable<T>>}
|
|
450
|
+
*/
|
|
451
|
+
async storeUnique(data, uniqueKeys) {
|
|
452
|
+
let result = null;
|
|
453
|
+
await Promise.all((0, lodash_1.map)(uniqueKeys, async (uniqueKey) => {
|
|
454
|
+
result = await this.where((0, firestore_1.where)(uniqueKey, "==", data[uniqueKey])).first();
|
|
455
|
+
if (result !== null) {
|
|
456
|
+
throw new unique_constraint_exception_1.default();
|
|
457
|
+
}
|
|
458
|
+
})).catch((e) => {
|
|
459
|
+
throw e;
|
|
460
|
+
});
|
|
461
|
+
return this.store(data);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* @method storeMultiple
|
|
465
|
+
* @description Cette méthode permet d'ajouter plusieurs éléments.
|
|
466
|
+
*
|
|
467
|
+
* @param {any[]} values
|
|
468
|
+
*
|
|
469
|
+
* @return {Promise}
|
|
470
|
+
*/
|
|
471
|
+
async storeMultiple(values) {
|
|
472
|
+
const chunkValues = (0, lodash_1.chunk)(values, 500);
|
|
473
|
+
for await (const chunkValue of chunkValues) {
|
|
474
|
+
const batch = (0, firestore_1.writeBatch)(this.firestore);
|
|
475
|
+
(0, lodash_1.each)(chunkValue, (data) => {
|
|
476
|
+
const prepared = this.prepareData(data);
|
|
477
|
+
batch.set(prepared.documentReference, {
|
|
478
|
+
...prepared.data,
|
|
479
|
+
id: prepared.documentReference.id,
|
|
480
|
+
});
|
|
481
|
+
});
|
|
482
|
+
await batch.commit();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
async update(docID, data, force = false) {
|
|
486
|
+
if (docID.trim() === "")
|
|
487
|
+
return null;
|
|
488
|
+
const preparedData = this.prepareData({ ...data, id: docID });
|
|
489
|
+
const documentReference = preparedData.documentReference;
|
|
490
|
+
data = preparedData.data;
|
|
491
|
+
if (documentReference) {
|
|
492
|
+
data.updatedAt = FirestoreRepository._now();
|
|
493
|
+
delete data.createdAt;
|
|
494
|
+
if (force) {
|
|
495
|
+
await (0, firestore_1.setDoc)(documentReference, data);
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
await (0, firestore_1.updateDoc)(documentReference, data);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
this.clearLocalStorage();
|
|
502
|
+
return this.doc(docID);
|
|
503
|
+
}
|
|
504
|
+
async delete(docID) {
|
|
505
|
+
if (typeof docID === "undefined" || docID.trim() === "")
|
|
506
|
+
return this.deleteWhere();
|
|
507
|
+
const documentReference = this.documentReference(docID);
|
|
508
|
+
this.clearLocalStorage();
|
|
509
|
+
if (documentReference) {
|
|
510
|
+
await (0, firestore_1.deleteDoc)(documentReference);
|
|
511
|
+
return true;
|
|
512
|
+
}
|
|
513
|
+
return false;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* @method softDelete
|
|
517
|
+
* @description Cette méthode permet de "soft supprimer" un élément en fonction de son ID.
|
|
518
|
+
*
|
|
519
|
+
* @param {string} docID
|
|
520
|
+
*
|
|
521
|
+
* @return {Promise<boolean>}
|
|
522
|
+
*/
|
|
523
|
+
async softDelete(docID) {
|
|
524
|
+
if (docID.trim() === "")
|
|
525
|
+
return false;
|
|
526
|
+
const documentReference = this.documentReference(docID);
|
|
527
|
+
if (documentReference) {
|
|
528
|
+
await (0, firestore_1.updateDoc)(documentReference, { deletedAt: FirestoreRepository._now() });
|
|
529
|
+
return true;
|
|
530
|
+
}
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* @method whereIn
|
|
535
|
+
* @description Cette méthode permet de rechercher parmi les valeurs du tableau en paramètre.
|
|
536
|
+
*
|
|
537
|
+
* @param {string} column
|
|
538
|
+
* @param {string[]} values
|
|
539
|
+
*
|
|
540
|
+
* @return {Promise}
|
|
541
|
+
*/
|
|
542
|
+
async whereIn(column, values) {
|
|
543
|
+
if (values.length === 0)
|
|
544
|
+
return this.all().get();
|
|
545
|
+
const chunkValues = (0, lodash_1.chunk)(values, 10);
|
|
546
|
+
let results = [];
|
|
547
|
+
for await (const items of chunkValues) {
|
|
548
|
+
results = results.concat(await this.where((0, firestore_1.where)(column, "in", items)).get());
|
|
549
|
+
}
|
|
550
|
+
return results;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* @method whereNotIn
|
|
554
|
+
* @description Cette méthode permet de rechercher parmi les valeurs du tableau en paramètre.
|
|
555
|
+
*
|
|
556
|
+
* @param {string} column
|
|
557
|
+
* @param {string[]} values
|
|
558
|
+
*
|
|
559
|
+
* @return {Promise}
|
|
560
|
+
*/
|
|
561
|
+
async whereNotIn(column, values) {
|
|
562
|
+
if (values.length === 0)
|
|
563
|
+
return this.all().get();
|
|
564
|
+
const chunkValues = (0, lodash_1.chunk)(values, 10);
|
|
565
|
+
let results = [];
|
|
566
|
+
for await (const items of chunkValues) {
|
|
567
|
+
results = results.concat(await this.where((0, firestore_1.where)(column, "not-in", items)).get());
|
|
568
|
+
}
|
|
569
|
+
return results;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* @method count
|
|
573
|
+
* @description Cette méthode permet de compter le nombre d'éléments dans la requête.
|
|
574
|
+
*
|
|
575
|
+
* @param {boolean} all
|
|
576
|
+
*
|
|
577
|
+
* @return {Promise<number>}
|
|
578
|
+
*/
|
|
579
|
+
async count(all = true) {
|
|
580
|
+
return (await (0, firestore_1.getCountFromServer)(all ? this.collection : this._query())).data().count;
|
|
581
|
+
}
|
|
582
|
+
async get(cast = true) {
|
|
583
|
+
return new Promise((resolve, reject) => {
|
|
584
|
+
if (!this.#snapshot) {
|
|
585
|
+
return reject(new empty_snapshot_exception_1.default());
|
|
586
|
+
}
|
|
587
|
+
const _query = this.#snapshot;
|
|
588
|
+
// @ts-ignore
|
|
589
|
+
const queryObject = _query._query;
|
|
590
|
+
let queryString = utils_1.base64.encode(JSON.stringify({
|
|
591
|
+
collectionGroup: queryObject.collectionGroup,
|
|
592
|
+
endAt: queryObject.endAt,
|
|
593
|
+
explicitOrderBy: queryObject.explicitOrderBy,
|
|
594
|
+
filters: queryObject.filters,
|
|
595
|
+
limit: queryObject.limit,
|
|
596
|
+
limitType: queryObject.limitType,
|
|
597
|
+
path: queryObject.path,
|
|
598
|
+
startAt: queryObject.startAt,
|
|
599
|
+
}));
|
|
600
|
+
if (this.options?.cache.use) {
|
|
601
|
+
queryString = utils_1.base64.encode(JSON.stringify({
|
|
602
|
+
collectionGroup: queryObject.collectionGroup,
|
|
603
|
+
endAt: queryObject.endAt,
|
|
604
|
+
explicitOrderBy: queryObject.explicitOrderBy,
|
|
605
|
+
filters: queryObject.filters,
|
|
606
|
+
limit: queryObject.limit,
|
|
607
|
+
limitType: queryObject.limitType,
|
|
608
|
+
path: queryObject.path,
|
|
609
|
+
startAt: queryObject.startAt,
|
|
610
|
+
}));
|
|
611
|
+
const cacheStorage = local_storage_1.default.get(`${this._firestoreLocalStoragePrefix}${queryString}`);
|
|
612
|
+
if (cacheStorage?.data && cacheStorage?.until && (0, moment_1.default)().unix() < (0, moment_1.default)(cacheStorage.until)?.unix()) {
|
|
613
|
+
return resolve(this.castingAll(cacheStorage?.data));
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
(0, firestore_1.getDocs)(_query)
|
|
617
|
+
.then(async (querySnapshot) => {
|
|
618
|
+
this.#snapshot = null;
|
|
619
|
+
const result = cast
|
|
620
|
+
? await this._castData(querySnapshot)
|
|
621
|
+
: await Promise.all(querySnapshot.docs.map(async (doc) => await doc.data()));
|
|
622
|
+
if (this.options?.cache.use) {
|
|
623
|
+
const firestoreStorage = {
|
|
624
|
+
data: await Promise.all(querySnapshot.docs.map(async (doc) => doc.data())),
|
|
625
|
+
until: (0, moment_1.default)().add(this.options?.cache.until, "seconds"),
|
|
626
|
+
};
|
|
627
|
+
// @ts-ignore
|
|
628
|
+
local_storage_1.default.set(`${this._firestoreLocalStoragePrefix}${queryString}`, firestoreStorage);
|
|
629
|
+
}
|
|
630
|
+
resolve(result);
|
|
631
|
+
})
|
|
632
|
+
.catch((error) => reject(FirestoreRepository.verifyLogin(error)))
|
|
633
|
+
.finally(() => (this.#snapshot = null));
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
snapshots(callback, options) {
|
|
637
|
+
if (!this.snapshot) {
|
|
638
|
+
return null;
|
|
639
|
+
}
|
|
640
|
+
const _query = this.snapshot;
|
|
641
|
+
return (0, firestore_1.onSnapshot)(_query, { includeMetadataChanges: options?.metaData ?? true }, async (querySnapshot) => {
|
|
642
|
+
this.snapshot = null;
|
|
643
|
+
const results = options?.cast
|
|
644
|
+
? await this._castData(querySnapshot)
|
|
645
|
+
: await Promise.all(querySnapshot.docs.map(async (doc) => await doc.data()));
|
|
646
|
+
if (callback) {
|
|
647
|
+
callback(results);
|
|
648
|
+
}
|
|
649
|
+
return results;
|
|
650
|
+
}, (error) => FirestoreRepository.verifyLogin(error), () => (this.snapshot = null));
|
|
651
|
+
}
|
|
652
|
+
async deleteWhere() {
|
|
653
|
+
if (this.#snapshot === null)
|
|
654
|
+
throw new empty_snapshot_exception_1.default();
|
|
655
|
+
const items = await this.get(false);
|
|
656
|
+
(0, lodash_1.each)(items, (doc) => (doc.id ? this.delete(doc.id) : null));
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
exports.default = FirestoreRepository;
|
|
660
|
+
//# sourceMappingURL=firestore-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore-repository.js","sourceRoot":"","sources":["../../src/core/firestore-repository.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAEb;;;;;;;GAOG;AAEH,kDAkC4B;AAE5B,mCAA4D;AAC5D,oDAAwC;AAExC,2EAAqD;AAErD,oCAAkC;AAClC,yDAAmC;AACnC,8CAA0C;AAK1C,kHAAuF;AACvF,0DAAkC;AAClC,oEAA2C;AAC3C,sGAA4E;AAC5E,oHAAyF;AACzF,4GAAiF;AACjF,yEAAgD;AAChD,4GAAkF;AAyBlF,MAAqB,mBAAmB;IACvC,KAAK,GAAkC,IAAI,CAAC;IAC5C,OAAO,CAAW;IAClB,OAAO,CAAW;IAClB,WAAW,GAAG,KAAK,CAAC;IACpB,4BAA4B,GAAG,kBAAkB,CAAC;IACzC,SAAS,CAAY;IAC9B,UAAU,CAAY;IACtB,WAAW,CAAsB;IACjC,eAAe,CAAmB;IAClC,SAAS,CAAkB;IAC3B,OAAO,CAA8B;IAErC,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