@infrab4a/connect 4.23.0-beta.0 → 4.23.0-beta.2

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
@@ -334,6 +334,14 @@ tslib.__decorate([
334
334
  ], Product.prototype, "kitProducts", void 0);
335
335
 
336
336
  class ProductErrors extends BaseModel {
337
+ constructor() {
338
+ super(...arguments);
339
+ this.errors = {};
340
+ }
341
+ setErrors(source, errors) {
342
+ this.errors[source] = errors.filter((error) => { var _a, _b; return !((_b = (_a = this.errors) === null || _a === void 0 ? void 0 : _a[source]) === null || _b === void 0 ? void 0 : _b.includes(error)); });
343
+ this.hasErrors = Object.values(this.errors).flat().length > 0;
344
+ }
337
345
  static get identifiersFields() {
338
346
  return ['productId'];
339
347
  }
package/index.esm.js CHANGED
@@ -328,6 +328,14 @@ __decorate([
328
328
  ], Product.prototype, "kitProducts", void 0);
329
329
 
330
330
  class ProductErrors extends BaseModel {
331
+ constructor() {
332
+ super(...arguments);
333
+ this.errors = {};
334
+ }
335
+ setErrors(source, errors) {
336
+ this.errors[source] = errors.filter((error) => { var _a, _b; return !((_b = (_a = this.errors) === null || _a === void 0 ? void 0 : _a[source]) === null || _b === void 0 ? void 0 : _b.includes(error)); });
337
+ this.hasErrors = Object.values(this.errors).flat().length > 0;
338
+ }
331
339
  static get identifiersFields() {
332
340
  return ['productId'];
333
341
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.23.0-beta.0",
3
+ "version": "4.23.0-beta.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -2,12 +2,13 @@ import { BaseModel } from '../../generic/model';
2
2
  import { Product } from './product';
3
3
  type ProductErrorsIdentifiers = 'productId';
4
4
  export declare class ProductErrors extends BaseModel<ProductErrors, ProductErrorsIdentifiers> {
5
+ private errors;
5
6
  productId: string;
6
7
  hasErrors: boolean;
7
8
  createdAt: Date;
8
9
  updatedAt: Date;
9
- errors: string[];
10
10
  product: Product;
11
+ setErrors(source: string, errors: string[]): void;
11
12
  static get identifiersFields(): ProductErrorsIdentifiers[];
12
13
  }
13
14
  export {};