@infrab4a/connect 4.9.0-beta.2 → 4.9.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -2685,8 +2685,9 @@ class ProductsIndex {
2685
2685
  }
2686
2686
  async save(product) {
2687
2687
  try {
2688
- const { createdAt, updatedAt, kitProducts } = product, data = tslib_1.__rest(product, ["createdAt", "updatedAt", "kitProducts"]);
2689
- this.adapter.save(this.index, data);
2688
+ const _a = product.toPlain(), { createdAt, updatedAt, kitProducts } = _a, data = tslib_1.__rest(_a, ["createdAt", "updatedAt", "kitProducts"]);
2689
+ const newProduct = Product.toInstance(data);
2690
+ this.adapter.save(this.index, newProduct);
2690
2691
  }
2691
2692
  catch (error) {
2692
2693
  console.error(error);
package/index.esm.js CHANGED
@@ -2661,8 +2661,9 @@ class ProductsIndex {
2661
2661
  }
2662
2662
  async save(product) {
2663
2663
  try {
2664
- const { createdAt, updatedAt, kitProducts } = product, data = __rest(product, ["createdAt", "updatedAt", "kitProducts"]);
2665
- this.adapter.save(this.index, data);
2664
+ const _a = product.toPlain(), { createdAt, updatedAt, kitProducts } = _a, data = __rest(_a, ["createdAt", "updatedAt", "kitProducts"]);
2665
+ const newProduct = Product.toInstance(data);
2666
+ this.adapter.save(this.index, newProduct);
2666
2667
  }
2667
2668
  catch (error) {
2668
2669
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.9.0-beta.2",
3
+ "version": "4.9.0-beta.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -11,7 +11,7 @@ export declare class AxiosAdapter<T extends ModelBaseStructure<T>> implements El
11
11
  constructor(config: AxiosElasticSearchConfig);
12
12
  get(index: string, id: string): Promise<T>;
13
13
  query(index: string, query: any): Promise<ElasticSearchResult<T>>;
14
- save(index: string, data: Partial<T>): Promise<void>;
14
+ save(index: string, data: T): Promise<void>;
15
15
  update(index: string, id: string, data: Partial<T>): Promise<void>;
16
16
  delete(index: string, id: string): Promise<void>;
17
17
  }
@@ -2,7 +2,7 @@ import { ElasticSearchResult } from '../types/elastic-search-result';
2
2
  export interface ElasticSearchAdapter<T = any> {
3
3
  get(index: string, id: string): Promise<T>;
4
4
  query(index: string, query: any): Promise<ElasticSearchResult<T>>;
5
- save(index: string, data: Partial<T>): Promise<void>;
5
+ save(index: string, data: T): Promise<void>;
6
6
  update(index: string, id: string, data: Partial<T>): Promise<void>;
7
7
  delete(index: string, id: string): Promise<void>;
8
8
  }