@infrab4a/connect 5.4.0-beta.8 → 5.4.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.
- package/index.cjs.js +27 -3
- package/index.esm.js +27 -4
- package/package.json +1 -1
- package/src/infra/hasura-graphql/models/index.d.ts +1 -0
- package/src/infra/hasura-graphql/models/product-catalog-hasura-graphql.d.ts +16 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-catalog-hasura-graphql.repository.d.ts +5 -3
package/index.cjs.js
CHANGED
|
@@ -5851,6 +5851,9 @@ tslib.__decorate([
|
|
|
5851
5851
|
tslib.__metadata("design:type", Product)
|
|
5852
5852
|
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
5853
5853
|
|
|
5854
|
+
class ProductCatalogHasuraGraphQL extends Product {
|
|
5855
|
+
}
|
|
5856
|
+
|
|
5854
5857
|
class ProductHasuraGraphQL extends Product {
|
|
5855
5858
|
}
|
|
5856
5859
|
tslib.__decorate([
|
|
@@ -7390,7 +7393,7 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
|
|
|
7390
7393
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
7391
7394
|
super({
|
|
7392
7395
|
tableName: 'product_catalog',
|
|
7393
|
-
model:
|
|
7396
|
+
model: ProductCatalogHasuraGraphQL,
|
|
7394
7397
|
endpoint,
|
|
7395
7398
|
authOptions,
|
|
7396
7399
|
interceptors,
|
|
@@ -7398,8 +7401,16 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
|
|
|
7398
7401
|
cache,
|
|
7399
7402
|
});
|
|
7400
7403
|
}
|
|
7401
|
-
async get({ id }) {
|
|
7402
|
-
|
|
7404
|
+
async get({ id }, options) {
|
|
7405
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
7406
|
+
const cacheKey = `${this.model.name.toLowerCase()}:id:${id}`;
|
|
7407
|
+
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
7408
|
+
if (cachedData) {
|
|
7409
|
+
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
7410
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
7411
|
+
}
|
|
7412
|
+
}
|
|
7413
|
+
const product = await super
|
|
7403
7414
|
.find({
|
|
7404
7415
|
filters: {
|
|
7405
7416
|
id,
|
|
@@ -7409,6 +7420,18 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
|
|
|
7409
7420
|
},
|
|
7410
7421
|
})
|
|
7411
7422
|
.then((res) => res.data.at(0));
|
|
7423
|
+
if (!product)
|
|
7424
|
+
throw new NotFoundError(`Product not found`);
|
|
7425
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
|
|
7426
|
+
const cacheKey = `${this.model.name.toLowerCase()}:id:${id}`;
|
|
7427
|
+
await this.cache.cacheAdapter.set({
|
|
7428
|
+
key: cacheKey,
|
|
7429
|
+
data: serialize(product),
|
|
7430
|
+
expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
|
|
7431
|
+
});
|
|
7432
|
+
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
7433
|
+
}
|
|
7434
|
+
return product;
|
|
7412
7435
|
}
|
|
7413
7436
|
async getByEAN(EAN, options) {
|
|
7414
7437
|
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
@@ -10376,6 +10399,7 @@ exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
|
|
10376
10399
|
exports.PaymentProviderFactory = PaymentProviderFactory;
|
|
10377
10400
|
exports.PaymentTransaction = PaymentTransaction;
|
|
10378
10401
|
exports.Product = Product;
|
|
10402
|
+
exports.ProductCatalogHasuraGraphQL = ProductCatalogHasuraGraphQL;
|
|
10379
10403
|
exports.ProductCatalogHasuraGraphQLRepository = ProductCatalogHasuraGraphQLRepository;
|
|
10380
10404
|
exports.ProductErrors = ProductErrors;
|
|
10381
10405
|
exports.ProductErrorsHasuraGraphQL = ProductErrorsHasuraGraphQL;
|
package/index.esm.js
CHANGED
|
@@ -5827,6 +5827,9 @@ __decorate([
|
|
|
5827
5827
|
__metadata("design:type", Product)
|
|
5828
5828
|
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
5829
5829
|
|
|
5830
|
+
class ProductCatalogHasuraGraphQL extends Product {
|
|
5831
|
+
}
|
|
5832
|
+
|
|
5830
5833
|
class ProductHasuraGraphQL extends Product {
|
|
5831
5834
|
}
|
|
5832
5835
|
__decorate([
|
|
@@ -7366,7 +7369,7 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
|
|
|
7366
7369
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
7367
7370
|
super({
|
|
7368
7371
|
tableName: 'product_catalog',
|
|
7369
|
-
model:
|
|
7372
|
+
model: ProductCatalogHasuraGraphQL,
|
|
7370
7373
|
endpoint,
|
|
7371
7374
|
authOptions,
|
|
7372
7375
|
interceptors,
|
|
@@ -7374,8 +7377,16 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
|
|
|
7374
7377
|
cache,
|
|
7375
7378
|
});
|
|
7376
7379
|
}
|
|
7377
|
-
async get({ id }) {
|
|
7378
|
-
|
|
7380
|
+
async get({ id }, options) {
|
|
7381
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
7382
|
+
const cacheKey = `${this.model.name.toLowerCase()}:id:${id}`;
|
|
7383
|
+
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
7384
|
+
if (cachedData) {
|
|
7385
|
+
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
7386
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
7387
|
+
}
|
|
7388
|
+
}
|
|
7389
|
+
const product = await super
|
|
7379
7390
|
.find({
|
|
7380
7391
|
filters: {
|
|
7381
7392
|
id,
|
|
@@ -7385,6 +7396,18 @@ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHa
|
|
|
7385
7396
|
},
|
|
7386
7397
|
})
|
|
7387
7398
|
.then((res) => res.data.at(0));
|
|
7399
|
+
if (!product)
|
|
7400
|
+
throw new NotFoundError(`Product not found`);
|
|
7401
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
|
|
7402
|
+
const cacheKey = `${this.model.name.toLowerCase()}:id:${id}`;
|
|
7403
|
+
await this.cache.cacheAdapter.set({
|
|
7404
|
+
key: cacheKey,
|
|
7405
|
+
data: serialize(product),
|
|
7406
|
+
expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
|
|
7407
|
+
});
|
|
7408
|
+
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
7409
|
+
}
|
|
7410
|
+
return product;
|
|
7388
7411
|
}
|
|
7389
7412
|
async getByEAN(EAN, options) {
|
|
7390
7413
|
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
@@ -10128,4 +10151,4 @@ class ProductsVertexSearch {
|
|
|
10128
10151
|
}
|
|
10129
10152
|
}
|
|
10130
10153
|
|
|
10131
|
-
export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandEquityOptions, BusinessError, BusinessUnitEnum, 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, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductCatalogHasuraGraphQLRepository, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, TransactionPaymentMethods, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
10154
|
+
export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandEquityOptions, BusinessError, BusinessUnitEnum, 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, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductCatalogHasuraGraphQL, ProductCatalogHasuraGraphQLRepository, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, TransactionPaymentMethods, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './category-hasura-graphql';
|
|
2
2
|
export * from './kit-product-hasura-graphql';
|
|
3
|
+
export * from './product-catalog-hasura-graphql';
|
|
3
4
|
export * from './product-errors-hasura-graphql';
|
|
4
5
|
export * from './product-hasura-graphql';
|
|
5
6
|
export * from './variant-hasura-graphql';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Product } from '../../../domain';
|
|
2
|
+
export declare class ProductCatalogHasuraGraphQL extends Product {
|
|
3
|
+
firestoreId?: string;
|
|
4
|
+
fullPrice?: number;
|
|
5
|
+
subscriberDiscountPercentage?: number;
|
|
6
|
+
subscriberPrice?: number;
|
|
7
|
+
productId?: number;
|
|
8
|
+
differentials?: string;
|
|
9
|
+
whoMustUse?: string;
|
|
10
|
+
howToUse?: string;
|
|
11
|
+
brandDescription?: string;
|
|
12
|
+
categoryId?: number;
|
|
13
|
+
ingredients?: string;
|
|
14
|
+
hasStock?: boolean;
|
|
15
|
+
intGender?: number;
|
|
16
|
+
}
|
package/src/infra/hasura-graphql/repositories/catalog/product-catalog-hasura-graphql.repository.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { FindRepositoryParams, Product, ProductCatalogRepository, ProductGender, RepositoryCacheOptions, RepositoryFindResult } from '../../../../domain';
|
|
2
2
|
import { HasuraConstructorParams } from '../../mixins';
|
|
3
|
-
import { ProductHasuraGraphQL } from '../../models';
|
|
4
|
-
declare const ProductCatalogHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<
|
|
3
|
+
import { ProductCatalogHasuraGraphQL, ProductHasuraGraphQL } from '../../models';
|
|
4
|
+
declare const ProductCatalogHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<ProductCatalogHasuraGraphQL> & import("../../../../domain").FindRepository<ProductCatalogHasuraGraphQL, FindRepositoryParams<ProductCatalogHasuraGraphQL>>, any[]>;
|
|
5
5
|
export declare class ProductCatalogHasuraGraphQLRepository extends ProductCatalogHasuraGraphQLRepository_base implements ProductCatalogRepository {
|
|
6
|
-
constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<
|
|
6
|
+
constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<ProductCatalogHasuraGraphQL>, 'endpoint' | 'authOptions' | 'interceptors' | 'cache'>);
|
|
7
7
|
get({ id }: {
|
|
8
8
|
id: string;
|
|
9
|
+
}, options?: {
|
|
10
|
+
cache?: RepositoryCacheOptions;
|
|
9
11
|
}): Promise<Product>;
|
|
10
12
|
getByEAN(EAN: string, options?: {
|
|
11
13
|
cache?: RepositoryCacheOptions;
|