@infrab4a/connect 4.9.0-beta.3 → 4.9.0

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
@@ -220,6 +220,12 @@ class ProductReviews extends BaseModel {
220
220
  }
221
221
  }
222
222
 
223
+ class ProductStockNotification extends BaseModel {
224
+ static get identifiersFields() {
225
+ return ['id'];
226
+ }
227
+ }
228
+
223
229
  class Variant extends BaseModel {
224
230
  static get identifiersFields() {
225
231
  return ['id', 'productId'];
@@ -2930,6 +2936,7 @@ const withFindFirestore = (MixinBase) => {
2930
2936
  ...this.buildWhereSentence(fieldName, is(filter[fieldName])),
2931
2937
  ], []);
2932
2938
  this.buildWhereSentence = (fieldName, options) => {
2939
+ var _a, _b, _c, _d;
2933
2940
  if (this.isSubCollection(this) && fieldName === this.parentIdField)
2934
2941
  return [];
2935
2942
  const value = (options === null || options === void 0 ? void 0 : options.value) || options;
@@ -2941,9 +2948,9 @@ const withFindFirestore = (MixinBase) => {
2941
2948
  : Object.keys(plainInstance).find((key) => plainInstance[key]);
2942
2949
  if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.LIKE) {
2943
2950
  if (Array.isArray(options === null || options === void 0 ? void 0 : options.value) &&
2944
- (this.fields[firestoreFieldName] ===
2951
+ (((_a = this.fields) === null || _a === void 0 ? void 0 : _a[firestoreFieldName]) ===
2945
2952
  FirestoreFieldType.Array ||
2946
- !this.fields[firestoreFieldName]))
2953
+ !((_b = this.fields) === null || _b === void 0 ? void 0 : _b[firestoreFieldName])))
2947
2954
  return [[firestoreFieldName, 'array-contains-any', options.value]];
2948
2955
  return [
2949
2956
  [firestoreFieldName, '>=', options.value],
@@ -2952,8 +2959,9 @@ const withFindFirestore = (MixinBase) => {
2952
2959
  }
2953
2960
  if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN &&
2954
2961
  Array.isArray(options === null || options === void 0 ? void 0 : options.value) &&
2955
- (this.fields[firestoreFieldName] === FirestoreFieldType.Array ||
2956
- !this.fields[firestoreFieldName]))
2962
+ (((_c = this.fields) === null || _c === void 0 ? void 0 : _c[firestoreFieldName]) ===
2963
+ FirestoreFieldType.Array ||
2964
+ !((_d = this.fields) === null || _d === void 0 ? void 0 : _d[firestoreFieldName])))
2957
2965
  return [[firestoreFieldName, 'array-contains', options.value]];
2958
2966
  if (lodash.isObject(options) && lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) && lodash.isNil(options === null || options === void 0 ? void 0 : options.value)) {
2959
2967
  return Object.keys(options).reduce((queries, key) => [
@@ -5882,6 +5890,42 @@ tslib_1.__decorate([
5882
5890
  tslib_1.__metadata("design:returntype", void 0)
5883
5891
  ], ProductReviewsHasuraGraphQLRepository.prototype, "disaproveReview", null);
5884
5892
 
5893
+ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5894
+ constructor({ endpoint, authOptions, interceptors, }) {
5895
+ super({
5896
+ tableName: 'product_stock_notification',
5897
+ model: ProductStockNotification,
5898
+ endpoint,
5899
+ authOptions,
5900
+ interceptors,
5901
+ fields: [
5902
+ 'id',
5903
+ { productId: { columnName: 'product_id' } },
5904
+ 'name',
5905
+ 'email',
5906
+ 'shop',
5907
+ { createdAt: { columnName: 'created_at' } },
5908
+ { updatedAt: { columnName: 'updated_at' } },
5909
+ ],
5910
+ });
5911
+ }
5912
+ async addCustomerEmail(shop, productId, name, email) {
5913
+ const notification = await this.find({
5914
+ filters: {
5915
+ productId,
5916
+ email,
5917
+ },
5918
+ }).then((data) => data.data.shift());
5919
+ if (!notification)
5920
+ this.create({
5921
+ shop,
5922
+ productId,
5923
+ name,
5924
+ email,
5925
+ });
5926
+ }
5927
+ }
5928
+
5885
5929
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5886
5930
  constructor({ endpoint, authOptions, interceptors, }) {
5887
5931
  super({
@@ -6419,6 +6463,8 @@ exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
6419
6463
  exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
6420
6464
  exports.ProductReviews = ProductReviews;
6421
6465
  exports.ProductReviewsHasuraGraphQLRepository = ProductReviewsHasuraGraphQLRepository;
6466
+ exports.ProductStockNotification = ProductStockNotification;
6467
+ exports.ProductStockNotificationHasuraGraphQLRepository = ProductStockNotificationHasuraGraphQLRepository;
6422
6468
  exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
6423
6469
  exports.ProductsIndex = ProductsIndex;
6424
6470
  exports.RecoveryPassword = RecoveryPassword;
package/index.esm.js CHANGED
@@ -196,6 +196,12 @@ class ProductReviews extends BaseModel {
196
196
  }
197
197
  }
198
198
 
199
+ class ProductStockNotification extends BaseModel {
200
+ static get identifiersFields() {
201
+ return ['id'];
202
+ }
203
+ }
204
+
199
205
  class Variant extends BaseModel {
200
206
  static get identifiersFields() {
201
207
  return ['id', 'productId'];
@@ -2906,6 +2912,7 @@ const withFindFirestore = (MixinBase) => {
2906
2912
  ...this.buildWhereSentence(fieldName, is(filter[fieldName])),
2907
2913
  ], []);
2908
2914
  this.buildWhereSentence = (fieldName, options) => {
2915
+ var _a, _b, _c, _d;
2909
2916
  if (this.isSubCollection(this) && fieldName === this.parentIdField)
2910
2917
  return [];
2911
2918
  const value = (options === null || options === void 0 ? void 0 : options.value) || options;
@@ -2917,9 +2924,9 @@ const withFindFirestore = (MixinBase) => {
2917
2924
  : Object.keys(plainInstance).find((key) => plainInstance[key]);
2918
2925
  if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
2919
2926
  if (Array.isArray(options === null || options === void 0 ? void 0 : options.value) &&
2920
- (this.fields[firestoreFieldName] ===
2927
+ (((_a = this.fields) === null || _a === void 0 ? void 0 : _a[firestoreFieldName]) ===
2921
2928
  FirestoreFieldType.Array ||
2922
- !this.fields[firestoreFieldName]))
2929
+ !((_b = this.fields) === null || _b === void 0 ? void 0 : _b[firestoreFieldName])))
2923
2930
  return [[firestoreFieldName, 'array-contains-any', options.value]];
2924
2931
  return [
2925
2932
  [firestoreFieldName, '>=', options.value],
@@ -2928,8 +2935,9 @@ const withFindFirestore = (MixinBase) => {
2928
2935
  }
2929
2936
  if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN &&
2930
2937
  Array.isArray(options === null || options === void 0 ? void 0 : options.value) &&
2931
- (this.fields[firestoreFieldName] === FirestoreFieldType.Array ||
2932
- !this.fields[firestoreFieldName]))
2938
+ (((_c = this.fields) === null || _c === void 0 ? void 0 : _c[firestoreFieldName]) ===
2939
+ FirestoreFieldType.Array ||
2940
+ !((_d = this.fields) === null || _d === void 0 ? void 0 : _d[firestoreFieldName])))
2933
2941
  return [[firestoreFieldName, 'array-contains', options.value]];
2934
2942
  if (isObject$1(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
2935
2943
  return Object.keys(options).reduce((queries, key) => [
@@ -5858,6 +5866,42 @@ __decorate([
5858
5866
  __metadata("design:returntype", void 0)
5859
5867
  ], ProductReviewsHasuraGraphQLRepository.prototype, "disaproveReview", null);
5860
5868
 
5869
+ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5870
+ constructor({ endpoint, authOptions, interceptors, }) {
5871
+ super({
5872
+ tableName: 'product_stock_notification',
5873
+ model: ProductStockNotification,
5874
+ endpoint,
5875
+ authOptions,
5876
+ interceptors,
5877
+ fields: [
5878
+ 'id',
5879
+ { productId: { columnName: 'product_id' } },
5880
+ 'name',
5881
+ 'email',
5882
+ 'shop',
5883
+ { createdAt: { columnName: 'created_at' } },
5884
+ { updatedAt: { columnName: 'updated_at' } },
5885
+ ],
5886
+ });
5887
+ }
5888
+ async addCustomerEmail(shop, productId, name, email) {
5889
+ const notification = await this.find({
5890
+ filters: {
5891
+ productId,
5892
+ email,
5893
+ },
5894
+ }).then((data) => data.data.shift());
5895
+ if (!notification)
5896
+ this.create({
5897
+ shop,
5898
+ productId,
5899
+ name,
5900
+ email,
5901
+ });
5902
+ }
5903
+ }
5904
+
5861
5905
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5862
5906
  constructor({ endpoint, authOptions, interceptors, }) {
5863
5907
  super({
@@ -6212,4 +6256,4 @@ __decorate([
6212
6256
  __metadata("design:returntype", Promise)
6213
6257
  ], WishlistHasuraGraphQLRepository.prototype, "getCategoryByShop", null);
6214
6258
 
6215
- 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, CouponFirestoreRepository, 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, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, 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, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
6259
+ 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, CouponFirestoreRepository, 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, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, 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, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, 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.9.0-beta.3",
3
+ "version": "4.9.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -13,7 +13,7 @@
13
13
  "class-transformer": "^0.5.1",
14
14
  "date-fns": "^2.28.0",
15
15
  "debug": "^4.3.4",
16
- "firebase": "^9.9.0",
16
+ "firebase": "9.18.0",
17
17
  "gql-query-builder": "3.7.0",
18
18
  "lodash": "^4.17.21",
19
19
  "reflect-metadata": "^0.1.13",
@@ -7,6 +7,7 @@ export * from './filter-option';
7
7
  export * from './kit-product';
8
8
  export * from './product';
9
9
  export * from './product-reviews';
10
+ export * from './product-stock-notification';
10
11
  export * from './types';
11
12
  export * from './variant';
12
13
  export * from './wishlist';
@@ -0,0 +1,12 @@
1
+ import { BaseModel, GenericIdentifier } from '../../generic/model';
2
+ import { Shops } from './enums';
3
+ export declare class ProductStockNotification extends BaseModel<ProductStockNotification> {
4
+ id: number;
5
+ productId: string;
6
+ name: string;
7
+ email: string;
8
+ shop: Shops;
9
+ createdAt?: Date;
10
+ updatedAt?: Date;
11
+ static get identifiersFields(): GenericIdentifier[];
12
+ }
@@ -4,6 +4,7 @@ export * from './category.repository';
4
4
  export * from './filter-option.repository';
5
5
  export * from './filter.repository';
6
6
  export * from './product-reviews.repository';
7
+ export * from './product-stock-notification.repository';
7
8
  export * from './product.repository';
8
9
  export * from './subscription-product.repository';
9
10
  export * from './variant.repository';
@@ -0,0 +1,5 @@
1
+ import { CrudRepository } from '../../generic/repository/crud.repository';
2
+ import { ProductStockNotification, Shops } from '../models';
3
+ export interface ProductStockNotificationRepository extends CrudRepository<ProductStockNotification> {
4
+ addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
5
+ }
@@ -5,5 +5,6 @@ export * from './filter-hasura-graphql.repository';
5
5
  export * from './filter-option-hasura-graphql.repository';
6
6
  export * from './product-hasura-graphql.repository';
7
7
  export * from './product-review-hasura-graphql.repository';
8
+ export * from './product-stock-notification-hasura-graphql.repository';
8
9
  export * from './variant-hasura-graphql.repository';
9
10
  export * from './wishlist-hasura-graphql.repository';
@@ -0,0 +1,11 @@
1
+ import { Filter, ProductStockNotification, Shops } from '../../../../domain';
2
+ import { ProductStockNotificationRepository } from '../../../../domain/catalog/repositories';
3
+ import { HasuraConstructorParams } from '../../mixins';
4
+ declare const ProductStockNotificationHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<ProductStockNotification> & import("../../../../domain").CrudRepository<ProductStockNotification, import("../../../../domain").CrudParams<ProductStockNotification>> & import("../../../../domain").UpdateRepository<ProductStockNotification, import("../../../../domain").RepositoryUpdateParams<ProductStockNotification>> & {
5
+ paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<ProductStockNotification>): Partial<ProductStockNotification>;
6
+ }, [HasuraConstructorParams<ProductStockNotification> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
7
+ export declare class ProductStockNotificationHasuraGraphQLRepository extends ProductStockNotificationHasuraGraphQLRepository_base implements ProductStockNotificationRepository {
8
+ constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Filter>, 'endpoint' | 'authOptions' | 'interceptors'>);
9
+ addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
10
+ }
11
+ export {};