@infrab4a/connect 4.25.0 → 4.25.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js
CHANGED
|
@@ -8,6 +8,7 @@ var classTransformer = require('class-transformer');
|
|
|
8
8
|
var dateFns = require('date-fns');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
10
|
var debug = require('debug');
|
|
11
|
+
var serializeJavascript = require('serialize-javascript');
|
|
11
12
|
var tsCustomError = require('ts-custom-error');
|
|
12
13
|
var axios = require('axios');
|
|
13
14
|
var auth = require('firebase/auth');
|
|
@@ -18,6 +19,25 @@ var gqlQueryBuilder = require('gql-query-builder');
|
|
|
18
19
|
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
21
|
|
|
22
|
+
function _interopNamespace(e) {
|
|
23
|
+
if (e && e.__esModule) return e;
|
|
24
|
+
var n = Object.create(null);
|
|
25
|
+
if (e) {
|
|
26
|
+
Object.keys(e).forEach(function (k) {
|
|
27
|
+
if (k !== 'default') {
|
|
28
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
29
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return e[k]; }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
n["default"] = e;
|
|
37
|
+
return Object.freeze(n);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var serializeJavascript__namespace = /*#__PURE__*/_interopNamespace(serializeJavascript);
|
|
21
41
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
22
42
|
|
|
23
43
|
exports.AntifraudProviders = void 0;
|
|
@@ -1234,6 +1254,13 @@ const parseDateTime = (value) => {
|
|
|
1234
1254
|
return date;
|
|
1235
1255
|
};
|
|
1236
1256
|
|
|
1257
|
+
const deserialize = (data) => {
|
|
1258
|
+
return eval('(' + data + ')');
|
|
1259
|
+
};
|
|
1260
|
+
const serialize = (data) => {
|
|
1261
|
+
return serializeJavascript__namespace(data);
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1237
1264
|
class BaseModel {
|
|
1238
1265
|
get identifier() {
|
|
1239
1266
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
@@ -3632,7 +3659,7 @@ const withGetFirestore = (MixinBase) => {
|
|
|
3632
3659
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
3633
3660
|
if (cachedData) {
|
|
3634
3661
|
logger.log({ req, res: 'Dados recuperados do cache', cacheKey });
|
|
3635
|
-
return this.model.toInstance(
|
|
3662
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
3636
3663
|
}
|
|
3637
3664
|
}
|
|
3638
3665
|
try {
|
|
@@ -3650,7 +3677,7 @@ const withGetFirestore = (MixinBase) => {
|
|
|
3650
3677
|
const cacheKey = FirestoreCacheKeyGeneratorHelper.generateGetCacheKey(this.model, identifiers);
|
|
3651
3678
|
await this.cache.cacheAdapter.set({
|
|
3652
3679
|
key: cacheKey,
|
|
3653
|
-
data:
|
|
3680
|
+
data: serialize(res),
|
|
3654
3681
|
expirationInSeconds: ((_j = options === null || options === void 0 ? void 0 : options.cache) === null || _j === void 0 ? void 0 : _j.ttl) || this.cache.ttlDefault,
|
|
3655
3682
|
});
|
|
3656
3683
|
logger.log({ req, message: 'Dados salvos no cache', cacheKey });
|
|
@@ -3755,7 +3782,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
3755
3782
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
3756
3783
|
if (cachedData) {
|
|
3757
3784
|
logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
3758
|
-
return
|
|
3785
|
+
return deserialize(cachedData);
|
|
3759
3786
|
}
|
|
3760
3787
|
}
|
|
3761
3788
|
const collectionName = this.buildCollectionPathForFind(find.filters);
|
|
@@ -3764,7 +3791,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
3764
3791
|
const req = { collection: collectionName, data: find };
|
|
3765
3792
|
try {
|
|
3766
3793
|
const intercepted = await ((_f = (_e = this.interceptors) === null || _e === void 0 ? void 0 : _e.request) === null || _f === void 0 ? void 0 : _f.call(_e, { find }));
|
|
3767
|
-
const {
|
|
3794
|
+
const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
3768
3795
|
const queries = this.makeFirestoreWhere(filters || {});
|
|
3769
3796
|
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
3770
3797
|
const offsets = await this.defineLimits(filters, limits);
|
|
@@ -3781,7 +3808,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
3781
3808
|
const cacheKey = this.generateCacheKey(find);
|
|
3782
3809
|
await this.cache.cacheAdapter.set({
|
|
3783
3810
|
key: cacheKey,
|
|
3784
|
-
data:
|
|
3811
|
+
data: serialize(res),
|
|
3785
3812
|
expirationInSeconds: ((_l = options === null || options === void 0 ? void 0 : options.cache) === null || _l === void 0 ? void 0 : _l.ttl) || this.cache.ttlDefault,
|
|
3786
3813
|
});
|
|
3787
3814
|
logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -5102,7 +5129,7 @@ const withGetHasuraGraphQL = (MixinBase) => {
|
|
|
5102
5129
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
5103
5130
|
if (cachedData) {
|
|
5104
5131
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
5105
|
-
return this.model.toInstance(
|
|
5132
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
5106
5133
|
}
|
|
5107
5134
|
}
|
|
5108
5135
|
const instance = this.model.toInstance(identifiers);
|
|
@@ -5128,7 +5155,7 @@ const withGetHasuraGraphQL = (MixinBase) => {
|
|
|
5128
5155
|
const cacheKey = this.generateCacheKey(identifiers);
|
|
5129
5156
|
await this.cache.cacheAdapter.set({
|
|
5130
5157
|
key: cacheKey,
|
|
5131
|
-
data:
|
|
5158
|
+
data: serialize(resultModel),
|
|
5132
5159
|
expirationInSeconds: ((_e = options === null || options === void 0 ? void 0 : options.cache) === null || _e === void 0 ? void 0 : _e.ttl) || this.cache.ttlDefault,
|
|
5133
5160
|
});
|
|
5134
5161
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -5192,7 +5219,7 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
5192
5219
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
5193
5220
|
if (cachedData) {
|
|
5194
5221
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
5195
|
-
return this.bindResult(
|
|
5222
|
+
return this.bindResult(deserialize(cachedData), { enableCount, findOptions, tableFiltersNamed });
|
|
5196
5223
|
}
|
|
5197
5224
|
}
|
|
5198
5225
|
const variablesFilters = lodash.isNil(filters)
|
|
@@ -5269,7 +5296,7 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
5269
5296
|
const cacheKey = generateCacheKey(this.model, params);
|
|
5270
5297
|
await this.cache.cacheAdapter.set({
|
|
5271
5298
|
key: cacheKey,
|
|
5272
|
-
data:
|
|
5299
|
+
data: serialize(result),
|
|
5273
5300
|
expirationInSeconds: ((_h = options === null || options === void 0 ? void 0 : options.cache) === null || _h === void 0 ? void 0 : _h.ttl) || this.cache.ttlDefault,
|
|
5274
5301
|
});
|
|
5275
5302
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -5720,7 +5747,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5720
5747
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
5721
5748
|
if (cachedData) {
|
|
5722
5749
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
5723
|
-
return
|
|
5750
|
+
return deserialize(cachedData).map((product) => new ProductHasuraGraphQL(product));
|
|
5724
5751
|
}
|
|
5725
5752
|
}
|
|
5726
5753
|
const fields = [
|
|
@@ -5929,7 +5956,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5929
5956
|
const cacheKey = `${this.model.name.toLowerCase()}:mountCategory:${category.id}:${shop}:${MD5GeneratorHelper.generateMD5(options)}`;
|
|
5930
5957
|
await this.cache.cacheAdapter.set({
|
|
5931
5958
|
key: cacheKey,
|
|
5932
|
-
data:
|
|
5959
|
+
data: serialize(result),
|
|
5933
5960
|
expirationInSeconds: ((_a = optionsCache === null || optionsCache === void 0 ? void 0 : optionsCache.cache) === null || _a === void 0 ? void 0 : _a.ttl) || this.cache.ttlDefault,
|
|
5934
5961
|
});
|
|
5935
5962
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -6485,7 +6512,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6485
6512
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
6486
6513
|
if (cachedData) {
|
|
6487
6514
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
6488
|
-
return this.model.toInstance(
|
|
6515
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
6489
6516
|
}
|
|
6490
6517
|
}
|
|
6491
6518
|
const result = await this.find({
|
|
@@ -6505,7 +6532,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6505
6532
|
const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
|
|
6506
6533
|
await this.cache.cacheAdapter.set({
|
|
6507
6534
|
key: cacheKey,
|
|
6508
|
-
data:
|
|
6535
|
+
data: serialize(product),
|
|
6509
6536
|
expirationInSeconds: ((_f = options === null || options === void 0 ? void 0 : options.cache) === null || _f === void 0 ? void 0 : _f.ttl) || this.cache.ttlDefault,
|
|
6510
6537
|
});
|
|
6511
6538
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -6529,7 +6556,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6529
6556
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
6530
6557
|
if (cachedData) {
|
|
6531
6558
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
6532
|
-
return
|
|
6559
|
+
return deserialize(cachedData).map((review) => new ProductReview(review));
|
|
6533
6560
|
}
|
|
6534
6561
|
}
|
|
6535
6562
|
let data = [];
|
|
@@ -6574,7 +6601,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6574
6601
|
const cacheKey = `${this.model.name.toLowerCase()}:all-reviews:${MD5GeneratorHelper.generateMD5(filters)}`;
|
|
6575
6602
|
await this.cache.cacheAdapter.set({
|
|
6576
6603
|
key: cacheKey,
|
|
6577
|
-
data:
|
|
6604
|
+
data: serialize(filteredReviews),
|
|
6578
6605
|
expirationInSeconds: ((_e = options === null || options === void 0 ? void 0 : options.cache) === null || _e === void 0 ? void 0 : _e.ttl) || this.cache.ttlDefault,
|
|
6579
6606
|
});
|
|
6580
6607
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -6588,7 +6615,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6588
6615
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
6589
6616
|
if (cachedData) {
|
|
6590
6617
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
6591
|
-
return
|
|
6618
|
+
return deserialize(cachedData).map((review) => new ProductReview(review));
|
|
6592
6619
|
}
|
|
6593
6620
|
}
|
|
6594
6621
|
const reviewsExpression = {
|
|
@@ -6611,7 +6638,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6611
6638
|
const cacheKey = `${this.model.name.toLowerCase()}:reviews:${status}`;
|
|
6612
6639
|
await this.cache.cacheAdapter.set({
|
|
6613
6640
|
key: cacheKey,
|
|
6614
|
-
data:
|
|
6641
|
+
data: serialize(reviews),
|
|
6615
6642
|
expirationInSeconds: ((_e = options === null || options === void 0 ? void 0 : options.cache) === null || _e === void 0 ? void 0 : _e.ttl) || this.cache.ttlDefault,
|
|
6616
6643
|
});
|
|
6617
6644
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -6734,7 +6761,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6734
6761
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
6735
6762
|
if (cachedData) {
|
|
6736
6763
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
6737
|
-
return
|
|
6764
|
+
return deserialize(cachedData).map((review) => new ProductReview(review));
|
|
6738
6765
|
}
|
|
6739
6766
|
}
|
|
6740
6767
|
const { product_review: data } = await this.query('product_review', this.reviewsFields, {
|
|
@@ -6751,7 +6778,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6751
6778
|
const cacheKey = `${this.model.name.toLowerCase()}:reviews:product:${productId}`;
|
|
6752
6779
|
await this.cache.cacheAdapter.set({
|
|
6753
6780
|
key: cacheKey,
|
|
6754
|
-
data:
|
|
6781
|
+
data: serialize(reviews),
|
|
6755
6782
|
expirationInSeconds: ((_e = options === null || options === void 0 ? void 0 : options.cache) === null || _e === void 0 ? void 0 : _e.ttl) || this.cache.ttlDefault,
|
|
6756
6783
|
});
|
|
6757
6784
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -8133,6 +8160,7 @@ exports.VertexAxiosAdapter = VertexAxiosAdapter;
|
|
|
8133
8160
|
exports.WeakPasswordError = WeakPasswordError;
|
|
8134
8161
|
exports.Wishlist = Wishlist;
|
|
8135
8162
|
exports.WishlistHasuraGraphQLRepository = WishlistHasuraGraphQLRepository;
|
|
8163
|
+
exports.deserialize = deserialize;
|
|
8136
8164
|
exports.getClass = getClass;
|
|
8137
8165
|
exports.is = is;
|
|
8138
8166
|
exports.isDebuggable = isDebuggable;
|
|
@@ -8140,6 +8168,7 @@ exports.isUUID = isUUID;
|
|
|
8140
8168
|
exports.parseDateTime = parseDateTime;
|
|
8141
8169
|
exports.registerClass = registerClass;
|
|
8142
8170
|
exports.resolveClass = resolveClass;
|
|
8171
|
+
exports.serialize = serialize;
|
|
8143
8172
|
exports.withCreateFirestore = withCreateFirestore;
|
|
8144
8173
|
exports.withCreateHasuraGraphQL = withCreateHasuraGraphQL;
|
|
8145
8174
|
exports.withCrudFirestore = withCrudFirestore;
|
package/index.esm.js
CHANGED
|
@@ -6,6 +6,7 @@ export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, f
|
|
|
6
6
|
import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, isEmpty, isDate, set, isNumber, chunk, isBoolean, isInteger, isNaN as isNaN$1, sortBy, omit } from 'lodash';
|
|
7
7
|
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
|
|
8
8
|
import { debug } from 'debug';
|
|
9
|
+
import * as serializeJavascript from 'serialize-javascript';
|
|
9
10
|
import { CustomError } from 'ts-custom-error';
|
|
10
11
|
import axios, { AxiosError } from 'axios';
|
|
11
12
|
import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
|
|
@@ -1228,6 +1229,13 @@ const parseDateTime = (value) => {
|
|
|
1228
1229
|
return date;
|
|
1229
1230
|
};
|
|
1230
1231
|
|
|
1232
|
+
const deserialize = (data) => {
|
|
1233
|
+
return eval('(' + data + ')');
|
|
1234
|
+
};
|
|
1235
|
+
const serialize = (data) => {
|
|
1236
|
+
return serializeJavascript(data);
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1231
1239
|
class BaseModel {
|
|
1232
1240
|
get identifier() {
|
|
1233
1241
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
@@ -3626,7 +3634,7 @@ const withGetFirestore = (MixinBase) => {
|
|
|
3626
3634
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
3627
3635
|
if (cachedData) {
|
|
3628
3636
|
logger.log({ req, res: 'Dados recuperados do cache', cacheKey });
|
|
3629
|
-
return this.model.toInstance(
|
|
3637
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
3630
3638
|
}
|
|
3631
3639
|
}
|
|
3632
3640
|
try {
|
|
@@ -3644,7 +3652,7 @@ const withGetFirestore = (MixinBase) => {
|
|
|
3644
3652
|
const cacheKey = FirestoreCacheKeyGeneratorHelper.generateGetCacheKey(this.model, identifiers);
|
|
3645
3653
|
await this.cache.cacheAdapter.set({
|
|
3646
3654
|
key: cacheKey,
|
|
3647
|
-
data:
|
|
3655
|
+
data: serialize(res),
|
|
3648
3656
|
expirationInSeconds: ((_j = options === null || options === void 0 ? void 0 : options.cache) === null || _j === void 0 ? void 0 : _j.ttl) || this.cache.ttlDefault,
|
|
3649
3657
|
});
|
|
3650
3658
|
logger.log({ req, message: 'Dados salvos no cache', cacheKey });
|
|
@@ -3749,7 +3757,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
3749
3757
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
3750
3758
|
if (cachedData) {
|
|
3751
3759
|
logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
3752
|
-
return
|
|
3760
|
+
return deserialize(cachedData);
|
|
3753
3761
|
}
|
|
3754
3762
|
}
|
|
3755
3763
|
const collectionName = this.buildCollectionPathForFind(find.filters);
|
|
@@ -3758,7 +3766,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
3758
3766
|
const req = { collection: collectionName, data: find };
|
|
3759
3767
|
try {
|
|
3760
3768
|
const intercepted = await ((_f = (_e = this.interceptors) === null || _e === void 0 ? void 0 : _e.request) === null || _f === void 0 ? void 0 : _f.call(_e, { find }));
|
|
3761
|
-
const {
|
|
3769
|
+
const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
3762
3770
|
const queries = this.makeFirestoreWhere(filters || {});
|
|
3763
3771
|
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
3764
3772
|
const offsets = await this.defineLimits(filters, limits);
|
|
@@ -3775,7 +3783,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
3775
3783
|
const cacheKey = this.generateCacheKey(find);
|
|
3776
3784
|
await this.cache.cacheAdapter.set({
|
|
3777
3785
|
key: cacheKey,
|
|
3778
|
-
data:
|
|
3786
|
+
data: serialize(res),
|
|
3779
3787
|
expirationInSeconds: ((_l = options === null || options === void 0 ? void 0 : options.cache) === null || _l === void 0 ? void 0 : _l.ttl) || this.cache.ttlDefault,
|
|
3780
3788
|
});
|
|
3781
3789
|
logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -5096,7 +5104,7 @@ const withGetHasuraGraphQL = (MixinBase) => {
|
|
|
5096
5104
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
5097
5105
|
if (cachedData) {
|
|
5098
5106
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
5099
|
-
return this.model.toInstance(
|
|
5107
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
5100
5108
|
}
|
|
5101
5109
|
}
|
|
5102
5110
|
const instance = this.model.toInstance(identifiers);
|
|
@@ -5122,7 +5130,7 @@ const withGetHasuraGraphQL = (MixinBase) => {
|
|
|
5122
5130
|
const cacheKey = this.generateCacheKey(identifiers);
|
|
5123
5131
|
await this.cache.cacheAdapter.set({
|
|
5124
5132
|
key: cacheKey,
|
|
5125
|
-
data:
|
|
5133
|
+
data: serialize(resultModel),
|
|
5126
5134
|
expirationInSeconds: ((_e = options === null || options === void 0 ? void 0 : options.cache) === null || _e === void 0 ? void 0 : _e.ttl) || this.cache.ttlDefault,
|
|
5127
5135
|
});
|
|
5128
5136
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -5186,7 +5194,7 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
5186
5194
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
5187
5195
|
if (cachedData) {
|
|
5188
5196
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
5189
|
-
return this.bindResult(
|
|
5197
|
+
return this.bindResult(deserialize(cachedData), { enableCount, findOptions, tableFiltersNamed });
|
|
5190
5198
|
}
|
|
5191
5199
|
}
|
|
5192
5200
|
const variablesFilters = isNil(filters)
|
|
@@ -5263,7 +5271,7 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
5263
5271
|
const cacheKey = generateCacheKey(this.model, params);
|
|
5264
5272
|
await this.cache.cacheAdapter.set({
|
|
5265
5273
|
key: cacheKey,
|
|
5266
|
-
data:
|
|
5274
|
+
data: serialize(result),
|
|
5267
5275
|
expirationInSeconds: ((_h = options === null || options === void 0 ? void 0 : options.cache) === null || _h === void 0 ? void 0 : _h.ttl) || this.cache.ttlDefault,
|
|
5268
5276
|
});
|
|
5269
5277
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -5714,7 +5722,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5714
5722
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
5715
5723
|
if (cachedData) {
|
|
5716
5724
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
5717
|
-
return
|
|
5725
|
+
return deserialize(cachedData).map((product) => new ProductHasuraGraphQL(product));
|
|
5718
5726
|
}
|
|
5719
5727
|
}
|
|
5720
5728
|
const fields = [
|
|
@@ -5923,7 +5931,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5923
5931
|
const cacheKey = `${this.model.name.toLowerCase()}:mountCategory:${category.id}:${shop}:${MD5GeneratorHelper.generateMD5(options)}`;
|
|
5924
5932
|
await this.cache.cacheAdapter.set({
|
|
5925
5933
|
key: cacheKey,
|
|
5926
|
-
data:
|
|
5934
|
+
data: serialize(result),
|
|
5927
5935
|
expirationInSeconds: ((_a = optionsCache === null || optionsCache === void 0 ? void 0 : optionsCache.cache) === null || _a === void 0 ? void 0 : _a.ttl) || this.cache.ttlDefault,
|
|
5928
5936
|
});
|
|
5929
5937
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -6479,7 +6487,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6479
6487
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
6480
6488
|
if (cachedData) {
|
|
6481
6489
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
6482
|
-
return this.model.toInstance(
|
|
6490
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
6483
6491
|
}
|
|
6484
6492
|
}
|
|
6485
6493
|
const result = await this.find({
|
|
@@ -6499,7 +6507,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6499
6507
|
const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
|
|
6500
6508
|
await this.cache.cacheAdapter.set({
|
|
6501
6509
|
key: cacheKey,
|
|
6502
|
-
data:
|
|
6510
|
+
data: serialize(product),
|
|
6503
6511
|
expirationInSeconds: ((_f = options === null || options === void 0 ? void 0 : options.cache) === null || _f === void 0 ? void 0 : _f.ttl) || this.cache.ttlDefault,
|
|
6504
6512
|
});
|
|
6505
6513
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -6523,7 +6531,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6523
6531
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
6524
6532
|
if (cachedData) {
|
|
6525
6533
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
6526
|
-
return
|
|
6534
|
+
return deserialize(cachedData).map((review) => new ProductReview(review));
|
|
6527
6535
|
}
|
|
6528
6536
|
}
|
|
6529
6537
|
let data = [];
|
|
@@ -6568,7 +6576,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6568
6576
|
const cacheKey = `${this.model.name.toLowerCase()}:all-reviews:${MD5GeneratorHelper.generateMD5(filters)}`;
|
|
6569
6577
|
await this.cache.cacheAdapter.set({
|
|
6570
6578
|
key: cacheKey,
|
|
6571
|
-
data:
|
|
6579
|
+
data: serialize(filteredReviews),
|
|
6572
6580
|
expirationInSeconds: ((_e = options === null || options === void 0 ? void 0 : options.cache) === null || _e === void 0 ? void 0 : _e.ttl) || this.cache.ttlDefault,
|
|
6573
6581
|
});
|
|
6574
6582
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -6582,7 +6590,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6582
6590
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
6583
6591
|
if (cachedData) {
|
|
6584
6592
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
6585
|
-
return
|
|
6593
|
+
return deserialize(cachedData).map((review) => new ProductReview(review));
|
|
6586
6594
|
}
|
|
6587
6595
|
}
|
|
6588
6596
|
const reviewsExpression = {
|
|
@@ -6605,7 +6613,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6605
6613
|
const cacheKey = `${this.model.name.toLowerCase()}:reviews:${status}`;
|
|
6606
6614
|
await this.cache.cacheAdapter.set({
|
|
6607
6615
|
key: cacheKey,
|
|
6608
|
-
data:
|
|
6616
|
+
data: serialize(reviews),
|
|
6609
6617
|
expirationInSeconds: ((_e = options === null || options === void 0 ? void 0 : options.cache) === null || _e === void 0 ? void 0 : _e.ttl) || this.cache.ttlDefault,
|
|
6610
6618
|
});
|
|
6611
6619
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -6728,7 +6736,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6728
6736
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
6729
6737
|
if (cachedData) {
|
|
6730
6738
|
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
6731
|
-
return
|
|
6739
|
+
return deserialize(cachedData).map((review) => new ProductReview(review));
|
|
6732
6740
|
}
|
|
6733
6741
|
}
|
|
6734
6742
|
const { product_review: data } = await this.query('product_review', this.reviewsFields, {
|
|
@@ -6745,7 +6753,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6745
6753
|
const cacheKey = `${this.model.name.toLowerCase()}:reviews:product:${productId}`;
|
|
6746
6754
|
await this.cache.cacheAdapter.set({
|
|
6747
6755
|
key: cacheKey,
|
|
6748
|
-
data:
|
|
6756
|
+
data: serialize(reviews),
|
|
6749
6757
|
expirationInSeconds: ((_e = options === null || options === void 0 ? void 0 : options.cache) === null || _e === void 0 ? void 0 : _e.ttl) || this.cache.ttlDefault,
|
|
6750
6758
|
});
|
|
6751
6759
|
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
@@ -7861,4 +7869,4 @@ class ProductsVertexSearch {
|
|
|
7861
7869
|
}
|
|
7862
7870
|
}
|
|
7863
7871
|
|
|
7864
|
-
export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
7872
|
+
export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infrab4a/connect",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.1-beta.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"gql-query-builder": "3.7.0",
|
|
18
18
|
"lodash": "^4.17.21",
|
|
19
19
|
"reflect-metadata": "^0.1.13",
|
|
20
|
+
"serialize-javascript": "^6.0.2",
|
|
20
21
|
"ts-custom-error": "3.2.2",
|
|
21
22
|
"ts-md5": "^1.2.9",
|
|
22
23
|
"tslib": "^2.4.0"
|
|
@@ -5,7 +5,7 @@ import { FirestoreRepository, FirestoreSubRepository } from '../types';
|
|
|
5
5
|
export declare const withHelpers: <TMixinBase extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: MixinCtor<any, any[]> & TMixinBase) => {
|
|
6
6
|
new (...args: any[]): {
|
|
7
7
|
[x: string]: any;
|
|
8
|
-
toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T> | QueryDocumentSnapshot<T>[]): T[];
|
|
8
|
+
toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T, import("firebase/firestore").DocumentData> | QueryDocumentSnapshot<T, import("firebase/firestore").DocumentData>[]): T[];
|
|
9
9
|
isSubCollection<T_1 extends ModelBaseStructure<T_1, T_1["identifiersFields"][number]>, E extends ModelBaseStructure<E, E["identifiersFields"][number]>>(repository: FirestoreRepository<T_1> | FirestoreSubRepository<T_1, E>): repository is FirestoreSubRepository<T_1, E>;
|
|
10
10
|
};
|
|
11
11
|
} & TMixinBase;
|
package/src/utils/index.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export * from './is-uuid';
|
|
|
10
10
|
export * from './log.utils';
|
|
11
11
|
export * from './mixins';
|
|
12
12
|
export * from './parse-datetime';
|
|
13
|
+
export * from './serialize';
|
|
13
14
|
export * from './types';
|
|
14
15
|
export { add, addBusinessDays, addDays, addMonths, addYears, chunk, each, endOfDay, format, formatISO9075, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, parseISO, pick, set, sortBy, startOfDay, sub, subDays, unset, };
|