@infrab4a/connect 4.20.0 → 4.21.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
@@ -215,6 +215,12 @@ tslib.__decorate([
215
215
  tslib.__metadata("design:type", Category)
216
216
  ], CategoryFilter.prototype, "category", void 0);
217
217
 
218
+ class CategoryProduct extends BaseModel {
219
+ static get identifiersFields() {
220
+ return ['categoryId', 'productId'];
221
+ }
222
+ }
223
+
218
224
  class FilterOption extends BaseModel {
219
225
  static get identifiersFields() {
220
226
  return ['id'];
@@ -5106,29 +5112,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5106
5112
  });
5107
5113
  return [];
5108
5114
  }
5109
- const plainData = this.paramsToPlain({ products });
5110
- if (!plainData.products || plainData.products.length <= 0)
5111
- return [];
5112
- const category = await this.get({ id: categoryId.toString() });
5113
- await this.mutation('delete_category_product', ['affected_rows'], {
5114
- where: {
5115
- type: 'category_product_bool_exp',
5116
- required: true,
5117
- value: {
5118
- category_id: { _eq: categoryId },
5119
- product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5120
- },
5121
- },
5122
- });
5123
- await this.mutation('insert_category_product', ['affected_rows'], {
5124
- objects: {
5125
- type: '[category_product_insert_input!]',
5126
- required: true,
5127
- value: plainData.products
5128
- .filter((productId) => !category.products.includes(productId))
5129
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
5130
- },
5131
- });
5132
5115
  const productsOrder = products.map((product, index) => {
5133
5116
  return {
5134
5117
  id: product,
@@ -5137,7 +5120,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5137
5120
  });
5138
5121
  const updateQueries = productsOrder.map((product) => ({
5139
5122
  where: {
5140
- category_id: { _eq: category.id },
5123
+ category_id: { _eq: categoryId },
5141
5124
  product_id: { _eq: product.id },
5142
5125
  },
5143
5126
  _set: {
@@ -5151,6 +5134,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5151
5134
  required: true,
5152
5135
  },
5153
5136
  });
5137
+ const plainData = this.paramsToPlain({ products });
5154
5138
  return plainData.products;
5155
5139
  }
5156
5140
  async updateMetadata(categoryId, { metadatas }) {
@@ -5266,6 +5250,40 @@ tslib.__decorate([
5266
5250
  tslib.__metadata("design:returntype", Promise)
5267
5251
  ], CategoryHasuraGraphQLRepository.prototype, "isChild", null);
5268
5252
 
5253
+ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5254
+ constructor({ endpoint, authOptions, interceptors, }) {
5255
+ super({
5256
+ tableName: 'category_product',
5257
+ model: CategoryProduct,
5258
+ endpoint,
5259
+ authOptions,
5260
+ interceptors,
5261
+ fields: [{ productId: { columnName: 'product_id' } }, { categoryId: { columnName: 'category_id' } }, 'order'],
5262
+ });
5263
+ }
5264
+ async removeProductFromCategory(categoryId, productId) {
5265
+ await this.mutation('delete_category_product', ['affected_rows'], {
5266
+ where: {
5267
+ type: 'category_product_bool_exp',
5268
+ required: true,
5269
+ value: {
5270
+ product_id: { _eq: productId },
5271
+ category_id: { _eq: categoryId },
5272
+ },
5273
+ },
5274
+ });
5275
+ }
5276
+ async addProductToCategory(categoryId, productId) {
5277
+ await this.mutation('insert_category_product', ['affected_rows'], {
5278
+ objects: {
5279
+ type: '[category_product_insert_input!]',
5280
+ required: true,
5281
+ value: [{ category_id: categoryId, product_id: productId }],
5282
+ },
5283
+ });
5284
+ }
5285
+ }
5286
+
5269
5287
  class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5270
5288
  constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
5271
5289
  super({
@@ -5678,7 +5696,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5678
5696
  const plainData = this.paramsToPlain({ id: checkId });
5679
5697
  const id = await this.getId(plainData.id);
5680
5698
  const product = await super.update(Object.assign({ id }, data));
5681
- product.categories = categories && (await this.updateCategories(+id, { categories }));
5682
5699
  product.kitProducts = kitProducts && (await this.updateKitProducts(+id, { kitProducts }));
5683
5700
  product.reviews = reviews && (await this.updateReviews(+id, { reviews }));
5684
5701
  product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
@@ -5742,42 +5759,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5742
5759
  getReviewStatus(review) {
5743
5760
  return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
5744
5761
  }
5745
- async updateCategories(productId, { categories }) {
5746
- if ('action' in categories && categories.action === 'remove') {
5747
- await this.mutation('delete_category_product', ['affected_rows'], {
5748
- where: {
5749
- type: 'category_product_bool_exp',
5750
- required: true,
5751
- value: { product_id: { _eq: productId } },
5752
- },
5753
- });
5754
- return [];
5755
- }
5756
- const plainData = this.paramsToPlain({ categories });
5757
- if (!plainData.categories || plainData.categories.length <= 0)
5758
- return [];
5759
- const product = await this.get({ id: productId.toString() });
5760
- await this.mutation('delete_category_product', ['affected_rows'], {
5761
- where: {
5762
- type: 'category_product_bool_exp',
5763
- required: true,
5764
- value: {
5765
- product_id: { _eq: productId },
5766
- category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
5767
- },
5768
- },
5769
- });
5770
- await this.mutation('insert_category_product', ['affected_rows'], {
5771
- objects: {
5772
- type: '[category_product_insert_input!]',
5773
- required: true,
5774
- value: plainData.categories
5775
- .filter((categoryId) => !product.categories.includes(categoryId))
5776
- .map((categoryId) => ({ category_id: categoryId, product_id: productId })),
5777
- },
5778
- });
5779
- return plainData.categories;
5780
- }
5781
5762
  async updateKitProducts(productId, { kitProducts }) {
5782
5763
  const plainData = this.paramsToPlain({ kitProducts });
5783
5764
  await this.mutation('delete_product_kit', ['affected_rows'], {
@@ -6179,7 +6160,7 @@ class WishlistHasuraGraphQL extends Wishlist {
6179
6160
  }
6180
6161
 
6181
6162
  class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
6182
- constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
6163
+ constructor({ endpoint, authOptions, interceptors, }, categoryProductRepository) {
6183
6164
  super({
6184
6165
  tableName: 'category',
6185
6166
  model: WishlistHasuraGraphQL,
@@ -6280,7 +6261,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6280
6261
  { mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
6281
6262
  ],
6282
6263
  });
6283
- this.categoryFilterRepository = categoryFilterRepository;
6264
+ this.categoryProductRepository = categoryProductRepository;
6284
6265
  }
6285
6266
  async create(params) {
6286
6267
  var _a;
@@ -6316,7 +6297,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6316
6297
  const plainData = this.paramsToPlain({ id: checkId });
6317
6298
  const id = plainData.id;
6318
6299
  const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
6319
- category.products = products && (await this.updateProducts(+id, { products }));
6320
6300
  category.metadatas = metadatas && (await this.updateMetadata(+id, { metadatas }));
6321
6301
  return category;
6322
6302
  }
@@ -6397,44 +6377,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6397
6377
  isChild(id, parentId) {
6398
6378
  return;
6399
6379
  }
6400
- async updateProducts(categoryId, { products }) {
6401
- if ('action' in products && products.action === 'remove') {
6402
- await this.mutation('delete_category_product', ['affected_rows'], {
6403
- where: {
6404
- type: 'category_product_bool_exp',
6405
- required: true,
6406
- value: { category_id: { _eq: categoryId } },
6407
- },
6408
- });
6409
- await this.categoryFilterRepository.deleteByCategory(categoryId);
6410
- return [];
6411
- }
6412
- const plainData = this.paramsToPlain({ products });
6413
- if (!plainData.products || plainData.products.length <= 0)
6414
- return [];
6415
- const category = await this.get({ id: categoryId.toString() });
6416
- await this.categoryFilterRepository.deleteByCategory(categoryId);
6417
- await this.mutation('delete_category_product', ['affected_rows'], {
6418
- where: {
6419
- type: 'category_product_bool_exp',
6420
- required: true,
6421
- value: {
6422
- category_id: { _eq: categoryId },
6423
- product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
6424
- },
6425
- },
6426
- });
6427
- await this.mutation('insert_category_product', ['affected_rows'], {
6428
- objects: {
6429
- type: '[category_product_insert_input!]',
6430
- required: true,
6431
- value: plainData.products
6432
- .filter((productId) => !category.products.includes(productId))
6433
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
6434
- },
6435
- });
6436
- return plainData.products;
6437
- }
6438
6380
  async updateMetadata(categoryId, { metadatas }) {
6439
6381
  if (Array.isArray(metadatas) && !metadatas.length)
6440
6382
  return [];
@@ -6470,6 +6412,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6470
6412
  return [];
6471
6413
  }
6472
6414
  }
6415
+ async addProduct(wishlistId, productId) {
6416
+ return this.categoryProductRepository.addProductToCategory(wishlistId, productId);
6417
+ }
6418
+ async removeProduct(wishlistId, productId) {
6419
+ return this.categoryProductRepository.removeProductFromCategory(wishlistId, productId);
6420
+ }
6473
6421
  }
6474
6422
  tslib.__decorate([
6475
6423
  Log(),
@@ -6789,6 +6737,8 @@ exports.CategoryFilterHasuraGraphQLRepository = CategoryFilterHasuraGraphQLRepos
6789
6737
  exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
6790
6738
  exports.CategoryHasuraGraphQL = CategoryHasuraGraphQL;
6791
6739
  exports.CategoryHasuraGraphQLRepository = CategoryHasuraGraphQLRepository;
6740
+ exports.CategoryProduct = CategoryProduct;
6741
+ exports.CategoryProductHasuraGraphQLRepository = CategoryProductHasuraGraphQLRepository;
6792
6742
  exports.Checkout = Checkout;
6793
6743
  exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
6794
6744
  exports.CheckoutSubscription = CheckoutSubscription;
package/index.esm.js CHANGED
@@ -209,6 +209,12 @@ __decorate([
209
209
  __metadata("design:type", Category)
210
210
  ], CategoryFilter.prototype, "category", void 0);
211
211
 
212
+ class CategoryProduct extends BaseModel {
213
+ static get identifiersFields() {
214
+ return ['categoryId', 'productId'];
215
+ }
216
+ }
217
+
212
218
  class FilterOption extends BaseModel {
213
219
  static get identifiersFields() {
214
220
  return ['id'];
@@ -5100,29 +5106,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5100
5106
  });
5101
5107
  return [];
5102
5108
  }
5103
- const plainData = this.paramsToPlain({ products });
5104
- if (!plainData.products || plainData.products.length <= 0)
5105
- return [];
5106
- const category = await this.get({ id: categoryId.toString() });
5107
- await this.mutation('delete_category_product', ['affected_rows'], {
5108
- where: {
5109
- type: 'category_product_bool_exp',
5110
- required: true,
5111
- value: {
5112
- category_id: { _eq: categoryId },
5113
- product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5114
- },
5115
- },
5116
- });
5117
- await this.mutation('insert_category_product', ['affected_rows'], {
5118
- objects: {
5119
- type: '[category_product_insert_input!]',
5120
- required: true,
5121
- value: plainData.products
5122
- .filter((productId) => !category.products.includes(productId))
5123
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
5124
- },
5125
- });
5126
5109
  const productsOrder = products.map((product, index) => {
5127
5110
  return {
5128
5111
  id: product,
@@ -5131,7 +5114,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5131
5114
  });
5132
5115
  const updateQueries = productsOrder.map((product) => ({
5133
5116
  where: {
5134
- category_id: { _eq: category.id },
5117
+ category_id: { _eq: categoryId },
5135
5118
  product_id: { _eq: product.id },
5136
5119
  },
5137
5120
  _set: {
@@ -5145,6 +5128,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5145
5128
  required: true,
5146
5129
  },
5147
5130
  });
5131
+ const plainData = this.paramsToPlain({ products });
5148
5132
  return plainData.products;
5149
5133
  }
5150
5134
  async updateMetadata(categoryId, { metadatas }) {
@@ -5260,6 +5244,40 @@ __decorate([
5260
5244
  __metadata("design:returntype", Promise)
5261
5245
  ], CategoryHasuraGraphQLRepository.prototype, "isChild", null);
5262
5246
 
5247
+ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5248
+ constructor({ endpoint, authOptions, interceptors, }) {
5249
+ super({
5250
+ tableName: 'category_product',
5251
+ model: CategoryProduct,
5252
+ endpoint,
5253
+ authOptions,
5254
+ interceptors,
5255
+ fields: [{ productId: { columnName: 'product_id' } }, { categoryId: { columnName: 'category_id' } }, 'order'],
5256
+ });
5257
+ }
5258
+ async removeProductFromCategory(categoryId, productId) {
5259
+ await this.mutation('delete_category_product', ['affected_rows'], {
5260
+ where: {
5261
+ type: 'category_product_bool_exp',
5262
+ required: true,
5263
+ value: {
5264
+ product_id: { _eq: productId },
5265
+ category_id: { _eq: categoryId },
5266
+ },
5267
+ },
5268
+ });
5269
+ }
5270
+ async addProductToCategory(categoryId, productId) {
5271
+ await this.mutation('insert_category_product', ['affected_rows'], {
5272
+ objects: {
5273
+ type: '[category_product_insert_input!]',
5274
+ required: true,
5275
+ value: [{ category_id: categoryId, product_id: productId }],
5276
+ },
5277
+ });
5278
+ }
5279
+ }
5280
+
5263
5281
  class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5264
5282
  constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
5265
5283
  super({
@@ -5672,7 +5690,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5672
5690
  const plainData = this.paramsToPlain({ id: checkId });
5673
5691
  const id = await this.getId(plainData.id);
5674
5692
  const product = await super.update(Object.assign({ id }, data));
5675
- product.categories = categories && (await this.updateCategories(+id, { categories }));
5676
5693
  product.kitProducts = kitProducts && (await this.updateKitProducts(+id, { kitProducts }));
5677
5694
  product.reviews = reviews && (await this.updateReviews(+id, { reviews }));
5678
5695
  product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
@@ -5736,42 +5753,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5736
5753
  getReviewStatus(review) {
5737
5754
  return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
5738
5755
  }
5739
- async updateCategories(productId, { categories }) {
5740
- if ('action' in categories && categories.action === 'remove') {
5741
- await this.mutation('delete_category_product', ['affected_rows'], {
5742
- where: {
5743
- type: 'category_product_bool_exp',
5744
- required: true,
5745
- value: { product_id: { _eq: productId } },
5746
- },
5747
- });
5748
- return [];
5749
- }
5750
- const plainData = this.paramsToPlain({ categories });
5751
- if (!plainData.categories || plainData.categories.length <= 0)
5752
- return [];
5753
- const product = await this.get({ id: productId.toString() });
5754
- await this.mutation('delete_category_product', ['affected_rows'], {
5755
- where: {
5756
- type: 'category_product_bool_exp',
5757
- required: true,
5758
- value: {
5759
- product_id: { _eq: productId },
5760
- category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
5761
- },
5762
- },
5763
- });
5764
- await this.mutation('insert_category_product', ['affected_rows'], {
5765
- objects: {
5766
- type: '[category_product_insert_input!]',
5767
- required: true,
5768
- value: plainData.categories
5769
- .filter((categoryId) => !product.categories.includes(categoryId))
5770
- .map((categoryId) => ({ category_id: categoryId, product_id: productId })),
5771
- },
5772
- });
5773
- return plainData.categories;
5774
- }
5775
5756
  async updateKitProducts(productId, { kitProducts }) {
5776
5757
  const plainData = this.paramsToPlain({ kitProducts });
5777
5758
  await this.mutation('delete_product_kit', ['affected_rows'], {
@@ -6173,7 +6154,7 @@ class WishlistHasuraGraphQL extends Wishlist {
6173
6154
  }
6174
6155
 
6175
6156
  class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
6176
- constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
6157
+ constructor({ endpoint, authOptions, interceptors, }, categoryProductRepository) {
6177
6158
  super({
6178
6159
  tableName: 'category',
6179
6160
  model: WishlistHasuraGraphQL,
@@ -6274,7 +6255,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6274
6255
  { mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
6275
6256
  ],
6276
6257
  });
6277
- this.categoryFilterRepository = categoryFilterRepository;
6258
+ this.categoryProductRepository = categoryProductRepository;
6278
6259
  }
6279
6260
  async create(params) {
6280
6261
  var _a;
@@ -6310,7 +6291,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6310
6291
  const plainData = this.paramsToPlain({ id: checkId });
6311
6292
  const id = plainData.id;
6312
6293
  const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
6313
- category.products = products && (await this.updateProducts(+id, { products }));
6314
6294
  category.metadatas = metadatas && (await this.updateMetadata(+id, { metadatas }));
6315
6295
  return category;
6316
6296
  }
@@ -6391,44 +6371,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6391
6371
  isChild(id, parentId) {
6392
6372
  return;
6393
6373
  }
6394
- async updateProducts(categoryId, { products }) {
6395
- if ('action' in products && products.action === 'remove') {
6396
- await this.mutation('delete_category_product', ['affected_rows'], {
6397
- where: {
6398
- type: 'category_product_bool_exp',
6399
- required: true,
6400
- value: { category_id: { _eq: categoryId } },
6401
- },
6402
- });
6403
- await this.categoryFilterRepository.deleteByCategory(categoryId);
6404
- return [];
6405
- }
6406
- const plainData = this.paramsToPlain({ products });
6407
- if (!plainData.products || plainData.products.length <= 0)
6408
- return [];
6409
- const category = await this.get({ id: categoryId.toString() });
6410
- await this.categoryFilterRepository.deleteByCategory(categoryId);
6411
- await this.mutation('delete_category_product', ['affected_rows'], {
6412
- where: {
6413
- type: 'category_product_bool_exp',
6414
- required: true,
6415
- value: {
6416
- category_id: { _eq: categoryId },
6417
- product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
6418
- },
6419
- },
6420
- });
6421
- await this.mutation('insert_category_product', ['affected_rows'], {
6422
- objects: {
6423
- type: '[category_product_insert_input!]',
6424
- required: true,
6425
- value: plainData.products
6426
- .filter((productId) => !category.products.includes(productId))
6427
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
6428
- },
6429
- });
6430
- return plainData.products;
6431
- }
6432
6374
  async updateMetadata(categoryId, { metadatas }) {
6433
6375
  if (Array.isArray(metadatas) && !metadatas.length)
6434
6376
  return [];
@@ -6464,6 +6406,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6464
6406
  return [];
6465
6407
  }
6466
6408
  }
6409
+ async addProduct(wishlistId, productId) {
6410
+ return this.categoryProductRepository.addProductToCategory(wishlistId, productId);
6411
+ }
6412
+ async removeProduct(wishlistId, productId) {
6413
+ return this.categoryProductRepository.removeProductFromCategory(wishlistId, productId);
6414
+ }
6467
6415
  }
6468
6416
  __decorate([
6469
6417
  Log(),
@@ -6643,4 +6591,4 @@ class ProductsVertexSearch {
6643
6591
  }
6644
6592
  }
6645
6593
 
6646
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
6594
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.20.0",
3
+ "version": "4.21.0-beta.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -0,0 +1,8 @@
1
+ import { BaseModel } from '../../generic/model';
2
+ export type CategoryProductIdentifiers = 'productId' | 'categoryId';
3
+ export declare class CategoryProduct extends BaseModel<CategoryProduct, CategoryProductIdentifiers> {
4
+ categoryId: number;
5
+ productId: number;
6
+ order: number;
7
+ static get identifiersFields(): CategoryProductIdentifiers[];
8
+ }
@@ -1,6 +1,7 @@
1
1
  export * from './category';
2
2
  export * from './category-collection-children';
3
3
  export * from './category-filter';
4
+ export * from './category-product';
4
5
  export * from './enums';
5
6
  export * from './filter';
6
7
  export * from './filter-option';
@@ -2,7 +2,6 @@ export * from './category-condition.type';
2
2
  export * from './category-images.type';
3
3
  export * from './category-metadata.type';
4
4
  export * from './category-most-relevant.type';
5
- export * from './category-product';
6
5
  export * from './product-evaluation.type';
7
6
  export * from './product-gender.type';
8
7
  export * from './product-label.type';
@@ -0,0 +1,6 @@
1
+ import { CrudRepository } from '../../generic/repository/crud.repository';
2
+ import { CategoryProduct } from '../models';
3
+ export interface CategoryProductRepository extends CrudRepository<CategoryProduct> {
4
+ removeProductFromCategory(categoryId: string, productId: string): Promise<void>;
5
+ addProductToCategory(categoryId: string, productId: string): Promise<void>;
6
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './category-collection-children.repository';
2
2
  export * from './category-filter.repository';
3
+ export * from './category-product.repository';
3
4
  export * from './category.repository';
4
5
  export * from './filter-option.repository';
5
6
  export * from './filter.repository';
@@ -6,4 +6,6 @@ export interface WishlistRepository extends CategoryRepository<Wishlist> {
6
6
  getWishlistBySlug(slug: string): Promise<Wishlist>;
7
7
  getWishlistByPerson(personId: string): Promise<Wishlist[]>;
8
8
  findBfluOrGlamgirlWishlists(params: FindRepositoryParams<Wishlist>, shops: Shops[]): Promise<RepositoryFindResult<Wishlist>>;
9
+ addProduct(wishlistId: string, productId: string): Promise<void>;
10
+ removeProduct(wishlistId: string, productId: string): Promise<void>;
9
11
  }
@@ -0,0 +1,11 @@
1
+ import { CategoryProduct, CategoryProductRepository } from '../../../../domain';
2
+ import { HasuraConstructorParams } from '../../mixins';
3
+ declare const CategoryProductHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<CategoryProduct> & import("../../../../domain").CrudRepository<CategoryProduct, import("../../../../domain").CrudParams<CategoryProduct>> & import("../../../../domain").UpdateRepository<CategoryProduct, import("../../../../domain").RepositoryUpdateParams<CategoryProduct>> & {
4
+ paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<CategoryProduct>): Partial<CategoryProduct>;
5
+ }, [HasuraConstructorParams<CategoryProduct> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
6
+ export declare class CategoryProductHasuraGraphQLRepository extends CategoryProductHasuraGraphQLRepository_base implements CategoryProductRepository {
7
+ constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<CategoryProduct>, 'endpoint' | 'authOptions' | 'interceptors'>);
8
+ removeProductFromCategory(categoryId: string, productId: string): Promise<void>;
9
+ addProductToCategory(categoryId: string, productId: string): Promise<void>;
10
+ }
11
+ export {};
@@ -1,6 +1,7 @@
1
1
  export * from './category-collection-children-hasura-graphql.repository';
2
2
  export * from './category-filter-hasura-graphql.repository';
3
3
  export * from './category-hasura-graphql.repository';
4
+ export * from './category-product-hasura-graphql.repository';
4
5
  export * from './filter-hasura-graphql.repository';
5
6
  export * from './filter-option-hasura-graphql.repository';
6
7
  export * from './product-hasura-graphql.repository';
@@ -17,7 +17,6 @@ export declare class ProductHasuraGraphQLRepository extends ProductHasuraGraphQL
17
17
  findCatalog(params: FindRepositoryParams<ProductHasuraGraphQL>, mainGender?: Extract<ProductGender, 'female' | 'male'>): Promise<RepositoryFindResult<ProductHasuraGraphQL>>;
18
18
  cleanShoppingCountFromIds(ids: string[]): Promise<void>;
19
19
  private getReviewStatus;
20
- private updateCategories;
21
20
  private updateKitProducts;
22
21
  private updateReviews;
23
22
  private updateMetadata;
@@ -1,13 +1,13 @@
1
1
  import { Category, CreateRepositoryParams, FindRepositoryParams, GetRepositoryParams, Product, RepositoryFindResult, Shops, UpdateRepositoryParams, Wishlist, WishlistRepository } from '../../../../domain';
2
2
  import { HasuraConstructorParams } from '../../mixins';
3
3
  import { WishlistHasuraGraphQL } from '../../models/wishlist-hasura-graphql';
4
- import { CategoryFilterHasuraGraphQLRepository } from './category-filter-hasura-graphql.repository';
4
+ import { CategoryProductHasuraGraphQLRepository } from './category-product-hasura-graphql.repository';
5
5
  declare const WishlistHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<WishlistHasuraGraphQL> & import("../../../../domain").CrudRepository<WishlistHasuraGraphQL, import("../../../../domain").CrudParams<WishlistHasuraGraphQL>> & import("../../../../domain").UpdateRepository<WishlistHasuraGraphQL, import("../../../../domain").RepositoryUpdateParams<WishlistHasuraGraphQL>> & {
6
6
  paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<WishlistHasuraGraphQL>): Partial<WishlistHasuraGraphQL>;
7
7
  }, [HasuraConstructorParams<WishlistHasuraGraphQL> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
8
8
  export declare class WishlistHasuraGraphQLRepository extends WishlistHasuraGraphQLRepository_base implements WishlistRepository {
9
- private readonly categoryFilterRepository;
10
- constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Wishlist>, 'endpoint' | 'authOptions' | 'interceptors'>, categoryFilterRepository: CategoryFilterHasuraGraphQLRepository);
9
+ private readonly categoryProductRepository;
10
+ constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Wishlist>, 'endpoint' | 'authOptions' | 'interceptors'>, categoryProductRepository: CategoryProductHasuraGraphQLRepository);
11
11
  create(params: CreateRepositoryParams<WishlistHasuraGraphQL>): Promise<WishlistHasuraGraphQL>;
12
12
  get(identifiers: GetRepositoryParams<WishlistHasuraGraphQL>): Promise<WishlistHasuraGraphQL>;
13
13
  find(params?: FindRepositoryParams<WishlistHasuraGraphQL>): Promise<RepositoryFindResult<WishlistHasuraGraphQL>>;
@@ -24,7 +24,8 @@ export declare class WishlistHasuraGraphQLRepository extends WishlistHasuraGraph
24
24
  }): Promise<Product[]>;
25
25
  getChildren(parentId: number): Promise<Category[]>;
26
26
  isChild(id: number, parentId: number): Promise<boolean>;
27
- private updateProducts;
28
27
  private updateMetadata;
28
+ addProduct(wishlistId: string, productId: string): Promise<void>;
29
+ removeProduct(wishlistId: string, productId: string): Promise<void>;
29
30
  }
30
31
  export {};