@infrab4a/connect-nestjs 1.1.3-beta.0 → 1.1.6
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/index.cjs.js
CHANGED
|
@@ -216,17 +216,19 @@ class ConnectCollectionService {
|
|
|
216
216
|
return new ConnectDocumentService(newDoc.path, this.firestore).withConverter(this.converter);
|
|
217
217
|
}
|
|
218
218
|
async getDocs() {
|
|
219
|
+
if (this.startingAt > 0)
|
|
220
|
+
this.limitBy += this.startingAt;
|
|
219
221
|
let query = this.query ? this.query : this.reference;
|
|
220
222
|
query = this.orderBy ? query.orderBy(this.orderBy.fieldPath, this.orderBy.directionStr) : query;
|
|
221
|
-
query = this.statingAt ? query.startAt(this.statingAt) : query;
|
|
222
|
-
query = this.startingAfter ? query.startAfter(this.startingAfter) : query;
|
|
223
|
-
query = this.offsetBy ? query.offset(this.offsetBy) : query;
|
|
224
223
|
query = this.limitBy ? query.limit(this.limitBy) : query;
|
|
225
|
-
return query.get().then((docs) =>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
224
|
+
return query.get().then((docs) => {
|
|
225
|
+
const docsPaginated = this.startingAt > 0 ? docs.docs.slice(this.startingAt, this.limitBy) : docs.docs;
|
|
226
|
+
return {
|
|
227
|
+
empty: Boolean(docsPaginated.length),
|
|
228
|
+
size: docsPaginated.length,
|
|
229
|
+
docs: docsPaginated.map((doc) => new ConnectBaseDocumentSnapshot(doc)),
|
|
230
|
+
};
|
|
231
|
+
});
|
|
230
232
|
}
|
|
231
233
|
getDoc(id) {
|
|
232
234
|
return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore).withConverter(this.converter);
|
|
@@ -248,7 +250,7 @@ class ConnectCollectionService {
|
|
|
248
250
|
return this;
|
|
249
251
|
}
|
|
250
252
|
fromStartAt(startingAt) {
|
|
251
|
-
this.
|
|
253
|
+
this.startingAt = startingAt;
|
|
252
254
|
return this;
|
|
253
255
|
}
|
|
254
256
|
fromStartAfter(startingAt) {
|
package/index.esm.js
CHANGED
|
@@ -212,17 +212,19 @@ class ConnectCollectionService {
|
|
|
212
212
|
return new ConnectDocumentService(newDoc.path, this.firestore).withConverter(this.converter);
|
|
213
213
|
}
|
|
214
214
|
async getDocs() {
|
|
215
|
+
if (this.startingAt > 0)
|
|
216
|
+
this.limitBy += this.startingAt;
|
|
215
217
|
let query = this.query ? this.query : this.reference;
|
|
216
218
|
query = this.orderBy ? query.orderBy(this.orderBy.fieldPath, this.orderBy.directionStr) : query;
|
|
217
|
-
query = this.statingAt ? query.startAt(this.statingAt) : query;
|
|
218
|
-
query = this.startingAfter ? query.startAfter(this.startingAfter) : query;
|
|
219
|
-
query = this.offsetBy ? query.offset(this.offsetBy) : query;
|
|
220
219
|
query = this.limitBy ? query.limit(this.limitBy) : query;
|
|
221
|
-
return query.get().then((docs) =>
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
220
|
+
return query.get().then((docs) => {
|
|
221
|
+
const docsPaginated = this.startingAt > 0 ? docs.docs.slice(this.startingAt, this.limitBy) : docs.docs;
|
|
222
|
+
return {
|
|
223
|
+
empty: Boolean(docsPaginated.length),
|
|
224
|
+
size: docsPaginated.length,
|
|
225
|
+
docs: docsPaginated.map((doc) => new ConnectBaseDocumentSnapshot(doc)),
|
|
226
|
+
};
|
|
227
|
+
});
|
|
226
228
|
}
|
|
227
229
|
getDoc(id) {
|
|
228
230
|
return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore).withConverter(this.converter);
|
|
@@ -244,7 +246,7 @@ class ConnectCollectionService {
|
|
|
244
246
|
return this;
|
|
245
247
|
}
|
|
246
248
|
fromStartAt(startingAt) {
|
|
247
|
-
this.
|
|
249
|
+
this.startingAt = startingAt;
|
|
248
250
|
return this;
|
|
249
251
|
}
|
|
250
252
|
fromStartAfter(startingAt) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infrab4a/connect-nestjs",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/B4AGroup/b4a-firebase-libs"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@infrab4a/connect": "^4.9.
|
|
12
|
+
"@infrab4a/connect": "^4.9.12",
|
|
13
13
|
"@nestjs/common": "^10.3.3",
|
|
14
14
|
"@nestjs/core": "^10.3.3",
|
|
15
15
|
"firebase-admin": "^12.0.0"
|
|
@@ -9,7 +9,7 @@ export declare class ConnectCollectionService<T extends ConnectDocumentData> imp
|
|
|
9
9
|
private orderBy;
|
|
10
10
|
private limitBy;
|
|
11
11
|
private offsetBy;
|
|
12
|
-
private
|
|
12
|
+
private startingAt;
|
|
13
13
|
private startingAfter;
|
|
14
14
|
private converter;
|
|
15
15
|
constructor(path: string, firestore: Firestore);
|