@infrab4a/connect 5.4.0-beta.6 → 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 CHANGED
@@ -7384,6 +7384,7 @@ const commonFields$1 = [
7384
7384
  { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7385
7385
  { daysOfUse: { columnName: 'days_of_use' } },
7386
7386
  { showVariants: { columnName: 'show_variants' } },
7387
+ { variantSlug: { columnName: 'variant_slug' } },
7387
7388
  ];
7388
7389
  class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHasuraGraphQL(Base)) {
7389
7390
  constructor({ endpoint, authOptions, interceptors, cache, }) {
@@ -7712,6 +7713,7 @@ const commonFields = [
7712
7713
  { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7713
7714
  { daysOfUse: { columnName: 'days_of_use' } },
7714
7715
  { showVariants: { columnName: 'show_variants' } },
7716
+ { variantSlug: { columnName: 'variant_slug' } },
7715
7717
  ];
7716
7718
  const fieldsConfiguration$2 = [
7717
7719
  ...commonFields,
@@ -7967,7 +7969,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7967
7969
  ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }, options))
7968
7970
  .data?.[0]
7969
7971
  : await super.get(identifiers, options);
7970
- // if (product.productId) throw new NotFoundError('Product not found, it is a variant')
7972
+ if (product.productId)
7973
+ throw new NotFoundError('Product not found, it is a variant');
7971
7974
  product.reviews =
7972
7975
  product.reviews ||
7973
7976
  (await this.findReviewsByProduct(product.productId ? +product.productId : +product.id, false, options));
@@ -8041,18 +8044,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8041
8044
  }
8042
8045
  return product;
8043
8046
  }
8044
- async getBySlugVariantData(product) {
8045
- if (!product.reviews.length && product.rate > 0) {
8046
- product.reviews = await this.findReviewsByProduct((product.productId ? product.productId : product.id), true);
8047
- }
8048
- // if (!product.metadata) {
8049
- // product.metadata = await this.findReviewsByProduct(
8050
- // (product.productId ? product.productId : product.id) as number,
8051
- // true,
8052
- // )
8053
- // }
8054
- return product;
8055
- }
8056
8047
  async getByEAN(EAN, options) {
8057
8048
  if (this.cache?.cacheAdapter && options?.cache?.enabled) {
8058
8049
  const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
package/index.esm.js CHANGED
@@ -7360,6 +7360,7 @@ const commonFields$1 = [
7360
7360
  { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7361
7361
  { daysOfUse: { columnName: 'days_of_use' } },
7362
7362
  { showVariants: { columnName: 'show_variants' } },
7363
+ { variantSlug: { columnName: 'variant_slug' } },
7363
7364
  ];
7364
7365
  class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHasuraGraphQL(Base)) {
7365
7366
  constructor({ endpoint, authOptions, interceptors, cache, }) {
@@ -7688,6 +7689,7 @@ const commonFields = [
7688
7689
  { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7689
7690
  { daysOfUse: { columnName: 'days_of_use' } },
7690
7691
  { showVariants: { columnName: 'show_variants' } },
7692
+ { variantSlug: { columnName: 'variant_slug' } },
7691
7693
  ];
7692
7694
  const fieldsConfiguration$2 = [
7693
7695
  ...commonFields,
@@ -7943,7 +7945,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7943
7945
  ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }, options))
7944
7946
  .data?.[0]
7945
7947
  : await super.get(identifiers, options);
7946
- // if (product.productId) throw new NotFoundError('Product not found, it is a variant')
7948
+ if (product.productId)
7949
+ throw new NotFoundError('Product not found, it is a variant');
7947
7950
  product.reviews =
7948
7951
  product.reviews ||
7949
7952
  (await this.findReviewsByProduct(product.productId ? +product.productId : +product.id, false, options));
@@ -8017,18 +8020,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8017
8020
  }
8018
8021
  return product;
8019
8022
  }
8020
- async getBySlugVariantData(product) {
8021
- if (!product.reviews.length && product.rate > 0) {
8022
- product.reviews = await this.findReviewsByProduct((product.productId ? product.productId : product.id), true);
8023
- }
8024
- // if (!product.metadata) {
8025
- // product.metadata = await this.findReviewsByProduct(
8026
- // (product.productId ? product.productId : product.id) as number,
8027
- // true,
8028
- // )
8029
- // }
8030
- return product;
8031
- }
8032
8023
  async getByEAN(EAN, options) {
8033
8024
  if (this.cache?.cacheAdapter && options?.cache?.enabled) {
8034
8025
  const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.4.0-beta.6",
3
+ "version": "5.4.0-beta.7",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -40,6 +40,7 @@ export declare class ProductBase<T extends ProductBase<T, I>, I = ProductIdentif
40
40
  group?: number;
41
41
  validity: boolean;
42
42
  daysOfUse?: number;
43
+ variantSlug?: string;
43
44
  category: Category;
44
45
  kitProducts?: KitProduct[];
45
46
  reviews?: ProductReview[];
@@ -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
  }
@@ -11,6 +11,7 @@ export declare class Order extends Checkout {
11
11
  deliveredAt?: string;
12
12
  trackingEvents?: OrderTrackingEvent[];
13
13
  payment: PaymentTransaction;
14
+ pedidov?: number;
14
15
  reshipmentOrderId?: string;
15
16
  isChange?: boolean;
16
17
  isReshipment?: boolean;
@@ -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>;