@infrab4a/connect 4.0.0-beta.8 → 4.0.0-beta.9

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.
@@ -1357,7 +1357,7 @@ const withFindFirestore = (MixinBase) => {
1357
1357
  const queries = [];
1358
1358
  if (limits?.offset) {
1359
1359
  if (this.model.isModel(limits.offset))
1360
- queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier.shift()))));
1360
+ queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier[limits.offset.identifiersFields?.shift()]))));
1361
1361
  else if (isNumber(limits.offset) || isString(limits.offset))
1362
1362
  queries.push(startAt(limits.offset));
1363
1363
  }
@@ -2520,12 +2520,13 @@ class VariantHasuraGraphQL extends Variant {
2520
2520
  }
2521
2521
 
2522
2522
  class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2523
- constructor(endpoint, authOptions, productRepository) {
2523
+ constructor({ endpoint, authOptions, interceptors, }, productRepository) {
2524
2524
  super({
2525
2525
  tableName: 'category',
2526
2526
  model: Category,
2527
2527
  endpoint,
2528
2528
  authOptions,
2529
+ interceptors,
2529
2530
  fields: [
2530
2531
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
2531
2532
  { firestoreId: { columnName: 'firestore_id' } },
@@ -2737,12 +2738,13 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2737
2738
  }
2738
2739
 
2739
2740
  class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2740
- constructor(endpoint, authOptions) {
2741
+ constructor({ endpoint, authOptions, interceptors, }) {
2741
2742
  super({
2742
2743
  tableName: 'product',
2743
2744
  model: ProductHasuraGraphQL,
2744
2745
  endpoint,
2745
2746
  authOptions,
2747
+ interceptors,
2746
2748
  fields: [],
2747
2749
  });
2748
2750
  this.bindReviewToModel = (plain) => ({
@@ -3197,12 +3199,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3197
3199
  }
3198
3200
 
3199
3201
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3200
- constructor(endpoint, authOptions) {
3202
+ constructor({ endpoint, authOptions, interceptors, }) {
3201
3203
  super({
3202
3204
  tableName: 'product',
3203
3205
  model: VariantHasuraGraphQL,
3204
3206
  endpoint,
3205
3207
  authOptions,
3208
+ interceptors,
3206
3209
  fields: [
3207
3210
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
3208
3211
  { firestoreId: { columnName: 'firestore_id' } },
@@ -3225,7 +3228,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3225
3228
  subscriberPrice: data.subscriber_price,
3226
3229
  }),
3227
3230
  bindFindFilter: (sentence) => {
3228
- const filters = Object.values(sentence).shift();
3231
+ const filters = Object.values(sentence || {}).shift();
3229
3232
  return {
3230
3233
  ...((filters?.price || filters?.price === 0) && { price: filters.price }),
3231
3234
  ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
@@ -3238,12 +3241,12 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3238
3241
  };
3239
3242
  },
3240
3243
  bindPersistData: (priceData) => ({
3241
- ...(priceData?.price >= 0 && { price: priceData.price }),
3242
- ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
3243
- ...(priceData.subscriberDiscountPercentage >= 0 && {
3244
+ ...((priceData?.price || 0) >= 0 && { price: priceData.price }),
3245
+ ...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
3246
+ ...((priceData?.subscriberDiscountPercentage || 0) >= 0 && {
3244
3247
  subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
3245
3248
  }),
3246
- ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
3249
+ ...((priceData?.subscriberPrice || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }),
3247
3250
  }),
3248
3251
  },
3249
3252
  },