@infrab4a/connect 4.25.0-beta.12 → 4.25.0-beta.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/index.cjs.js +192 -273
- package/index.esm.js +173 -273
- package/package.json +1 -1
- package/src/domain/catalog/repositories/category.repository.d.ts +4 -15
- package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/subscription-materialization-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/subscription-summary-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/mixins/helpers/md5-generator.helper.d.ts +7 -0
- package/src/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +0 -16
- package/src/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +6 -19
- package/src/infra/hasura-graphql/repositories/catalog/category-product-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/product-errors-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/product-review-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/mixins/helpers/cache-key-generator.helper.d.ts +0 -9
- package/src/infra/firebase/firestore/mixins/helpers/index.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -11,14 +11,33 @@ var debug = require('debug');
|
|
|
11
11
|
var tsCustomError = require('ts-custom-error');
|
|
12
12
|
var axios = require('axios');
|
|
13
13
|
var auth = require('firebase/auth');
|
|
14
|
-
var
|
|
14
|
+
var crypto = require('crypto');
|
|
15
15
|
var firestore = require('firebase/firestore');
|
|
16
16
|
var storage = require('firebase/storage');
|
|
17
17
|
var gqlQueryBuilder = require('gql-query-builder');
|
|
18
18
|
|
|
19
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
20
|
|
|
21
|
+
function _interopNamespace(e) {
|
|
22
|
+
if (e && e.__esModule) return e;
|
|
23
|
+
var n = Object.create(null);
|
|
24
|
+
if (e) {
|
|
25
|
+
Object.keys(e).forEach(function (k) {
|
|
26
|
+
if (k !== 'default') {
|
|
27
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
28
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return e[k]; }
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
n["default"] = e;
|
|
36
|
+
return Object.freeze(n);
|
|
37
|
+
}
|
|
38
|
+
|
|
21
39
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
40
|
+
var crypto__namespace = /*#__PURE__*/_interopNamespace(crypto);
|
|
22
41
|
|
|
23
42
|
exports.AntifraudProviders = void 0;
|
|
24
43
|
(function (AntifraudProviders) {
|
|
@@ -3572,28 +3591,46 @@ GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields = (fieldName, fieldValue)
|
|
|
3572
3591
|
};
|
|
3573
3592
|
|
|
3574
3593
|
class MD5GeneratorHelper {
|
|
3594
|
+
/**
|
|
3595
|
+
* Gera um hash MD5 para um objeto de qualquer estrutura
|
|
3596
|
+
* Garante que o mesmo objeto sempre gerará o mesmo hash, independentemente da ordem das chaves
|
|
3597
|
+
*/
|
|
3575
3598
|
static generateMD5(data) {
|
|
3576
|
-
|
|
3577
|
-
|
|
3599
|
+
// Null ou undefined geram um hash fixo
|
|
3600
|
+
if (data === null || data === undefined) {
|
|
3601
|
+
return crypto__namespace.createHash('md5').update('null').digest('hex');
|
|
3602
|
+
}
|
|
3578
3603
|
const normalizedData = this.normalizeData(data);
|
|
3579
3604
|
const jsonString = JSON.stringify(normalizedData);
|
|
3580
|
-
return
|
|
3605
|
+
return crypto__namespace.createHash('md5').update(jsonString).digest('hex');
|
|
3581
3606
|
}
|
|
3607
|
+
/**
|
|
3608
|
+
* Normaliza os dados para garantir que a ordem das chaves não afete o resultado
|
|
3609
|
+
*/
|
|
3582
3610
|
static normalizeData(data, depth = 0, maxDepth = 100) {
|
|
3583
|
-
|
|
3611
|
+
// Proteção contra recursão infinita
|
|
3612
|
+
if (depth > maxDepth) {
|
|
3584
3613
|
return '[MAX_DEPTH_REACHED]';
|
|
3585
|
-
|
|
3614
|
+
}
|
|
3615
|
+
// Tipos primitivos retornam diretamente
|
|
3616
|
+
if (data === null || data === undefined) {
|
|
3586
3617
|
return null;
|
|
3587
|
-
|
|
3618
|
+
}
|
|
3619
|
+
if (typeof data !== 'object') {
|
|
3588
3620
|
return data;
|
|
3589
|
-
|
|
3621
|
+
}
|
|
3622
|
+
// Arrays são normalizados e ordenados
|
|
3623
|
+
if (Array.isArray(data)) {
|
|
3590
3624
|
return data
|
|
3591
3625
|
.map((item) => this.normalizeData(item, depth + 1, maxDepth))
|
|
3592
3626
|
.sort((a, b) => {
|
|
3627
|
+
// Converte para string para comparação determinística
|
|
3593
3628
|
const strA = typeof a === 'object' && a !== null ? JSON.stringify(a) : String(a);
|
|
3594
3629
|
const strB = typeof b === 'object' && b !== null ? JSON.stringify(b) : String(b);
|
|
3595
3630
|
return strA.localeCompare(strB);
|
|
3596
3631
|
});
|
|
3632
|
+
}
|
|
3633
|
+
// Objetos: ordena as chaves
|
|
3597
3634
|
const sortedObj = {};
|
|
3598
3635
|
const keys = Object.keys(data).sort();
|
|
3599
3636
|
keys.forEach((key) => {
|
|
@@ -3604,39 +3641,24 @@ class MD5GeneratorHelper {
|
|
|
3604
3641
|
}
|
|
3605
3642
|
}
|
|
3606
3643
|
|
|
3607
|
-
class FirestoreCacheKeyGeneratorHelper {
|
|
3608
|
-
static generateGetCacheKey(model, identifiers) {
|
|
3609
|
-
const sortedEntries = Object.entries(identifiers).sort(([keyA], [keyB]) => keyA.localeCompare(keyB));
|
|
3610
|
-
const keyParts = [];
|
|
3611
|
-
for (const [key, value] of sortedEntries) {
|
|
3612
|
-
keyParts.push(`${key}:${value}`);
|
|
3613
|
-
}
|
|
3614
|
-
return `${model.name.toLowerCase()}:get:${keyParts.join(':')}`;
|
|
3615
|
-
}
|
|
3616
|
-
static generateFindCacheKey(model, findParams) {
|
|
3617
|
-
const md5 = MD5GeneratorHelper.generateMD5(findParams);
|
|
3618
|
-
return `${model.name.toLowerCase()}:find:${md5}`;
|
|
3619
|
-
}
|
|
3620
|
-
}
|
|
3621
|
-
|
|
3622
3644
|
const withGetFirestore = (MixinBase) => {
|
|
3623
3645
|
return class GetFirestore extends MixinBase {
|
|
3624
|
-
async get(identifiers
|
|
3625
|
-
var _a, _b, _c, _d, _e, _f
|
|
3646
|
+
async get(identifiers) {
|
|
3647
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3626
3648
|
const logger = this.logger.with('get');
|
|
3627
3649
|
const collectionName = this.buildCollectionPathForGet(identifiers);
|
|
3628
3650
|
const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => (Object.assign(Object.assign({}, acc), { [field]: identifiers[field] })), {}));
|
|
3629
3651
|
const req = { collection: collectionName, data: identifiers };
|
|
3630
|
-
if ((
|
|
3631
|
-
const cacheKey =
|
|
3652
|
+
if ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.cacheAdapter) {
|
|
3653
|
+
const cacheKey = CacheKeyGeneratorHelper.generateCacheKeyFromIdentifiers(this.model, identifiers);
|
|
3632
3654
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
3633
3655
|
if (cachedData) {
|
|
3634
3656
|
logger.log({ req, res: 'Dados recuperados do cache', cacheKey });
|
|
3635
|
-
return this.model.toInstance(
|
|
3657
|
+
return this.model.toInstance(cachedData);
|
|
3636
3658
|
}
|
|
3637
3659
|
}
|
|
3638
3660
|
try {
|
|
3639
|
-
const intercepted = await ((
|
|
3661
|
+
const intercepted = await ((_c = (_b = this.interceptors) === null || _b === void 0 ? void 0 : _b.request) === null || _c === void 0 ? void 0 : _c.call(_b, { instance }));
|
|
3640
3662
|
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || instance;
|
|
3641
3663
|
const docRef = await this.collection(collectionName)
|
|
3642
3664
|
.getDoc(Object.values(builded.identifier).shift().toString())
|
|
@@ -3644,14 +3666,14 @@ const withGetFirestore = (MixinBase) => {
|
|
|
3644
3666
|
const data = docRef.data();
|
|
3645
3667
|
if (lodash.isNil(data))
|
|
3646
3668
|
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers).shift()}' not found`);
|
|
3647
|
-
const res = (
|
|
3669
|
+
const res = ((_e = (_d = this.interceptors) === null || _d === void 0 ? void 0 : _d.response) === null || _e === void 0 ? void 0 : _e.call(_d, data, intercepted)) || data;
|
|
3648
3670
|
logger.log({ req, res });
|
|
3649
|
-
if ((
|
|
3650
|
-
const cacheKey =
|
|
3671
|
+
if ((_f = this.cache) === null || _f === void 0 ? void 0 : _f.cacheAdapter) {
|
|
3672
|
+
const cacheKey = CacheKeyGeneratorHelper.generateCacheKeyFromIdentifiers(this.model, identifiers);
|
|
3651
3673
|
await this.cache.cacheAdapter.set({
|
|
3652
3674
|
key: cacheKey,
|
|
3653
|
-
data:
|
|
3654
|
-
expirationInSeconds:
|
|
3675
|
+
data: res,
|
|
3676
|
+
expirationInSeconds: this.cache.ttlDefault,
|
|
3655
3677
|
});
|
|
3656
3678
|
logger.log({ req, message: 'Dados salvos no cache', cacheKey });
|
|
3657
3679
|
}
|
|
@@ -3744,26 +3766,15 @@ const withFindFirestore = (MixinBase) => {
|
|
|
3744
3766
|
]);
|
|
3745
3767
|
};
|
|
3746
3768
|
}
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
}
|
|
3750
|
-
async find(find = {}, options) {
|
|
3751
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
3769
|
+
async find(find = {}) {
|
|
3770
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3752
3771
|
const logger = this.logger.with('find');
|
|
3753
|
-
if (((_a = this.cache) === null || _a === void 0 ? void 0 : _a.cacheAdapter) && ((_b = options === null || options === void 0 ? void 0 : options.cache) === null || _b === void 0 ? void 0 : _b.enabled) !== false) {
|
|
3754
|
-
const cacheKey = this.generateCacheKey(find);
|
|
3755
|
-
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
3756
|
-
if (cachedData) {
|
|
3757
|
-
logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
3758
|
-
return JSON.parse(cachedData);
|
|
3759
|
-
}
|
|
3760
|
-
}
|
|
3761
3772
|
const collectionName = this.buildCollectionPathForFind(find.filters);
|
|
3762
3773
|
const collection = this.collection(collectionName);
|
|
3763
|
-
const enableCount = (
|
|
3774
|
+
const enableCount = (_b = (_a = find === null || find === void 0 ? void 0 : find.options) === null || _a === void 0 ? void 0 : _a.enableCount) !== null && _b !== void 0 ? _b : true;
|
|
3764
3775
|
const req = { collection: collectionName, data: find };
|
|
3765
3776
|
try {
|
|
3766
|
-
const intercepted = await ((
|
|
3777
|
+
const intercepted = await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.call(_c, { find }));
|
|
3767
3778
|
const { fields, filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
3768
3779
|
const queries = this.makeFirestoreWhere(filters || {});
|
|
3769
3780
|
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
@@ -3773,19 +3784,10 @@ const withFindFirestore = (MixinBase) => {
|
|
|
3773
3784
|
.getDocs();
|
|
3774
3785
|
const data = docs.docs.map((doc) => doc.data());
|
|
3775
3786
|
const res = {
|
|
3776
|
-
data: (await ((
|
|
3787
|
+
data: (await ((_f = (_e = this.interceptors) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.call(_e, data, intercepted))) || data,
|
|
3777
3788
|
count: enableCount ? this.calculateCount(data, limits) : Infinity,
|
|
3778
3789
|
};
|
|
3779
3790
|
logger.log({ req, queries, ordination, offsets, res });
|
|
3780
|
-
if (((_j = this.cache) === null || _j === void 0 ? void 0 : _j.cacheAdapter) && ((_k = options === null || options === void 0 ? void 0 : options.cache) === null || _k === void 0 ? void 0 : _k.enabled) !== false) {
|
|
3781
|
-
const cacheKey = this.generateCacheKey(find);
|
|
3782
|
-
await this.cache.cacheAdapter.set({
|
|
3783
|
-
key: cacheKey,
|
|
3784
|
-
data: JSON.stringify(res),
|
|
3785
|
-
expirationInSeconds: ((_l = options === null || options === void 0 ? void 0 : options.cache) === null || _l === void 0 ? void 0 : _l.ttl) || this.cache.ttlDefault,
|
|
3786
|
-
});
|
|
3787
|
-
logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
3788
|
-
}
|
|
3789
3791
|
return res;
|
|
3790
3792
|
}
|
|
3791
3793
|
catch (error) {
|
|
@@ -3889,41 +3891,24 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
3889
3891
|
return options === null || options === void 0 ? void 0 : options.value;
|
|
3890
3892
|
};
|
|
3891
3893
|
return class UpdateFirestore extends MixinBase {
|
|
3892
|
-
getIdentifiersFromData(data) {
|
|
3893
|
-
const identifiers = {};
|
|
3894
|
-
const model = new this.model();
|
|
3895
|
-
const keyField = model.identifiersFields.shift();
|
|
3896
|
-
const identifierValue = getValueFromParams(data, keyField);
|
|
3897
|
-
identifiers[keyField] = identifierValue;
|
|
3898
|
-
return identifiers;
|
|
3899
|
-
}
|
|
3900
|
-
generateCacheKey(identifiers) {
|
|
3901
|
-
return FirestoreCacheKeyGeneratorHelper.generateGetCacheKey(this.model, identifiers);
|
|
3902
|
-
}
|
|
3903
3894
|
async update(data) {
|
|
3904
|
-
var _a, _b, _c, _d
|
|
3895
|
+
var _a, _b, _c, _d;
|
|
3905
3896
|
const logger = this.logger.with('update');
|
|
3906
3897
|
const collectionName = this.buildCollectionPathForUpdate(data);
|
|
3907
3898
|
const model = new this.model();
|
|
3908
3899
|
const keyField = model.identifiersFields.shift();
|
|
3909
3900
|
const req = { collection: collectionName, data };
|
|
3910
|
-
if ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.cacheAdapter) {
|
|
3911
|
-
const identifiers = this.getIdentifiersFromData(data);
|
|
3912
|
-
const cacheKey = this.generateCacheKey(identifiers);
|
|
3913
|
-
await this.cache.cacheAdapter.remove(cacheKey);
|
|
3914
|
-
logger.log(`Cache removido: ${cacheKey}`);
|
|
3915
|
-
}
|
|
3916
3901
|
try {
|
|
3917
3902
|
const identifiers = getValueFromParams(data, keyField);
|
|
3918
3903
|
const docRef = this.collection(collectionName).getDoc(identifiers.toString());
|
|
3919
3904
|
if (!(await docRef.get()).data())
|
|
3920
3905
|
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
|
|
3921
3906
|
const plainFromData = this.model.toInstance(this.paramsToPlain(data));
|
|
3922
|
-
const intercepted = await ((
|
|
3907
|
+
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance: plainFromData }));
|
|
3923
3908
|
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
|
|
3924
3909
|
await docRef.save(builded.toPlain());
|
|
3925
3910
|
const docData = await docRef.get();
|
|
3926
|
-
const res = ((
|
|
3911
|
+
const res = ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, docData.data(), intercepted)) || docData.data();
|
|
3927
3912
|
logger.log({ req, res, identifiers });
|
|
3928
3913
|
return res;
|
|
3929
3914
|
}
|
|
@@ -3949,25 +3934,17 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
3949
3934
|
|
|
3950
3935
|
const withDeleteFirestore = (MixinBase) => {
|
|
3951
3936
|
return class DeleteFirestore extends MixinBase {
|
|
3952
|
-
generateCacheKey(identifiers) {
|
|
3953
|
-
return FirestoreCacheKeyGeneratorHelper.generateGetCacheKey(this.model, identifiers);
|
|
3954
|
-
}
|
|
3955
3937
|
async delete(identifiers) {
|
|
3956
|
-
var _a, _b, _c, _d
|
|
3938
|
+
var _a, _b, _c, _d;
|
|
3957
3939
|
const logger = this.logger.with('delete');
|
|
3958
3940
|
const collectionName = this.buildCollectionPathForRemove(identifiers);
|
|
3959
3941
|
const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => (Object.assign(Object.assign({}, acc), { [field]: identifiers[field] })), {}));
|
|
3960
3942
|
const req = { collection: collectionName, data: identifiers };
|
|
3961
|
-
if ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.cacheAdapter) {
|
|
3962
|
-
const cacheKey = this.generateCacheKey(identifiers);
|
|
3963
|
-
await this.cache.cacheAdapter.remove(cacheKey);
|
|
3964
|
-
logger.log(`Cache removido: ${cacheKey}`);
|
|
3965
|
-
}
|
|
3966
3943
|
try {
|
|
3967
|
-
const intercepted = await ((
|
|
3944
|
+
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance }));
|
|
3968
3945
|
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || instance;
|
|
3969
3946
|
await this.collection(collectionName).getDoc(Object.values(builded.identifier).shift().toString()).delete();
|
|
3970
|
-
await ((
|
|
3947
|
+
await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, instance, intercepted));
|
|
3971
3948
|
logger.log({ req, res: undefined });
|
|
3972
3949
|
}
|
|
3973
3950
|
catch (error) {
|
|
@@ -4212,13 +4189,12 @@ class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
4212
4189
|
}
|
|
4213
4190
|
|
|
4214
4191
|
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4215
|
-
constructor({ firestore, interceptors
|
|
4192
|
+
constructor({ firestore, interceptors }) {
|
|
4216
4193
|
super({
|
|
4217
4194
|
firestore,
|
|
4218
4195
|
collectionName: 'dms',
|
|
4219
4196
|
model: Home,
|
|
4220
4197
|
interceptors,
|
|
4221
|
-
cache,
|
|
4222
4198
|
});
|
|
4223
4199
|
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
4224
4200
|
var _a, _b, _c;
|
|
@@ -4275,97 +4251,89 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
4275
4251
|
}
|
|
4276
4252
|
|
|
4277
4253
|
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4278
|
-
constructor({ firestore, interceptors
|
|
4254
|
+
constructor({ firestore, interceptors }) {
|
|
4279
4255
|
super({
|
|
4280
4256
|
firestore,
|
|
4281
4257
|
collectionName: 'shopMenus',
|
|
4282
4258
|
model: ShopMenu,
|
|
4283
4259
|
interceptors,
|
|
4284
|
-
cache,
|
|
4285
4260
|
});
|
|
4286
4261
|
}
|
|
4287
4262
|
}
|
|
4288
4263
|
|
|
4289
4264
|
class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4290
|
-
constructor({ firestore, interceptors,
|
|
4265
|
+
constructor({ firestore, interceptors, }) {
|
|
4291
4266
|
super({
|
|
4292
4267
|
firestore,
|
|
4293
4268
|
collectionName: 'shopSettings',
|
|
4294
4269
|
model: ShopSettings,
|
|
4295
4270
|
interceptors,
|
|
4296
|
-
cache,
|
|
4297
4271
|
});
|
|
4298
4272
|
}
|
|
4299
4273
|
}
|
|
4300
4274
|
|
|
4301
4275
|
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4302
|
-
constructor({ firestore, interceptors
|
|
4276
|
+
constructor({ firestore, interceptors }) {
|
|
4303
4277
|
super({
|
|
4304
4278
|
firestore,
|
|
4305
4279
|
collectionName: 'buy2win',
|
|
4306
4280
|
model: Buy2Win,
|
|
4307
4281
|
interceptors,
|
|
4308
|
-
cache,
|
|
4309
4282
|
});
|
|
4310
4283
|
}
|
|
4311
4284
|
}
|
|
4312
4285
|
|
|
4313
4286
|
class CampaignDashboardFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4314
|
-
constructor({ firestore, interceptors,
|
|
4287
|
+
constructor({ firestore, interceptors, }) {
|
|
4315
4288
|
super({
|
|
4316
4289
|
firestore,
|
|
4317
4290
|
collectionName: 'dashboardCampaignsAuto',
|
|
4318
4291
|
model: CampaignDashboard,
|
|
4319
4292
|
interceptors,
|
|
4320
|
-
cache,
|
|
4321
4293
|
});
|
|
4322
4294
|
}
|
|
4323
4295
|
}
|
|
4324
4296
|
|
|
4325
4297
|
class CampaignHashtagFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4326
|
-
constructor({ firestore, interceptors,
|
|
4298
|
+
constructor({ firestore, interceptors, }) {
|
|
4327
4299
|
super({
|
|
4328
4300
|
firestore,
|
|
4329
4301
|
collectionName: 'hashtagCampaignsAuto',
|
|
4330
4302
|
model: CampaignHashtag,
|
|
4331
4303
|
interceptors,
|
|
4332
|
-
cache,
|
|
4333
4304
|
});
|
|
4334
4305
|
}
|
|
4335
4306
|
}
|
|
4336
4307
|
|
|
4337
4308
|
class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4338
|
-
constructor({ firestore, interceptors
|
|
4309
|
+
constructor({ firestore, interceptors }) {
|
|
4339
4310
|
super({
|
|
4340
4311
|
firestore,
|
|
4341
4312
|
collectionName: 'checkouts',
|
|
4342
4313
|
model: Checkout,
|
|
4343
4314
|
interceptors,
|
|
4344
|
-
cache,
|
|
4345
4315
|
});
|
|
4346
4316
|
}
|
|
4347
4317
|
}
|
|
4348
4318
|
|
|
4349
4319
|
class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4350
|
-
constructor({ firestore, interceptors,
|
|
4320
|
+
constructor({ firestore, interceptors, }) {
|
|
4351
4321
|
super({
|
|
4352
4322
|
firestore,
|
|
4353
4323
|
collectionName: 'checkoutsSubscription',
|
|
4354
4324
|
model: CheckoutSubscription,
|
|
4355
4325
|
interceptors,
|
|
4356
|
-
cache,
|
|
4357
4326
|
});
|
|
4358
4327
|
}
|
|
4359
4328
|
}
|
|
4360
4329
|
|
|
4361
4330
|
class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4362
|
-
constructor({ firestore, interceptors
|
|
4331
|
+
constructor({ firestore, interceptors }) {
|
|
4363
4332
|
super({
|
|
4364
4333
|
firestore,
|
|
4365
4334
|
collectionName: 'coupons',
|
|
4366
4335
|
model: Coupon,
|
|
4367
4336
|
interceptors,
|
|
4368
|
-
cache,
|
|
4369
4337
|
});
|
|
4370
4338
|
}
|
|
4371
4339
|
buildModelInstance() {
|
|
@@ -4388,13 +4356,12 @@ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirest
|
|
|
4388
4356
|
}
|
|
4389
4357
|
|
|
4390
4358
|
class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4391
|
-
constructor({ firestore, interceptors
|
|
4359
|
+
constructor({ firestore, interceptors }) {
|
|
4392
4360
|
super({
|
|
4393
4361
|
firestore,
|
|
4394
4362
|
collectionName: 'orders',
|
|
4395
4363
|
model: Order,
|
|
4396
4364
|
interceptors,
|
|
4397
|
-
cache,
|
|
4398
4365
|
fields: {
|
|
4399
4366
|
status: FirestoreFieldType.String,
|
|
4400
4367
|
},
|
|
@@ -4426,24 +4393,22 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
|
|
|
4426
4393
|
}
|
|
4427
4394
|
|
|
4428
4395
|
class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
4429
|
-
constructor({ firestore, interceptors
|
|
4396
|
+
constructor({ firestore, interceptors }) {
|
|
4430
4397
|
super({
|
|
4431
4398
|
firestore,
|
|
4432
4399
|
interceptors,
|
|
4433
|
-
cache,
|
|
4434
4400
|
});
|
|
4435
4401
|
this.collectionName = 'legacyOrders';
|
|
4436
4402
|
}
|
|
4437
4403
|
}
|
|
4438
4404
|
|
|
4439
4405
|
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4440
|
-
constructor({ firestore, interceptors,
|
|
4406
|
+
constructor({ firestore, interceptors, }) {
|
|
4441
4407
|
super({
|
|
4442
4408
|
firestore,
|
|
4443
4409
|
collectionName: 'paymentBlockedAttempts',
|
|
4444
4410
|
model: OrderBlocked,
|
|
4445
4411
|
interceptors,
|
|
4446
|
-
cache,
|
|
4447
4412
|
});
|
|
4448
4413
|
}
|
|
4449
4414
|
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
@@ -4475,141 +4440,130 @@ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
4475
4440
|
}
|
|
4476
4441
|
|
|
4477
4442
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4478
|
-
constructor({ firestore, interceptors
|
|
4443
|
+
constructor({ firestore, interceptors }) {
|
|
4479
4444
|
super({
|
|
4480
4445
|
firestore,
|
|
4481
4446
|
collectionName: 'payments',
|
|
4482
4447
|
model: Payment,
|
|
4483
4448
|
interceptors,
|
|
4484
|
-
cache,
|
|
4485
4449
|
});
|
|
4486
4450
|
}
|
|
4487
4451
|
}
|
|
4488
4452
|
|
|
4489
4453
|
class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4490
|
-
constructor({ firestore, interceptors,
|
|
4454
|
+
constructor({ firestore, interceptors, }) {
|
|
4491
4455
|
super({
|
|
4492
4456
|
firestore,
|
|
4493
4457
|
collectionName: 'subscriptionPlans',
|
|
4494
4458
|
model: SubscriptionPlan,
|
|
4495
4459
|
interceptors,
|
|
4496
|
-
cache,
|
|
4497
4460
|
});
|
|
4498
4461
|
}
|
|
4499
4462
|
}
|
|
4500
4463
|
|
|
4501
4464
|
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4502
|
-
constructor({ firestore, interceptors
|
|
4465
|
+
constructor({ firestore, interceptors }) {
|
|
4503
4466
|
super({
|
|
4504
4467
|
firestore,
|
|
4505
4468
|
collectionName: 'leads',
|
|
4506
4469
|
model: Lead,
|
|
4507
4470
|
interceptors,
|
|
4508
|
-
cache,
|
|
4509
4471
|
});
|
|
4510
4472
|
}
|
|
4511
4473
|
}
|
|
4512
4474
|
|
|
4513
4475
|
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
4514
|
-
constructor({ firestore, interceptors
|
|
4476
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
4515
4477
|
super({
|
|
4516
4478
|
firestore,
|
|
4517
4479
|
collectionName: 'editions',
|
|
4518
4480
|
parentIdField: 'subscriptionId',
|
|
4519
4481
|
model: Edition,
|
|
4520
4482
|
interceptors,
|
|
4521
|
-
cache,
|
|
4522
4483
|
});
|
|
4523
4484
|
this.parentRepository = parentRepository;
|
|
4524
4485
|
}
|
|
4525
4486
|
}
|
|
4526
4487
|
|
|
4527
4488
|
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4528
|
-
constructor({ firestore, interceptors,
|
|
4489
|
+
constructor({ firestore, interceptors, }) {
|
|
4529
4490
|
super({
|
|
4530
4491
|
firestore,
|
|
4531
4492
|
collectionName: 'subscription',
|
|
4532
4493
|
model: Subscription,
|
|
4533
4494
|
interceptors,
|
|
4534
|
-
cache,
|
|
4535
4495
|
});
|
|
4536
4496
|
}
|
|
4537
4497
|
}
|
|
4538
4498
|
|
|
4539
4499
|
class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4540
|
-
constructor({ firestore, interceptors
|
|
4500
|
+
constructor({ firestore, interceptors }) {
|
|
4541
4501
|
super({
|
|
4542
4502
|
firestore,
|
|
4543
4503
|
collectionName: 'subscriptionMaterialization',
|
|
4544
4504
|
model: SubscriptionMaterialization,
|
|
4545
4505
|
interceptors,
|
|
4546
|
-
cache,
|
|
4547
4506
|
});
|
|
4548
4507
|
}
|
|
4549
4508
|
}
|
|
4550
4509
|
|
|
4551
4510
|
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
4552
|
-
constructor({ firestore, interceptors
|
|
4511
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
4553
4512
|
super({
|
|
4554
4513
|
firestore,
|
|
4555
4514
|
collectionName: 'payments',
|
|
4556
4515
|
parentIdField: 'subscriptionId',
|
|
4557
4516
|
model: SubscriptionPayment,
|
|
4558
4517
|
interceptors,
|
|
4559
|
-
cache,
|
|
4560
4518
|
});
|
|
4561
4519
|
this.parentRepository = parentRepository;
|
|
4562
4520
|
}
|
|
4563
4521
|
}
|
|
4564
4522
|
|
|
4565
4523
|
class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4566
|
-
constructor({ firestore, interceptors,
|
|
4524
|
+
constructor({ firestore, interceptors, }) {
|
|
4567
4525
|
super({
|
|
4568
4526
|
firestore,
|
|
4569
4527
|
collectionName: 'subscriptionSummary',
|
|
4570
4528
|
model: SubscriptionSummary,
|
|
4571
4529
|
interceptors,
|
|
4572
|
-
cache,
|
|
4573
4530
|
});
|
|
4574
4531
|
}
|
|
4575
4532
|
}
|
|
4576
4533
|
|
|
4577
4534
|
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
4578
|
-
constructor({ firestore, interceptors
|
|
4535
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
4579
4536
|
super({
|
|
4580
4537
|
firestore,
|
|
4581
4538
|
collectionName: 'address',
|
|
4582
4539
|
parentIdField: 'userId',
|
|
4583
4540
|
model: UserAddress,
|
|
4584
4541
|
interceptors,
|
|
4585
|
-
cache,
|
|
4586
4542
|
});
|
|
4587
4543
|
this.parentRepository = parentRepository;
|
|
4588
4544
|
}
|
|
4589
4545
|
}
|
|
4590
4546
|
|
|
4591
4547
|
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
4592
|
-
constructor({ firestore, interceptors
|
|
4548
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
4593
4549
|
super({
|
|
4594
4550
|
firestore,
|
|
4595
4551
|
collectionName: 'CX',
|
|
4596
4552
|
parentIdField: 'userId',
|
|
4597
4553
|
model: BeautyProfile,
|
|
4598
4554
|
interceptors,
|
|
4599
|
-
cache,
|
|
4600
4555
|
});
|
|
4601
4556
|
this.parentRepository = parentRepository;
|
|
4602
4557
|
}
|
|
4603
4558
|
}
|
|
4604
4559
|
|
|
4605
4560
|
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4606
|
-
constructor({ firestore, interceptors
|
|
4561
|
+
constructor({ firestore, interceptors }) {
|
|
4607
4562
|
super({
|
|
4608
4563
|
firestore,
|
|
4609
4564
|
collectionName: 'users',
|
|
4610
4565
|
model: User,
|
|
4611
4566
|
interceptors,
|
|
4612
|
-
cache,
|
|
4613
4567
|
});
|
|
4614
4568
|
}
|
|
4615
4569
|
async get(identifiers) {
|
|
@@ -4669,14 +4623,13 @@ tslib.__decorate([
|
|
|
4669
4623
|
], UserFirestoreRepository.prototype, "checkIfExistsByField", null);
|
|
4670
4624
|
|
|
4671
4625
|
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
4672
|
-
constructor({ firestore, interceptors
|
|
4626
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
4673
4627
|
super({
|
|
4674
4628
|
firestore,
|
|
4675
4629
|
collectionName: 'payment_method',
|
|
4676
4630
|
parentIdField: 'userId',
|
|
4677
4631
|
model: UserPaymentMethod,
|
|
4678
4632
|
interceptors,
|
|
4679
|
-
cache,
|
|
4680
4633
|
});
|
|
4681
4634
|
this.parentRepository = parentRepository;
|
|
4682
4635
|
}
|
|
@@ -5095,7 +5048,7 @@ const withGetHasuraGraphQL = (MixinBase) => {
|
|
|
5095
5048
|
return CacheKeyGeneratorHelper.generateCacheKeyFromIdentifiers(this.model, identifiers);
|
|
5096
5049
|
}
|
|
5097
5050
|
async get(identifiers, options) {
|
|
5098
|
-
var _a, _b, _c, _d
|
|
5051
|
+
var _a, _b, _c, _d;
|
|
5099
5052
|
this.logger = DebugHelper.from(this, 'get');
|
|
5100
5053
|
if (((_a = this.cache) === null || _a === void 0 ? void 0 : _a.cacheAdapter) && ((_b = options === null || options === void 0 ? void 0 : options.cache) === null || _b === void 0 ? void 0 : _b.enabled)) {
|
|
5101
5054
|
const cacheKey = this.generateCacheKey(identifiers);
|
|
@@ -5129,7 +5082,7 @@ const withGetHasuraGraphQL = (MixinBase) => {
|
|
|
5129
5082
|
await this.cache.cacheAdapter.set({
|
|
5130
5083
|
key: cacheKey,
|
|
5131
5084
|
data: JSON.stringify(resultModel.toPlain()),
|
|
5132
|
-
expirationInSeconds:
|
|
5085
|
+
expirationInSeconds: this.cache.ttlDefault,
|
|
5133
5086
|
});
|
|
5134
5087
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
5135
5088
|
}
|
|
@@ -5182,19 +5135,19 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
5182
5135
|
});
|
|
5183
5136
|
}
|
|
5184
5137
|
async find(params, options) {
|
|
5185
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5138
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
5186
5139
|
this.logger = DebugHelper.from(this, 'find');
|
|
5187
|
-
|
|
5188
|
-
const tableFiltersNamed = `${this.tableName}:${JSON.stringify(filters)}`;
|
|
5189
|
-
const enableCount = (_a = findOptions === null || findOptions === void 0 ? void 0 : findOptions.enableCount) !== null && _a !== void 0 ? _a : true;
|
|
5190
|
-
if (((_b = this.cache) === null || _b === void 0 ? void 0 : _b.cacheAdapter) && ((_c = options === null || options === void 0 ? void 0 : options.cache) === null || _c === void 0 ? void 0 : _c.enabled)) {
|
|
5140
|
+
if (((_a = this.cache) === null || _a === void 0 ? void 0 : _a.cacheAdapter) && ((_b = options === null || options === void 0 ? void 0 : options.cache) === null || _b === void 0 ? void 0 : _b.enabled)) {
|
|
5191
5141
|
const cacheKey = generateCacheKey(this.model, params);
|
|
5192
5142
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
5193
5143
|
if (cachedData) {
|
|
5194
5144
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
5195
|
-
return
|
|
5145
|
+
return JSON.parse(cachedData);
|
|
5196
5146
|
}
|
|
5197
5147
|
}
|
|
5148
|
+
const { filters, limits, orderBy, options: findOptions } = params || {};
|
|
5149
|
+
const tableFiltersNamed = `${this.tableName}:${JSON.stringify(filters)}`;
|
|
5150
|
+
const enableCount = (_c = findOptions === null || findOptions === void 0 ? void 0 : findOptions.enableCount) !== null && _c !== void 0 ? _c : true;
|
|
5198
5151
|
const variablesFilters = lodash.isNil(filters)
|
|
5199
5152
|
? {}
|
|
5200
5153
|
: {
|
|
@@ -5265,42 +5218,38 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
5265
5218
|
}))) ||
|
|
5266
5219
|
[]),
|
|
5267
5220
|
]);
|
|
5268
|
-
if (((_f = this.cache) === null || _f === void 0 ? void 0 : _f.cacheAdapter) && ((_g = options === null || options === void 0 ? void 0 : options.cache) === null || _g === void 0 ? void 0 : _g.enabled)) {
|
|
5269
|
-
const cacheKey = generateCacheKey(this.model, params);
|
|
5270
|
-
await this.cache.cacheAdapter.set({
|
|
5271
|
-
key: cacheKey,
|
|
5272
|
-
data: JSON.stringify(result),
|
|
5273
|
-
expirationInSeconds: ((_h = options === null || options === void 0 ? void 0 : options.cache) === null || _h === void 0 ? void 0 : _h.ttl) || this.cache.ttlDefault,
|
|
5274
|
-
});
|
|
5275
|
-
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
5276
|
-
}
|
|
5277
|
-
return this.bindResult(result, { enableCount, findOptions, tableFiltersNamed });
|
|
5278
|
-
}
|
|
5279
|
-
bindResult(result, { enableCount, findOptions, tableFiltersNamed, }) {
|
|
5280
|
-
var _a, _b, _c, _d;
|
|
5281
5221
|
const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
|
|
5282
|
-
const findResult = Object.assign(Object.assign(Object.assign({ data, count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity }, (((
|
|
5222
|
+
const findResult = Object.assign(Object.assign(Object.assign({ data, count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity }, (((_f = findOptions === null || findOptions === void 0 ? void 0 : findOptions.minimal) === null || _f === void 0 ? void 0 : _f.length)
|
|
5283
5223
|
? {
|
|
5284
5224
|
minimal: findOptions.minimal.reduce((minimals, current) => {
|
|
5285
5225
|
var _a;
|
|
5286
5226
|
return (Object.assign(Object.assign({}, minimals), lodash.set(minimals, current, result[`${this.tableName}_aggregate`].aggregate.min[((_a = AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || current])));
|
|
5287
5227
|
}, {}),
|
|
5288
5228
|
}
|
|
5289
|
-
: {})), (((
|
|
5229
|
+
: {})), (((_g = findOptions === null || findOptions === void 0 ? void 0 : findOptions.maximum) === null || _g === void 0 ? void 0 : _g.length)
|
|
5290
5230
|
? {
|
|
5291
5231
|
maximum: findOptions.maximum.reduce((maximums, current) => {
|
|
5292
5232
|
var _a;
|
|
5293
5233
|
return (Object.assign(Object.assign({}, maximums), lodash.set(maximums, current, result[`${this.tableName}_aggregate`].aggregate.max[((_a = AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || current])));
|
|
5294
5234
|
}, {}),
|
|
5295
5235
|
}
|
|
5296
|
-
: {})), (((
|
|
5297
|
-
distinct: (
|
|
5236
|
+
: {})), (((_h = findOptions === null || findOptions === void 0 ? void 0 : findOptions.distinct) === null || _h === void 0 ? void 0 : _h.length) && {
|
|
5237
|
+
distinct: (_j = this.lastDistinct[tableFiltersNamed]) !== null && _j !== void 0 ? _j : (this.lastDistinct[tableFiltersNamed] = findOptions === null || findOptions === void 0 ? void 0 : findOptions.distinct.reduce((distinct, current) => {
|
|
5298
5238
|
var _a, _b;
|
|
5299
5239
|
const distinctOption = (_a = this.fields.find((fieldOption) => fieldOption === current)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === current);
|
|
5300
5240
|
const fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || current;
|
|
5301
5241
|
return Object.assign(Object.assign({}, distinct), { [current.toString()]: result[`${this.tableName}_${current.toString()}_distinct`].map((obj) => obj[fieldName]) });
|
|
5302
5242
|
}, {})),
|
|
5303
5243
|
}));
|
|
5244
|
+
if (((_k = this.cache) === null || _k === void 0 ? void 0 : _k.cacheAdapter) && ((_l = options === null || options === void 0 ? void 0 : options.cache) === null || _l === void 0 ? void 0 : _l.enabled)) {
|
|
5245
|
+
const cacheKey = generateCacheKey(this.model, params);
|
|
5246
|
+
await this.cache.cacheAdapter.set({
|
|
5247
|
+
key: cacheKey,
|
|
5248
|
+
data: JSON.stringify(findResult),
|
|
5249
|
+
expirationInSeconds: this.cache.ttlDefault,
|
|
5250
|
+
});
|
|
5251
|
+
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
5252
|
+
}
|
|
5304
5253
|
return findResult;
|
|
5305
5254
|
}
|
|
5306
5255
|
};
|
|
@@ -5343,7 +5292,7 @@ tslib.__decorate([
|
|
|
5343
5292
|
], ProductErrorsHasuraGraphQL.prototype, "product", void 0);
|
|
5344
5293
|
|
|
5345
5294
|
class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5346
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
5295
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5347
5296
|
super({
|
|
5348
5297
|
tableName: 'category_collection_children',
|
|
5349
5298
|
model: CategoryCollectionChildren,
|
|
@@ -5374,13 +5323,12 @@ class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGr
|
|
|
5374
5323
|
},
|
|
5375
5324
|
},
|
|
5376
5325
|
],
|
|
5377
|
-
cache,
|
|
5378
5326
|
});
|
|
5379
5327
|
}
|
|
5380
5328
|
}
|
|
5381
5329
|
|
|
5382
5330
|
class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5383
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
5331
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5384
5332
|
super({
|
|
5385
5333
|
tableName: 'category_filter',
|
|
5386
5334
|
model: CategoryFilter,
|
|
@@ -5462,7 +5410,6 @@ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
5462
5410
|
},
|
|
5463
5411
|
},
|
|
5464
5412
|
],
|
|
5465
|
-
cache,
|
|
5466
5413
|
});
|
|
5467
5414
|
}
|
|
5468
5415
|
deleteByCategory(categoryId) {
|
|
@@ -5602,17 +5549,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5602
5549
|
});
|
|
5603
5550
|
this.productRepository = productRepository;
|
|
5604
5551
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5605
|
-
this.reorganizeMostRelevantsProducts = (products, mostRelevantsIds, limit) => {
|
|
5606
|
-
const mostRelevantWithouyStock = products.filter((product) => mostRelevantsIds.includes(product.id) && product.stock.quantity <= 0);
|
|
5607
|
-
const firstProducts = products
|
|
5608
|
-
.filter((product) => mostRelevantsIds.includes(product.id) && product.stock.quantity > 0)
|
|
5609
|
-
.sort((a, b) => mostRelevantsIds.indexOf(a.id) - mostRelevantsIds.indexOf(b.id));
|
|
5610
|
-
const lastProducts = products
|
|
5611
|
-
.filter((product) => !mostRelevantsIds.includes(product.id) && product.stock.quantity > 0)
|
|
5612
|
-
.concat(mostRelevantWithouyStock);
|
|
5613
|
-
const categoryMostRelevants = firstProducts.concat(lastProducts);
|
|
5614
|
-
return limit ? categoryMostRelevants.slice(0, limit) : categoryMostRelevants;
|
|
5615
|
-
};
|
|
5616
5552
|
}
|
|
5617
5553
|
async create(params) {
|
|
5618
5554
|
const { images, mostRelevants, metadatas } = params, data = tslib.__rest(params, ["images", "mostRelevants", "metadatas"]);
|
|
@@ -5632,12 +5568,11 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5632
5568
|
},
|
|
5633
5569
|
} }));
|
|
5634
5570
|
}
|
|
5635
|
-
async get(identifiers
|
|
5571
|
+
async get(identifiers) {
|
|
5636
5572
|
var _a;
|
|
5637
5573
|
return Number.isNaN(+identifiers.id)
|
|
5638
|
-
? (_a = (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }
|
|
5639
|
-
|
|
5640
|
-
: super.get(identifiers, optionsCache);
|
|
5574
|
+
? (_a = (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
5575
|
+
: super.get(identifiers);
|
|
5641
5576
|
}
|
|
5642
5577
|
async update(params) {
|
|
5643
5578
|
const { products, id: checkId, metadatas, filters } = params, data = tslib.__rest(params, ["products", "id", "metadatas", "filters"]);
|
|
@@ -5649,7 +5584,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5649
5584
|
category.filters = filters && (await this.updateFilters(+id, { filters }));
|
|
5650
5585
|
return category;
|
|
5651
5586
|
}
|
|
5652
|
-
async getCategoryBySlug(slug, shop
|
|
5587
|
+
async getCategoryBySlug(slug, shop) {
|
|
5653
5588
|
if (!slug)
|
|
5654
5589
|
return null;
|
|
5655
5590
|
const { data } = await this.find({
|
|
@@ -5661,14 +5596,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5661
5596
|
options: {
|
|
5662
5597
|
enableCount: false,
|
|
5663
5598
|
},
|
|
5664
|
-
}
|
|
5599
|
+
});
|
|
5665
5600
|
if (!data.length)
|
|
5666
5601
|
throw new NotFoundError(`Category with slug ${slug} not found`);
|
|
5667
5602
|
if (data.length > 1)
|
|
5668
5603
|
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
5669
5604
|
return data.shift();
|
|
5670
5605
|
}
|
|
5671
|
-
async getCategoryByShop(shop
|
|
5606
|
+
async getCategoryByShop(shop) {
|
|
5672
5607
|
if (!shop)
|
|
5673
5608
|
return;
|
|
5674
5609
|
const { data } = await this.find({
|
|
@@ -5680,10 +5615,10 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5680
5615
|
options: {
|
|
5681
5616
|
enableCount: false,
|
|
5682
5617
|
},
|
|
5683
|
-
}
|
|
5618
|
+
});
|
|
5684
5619
|
return data;
|
|
5685
5620
|
}
|
|
5686
|
-
async getCategoriesForHome(categoryIds, shop, limit = 4
|
|
5621
|
+
async getCategoriesForHome(categoryIds, shop, limit = 4) {
|
|
5687
5622
|
if (!(categoryIds === null || categoryIds === void 0 ? void 0 : categoryIds.length))
|
|
5688
5623
|
return [];
|
|
5689
5624
|
const categoriesFirestore = categoryIds.filter((categoryId) => Number.isNaN(+categoryId));
|
|
@@ -5691,91 +5626,83 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5691
5626
|
const categories = [];
|
|
5692
5627
|
if (categoriesFirestore.length)
|
|
5693
5628
|
categories.push(...(await this.find({
|
|
5694
|
-
filters: {
|
|
5695
|
-
|
|
5696
|
-
published: true,
|
|
5697
|
-
},
|
|
5698
|
-
}, optionsCache).then(({ data }) => data)));
|
|
5629
|
+
filters: { firestoreId: { operator: exports.Where.IN, value: categoriesFirestore.filter(Boolean) }, published: true },
|
|
5630
|
+
}).then(({ data }) => data)));
|
|
5699
5631
|
if (categoriesHasura.length)
|
|
5700
5632
|
categories.push(...(await this.find({
|
|
5701
5633
|
filters: {
|
|
5702
5634
|
id: { operator: exports.Where.IN, value: categoriesHasura.filter(Boolean) },
|
|
5703
5635
|
published: true,
|
|
5704
5636
|
},
|
|
5705
|
-
}
|
|
5637
|
+
}).then(({ data }) => data)));
|
|
5706
5638
|
if (!categories.length)
|
|
5707
5639
|
return [];
|
|
5708
5640
|
const homeSections = await Promise.all(categories.map(async (category) => ({
|
|
5709
5641
|
category,
|
|
5710
|
-
products: await this.mountCategory(category, shop, { limit, hasStock: true }
|
|
5642
|
+
products: await this.mountCategory(category, shop, { limit, hasStock: true }),
|
|
5711
5643
|
})));
|
|
5712
5644
|
return homeSections;
|
|
5713
5645
|
}
|
|
5714
|
-
async mountCategory(category, shop, options
|
|
5646
|
+
async mountCategory(category, shop, options) {
|
|
5715
5647
|
var _a;
|
|
5716
5648
|
if (!((_a = category === null || category === void 0 ? void 0 : category.products) === null || _a === void 0 ? void 0 : _a.length))
|
|
5717
5649
|
return [];
|
|
5718
|
-
const
|
|
5719
|
-
|
|
5720
|
-
'name',
|
|
5721
|
-
'slug',
|
|
5722
|
-
'images',
|
|
5723
|
-
'miniatures',
|
|
5724
|
-
'price',
|
|
5725
|
-
'fullPrice',
|
|
5726
|
-
'subscriberDiscountPercentage',
|
|
5727
|
-
'subscriberPrice',
|
|
5728
|
-
'stock',
|
|
5729
|
-
'published',
|
|
5730
|
-
'CEST',
|
|
5731
|
-
'EAN',
|
|
5732
|
-
'NCM',
|
|
5733
|
-
'brand',
|
|
5734
|
-
'costPrice',
|
|
5735
|
-
'hasVariants',
|
|
5736
|
-
'isKit',
|
|
5737
|
-
'sku',
|
|
5738
|
-
'rate',
|
|
5739
|
-
'tags',
|
|
5740
|
-
'type',
|
|
5741
|
-
'shoppingCount',
|
|
5742
|
-
'gender',
|
|
5743
|
-
'createdAt',
|
|
5744
|
-
];
|
|
5650
|
+
const mostRelevants = category.getMostRelevantByShop(shop);
|
|
5651
|
+
const mostRelevantProductsIds = [...new Set(mostRelevants.concat(category.products))];
|
|
5745
5652
|
const products = [];
|
|
5746
|
-
const
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5653
|
+
const { data: productsData } = await this.productRepository.findCatalog({
|
|
5654
|
+
filters: {
|
|
5655
|
+
id: { operator: exports.Where.IN, value: mostRelevantProductsIds },
|
|
5656
|
+
published: true,
|
|
5657
|
+
},
|
|
5658
|
+
fields: [
|
|
5659
|
+
'id',
|
|
5660
|
+
'name',
|
|
5661
|
+
'slug',
|
|
5662
|
+
'images',
|
|
5663
|
+
'miniatures',
|
|
5664
|
+
'price',
|
|
5665
|
+
'fullPrice',
|
|
5666
|
+
'subscriberDiscountPercentage',
|
|
5667
|
+
'subscriberPrice',
|
|
5668
|
+
'stock',
|
|
5669
|
+
'published',
|
|
5670
|
+
'CEST',
|
|
5671
|
+
'EAN',
|
|
5672
|
+
'NCM',
|
|
5673
|
+
'brand',
|
|
5674
|
+
'costPrice',
|
|
5675
|
+
'hasVariants',
|
|
5676
|
+
'isKit',
|
|
5677
|
+
'sku',
|
|
5678
|
+
'rate',
|
|
5679
|
+
'tags',
|
|
5680
|
+
'type',
|
|
5681
|
+
'shoppingCount',
|
|
5682
|
+
'gender',
|
|
5683
|
+
'createdAt',
|
|
5684
|
+
],
|
|
5685
|
+
options: { enableCount: false },
|
|
5686
|
+
orderBy: {
|
|
5772
5687
|
shoppingCount: 'desc',
|
|
5773
5688
|
rate: 'desc',
|
|
5689
|
+
stock: 'desc',
|
|
5774
5690
|
name: 'asc',
|
|
5775
|
-
}
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5691
|
+
},
|
|
5692
|
+
}, shop === exports.Shops.MENSMARKET ? 'male' : 'female');
|
|
5693
|
+
const mostRelevantWithouyStock = productsData.filter((product) => mostRelevants.includes(product.id) && product.stock.quantity <= 0);
|
|
5694
|
+
const firstProducts = productsData
|
|
5695
|
+
.filter((product) => mostRelevants.includes(product.id) && product.stock.quantity > 0)
|
|
5696
|
+
.sort((a, b) => mostRelevants.indexOf(a.id) - mostRelevants.indexOf(b.id));
|
|
5697
|
+
const lastProducts = productsData
|
|
5698
|
+
.filter((product) => !mostRelevants.includes(product.id) && product.stock.quantity > 0)
|
|
5699
|
+
.concat(mostRelevantWithouyStock);
|
|
5700
|
+
const categoryMostRelevants = firstProducts.concat(lastProducts);
|
|
5701
|
+
const resultFinal = categoryMostRelevants.slice(0, options.limit);
|
|
5702
|
+
products.push(...resultFinal);
|
|
5703
|
+
return products;
|
|
5704
|
+
}
|
|
5705
|
+
async getChildren(parentId) {
|
|
5779
5706
|
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference', 'published', 'shops'], {
|
|
5780
5707
|
args: {
|
|
5781
5708
|
type: 'category_tree_args',
|
|
@@ -5913,31 +5840,31 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5913
5840
|
tslib.__decorate([
|
|
5914
5841
|
Log(),
|
|
5915
5842
|
tslib.__metadata("design:type", Function),
|
|
5916
|
-
tslib.__metadata("design:paramtypes", [String, String
|
|
5843
|
+
tslib.__metadata("design:paramtypes", [String, String]),
|
|
5917
5844
|
tslib.__metadata("design:returntype", Promise)
|
|
5918
5845
|
], CategoryHasuraGraphQLRepository.prototype, "getCategoryBySlug", null);
|
|
5919
5846
|
tslib.__decorate([
|
|
5920
5847
|
Log(),
|
|
5921
5848
|
tslib.__metadata("design:type", Function),
|
|
5922
|
-
tslib.__metadata("design:paramtypes", [String
|
|
5849
|
+
tslib.__metadata("design:paramtypes", [String]),
|
|
5923
5850
|
tslib.__metadata("design:returntype", Promise)
|
|
5924
5851
|
], CategoryHasuraGraphQLRepository.prototype, "getCategoryByShop", null);
|
|
5925
5852
|
tslib.__decorate([
|
|
5926
5853
|
Log(),
|
|
5927
5854
|
tslib.__metadata("design:type", Function),
|
|
5928
|
-
tslib.__metadata("design:paramtypes", [Array, String, Object
|
|
5855
|
+
tslib.__metadata("design:paramtypes", [Array, String, Object]),
|
|
5929
5856
|
tslib.__metadata("design:returntype", Promise)
|
|
5930
5857
|
], CategoryHasuraGraphQLRepository.prototype, "getCategoriesForHome", null);
|
|
5931
5858
|
tslib.__decorate([
|
|
5932
5859
|
Log(),
|
|
5933
5860
|
tslib.__metadata("design:type", Function),
|
|
5934
|
-
tslib.__metadata("design:paramtypes", [Category, String, Object
|
|
5861
|
+
tslib.__metadata("design:paramtypes", [Category, String, Object]),
|
|
5935
5862
|
tslib.__metadata("design:returntype", Promise)
|
|
5936
5863
|
], CategoryHasuraGraphQLRepository.prototype, "mountCategory", null);
|
|
5937
5864
|
tslib.__decorate([
|
|
5938
5865
|
Log(),
|
|
5939
5866
|
tslib.__metadata("design:type", Function),
|
|
5940
|
-
tslib.__metadata("design:paramtypes", [Number
|
|
5867
|
+
tslib.__metadata("design:paramtypes", [Number]),
|
|
5941
5868
|
tslib.__metadata("design:returntype", Promise)
|
|
5942
5869
|
], CategoryHasuraGraphQLRepository.prototype, "getChildren", null);
|
|
5943
5870
|
tslib.__decorate([
|
|
@@ -5948,7 +5875,7 @@ tslib.__decorate([
|
|
|
5948
5875
|
], CategoryHasuraGraphQLRepository.prototype, "isChild", null);
|
|
5949
5876
|
|
|
5950
5877
|
class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5951
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
5878
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5952
5879
|
super({
|
|
5953
5880
|
tableName: 'category_product',
|
|
5954
5881
|
model: CategoryProduct,
|
|
@@ -5956,7 +5883,6 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
|
|
|
5956
5883
|
authOptions,
|
|
5957
5884
|
interceptors,
|
|
5958
5885
|
fields: [{ productId: { columnName: 'product_id' } }, { categoryId: { columnName: 'category_id' } }, 'order'],
|
|
5959
|
-
cache,
|
|
5960
5886
|
});
|
|
5961
5887
|
}
|
|
5962
5888
|
async removeProductFromCategory(categoryId, productId) {
|
|
@@ -5983,7 +5909,7 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
|
|
|
5983
5909
|
}
|
|
5984
5910
|
|
|
5985
5911
|
class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5986
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
5912
|
+
constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
|
|
5987
5913
|
super({
|
|
5988
5914
|
tableName: 'filter',
|
|
5989
5915
|
model: Filter,
|
|
@@ -6023,7 +5949,6 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
6023
5949
|
},
|
|
6024
5950
|
},
|
|
6025
5951
|
],
|
|
6026
|
-
cache,
|
|
6027
5952
|
});
|
|
6028
5953
|
this.filterOptionRepository = filterOptionRepository;
|
|
6029
5954
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
@@ -6110,7 +6035,7 @@ tslib.__decorate([
|
|
|
6110
6035
|
], FilterHasuraGraphQLRepository.prototype, "deleteOptions", null);
|
|
6111
6036
|
|
|
6112
6037
|
class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6113
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
6038
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
6114
6039
|
super({
|
|
6115
6040
|
tableName: 'filter_option',
|
|
6116
6041
|
model: FilterOption,
|
|
@@ -6124,20 +6049,18 @@ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasu
|
|
|
6124
6049
|
{ createdAt: { columnName: 'created_at' } },
|
|
6125
6050
|
{ updatedAt: { columnName: 'updated_at' } },
|
|
6126
6051
|
],
|
|
6127
|
-
cache,
|
|
6128
6052
|
});
|
|
6129
6053
|
}
|
|
6130
6054
|
}
|
|
6131
6055
|
|
|
6132
6056
|
class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6133
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
6057
|
+
constructor({ endpoint, authOptions, interceptors, }, productRepository) {
|
|
6134
6058
|
super({
|
|
6135
6059
|
tableName: 'product_errors',
|
|
6136
6060
|
model: ProductErrorsHasuraGraphQL,
|
|
6137
6061
|
endpoint,
|
|
6138
6062
|
authOptions,
|
|
6139
6063
|
interceptors,
|
|
6140
|
-
cache,
|
|
6141
6064
|
fields: [
|
|
6142
6065
|
{
|
|
6143
6066
|
productId: {
|
|
@@ -6851,7 +6774,7 @@ tslib.__decorate([
|
|
|
6851
6774
|
], ProductHasuraGraphQLRepository.prototype, "findReviewsByProduct", null);
|
|
6852
6775
|
|
|
6853
6776
|
class ProductReviewHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6854
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
6777
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
6855
6778
|
super({
|
|
6856
6779
|
tableName: 'product_review',
|
|
6857
6780
|
model: ProductReview,
|
|
@@ -6875,7 +6798,6 @@ class ProductReviewHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHas
|
|
|
6875
6798
|
{ createdAt: { columnName: 'created_at' } },
|
|
6876
6799
|
{ updatedAt: { columnName: 'updated_at' } },
|
|
6877
6800
|
],
|
|
6878
|
-
cache,
|
|
6879
6801
|
});
|
|
6880
6802
|
}
|
|
6881
6803
|
async updateManyStatus(reviews) {
|
|
@@ -6917,14 +6839,13 @@ tslib.__decorate([
|
|
|
6917
6839
|
], ProductReviewHasuraGraphQLRepository.prototype, "disaproveReview", null);
|
|
6918
6840
|
|
|
6919
6841
|
class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6920
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
6842
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
6921
6843
|
super({
|
|
6922
6844
|
tableName: 'product_stock_notification',
|
|
6923
6845
|
model: ProductStockNotification,
|
|
6924
6846
|
endpoint,
|
|
6925
6847
|
authOptions,
|
|
6926
6848
|
interceptors,
|
|
6927
|
-
cache,
|
|
6928
6849
|
fields: [
|
|
6929
6850
|
'id',
|
|
6930
6851
|
{ productId: { columnName: 'product_id' } },
|
|
@@ -6979,14 +6900,13 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
|
|
|
6979
6900
|
}
|
|
6980
6901
|
|
|
6981
6902
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6982
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
6903
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
6983
6904
|
super({
|
|
6984
6905
|
tableName: 'product',
|
|
6985
6906
|
model: VariantHasuraGraphQL,
|
|
6986
6907
|
endpoint,
|
|
6987
6908
|
authOptions,
|
|
6988
6909
|
interceptors,
|
|
6989
|
-
cache,
|
|
6990
6910
|
fields: [
|
|
6991
6911
|
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
6992
6912
|
{ firestoreId: { columnName: 'firestore_id' } },
|
|
@@ -7093,14 +7013,13 @@ class WishlistHasuraGraphQL extends Wishlist {
|
|
|
7093
7013
|
}
|
|
7094
7014
|
|
|
7095
7015
|
class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
7096
|
-
constructor({ endpoint, authOptions, interceptors,
|
|
7016
|
+
constructor({ endpoint, authOptions, interceptors, }, categoryProductRepository) {
|
|
7097
7017
|
super({
|
|
7098
7018
|
tableName: 'category',
|
|
7099
7019
|
model: WishlistHasuraGraphQL,
|
|
7100
7020
|
endpoint,
|
|
7101
7021
|
authOptions,
|
|
7102
7022
|
interceptors,
|
|
7103
|
-
cache,
|
|
7104
7023
|
fields: [
|
|
7105
7024
|
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
7106
7025
|
{ firestoreId: { columnName: 'firestore_id' } },
|