@infrab4a/connect 4.3.9-beta.4 → 4.3.10-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +50 -35
- package/index.esm.js +50 -35
- package/package.json +1 -1
- package/src/domain/catalog/repositories/product.repository.d.ts +0 -13
- package/src/domain/generic/repository/enums/where.enum.d.ts +2 -1
- package/src/domain/generic/repository/types/repository-find-filters.type.d.ts +2 -0
- package/src/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/enums/hasura-graphql-where.enum.d.ts +4 -1
- package/src/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +2 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +0 -2
package/index.cjs.js
CHANGED
|
@@ -237,6 +237,7 @@ exports.Where = void 0;
|
|
|
237
237
|
Where["NOTLIKE"] = "not like";
|
|
238
238
|
Where["ISNULL"] = "is null";
|
|
239
239
|
Where["ISNOTNULL"] = "is not null";
|
|
240
|
+
Where["IREGEX"] = "iregex";
|
|
240
241
|
})(exports.Where || (exports.Where = {}));
|
|
241
242
|
|
|
242
243
|
exports.UpdateOptionActions = void 0;
|
|
@@ -3168,9 +3169,6 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3168
3169
|
});
|
|
3169
3170
|
this.reviews = {};
|
|
3170
3171
|
}
|
|
3171
|
-
fetchProductReviews(filters) {
|
|
3172
|
-
throw new Error('Method not implemented.');
|
|
3173
|
-
}
|
|
3174
3172
|
async getBySlug(slug) {
|
|
3175
3173
|
var _a;
|
|
3176
3174
|
const result = await this.find({
|
|
@@ -3212,9 +3210,6 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3212
3210
|
findCatalog(params) {
|
|
3213
3211
|
return this.find(params);
|
|
3214
3212
|
}
|
|
3215
|
-
async fetchPaginatedReviews() {
|
|
3216
|
-
return Promise.resolve([]);
|
|
3217
|
-
}
|
|
3218
3213
|
}
|
|
3219
3214
|
|
|
3220
3215
|
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
@@ -3529,11 +3524,14 @@ var HasuraGraphQLWhere;
|
|
|
3529
3524
|
HasuraGraphQLWhere["LT"] = "_lt";
|
|
3530
3525
|
HasuraGraphQLWhere["LTE"] = "_lte";
|
|
3531
3526
|
HasuraGraphQLWhere["LIKE"] = "_like";
|
|
3527
|
+
HasuraGraphQLWhere["ILIKE"] = "_ilike";
|
|
3532
3528
|
HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
|
|
3533
3529
|
HasuraGraphQLWhere["ISNULL"] = "_is_null";
|
|
3534
3530
|
HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
|
|
3535
3531
|
HasuraGraphQLWhere["JSON_CONTAINS"] = "_contains";
|
|
3536
3532
|
HasuraGraphQLWhere["JSON_HAS_KEYS_ANY"] = "_has_keys_any";
|
|
3533
|
+
HasuraGraphQLWhere["IREGEX"] = "_iregex";
|
|
3534
|
+
HasuraGraphQLWhere["REGEX"] = "_regex";
|
|
3537
3535
|
})(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
|
|
3538
3536
|
|
|
3539
3537
|
var HasuraGraphQLColumnType;
|
|
@@ -3561,13 +3559,48 @@ FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
|
|
|
3561
3559
|
return false;
|
|
3562
3560
|
const converter = fieldOption.to
|
|
3563
3561
|
? fieldOption.to
|
|
3564
|
-
: (value) =>
|
|
3565
|
-
? `%${value}%`
|
|
3566
|
-
|
|
3562
|
+
: (value) => {
|
|
3563
|
+
const newValue = filter.ignoreCase && !Array.isArray(filter.value) && value.indexOf('%') < 0 ? `%${value}%` : value;
|
|
3564
|
+
return filter.ignoreAccent && !Array.isArray(filter.value)
|
|
3565
|
+
? FilterOptionHelper.buildInsensitiveLike(newValue)
|
|
3566
|
+
: newValue;
|
|
3567
|
+
};
|
|
3567
3568
|
return Array.isArray(filter.value) && !fieldOption.fields && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
|
|
3568
3569
|
? filter.value.map((fieldValue) => converter(fieldValue))
|
|
3569
3570
|
: converter(filter.value);
|
|
3570
3571
|
};
|
|
3572
|
+
FilterOptionHelper.buildInsensitiveLike = (value) => {
|
|
3573
|
+
const valueWithoutAccents = FilterOptionHelper.removeAccents(value);
|
|
3574
|
+
let result = '';
|
|
3575
|
+
for (const char of valueWithoutAccents) {
|
|
3576
|
+
const allCharOptions = [];
|
|
3577
|
+
if (['a', 'e', 'i', 'o', 'u', 'c', 'A', 'E', 'I', 'O', 'U', 'C'].includes(char)) {
|
|
3578
|
+
const charOptions = {
|
|
3579
|
+
a: ['á', 'â', 'ã', 'à', 'a'],
|
|
3580
|
+
e: ['é', 'ê', 'ẽ', 'è', 'e'],
|
|
3581
|
+
i: ['í', 'î', 'ĩ', 'ì', 'i'],
|
|
3582
|
+
o: ['ó', 'ô', 'õ', 'ò', 'o'],
|
|
3583
|
+
u: ['ú', 'û', 'ũ', 'ù', 'u'],
|
|
3584
|
+
c: ['ç', 'c'],
|
|
3585
|
+
A: ['Á', 'Â', 'Ã', 'À', 'A'],
|
|
3586
|
+
E: ['É', 'Ê', 'Ẽ', 'È', 'E'],
|
|
3587
|
+
I: ['Í', 'Î', 'Ĩ', 'Ì', 'I'],
|
|
3588
|
+
O: ['Ó', 'Ô', 'Õ', 'Ò', 'O'],
|
|
3589
|
+
U: ['Ú', 'Û', 'Ũ', 'Ù', 'U'],
|
|
3590
|
+
C: ['Ç', 'C'],
|
|
3591
|
+
};
|
|
3592
|
+
allCharOptions.push(...charOptions[char]);
|
|
3593
|
+
result += `[${allCharOptions.join('')}]`;
|
|
3594
|
+
}
|
|
3595
|
+
else {
|
|
3596
|
+
result += char;
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
return result;
|
|
3600
|
+
};
|
|
3601
|
+
FilterOptionHelper.removeAccents = (text) => {
|
|
3602
|
+
return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
3603
|
+
};
|
|
3571
3604
|
|
|
3572
3605
|
class BindFilterQueryHelper {
|
|
3573
3606
|
}
|
|
@@ -3610,8 +3643,14 @@ BindFilterQueryHelper.BuildOperatorSentence = (options, fieldOption) => ({
|
|
|
3610
3643
|
BindFilterQueryHelper.GetHasuraOperator = (options, fieldOption) => FilterOptionHelper.CheckIfIsFilterOption(options)
|
|
3611
3644
|
? fieldOption.type === HasuraGraphQLColumnType.Jsonb
|
|
3612
3645
|
? BindFilterQueryHelper.GetHasuraJsonbOperator(options)
|
|
3613
|
-
:
|
|
3614
|
-
|
|
3646
|
+
: options.operator === exports.Where.LIKE && options.ignoreCase && options.ignoreAccent
|
|
3647
|
+
? HasuraGraphQLWhere.IREGEX
|
|
3648
|
+
: options.operator === exports.Where.LIKE && options.ignoreAccent
|
|
3649
|
+
? HasuraGraphQLWhere.REGEX
|
|
3650
|
+
: options.operator === exports.Where.LIKE && options.ignoreCase
|
|
3651
|
+
? HasuraGraphQLWhere.ILIKE
|
|
3652
|
+
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
|
|
3653
|
+
Object.keys(exports.Where).find((operator) => exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
|
|
3615
3654
|
: HasuraGraphQLWhere.EQUALS;
|
|
3616
3655
|
BindFilterQueryHelper.GetHasuraJsonbOperator = (options) => options.operator === exports.Where.IN
|
|
3617
3656
|
? HasuraGraphQLWhere.JSON_CONTAINS
|
|
@@ -5024,30 +5063,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5024
5063
|
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
5025
5064
|
return product;
|
|
5026
5065
|
}
|
|
5027
|
-
async fetchProductReviews() {
|
|
5028
|
-
let data = [];
|
|
5029
|
-
let count = 0;
|
|
5030
|
-
let offset = 0;
|
|
5031
|
-
const limit = 500;
|
|
5032
|
-
do {
|
|
5033
|
-
const result = await super.find(Object.assign({ fields: ['id', 'name', 'sku', 'reviews'] }, ({
|
|
5034
|
-
limits: {
|
|
5035
|
-
offset,
|
|
5036
|
-
limit,
|
|
5037
|
-
},
|
|
5038
|
-
})));
|
|
5039
|
-
data = data.concat(result.data);
|
|
5040
|
-
count = result.data.length;
|
|
5041
|
-
offset += limit;
|
|
5042
|
-
} while (count === limit);
|
|
5043
|
-
return data.reduce((reviews, product) => [
|
|
5044
|
-
...reviews,
|
|
5045
|
-
...product.reviews.map((review) => (Object.assign(Object.assign({}, review), { reviewStatus: this.getReviewStatus(review), productId: product.id, productName: product.name, productSku: product.sku }))),
|
|
5046
|
-
], []);
|
|
5047
|
-
}
|
|
5048
|
-
getReviewStatus(review) {
|
|
5049
|
-
return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
|
|
5050
|
-
}
|
|
5051
5066
|
async fetchReviews(status) {
|
|
5052
5067
|
const reviewsExpression = {
|
|
5053
5068
|
status: status === 'pending'
|
package/index.esm.js
CHANGED
|
@@ -231,6 +231,7 @@ var Where;
|
|
|
231
231
|
Where["NOTLIKE"] = "not like";
|
|
232
232
|
Where["ISNULL"] = "is null";
|
|
233
233
|
Where["ISNOTNULL"] = "is not null";
|
|
234
|
+
Where["IREGEX"] = "iregex";
|
|
234
235
|
})(Where || (Where = {}));
|
|
235
236
|
|
|
236
237
|
var UpdateOptionActions;
|
|
@@ -3162,9 +3163,6 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3162
3163
|
});
|
|
3163
3164
|
this.reviews = {};
|
|
3164
3165
|
}
|
|
3165
|
-
fetchProductReviews(filters) {
|
|
3166
|
-
throw new Error('Method not implemented.');
|
|
3167
|
-
}
|
|
3168
3166
|
async getBySlug(slug) {
|
|
3169
3167
|
var _a;
|
|
3170
3168
|
const result = await this.find({
|
|
@@ -3206,9 +3204,6 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3206
3204
|
findCatalog(params) {
|
|
3207
3205
|
return this.find(params);
|
|
3208
3206
|
}
|
|
3209
|
-
async fetchPaginatedReviews() {
|
|
3210
|
-
return Promise.resolve([]);
|
|
3211
|
-
}
|
|
3212
3207
|
}
|
|
3213
3208
|
|
|
3214
3209
|
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
@@ -3523,11 +3518,14 @@ var HasuraGraphQLWhere;
|
|
|
3523
3518
|
HasuraGraphQLWhere["LT"] = "_lt";
|
|
3524
3519
|
HasuraGraphQLWhere["LTE"] = "_lte";
|
|
3525
3520
|
HasuraGraphQLWhere["LIKE"] = "_like";
|
|
3521
|
+
HasuraGraphQLWhere["ILIKE"] = "_ilike";
|
|
3526
3522
|
HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
|
|
3527
3523
|
HasuraGraphQLWhere["ISNULL"] = "_is_null";
|
|
3528
3524
|
HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
|
|
3529
3525
|
HasuraGraphQLWhere["JSON_CONTAINS"] = "_contains";
|
|
3530
3526
|
HasuraGraphQLWhere["JSON_HAS_KEYS_ANY"] = "_has_keys_any";
|
|
3527
|
+
HasuraGraphQLWhere["IREGEX"] = "_iregex";
|
|
3528
|
+
HasuraGraphQLWhere["REGEX"] = "_regex";
|
|
3531
3529
|
})(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
|
|
3532
3530
|
|
|
3533
3531
|
var HasuraGraphQLColumnType;
|
|
@@ -3555,13 +3553,48 @@ FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
|
|
|
3555
3553
|
return false;
|
|
3556
3554
|
const converter = fieldOption.to
|
|
3557
3555
|
? fieldOption.to
|
|
3558
|
-
: (value) =>
|
|
3559
|
-
? `%${value}%`
|
|
3560
|
-
|
|
3556
|
+
: (value) => {
|
|
3557
|
+
const newValue = filter.ignoreCase && !Array.isArray(filter.value) && value.indexOf('%') < 0 ? `%${value}%` : value;
|
|
3558
|
+
return filter.ignoreAccent && !Array.isArray(filter.value)
|
|
3559
|
+
? FilterOptionHelper.buildInsensitiveLike(newValue)
|
|
3560
|
+
: newValue;
|
|
3561
|
+
};
|
|
3561
3562
|
return Array.isArray(filter.value) && !fieldOption.fields && [Where.IN, Where.NOTIN].includes(filter.operator)
|
|
3562
3563
|
? filter.value.map((fieldValue) => converter(fieldValue))
|
|
3563
3564
|
: converter(filter.value);
|
|
3564
3565
|
};
|
|
3566
|
+
FilterOptionHelper.buildInsensitiveLike = (value) => {
|
|
3567
|
+
const valueWithoutAccents = FilterOptionHelper.removeAccents(value);
|
|
3568
|
+
let result = '';
|
|
3569
|
+
for (const char of valueWithoutAccents) {
|
|
3570
|
+
const allCharOptions = [];
|
|
3571
|
+
if (['a', 'e', 'i', 'o', 'u', 'c', 'A', 'E', 'I', 'O', 'U', 'C'].includes(char)) {
|
|
3572
|
+
const charOptions = {
|
|
3573
|
+
a: ['á', 'â', 'ã', 'à', 'a'],
|
|
3574
|
+
e: ['é', 'ê', 'ẽ', 'è', 'e'],
|
|
3575
|
+
i: ['í', 'î', 'ĩ', 'ì', 'i'],
|
|
3576
|
+
o: ['ó', 'ô', 'õ', 'ò', 'o'],
|
|
3577
|
+
u: ['ú', 'û', 'ũ', 'ù', 'u'],
|
|
3578
|
+
c: ['ç', 'c'],
|
|
3579
|
+
A: ['Á', 'Â', 'Ã', 'À', 'A'],
|
|
3580
|
+
E: ['É', 'Ê', 'Ẽ', 'È', 'E'],
|
|
3581
|
+
I: ['Í', 'Î', 'Ĩ', 'Ì', 'I'],
|
|
3582
|
+
O: ['Ó', 'Ô', 'Õ', 'Ò', 'O'],
|
|
3583
|
+
U: ['Ú', 'Û', 'Ũ', 'Ù', 'U'],
|
|
3584
|
+
C: ['Ç', 'C'],
|
|
3585
|
+
};
|
|
3586
|
+
allCharOptions.push(...charOptions[char]);
|
|
3587
|
+
result += `[${allCharOptions.join('')}]`;
|
|
3588
|
+
}
|
|
3589
|
+
else {
|
|
3590
|
+
result += char;
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
return result;
|
|
3594
|
+
};
|
|
3595
|
+
FilterOptionHelper.removeAccents = (text) => {
|
|
3596
|
+
return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
3597
|
+
};
|
|
3565
3598
|
|
|
3566
3599
|
class BindFilterQueryHelper {
|
|
3567
3600
|
}
|
|
@@ -3604,8 +3637,14 @@ BindFilterQueryHelper.BuildOperatorSentence = (options, fieldOption) => ({
|
|
|
3604
3637
|
BindFilterQueryHelper.GetHasuraOperator = (options, fieldOption) => FilterOptionHelper.CheckIfIsFilterOption(options)
|
|
3605
3638
|
? fieldOption.type === HasuraGraphQLColumnType.Jsonb
|
|
3606
3639
|
? BindFilterQueryHelper.GetHasuraJsonbOperator(options)
|
|
3607
|
-
:
|
|
3608
|
-
|
|
3640
|
+
: options.operator === Where.LIKE && options.ignoreCase && options.ignoreAccent
|
|
3641
|
+
? HasuraGraphQLWhere.IREGEX
|
|
3642
|
+
: options.operator === Where.LIKE && options.ignoreAccent
|
|
3643
|
+
? HasuraGraphQLWhere.REGEX
|
|
3644
|
+
: options.operator === Where.LIKE && options.ignoreCase
|
|
3645
|
+
? HasuraGraphQLWhere.ILIKE
|
|
3646
|
+
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
|
|
3647
|
+
Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
|
|
3609
3648
|
: HasuraGraphQLWhere.EQUALS;
|
|
3610
3649
|
BindFilterQueryHelper.GetHasuraJsonbOperator = (options) => options.operator === Where.IN
|
|
3611
3650
|
? HasuraGraphQLWhere.JSON_CONTAINS
|
|
@@ -5018,30 +5057,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5018
5057
|
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
5019
5058
|
return product;
|
|
5020
5059
|
}
|
|
5021
|
-
async fetchProductReviews() {
|
|
5022
|
-
let data = [];
|
|
5023
|
-
let count = 0;
|
|
5024
|
-
let offset = 0;
|
|
5025
|
-
const limit = 500;
|
|
5026
|
-
do {
|
|
5027
|
-
const result = await super.find(Object.assign({ fields: ['id', 'name', 'sku', 'reviews'] }, ({
|
|
5028
|
-
limits: {
|
|
5029
|
-
offset,
|
|
5030
|
-
limit,
|
|
5031
|
-
},
|
|
5032
|
-
})));
|
|
5033
|
-
data = data.concat(result.data);
|
|
5034
|
-
count = result.data.length;
|
|
5035
|
-
offset += limit;
|
|
5036
|
-
} while (count === limit);
|
|
5037
|
-
return data.reduce((reviews, product) => [
|
|
5038
|
-
...reviews,
|
|
5039
|
-
...product.reviews.map((review) => (Object.assign(Object.assign({}, review), { reviewStatus: this.getReviewStatus(review), productId: product.id, productName: product.name, productSku: product.sku }))),
|
|
5040
|
-
], []);
|
|
5041
|
-
}
|
|
5042
|
-
getReviewStatus(review) {
|
|
5043
|
-
return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
|
|
5044
|
-
}
|
|
5045
5060
|
async fetchReviews(status) {
|
|
5046
5061
|
const reviewsExpression = {
|
|
5047
5062
|
status: status === 'pending'
|
package/package.json
CHANGED
|
@@ -6,23 +6,10 @@ export type ReviewWithProductData = ProductReview & {
|
|
|
6
6
|
productId: string;
|
|
7
7
|
productName: string;
|
|
8
8
|
productSku: string;
|
|
9
|
-
reviewStatus?: 'pending' | 'approved' | 'rejected';
|
|
10
|
-
};
|
|
11
|
-
export type PaginatedReviewFilters = {
|
|
12
|
-
sku?: string;
|
|
13
|
-
status: ReviewStatusParams;
|
|
14
|
-
email?: string;
|
|
15
|
-
rate?: number;
|
|
16
|
-
period?: {
|
|
17
|
-
start: Date;
|
|
18
|
-
end: Date;
|
|
19
|
-
};
|
|
20
|
-
limit?: number;
|
|
21
9
|
};
|
|
22
10
|
export interface ProductRepository extends CrudRepository<Product> {
|
|
23
11
|
getBySlug(slug: string): Promise<Product>;
|
|
24
12
|
fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
|
|
25
|
-
fetchProductReviews(filters: PaginatedReviewFilters): Promise<ReviewWithProductData[]>;
|
|
26
13
|
cleanShoppingCountFromIds(ids: string[]): Promise<any>;
|
|
27
14
|
findCatalog(params: FindRepositoryParams<Product>, mainGender?: Extract<ProductGender, 'female' | 'male' | 'unisex'>): Promise<RepositoryFindResult<Product>>;
|
|
28
15
|
}
|
|
@@ -5,6 +5,8 @@ import { Where } from '../enums/where.enum';
|
|
|
5
5
|
export type RepositoryFindFieltersOptions<Model, FieldName extends keyof Model> = {
|
|
6
6
|
operator: Where;
|
|
7
7
|
value?: PropType<Model, FieldName> | PropType<Model, FieldName>[];
|
|
8
|
+
ignoreCase?: boolean;
|
|
9
|
+
ignoreAccent?: boolean;
|
|
8
10
|
};
|
|
9
11
|
export type RepositoryFindField<Model, FieldName extends keyof Model> = RepositoryFindFieltersOptions<Model, FieldName> | RepositoryFindFieltersOptions<Model, FieldName>[] | Partial<PropType<Model, FieldName>>;
|
|
10
12
|
export type NestedRepositoryFindFieltersOptions<Model> = {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { FindRepositoryParams,
|
|
1
|
+
import { FindRepositoryParams, Product, ProductRepository, RepositoryFindResult, ReviewStatusParams, ReviewWithProductData } from '../../../../../domain';
|
|
2
2
|
import { FirestoreConstructorParams } from '../../mixins';
|
|
3
3
|
declare const ProductFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../..").FirestoreRepository<Product> & import("../../../../../domain").CrudRepository<Product, import("../../../../../domain").CrudParams<Product>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<Product>, ...any[]]>;
|
|
4
4
|
export declare class ProductFirestoreRepository extends ProductFirestoreRepository_base implements ProductRepository {
|
|
5
5
|
private reviews;
|
|
6
6
|
constructor({ firestore, interceptors }: Pick<FirestoreConstructorParams<Product>, 'firestore' | 'interceptors'>);
|
|
7
|
-
fetchProductReviews(filters: PaginatedReviewFilters): Promise<ReviewWithProductData[]>;
|
|
8
7
|
getBySlug(slug: string): Promise<Product>;
|
|
9
8
|
fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
|
|
10
9
|
cleanShoppingCountFromIds(): Promise<void>;
|
|
11
10
|
findCatalog(params: FindRepositoryParams<Product>): Promise<RepositoryFindResult<Product>>;
|
|
12
|
-
fetchPaginatedReviews(): Promise<ReviewWithProductData[]>;
|
|
13
11
|
}
|
|
14
12
|
export {};
|
|
@@ -7,9 +7,12 @@ export declare enum HasuraGraphQLWhere {
|
|
|
7
7
|
LT = "_lt",
|
|
8
8
|
LTE = "_lte",
|
|
9
9
|
LIKE = "_like",
|
|
10
|
+
ILIKE = "_ilike",
|
|
10
11
|
NOTLIKE = "_nlike",
|
|
11
12
|
ISNULL = "_is_null",
|
|
12
13
|
ISNOTNULL = "_is_null",
|
|
13
14
|
JSON_CONTAINS = "_contains",
|
|
14
|
-
JSON_HAS_KEYS_ANY = "_has_keys_any"
|
|
15
|
+
JSON_HAS_KEYS_ANY = "_has_keys_any",
|
|
16
|
+
IREGEX = "_iregex",
|
|
17
|
+
REGEX = "_regex"
|
|
15
18
|
}
|
|
@@ -3,4 +3,6 @@ import { ColumnOptions } from '../../types';
|
|
|
3
3
|
export declare class FilterOptionHelper {
|
|
4
4
|
static CheckIfIsFilterOption: <Model extends ModelBaseStructure>(filter: any) => filter is RepositoryFindFieltersOptions<Model, any>;
|
|
5
5
|
static GetValueFromFilter: <Model extends ModelBaseStructure<Model>>(filter: RepositoryFindFieltersOptions<Model, any>, fieldOption: ColumnOptions<any, any>) => any;
|
|
6
|
+
private static buildInsensitiveLike;
|
|
7
|
+
private static removeAccents;
|
|
6
8
|
}
|
package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts
CHANGED
|
@@ -12,8 +12,6 @@ export declare class ProductHasuraGraphQLRepository extends ProductHasuraGraphQL
|
|
|
12
12
|
find(params?: FindRepositoryParams<ProductHasuraGraphQL>): Promise<RepositoryFindResult<ProductHasuraGraphQL>>;
|
|
13
13
|
getBySlug(slug: string): Promise<ProductHasuraGraphQL>;
|
|
14
14
|
update(params: UpdateRepositoryParams<ProductHasuraGraphQL>): Promise<ProductHasuraGraphQL>;
|
|
15
|
-
fetchProductReviews(): Promise<ReviewWithProductData[]>;
|
|
16
|
-
private getReviewStatus;
|
|
17
15
|
fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
|
|
18
16
|
findCatalog(params: FindRepositoryParams<ProductHasuraGraphQL>, mainGender?: Extract<ProductGender, 'female' | 'male'>): Promise<RepositoryFindResult<ProductHasuraGraphQL>>;
|
|
19
17
|
private updateCategories;
|