@infrab4a/connect 5.4.0-beta.0 → 5.4.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
@@ -875,7 +875,8 @@ class Variant extends ProductBase {
875
875
  tslib.__decorate([
876
876
  classTransformer.Type(() => Product),
877
877
  tslib.__metadata("design:type", Product)
878
- ], Variant.prototype, "product", void 0);
878
+ ], Variant.prototype, "product", void 0);
879
+ registerClass('Product', Product);
879
880
 
880
881
  class Product extends ProductBase {
881
882
  }
@@ -7396,6 +7397,30 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
7396
7397
  cache,
7397
7398
  });
7398
7399
  }
7400
+ async get({ id }) {
7401
+ return super
7402
+ .find({
7403
+ filters: {
7404
+ id,
7405
+ },
7406
+ limits: {
7407
+ limit: 1,
7408
+ },
7409
+ })
7410
+ .then((res) => res.data.at(0));
7411
+ }
7412
+ async getByEAN(EAN, options) {
7413
+ return super
7414
+ .find({
7415
+ filters: {
7416
+ EAN,
7417
+ },
7418
+ limits: {
7419
+ limit: 1,
7420
+ },
7421
+ })
7422
+ .then((res) => res.data.at(0));
7423
+ }
7399
7424
  async find(params, optionsParams) {
7400
7425
  const { filters, fields, ...options } = params || {};
7401
7426
  const bindFields = fields ||
package/index.esm.js CHANGED
@@ -851,7 +851,8 @@ class Variant extends ProductBase {
851
851
  __decorate([
852
852
  Type(() => Product),
853
853
  __metadata("design:type", Product)
854
- ], Variant.prototype, "product", void 0);
854
+ ], Variant.prototype, "product", void 0);
855
+ registerClass('Product', Product);
855
856
 
856
857
  class Product extends ProductBase {
857
858
  }
@@ -7372,6 +7373,30 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
7372
7373
  cache,
7373
7374
  });
7374
7375
  }
7376
+ async get({ id }) {
7377
+ return super
7378
+ .find({
7379
+ filters: {
7380
+ id,
7381
+ },
7382
+ limits: {
7383
+ limit: 1,
7384
+ },
7385
+ })
7386
+ .then((res) => res.data.at(0));
7387
+ }
7388
+ async getByEAN(EAN, options) {
7389
+ return super
7390
+ .find({
7391
+ filters: {
7392
+ EAN,
7393
+ },
7394
+ limits: {
7395
+ limit: 1,
7396
+ },
7397
+ })
7398
+ .then((res) => res.data.at(0));
7399
+ }
7375
7400
  async find(params, optionsParams) {
7376
7401
  const { filters, fields, ...options } = params || {};
7377
7402
  const bindFields = fields ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.4.0-beta.0",
3
+ "version": "5.4.0-beta.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -5,6 +5,7 @@ export * from './category.repository';
5
5
  export * from './filter-option.repository';
6
6
  export * from './filter.repository';
7
7
  export * from './group.repository';
8
+ export * from './product-catalog.repository';
8
9
  export * from './product-errors.repository';
9
10
  export * from './product-reviews.repository';
10
11
  export * from './product-stock-notification.repository';
@@ -0,0 +1,13 @@
1
+ import { FindRepositoryParams, RepositoryCacheOptions, RepositoryFindResult } from '../../generic';
2
+ import { Product, ProductGender } from '../models';
3
+ export interface ProductCatalogRepository {
4
+ get({ id }: {
5
+ id: string;
6
+ }): Promise<Product>;
7
+ getByEAN(EAN: string, options?: {
8
+ cache?: RepositoryCacheOptions;
9
+ }): Promise<Product>;
10
+ findCatalog(params: FindRepositoryParams<Product>, mainGender?: Extract<ProductGender, 'female' | 'male' | 'unisex'>, options?: {
11
+ cache?: RepositoryCacheOptions;
12
+ }): Promise<RepositoryFindResult<Product>>;
13
+ }
@@ -1,9 +1,15 @@
1
- import { FindRepositoryParams, ProductGender, RepositoryCacheOptions, RepositoryFindResult } from '../../../../domain';
1
+ import { FindRepositoryParams, Product, ProductCatalogRepository, ProductGender, RepositoryCacheOptions, RepositoryFindResult } from '../../../../domain';
2
2
  import { HasuraConstructorParams } from '../../mixins';
3
3
  import { ProductHasuraGraphQL } from '../../models';
4
4
  declare const ProductCatalogHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<ProductHasuraGraphQL> & import("../../../../domain").FindRepository<ProductHasuraGraphQL, FindRepositoryParams<ProductHasuraGraphQL>>, any[]>;
5
- export declare class ProductCatalogHasuraGraphQLRepository extends ProductCatalogHasuraGraphQLRepository_base {
5
+ export declare class ProductCatalogHasuraGraphQLRepository extends ProductCatalogHasuraGraphQLRepository_base implements ProductCatalogRepository {
6
6
  constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<ProductHasuraGraphQL>, 'endpoint' | 'authOptions' | 'interceptors' | 'cache'>);
7
+ get({ id }: {
8
+ id: string;
9
+ }): Promise<Product>;
10
+ getByEAN(EAN: string, options?: {
11
+ cache?: RepositoryCacheOptions;
12
+ }): Promise<Product>;
7
13
  find(params?: FindRepositoryParams<ProductHasuraGraphQL>, optionsParams?: {
8
14
  cache?: RepositoryCacheOptions;
9
15
  }): Promise<RepositoryFindResult<ProductHasuraGraphQL>>;