@infrab4a/connect 4.0.0-beta.19 → 4.0.0-beta.20

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 (32) hide show
  1. package/domain/catalog/models/category.d.ts +4 -0
  2. package/domain/catalog/models/product.d.ts +6 -1
  3. package/domain/catalog/models/types/index.d.ts +1 -0
  4. package/domain/catalog/models/types/product-evaluation.type.d.ts +6 -0
  5. package/domain/users/models/lead.d.ts +1 -0
  6. package/esm2020/domain/catalog/models/category.mjs +5 -1
  7. package/esm2020/domain/catalog/models/product.mjs +24 -1
  8. package/esm2020/domain/catalog/models/types/index.mjs +2 -1
  9. package/esm2020/domain/catalog/models/types/product-evaluation.type.mjs +2 -0
  10. package/esm2020/domain/users/models/lead.mjs +1 -1
  11. package/esm2020/infra/elasticsearch/adapters/axios.adapter.mjs +28 -11
  12. package/esm2020/infra/elasticsearch/adapters/elastic-search.adapter.mjs +1 -1
  13. package/esm2020/infra/elasticsearch/indexes/products-index.mjs +58 -52
  14. package/esm2020/infra/elasticsearch/types/elastic-search-result.mjs +1 -1
  15. package/esm2020/infra/hasura-graphql/mixins/helpers/graphql-field.helper.mjs +8 -5
  16. package/esm2020/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.mjs +2 -2
  17. package/esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs +1 -1
  18. package/esm2020/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.mjs +2 -1
  19. package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +12 -1
  20. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.mjs +2 -1
  21. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.mjs +2 -1
  22. package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +19 -11
  23. package/fesm2015/infrab4a-connect.mjs +152 -72
  24. package/fesm2015/infrab4a-connect.mjs.map +1 -1
  25. package/fesm2020/infrab4a-connect.mjs +149 -75
  26. package/fesm2020/infrab4a-connect.mjs.map +1 -1
  27. package/infra/elasticsearch/adapters/axios.adapter.d.ts +6 -4
  28. package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +3 -2
  29. package/infra/elasticsearch/indexes/products-index.d.ts +8 -10
  30. package/infra/elasticsearch/types/elastic-search-result.d.ts +2 -0
  31. package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +1 -0
  32. package/package.json +1 -1
@@ -1,14 +1,16 @@
1
1
  import { BaseModel } from '../../../domain';
2
2
  import { ElasticSearchResult } from '../types/elastic-search-result';
3
+ import { ElasticSearchAdapter } from './elastic-search.adapter';
3
4
  export declare type AxiosElasticSearchConfig = {
4
5
  url: string;
5
6
  credential: string;
6
7
  };
7
- export declare class AxiosAdapter<T extends BaseModel<T>> {
8
+ export declare class AxiosAdapter<T extends BaseModel<T>> implements ElasticSearchAdapter<T> {
8
9
  private readonly config;
9
10
  constructor(config: AxiosElasticSearchConfig);
10
- get(index: string): Promise<Partial<T>>;
11
- query(index: string, query: any): Promise<ElasticSearchResult<Partial<T>>>;
11
+ get(index: string, id: string): Promise<T>;
12
+ query(index: string, query: any): Promise<ElasticSearchResult<T>>;
12
13
  save(index: string, data: Partial<T>): Promise<void>;
13
- delete(index: string): Promise<void>;
14
+ update(index: string, id: string, data: Partial<T>): Promise<void>;
15
+ delete(index: string, id: string): Promise<void>;
14
16
  }
@@ -1,7 +1,8 @@
1
1
  import { ElasticSearchResult } from '../types/elastic-search-result';
2
2
  export interface ElasticSearchAdapter<T = any> {
3
- get(index: string): Promise<T>;
3
+ get(index: string, id: string): Promise<T>;
4
4
  query(index: string, query: any): Promise<ElasticSearchResult<T>>;
5
5
  save(index: string, data: Partial<T>): Promise<void>;
6
- delete(index: string): Promise<void>;
6
+ update(index: string, id: string, data: Partial<T>): Promise<void>;
7
+ delete(index: string, id: string): Promise<void>;
7
8
  }
@@ -1,15 +1,13 @@
1
- import { Product, Shops } from '../../../domain';
1
+ import { Product } from '../../../domain';
2
2
  import { ProductHasuraGraphQL } from '../../hasura-graphql';
3
- import { AxiosAdapter } from '../adapters';
3
+ import { ElasticSearchAdapter } from '../adapters';
4
4
  export declare class ProductsIndex {
5
5
  private readonly adapter;
6
- constructor(adapter: AxiosAdapter<Product>);
7
- get(id: string): Promise<Product>;
8
- findById(ids: string[], options?: {
9
- hasStock: boolean;
10
- size: number;
11
- shop: Shops;
12
- }): Promise<Product[]>;
6
+ private index;
7
+ constructor(adapter: ElasticSearchAdapter<Product>);
8
+ getById(id: string): Promise<Product>;
9
+ search(searchTerm: string, total: number, shop: string): Promise<import("@infrab4a/connect").ElasticSearchResult<Product>>;
13
10
  save(product: ProductHasuraGraphQL): Promise<void>;
14
- delete(product: ProductHasuraGraphQL): Promise<void>;
11
+ update(product: ProductHasuraGraphQL): Promise<void>;
12
+ delete(id: string): Promise<void>;
15
13
  }
@@ -2,6 +2,8 @@ export declare type ElasticSearchResult<T> = {
2
2
  total: number;
3
3
  hits: {
4
4
  _index: string;
5
+ _id: string;
6
+ _score: number;
5
7
  _source: T;
6
8
  }[];
7
9
  };
@@ -10,5 +10,6 @@ export declare class ProductHasuraGraphQL extends Product {
10
10
  whoMustUse?: string;
11
11
  howToUse?: string;
12
12
  brandDescription?: string;
13
+ categoryId?: number;
13
14
  kitProducts?: KitProductHasuraGraphQL[];
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.0.0-beta.19",
3
+ "version": "4.0.0-beta.20",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },