@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
@@ -1,9 +1,5 @@
1
- import { CreateRepository, CreateRepositoryParams, ModelBaseStructure } from '../../../domain';
1
+ import { CreateRepository, ModelBaseStructure } from '../../../domain';
2
2
  import { MergeConstructorParams, MixinCtor } from '../../../utils';
3
3
  import { GraphQLRepository } from '../types';
4
- export type CreateConstructorParams = {
5
- insertGraphQLOperation?: string;
6
- insertAllGraphQLOperation?: string;
7
- insertGraphQLObjectType?: string;
8
- };
9
- export declare const withCreateHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & InstanceType<TMixinBase> & CreateRepository<MBase, CreateRepositoryParams<MBase>>, MergeConstructorParams<[CreateConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
4
+ import { CreateConstructorParams } from './factories';
5
+ export declare const withCreateHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & InstanceType<TMixinBase> & CreateRepository<MBase, import("../../../domain").CreateRepositoryParams<MBase>>, MergeConstructorParams<[CreateConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
@@ -1,11 +1,7 @@
1
1
  import { CrudRepository, ModelBaseStructure } from '../../../domain';
2
2
  import { MergeConstructorParams, MixinCtor } from '../../../utils';
3
3
  import { GraphQLRepository } from '../types';
4
- import { CreateConstructorParams } from './with-create-hasura-graphql.mixin';
5
- import { DeleteConstructorParams } from './with-delete-hasura-graphql.mixin';
6
- import { GetConstructorParams } from './with-get-hasura-graphql.mixin';
4
+ import { CreateConstructorParams, DeleteConstructorParams, GetConstructorParams } from './factories';
7
5
  import { HasuraConstructorParams } from './with-hasura-graphql.mixin';
8
6
  import { UpdateConstructorParams, UpdateHasuraGraphQLRepositoryType } from './with-update-hasura-graphql.mixin';
9
- export declare const withCrudHasuraGraphQL: <TBase extends ModelBaseStructure<TBase, TBase["identifiersFields"][number]>, Repository = CrudRepository<TBase, import("../../../domain").CrudParams<TBase>>, TMixinBase extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: MixinCtor<GraphQLRepository<TBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<TBase> & Repository & import("../../../domain").UpdateRepository<TBase, import("../../../domain").RepositoryUpdateParams<TBase>> & {
10
- paramsToPlain(params: import("../../../domain").RepositoryUpdateParams<TBase>): Partial<TBase>;
11
- }, MergeConstructorParams<[HasuraConstructorParams<TBase> & CreateConstructorParams & DeleteConstructorParams & GetConstructorParams & UpdateConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
7
+ export declare const withCrudHasuraGraphQL: <TBase extends ModelBaseStructure<TBase, TBase["identifiersFields"][number]>, Repository = CrudRepository<TBase, import("../../../domain").CrudParams<TBase>>, TMixinBase extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: MixinCtor<GraphQLRepository<TBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<TBase> & Repository & UpdateHasuraGraphQLRepositoryType<TBase>, MergeConstructorParams<[HasuraConstructorParams<TBase> & CreateConstructorParams & DeleteConstructorParams & GetConstructorParams & UpdateConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
@@ -1,7 +1,5 @@
1
- import { DeleteRepository, DeleteRepositoryParams, ModelBaseStructure } from '../../../domain';
1
+ import { DeleteRepository, ModelBaseStructure } from '../../../domain';
2
2
  import { MergeConstructorParams, MixinCtor } from '../../../utils';
3
3
  import { GraphQLRepository } from '../types';
4
- export type DeleteConstructorParams = {
5
- deleteGraphQLOperation?: string;
6
- };
7
- export declare const withDeleteHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & DeleteRepository<MBase, DeleteRepositoryParams<MBase>> & InstanceType<TMixinBase>, MergeConstructorParams<[DeleteConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
4
+ import { DeleteConstructorParams } from './factories';
5
+ export declare const withDeleteHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & DeleteRepository<MBase, import("../../../domain").DeleteRepositoryParams<MBase>> & InstanceType<TMixinBase>, MergeConstructorParams<[DeleteConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
@@ -1,54 +1,4 @@
1
- import { BaseModelBuilder, FindRepositoryParams, ModelBaseStructure, NonFunctionAndIdentifierPropertyNames, RepositoryCacheOptions, RepositoryFindResult, RepositoryOrderBy } from '../../../domain';
2
- import { DebugHelper, MixinCtor } from '../../../utils';
3
- import { GraphQLParams, GraphQLRepository, HasuraGraphQLFields } from '../types';
4
- export declare const withFindHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => {
5
- new (...args: any[]): {
6
- lastDistinct: Record<string, any>;
7
- find(params?: FindRepositoryParams<MBase>, options?: {
8
- cache?: RepositoryCacheOptions;
9
- }): Promise<RepositoryFindResult<MBase>>;
10
- bindResult(result: any, { enableCount, findOptions, tableFiltersNamed, }: {
11
- enableCount: boolean;
12
- findOptions: {
13
- enableCount?: boolean;
14
- minimal?: ({} | NonFunctionAndIdentifierPropertyNames<MBase>)[];
15
- maximum?: ({} | NonFunctionAndIdentifierPropertyNames<MBase>)[];
16
- distinct?: ({} | NonFunctionAndIdentifierPropertyNames<MBase>)[];
17
- };
18
- tableFiltersNamed: string;
19
- }): {
20
- distinct: any;
21
- maximum?: import("../../../domain").NonFunctionAndIdentifierPropertiesWithNoPartial<MBase> extends infer T extends import("../../../domain").NonFunctionAndIdentifierPropertiesWithNoPartial<MBase> ? { [key in keyof T]: import("../../../domain").NonFunctionAndIdentifierPropertiesWithNoPartial<MBase>[key]; } : never;
22
- minimal?: import("../../../domain").NonFunctionAndIdentifierPropertiesWithNoPartial<MBase> extends infer T extends import("../../../domain").NonFunctionAndIdentifierPropertiesWithNoPartial<MBase> ? { [key in keyof T]: import("../../../domain").NonFunctionAndIdentifierPropertiesWithNoPartial<MBase>[key]; } : never;
23
- data: MBase[];
24
- count: any;
25
- };
26
- bindOrderByAttributes: (orderBy: RepositoryOrderBy<MBase>, fields: HasuraGraphQLFields<MBase>) => any[];
27
- bindAggretageAttributes: (aggregates: {
28
- minimal?: ({} | NonFunctionAndIdentifierPropertyNames<MBase>)[];
29
- maximum?: ({} | NonFunctionAndIdentifierPropertyNames<MBase>)[];
30
- }, fields: HasuraGraphQLFields<MBase>) => ({
31
- min: {}[];
32
- max?: undefined;
33
- } | {
34
- max: {}[];
35
- min?: undefined;
36
- })[];
37
- bindDistinctAttributes: (distinct: ({} | NonFunctionAndIdentifierPropertyNames<MBase>)[], fields: HasuraGraphQLFields<MBase>) => {}[];
38
- bindAttributesToColumns: (attributes: ({} | NonFunctionAndIdentifierPropertyNames<MBase>)[], fields: HasuraGraphQLFields<MBase>) => {}[];
39
- tableName: string;
40
- model: BaseModelBuilder<MBase, any, MBase & {
41
- prototype: unknown;
42
- }>;
43
- fields: HasuraGraphQLFields<MBase>;
44
- endpoint: string;
45
- authOptions: import("../types").HasuraGraphQLAuthOptions;
46
- logger: DebugHelper;
47
- cache?: import("../../../domain").CacheConfig;
48
- mutation: <ReturnFields = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation, fields?: string[] | HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields>;
49
- query: <ReturnFields_1 = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation | GraphQLParams<MBase>[], fields?: string[] | HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields_1>;
50
- getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
51
- convertDataFromHasura(data: Record<string, string | number>, fields?: string[] | HasuraGraphQLFields<MBase>): MBase;
52
- convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
53
- };
54
- } & TMixinBase;
1
+ import { FindRepository, ModelBaseStructure } from '../../../domain';
2
+ import { MergeConstructorParams, MixinCtor } from '../../../utils';
3
+ import { GraphQLRepository } from '../types';
4
+ export declare const withFindHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & FindRepository<MBase, import("../../../domain").FindRepositoryParams<MBase>> & InstanceType<TMixinBase>, MergeConstructorParams<any[], ConstructorParameters<TMixinBase>>>;
@@ -1,29 +1,5 @@
1
- import { GetRepositoryParams, ModelBaseStructure, RepositoryCacheOptions } from '../../../domain';
2
- import { DebugHelper, MixinCtor } from '../../../utils';
1
+ import { GetRepository, ModelBaseStructure } from '../../../domain';
2
+ import { MergeConstructorParams, MixinCtor } from '../../../utils';
3
3
  import { GraphQLRepository } from '../types';
4
- export type GetConstructorParams = {
5
- getGraphQLOperation?: string;
6
- };
7
- export declare const withGetHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => {
8
- new (...params: any[]): {
9
- getGraphQLOperation: string;
10
- generateCacheKey(identifiers: GetRepositoryParams<MBase>): string;
11
- get(identifiers: GetRepositoryParams<MBase>, options?: {
12
- cache?: RepositoryCacheOptions;
13
- }): Promise<MBase>;
14
- tableName: string;
15
- model: import("../../../domain").BaseModelBuilder<MBase, any, MBase & {
16
- prototype: unknown;
17
- }>;
18
- fields: import("../types").HasuraGraphQLFields<MBase>;
19
- endpoint: string;
20
- authOptions: import("../types").HasuraGraphQLAuthOptions;
21
- logger: DebugHelper;
22
- cache?: import("../../../domain").CacheConfig;
23
- mutation: <ReturnFields = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation, fields?: string[] | import("../types").HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields>;
24
- query: <ReturnFields_1 = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation | import("../types").GraphQLParams<MBase>[], fields?: string[] | import("../types").HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields_1>;
25
- getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
26
- convertDataFromHasura(data: Record<string, string | number>, fields?: string[] | import("../types").HasuraGraphQLFields<MBase>): MBase;
27
- convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
28
- };
29
- } & TMixinBase;
4
+ import { GetConstructorParams } from './factories';
5
+ export declare const withGetHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & GetRepository<MBase, import("../../../domain").GetRepositoryParams<MBase>> & InstanceType<TMixinBase>, MergeConstructorParams<[GetConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
@@ -1,24 +1,6 @@
1
- import { IOperation } from 'gql-query-builder/build/IQueryBuilderOptions';
2
- import { BaseModelBuilder, CacheConfig, ModelBaseStructure } from '../../../domain';
1
+ import { ModelBaseStructure } from '../../../domain';
3
2
  import { MergeConstructorParams, MixinCtor } from '../../../utils';
4
- import { Fields, GraphQLRepository, HasuraGraphQLAuthOptions, HasuraGraphQLFields, VariableOptions } from '../types';
5
- type QueryBuilderOptions = {
6
- operation: string | IOperation;
7
- fields: Fields;
8
- variables?: VariableOptions;
9
- };
10
- type HasuraGraphQLInterceptors<P = QueryBuilderOptions | QueryBuilderOptions[]> = {
11
- request?: <R>(request: P) => Promise<P & R>;
12
- response?: <R>(response: R, request: P) => Promise<R>;
13
- };
14
- export type HasuraConstructorParams<Model extends ModelBaseStructure<Model, Model['identifiersFields'][number]>> = {
15
- tableName: string;
16
- model: BaseModelBuilder<Model>;
17
- fields: HasuraGraphQLFields<Model>;
18
- endpoint: string;
19
- interceptors?: HasuraGraphQLInterceptors;
20
- authOptions: HasuraGraphQLAuthOptions;
21
- cache?: CacheConfig;
22
- };
3
+ import { GraphQLRepository } from '../types';
4
+ import { HasuraConstructorParams, HasuraGraphQLInterceptors } from './factories/hasura-graphql-class.factory';
5
+ export { HasuraConstructorParams, HasuraGraphQLInterceptors };
23
6
  export declare const withHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, T extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: T) => MixinCtor<GraphQLRepository<MBase>, any[]>;
24
- export {};
@@ -1,14 +1,6 @@
1
- import { ModelBaseStructure, RepositoryUpdateParams, UpdateRepository } from '../../../domain';
1
+ import { ModelBaseStructure } from '../../../domain';
2
2
  import { MergeConstructorParams, MixinCtor } from '../../../utils';
3
3
  import { GraphQLRepository } from '../types';
4
- export type UpdateHasuraGraphQLRepositoryType<MBase extends ModelBaseStructure<MBase, MBase['identifiersFields'][number]>> = UpdateRepository<MBase> & {
5
- paramsToPlain(params: RepositoryUpdateParams<MBase>): Partial<MBase>;
6
- };
7
- export type UpdateConstructorParams = {
8
- updateGraphQLOperation?: string;
9
- updateGraphQLObjectType?: string;
10
- updateGraphQLPKType?: string;
11
- };
12
- export declare const withUpdateHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & UpdateRepository<MBase, RepositoryUpdateParams<MBase>> & {
13
- paramsToPlain(params: RepositoryUpdateParams<MBase>): Partial<MBase>;
14
- } & InstanceType<TMixinBase>, MergeConstructorParams<[UpdateConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
4
+ import { UpdateConstructorParams, UpdateHasuraGraphQLRepositoryType } from './factories/update-hasura-class.factory';
5
+ export { UpdateConstructorParams, UpdateHasuraGraphQLRepositoryType };
6
+ export declare const withUpdateHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & UpdateHasuraGraphQLRepositoryType<MBase> & InstanceType<TMixinBase>, MergeConstructorParams<[UpdateConstructorParams, ...any[]], ConstructorParameters<TMixinBase>>>;
@@ -1,9 +1,7 @@
1
1
  import { CategoryCollectionChildren } from '../../../../domain';
2
2
  import { CategoryCollectionChildrenRepository } from '../../../../domain/catalog/repositories/category-collection-children.repository';
3
3
  import { HasuraConstructorParams } from '../../mixins';
4
- declare const CategoryCollectionChildrenHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<CategoryCollectionChildren> & import("../../../../domain").CrudRepository<CategoryCollectionChildren, import("../../../../domain").CrudParams<CategoryCollectionChildren>> & import("../../../../domain").UpdateRepository<CategoryCollectionChildren, import("../../../../domain").RepositoryUpdateParams<CategoryCollectionChildren>> & {
5
- paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<CategoryCollectionChildren>): Partial<CategoryCollectionChildren>;
6
- }, [HasuraConstructorParams<CategoryCollectionChildren> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
4
+ declare const CategoryCollectionChildrenHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<CategoryCollectionChildren> & import("../../../../domain").CrudRepository<CategoryCollectionChildren, import("../../../../domain").CrudParams<CategoryCollectionChildren>> & import("../../mixins").UpdateHasuraGraphQLRepositoryType<CategoryCollectionChildren>, [HasuraConstructorParams<CategoryCollectionChildren> & import("../../mixins/factories").CreateConstructorParams & import("../../mixins/factories").DeleteConstructorParams & import("../../mixins/factories").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
7
5
  export declare class CategoryCollectionChildrenHasuraGraphQLRepository extends CategoryCollectionChildrenHasuraGraphQLRepository_base implements CategoryCollectionChildrenRepository {
8
6
  constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<CategoryCollectionChildren>, 'endpoint' | 'authOptions' | 'interceptors' | 'cache'>);
9
7
  }
@@ -1,9 +1,7 @@
1
1
  import { CategoryFilter } from '../../../../domain';
2
2
  import { CategoryFilterRepository } from '../../../../domain/catalog/repositories';
3
3
  import { HasuraConstructorParams } from '../../mixins';
4
- declare const CategoryFilterHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<CategoryFilter> & import("../../../../domain").CrudRepository<CategoryFilter, import("../../../../domain").CrudParams<CategoryFilter>> & import("../../../../domain").UpdateRepository<CategoryFilter, import("../../../../domain").RepositoryUpdateParams<CategoryFilter>> & {
5
- paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<CategoryFilter>): Partial<CategoryFilter>;
6
- }, [HasuraConstructorParams<CategoryFilter> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
4
+ declare const CategoryFilterHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<CategoryFilter> & import("../../../../domain").CrudRepository<CategoryFilter, import("../../../../domain").CrudParams<CategoryFilter>> & import("../../mixins").UpdateHasuraGraphQLRepositoryType<CategoryFilter>, [HasuraConstructorParams<CategoryFilter> & import("../../mixins/factories").CreateConstructorParams & import("../../mixins/factories").DeleteConstructorParams & import("../../mixins/factories").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
7
5
  export declare class CategoryFilterHasuraGraphQLRepository extends CategoryFilterHasuraGraphQLRepository_base implements CategoryFilterRepository {
8
6
  constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<CategoryFilter>, 'endpoint' | 'authOptions' | 'interceptors' | 'cache'>);
9
7
  addFiltersToCategory(categoryId: number, filterIds: number[]): Promise<void>;
@@ -2,10 +2,9 @@ import { Category, CategoryRepository, CreateRepositoryParams, GetRepositoryPara
2
2
  import { HasuraConstructorParams } from '../../mixins';
3
3
  import { CategoryHasuraGraphQL } from '../../models';
4
4
  import { CategoryFilterHasuraGraphQLRepository } from './category-filter-hasura-graphql.repository';
5
+ import { CategoriesForHomeParams, MountCategoryParams } from './helpers';
5
6
  import { ProductHasuraGraphQLRepository } from './product-hasura-graphql.repository';
6
- declare const CategoryHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<CategoryHasuraGraphQL> & import("../../../../domain").CrudRepository<CategoryHasuraGraphQL, import("../../../../domain").CrudParams<CategoryHasuraGraphQL>> & import("../../../../domain").UpdateRepository<CategoryHasuraGraphQL, import("../../../../domain").RepositoryUpdateParams<CategoryHasuraGraphQL>> & {
7
- paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<CategoryHasuraGraphQL>): Partial<CategoryHasuraGraphQL>;
8
- }, [HasuraConstructorParams<CategoryHasuraGraphQL> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
7
+ declare const CategoryHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<CategoryHasuraGraphQL> & import("../../../../domain").CrudRepository<CategoryHasuraGraphQL, import("../../../../domain").CrudParams<CategoryHasuraGraphQL>> & import("../../mixins").UpdateHasuraGraphQLRepositoryType<CategoryHasuraGraphQL>, [HasuraConstructorParams<CategoryHasuraGraphQL> & import("../../mixins/factories").CreateConstructorParams & import("../../mixins/factories").DeleteConstructorParams & import("../../mixins/factories").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
9
8
  export declare class CategoryHasuraGraphQLRepository extends CategoryHasuraGraphQLRepository_base implements CategoryRepository {
10
9
  private readonly productRepository;
11
10
  private readonly categoryFilterRepository;
@@ -21,19 +20,11 @@ export declare class CategoryHasuraGraphQLRepository extends CategoryHasuraGraph
21
20
  getCategoryByShop(shop: string, optionsCache?: {
22
21
  cache?: RepositoryCacheOptions;
23
22
  }): Promise<Category[]>;
24
- getCategoriesForHome(categoryIds: string[], shop: Shops, limit?: number, optionsCache?: {
25
- cache?: RepositoryCacheOptions;
26
- }): Promise<{
23
+ getCategoriesForHome(params: CategoriesForHomeParams): Promise<{
27
24
  category: Category;
28
25
  products: Product[];
29
26
  }[]>;
30
- mountCategory(category: Category, shop: Shops, options?: {
31
- limit?: number;
32
- hasStock?: boolean;
33
- gender?: string;
34
- }, optionsCache?: {
35
- cache?: RepositoryCacheOptions;
36
- }): Promise<Product[]>;
27
+ mountCategory(params: MountCategoryParams): Promise<Product[]>;
37
28
  getChildren(parentId: number, _optionsCache?: {
38
29
  cache?: RepositoryCacheOptions;
39
30
  }): Promise<Category[]>;
@@ -42,7 +33,5 @@ export declare class CategoryHasuraGraphQLRepository extends CategoryHasuraGraph
42
33
  private updateProducts;
43
34
  private updateMetadata;
44
35
  private updateFilters;
45
- private saveToCache;
46
- private reorganizeMostRelevantsProducts;
47
36
  }
48
37
  export {};
@@ -1,8 +1,6 @@
1
1
  import { CategoryProduct, CategoryProductRepository } from '../../../../domain';
2
2
  import { HasuraConstructorParams } from '../../mixins';
3
- declare const CategoryProductHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<CategoryProduct> & import("../../../../domain").CrudRepository<CategoryProduct, import("../../../../domain").CrudParams<CategoryProduct>> & import("../../../../domain").UpdateRepository<CategoryProduct, import("../../../../domain").RepositoryUpdateParams<CategoryProduct>> & {
4
- paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<CategoryProduct>): Partial<CategoryProduct>;
5
- }, [HasuraConstructorParams<CategoryProduct> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
3
+ declare const CategoryProductHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<CategoryProduct> & import("../../../../domain").CrudRepository<CategoryProduct, import("../../../../domain").CrudParams<CategoryProduct>> & import("../../mixins").UpdateHasuraGraphQLRepositoryType<CategoryProduct>, [HasuraConstructorParams<CategoryProduct> & import("../../mixins/factories").CreateConstructorParams & import("../../mixins/factories").DeleteConstructorParams & import("../../mixins/factories").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
6
4
  export declare class CategoryProductHasuraGraphQLRepository extends CategoryProductHasuraGraphQLRepository_base implements CategoryProductRepository {
7
5
  constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<CategoryProduct>, 'endpoint' | 'authOptions' | 'interceptors' | 'cache'>);
8
6
  removeProductsFromCategory(categoryId: string, productIds: string[]): Promise<void>;
@@ -3,15 +3,13 @@ import { FilterRepository } from '../../../../domain/catalog/repositories';
3
3
  import { HasuraConstructorParams } from '../../mixins';
4
4
  import { CategoryFilterHasuraGraphQLRepository } from './category-filter-hasura-graphql.repository';
5
5
  import { FilterOptionHasuraGraphQLRepository } from './filter-option-hasura-graphql.repository';
6
- declare const FilterHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<Filter> & import("../../../../domain").CrudRepository<Filter, import("../../../../domain").CrudParams<Filter>> & import("../../../../domain").UpdateRepository<Filter, import("../../../../domain").RepositoryUpdateParams<Filter>> & {
7
- paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<Filter>): Partial<Filter>;
8
- }, [HasuraConstructorParams<Filter> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
6
+ declare const FilterHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<Filter> & import("../../../../domain").CrudRepository<Filter, import("../../../../domain").CrudParams<Filter>> & import("../../mixins").UpdateHasuraGraphQLRepositoryType<Filter>, [HasuraConstructorParams<Filter> & import("../../mixins/factories").CreateConstructorParams & import("../../mixins/factories").DeleteConstructorParams & import("../../mixins/factories").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
9
7
  export declare class FilterHasuraGraphQLRepository extends FilterHasuraGraphQLRepository_base implements FilterRepository {
10
8
  private readonly filterOptionRepository;
11
9
  private readonly categoryFilterRepository;
12
10
  constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<Filter>, 'endpoint' | 'authOptions' | 'interceptors' | 'cache'>, filterOptionRepository: FilterOptionHasuraGraphQLRepository, categoryFilterRepository: CategoryFilterHasuraGraphQLRepository);
13
11
  update(params: UpdateRepositoryParams<Filter>): Promise<Filter>;
14
- updateOptions(filterId: number, { options }: Pick<UpdateRepositoryParams<Filter>, 'options'>): Promise<import("../../../../domain").FilterOption[]>;
12
+ updateOptions(filterId: number, { options }: Pick<UpdateRepositoryParams<Filter>, 'options'>): Promise<any[]>;
15
13
  delete(params: DeleteRepositoryParams<Filter>): Promise<void>;
16
14
  deleteOptions(filterId: number): Promise<void>;
17
15
  }
@@ -1,9 +1,7 @@
1
1
  import { FilterOption } from '../../../../domain';
2
2
  import { FilterOptionRepository } from '../../../../domain/catalog/repositories';
3
3
  import { HasuraConstructorParams } from '../../mixins';
4
- declare const FilterOptionHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<FilterOption> & import("../../../../domain").CrudRepository<FilterOption, import("../../../../domain").CrudParams<FilterOption>> & import("../../../../domain").UpdateRepository<FilterOption, import("../../../../domain").RepositoryUpdateParams<FilterOption>> & {
5
- paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<FilterOption>): Partial<FilterOption>;
6
- }, [HasuraConstructorParams<FilterOption> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
4
+ declare const FilterOptionHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<FilterOption> & import("../../../../domain").CrudRepository<FilterOption, import("../../../../domain").CrudParams<FilterOption>> & import("../../mixins").UpdateHasuraGraphQLRepositoryType<FilterOption>, [HasuraConstructorParams<FilterOption> & import("../../mixins/factories").CreateConstructorParams & import("../../mixins/factories").DeleteConstructorParams & import("../../mixins/factories").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
7
5
  export declare class FilterOptionHasuraGraphQLRepository extends FilterOptionHasuraGraphQLRepository_base implements FilterOptionRepository {
8
6
  constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<FilterOption>, 'endpoint' | 'authOptions' | 'interceptors' | 'cache'>);
9
7
  }
@@ -0,0 +1,31 @@
1
+ import { CacheAdapter, Category, Product, RepositoryCacheOptions, Shops } from '../../../../../domain';
2
+ import { DebugHelper } from '../../../../../utils';
3
+ import { ProductHasuraGraphQL } from '../../../models';
4
+ export interface CategoryCacheParams {
5
+ category: Category;
6
+ shop: Shops;
7
+ options: {
8
+ limit?: number;
9
+ hasStock?: boolean;
10
+ };
11
+ optionsCache: {
12
+ cache?: RepositoryCacheOptions;
13
+ };
14
+ }
15
+ export declare class CategoryCacheOperationsHelper {
16
+ static generateCacheKey(category: Category, shop: Shops, options: {
17
+ limit?: number;
18
+ hasStock?: boolean;
19
+ }): string;
20
+ static getCachedProducts(cacheAdapter: CacheAdapter, cacheKey: string, logger: DebugHelper): Promise<ProductHasuraGraphQL[] | null>;
21
+ static saveProductsToCache(params: {
22
+ cacheAdapter: CacheAdapter;
23
+ cacheKey: string;
24
+ products: Product[];
25
+ ttl: number;
26
+ logger: DebugHelper;
27
+ }): Promise<void>;
28
+ static shouldUseCache(cacheAdapter: CacheAdapter, optionsCache?: {
29
+ cache?: RepositoryCacheOptions;
30
+ }): boolean;
31
+ }
@@ -0,0 +1,17 @@
1
+ import { Filter, UpdateRepositoryParams } from '../../../../../domain';
2
+ import { CategoryHasuraGraphQL } from '../../../models';
3
+ import { CategoryFilterHasuraGraphQLRepository } from '../category-filter-hasura-graphql.repository';
4
+ interface FilterUpdateDependencies {
5
+ categoryFilterRepository: CategoryFilterHasuraGraphQLRepository;
6
+ }
7
+ export declare class CategoryFilterOperationsHelper {
8
+ static executeUpdate(categoryId: number, filters: Pick<UpdateRepositoryParams<CategoryHasuraGraphQL>, 'filters'>['filters'], dependencies: FilterUpdateDependencies): Promise<Filter[]>;
9
+ private static handleRemoveAction;
10
+ private static handleMergeAction;
11
+ private static handleReplaceAction;
12
+ private static getCurrentFilters;
13
+ private static calculateFilterDifferences;
14
+ private static processFilterDeletions;
15
+ private static processFilterInsertions;
16
+ }
17
+ export {};
@@ -0,0 +1,32 @@
1
+ import { Category, Product, RepositoryCacheOptions, Shops } from '../../../../../domain';
2
+ export interface CategoriesForHomeParams {
3
+ categoryIds: string[];
4
+ shop: Shops;
5
+ limit?: number;
6
+ optionsCache?: {
7
+ cache?: RepositoryCacheOptions;
8
+ };
9
+ }
10
+ export interface CategoryHomeSection {
11
+ category: Category;
12
+ products: Product[];
13
+ }
14
+ export declare class CategoryHomeOperationsHelper {
15
+ static separateCategoryIds(categoryIds: string[]): {
16
+ firestore: string[];
17
+ hasura: string[];
18
+ };
19
+ static fetchFirestoreCategories(categoriesFirestore: string[], findFunction: Function, optionsCache?: {
20
+ cache?: RepositoryCacheOptions;
21
+ }): Promise<Category[]>;
22
+ static fetchHasuraCategories(categoriesHasura: string[], findFunction: Function, optionsCache?: {
23
+ cache?: RepositoryCacheOptions;
24
+ }): Promise<Category[]>;
25
+ static buildHomeSections(categories: Category[], mountCategoryFunction: Function, params: {
26
+ shop: Shops;
27
+ limit: number;
28
+ optionsCache?: {
29
+ cache?: RepositoryCacheOptions;
30
+ };
31
+ }): Promise<CategoryHomeSection[]>;
32
+ }
@@ -0,0 +1,19 @@
1
+ import { CacheAdapter, Product } from '../../../../../domain';
2
+ import { DebugHelper } from '../../../../../utils';
3
+ import { ProductHasuraGraphQLRepository } from '../product-hasura-graphql.repository';
4
+ import { MountCategoryParams } from './category-product-operations.helper';
5
+ interface MountCategoryDependencies {
6
+ productRepository: ProductHasuraGraphQLRepository;
7
+ cacheAdapter?: CacheAdapter;
8
+ defaultCacheTtl: number;
9
+ logger: DebugHelper;
10
+ }
11
+ export declare class CategoryMountOperationsHelper {
12
+ static executeMount(params: MountCategoryParams, dependencies: MountCategoryDependencies): Promise<Product[]>;
13
+ private static tryGetFromCache;
14
+ private static fetchMostRelevantProducts;
15
+ private static finalizeMountWithMostRelevants;
16
+ private static finalizeMountWithAllProducts;
17
+ private static saveToCacheIfNeeded;
18
+ }
19
+ export {};
@@ -0,0 +1,62 @@
1
+ import { Category, FindRepositoryParams, NonFunctionPropertyNames, ProductRepository, RepositoryCacheOptions, Shops, Where } from '../../../../../domain';
2
+ import { ProductHasuraGraphQL } from '../../../models';
3
+ export interface MountCategoryParams {
4
+ category: Category;
5
+ shop: Shops;
6
+ options?: {
7
+ limit?: number;
8
+ hasStock?: boolean;
9
+ gender?: string;
10
+ };
11
+ optionsCache?: {
12
+ cache?: RepositoryCacheOptions;
13
+ };
14
+ }
15
+ export interface ProductSearchFilters {
16
+ id: {
17
+ operator: Where;
18
+ value: string[];
19
+ };
20
+ published: boolean;
21
+ stock?: {
22
+ quantity: {
23
+ operator: Where;
24
+ value: number;
25
+ };
26
+ };
27
+ }
28
+ export declare class CategoryProductOperationsHelper {
29
+ static getProductFields(): NonFunctionPropertyNames<ProductHasuraGraphQL>[];
30
+ static buildProductFilters(productIds: string[], hasStock?: boolean): ProductSearchFilters;
31
+ static buildProductQuery(params: {
32
+ productIds: string[];
33
+ fields: NonFunctionPropertyNames<ProductHasuraGraphQL>[];
34
+ hasStock?: boolean;
35
+ limit?: number;
36
+ }): FindRepositoryParams<ProductHasuraGraphQL>;
37
+ static getGenderParam(shop: Shops): 'male' | 'female';
38
+ static fetchMostRelevantProducts(params: {
39
+ productRepository: ProductRepository;
40
+ mostRelevantsIds: string[];
41
+ fields: NonFunctionPropertyNames<ProductHasuraGraphQL>[];
42
+ shop: Shops;
43
+ hasStock?: boolean;
44
+ optionsCache?: {
45
+ cache?: RepositoryCacheOptions;
46
+ };
47
+ }): Promise<ProductHasuraGraphQL[]>;
48
+ static fetchRegularProducts(params: {
49
+ productRepository: ProductRepository;
50
+ productIds: string[];
51
+ fields: NonFunctionPropertyNames<ProductHasuraGraphQL>[];
52
+ shop: Shops;
53
+ options: {
54
+ hasStock?: boolean;
55
+ limit?: number;
56
+ };
57
+ optionsCache?: {
58
+ cache?: RepositoryCacheOptions;
59
+ };
60
+ }): Promise<ProductHasuraGraphQL[]>;
61
+ static reorganizeMostRelevantsProducts(products: ProductHasuraGraphQL[], mostRelevantsIds: string[], limit?: number): ProductHasuraGraphQL[];
62
+ }
@@ -0,0 +1,10 @@
1
+ export * from './category-cache-operations.helper';
2
+ export * from './category-filter-operations.helper';
3
+ export * from './category-home-operations.helper';
4
+ export * from './category-mount-operations.helper';
5
+ export * from './category-product-operations.helper';
6
+ export * from './product-fetch-reviews.helper';
7
+ export * from './product-review-cache.helper';
8
+ export * from './product-review-operations.helper';
9
+ export * from './product-review-update.helper';
10
+ export * from './product-variant-report.helper';
@@ -0,0 +1,17 @@
1
+ import { ProductReview, ReviewStatusParams, ReviewWithProductData } from '../../../../../domain';
2
+ import { ProductHasuraGraphQL } from '../../../models';
3
+ interface FetchReviewsDependencies {
4
+ query: (table: string, fields: any, params?: any) => Promise<any>;
5
+ bindReviewToModel: (plain: any) => ProductReview;
6
+ reviewsFields: any;
7
+ }
8
+ export declare class ProductFetchReviewsHelper {
9
+ static buildReviewsExpression(status: ReviewStatusParams): any;
10
+ static fetchProductsWithReviews(status: ReviewStatusParams, dependencies: FetchReviewsDependencies): Promise<any[]>;
11
+ static processReviewsData(data: Array<Omit<ProductHasuraGraphQL, 'reviews'> & {
12
+ reviews: Array<Record<'person_id' | 'order_id' | 'created_at' | 'updated_at' | 'status', any>>;
13
+ }>, status: ReviewStatusParams, bindReviewToModel: (plain: any) => ProductReview): ReviewWithProductData[];
14
+ private static matchesStatus;
15
+ static executeQuery(status: ReviewStatusParams, dependencies: FetchReviewsDependencies): Promise<ReviewWithProductData[]>;
16
+ }
17
+ export {};
@@ -0,0 +1,28 @@
1
+ import { PaginatedReviewFilters, ProductReview, RepositoryCacheOptions, ReviewStatusParams, ReviewWithProductData } from '../../../../../domain';
2
+ interface CacheOperationDependencies {
3
+ cacheAdapter: any;
4
+ logger: any;
5
+ modelName: string;
6
+ defaultTtl: number;
7
+ }
8
+ interface CacheCheckParams {
9
+ key: string;
10
+ dependencies: CacheOperationDependencies;
11
+ }
12
+ interface CacheSaveParams {
13
+ key: string;
14
+ data: any;
15
+ ttl?: number;
16
+ dependencies: CacheOperationDependencies;
17
+ }
18
+ export declare class ProductReviewCacheHelper {
19
+ static generateProductReviewsCacheKey(filters: PaginatedReviewFilters, modelName: string): string;
20
+ static generateReviewsStatusCacheKey(status: ReviewStatusParams, modelName: string): string;
21
+ static generateProductReviewsCacheKeyForProduct(productId: number, modelName: string): string;
22
+ static tryGetFromCache(params: CacheCheckParams): Promise<ReviewWithProductData[] | ProductReview[] | null>;
23
+ static saveToCache(params: CacheSaveParams): Promise<void>;
24
+ static shouldUseCache(cacheAdapter: any, options?: {
25
+ cache?: RepositoryCacheOptions;
26
+ }): boolean;
27
+ }
28
+ export {};
@@ -0,0 +1,20 @@
1
+ import { PaginatedReviewFilters, ProductReview, ReviewWithProductData } from '../../../../../domain';
2
+ import { ProductHasuraGraphQL } from '../../../models';
3
+ interface ReviewDataFetchParams {
4
+ repository: any;
5
+ limit: number;
6
+ }
7
+ interface ReviewProcessingParams {
8
+ data: ProductHasuraGraphQL[];
9
+ getReviewStatus: (review: ProductReview) => 'approved' | 'rejected' | 'pending';
10
+ }
11
+ interface ReviewFilteringParams {
12
+ reviews: ReviewWithProductData[];
13
+ filters: PaginatedReviewFilters;
14
+ }
15
+ export declare class ProductReviewOperationsHelper {
16
+ static fetchAllProductsWithReviews(params: ReviewDataFetchParams): Promise<ProductHasuraGraphQL[]>;
17
+ static processProductsToReviews(params: ReviewProcessingParams): ReviewWithProductData[];
18
+ static applyReviewFilters(params: ReviewFilteringParams): ReviewWithProductData[];
19
+ }
20
+ export {};
@@ -0,0 +1,20 @@
1
+ import { NonFunctionPropertyNames, ProductReview, UpdateRepositoryParams } from '../../../../../domain';
2
+ import { UpdateHasuraGraphQLRepositoryType } from '../../../mixins';
3
+ import { ProductHasuraGraphQL } from '../../../models';
4
+ import { GraphQLRepository } from '../../../types';
5
+ interface ReviewUpdateDependencies {
6
+ mutation: GraphQLRepository<ProductHasuraGraphQL>['mutation'];
7
+ findReview: (review: ProductReview, productId: number) => Promise<ProductReview>;
8
+ bindReviewToModel: (plain: Record<'person_id' | 'order_id' | 'created_at' | 'updated_at', any>) => ProductReview;
9
+ bindReviewToHasura: (review: ProductReview) => any;
10
+ reviewsFields: NonFunctionPropertyNames<ProductHasuraGraphQL>[];
11
+ paramsToPlain: UpdateHasuraGraphQLRepositoryType<ProductHasuraGraphQL>['paramsToPlain'];
12
+ }
13
+ export declare class ProductReviewUpdateHelper {
14
+ static executeUpdate(productId: number, reviews: Pick<UpdateRepositoryParams<ProductHasuraGraphQL>, 'reviews'>['reviews'], dependencies: ReviewUpdateDependencies): Promise<ProductReview[]>;
15
+ private static handleRemoveReviews;
16
+ private static handleUpsertReviews;
17
+ private static updateExistingReview;
18
+ private static insertNewReview;
19
+ }
20
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ProductVariantReport } from '../../../../../domain';
2
+ interface VariantReportDependencies {
3
+ query: (table: string, fields: string[]) => Promise<any>;
4
+ }
5
+ export declare class ProductVariantReportHelper {
6
+ static getReportFields(): string[];
7
+ static executeReport(dependencies: VariantReportDependencies): Promise<ProductVariantReport[]>;
8
+ }
9
+ export {};