@infrab4a/connect 4.29.0 → 4.29.1-alpha.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.
Files changed (110) hide show
  1. package/index.cjs.js +3817 -2863
  2. package/index.esm.js +3815 -2862
  3. package/package.json +2 -2
  4. package/src/domain/catalog/repositories/category.repository.d.ts +22 -9
  5. package/src/domain/catalog/repositories/filter-option.repository.d.ts +1 -1
  6. package/src/domain/catalog/repositories/filter.repository.d.ts +1 -1
  7. package/src/domain/catalog/repositories/product-stock-notification.repository.d.ts +8 -1
  8. package/src/domain/catalog/repositories/wishlist.repository.d.ts +1 -1
  9. package/src/domain/shopping/models/campaign-dashboard.d.ts +1 -1
  10. package/src/domain/shopping/models/campaign-hashtag.d.ts +1 -1
  11. package/src/domain/shopping/repositories/order-blocked.repository.d.ts +9 -1
  12. package/src/domain/shopping/services/antifraud-card.service.d.ts +17 -0
  13. package/src/domain/shopping/services/antifraud-glampoints.service.d.ts +1 -1
  14. package/src/domain/shopping/services/antifraud-pix.service.d.ts +1 -1
  15. package/src/infra/adyen/adapters/adyen-card-payment-axios.adapter.d.ts +6 -4
  16. package/src/infra/adyen/helpers/adyen-blocked-order.helper.d.ts +13 -0
  17. package/src/infra/adyen/helpers/adyen-payment-factory.helper.d.ts +6 -0
  18. package/src/infra/adyen/helpers/adyen-payment-operations.helper.d.ts +31 -0
  19. package/src/infra/adyen/helpers/index.d.ts +3 -0
  20. package/src/infra/elasticsearch/helpers/elasticsearch-fields.helper.d.ts +8 -0
  21. package/src/infra/elasticsearch/helpers/elasticsearch-query-builder.helper.d.ts +16 -0
  22. package/src/infra/elasticsearch/helpers/elasticsearch-result-processor.helper.d.ts +8 -0
  23. package/src/infra/elasticsearch/helpers/elasticsearch-search-operations.helper.d.ts +11 -0
  24. package/src/infra/elasticsearch/helpers/index.d.ts +4 -0
  25. package/src/infra/elasticsearch/indexes/products-index.d.ts +1 -39
  26. package/src/infra/firebase/firestore/mixins/helpers/firestore-cache.helper.d.ts +41 -0
  27. package/src/infra/firebase/firestore/mixins/helpers/firestore-data-converter.helper.d.ts +7 -0
  28. package/src/infra/firebase/firestore/mixins/helpers/firestore-model-converter.helper.d.ts +14 -0
  29. package/src/infra/firebase/firestore/mixins/helpers/firestore-operations.helper.d.ts +24 -0
  30. package/src/infra/firebase/firestore/mixins/helpers/firestore-query-builder.helper.d.ts +37 -0
  31. package/src/infra/firebase/firestore/mixins/helpers/index.d.ts +3 -0
  32. package/src/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +1 -1
  33. package/src/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +21 -9
  34. package/src/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -1
  35. package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +8 -1
  36. package/src/infra/hasura-graphql/mixins/factories/create-hasura-class.factory.d.ts +30 -0
  37. package/src/infra/hasura-graphql/mixins/factories/delete-hasura-class.factory.d.ts +26 -0
  38. package/src/infra/hasura-graphql/mixins/factories/find-hasura-class.factory.d.ts +31 -0
  39. package/src/infra/hasura-graphql/mixins/factories/get-hasura-class.factory.d.ts +29 -0
  40. package/src/infra/hasura-graphql/mixins/factories/hasura-graphql-class.factory.d.ts +40 -0
  41. package/src/infra/hasura-graphql/mixins/factories/index.d.ts +6 -0
  42. package/src/infra/hasura-graphql/mixins/factories/update-hasura-class.factory.d.ts +36 -0
  43. package/src/infra/hasura-graphql/mixins/helpers/create/hasura-column.helper.d.ts +7 -0
  44. package/src/infra/hasura-graphql/mixins/helpers/create/hasura-create-operations.helper.d.ts +16 -0
  45. package/src/infra/hasura-graphql/mixins/helpers/create/index.d.ts +2 -0
  46. package/src/infra/hasura-graphql/mixins/helpers/delete/hasura-cache-operations.helper.d.ts +9 -0
  47. package/src/infra/hasura-graphql/mixins/helpers/delete/hasura-delete-operations.helper.d.ts +15 -0
  48. package/src/infra/hasura-graphql/mixins/helpers/delete/hasura-delete-variables.helper.d.ts +10 -0
  49. package/src/infra/hasura-graphql/mixins/helpers/delete/index.d.ts +3 -0
  50. package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-binding.helper.d.ts +18 -0
  51. package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-cache.helper.d.ts +25 -0
  52. package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-operations.helper.d.ts +20 -0
  53. package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-query-builder.helper.d.ts +14 -0
  54. package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-result.helper.d.ts +26 -0
  55. package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-variables.helper.d.ts +21 -0
  56. package/src/infra/hasura-graphql/mixins/helpers/find/index.d.ts +6 -0
  57. package/src/infra/hasura-graphql/mixins/helpers/get/hasura-get-cache.helper.d.ts +21 -0
  58. package/src/infra/hasura-graphql/mixins/helpers/get/hasura-get-operations.helper.d.ts +18 -0
  59. package/src/infra/hasura-graphql/mixins/helpers/get/hasura-get-variables.helper.d.ts +9 -0
  60. package/src/infra/hasura-graphql/mixins/helpers/get/index.d.ts +3 -0
  61. package/src/infra/hasura-graphql/mixins/helpers/hasura-auth.helper.d.ts +4 -0
  62. package/src/infra/hasura-graphql/mixins/helpers/hasura-data-converter.helper.d.ts +8 -0
  63. package/src/infra/hasura-graphql/mixins/helpers/hasura-graphql-operations.helper.d.ts +32 -0
  64. package/src/infra/hasura-graphql/mixins/helpers/hasura-query-builder.helper.d.ts +23 -0
  65. package/src/infra/hasura-graphql/mixins/helpers/hasura-request.helper.d.ts +11 -0
  66. package/src/infra/hasura-graphql/mixins/helpers/index.d.ts +11 -1
  67. package/src/infra/hasura-graphql/mixins/helpers/update/hasura-update-data.helper.d.ts +6 -0
  68. package/src/infra/hasura-graphql/mixins/helpers/update/hasura-update-operations.helper.d.ts +18 -0
  69. package/src/infra/hasura-graphql/mixins/helpers/update/hasura-update-variables.helper.d.ts +25 -0
  70. package/src/infra/hasura-graphql/mixins/helpers/update/index.d.ts +3 -0
  71. package/src/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +3 -7
  72. package/src/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +2 -6
  73. package/src/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +3 -5
  74. package/src/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +4 -54
  75. package/src/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +4 -28
  76. package/src/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +4 -22
  77. package/src/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +4 -12
  78. package/src/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +1 -3
  79. package/src/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +1 -3
  80. package/src/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +4 -15
  81. package/src/infra/hasura-graphql/repositories/catalog/category-product-hasura-graphql.repository.d.ts +1 -3
  82. package/src/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +2 -4
  83. package/src/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +1 -3
  84. package/src/infra/hasura-graphql/repositories/catalog/helpers/category-cache-operations.helper.d.ts +31 -0
  85. package/src/infra/hasura-graphql/repositories/catalog/helpers/category-filter-operations.helper.d.ts +17 -0
  86. package/src/infra/hasura-graphql/repositories/catalog/helpers/category-home-operations.helper.d.ts +32 -0
  87. package/src/infra/hasura-graphql/repositories/catalog/helpers/category-mount-operations.helper.d.ts +19 -0
  88. package/src/infra/hasura-graphql/repositories/catalog/helpers/category-product-operations.helper.d.ts +62 -0
  89. package/src/infra/hasura-graphql/repositories/catalog/helpers/index.d.ts +10 -0
  90. package/src/infra/hasura-graphql/repositories/catalog/helpers/product-fetch-reviews.helper.d.ts +17 -0
  91. package/src/infra/hasura-graphql/repositories/catalog/helpers/product-review-cache.helper.d.ts +28 -0
  92. package/src/infra/hasura-graphql/repositories/catalog/helpers/product-review-operations.helper.d.ts +20 -0
  93. package/src/infra/hasura-graphql/repositories/catalog/helpers/product-review-update.helper.d.ts +20 -0
  94. package/src/infra/hasura-graphql/repositories/catalog/helpers/product-variant-report.helper.d.ts +9 -0
  95. package/src/infra/hasura-graphql/repositories/catalog/product-errors-hasura-graphql.repository.d.ts +1 -3
  96. package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +1 -3
  97. package/src/infra/hasura-graphql/repositories/catalog/product-review-hasura-graphql.repository.d.ts +1 -3
  98. package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +8 -4
  99. package/src/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +1 -3
  100. package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +8 -10
  101. package/src/infra/pagarme/adapters/helpers/index.d.ts +3 -0
  102. package/src/infra/pagarme/adapters/helpers/pagarme-blocked-order.helper.d.ts +14 -0
  103. package/src/infra/pagarme/adapters/helpers/pagarme-payment-factory.helper.d.ts +11 -0
  104. package/src/infra/pagarme/adapters/helpers/pagarme-payment-operations.helper.d.ts +12 -0
  105. package/src/infra/vertex-ai/adapters/vertex-axios.adapter.d.ts +1 -1
  106. package/src/utils/circular-dependencies.d.ts +0 -4
  107. package/src/utils/helpers/debug.helper.d.ts +8 -8
  108. package/src/utils/helpers/reflect.helper.d.ts +1 -1
  109. package/src/utils/index.d.ts +1 -0
  110. package/src/utils/obs-emitter.d.ts +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.29.0",
3
+ "version": "4.29.1-alpha.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -18,7 +18,7 @@
18
18
  "lodash": "^4.17.21",
19
19
  "reflect-metadata": "^0.1.13",
20
20
  "serialize-javascript": "^6.0.2",
21
- "ts-custom-error": "3.2.2",
21
+ "ts-custom-error": "^3.3.1",
22
22
  "ts-md5": "^1.2.9",
23
23
  "tslib": "^2.4.0"
24
24
  },
@@ -3,6 +3,25 @@ import { RepositoryCacheOptions } from '../../generic/repository/types';
3
3
  import { Product } from '../models';
4
4
  import { Category } from '../models/category';
5
5
  import { Shops } from '../models/enums/shops.enum';
6
+ type CategoriesForHomeParams = {
7
+ categoryIds: string[];
8
+ shop: Shops;
9
+ limit?: number;
10
+ optionsCache?: {
11
+ cache?: RepositoryCacheOptions;
12
+ };
13
+ };
14
+ type MountCategoryParams = {
15
+ category: Category;
16
+ shop: Shops;
17
+ options?: {
18
+ limit?: number;
19
+ hasStock?: boolean;
20
+ };
21
+ optionsCache?: {
22
+ cache?: RepositoryCacheOptions;
23
+ };
24
+ };
6
25
  export interface CategoryRepository<T extends Category = Category> extends CrudRepository<T> {
7
26
  getCategoryBySlug(slug: string, shop: Shops, optionsCache?: {
8
27
  cache?: RepositoryCacheOptions;
@@ -10,20 +29,14 @@ export interface CategoryRepository<T extends Category = Category> extends CrudR
10
29
  getCategoryByShop(shop: string, optionsCache?: {
11
30
  cache?: RepositoryCacheOptions;
12
31
  }): Promise<Category[]>;
13
- getCategoriesForHome(categoryIds: string[], shop: Shops, limit?: number, optionsCache?: {
14
- cache?: RepositoryCacheOptions;
15
- }): Promise<{
32
+ getCategoriesForHome(params: CategoriesForHomeParams): Promise<{
16
33
  category: Category;
17
34
  products: Product[];
18
35
  }[]>;
19
- mountCategory(category: Category, shop: Shops, options?: {
20
- limit?: number;
21
- hasStock?: boolean;
22
- }, optionsCache?: {
23
- cache?: RepositoryCacheOptions;
24
- }): Promise<Product[]>;
36
+ mountCategory(params: MountCategoryParams): Promise<Product[]>;
25
37
  getChildren(parentId: number, optionsCache?: {
26
38
  cache?: RepositoryCacheOptions;
27
39
  }): Promise<Category[]>;
28
40
  isChild(id: number, parentId: number): Promise<boolean>;
29
41
  }
42
+ export {};
@@ -1,4 +1,4 @@
1
1
  import { CrudRepository } from '../../generic/repository/crud.repository';
2
- import { FilterOption } from "../models";
2
+ import { FilterOption } from '../models';
3
3
  export interface FilterOptionRepository extends CrudRepository<FilterOption> {
4
4
  }
@@ -1,4 +1,4 @@
1
1
  import { CrudRepository } from '../../generic/repository/crud.repository';
2
- import { Filter } from "../models";
2
+ import { Filter } from '../models';
3
3
  export interface FilterRepository extends CrudRepository<Filter> {
4
4
  }
@@ -1,8 +1,14 @@
1
1
  import { RepositoryFindResult } from '../../generic';
2
2
  import { CrudRepository } from '../../generic/repository/crud.repository';
3
3
  import { ProductStockNotification, ReportStockNotification, ReportStockNotificationInput, Shops } from '../models';
4
+ type AddCustomerEmailParams = {
5
+ shop: Shops;
6
+ productId: string;
7
+ name: string;
8
+ email: string;
9
+ };
4
10
  export interface ProductStockNotificationRepository extends CrudRepository<ProductStockNotification> {
5
- addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
11
+ addCustomerEmail(params: AddCustomerEmailParams): Promise<void>;
6
12
  getNotificationsReport(params: ReportStockNotificationInput, orderBy: {
7
13
  field: string;
8
14
  direction: string;
@@ -11,3 +17,4 @@ export interface ProductStockNotificationRepository extends CrudRepository<Produ
11
17
  limit: number;
12
18
  }): Promise<RepositoryFindResult<ReportStockNotification>>;
13
19
  }
20
+ export {};
@@ -1,7 +1,7 @@
1
- import { CategoryRepository } from '.';
2
1
  import { FindRepositoryParams, RepositoryFindResult } from '../../generic';
3
2
  import { Shops } from '../models';
4
3
  import { Wishlist } from '../models/wishlist';
4
+ import { CategoryRepository } from '.';
5
5
  export interface WishlistRepository extends CategoryRepository<Wishlist> {
6
6
  getWishlistBySlug(slug: string): Promise<Wishlist>;
7
7
  getWishlistByPerson(personId: string): Promise<Wishlist[]>;
@@ -1,4 +1,4 @@
1
- import { BaseModel, GenericIdentifier } from "../../generic";
1
+ import { BaseModel, GenericIdentifier } from '../../generic';
2
2
  export declare class CampaignDashboard extends BaseModel<CampaignDashboard> {
3
3
  id: string;
4
4
  status: string;
@@ -1,4 +1,4 @@
1
- import { BaseModel, GenericIdentifier } from "../../generic";
1
+ import { BaseModel, GenericIdentifier } from '../../generic';
2
2
  export declare class CampaignHashtag extends BaseModel<CampaignHashtag> {
3
3
  id: string;
4
4
  status?: string;
@@ -1,6 +1,14 @@
1
1
  import { CrudRepository } from '../../generic/repository/crud.repository';
2
2
  import { Checkout, OrderBlocked } from '../models';
3
3
  import { PaymentCardInfo } from '../types';
4
+ type CreateBlockedOrderParams = {
5
+ checkout: Checkout;
6
+ blockType: string;
7
+ type: string;
8
+ limiteRange: string;
9
+ card?: PaymentCardInfo;
10
+ };
4
11
  export interface OrderBlockedRepository extends CrudRepository<OrderBlocked> {
5
- createBlockedOrderOrPayment(checkout: Checkout, blockType: string, type: string, limiteRange: string, card?: PaymentCardInfo): Promise<OrderBlocked>;
12
+ createBlockedOrderOrPayment(params: CreateBlockedOrderParams): Promise<OrderBlocked>;
6
13
  }
14
+ export {};
@@ -10,8 +10,25 @@ export declare class AntifraudCardService implements AntifraudProvider {
10
10
  private LIMIT_BLOCKED_ORDERS_DAY;
11
11
  constructor(orderRepository: OrderRepository, orderBlockedRepository: OrderBlockedRepository);
12
12
  validate(checkout: Checkout, card: PaymentCardInfo): Promise<Boolean>;
13
+ private validateBlockedOrderAttempts;
14
+ private validateDayAndWeekOrderLimits;
13
15
  private verifyBlockedOrderAttempts;
16
+ private getTodayDateRange;
17
+ private getBlockedOrdersByMultipleCriteria;
18
+ private getBlockedOrdersByCpf;
19
+ private getBlockedOrdersByEmail;
20
+ private getBlockedOrdersByZip;
21
+ private getBlockedOrdersByPhone;
22
+ private calculateUniqueBlockedAttempts;
23
+ private filterUniqueEmailBlocked;
24
+ private filterUniqueZipBlocked;
25
+ private filterUniquePhoneBlocked;
26
+ private createBlockedOrderRecord;
14
27
  private verifyDayAndWeekOrders;
28
+ private buildValidationParams;
29
+ private validateDayOrderLimits;
30
+ private validateWeekOrderLimits;
31
+ private checkOrderLimitsAndBlock;
15
32
  private validateOrdersByRange;
16
33
  private countOrdersByField;
17
34
  private getDateRange;
@@ -2,5 +2,5 @@ import { AntifraudProvider } from '../interfaces';
2
2
  import { Checkout } from '../models';
3
3
  export declare class AntifraudGlampointsService implements AntifraudProvider {
4
4
  constructor();
5
- validate(checkout: Checkout): Promise<Boolean>;
5
+ validate(_checkout: Checkout): Promise<Boolean>;
6
6
  }
@@ -2,5 +2,5 @@ import { AntifraudProvider } from '../interfaces';
2
2
  import { Checkout } from '../models';
3
3
  export declare class AntifraudPixService implements AntifraudProvider {
4
4
  constructor();
5
- validate(checkout: Checkout): Promise<Boolean>;
5
+ validate(_checkout: Checkout): Promise<boolean>;
6
6
  }
@@ -8,10 +8,12 @@ export declare class AdyenCardAxiosAdapter implements PaymentProviderCard<AdyenC
8
8
  private paymentRepository;
9
9
  private orderBlockedRepository;
10
10
  constructor(credentials: AdyenCredentials, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
11
- createCardHash(bu: BusinessUnitEnum): Promise<string>;
11
+ createCardHash(_bu: BusinessUnitEnum): Promise<string>;
12
12
  pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
13
- private createCardPayment;
13
+ private executeAdyenPayment;
14
+ private handleUnauthorizedPayment;
15
+ private createSuccessfulPayment;
14
16
  addCard(): Promise<AdyenCard>;
15
- getCardByToken(token: string): Promise<AdyenCard>;
16
- createTransaction(info: any): Promise<PaymentTransaction>;
17
+ getCardByToken(_token: string): Promise<AdyenCard>;
18
+ createTransaction(_info: any): Promise<PaymentTransaction>;
17
19
  }
@@ -0,0 +1,13 @@
1
+ import { Checkout } from '../../../domain/shopping/models';
2
+ import { OrderBlockedRepository } from '../../../domain/shopping/repositories';
3
+ import { PaymentCardInfo } from '../../../domain/shopping/types';
4
+ import { PaymentError } from '../../../errors';
5
+ export declare class AdyenBlockedOrderHelper {
6
+ static handleUnauthorizedPayment(params: {
7
+ checkout: Checkout;
8
+ card: PaymentCardInfo;
9
+ orderBlockedRepository: OrderBlockedRepository;
10
+ adyenResponse: any;
11
+ }): Promise<never>;
12
+ static createPaymentError(checkout: Checkout, errorInfo: any): PaymentError;
13
+ }
@@ -0,0 +1,6 @@
1
+ import { Checkout, Payment } from '../../../domain/shopping/models';
2
+ import { PaymentRepository } from '../../../domain/shopping/repositories';
3
+ import { AdyenPaymentResponse } from './adyen-payment-operations.helper';
4
+ export declare class AdyenPaymentFactoryHelper {
5
+ static createPaymentFromAdyenResponse(checkout: Checkout, adyenResponse: AdyenPaymentResponse, paymentRepository: PaymentRepository): Promise<Payment>;
6
+ }
@@ -0,0 +1,31 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { Checkout } from '../../../domain/shopping/models';
3
+ import { AdyenCredentials, PaymentCardInfo } from '../../../domain/shopping/types';
4
+ export interface AdyenPaymentRequest {
5
+ amount: {
6
+ currency: string;
7
+ value: number;
8
+ };
9
+ paymentMethod: {
10
+ type: string;
11
+ storedPaymentMethodId: string;
12
+ };
13
+ reference: string;
14
+ shopperInteraction: string;
15
+ merchantAccount: string;
16
+ shopperReference: string;
17
+ recurringProcessingModel: string;
18
+ returnUrl: string;
19
+ installments: {
20
+ value: number;
21
+ };
22
+ }
23
+ export interface AdyenPaymentResponse {
24
+ resultCode: 'Authorised' | 'Refused' | 'Error' | string;
25
+ [key: string]: any;
26
+ }
27
+ export declare class AdyenPaymentOperationsHelper {
28
+ static buildPaymentRequest(checkout: Checkout, card: PaymentCardInfo, credentials: AdyenCredentials): AdyenPaymentRequest;
29
+ static executePaymentRequest(paymentRequest: AdyenPaymentRequest, credentials: AdyenCredentials): Promise<AxiosResponse<AdyenPaymentResponse>>;
30
+ static isPaymentAuthorised(response: AdyenPaymentResponse): boolean;
31
+ }
@@ -0,0 +1,3 @@
1
+ export * from './adyen-blocked-order.helper';
2
+ export * from './adyen-payment-factory.helper';
3
+ export * from './adyen-payment-operations.helper';
@@ -0,0 +1,8 @@
1
+ export declare class ElasticSearchFieldsHelper {
2
+ static getProductSearchFields(total: number): string[];
3
+ static getProductSearchFilters(): Array<{
4
+ term: {
5
+ [key: string]: string | boolean | number;
6
+ };
7
+ }>;
8
+ }
@@ -0,0 +1,16 @@
1
+ export interface ElasticSearchQuery {
2
+ should: any[];
3
+ filter: Array<{
4
+ term: {
5
+ [key: string]: string | boolean | number;
6
+ };
7
+ }>;
8
+ }
9
+ export declare class ElasticSearchQueryBuilderHelper {
10
+ static buildProductSearchQuery(searchTerm: string, filters: Array<{
11
+ term: {
12
+ [key: string]: string | boolean | number;
13
+ };
14
+ }>): ElasticSearchQuery;
15
+ private static addComplementarySearchRules;
16
+ }
@@ -0,0 +1,8 @@
1
+ import { Product } from '../../../domain';
2
+ import { ElasticSearchResult } from '../types';
3
+ export declare class ElasticSearchResultProcessorHelper {
4
+ static processProductSearchResults(search: ElasticSearchResult<Product>): any[];
5
+ private static filterValidHits;
6
+ private static applyPriceRounding;
7
+ private static transformHitsToProducts;
8
+ }
@@ -0,0 +1,11 @@
1
+ import { Product } from '../../../domain';
2
+ import { ElasticSearchAdapter } from '../adapters';
3
+ export interface ProductSearchParams {
4
+ searchTerm: string;
5
+ total: number;
6
+ shop?: string;
7
+ }
8
+ export declare class ElasticSearchOperationsHelper {
9
+ static executeProductSearch(params: ProductSearchParams, adapter: ElasticSearchAdapter<Product>, index: string): Promise<any[]>;
10
+ private static performSearch;
11
+ }
@@ -0,0 +1,4 @@
1
+ export * from './elasticsearch-fields.helper';
2
+ export * from './elasticsearch-query-builder.helper';
3
+ export * from './elasticsearch-result-processor.helper';
4
+ export * from './elasticsearch-search-operations.helper';
@@ -6,45 +6,7 @@ export declare class ProductsIndex {
6
6
  private index;
7
7
  constructor(adapter: ElasticSearchAdapter<Product>);
8
8
  getById(id: string): Promise<Product>;
9
- search(searchTerm: string, total: number, shop?: string): Promise<{
10
- stock: number;
11
- hasVariants: boolean;
12
- variants?: import("../../../domain").Variant[];
13
- id: string;
14
- name: string;
15
- slug: string;
16
- description: import("../../../domain").ShopDescription;
17
- sku: string;
18
- price: import("../../../domain").ShopPrice;
19
- NCM: string;
20
- EAN: string;
21
- CEST: string;
22
- weight: number;
23
- costPrice: number;
24
- images?: string[];
25
- miniatures?: string[];
26
- published: boolean;
27
- createdAt?: Date;
28
- updatedAt?: Date;
29
- brand: string;
30
- tags?: string[];
31
- filters?: string[];
32
- type?: string;
33
- categories?: string[];
34
- video?: string;
35
- isKit?: boolean;
36
- rate?: number;
37
- gender?: import("../../../domain").ProductGender;
38
- shoppingCount?: number;
39
- metadata: import("../../../domain").ProductMetadata;
40
- outlet?: boolean;
41
- label?: "outlet" | "on-sale" | "last-units" | "glamstar";
42
- group?: number;
43
- validity: boolean;
44
- category: import("../../../domain").Category;
45
- kitProducts?: import("../../../domain").KitProduct[];
46
- reviews?: import("../../../domain").ProductReview[];
47
- }[]>;
9
+ search(searchTerm: string, total: number, shop?: string): Promise<any[]>;
48
10
  save(product: ProductHasuraGraphQL): Promise<void>;
49
11
  update(product: ProductHasuraGraphQL): Promise<void>;
50
12
  delete(id: string): Promise<void>;
@@ -0,0 +1,41 @@
1
+ import { BaseModelBuilder, ModelBaseStructure, RepositoryCacheOptions } from '../../../../../domain';
2
+ type CacheConfig = {
3
+ cacheAdapter?: any;
4
+ ttlDefault?: number;
5
+ };
6
+ type CacheGetParams<TBase extends ModelBaseStructure<TBase>> = {
7
+ model: BaseModelBuilder<TBase>;
8
+ identifiers: any;
9
+ options?: {
10
+ cache?: RepositoryCacheOptions;
11
+ };
12
+ logger: any;
13
+ req: any;
14
+ };
15
+ type CacheSaveParams = {
16
+ cacheKey: string;
17
+ data: any;
18
+ expirationInSeconds?: number;
19
+ logger: any;
20
+ req?: any;
21
+ };
22
+ type CacheRemoveParams = {
23
+ cacheKey: string;
24
+ logger: any;
25
+ };
26
+ export declare class FirestoreCacheHelper {
27
+ static getCachedData<TBase extends ModelBaseStructure<TBase>>(cache: CacheConfig | undefined, params: CacheGetParams<TBase>): Promise<any | null>;
28
+ static getCachedFindData<TBase extends ModelBaseStructure<TBase>>(cache: CacheConfig | undefined, params: {
29
+ model: BaseModelBuilder<TBase>;
30
+ find: any;
31
+ options?: {
32
+ cache?: RepositoryCacheOptions;
33
+ };
34
+ logger: any;
35
+ }): Promise<any | null>;
36
+ static saveCacheData(cache: CacheConfig | undefined, params: CacheSaveParams): Promise<void>;
37
+ static removeCacheData(cache: CacheConfig | undefined, params: CacheRemoveParams): Promise<void>;
38
+ static generateGetCacheKey<TBase extends ModelBaseStructure<TBase>>(model: BaseModelBuilder<TBase>, identifiers: any): string;
39
+ static generateFindCacheKey<TBase extends ModelBaseStructure<TBase>>(model: BaseModelBuilder<TBase>, findParams: any): string;
40
+ }
41
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ModelBaseStructure, NonFunctionAndIdentifierPropertiesWithNoPartial } from '../../../../../domain';
2
+ export declare class FirestoreDataConverterHelper {
3
+ static isValidObjectForDateBinding(data: any): boolean;
4
+ static convertToDate(data: any, keyName: string): any;
5
+ static processArrayData(arrayData: any[]): any[];
6
+ static bindAllDateFromObject<TBase extends ModelBaseStructure<TBase> = any>(data: Record<string, any>): NonFunctionAndIdentifierPropertiesWithNoPartial<TBase>;
7
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseModelBuilder, ModelBaseStructure } from '../../../../../domain';
2
+ import { ConnectDocumentData, ConnectDocumentSnapshot } from '../../types';
3
+ export declare class FirestoreModelConverterHelper<TBase extends ModelBaseStructure<TBase>> {
4
+ private model;
5
+ constructor(model: BaseModelBuilder<TBase>);
6
+ static omitByRecursivelyInPlace(value: any, iteratee: (value: any, key: string) => boolean): any;
7
+ buildToFirestoreConverter(): (data: TBase) => ConnectDocumentData<TBase>;
8
+ buildFromFirestoreConverter(): (snap: ConnectDocumentSnapshot<TBase>) => TBase;
9
+ private handleConversionError;
10
+ getConverters(): {
11
+ toFirestore: (data: TBase) => ConnectDocumentData<TBase>;
12
+ fromFirestore: (snap: ConnectDocumentSnapshot<TBase>) => TBase;
13
+ };
14
+ }
@@ -0,0 +1,24 @@
1
+ import { BaseModelBuilder, ModelBaseStructure } from '../../../../../domain';
2
+ export declare class FirestoreOperationsHelper<TBase extends ModelBaseStructure<TBase>> {
3
+ private model;
4
+ constructor(model: BaseModelBuilder<TBase>);
5
+ buildInstanceFromIdentifiers(identifiers: any): TBase;
6
+ validateDocumentExists(docRef: any, collectionName: string, identifiers: any): Promise<void>;
7
+ validateDocumentData(data: any, collectionName: string, identifiers: any): void;
8
+ getDocumentSnapshot(collection: any, instance: TBase): Promise<any>;
9
+ executeDelete(collection: any, instance: TBase): Promise<void>;
10
+ calculateCount<T>(data: T[], limits?: {
11
+ limit?: number;
12
+ }): number;
13
+ handleError(error: unknown, logger: any, req: any): void;
14
+ buildCollectionPath(params: {
15
+ isSubCollection: boolean;
16
+ collectionName: string;
17
+ parentRepository?: {
18
+ collectionName: string;
19
+ };
20
+ parentIdField?: string;
21
+ identifiers?: any;
22
+ }): string;
23
+ getKeyField(): string;
24
+ }
@@ -0,0 +1,37 @@
1
+ import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames, NonFunctionPropertyNames, RepositoryFindFielters, RepositoryFindFieltersOptions, RepositoryLimitOptions, RepositoryOrderBy } from '../../../../../domain';
2
+ import { FirestoreFieldType } from '../../enums';
3
+ import { ConnectCollectionReference } from '../../services';
4
+ import { ConnectDocumentSnapshot, ConnectWhereOption } from '../../types';
5
+ export declare class FirestoreQueryBuilderHelper<TBase extends ModelBaseStructure<TBase>> {
6
+ private config;
7
+ constructor(config: {
8
+ model: any;
9
+ fields?: Partial<Record<NonFunctionAndIdentifierPropertyNames<TBase>, FirestoreFieldType>>;
10
+ isSubCollection?: (instance: any) => boolean;
11
+ parentIdField?: string;
12
+ });
13
+ buildWhereSentence(fieldName: NonFunctionPropertyNames<TBase> | string, options: RepositoryFindFieltersOptions<TBase, NonFunctionPropertyNames<TBase>>): [string, ConnectWhereOption, any][];
14
+ private getFirestoreFieldName;
15
+ private buildWhereConditions;
16
+ private buildLikeConditions;
17
+ private buildInConditions;
18
+ private buildNestedObjectConditions;
19
+ private isArrayField;
20
+ private isNestedObjectFilter;
21
+ buildOrderBy(filters: RepositoryFindFielters<TBase>, fieldsToOrderBy?: RepositoryOrderBy<TBase>): [string, 'asc' | 'desc'][];
22
+ private addMissingOrderFields;
23
+ private convertToOrderByArray;
24
+ buildLimits(params: {
25
+ filters: RepositoryFindFielters<TBase>;
26
+ limits: RepositoryLimitOptions<TBase>;
27
+ collection: (path: string) => ConnectCollectionReference<TBase>;
28
+ buildCollectionPath: (filters: RepositoryFindFielters<TBase>) => string;
29
+ }): Promise<['fromStartAfter' | 'fromStartAt' | 'limit', string | number | ConnectDocumentSnapshot<TBase>][]>;
30
+ private addOffsetQuery;
31
+ buildQuery(params: {
32
+ collection: ConnectCollectionReference<TBase>;
33
+ queries: [string, ConnectWhereOption, any][];
34
+ ordination: [string, 'asc' | 'desc'][];
35
+ offsets: ['fromStartAfter' | 'fromStartAt' | 'limit', string | number | ConnectDocumentSnapshot<TBase>][];
36
+ }): ConnectCollectionReference<TBase>;
37
+ }
@@ -1 +1,4 @@
1
1
  export * from './cache-key-generator.helper';
2
+ export * from './firestore-cache.helper';
3
+ export * from './firestore-operations.helper';
4
+ export * from './firestore-query-builder.helper';
@@ -5,7 +5,7 @@ import { FirestoreConstructorParams } from './with-firestore.mixin';
5
5
  export type FirestoreSubCollectionConstructorParams<TBase extends ModelBaseStructure> = {
6
6
  parentIdField: keyof IdentifiersModel<TBase>;
7
7
  };
8
- export declare const withSubCollection: <TBase extends ModelBaseStructure<TBase, TBase["identifiersFields"][number]>, TBaseParent extends ModelBaseStructure<TBaseParent, TBaseParent["identifiersFields"][number]>, TMixinBase extends MixinCtor<FirestoreRepository<TBase>, any[]>>(MixinBase: MixinCtor<FirestoreRepository<TBase>, any[]> & TMixinBase, ParentModel: new () => TBaseParent) => MixinCtor<FirestoreRepository<TBase> & InstanceType<TMixinBase> & {
8
+ export declare const withSubCollection: <TBase extends ModelBaseStructure<TBase, TBase["identifiersFields"][number]>, TBaseParent extends ModelBaseStructure<TBaseParent, TBaseParent["identifiersFields"][number]>, TMixinBase extends MixinCtor<FirestoreRepository<TBase>, any[]>>(MixinBase: MixinCtor<FirestoreRepository<TBase>, any[]> & TMixinBase, _ParentModel: new () => TBaseParent) => MixinCtor<FirestoreRepository<TBase> & InstanceType<TMixinBase> & {
9
9
  readonly parentRepository: FirestoreRepository<TBaseParent>;
10
10
  parentIdField: Extract<import("../../../../domain").NonFunctionAndIdentifierPropertyNames<TBase>, import("../../../../utils").PropType<TBase, "identifiersFields">[number]>;
11
11
  } & FirestoreHelpers, MergeConstructorParams<[FirestoreConstructorParams<TBase> & FirestoreSubCollectionConstructorParams<TBase>, ...any[]], ConstructorParameters<TMixinBase>>>;
@@ -1,20 +1,32 @@
1
1
  import { Category, CategoryRepository, Product, Shops } from '../../../../../domain';
2
2
  import { FirestoreConstructorParams } from '../../mixins';
3
+ type CategoriesForHomeParams = {
4
+ categoryIds: string[];
5
+ shop: Shops;
6
+ limit?: number;
7
+ optionsCache?: any;
8
+ };
9
+ type MountCategoryParams = {
10
+ category: Category;
11
+ shop: Shops;
12
+ options?: {
13
+ limit?: number;
14
+ hasStock?: boolean;
15
+ gender?: string;
16
+ };
17
+ optionsCache?: any;
18
+ };
3
19
  declare const CategoryFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../../types").FirestoreRepository<Category> & import("../../../../../domain").CrudRepository<Category, import("../../../../../domain").CrudParams<Category>> & import("../../types").FirestoreHelpers, [FirestoreConstructorParams<Category>, ...any[]]>;
4
20
  export declare class CategoryFirestoreRepository extends CategoryFirestoreRepository_base implements CategoryRepository {
5
21
  constructor({ firestore, interceptors }: Pick<FirestoreConstructorParams<Category>, 'firestore' | 'interceptors'>);
6
22
  getCategoryBySlug(slug: string, shop: Shops): Promise<Category>;
7
- getCategoriesForHome(categoryIds: string[], shop: Shops, limit?: number): Promise<{
23
+ getCategoriesForHome(params: CategoriesForHomeParams): Promise<{
8
24
  category: Category;
9
25
  products: Product[];
10
26
  }[]>;
11
- mountCategory(category: Category, shop: Shops, options?: {
12
- limit?: number;
13
- hasStock?: boolean;
14
- gender?: string;
15
- }): Promise<Product[]>;
16
- getCategoryByShop(shop: string): Promise<Category[]>;
17
- getChildren(parentId: number): Promise<Category[]>;
18
- isChild(id: number, parentId: number): Promise<boolean>;
27
+ mountCategory(params: MountCategoryParams): Promise<Product[]>;
28
+ getCategoryByShop(_shop: string): Promise<Category[]>;
29
+ getChildren(_parentId: number): Promise<Category[]>;
30
+ isChild(_id: number, _parentId: number): Promise<boolean>;
19
31
  }
20
32
  export {};
@@ -4,7 +4,7 @@ declare const ProductFirestoreRepository_base: import("../../../../../utils").Mi
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[]>;
7
+ fetchProductReviews(_filters: PaginatedReviewFilters): Promise<ReviewWithProductData[]>;
8
8
  getBySlug(slug: string): Promise<Product>;
9
9
  fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
10
10
  cleanShoppingCountFromIds(): Promise<void>;
@@ -1,9 +1,16 @@
1
1
  import { Checkout, OrderBlocked, OrderBlockedRepository, OrderBlockedType, PaymentCardInfo } from '../../../../../domain';
2
2
  import { FirestoreConstructorParams } from '../../mixins';
3
+ type CreateBlockedOrderParams = {
4
+ checkout: Checkout;
5
+ blockType: string;
6
+ type: OrderBlockedType;
7
+ limiteRange: string;
8
+ card?: PaymentCardInfo;
9
+ };
3
10
  declare const OrderBlockedFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../..").FirestoreRepository<OrderBlocked> & import("../../../../../domain").CrudRepository<OrderBlocked, import("../../../../../domain").CrudParams<OrderBlocked>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<OrderBlocked>, ...any[]]>;
4
11
  export declare class OrderBlockedFirestoreRepository extends OrderBlockedFirestoreRepository_base implements OrderBlockedRepository {
5
12
  constructor({ firestore, interceptors, cache, }: Pick<FirestoreConstructorParams<OrderBlocked>, 'firestore' | 'interceptors' | 'cache'>);
6
- createBlockedOrderOrPayment(checkout: Checkout, blockType: string, type: OrderBlockedType, limiteRange: string, card?: PaymentCardInfo): Promise<OrderBlocked>;
13
+ createBlockedOrderOrPayment(params: CreateBlockedOrderParams): Promise<OrderBlocked>;
7
14
  private formatZip;
8
15
  }
9
16
  export {};
@@ -0,0 +1,30 @@
1
+ import { CreateRepositoryParams, ModelBaseStructure } from '../../../../domain';
2
+ import { MixinCtor } from '../../../../utils';
3
+ import { GraphQLRepository } from '../../types';
4
+ export type CreateConstructorParams = {
5
+ insertGraphQLOperation?: string;
6
+ insertAllGraphQLOperation?: string;
7
+ insertGraphQLObjectType?: string;
8
+ };
9
+ export declare function createCreateHasuraGraphQLClass<MBase extends ModelBaseStructure<MBase, MBase['identifiersFields'][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>>>(MixinBase: MixinCtor<GraphQLRepository<MBase>> & TMixinBase): {
10
+ new (...params: any[]): {
11
+ insertGraphQLOperation: string;
12
+ insertGraphQLObjectType: string;
13
+ create(data: CreateRepositoryParams<MBase>): Promise<MBase>;
14
+ save(data: MBase): Promise<Partial<MBase>>;
15
+ tableName: string;
16
+ model: import("../../../../domain").BaseModelBuilder<MBase, any, MBase & {
17
+ prototype: unknown;
18
+ }>;
19
+ fields: import("../../types").HasuraGraphQLFields<MBase>;
20
+ endpoint: string;
21
+ authOptions: import("../../types").HasuraGraphQLAuthOptions;
22
+ logger: import("../../../../utils").DebugHelper;
23
+ cache?: import("../../../../domain").CacheConfig;
24
+ mutation: <ReturnFields = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields>;
25
+ query: <ReturnFields_1 = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation | import("../../types").GraphQLParams<MBase>[], fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields_1>;
26
+ getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
27
+ convertDataFromHasura(data: Record<string, string | number>, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[]): MBase;
28
+ convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
29
+ };
30
+ } & TMixinBase;