@infrab4a/connect 5.4.0-beta.0 → 5.4.0-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.
package/index.cjs.js CHANGED
@@ -7396,6 +7396,30 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
7396
7396
  cache,
7397
7397
  });
7398
7398
  }
7399
+ async get({ id }) {
7400
+ return super
7401
+ .find({
7402
+ filters: {
7403
+ id,
7404
+ },
7405
+ limits: {
7406
+ limit: 1,
7407
+ },
7408
+ })
7409
+ .then((res) => res.data.at(0));
7410
+ }
7411
+ async getByEAN(EAN, options) {
7412
+ return super
7413
+ .find({
7414
+ filters: {
7415
+ EAN,
7416
+ },
7417
+ limits: {
7418
+ limit: 1,
7419
+ },
7420
+ })
7421
+ .then((res) => res.data.at(0));
7422
+ }
7399
7423
  async find(params, optionsParams) {
7400
7424
  const { filters, fields, ...options } = params || {};
7401
7425
  const bindFields = fields ||
package/index.esm.js CHANGED
@@ -7372,6 +7372,30 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
7372
7372
  cache,
7373
7373
  });
7374
7374
  }
7375
+ async get({ id }) {
7376
+ return super
7377
+ .find({
7378
+ filters: {
7379
+ id,
7380
+ },
7381
+ limits: {
7382
+ limit: 1,
7383
+ },
7384
+ })
7385
+ .then((res) => res.data.at(0));
7386
+ }
7387
+ async getByEAN(EAN, options) {
7388
+ return super
7389
+ .find({
7390
+ filters: {
7391
+ EAN,
7392
+ },
7393
+ limits: {
7394
+ limit: 1,
7395
+ },
7396
+ })
7397
+ .then((res) => res.data.at(0));
7398
+ }
7375
7399
  async find(params, optionsParams) {
7376
7400
  const { filters, fields, ...options } = params || {};
7377
7401
  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.1",
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>>;