@infrab4a/connect 0.8.2 → 0.9.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.
Files changed (38) hide show
  1. package/bundles/infrab4a-connect.umd.js +54 -11
  2. package/bundles/infrab4a-connect.umd.js.map +1 -1
  3. package/esm2015/lib/domain/users/models/index.js +2 -1
  4. package/esm2015/lib/domain/users/models/lead.js +7 -0
  5. package/esm2015/lib/domain/users/repositories/index.js +2 -1
  6. package/esm2015/lib/domain/users/repositories/lead.repository.js +2 -0
  7. package/esm2015/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +15 -11
  8. package/esm2015/lib/infra/firebase/firestore/repositories/users/index.js +2 -1
  9. package/esm2015/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +12 -0
  10. package/fesm2015/infrab4a-connect.js +30 -11
  11. package/fesm2015/infrab4a-connect.js.map +1 -1
  12. package/lib/domain/users/models/index.d.ts +1 -0
  13. package/lib/domain/users/models/lead.d.ts +9 -0
  14. package/lib/domain/users/repositories/index.d.ts +1 -0
  15. package/lib/domain/users/repositories/lead.repository.d.ts +4 -0
  16. package/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +1 -1
  17. package/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +1 -1
  18. package/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +1 -1
  19. package/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -1
  20. package/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +1 -1
  21. package/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +1 -1
  22. package/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +1 -1
  23. package/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +1 -1
  24. package/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +1 -1
  25. package/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +1 -1
  26. package/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +1 -1
  27. package/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +1 -1
  28. package/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +1 -1
  29. package/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +1 -1
  30. package/lib/infra/firebase/firestore/repositories/users/index.d.ts +1 -0
  31. package/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +49 -0
  32. package/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +1 -1
  33. package/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +1 -1
  34. package/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +1 -1
  35. package/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +1 -1
  36. package/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +1 -1
  37. package/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +1 -1
  38. package/package.json +1 -1
@@ -776,6 +776,17 @@
776
776
  return UserAddress;
777
777
  }(Address));
778
778
 
779
+ var Lead = /** @class */ (function (_super) {
780
+ __extends(Lead, _super);
781
+ function Lead() {
782
+ return _super !== null && _super.apply(this, arguments) || this;
783
+ }
784
+ Lead.prototype.identifierFields = function () {
785
+ return ['id'];
786
+ };
787
+ return Lead;
788
+ }(BaseModel));
789
+
779
790
  var UnauthorizedError = /** @class */ (function (_super) {
780
791
  __extends(UnauthorizedError, _super);
781
792
  function UnauthorizedError(message) {
@@ -1256,9 +1267,11 @@
1256
1267
  query = this.collection(this.buildCollectionPathForFind(filters));
1257
1268
  filters === null || filters === void 0 ? void 0 : filters.forEach(function (filterer) { return (query = _this.makeFirestoreWhere(query, filterer)); });
1258
1269
  orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach(function (orderer) { return Object.keys(orderer).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderer[fieldName])); }); });
1259
- query = this.defineLimits(query, filters, limits);
1260
- return [4 /*yield*/, query.get()];
1270
+ return [4 /*yield*/, this.defineLimits(query, filters, limits)];
1261
1271
  case 1:
1272
+ query = _b.sent();
1273
+ return [4 /*yield*/, query.get()];
1274
+ case 2:
1262
1275
  docs = _b.sent();
1263
1276
  data = docs.docs.map(function (doc) { return doc.data(); });
1264
1277
  return [2 /*return*/, {
@@ -1278,15 +1291,31 @@
1278
1291
  return this.parentRepository.collectionName + "/" + parentId + "/" + this.collectionName;
1279
1292
  };
1280
1293
  FindFirestore.prototype.defineLimits = function (query, filters, limits) {
1281
- if (limits === null || limits === void 0 ? void 0 : limits.offset) {
1282
- if (limits.offset instanceof this.model)
1283
- query = query.startAfter(this.collection(this.buildCollectionPathForFind(filters)).doc(limits.offset[limits.offset.identifierFields().shift()]));
1284
- if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
1285
- query = query.startAt(limits.offset);
1286
- }
1287
- if (limits === null || limits === void 0 ? void 0 : limits.limit)
1288
- query = query.limit(limits.limit);
1289
- return query;
1294
+ return __awaiter(this, void 0, void 0, function () {
1295
+ var _b, _c;
1296
+ return __generator(this, function (_d) {
1297
+ switch (_d.label) {
1298
+ case 0:
1299
+ if (!(limits === null || limits === void 0 ? void 0 : limits.offset)) return [3 /*break*/, 3];
1300
+ if (!(limits.offset instanceof this.model)) return [3 /*break*/, 2];
1301
+ _c = (_b = query).startAfter;
1302
+ return [4 /*yield*/, this.collection(this.buildCollectionPathForFind(filters))
1303
+ .doc(limits.offset[limits.offset.identifierFields().shift()])
1304
+ .get()];
1305
+ case 1:
1306
+ query = _c.apply(_b, [_d.sent()]);
1307
+ return [3 /*break*/, 3];
1308
+ case 2:
1309
+ if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
1310
+ query = query.startAt(limits.offset);
1311
+ _d.label = 3;
1312
+ case 3:
1313
+ if (limits === null || limits === void 0 ? void 0 : limits.limit)
1314
+ query = query.limit(limits.limit);
1315
+ return [2 /*return*/, query];
1316
+ }
1317
+ });
1318
+ });
1290
1319
  };
1291
1320
  FindFirestore.prototype.calculateCount = function (data, limits) {
1292
1321
  if (data.length <= 0)
@@ -1620,6 +1649,18 @@
1620
1649
  return SubscriptionPaymentFirestoreRepository;
1621
1650
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription)));
1622
1651
 
1652
+ var LeadFirestoreRepository = /** @class */ (function (_super) {
1653
+ __extends(LeadFirestoreRepository, _super);
1654
+ function LeadFirestoreRepository(firestore) {
1655
+ var _this = _super.call(this) || this;
1656
+ _this.firestore = firestore;
1657
+ _this.collectionName = 'leads';
1658
+ _this.model = Lead;
1659
+ return _this;
1660
+ }
1661
+ return LeadFirestoreRepository;
1662
+ }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1663
+
1623
1664
  var CategoryFirestoreRepository = /** @class */ (function (_super) {
1624
1665
  __extends(CategoryFirestoreRepository, _super);
1625
1666
  function CategoryFirestoreRepository(firestore) {
@@ -2016,6 +2057,8 @@
2016
2057
  exports.Home = Home;
2017
2058
  exports.HomeFirestoreRepository = HomeFirestoreRepository;
2018
2059
  exports.InvalidArgumentError = InvalidArgumentError;
2060
+ exports.Lead = Lead;
2061
+ exports.LeadFirestoreRepository = LeadFirestoreRepository;
2019
2062
  exports.LegacyOrderFirestoreRepository = LegacyOrderFirestoreRepository;
2020
2063
  exports.LineItem = LineItem;
2021
2064
  exports.NotFoundError = NotFoundError;