@infrab4a/connect 3.3.3-beta.0 → 3.4.0-beta.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.
- package/bundles/infrab4a-connect.umd.js +410 -265
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/filter-option.d.ts +10 -0
- package/domain/catalog/models/filter.d.ts +12 -0
- package/domain/catalog/models/index.d.ts +2 -0
- package/domain/catalog/repositories/filter-option.repository.d.ts +4 -0
- package/domain/catalog/repositories/filter.repository.d.ts +4 -0
- package/domain/catalog/repositories/index.d.ts +2 -0
- package/domain/generic/repository/find.repository.d.ts +0 -3
- package/domain/shopping/models/index.d.ts +4 -5
- package/domain/shopping/repositories/index.d.ts +2 -4
- package/esm2015/domain/catalog/models/filter-option.js +10 -0
- package/esm2015/domain/catalog/models/filter.js +10 -0
- package/esm2015/domain/catalog/models/index.js +3 -1
- package/esm2015/domain/catalog/repositories/filter-option.repository.js +2 -0
- package/esm2015/domain/catalog/repositories/filter.repository.js +2 -0
- package/esm2015/domain/catalog/repositories/index.js +3 -1
- package/esm2015/domain/generic/repository/find.repository.js +1 -1
- package/esm2015/domain/shopping/models/index.js +5 -6
- package/esm2015/domain/shopping/repositories/index.js +3 -5
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +3 -5
- package/esm2015/infra/firebase/firestore/repositories/shopping/index.js +4 -6
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +12 -17
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +5 -5
- package/esm2015/infra/hasura-graphql/models/filter-hasura-graphql.js +4 -0
- package/esm2015/infra/hasura-graphql/models/filter-option-hasura-graphql.js +4 -0
- package/esm2015/infra/hasura-graphql/models/index.js +3 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +9 -9
- package/esm2015/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.js +104 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.js +41 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +3 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +4 -7
- package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +2 -2
- package/esm2015/utils/index.js +6 -6
- package/fesm2015/infrab4a-connect.js +238 -117
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +2 -2
- package/infra/firebase/firestore/repositories/shopping/index.d.ts +3 -5
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +9 -4
- package/infra/hasura-graphql/models/filter-hasura-graphql.d.ts +3 -0
- package/infra/hasura-graphql/models/filter-option-hasura-graphql.d.ts +3 -0
- package/infra/hasura-graphql/models/index.d.ts +2 -0
- package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +18 -0
- package/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +15 -0
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +2 -0
- package/package.json +2 -2
- package/utils/index.d.ts +5 -5
- package/domain/shopping/models/campaign-dashboard.d.ts +0 -15
- package/domain/shopping/models/campaign-hashtag.d.ts +0 -18
- package/domain/shopping/repositories/campaign-dashboard.repository.d.ts +0 -4
- package/domain/shopping/repositories/campaign-hashtag.repository.d.ts +0 -4
- package/esm2015/domain/shopping/models/campaign-dashboard.js +0 -7
- package/esm2015/domain/shopping/models/campaign-hashtag.js +0 -7
- package/esm2015/domain/shopping/repositories/campaign-dashboard.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/campaign-hashtag.repository.js +0 -2
- package/esm2015/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.js +0 -12
- package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +0 -9
- package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +0 -9
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-custom-error'), require('axios'), require('firebase'), require('gql-query-builder')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-custom-error', 'axios', 'firebase', 'gql-query-builder'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global["ts-custom-error"], global.axios, global.firebase, global["gql-query-builder"]));
|
|
5
|
-
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsCustomError, axios, firebase, gqlQueryBuilder) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-custom-error'), require('axios'), require('firebase'), require('gql-query-builder'), require('node-fetch')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-custom-error', 'axios', 'firebase', 'gql-query-builder', 'node-fetch'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global["ts-custom-error"], global.axios, global.firebase, global["gql-query-builder"], global["node-fetch"]));
|
|
5
|
+
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsCustomError, axios, firebase, gqlQueryBuilder, fetch) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
9
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
10
10
|
var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
|
|
11
|
+
var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
|
|
11
12
|
|
|
12
13
|
var BaseModel = /** @class */ (function () {
|
|
13
14
|
function BaseModel(args) {
|
|
@@ -289,7 +290,7 @@
|
|
|
289
290
|
Status["CANCELLED"] = "Cancelado";
|
|
290
291
|
})(exports.Status || (exports.Status = {}));
|
|
291
292
|
|
|
292
|
-
|
|
293
|
+
/*! *****************************************************************************
|
|
293
294
|
Copyright (c) Microsoft Corporation.
|
|
294
295
|
|
|
295
296
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -356,64 +357,6 @@
|
|
|
356
357
|
function __param(paramIndex, decorator) {
|
|
357
358
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
358
359
|
}
|
|
359
|
-
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
360
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function")
|
|
361
|
-
throw new TypeError("Function expected"); return f; }
|
|
362
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
363
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
364
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
365
|
-
var _, done = false;
|
|
366
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
367
|
-
var context = {};
|
|
368
|
-
for (var p in contextIn)
|
|
369
|
-
context[p] = p === "access" ? {} : contextIn[p];
|
|
370
|
-
for (var p in contextIn.access)
|
|
371
|
-
context.access[p] = contextIn.access[p];
|
|
372
|
-
context.addInitializer = function (f) { if (done)
|
|
373
|
-
throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
374
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
375
|
-
if (kind === "accessor") {
|
|
376
|
-
if (result === void 0)
|
|
377
|
-
continue;
|
|
378
|
-
if (result === null || typeof result !== "object")
|
|
379
|
-
throw new TypeError("Object expected");
|
|
380
|
-
if (_ = accept(result.get))
|
|
381
|
-
descriptor.get = _;
|
|
382
|
-
if (_ = accept(result.set))
|
|
383
|
-
descriptor.set = _;
|
|
384
|
-
if (_ = accept(result.init))
|
|
385
|
-
initializers.push(_);
|
|
386
|
-
}
|
|
387
|
-
else if (_ = accept(result)) {
|
|
388
|
-
if (kind === "field")
|
|
389
|
-
initializers.push(_);
|
|
390
|
-
else
|
|
391
|
-
descriptor[key] = _;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (target)
|
|
395
|
-
Object.defineProperty(target, contextIn.name, descriptor);
|
|
396
|
-
done = true;
|
|
397
|
-
}
|
|
398
|
-
;
|
|
399
|
-
function __runInitializers(thisArg, initializers, value) {
|
|
400
|
-
var useValue = arguments.length > 2;
|
|
401
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
402
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
403
|
-
}
|
|
404
|
-
return useValue ? value : void 0;
|
|
405
|
-
}
|
|
406
|
-
;
|
|
407
|
-
function __propKey(x) {
|
|
408
|
-
return typeof x === "symbol" ? x : "".concat(x);
|
|
409
|
-
}
|
|
410
|
-
;
|
|
411
|
-
function __setFunctionName(f, name, prefix) {
|
|
412
|
-
if (typeof name === "symbol")
|
|
413
|
-
name = name.description ? "[".concat(name.description, "]") : "";
|
|
414
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
415
|
-
}
|
|
416
|
-
;
|
|
417
360
|
function __metadata(metadataKey, metadataValue) {
|
|
418
361
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
419
362
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -445,7 +388,7 @@
|
|
|
445
388
|
function step(op) {
|
|
446
389
|
if (f)
|
|
447
390
|
throw new TypeError("Generator is already executing.");
|
|
448
|
-
while (
|
|
391
|
+
while (_)
|
|
449
392
|
try {
|
|
450
393
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
451
394
|
return t;
|
|
@@ -509,11 +452,7 @@
|
|
|
509
452
|
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
510
453
|
if (k2 === undefined)
|
|
511
454
|
k2 = k;
|
|
512
|
-
|
|
513
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
514
|
-
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
515
|
-
}
|
|
516
|
-
Object.defineProperty(o, k2, desc);
|
|
455
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
517
456
|
}) : (function (o, m, k, k2) {
|
|
518
457
|
if (k2 === undefined)
|
|
519
458
|
k2 = k;
|
|
@@ -613,7 +552,7 @@
|
|
|
613
552
|
function __asyncDelegator(o) {
|
|
614
553
|
var i, p;
|
|
615
554
|
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
616
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done:
|
|
555
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
617
556
|
}
|
|
618
557
|
function __asyncValues(o) {
|
|
619
558
|
if (!Symbol.asyncIterator)
|
|
@@ -667,11 +606,6 @@
|
|
|
667
606
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
668
607
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
669
608
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
670
|
-
}
|
|
671
|
-
function __classPrivateFieldIn(state, receiver) {
|
|
672
|
-
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
|
673
|
-
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
674
|
-
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
675
609
|
}
|
|
676
610
|
|
|
677
611
|
var Edition = /** @class */ (function (_super) {
|
|
@@ -898,6 +832,8 @@
|
|
|
898
832
|
return Address;
|
|
899
833
|
}(BaseModel));
|
|
900
834
|
|
|
835
|
+
var isUUID = function (value) { return lodash.isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value); };
|
|
836
|
+
|
|
901
837
|
var Base = /** @class */ (function () {
|
|
902
838
|
function Base() {
|
|
903
839
|
var args = [];
|
|
@@ -909,8 +845,6 @@
|
|
|
909
845
|
return Base;
|
|
910
846
|
}());
|
|
911
847
|
|
|
912
|
-
var isUUID = function (value) { return lodash.isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value); };
|
|
913
|
-
|
|
914
848
|
var parseDateTime = function (value) {
|
|
915
849
|
if (!lodash.isString(value))
|
|
916
850
|
return value;
|
|
@@ -1351,6 +1285,42 @@
|
|
|
1351
1285
|
Shops["ALL"] = "ALL";
|
|
1352
1286
|
})(exports.Shops || (exports.Shops = {}));
|
|
1353
1287
|
|
|
1288
|
+
var Filter = /** @class */ (function (_super) {
|
|
1289
|
+
__extends(Filter, _super);
|
|
1290
|
+
function Filter() {
|
|
1291
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1292
|
+
}
|
|
1293
|
+
Filter.prototype.identifierFields = function () {
|
|
1294
|
+
return ['id'];
|
|
1295
|
+
};
|
|
1296
|
+
Object.defineProperty(Filter, "identifiersFields", {
|
|
1297
|
+
get: function () {
|
|
1298
|
+
return ['id'];
|
|
1299
|
+
},
|
|
1300
|
+
enumerable: false,
|
|
1301
|
+
configurable: true
|
|
1302
|
+
});
|
|
1303
|
+
return Filter;
|
|
1304
|
+
}(BaseModel));
|
|
1305
|
+
|
|
1306
|
+
var FilterOption = /** @class */ (function (_super) {
|
|
1307
|
+
__extends(FilterOption, _super);
|
|
1308
|
+
function FilterOption() {
|
|
1309
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1310
|
+
}
|
|
1311
|
+
FilterOption.prototype.identifierFields = function () {
|
|
1312
|
+
return ['id'];
|
|
1313
|
+
};
|
|
1314
|
+
Object.defineProperty(FilterOption, "identifiersFields", {
|
|
1315
|
+
get: function () {
|
|
1316
|
+
return ['id'];
|
|
1317
|
+
},
|
|
1318
|
+
enumerable: false,
|
|
1319
|
+
configurable: true
|
|
1320
|
+
});
|
|
1321
|
+
return FilterOption;
|
|
1322
|
+
}(BaseModel));
|
|
1323
|
+
|
|
1354
1324
|
var Product = /** @class */ (function (_super) {
|
|
1355
1325
|
__extends(Product, _super);
|
|
1356
1326
|
function Product() {
|
|
@@ -1414,54 +1384,17 @@
|
|
|
1414
1384
|
return Variant;
|
|
1415
1385
|
}(BaseModel));
|
|
1416
1386
|
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
});
|
|
1429
|
-
return Buy2Win;
|
|
1430
|
-
}(BaseModel));
|
|
1431
|
-
__decorate([
|
|
1432
|
-
classTransformer.Type(function () { return Category; }),
|
|
1433
|
-
__metadata("design:type", Array)
|
|
1434
|
-
], Buy2Win.prototype, "categories", void 0);
|
|
1435
|
-
|
|
1436
|
-
var CampaignDashboard = /** @class */ (function (_super) {
|
|
1437
|
-
__extends(CampaignDashboard, _super);
|
|
1438
|
-
function CampaignDashboard() {
|
|
1439
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1440
|
-
}
|
|
1441
|
-
Object.defineProperty(CampaignDashboard, "identifiersFields", {
|
|
1442
|
-
get: function () {
|
|
1443
|
-
return ['id'];
|
|
1444
|
-
},
|
|
1445
|
-
enumerable: false,
|
|
1446
|
-
configurable: true
|
|
1447
|
-
});
|
|
1448
|
-
return CampaignDashboard;
|
|
1449
|
-
}(BaseModel));
|
|
1450
|
-
|
|
1451
|
-
var CampaignHashtag = /** @class */ (function (_super) {
|
|
1452
|
-
__extends(CampaignHashtag, _super);
|
|
1453
|
-
function CampaignHashtag() {
|
|
1454
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1455
|
-
}
|
|
1456
|
-
Object.defineProperty(CampaignHashtag, "identifiersFields", {
|
|
1457
|
-
get: function () {
|
|
1458
|
-
return ['id'];
|
|
1459
|
-
},
|
|
1460
|
-
enumerable: false,
|
|
1461
|
-
configurable: true
|
|
1462
|
-
});
|
|
1463
|
-
return CampaignHashtag;
|
|
1464
|
-
}(BaseModel));
|
|
1387
|
+
exports.OrderStatus = void 0;
|
|
1388
|
+
(function (OrderStatus) {
|
|
1389
|
+
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
1390
|
+
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
1391
|
+
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
1392
|
+
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
1393
|
+
OrderStatus["ENVIADO"] = "Enviado";
|
|
1394
|
+
OrderStatus["ENTREGUE"] = "Entregue";
|
|
1395
|
+
OrderStatus["CANCELADO"] = "Cancelado";
|
|
1396
|
+
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
1397
|
+
})(exports.OrderStatus || (exports.OrderStatus = {}));
|
|
1465
1398
|
|
|
1466
1399
|
var LineItem = /** @class */ (function (_super) {
|
|
1467
1400
|
__extends(LineItem, _super);
|
|
@@ -1525,18 +1458,6 @@
|
|
|
1525
1458
|
__metadata("design:type", Coupon)
|
|
1526
1459
|
], Checkout.prototype, "coupon", void 0);
|
|
1527
1460
|
|
|
1528
|
-
exports.OrderStatus = void 0;
|
|
1529
|
-
(function (OrderStatus) {
|
|
1530
|
-
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
1531
|
-
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
1532
|
-
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
1533
|
-
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
1534
|
-
OrderStatus["ENVIADO"] = "Enviado";
|
|
1535
|
-
OrderStatus["ENTREGUE"] = "Entregue";
|
|
1536
|
-
OrderStatus["CANCELADO"] = "Cancelado";
|
|
1537
|
-
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
1538
|
-
})(exports.OrderStatus || (exports.OrderStatus = {}));
|
|
1539
|
-
|
|
1540
1461
|
var Order = /** @class */ (function (_super) {
|
|
1541
1462
|
__extends(Order, _super);
|
|
1542
1463
|
function Order() {
|
|
@@ -1580,6 +1501,25 @@
|
|
|
1580
1501
|
__metadata("design:type", Coupon)
|
|
1581
1502
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
1582
1503
|
|
|
1504
|
+
var Buy2Win = /** @class */ (function (_super) {
|
|
1505
|
+
__extends(Buy2Win, _super);
|
|
1506
|
+
function Buy2Win() {
|
|
1507
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1508
|
+
}
|
|
1509
|
+
Object.defineProperty(Buy2Win, "identifiersFields", {
|
|
1510
|
+
get: function () {
|
|
1511
|
+
return ['id'];
|
|
1512
|
+
},
|
|
1513
|
+
enumerable: false,
|
|
1514
|
+
configurable: true
|
|
1515
|
+
});
|
|
1516
|
+
return Buy2Win;
|
|
1517
|
+
}(BaseModel));
|
|
1518
|
+
__decorate([
|
|
1519
|
+
classTransformer.Type(function () { return Category; }),
|
|
1520
|
+
__metadata("design:type", Array)
|
|
1521
|
+
], Buy2Win.prototype, "categories", void 0);
|
|
1522
|
+
|
|
1583
1523
|
exports.FilterType = void 0;
|
|
1584
1524
|
(function (FilterType) {
|
|
1585
1525
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -2124,37 +2064,35 @@
|
|
|
2124
2064
|
};
|
|
2125
2065
|
return _this;
|
|
2126
2066
|
}
|
|
2127
|
-
FindFirestore.prototype.find = function (
|
|
2128
|
-
var
|
|
2129
|
-
var _a;
|
|
2067
|
+
FindFirestore.prototype.find = function (_a) {
|
|
2068
|
+
var _b = _a === void 0 ? {} : _a, filters = _b.filters, limits = _b.limits, orderBy = _b.orderBy;
|
|
2130
2069
|
return __awaiter(this, void 0, void 0, function () {
|
|
2131
|
-
var orderByKeys,
|
|
2132
|
-
return __generator(this, function (
|
|
2133
|
-
switch (
|
|
2070
|
+
var orderByKeys, query, filtersKeysWithUnordered, docs, data;
|
|
2071
|
+
return __generator(this, function (_a) {
|
|
2072
|
+
switch (_a.label) {
|
|
2134
2073
|
case 0:
|
|
2135
2074
|
orderByKeys = Object.keys(orderBy || {});
|
|
2136
|
-
enableCount = (_a = options === null || options === void 0 ? void 0 : options.enableCount) !== null && _a !== void 0 ? _a : true;
|
|
2137
2075
|
query = this.collection(this.buildCollectionPathForFind(filters || {}));
|
|
2138
2076
|
query = this.makeFirestoreWhere(query, filters || {});
|
|
2139
2077
|
if (orderByKeys.length) {
|
|
2140
2078
|
filtersKeysWithUnordered = Object.keys(filters || {}).filter(function (filterKey) { return !orderByKeys.includes(filterKey); });
|
|
2141
2079
|
if (filtersKeysWithUnordered.length)
|
|
2142
2080
|
filtersKeysWithUnordered.forEach(function (filterKey) {
|
|
2143
|
-
var
|
|
2144
|
-
return (orderBy = Object.assign(Object.assign({}, (![exports.Where.EQUALS].includes(filters[filterKey].operator) ? (
|
|
2081
|
+
var _a;
|
|
2082
|
+
return (orderBy = Object.assign(Object.assign({}, (![exports.Where.EQUALS].includes(filters[filterKey].operator) ? (_a = {}, _a[filterKey] = 'asc', _a) : {})), orderBy));
|
|
2145
2083
|
});
|
|
2146
2084
|
Object.keys(orderBy).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderBy[fieldName])); });
|
|
2147
2085
|
}
|
|
2148
2086
|
return [4 /*yield*/, this.defineLimits(query, filters, limits)];
|
|
2149
2087
|
case 1:
|
|
2150
|
-
query =
|
|
2088
|
+
query = _a.sent();
|
|
2151
2089
|
return [4 /*yield*/, query.get()];
|
|
2152
2090
|
case 2:
|
|
2153
|
-
docs =
|
|
2091
|
+
docs = _a.sent();
|
|
2154
2092
|
data = docs.docs.map(function (doc) { return doc.data(); });
|
|
2155
2093
|
return [2 /*return*/, {
|
|
2156
2094
|
data: data,
|
|
2157
|
-
count:
|
|
2095
|
+
count: this.calculateCount(data, limits),
|
|
2158
2096
|
}];
|
|
2159
2097
|
}
|
|
2160
2098
|
});
|
|
@@ -2169,23 +2107,23 @@
|
|
|
2169
2107
|
};
|
|
2170
2108
|
FindFirestore.prototype.defineLimits = function (query, filters, limits) {
|
|
2171
2109
|
return __awaiter(this, void 0, void 0, function () {
|
|
2172
|
-
var
|
|
2173
|
-
return __generator(this, function (
|
|
2174
|
-
switch (
|
|
2110
|
+
var _a, _b;
|
|
2111
|
+
return __generator(this, function (_c) {
|
|
2112
|
+
switch (_c.label) {
|
|
2175
2113
|
case 0:
|
|
2176
2114
|
if (!(limits === null || limits === void 0 ? void 0 : limits.offset)) return [3 /*break*/, 3];
|
|
2177
2115
|
if (!this.model.isModel(limits.offset)) return [3 /*break*/, 2];
|
|
2178
|
-
|
|
2116
|
+
_b = (_a = query).startAfter;
|
|
2179
2117
|
return [4 /*yield*/, this.collection(this.buildCollectionPathForFind(filters))
|
|
2180
2118
|
.doc(limits.offset[limits.offset.identifiersFields.shift()])
|
|
2181
2119
|
.get()];
|
|
2182
2120
|
case 1:
|
|
2183
|
-
query =
|
|
2121
|
+
query = _b.apply(_a, [_c.sent()]);
|
|
2184
2122
|
return [3 /*break*/, 3];
|
|
2185
2123
|
case 2:
|
|
2186
2124
|
if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
|
|
2187
2125
|
query = query.startAt(limits.offset);
|
|
2188
|
-
|
|
2126
|
+
_c.label = 3;
|
|
2189
2127
|
case 3:
|
|
2190
2128
|
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
2191
2129
|
query = query.limit(limits.limit);
|
|
@@ -2779,42 +2717,6 @@
|
|
|
2779
2717
|
return SubscriptionProductFirestoreRepository;
|
|
2780
2718
|
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2781
2719
|
|
|
2782
|
-
var Buy2WinFirestoreRepository = /** @class */ (function (_super) {
|
|
2783
|
-
__extends(Buy2WinFirestoreRepository, _super);
|
|
2784
|
-
function Buy2WinFirestoreRepository(firestore) {
|
|
2785
|
-
var _this = _super.call(this) || this;
|
|
2786
|
-
_this.firestore = firestore;
|
|
2787
|
-
_this.collectionName = 'buy2win';
|
|
2788
|
-
_this.model = Buy2Win;
|
|
2789
|
-
return _this;
|
|
2790
|
-
}
|
|
2791
|
-
return Buy2WinFirestoreRepository;
|
|
2792
|
-
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2793
|
-
|
|
2794
|
-
var CampaignDashboardFirestoreRepository = /** @class */ (function (_super) {
|
|
2795
|
-
__extends(CampaignDashboardFirestoreRepository, _super);
|
|
2796
|
-
function CampaignDashboardFirestoreRepository(firestore) {
|
|
2797
|
-
var _this = _super.call(this) || this;
|
|
2798
|
-
_this.firestore = firestore;
|
|
2799
|
-
_this.collectionName = 'dashboardCampaignsAuto';
|
|
2800
|
-
_this.model = CampaignDashboard;
|
|
2801
|
-
return _this;
|
|
2802
|
-
}
|
|
2803
|
-
return CampaignDashboardFirestoreRepository;
|
|
2804
|
-
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2805
|
-
|
|
2806
|
-
var CampaignHashtagFirestoreRepository = /** @class */ (function (_super) {
|
|
2807
|
-
__extends(CampaignHashtagFirestoreRepository, _super);
|
|
2808
|
-
function CampaignHashtagFirestoreRepository(firestore) {
|
|
2809
|
-
var _this = _super.call(this) || this;
|
|
2810
|
-
_this.firestore = firestore;
|
|
2811
|
-
_this.collectionName = 'hashtagCampaignsAuto';
|
|
2812
|
-
_this.model = CampaignHashtag;
|
|
2813
|
-
return _this;
|
|
2814
|
-
}
|
|
2815
|
-
return CampaignHashtagFirestoreRepository;
|
|
2816
|
-
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2817
|
-
|
|
2818
2720
|
var CheckoutFirestoreRepository = /** @class */ (function (_super) {
|
|
2819
2721
|
__extends(CheckoutFirestoreRepository, _super);
|
|
2820
2722
|
function CheckoutFirestoreRepository(firestore) {
|
|
@@ -2827,18 +2729,6 @@
|
|
|
2827
2729
|
return CheckoutFirestoreRepository;
|
|
2828
2730
|
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2829
2731
|
|
|
2830
|
-
var CheckoutSubscriptionFirestoreRepository = /** @class */ (function (_super) {
|
|
2831
|
-
__extends(CheckoutSubscriptionFirestoreRepository, _super);
|
|
2832
|
-
function CheckoutSubscriptionFirestoreRepository(firestore) {
|
|
2833
|
-
var _this = _super.call(this) || this;
|
|
2834
|
-
_this.firestore = firestore;
|
|
2835
|
-
_this.collectionName = 'checkoutsSubscription';
|
|
2836
|
-
_this.model = CheckoutSubscription;
|
|
2837
|
-
return _this;
|
|
2838
|
-
}
|
|
2839
|
-
return CheckoutSubscriptionFirestoreRepository;
|
|
2840
|
-
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2841
|
-
|
|
2842
2732
|
var CouponFirestoreRepository = /** @class */ (function (_super) {
|
|
2843
2733
|
__extends(CouponFirestoreRepository, _super);
|
|
2844
2734
|
function CouponFirestoreRepository(firestore) {
|
|
@@ -2908,17 +2798,6 @@
|
|
|
2908
2798
|
return OrderFirestoreRepository;
|
|
2909
2799
|
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2910
2800
|
|
|
2911
|
-
var LegacyOrderFirestoreRepository = /** @class */ (function (_super) {
|
|
2912
|
-
__extends(LegacyOrderFirestoreRepository, _super);
|
|
2913
|
-
function LegacyOrderFirestoreRepository(firestore) {
|
|
2914
|
-
var _this = _super.call(this, firestore) || this;
|
|
2915
|
-
_this.firestore = firestore;
|
|
2916
|
-
_this.collectionName = 'legacyOrders';
|
|
2917
|
-
return _this;
|
|
2918
|
-
}
|
|
2919
|
-
return LegacyOrderFirestoreRepository;
|
|
2920
|
-
}(OrderFirestoreRepository));
|
|
2921
|
-
|
|
2922
2801
|
var PaymentFirestoreRepository = /** @class */ (function (_super) {
|
|
2923
2802
|
__extends(PaymentFirestoreRepository, _super);
|
|
2924
2803
|
function PaymentFirestoreRepository(firestore) {
|
|
@@ -2931,6 +2810,18 @@
|
|
|
2931
2810
|
return PaymentFirestoreRepository;
|
|
2932
2811
|
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2933
2812
|
|
|
2813
|
+
var CheckoutSubscriptionFirestoreRepository = /** @class */ (function (_super) {
|
|
2814
|
+
__extends(CheckoutSubscriptionFirestoreRepository, _super);
|
|
2815
|
+
function CheckoutSubscriptionFirestoreRepository(firestore) {
|
|
2816
|
+
var _this = _super.call(this) || this;
|
|
2817
|
+
_this.firestore = firestore;
|
|
2818
|
+
_this.collectionName = 'checkoutsSubscription';
|
|
2819
|
+
_this.model = CheckoutSubscription;
|
|
2820
|
+
return _this;
|
|
2821
|
+
}
|
|
2822
|
+
return CheckoutSubscriptionFirestoreRepository;
|
|
2823
|
+
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2824
|
+
|
|
2934
2825
|
var SubscriptionPlanFirestoreRepository = /** @class */ (function (_super) {
|
|
2935
2826
|
__extends(SubscriptionPlanFirestoreRepository, _super);
|
|
2936
2827
|
function SubscriptionPlanFirestoreRepository(firestore) {
|
|
@@ -2943,6 +2834,29 @@
|
|
|
2943
2834
|
return SubscriptionPlanFirestoreRepository;
|
|
2944
2835
|
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2945
2836
|
|
|
2837
|
+
var Buy2WinFirestoreRepository = /** @class */ (function (_super) {
|
|
2838
|
+
__extends(Buy2WinFirestoreRepository, _super);
|
|
2839
|
+
function Buy2WinFirestoreRepository(firestore) {
|
|
2840
|
+
var _this = _super.call(this) || this;
|
|
2841
|
+
_this.firestore = firestore;
|
|
2842
|
+
_this.collectionName = 'buy2win';
|
|
2843
|
+
_this.model = Buy2Win;
|
|
2844
|
+
return _this;
|
|
2845
|
+
}
|
|
2846
|
+
return Buy2WinFirestoreRepository;
|
|
2847
|
+
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2848
|
+
|
|
2849
|
+
var LegacyOrderFirestoreRepository = /** @class */ (function (_super) {
|
|
2850
|
+
__extends(LegacyOrderFirestoreRepository, _super);
|
|
2851
|
+
function LegacyOrderFirestoreRepository(firestore) {
|
|
2852
|
+
var _this = _super.call(this, firestore) || this;
|
|
2853
|
+
_this.firestore = firestore;
|
|
2854
|
+
_this.collectionName = 'legacyOrders';
|
|
2855
|
+
return _this;
|
|
2856
|
+
}
|
|
2857
|
+
return LegacyOrderFirestoreRepository;
|
|
2858
|
+
}(OrderFirestoreRepository));
|
|
2859
|
+
|
|
2946
2860
|
var HomeFirestoreRepository = /** @class */ (function (_super) {
|
|
2947
2861
|
__extends(HomeFirestoreRepository, _super);
|
|
2948
2862
|
function HomeFirestoreRepository(firestore) {
|
|
@@ -3529,19 +3443,21 @@
|
|
|
3529
3443
|
};
|
|
3530
3444
|
HasuraGraphQLMixin.prototype.fetch = function (params) {
|
|
3531
3445
|
return __awaiter(this, void 0, void 0, function () {
|
|
3532
|
-
var headers, result;
|
|
3446
|
+
var headers, response, result;
|
|
3533
3447
|
return __generator(this, function (_a) {
|
|
3534
3448
|
switch (_a.label) {
|
|
3535
3449
|
case 0:
|
|
3536
3450
|
headers = this.headers;
|
|
3537
|
-
return [4 /*yield*/,
|
|
3538
|
-
url: "" + this.endpoint,
|
|
3451
|
+
return [4 /*yield*/, fetch__default["default"]("" + this.endpoint, {
|
|
3539
3452
|
method: 'POST',
|
|
3540
|
-
|
|
3453
|
+
body: JSON.stringify(params),
|
|
3541
3454
|
headers: headers,
|
|
3542
3455
|
})];
|
|
3543
3456
|
case 1:
|
|
3544
|
-
|
|
3457
|
+
response = _a.sent();
|
|
3458
|
+
return [4 /*yield*/, response.json()];
|
|
3459
|
+
case 2:
|
|
3460
|
+
result = _a.sent();
|
|
3545
3461
|
if (!lodash.isNil(result.errors))
|
|
3546
3462
|
throw new Error(JSON.stringify(result.errors));
|
|
3547
3463
|
return [2 /*return*/, result.data];
|
|
@@ -3713,16 +3629,14 @@
|
|
|
3713
3629
|
function FindHasuraGraphQLMixin() {
|
|
3714
3630
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
3715
3631
|
}
|
|
3716
|
-
FindHasuraGraphQLMixin.prototype.find = function (
|
|
3717
|
-
var _a;
|
|
3632
|
+
FindHasuraGraphQLMixin.prototype.find = function (options) {
|
|
3718
3633
|
return __awaiter(this, void 0, void 0, function () {
|
|
3719
|
-
var _b, filters, limits, orderBy,
|
|
3634
|
+
var _b, filters, limits, orderBy, variablesCount, variables, result, data, count;
|
|
3720
3635
|
var _this = this;
|
|
3721
3636
|
return __generator(this, function (_c) {
|
|
3722
3637
|
switch (_c.label) {
|
|
3723
3638
|
case 0:
|
|
3724
|
-
_b =
|
|
3725
|
-
enableCount = (_a = options === null || options === void 0 ? void 0 : options.enableCount) !== null && _a !== void 0 ? _a : true;
|
|
3639
|
+
_b = options || {}, filters = _b.filters, limits = _b.limits, orderBy = _b.orderBy;
|
|
3726
3640
|
variablesCount = Object.assign(Object.assign({}, (lodash.isNil(orderBy) ? {} : { order_by: { type: this.tableName + "_order_by!", list: true, value: orderBy } })), (lodash.isNil(filters)
|
|
3727
3641
|
? {}
|
|
3728
3642
|
: {
|
|
@@ -3733,11 +3647,11 @@
|
|
|
3733
3647
|
},
|
|
3734
3648
|
}));
|
|
3735
3649
|
variables = Object.assign(Object.assign({}, (lodash.isNil(limits) ? {} : limits)), variablesCount);
|
|
3736
|
-
return [4 /*yield*/, this.query(
|
|
3650
|
+
return [4 /*yield*/, this.query([
|
|
3737
3651
|
{
|
|
3738
3652
|
operation: this.tableName,
|
|
3739
|
-
fields:
|
|
3740
|
-
?
|
|
3653
|
+
fields: options.fields
|
|
3654
|
+
? options.fields
|
|
3741
3655
|
.map(function (fieldName) {
|
|
3742
3656
|
var _a;
|
|
3743
3657
|
return (_a = _this.fields.find(function (fieldOption) { return fieldOption === fieldName; })) !== null && _a !== void 0 ? _a : _this.fields.find(function (fieldOption) { return Object.keys(fieldOption).shift() === fieldName; });
|
|
@@ -3745,20 +3659,18 @@
|
|
|
3745
3659
|
.filter(Boolean)
|
|
3746
3660
|
: this.fields,
|
|
3747
3661
|
variables: variables,
|
|
3748
|
-
}
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
{
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
},
|
|
3756
|
-
]
|
|
3757
|
-
: []))))];
|
|
3662
|
+
},
|
|
3663
|
+
{
|
|
3664
|
+
operation: this.tableName + "_aggregate",
|
|
3665
|
+
fields: [{ aggregate: ['count'] }],
|
|
3666
|
+
variables: variablesCount,
|
|
3667
|
+
},
|
|
3668
|
+
])];
|
|
3758
3669
|
case 1:
|
|
3759
3670
|
result = _c.sent();
|
|
3760
3671
|
data = result[this.tableName].map(function (row) { return _this.convertDataFromHasura(row); });
|
|
3761
|
-
|
|
3672
|
+
count = result[this.tableName + "_aggregate"].aggregate.count;
|
|
3673
|
+
return [2 /*return*/, { count: count, data: data }];
|
|
3762
3674
|
}
|
|
3763
3675
|
});
|
|
3764
3676
|
});
|
|
@@ -3785,6 +3697,22 @@
|
|
|
3785
3697
|
return CategoryHasuraGraphQL;
|
|
3786
3698
|
}(Category));
|
|
3787
3699
|
|
|
3700
|
+
var FilterHasuraGraphQL = /** @class */ (function (_super) {
|
|
3701
|
+
__extends(FilterHasuraGraphQL, _super);
|
|
3702
|
+
function FilterHasuraGraphQL() {
|
|
3703
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3704
|
+
}
|
|
3705
|
+
return FilterHasuraGraphQL;
|
|
3706
|
+
}(Filter));
|
|
3707
|
+
|
|
3708
|
+
var FilterOptionHasuraGraphQL = /** @class */ (function (_super) {
|
|
3709
|
+
__extends(FilterOptionHasuraGraphQL, _super);
|
|
3710
|
+
function FilterOptionHasuraGraphQL() {
|
|
3711
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3712
|
+
}
|
|
3713
|
+
return FilterOptionHasuraGraphQL;
|
|
3714
|
+
}(FilterOption));
|
|
3715
|
+
|
|
3788
3716
|
var ProductHasuraGraphQL = /** @class */ (function (_super) {
|
|
3789
3717
|
__extends(ProductHasuraGraphQL, _super);
|
|
3790
3718
|
function ProductHasuraGraphQL() {
|
|
@@ -3912,7 +3840,7 @@
|
|
|
3912
3840
|
switch (_d.label) {
|
|
3913
3841
|
case 0:
|
|
3914
3842
|
if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
|
|
3915
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id }
|
|
3843
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
|
|
3916
3844
|
case 1:
|
|
3917
3845
|
_c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
|
|
3918
3846
|
return [3 /*break*/, 3];
|
|
@@ -3966,19 +3894,19 @@
|
|
|
3966
3894
|
};
|
|
3967
3895
|
CategoryHasuraGraphQLRepository.prototype.getCategoryBySlug = function (slug, shop) {
|
|
3968
3896
|
return __awaiter(this, void 0, void 0, function () {
|
|
3969
|
-
var data;
|
|
3970
|
-
return __generator(this, function (
|
|
3971
|
-
switch (
|
|
3897
|
+
var _c, data, count;
|
|
3898
|
+
return __generator(this, function (_d) {
|
|
3899
|
+
switch (_d.label) {
|
|
3972
3900
|
case 0:
|
|
3973
3901
|
if (!slug)
|
|
3974
3902
|
return [2 /*return*/];
|
|
3975
|
-
return [4 /*yield*/, this.find({ filters: { slug: slug, shop: shop, published: true }
|
|
3903
|
+
return [4 /*yield*/, this.find({ filters: { slug: slug, shop: shop, published: true } })];
|
|
3976
3904
|
case 1:
|
|
3977
|
-
|
|
3978
|
-
if (
|
|
3979
|
-
throw new NotFoundError("Category with slug " + slug + " not found");
|
|
3980
|
-
if (data.length > 1)
|
|
3905
|
+
_c = _d.sent(), data = _c.data, count = _c.count;
|
|
3906
|
+
if (count > 1)
|
|
3981
3907
|
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
3908
|
+
if (!count)
|
|
3909
|
+
throw new NotFoundError("Category with slug " + slug + " not found");
|
|
3982
3910
|
return [2 /*return*/, data.shift()];
|
|
3983
3911
|
}
|
|
3984
3912
|
});
|
|
@@ -4058,7 +3986,7 @@
|
|
|
4058
3986
|
if (!((_a = category === null || category === void 0 ? void 0 : category.products) === null || _a === void 0 ? void 0 : _a.length))
|
|
4059
3987
|
return [2 /*return*/, []];
|
|
4060
3988
|
products = [];
|
|
4061
|
-
return [4 /*yield*/, this.productRepository.find(Object.assign(
|
|
3989
|
+
return [4 /*yield*/, this.productRepository.find(Object.assign({ filters: Object.assign({ id: { operator: exports.Where.IN, value: category.products }, published: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: exports.Where.GT, value: 0 } } } : {})), fields: [
|
|
4062
3990
|
'id',
|
|
4063
3991
|
'name',
|
|
4064
3992
|
'slug',
|
|
@@ -4082,7 +4010,7 @@
|
|
|
4082
4010
|
'tags',
|
|
4083
4011
|
'type',
|
|
4084
4012
|
'shoppingCount',
|
|
4085
|
-
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {}))
|
|
4013
|
+
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})))];
|
|
4086
4014
|
case 1:
|
|
4087
4015
|
productsData = (_c.sent()).data;
|
|
4088
4016
|
products.push.apply(products, __spreadArray([], __read(productsData)));
|
|
@@ -4100,7 +4028,7 @@
|
|
|
4100
4028
|
case 0:
|
|
4101
4029
|
if (!Number.isNaN(+id))
|
|
4102
4030
|
return [2 /*return*/, id];
|
|
4103
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: id }
|
|
4031
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
|
|
4104
4032
|
case 1:
|
|
4105
4033
|
data = (_c.sent()).data;
|
|
4106
4034
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
@@ -4187,6 +4115,217 @@
|
|
|
4187
4115
|
return CategoryHasuraGraphQLRepository;
|
|
4188
4116
|
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
4189
4117
|
|
|
4118
|
+
var FilterHasuraGraphQLRepository = /** @class */ (function (_super_1) {
|
|
4119
|
+
__extends(FilterHasuraGraphQLRepository, _super_1);
|
|
4120
|
+
function FilterHasuraGraphQLRepository(endpoint, authOptions, filterOptionRepository) {
|
|
4121
|
+
var _this = _super_1.call(this, {
|
|
4122
|
+
tableName: 'filter',
|
|
4123
|
+
model: FilterHasuraGraphQL,
|
|
4124
|
+
endpoint: endpoint,
|
|
4125
|
+
authOptions: authOptions,
|
|
4126
|
+
fields: [
|
|
4127
|
+
'id',
|
|
4128
|
+
'description',
|
|
4129
|
+
'enabled',
|
|
4130
|
+
'createdAt',
|
|
4131
|
+
'updatedAt',
|
|
4132
|
+
{
|
|
4133
|
+
options: {
|
|
4134
|
+
columnName: 'options',
|
|
4135
|
+
foreignKeyColumn: { filterId: 'id' },
|
|
4136
|
+
fields: [
|
|
4137
|
+
'id',
|
|
4138
|
+
{ filterId: { columnName: 'filter_id' } },
|
|
4139
|
+
'description',
|
|
4140
|
+
'createdAt',
|
|
4141
|
+
'updatedAt'
|
|
4142
|
+
],
|
|
4143
|
+
},
|
|
4144
|
+
}
|
|
4145
|
+
],
|
|
4146
|
+
}) || this;
|
|
4147
|
+
_this.filterOptionRepository = filterOptionRepository;
|
|
4148
|
+
return _this;
|
|
4149
|
+
}
|
|
4150
|
+
FilterHasuraGraphQLRepository.prototype.get = function (identifiers) {
|
|
4151
|
+
var _super = Object.create(null, {
|
|
4152
|
+
get: { get: function () { return _super_1.prototype.get; } }
|
|
4153
|
+
});
|
|
4154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4155
|
+
var filter;
|
|
4156
|
+
return __generator(this, function (_a) {
|
|
4157
|
+
switch (_a.label) {
|
|
4158
|
+
case 0: return [4 /*yield*/, _super.get.call(this, identifiers)];
|
|
4159
|
+
case 1:
|
|
4160
|
+
filter = _a.sent();
|
|
4161
|
+
if (!filter)
|
|
4162
|
+
throw new NotFoundError('Filter not found');
|
|
4163
|
+
return [2 /*return*/, filter];
|
|
4164
|
+
}
|
|
4165
|
+
});
|
|
4166
|
+
});
|
|
4167
|
+
};
|
|
4168
|
+
FilterHasuraGraphQLRepository.prototype.find = function (options) {
|
|
4169
|
+
var _super = Object.create(null, {
|
|
4170
|
+
find: { get: function () { return _super_1.prototype.find; } }
|
|
4171
|
+
});
|
|
4172
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4173
|
+
var filter;
|
|
4174
|
+
return __generator(this, function (_a) {
|
|
4175
|
+
switch (_a.label) {
|
|
4176
|
+
case 0: return [4 /*yield*/, _super.find.call(this, options)];
|
|
4177
|
+
case 1:
|
|
4178
|
+
filter = _a.sent();
|
|
4179
|
+
return [2 /*return*/, filter];
|
|
4180
|
+
}
|
|
4181
|
+
});
|
|
4182
|
+
});
|
|
4183
|
+
};
|
|
4184
|
+
FilterHasuraGraphQLRepository.prototype.create = function (params) {
|
|
4185
|
+
var _super = Object.create(null, {
|
|
4186
|
+
create: { get: function () { return _super_1.prototype.create; } }
|
|
4187
|
+
});
|
|
4188
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4189
|
+
var filter;
|
|
4190
|
+
return __generator(this, function (_a) {
|
|
4191
|
+
switch (_a.label) {
|
|
4192
|
+
case 0: return [4 /*yield*/, _super.create.call(this, params)];
|
|
4193
|
+
case 1:
|
|
4194
|
+
filter = _a.sent();
|
|
4195
|
+
return [2 /*return*/, filter];
|
|
4196
|
+
}
|
|
4197
|
+
});
|
|
4198
|
+
});
|
|
4199
|
+
};
|
|
4200
|
+
FilterHasuraGraphQLRepository.prototype.update = function (params) {
|
|
4201
|
+
var _super = Object.create(null, {
|
|
4202
|
+
update: { get: function () { return _super_1.prototype.update; } }
|
|
4203
|
+
});
|
|
4204
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4205
|
+
var options, data, filter, _a;
|
|
4206
|
+
return __generator(this, function (_b) {
|
|
4207
|
+
switch (_b.label) {
|
|
4208
|
+
case 0:
|
|
4209
|
+
options = params.options, data = __rest(params, ["options"]);
|
|
4210
|
+
return [4 /*yield*/, _super.update.call(this, data)];
|
|
4211
|
+
case 1:
|
|
4212
|
+
filter = _b.sent();
|
|
4213
|
+
_a = filter;
|
|
4214
|
+
return [4 /*yield*/, this.updateOptions(+data.id, { options: options })];
|
|
4215
|
+
case 2:
|
|
4216
|
+
_a.options = _b.sent();
|
|
4217
|
+
return [2 /*return*/, filter];
|
|
4218
|
+
}
|
|
4219
|
+
});
|
|
4220
|
+
});
|
|
4221
|
+
};
|
|
4222
|
+
;
|
|
4223
|
+
FilterHasuraGraphQLRepository.prototype.updateOptions = function (filterId, _a) {
|
|
4224
|
+
var options = _a.options;
|
|
4225
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4226
|
+
var i, filterOptions, i, hasFilter, newOption;
|
|
4227
|
+
return __generator(this, function (_a) {
|
|
4228
|
+
switch (_a.label) {
|
|
4229
|
+
case 0:
|
|
4230
|
+
if (!options)
|
|
4231
|
+
return [2 /*return*/, []];
|
|
4232
|
+
if (!('action' in options && options.action === 'remove')) return [3 /*break*/, 5];
|
|
4233
|
+
i = 0;
|
|
4234
|
+
_a.label = 1;
|
|
4235
|
+
case 1:
|
|
4236
|
+
if (!(i < options.value.length)) return [3 /*break*/, 4];
|
|
4237
|
+
return [4 /*yield*/, this.filterOptionRepository.delete({ id: options.value[i].id })];
|
|
4238
|
+
case 2:
|
|
4239
|
+
_a.sent();
|
|
4240
|
+
_a.label = 3;
|
|
4241
|
+
case 3:
|
|
4242
|
+
i++;
|
|
4243
|
+
return [3 /*break*/, 1];
|
|
4244
|
+
case 4: return [2 /*return*/, []];
|
|
4245
|
+
case 5:
|
|
4246
|
+
if (!('action' in options && options.action === 'update')) return [3 /*break*/, 12];
|
|
4247
|
+
filterOptions = [];
|
|
4248
|
+
i = 0;
|
|
4249
|
+
_a.label = 6;
|
|
4250
|
+
case 6:
|
|
4251
|
+
if (!(i < options.value.length)) return [3 /*break*/, 11];
|
|
4252
|
+
return [4 /*yield*/, this.filterOptionRepository.get({ id: options.value[i].id })];
|
|
4253
|
+
case 7:
|
|
4254
|
+
hasFilter = _a.sent();
|
|
4255
|
+
if (!!hasFilter) return [3 /*break*/, 9];
|
|
4256
|
+
return [4 /*yield*/, this.filterOptionRepository.create(options.value[i])];
|
|
4257
|
+
case 8:
|
|
4258
|
+
newOption = _a.sent();
|
|
4259
|
+
filterOptions.push(newOption);
|
|
4260
|
+
return [3 /*break*/, 10];
|
|
4261
|
+
case 9:
|
|
4262
|
+
filterOptions.push(hasFilter);
|
|
4263
|
+
_a.label = 10;
|
|
4264
|
+
case 10:
|
|
4265
|
+
i++;
|
|
4266
|
+
return [3 /*break*/, 6];
|
|
4267
|
+
case 11: return [2 /*return*/, filterOptions];
|
|
4268
|
+
case 12: return [2 /*return*/];
|
|
4269
|
+
}
|
|
4270
|
+
});
|
|
4271
|
+
});
|
|
4272
|
+
};
|
|
4273
|
+
return FilterHasuraGraphQLRepository;
|
|
4274
|
+
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
4275
|
+
|
|
4276
|
+
var FilterOptionHasuraGraphQLRepository = /** @class */ (function (_super_1) {
|
|
4277
|
+
__extends(FilterOptionHasuraGraphQLRepository, _super_1);
|
|
4278
|
+
function FilterOptionHasuraGraphQLRepository(endpoint, authOptions) {
|
|
4279
|
+
return _super_1.call(this, {
|
|
4280
|
+
tableName: 'filter-option',
|
|
4281
|
+
model: FilterOptionHasuraGraphQL,
|
|
4282
|
+
endpoint: endpoint,
|
|
4283
|
+
authOptions: authOptions,
|
|
4284
|
+
fields: [],
|
|
4285
|
+
}) || this;
|
|
4286
|
+
}
|
|
4287
|
+
FilterOptionHasuraGraphQLRepository.prototype.create = function (params) {
|
|
4288
|
+
return _super_1.prototype.create.call(this, params);
|
|
4289
|
+
};
|
|
4290
|
+
FilterOptionHasuraGraphQLRepository.prototype.find = function (options) {
|
|
4291
|
+
var _super = Object.create(null, {
|
|
4292
|
+
find: { get: function () { return _super_1.prototype.find; } }
|
|
4293
|
+
});
|
|
4294
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4295
|
+
var filterOptions;
|
|
4296
|
+
return __generator(this, function (_a) {
|
|
4297
|
+
switch (_a.label) {
|
|
4298
|
+
case 0: return [4 /*yield*/, _super.find.call(this, options)];
|
|
4299
|
+
case 1:
|
|
4300
|
+
filterOptions = _a.sent();
|
|
4301
|
+
return [2 /*return*/, filterOptions];
|
|
4302
|
+
}
|
|
4303
|
+
});
|
|
4304
|
+
});
|
|
4305
|
+
};
|
|
4306
|
+
FilterOptionHasuraGraphQLRepository.prototype.delete = function (identifiers) {
|
|
4307
|
+
return _super_1.prototype.delete.call(this, identifiers);
|
|
4308
|
+
};
|
|
4309
|
+
FilterOptionHasuraGraphQLRepository.prototype.findByFilter = function (filterId) {
|
|
4310
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4311
|
+
var options;
|
|
4312
|
+
return __generator(this, function (_a) {
|
|
4313
|
+
switch (_a.label) {
|
|
4314
|
+
case 0: return [4 /*yield*/, this.find({
|
|
4315
|
+
filters: {
|
|
4316
|
+
filterId: filterId,
|
|
4317
|
+
},
|
|
4318
|
+
})];
|
|
4319
|
+
case 1:
|
|
4320
|
+
options = _a.sent();
|
|
4321
|
+
return [2 /*return*/, options];
|
|
4322
|
+
}
|
|
4323
|
+
});
|
|
4324
|
+
});
|
|
4325
|
+
};
|
|
4326
|
+
return FilterOptionHasuraGraphQLRepository;
|
|
4327
|
+
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
4328
|
+
|
|
4190
4329
|
var ProductHasuraGraphQLRepository = /** @class */ (function (_super_1) {
|
|
4191
4330
|
__extends(ProductHasuraGraphQLRepository, _super_1);
|
|
4192
4331
|
function ProductHasuraGraphQLRepository(endpoint, authOptions) {
|
|
@@ -4420,7 +4559,7 @@
|
|
|
4420
4559
|
switch (_f.label) {
|
|
4421
4560
|
case 0:
|
|
4422
4561
|
if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
|
|
4423
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id }
|
|
4562
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
|
|
4424
4563
|
case 1:
|
|
4425
4564
|
_c = (_a = (_f.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
|
|
4426
4565
|
return [3 /*break*/, 4];
|
|
@@ -4465,21 +4604,21 @@
|
|
|
4465
4604
|
ProductHasuraGraphQLRepository.prototype.getBySlug = function (slug) {
|
|
4466
4605
|
var _a;
|
|
4467
4606
|
return __awaiter(this, void 0, void 0, function () {
|
|
4468
|
-
var result, product;
|
|
4469
|
-
return __generator(this, function (
|
|
4470
|
-
switch (
|
|
4607
|
+
var result, product, _c;
|
|
4608
|
+
return __generator(this, function (_d) {
|
|
4609
|
+
switch (_d.label) {
|
|
4471
4610
|
case 0: return [4 /*yield*/, this.find({
|
|
4472
4611
|
filters: {
|
|
4473
4612
|
slug: slug,
|
|
4474
4613
|
},
|
|
4475
|
-
fields: this.fields.map(function (field) { return typeof field === 'string' ? field : Object.keys(field).shift(); }),
|
|
4476
|
-
options: {
|
|
4477
|
-
enableCount: false,
|
|
4478
|
-
},
|
|
4479
4614
|
})];
|
|
4480
4615
|
case 1:
|
|
4481
|
-
result =
|
|
4616
|
+
result = _d.sent();
|
|
4482
4617
|
product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
4618
|
+
_c = product;
|
|
4619
|
+
return [4 /*yield*/, this.findReviewsByProduct(+product.id)];
|
|
4620
|
+
case 2:
|
|
4621
|
+
_c.reviews = _d.sent();
|
|
4483
4622
|
return [2 /*return*/, product];
|
|
4484
4623
|
}
|
|
4485
4624
|
});
|
|
@@ -4760,7 +4899,7 @@
|
|
|
4760
4899
|
case 0:
|
|
4761
4900
|
if (!Number.isNaN(+id))
|
|
4762
4901
|
return [2 /*return*/, id];
|
|
4763
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: id }
|
|
4902
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
|
|
4764
4903
|
case 1:
|
|
4765
4904
|
data = (_c.sent()).data;
|
|
4766
4905
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
@@ -4990,7 +5129,7 @@
|
|
|
4990
5129
|
case 0:
|
|
4991
5130
|
if (!Number.isNaN(+id))
|
|
4992
5131
|
return [2 /*return*/, id];
|
|
4993
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: id }
|
|
5132
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
|
|
4994
5133
|
case 1:
|
|
4995
5134
|
data = (_c.sent()).data;
|
|
4996
5135
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
@@ -5055,6 +5194,10 @@
|
|
|
5055
5194
|
enumerable: true,
|
|
5056
5195
|
get: function () { return lodash.chunk; }
|
|
5057
5196
|
});
|
|
5197
|
+
Object.defineProperty(exports, 'difference', {
|
|
5198
|
+
enumerable: true,
|
|
5199
|
+
get: function () { return lodash.difference; }
|
|
5200
|
+
});
|
|
5058
5201
|
Object.defineProperty(exports, 'isBoolean', {
|
|
5059
5202
|
enumerable: true,
|
|
5060
5203
|
get: function () { return lodash.isBoolean; }
|
|
@@ -5117,10 +5260,6 @@
|
|
|
5117
5260
|
exports.BeautyQuestionsHelper = BeautyQuestionsHelper;
|
|
5118
5261
|
exports.Buy2Win = Buy2Win;
|
|
5119
5262
|
exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
|
|
5120
|
-
exports.CampaignDashboard = CampaignDashboard;
|
|
5121
|
-
exports.CampaignDashboardFirestoreRepository = CampaignDashboardFirestoreRepository;
|
|
5122
|
-
exports.CampaignHashtag = CampaignHashtag;
|
|
5123
|
-
exports.CampaignHashtagFirestoreRepository = CampaignHashtagFirestoreRepository;
|
|
5124
5263
|
exports.Category = Category;
|
|
5125
5264
|
exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
|
|
5126
5265
|
exports.CategoryHasuraGraphQL = CategoryHasuraGraphQL;
|
|
@@ -5133,6 +5272,12 @@
|
|
|
5133
5272
|
exports.CouponFirestoreRepository = CouponFirestoreRepository;
|
|
5134
5273
|
exports.DuplicatedResultsError = DuplicatedResultsError;
|
|
5135
5274
|
exports.Edition = Edition;
|
|
5275
|
+
exports.Filter = Filter;
|
|
5276
|
+
exports.FilterHasuraGraphQL = FilterHasuraGraphQL;
|
|
5277
|
+
exports.FilterHasuraGraphQLRepository = FilterHasuraGraphQLRepository;
|
|
5278
|
+
exports.FilterOption = FilterOption;
|
|
5279
|
+
exports.FilterOptionHasuraGraphQL = FilterOptionHasuraGraphQL;
|
|
5280
|
+
exports.FilterOptionHasuraGraphQLRepository = FilterOptionHasuraGraphQLRepository;
|
|
5136
5281
|
exports.Home = Home;
|
|
5137
5282
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
5138
5283
|
exports.InvalidArgumentError = InvalidArgumentError;
|