@infrab4a/connect 4.2.3-beta.0 → 4.2.3-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
@@ -4456,6 +4456,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4456
4456
  if (!plainData.products || plainData.products.length <= 0)
4457
4457
  return [];
4458
4458
  const category = await this.get({ id: categoryId.toString() });
4459
+ await this.mutation('delete_category_product', ['affected_rows'], {
4460
+ where: {
4461
+ type: 'category_product_bool_exp',
4462
+ required: true,
4463
+ value: {
4464
+ category_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
4465
+ },
4466
+ },
4467
+ });
4459
4468
  await this.mutation('insert_category_product', ['affected_rows'], {
4460
4469
  objects: {
4461
4470
  type: '[category_product_insert_input!]',
@@ -5358,6 +5367,10 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5358
5367
  throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
5359
5368
  return data;
5360
5369
  }
5370
+ async find(params) {
5371
+ const { filters } = params, rest = tslib.__rest(params, ["filters"]);
5372
+ return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: exports.Where.EQUALS, value: true } }) }));
5373
+ }
5361
5374
  async update(params) {
5362
5375
  const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
5363
5376
  const plainData = this.paramsToPlain({ id: checkId });
package/index.esm.js CHANGED
@@ -4450,6 +4450,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4450
4450
  if (!plainData.products || plainData.products.length <= 0)
4451
4451
  return [];
4452
4452
  const category = await this.get({ id: categoryId.toString() });
4453
+ await this.mutation('delete_category_product', ['affected_rows'], {
4454
+ where: {
4455
+ type: 'category_product_bool_exp',
4456
+ required: true,
4457
+ value: {
4458
+ category_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
4459
+ },
4460
+ },
4461
+ });
4453
4462
  await this.mutation('insert_category_product', ['affected_rows'], {
4454
4463
  objects: {
4455
4464
  type: '[category_product_insert_input!]',
@@ -5352,6 +5361,10 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5352
5361
  throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
5353
5362
  return data;
5354
5363
  }
5364
+ async find(params) {
5365
+ const { filters } = params, rest = __rest(params, ["filters"]);
5366
+ return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: Where.EQUALS, value: true } }) }));
5367
+ }
5355
5368
  async update(params) {
5356
5369
  const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
5357
5370
  const plainData = this.paramsToPlain({ id: checkId });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.2.3-beta.0",
3
+ "version": "4.2.3-beta.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -1,4 +1,4 @@
1
- import { Category, CreateRepositoryParams, GetRepositoryParams, Product, Shops, UpdateRepositoryParams, Wishlist, WishlistRepository } from '../../../../domain';
1
+ import { Category, CreateRepositoryParams, FindRepositoryParams, GetRepositoryParams, Product, RepositoryFindResult, Shops, UpdateRepositoryParams, Wishlist, WishlistRepository } from '../../../../domain';
2
2
  import { HasuraConstructorParams } from '../../mixins';
3
3
  import { CategoryFilterHasuraGraphQLRepository } from './category-filter-hasura-graphql.repository';
4
4
  declare const WishlistHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<Wishlist> & import("../../../../domain").CrudRepository<Wishlist, import("../../../../domain").CrudParams<Wishlist>> & import("../../../../domain").UpdateRepository<Wishlist, import("../../../../domain").RepositoryUpdateParams<Wishlist>> & {
@@ -9,6 +9,7 @@ export declare class WishlistHasuraGraphQLRepository extends WishlistHasuraGraph
9
9
  constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Wishlist>, 'endpoint' | 'authOptions' | 'interceptors'>, categoryFilterRepository: CategoryFilterHasuraGraphQLRepository);
10
10
  create(params: CreateRepositoryParams<Wishlist>): Promise<Wishlist>;
11
11
  get(identifiers: GetRepositoryParams<Wishlist>): Promise<Wishlist>;
12
+ find(params?: FindRepositoryParams<Wishlist>): Promise<RepositoryFindResult<Wishlist>>;
12
13
  update(params: UpdateRepositoryParams<Wishlist>): Promise<Wishlist>;
13
14
  getWishlistBySlug(slug: string): Promise<Wishlist>;
14
15
  getWishlistByPerson(personId: string): Promise<Wishlist[]>;