@infrab4a/connect 5.4.0-beta.5 → 5.4.0-beta.7
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 +7 -19
- package/index.esm.js +7 -19
- package/package.json +1 -1
- package/src/domain/catalog/models/product-base.d.ts +1 -0
- package/src/domain/catalog/models/variant.d.ts +0 -1
- package/src/domain/shopping/models/order.d.ts +1 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -3392,8 +3392,6 @@ class HasuraQueryBuilderHelper {
|
|
|
3392
3392
|
class HasuraRequestHelper {
|
|
3393
3393
|
static async fetch(params) {
|
|
3394
3394
|
const { variables, query, endpoint, headers, logger } = params;
|
|
3395
|
-
console.warn('variables', variables);
|
|
3396
|
-
console.warn('query', query);
|
|
3397
3395
|
const request = {
|
|
3398
3396
|
url: endpoint,
|
|
3399
3397
|
method: 'POST',
|
|
@@ -7386,6 +7384,7 @@ const commonFields$1 = [
|
|
|
7386
7384
|
{ tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7387
7385
|
{ daysOfUse: { columnName: 'days_of_use' } },
|
|
7388
7386
|
{ showVariants: { columnName: 'show_variants' } },
|
|
7387
|
+
{ variantSlug: { columnName: 'variant_slug' } },
|
|
7389
7388
|
];
|
|
7390
7389
|
class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
7391
7390
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
@@ -7714,6 +7713,7 @@ const commonFields = [
|
|
|
7714
7713
|
{ tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7715
7714
|
{ daysOfUse: { columnName: 'days_of_use' } },
|
|
7716
7715
|
{ showVariants: { columnName: 'show_variants' } },
|
|
7716
|
+
{ variantSlug: { columnName: 'variant_slug' } },
|
|
7717
7717
|
];
|
|
7718
7718
|
const fieldsConfiguration$2 = [
|
|
7719
7719
|
...commonFields,
|
|
@@ -7969,7 +7969,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7969
7969
|
? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }, options))
|
|
7970
7970
|
.data?.[0]
|
|
7971
7971
|
: await super.get(identifiers, options);
|
|
7972
|
-
|
|
7972
|
+
if (product.productId)
|
|
7973
|
+
throw new NotFoundError('Product not found, it is a variant');
|
|
7973
7974
|
product.reviews =
|
|
7974
7975
|
product.reviews ||
|
|
7975
7976
|
(await this.findReviewsByProduct(product.productId ? +product.productId : +product.id, false, options));
|
|
@@ -8016,6 +8017,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
8016
8017
|
const result = await this.find({
|
|
8017
8018
|
filters: {
|
|
8018
8019
|
slug,
|
|
8020
|
+
productId: {
|
|
8021
|
+
operator: exports.Where.ISNULL,
|
|
8022
|
+
},
|
|
8019
8023
|
},
|
|
8020
8024
|
fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
|
|
8021
8025
|
options: {
|
|
@@ -8025,11 +8029,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
8025
8029
|
if (!result.data.length)
|
|
8026
8030
|
return null;
|
|
8027
8031
|
const product = result?.data?.shift();
|
|
8028
|
-
if (product.productId) ;
|
|
8029
|
-
console.warn('product getBySlug', product);
|
|
8030
|
-
console.warn('vai entrar', !product.reviews.length && product.rate > 0);
|
|
8031
8032
|
if (!product.reviews.length && product.rate > 0) {
|
|
8032
|
-
console.warn('entrou');
|
|
8033
8033
|
product.reviews = await this.findReviewsByProduct((product.productId ? product.productId : product.id), true);
|
|
8034
8034
|
}
|
|
8035
8035
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
@@ -8044,18 +8044,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
8044
8044
|
}
|
|
8045
8045
|
return product;
|
|
8046
8046
|
}
|
|
8047
|
-
async getBySlugVariantData(product) {
|
|
8048
|
-
if (!product.reviews.length && product.rate > 0) {
|
|
8049
|
-
product.reviews = await this.findReviewsByProduct((product.productId ? product.productId : product.id), true);
|
|
8050
|
-
}
|
|
8051
|
-
// if (!product.metadata) {
|
|
8052
|
-
// product.metadata = await this.findReviewsByProduct(
|
|
8053
|
-
// (product.productId ? product.productId : product.id) as number,
|
|
8054
|
-
// true,
|
|
8055
|
-
// )
|
|
8056
|
-
// }
|
|
8057
|
-
return product;
|
|
8058
|
-
}
|
|
8059
8047
|
async getByEAN(EAN, options) {
|
|
8060
8048
|
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
8061
8049
|
const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
|
package/index.esm.js
CHANGED
|
@@ -3368,8 +3368,6 @@ class HasuraQueryBuilderHelper {
|
|
|
3368
3368
|
class HasuraRequestHelper {
|
|
3369
3369
|
static async fetch(params) {
|
|
3370
3370
|
const { variables, query, endpoint, headers, logger } = params;
|
|
3371
|
-
console.warn('variables', variables);
|
|
3372
|
-
console.warn('query', query);
|
|
3373
3371
|
const request = {
|
|
3374
3372
|
url: endpoint,
|
|
3375
3373
|
method: 'POST',
|
|
@@ -7362,6 +7360,7 @@ const commonFields$1 = [
|
|
|
7362
7360
|
{ tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7363
7361
|
{ daysOfUse: { columnName: 'days_of_use' } },
|
|
7364
7362
|
{ showVariants: { columnName: 'show_variants' } },
|
|
7363
|
+
{ variantSlug: { columnName: 'variant_slug' } },
|
|
7365
7364
|
];
|
|
7366
7365
|
class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
7367
7366
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
@@ -7690,6 +7689,7 @@ const commonFields = [
|
|
|
7690
7689
|
{ tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7691
7690
|
{ daysOfUse: { columnName: 'days_of_use' } },
|
|
7692
7691
|
{ showVariants: { columnName: 'show_variants' } },
|
|
7692
|
+
{ variantSlug: { columnName: 'variant_slug' } },
|
|
7693
7693
|
];
|
|
7694
7694
|
const fieldsConfiguration$2 = [
|
|
7695
7695
|
...commonFields,
|
|
@@ -7945,7 +7945,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7945
7945
|
? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }, options))
|
|
7946
7946
|
.data?.[0]
|
|
7947
7947
|
: await super.get(identifiers, options);
|
|
7948
|
-
|
|
7948
|
+
if (product.productId)
|
|
7949
|
+
throw new NotFoundError('Product not found, it is a variant');
|
|
7949
7950
|
product.reviews =
|
|
7950
7951
|
product.reviews ||
|
|
7951
7952
|
(await this.findReviewsByProduct(product.productId ? +product.productId : +product.id, false, options));
|
|
@@ -7992,6 +7993,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7992
7993
|
const result = await this.find({
|
|
7993
7994
|
filters: {
|
|
7994
7995
|
slug,
|
|
7996
|
+
productId: {
|
|
7997
|
+
operator: Where.ISNULL,
|
|
7998
|
+
},
|
|
7995
7999
|
},
|
|
7996
8000
|
fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
|
|
7997
8001
|
options: {
|
|
@@ -8001,11 +8005,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
8001
8005
|
if (!result.data.length)
|
|
8002
8006
|
return null;
|
|
8003
8007
|
const product = result?.data?.shift();
|
|
8004
|
-
if (product.productId) ;
|
|
8005
|
-
console.warn('product getBySlug', product);
|
|
8006
|
-
console.warn('vai entrar', !product.reviews.length && product.rate > 0);
|
|
8007
8008
|
if (!product.reviews.length && product.rate > 0) {
|
|
8008
|
-
console.warn('entrou');
|
|
8009
8009
|
product.reviews = await this.findReviewsByProduct((product.productId ? product.productId : product.id), true);
|
|
8010
8010
|
}
|
|
8011
8011
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
@@ -8020,18 +8020,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
8020
8020
|
}
|
|
8021
8021
|
return product;
|
|
8022
8022
|
}
|
|
8023
|
-
async getBySlugVariantData(product) {
|
|
8024
|
-
if (!product.reviews.length && product.rate > 0) {
|
|
8025
|
-
product.reviews = await this.findReviewsByProduct((product.productId ? product.productId : product.id), true);
|
|
8026
|
-
}
|
|
8027
|
-
// if (!product.metadata) {
|
|
8028
|
-
// product.metadata = await this.findReviewsByProduct(
|
|
8029
|
-
// (product.productId ? product.productId : product.id) as number,
|
|
8030
|
-
// true,
|
|
8031
|
-
// )
|
|
8032
|
-
// }
|
|
8033
|
-
return product;
|
|
8034
|
-
}
|
|
8035
8023
|
async getByEAN(EAN, options) {
|
|
8036
8024
|
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
8037
8025
|
const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
|
package/package.json
CHANGED
|
@@ -4,6 +4,5 @@ export type ProductVariantIdentifiers = 'id' | 'productId';
|
|
|
4
4
|
export declare class Variant extends ProductBase<Variant, ProductVariantIdentifiers> {
|
|
5
5
|
productId: string;
|
|
6
6
|
grade?: VariantGrade[];
|
|
7
|
-
variantSlug?: string;
|
|
8
7
|
static get identifiersFields(): ProductVariantIdentifiers[];
|
|
9
8
|
}
|
package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export declare class ProductHasuraGraphQLRepository extends ProductHasuraGraphQL
|
|
|
15
15
|
getBySlug(slug: string, options?: {
|
|
16
16
|
cache?: RepositoryCacheOptions;
|
|
17
17
|
}): Promise<ProductHasuraGraphQL>;
|
|
18
|
-
private getBySlugVariantData;
|
|
19
18
|
getByEAN(EAN: string, options?: {
|
|
20
19
|
cache?: RepositoryCacheOptions;
|
|
21
20
|
}): Promise<ProductHasuraGraphQL>;
|