@infrab4a/connect 3.13.3 → 3.13.6-beta.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 (155) hide show
  1. package/bundles/infrab4a-connect.umd.js +725 -116
  2. package/bundles/infrab4a-connect.umd.js.map +1 -1
  3. package/domain/catalog/helpers/index.d.ts +1 -1
  4. package/domain/catalog/models/category-collection-children.d.ts +1 -2
  5. package/domain/catalog/models/category-filter.d.ts +1 -1
  6. package/domain/catalog/models/category.d.ts +1 -2
  7. package/domain/catalog/models/filter-option.d.ts +1 -2
  8. package/domain/catalog/models/filter.d.ts +1 -2
  9. package/domain/catalog/models/kit-product.d.ts +1 -1
  10. package/domain/catalog/models/product.d.ts +1 -2
  11. package/domain/catalog/models/variant.d.ts +1 -2
  12. package/domain/generic/model/base.model.d.ts +9 -5
  13. package/domain/generic/model/types/base-model-builder.type.d.ts +4 -2
  14. package/domain/generic/model/types/identifier-model.type.d.ts +6 -5
  15. package/domain/generic/model/types/model-base-structure.type.d.ts +9 -3
  16. package/domain/generic/model/types/non-function-property-name.type.d.ts +12 -3
  17. package/domain/generic/repository/get.repository.d.ts +2 -2
  18. package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
  19. package/domain/generic/repository/types/repository-order-by-list.type.d.ts +2 -2
  20. package/domain/generic/repository/types/repository-update-params.type.d.ts +2 -2
  21. package/domain/location/models/address.d.ts +4 -3
  22. package/domain/shopping/models/checkout.d.ts +5 -6
  23. package/domain/shopping/models/subscription/checkout.d.ts +3 -4
  24. package/domain/users/models/subscription/subscription.d.ts +3 -3
  25. package/domain/users/models/user-address.d.ts +1 -1
  26. package/domain/users/models/user.d.ts +3 -4
  27. package/esm2015/domain/catalog/helpers/index.js +2 -2
  28. package/esm2015/domain/catalog/helpers/round-product-price.helper.js +15 -0
  29. package/esm2015/domain/catalog/models/category-collection-children.js +1 -4
  30. package/esm2015/domain/catalog/models/category-filter.js +1 -4
  31. package/esm2015/domain/catalog/models/category.js +1 -4
  32. package/esm2015/domain/catalog/models/filter-option.js +1 -4
  33. package/esm2015/domain/catalog/models/filter.js +1 -4
  34. package/esm2015/domain/catalog/models/kit-product.js +2 -2
  35. package/esm2015/domain/catalog/models/product.js +1 -4
  36. package/esm2015/domain/catalog/models/variant.js +1 -4
  37. package/esm2015/domain/generic/model/base.model.js +3 -2
  38. package/esm2015/domain/generic/model/types/base-model-builder.type.js +1 -1
  39. package/esm2015/domain/generic/model/types/identifier-model.type.js +1 -1
  40. package/esm2015/domain/generic/model/types/model-base-structure.type.js +1 -1
  41. package/esm2015/domain/generic/model/types/non-function-property-name.type.js +1 -1
  42. package/esm2015/domain/generic/repository/get.repository.js +1 -1
  43. package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +1 -1
  44. package/esm2015/domain/generic/repository/types/repository-order-by-list.type.js +1 -1
  45. package/esm2015/domain/generic/repository/types/repository-update-params.type.js +1 -1
  46. package/esm2015/domain/location/models/address.js +2 -2
  47. package/esm2015/domain/shopping/models/checkout.js +6 -7
  48. package/esm2015/domain/shopping/models/order.js +1 -1
  49. package/esm2015/domain/shopping/models/subscription/checkout.js +6 -6
  50. package/esm2015/domain/users/models/subscription/subscription.js +6 -6
  51. package/esm2015/domain/users/models/user-address.js +1 -1
  52. package/esm2015/domain/users/models/user.js +3 -3
  53. package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +1 -1
  54. package/esm2015/infra/elasticsearch/indexes/products-index.js +8 -3
  55. package/esm2015/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +3 -3
  56. package/esm2015/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +1 -1
  57. package/esm2015/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +1 -1
  58. package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +1 -1
  59. package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +1 -1
  60. package/esm2015/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +2 -2
  61. package/esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js +1 -1
  62. package/esm2015/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +1 -1
  63. package/esm2015/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +1 -1
  64. package/esm2015/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +2 -2
  65. package/esm2015/infra/firebase/firestore/types/firestore-sub.repository.type.js +1 -1
  66. package/esm2015/infra/firebase/firestore/types/firestore.helpers.type.js +1 -1
  67. package/esm2015/infra/firebase/firestore/types/firestore.repository.type.js +1 -1
  68. package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +1 -1
  69. package/esm2015/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.js +19 -14
  70. package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +1 -1
  71. package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +23 -18
  72. package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +19 -3
  73. package/esm2015/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.js +2 -2
  74. package/esm2015/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.js +5 -3
  75. package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +18 -4
  76. package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +5 -3
  77. package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +7 -4
  78. package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +7 -5
  79. package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +1 -1
  80. package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
  81. package/esm2015/utils/decorators/debug.class.decorator.js +7 -0
  82. package/esm2015/utils/decorators/index.js +3 -0
  83. package/esm2015/utils/decorators/trace.method.decorator.js +81 -0
  84. package/esm2015/utils/helpers/class-name.helper.js +15 -0
  85. package/esm2015/utils/helpers/debug-decorator.helper.js +18 -0
  86. package/esm2015/utils/helpers/debug.helper.js +150 -0
  87. package/esm2015/utils/helpers/index.js +5 -0
  88. package/esm2015/utils/helpers/reflect.helper.js +165 -0
  89. package/esm2015/utils/index.js +4 -1
  90. package/esm2015/utils/log.utils.js +9 -0
  91. package/fesm2015/infrab4a-connect.js +557 -90
  92. package/fesm2015/infrab4a-connect.js.map +1 -1
  93. package/infra/elasticsearch/adapters/axios.adapter.d.ts +2 -2
  94. package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +2 -2
  95. package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +3 -3
  96. package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +3 -3
  97. package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +2 -2
  98. package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +1 -1
  99. package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +3 -3
  100. package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +4 -4
  101. package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +4 -4
  102. package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +3 -3
  103. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +1 -1
  104. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -1
  105. package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +1 -1
  106. package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +1 -1
  107. package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +1 -1
  108. package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +1 -1
  109. package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +1 -1
  110. package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +1 -1
  111. package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +1 -1
  112. package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +1 -1
  113. package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +1 -1
  114. package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +1 -1
  115. package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +1 -1
  116. package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +1 -1
  117. package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +1 -1
  118. package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +1 -1
  119. package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +1 -1
  120. package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +1 -1
  121. package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +1 -1
  122. package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +1 -1
  123. package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +1 -1
  124. package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +1 -1
  125. package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +1 -1
  126. package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +1 -1
  127. package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +3 -3
  128. package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +5 -5
  129. package/infra/firebase/firestore/types/firestore.repository.type.d.ts +1 -1
  130. package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +5 -3
  131. package/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.d.ts +5 -5
  132. package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +4 -2
  133. package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +6 -5
  134. package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +2 -1
  135. package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +4 -4
  136. package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +2 -2
  137. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +11 -9
  138. package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +5 -4
  139. package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +2 -2
  140. package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +2 -2
  141. package/infra/hasura-graphql/types/graphql.repository.type.d.ts +5 -3
  142. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +7 -3
  143. package/package.json +3 -2
  144. package/utils/decorators/debug.class.decorator.d.ts +2 -0
  145. package/utils/decorators/index.d.ts +2 -0
  146. package/utils/decorators/trace.method.decorator.d.ts +14 -0
  147. package/utils/helpers/class-name.helper.d.ts +3 -0
  148. package/utils/helpers/debug-decorator.helper.d.ts +9 -0
  149. package/utils/helpers/debug.helper.d.ts +60 -0
  150. package/utils/helpers/index.d.ts +4 -0
  151. package/utils/helpers/reflect.helper.d.ts +50 -0
  152. package/utils/index.d.ts +3 -0
  153. package/utils/log.utils.d.ts +7 -0
  154. package/esm2015/domain/catalog/helpers/RoundProdutcPriceHelper.js +0 -15
  155. /package/domain/catalog/helpers/{RoundProdutcPriceHelper.d.ts → round-product-price.helper.d.ts} +0 -0
@@ -1,20 +1,22 @@
1
- import { FindRepositoryParams, ModelBaseStructure, RepositoryFindResult } from '../../../domain';
2
- import { MixinCtor } from '../../../utils';
3
- import { GraphQLParams, GraphQLRepository } from '../types';
4
- export declare const withFindHasuraGraphQL: <MBase extends ModelBaseStructure<any, any>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => {
1
+ import { FindRepositoryParams, ModelBaseStructure, 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
5
  new (...args: any[]): {
6
6
  find(params?: FindRepositoryParams<MBase>): Promise<RepositoryFindResult<MBase>>;
7
+ bindOrderByAttributes: (orderBy: RepositoryOrderBy<MBase>, fields: HasuraGraphQLFields<MBase>) => {};
7
8
  tableName: string;
8
- model: import("../../../domain").BaseModelBuilder<MBase, import("../../../domain").NonFunctionAndIdentifierPropertyNames<MBase>, MBase & {
9
+ model: import("../../../domain").BaseModelBuilder<MBase, any, MBase & {
9
10
  prototype: unknown;
10
11
  }>;
11
- fields: import("../types").HasuraGraphQLFields<MBase>;
12
+ fields: HasuraGraphQLFields<MBase>;
12
13
  endpoint: string;
13
14
  authOptions: import("../types").HasuraGraphQLAuthOptions;
14
- mutation: <ReturnFields = any>(operation: string, fields?: string[] | import("../types").HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields>;
15
- query: <ReturnFields_1 = any>(operation: string | GraphQLParams<MBase>[], fields?: string[] | import("../types").HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields_1>;
15
+ logger: DebugHelper;
16
+ mutation: <ReturnFields = any>(operation: string, fields?: string[] | HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields>;
17
+ query: <ReturnFields_1 = any>(operation: string | GraphQLParams<MBase>[], fields?: string[] | HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields_1>;
16
18
  getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
17
- convertDataFromHasura: (data: Record<string, string | number>) => MBase;
19
+ convertDataFromHasura(data: Record<string, string | number>, fields?: string[] | HasuraGraphQLFields<MBase>): MBase;
18
20
  convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
19
21
  };
20
22
  } & TMixinBase;
@@ -1,24 +1,25 @@
1
1
  import { GetRepositoryParams, ModelBaseStructure } from '../../../domain';
2
- import { MixinCtor } from '../../../utils';
2
+ import { DebugHelper, MixinCtor } from '../../../utils';
3
3
  import { GraphQLRepository } from '../types';
4
4
  export declare type GetConstructorParams = {
5
5
  getGraphQLOperation?: string;
6
6
  };
7
- export declare const withGetHasuraGraphQL: <MBase extends ModelBaseStructure<any, any>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => {
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
8
  new (...params: any[]): {
9
9
  getGraphQLOperation: string;
10
10
  get(identifiers: GetRepositoryParams<MBase>): Promise<MBase>;
11
11
  tableName: string;
12
- model: import("../../../domain").BaseModelBuilder<MBase, import("../../../domain").NonFunctionAndIdentifierPropertyNames<MBase>, MBase & {
12
+ model: import("../../../domain").BaseModelBuilder<MBase, any, MBase & {
13
13
  prototype: unknown;
14
14
  }>;
15
15
  fields: import("../types").HasuraGraphQLFields<MBase>;
16
16
  endpoint: string;
17
17
  authOptions: import("../types").HasuraGraphQLAuthOptions;
18
+ logger: DebugHelper;
18
19
  mutation: <ReturnFields = any>(operation: string, fields?: string[] | import("../types").HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields>;
19
20
  query: <ReturnFields_1 = any>(operation: string | import("../types").GraphQLParams<MBase>[], fields?: string[] | import("../types").HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields_1>;
20
21
  getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
21
- convertDataFromHasura: (data: Record<string, string | number>) => MBase;
22
+ convertDataFromHasura(data: Record<string, string | number>, fields?: string[] | import("../types").HasuraGraphQLFields<MBase>): MBase;
22
23
  convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
23
24
  };
24
25
  } & TMixinBase;
@@ -1,11 +1,11 @@
1
1
  import { BaseModelBuilder, ModelBaseStructure } from '../../../domain';
2
2
  import { MergeConstructorParams, MixinCtor } from '../../../utils';
3
3
  import { GraphQLRepository, HasuraGraphQLAuthOptions, HasuraGraphQLFields } from '../types';
4
- export declare type ConstructorParams<Model extends ModelBaseStructure> = {
4
+ export declare type ConstructorParams<Model extends ModelBaseStructure<Model, Model['identifiersFields'][number]>> = {
5
5
  tableName: string;
6
6
  model: BaseModelBuilder<Model>;
7
7
  fields: HasuraGraphQLFields<Model>;
8
8
  endpoint: string;
9
9
  authOptions: HasuraGraphQLAuthOptions;
10
10
  };
11
- export declare const withHasuraGraphQL: <MBase extends ModelBaseStructure<any, any>, T extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: T) => MixinCtor<GraphQLRepository<MBase>, MergeConstructorParams<ConstructorParams<MBase>, ConstructorParameters<T>>>;
11
+ export declare const withHasuraGraphQL: <MBase extends ModelBaseStructure<MBase, MBase["identifiersFields"][number]>, T extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: T) => MixinCtor<GraphQLRepository<MBase>, MergeConstructorParams<ConstructorParams<MBase>, ConstructorParameters<T>>>;
@@ -1,7 +1,7 @@
1
1
  import { ModelBaseStructure, RepositoryUpdateParams, UpdateRepository } from '../../../domain';
2
2
  import { MergeConstructorParams, MixinCtor } from '../../../utils';
3
3
  import { GraphQLRepository } from '../types';
4
- export declare type UpdateHasuraGraphQLRepositoryType<MBase extends ModelBaseStructure> = UpdateRepository<MBase> & {
4
+ export declare type UpdateHasuraGraphQLRepositoryType<MBase extends ModelBaseStructure<MBase, MBase['identifiersFields'][number]>> = UpdateRepository<MBase> & {
5
5
  paramsToPlain(params: RepositoryUpdateParams<MBase>): Partial<MBase>;
6
6
  };
7
7
  export declare type UpdateConstructorParams = {
@@ -9,6 +9,6 @@ export declare type UpdateConstructorParams = {
9
9
  updateGraphQLObjectType?: string;
10
10
  updateGraphQLPKType?: string;
11
11
  };
12
- export declare const withUpdateHasuraGraphQL: <MBase extends ModelBaseStructure<any, any>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => MixinCtor<GraphQLRepository<MBase> & UpdateRepository<MBase, RepositoryUpdateParams<MBase>> & {
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
13
  paramsToPlain(params: RepositoryUpdateParams<MBase>): Partial<MBase>;
14
14
  } & InstanceType<TMixinBase>, MergeConstructorParams<UpdateConstructorParams, ConstructorParameters<TMixinBase>>>;
@@ -1,21 +1,23 @@
1
1
  import { BaseModelBuilder, ModelBaseStructure } from '../../../domain';
2
+ import { DebugHelper } from '../../../utils';
2
3
  import { HasuraGraphQLAuthOptions } from './hasura-graphql-auth-options.type';
3
4
  import { HasuraGraphQLFields } from './hasura-graphql-fields.type';
4
5
  import { VariableOptions } from './variable-options.type';
5
- export declare type GraphQLParams<Model extends ModelBaseStructure> = {
6
+ export declare type GraphQLParams<Model extends ModelBaseStructure<Model>> = {
6
7
  operation: string;
7
8
  fields?: HasuraGraphQLFields<Model>;
8
9
  variables?: VariableOptions;
9
10
  };
10
- export declare type GraphQLRepository<Model extends ModelBaseStructure> = {
11
+ export declare type GraphQLRepository<Model extends ModelBaseStructure<Model>> = {
11
12
  tableName: string;
12
13
  model: BaseModelBuilder<Model>;
13
14
  fields: HasuraGraphQLFields<Model>;
14
15
  endpoint: string;
15
16
  authOptions: HasuraGraphQLAuthOptions;
17
+ logger: DebugHelper;
16
18
  mutation: <ReturnFields = any>(operation: string, fields?: string[] | HasuraGraphQLFields<Model>, variables?: VariableOptions) => Promise<ReturnFields>;
17
19
  query: <ReturnFields = any>(operation: string | GraphQLParams<Model>[], fields?: string[] | HasuraGraphQLFields<Model>, variables?: VariableOptions) => Promise<ReturnFields>;
18
20
  getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
19
- convertDataFromHasura: (data: Record<string, string | number>) => Model;
21
+ convertDataFromHasura(data: Record<string, string | number>, fields?: string[] | HasuraGraphQLFields<Model>): Model;
20
22
  convertDataToHasura(instance: Model, update?: boolean): Record<string, string | number>;
21
23
  };
@@ -8,7 +8,7 @@ export declare type ColumnOptions<FieldType, Model, ValueFrom = any> = {
8
8
  filterType: HasuraGraphQLColumnType | string;
9
9
  filters: NestedRepositoryFindFieltersOptions<FieldType>;
10
10
  };
11
- fields?: HasuraGraphQLFields<FieldType extends any[] ? FieldType[number] : FieldType>;
11
+ fields?: HasuraGraphQLFields<FieldType>;
12
12
  foreignKeyColumn?: Partial<Record<NonFunctionAndIdentifierPropertyNames<FieldType extends any[] ? FieldType[number] : FieldType>, NonFunctionAndIdentifierPropertyNames<Model> | (string & {})>> | {};
13
13
  from?: (value: ValueFrom | ValueFrom[], data?: any) => FieldType;
14
14
  to?: (value: FieldType, instance?: Model) => ValueFrom;
@@ -31,10 +31,14 @@ export declare type AggregateOptions<Model> = {
31
31
  var_samp?: Array<AggregateOptionFields<Model, number>>;
32
32
  variance?: Array<AggregateOptionFields<Model, number>>;
33
33
  };
34
- export declare type HasuraGraphQLFields<Model> = ((Model extends ModelBaseStructure ? NonFunctionAndIdentifierPropertyNames<Model> | {
34
+ declare type ModelBaseHasuraGraphQLFields<Model> = Model extends ModelBaseStructure ? NonFunctionAndIdentifierPropertyNames<Model> | {
35
35
  [key in NonFunctionAndIdentifierPropertyNames<Model>]?: PropType<Model, key> extends ModelBaseStructure ? HasuraGraphQLFields<PropType<Model, key>> : PropType<Model, key> extends any[] ? PropType<Model, key>[] extends ModelBaseStructure[] ? HasuraGraphQLFields<PropType<Model, key>[]> : never : never;
36
36
  } | {
37
37
  [key in NonFunctionAndIdentifierPropertyNames<Model>]?: key extends 'aggregate' ? never : PropType<Model, key> extends ModelBaseStructure ? ColumnOptions<PropType<Model, key>, Model> : ColumnOptions<PropType<Model, key>, Model>;
38
- } | Record<string, ColumnOptions<PropType<Model, any>, Model>> : string) | {
38
+ } | Record<string, ColumnOptions<PropType<Model, any>, Model>> : string;
39
+ export declare type HasuraGraphQLFields<Model> = (ModelBaseHasuraGraphQLFields<Model> | {
39
40
  aggregate: Array<AggregateOptions<Model> | 'count'>;
41
+ } | {
42
+ returning: NonFunctionAndIdentifierPropertyNames<Model>[];
40
43
  } | 'affected_rows')[];
44
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "3.13.3",
3
+ "version": "3.13.6-beta.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -12,6 +12,7 @@
12
12
  "axios": "^0.27.2",
13
13
  "class-transformer": "^0.5.1",
14
14
  "date-fns": "^2.28.0",
15
+ "debug": "^4.3.4",
15
16
  "firebase": "7.24.0",
16
17
  "gql-query-builder": "3.7.0",
17
18
  "lodash": "^4.17.21",
@@ -27,4 +28,4 @@
27
28
  "fesm2015": "fesm2015/infrab4a-connect.js",
28
29
  "typings": "infrab4a-connect.d.ts",
29
30
  "sideEffects": false
30
- }
31
+ }
@@ -0,0 +1,2 @@
1
+ import { DebugOptions } from '../helpers';
2
+ export declare function Debug(opts?: DebugOptions): ClassDecorator;
@@ -0,0 +1,2 @@
1
+ export * from './debug.class.decorator';
2
+ export * from './trace.method.decorator';
@@ -0,0 +1,14 @@
1
+ export declare type CallbackFnArgs<T, Result> = {
2
+ target: T;
3
+ result: Result;
4
+ args: Array<any>;
5
+ namespace?: Array<string>;
6
+ };
7
+ declare type CallbackFn<T, Result> = (opts: CallbackFnArgs<T, Result>) => void;
8
+ declare type TraceOptions<T, Result> = {
9
+ callbackFn?: CallbackFn<T, Result>;
10
+ level?: 'trace' | 'log';
11
+ };
12
+ export declare function Log<T, Result>(options?: TraceOptions<T, Result>): (target: any, propertyKey: string, propertyDescriptor: PropertyDescriptor) => PropertyDescriptor;
13
+ export declare function Trace<T, Result>(options?: TraceOptions<T, Result>): (target: any, propertyKey: string, propertyDescriptor: PropertyDescriptor) => PropertyDescriptor;
14
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare class ClassNameHelper {
2
+ static get(clazz: any): string;
3
+ }
@@ -0,0 +1,9 @@
1
+ export declare type DebugOptions = {
2
+ name?: string;
3
+ namespaces?: Array<string>;
4
+ };
5
+ export declare class DebugDecoratorHelper {
6
+ static DebugNamingMetadataKey: string;
7
+ static set(target: object, options: DebugOptions): void;
8
+ static get(target: object): DebugOptions;
9
+ }
@@ -0,0 +1,60 @@
1
+ import { Debugger } from 'debug';
2
+ import { Subject } from 'rxjs';
3
+ export declare type Debuggable = {
4
+ debug: DebugHelper;
5
+ };
6
+ declare type DebugLog = {
7
+ namespace: string;
8
+ message: string;
9
+ args: Array<any>;
10
+ };
11
+ declare type DebugError = {
12
+ namespace: string;
13
+ error: any;
14
+ args: Array<any>;
15
+ };
16
+ export declare const isDebuggable: (object: any) => object is Debuggable;
17
+ export declare class DebugHelper {
18
+ static logs$: Subject<DebugLog>;
19
+ static traces$: Subject<DebugLog>;
20
+ static errors$: Subject<DebugError>;
21
+ static isDebuggable: (object: any) => object is Debuggable;
22
+ static namespacesFor(target: object): Array<string>;
23
+ static as(...namespaces: Array<string>): DebugHelper;
24
+ static for(target: object, ...namespaces: Array<string>): DebugHelper;
25
+ static from(target: object, ...namespaces: Array<string>): DebugHelper;
26
+ static clonedFrom(target: object, ...namespaces: Array<string>): DebugHelper;
27
+ static clone(target: object, ...namespaces: Array<string>): {
28
+ original: DebugHelper;
29
+ debug: DebugHelper;
30
+ };
31
+ static replace(target: any, attrs: {
32
+ with: DebugHelper;
33
+ }): void;
34
+ static mock(target: object, ...namespaces: Array<string>): {
35
+ original: DebugHelper;
36
+ debug: DebugHelper;
37
+ };
38
+ logger: Debugger;
39
+ tracer: Debugger;
40
+ err: Debugger;
41
+ namespaces: Set<string>;
42
+ constructor(...namespace: Array<string>);
43
+ get entries(): Array<string>;
44
+ get namespace(): string;
45
+ log(message?: any, ...args: Array<any>): DebugHelper;
46
+ trace(message?: any, ...args: Array<any>): DebugHelper;
47
+ error(error: any, ...args: Array<any>): DebugHelper;
48
+ build(): DebugHelper;
49
+ with(...namespace: Array<string>): DebugHelper;
50
+ push(...namespace: Array<string>): DebugHelper;
51
+ unshift(...namespace: Array<string>): DebugHelper;
52
+ reset(...namespace: Array<string>): DebugHelper;
53
+ startWith(...namespace: Array<string>): DebugHelper;
54
+ shift(): DebugHelper;
55
+ pop(): DebugHelper;
56
+ clear(): DebugHelper;
57
+ remove(...namespace: Array<string>): DebugHelper;
58
+ puts(...args: Array<string>): string;
59
+ }
60
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './debug.helper';
2
+ export * from './reflect.helper';
3
+ export * from './class-name.helper';
4
+ export * from './debug-decorator.helper';
@@ -0,0 +1,50 @@
1
+ import 'reflect-metadata';
2
+ declare type Dictionary<T> = {
3
+ [key: string]: T;
4
+ };
5
+ export declare type MetaArgs = {
6
+ key: string;
7
+ target: any;
8
+ property?: string | symbol;
9
+ own?: boolean;
10
+ propertyDescriptor?: PropertyDescriptor;
11
+ };
12
+ export declare type MetaValueArgs<T = any> = MetaArgs & {
13
+ value: T;
14
+ };
15
+ declare type MetaProperties<T = any> = Dictionary<T>;
16
+ declare type MetaTargets = Dictionary<MetaProperties>;
17
+ declare type MetaKeys = Dictionary<MetaTargets>;
18
+ declare type MetaStorage = {
19
+ value?: any;
20
+ object?: any;
21
+ values?: MetaKeys;
22
+ };
23
+ export declare class ReflectHelper {
24
+ static get items(): MetaStorage;
25
+ static get keys(): Array<string>;
26
+ static has(key: string, target?: any, property?: string | symbol): boolean;
27
+ static get<T = any>({ key, target, property, own }: MetaArgs): Array<T>;
28
+ static first<T = any>({ key, target, property, own }: MetaArgs): T;
29
+ static last<T = any>({ key, target, property, own }: MetaArgs): T;
30
+ static set<T = any>({ key, target, property, value, propertyDescriptor }: MetaValueArgs<T>): void;
31
+ static add<T = any>({ key, target, property, value, propertyDescriptor }: MetaValueArgs<T>): void;
32
+ static all<T = any>({ key }: Partial<MetaArgs>): Array<MetaValueArgs<T>>;
33
+ static allFrom(key: string, target: any): any;
34
+ static allValuesFrom(key: string, target: any, property: any): any;
35
+ static delete({ key, target, property }: MetaArgs): boolean;
36
+ static clear(key?: string): void;
37
+ static getType({ target, propertyKey }: {
38
+ target: any;
39
+ propertyKey: any;
40
+ }): any;
41
+ static getReturntype({ target, propertyKey }: {
42
+ target: any;
43
+ propertyKey: any;
44
+ }): any;
45
+ static getAllMethods(target: any): string[];
46
+ private static _items;
47
+ private static put;
48
+ private static remove;
49
+ }
50
+ export {};
package/utils/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
2
2
  import { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
3
+ export * from './decorators';
4
+ export * from './helpers';
3
5
  export * from './is-uuid';
6
+ export * from './log.utils';
4
7
  export * from './mixins';
5
8
  export * from './parse-datetime';
6
9
  export * from './types';
@@ -0,0 +1,7 @@
1
+ import { Debugger } from 'debug';
2
+ export declare enum DebugNamespaces {
3
+ ROOT = "connect",
4
+ TRACE = "trace",
5
+ ERROR = "error"
6
+ }
7
+ export declare const Logger: Debugger;
@@ -1,15 +0,0 @@
1
- import { LineItem } from '../../shopping';
2
- export class RoundProductPricesHelper {
3
- static roundProductPrices(product) {
4
- product.price.price = Number(product.price.price.toFixed(2));
5
- product.price.fullPrice = Number(product.price.fullPrice.toFixed(2));
6
- if (product.price.subscriberPrice) {
7
- product.price.subscriberPrice = Number(product.price.subscriberPrice.toFixed(2));
8
- }
9
- if (product instanceof LineItem && product.pricePaid) {
10
- product.pricePaid = Number(product.pricePaid.toFixed(2));
11
- }
12
- return product;
13
- }
14
- }
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUm91bmRQcm9kdXRjUHJpY2VIZWxwZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb25uZWN0L3NyYy9kb21haW4vY2F0YWxvZy9oZWxwZXJzL1JvdW5kUHJvZHV0Y1ByaWNlSGVscGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQTtBQUd6QyxNQUFNLE9BQU8sd0JBQXdCO0lBQzVCLE1BQU0sQ0FBQyxrQkFBa0IsQ0FBQyxPQUFnQjtRQUMvQyxPQUFPLENBQUMsS0FBSyxDQUFDLEtBQUssR0FBRyxNQUFNLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDNUQsT0FBTyxDQUFDLEtBQUssQ0FBQyxTQUFTLEdBQUcsTUFBTSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQ3BFLElBQUksT0FBTyxDQUFDLEtBQUssQ0FBQyxlQUFlLEVBQUU7WUFDakMsT0FBTyxDQUFDLEtBQUssQ0FBQyxlQUFlLEdBQUcsTUFBTSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsZUFBZSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO1NBQ2pGO1FBQ0QsSUFBSSxPQUFPLFlBQVksUUFBUSxJQUFJLE9BQU8sQ0FBQyxTQUFTLEVBQUU7WUFDcEQsT0FBTyxDQUFDLFNBQVMsR0FBRyxNQUFNLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQTtTQUN6RDtRQUVELE9BQU8sT0FBTyxDQUFBO0lBQ2hCLENBQUM7Q0FDRiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IExpbmVJdGVtIH0gZnJvbSAnLi4vLi4vc2hvcHBpbmcnXG5pbXBvcnQgeyBQcm9kdWN0IH0gZnJvbSAnLi4vbW9kZWxzJ1xuXG5leHBvcnQgY2xhc3MgUm91bmRQcm9kdWN0UHJpY2VzSGVscGVyIHtcbiAgcHVibGljIHN0YXRpYyByb3VuZFByb2R1Y3RQcmljZXMocHJvZHVjdDogUHJvZHVjdCk6IFByb2R1Y3Qge1xuICAgIHByb2R1Y3QucHJpY2UucHJpY2UgPSBOdW1iZXIocHJvZHVjdC5wcmljZS5wcmljZS50b0ZpeGVkKDIpKVxuICAgIHByb2R1Y3QucHJpY2UuZnVsbFByaWNlID0gTnVtYmVyKHByb2R1Y3QucHJpY2UuZnVsbFByaWNlLnRvRml4ZWQoMikpXG4gICAgaWYgKHByb2R1Y3QucHJpY2Uuc3Vic2NyaWJlclByaWNlKSB7XG4gICAgICBwcm9kdWN0LnByaWNlLnN1YnNjcmliZXJQcmljZSA9IE51bWJlcihwcm9kdWN0LnByaWNlLnN1YnNjcmliZXJQcmljZS50b0ZpeGVkKDIpKVxuICAgIH1cbiAgICBpZiAocHJvZHVjdCBpbnN0YW5jZW9mIExpbmVJdGVtICYmIHByb2R1Y3QucHJpY2VQYWlkKSB7XG4gICAgICBwcm9kdWN0LnByaWNlUGFpZCA9IE51bWJlcihwcm9kdWN0LnByaWNlUGFpZC50b0ZpeGVkKDIpKVxuICAgIH1cblxuICAgIHJldHVybiBwcm9kdWN0XG4gIH1cbn1cbiJdfQ==