@infrab4a/connect 4.0.0-beta.30 → 4.0.0-beta.32
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/domain/catalog/models/types/shop-description.type.d.ts +1 -0
- package/domain/generic/repository/find.repository.d.ts +3 -1
- package/domain/generic/repository/types/repository-find-result.type.d.ts +8 -1
- package/esm2020/domain/catalog/models/types/shop-description.type.mjs +1 -1
- package/esm2020/domain/generic/repository/find.repository.mjs +1 -1
- package/esm2020/domain/generic/repository/types/repository-find-result.type.mjs +1 -1
- package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +2 -2
- package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +2 -2
- package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +49 -5
- package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +1 -1
- package/esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs +1 -1
- package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +15 -5
- package/esm2020/utils/index.mjs +3 -3
- package/fesm2015/infrab4a-connect.mjs +67 -16
- package/fesm2015/infrab4a-connect.mjs.map +1 -1
- package/fesm2020/infrab4a-connect.mjs +65 -11
- package/fesm2020/infrab4a-connect.mjs.map +1 -1
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +12 -1
- package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +1 -0
- package/package.json +1 -1
- package/utils/index.d.ts +2 -2
|
@@ -4,7 +4,7 @@ import { __decorate, __metadata } from 'tslib';
|
|
|
4
4
|
import { parseISO } from 'date-fns';
|
|
5
5
|
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
6
6
|
import { isNil, isArray, first, last, flatten, compact, get as get$1, isString, each, unset, isObject, isNumber, isDate, set, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
7
|
-
export { chunk, each, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
|
|
7
|
+
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
|
|
8
8
|
import { Subject } from 'rxjs';
|
|
9
9
|
import { debug } from 'debug';
|
|
10
10
|
import { CustomError } from 'ts-custom-error';
|
|
@@ -1760,11 +1760,11 @@ const withFirestore = (MixinBase) => {
|
|
|
1760
1760
|
};
|
|
1761
1761
|
return class extends MixinBase {
|
|
1762
1762
|
constructor(...params) {
|
|
1763
|
-
const options = params[0];
|
|
1764
1763
|
super(...params);
|
|
1765
1764
|
this.fields = {};
|
|
1766
1765
|
this.interceptors = {};
|
|
1767
1766
|
this.collectionName = '';
|
|
1767
|
+
const options = params[0];
|
|
1768
1768
|
this.firestore = options.firestore;
|
|
1769
1769
|
this.collectionName = options.collectionName;
|
|
1770
1770
|
this.model = options.model;
|
|
@@ -2642,7 +2642,7 @@ AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
|
|
|
2642
2642
|
return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
|
|
2643
2643
|
return { attributeName, columnName: attributeName.toString(), ...fieldOption };
|
|
2644
2644
|
};
|
|
2645
|
-
AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue
|
|
2645
|
+
AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue?.columnName;
|
|
2646
2646
|
AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
|
|
2647
2647
|
if (fields.includes(columnName))
|
|
2648
2648
|
return { columnName, attributeName: columnName };
|
|
@@ -3172,6 +3172,23 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3172
3172
|
[AttributeOptionHelper.FindByAttribute(current, fields)
|
|
3173
3173
|
.columnName]: orderBy[current],
|
|
3174
3174
|
}), {});
|
|
3175
|
+
this.bindAggretageAttributes = (aggregates, fields) => [
|
|
3176
|
+
...(aggregates?.minimal?.length
|
|
3177
|
+
? [
|
|
3178
|
+
{
|
|
3179
|
+
min: this.bindAttributesToColumns(aggregates?.minimal, fields),
|
|
3180
|
+
},
|
|
3181
|
+
]
|
|
3182
|
+
: []),
|
|
3183
|
+
...(aggregates?.maximum?.length
|
|
3184
|
+
? [
|
|
3185
|
+
{
|
|
3186
|
+
max: this.bindAttributesToColumns(aggregates?.maximum, fields),
|
|
3187
|
+
},
|
|
3188
|
+
]
|
|
3189
|
+
: []),
|
|
3190
|
+
];
|
|
3191
|
+
this.bindAttributesToColumns = (attributes, fields) => attributes.map((attr) => AttributeOptionHelper.FindByAttribute(attr.toString().split('.').pop(), fields)?.columnName || attr);
|
|
3175
3192
|
}
|
|
3176
3193
|
async find(params) {
|
|
3177
3194
|
this.logger = DebugHelper.from(this, 'find');
|
|
@@ -3201,6 +3218,10 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3201
3218
|
...(isNil(limits) ? {} : limits),
|
|
3202
3219
|
...variablesCount,
|
|
3203
3220
|
};
|
|
3221
|
+
const aggregateFields = [
|
|
3222
|
+
...(enableCount ? ['count'] : []),
|
|
3223
|
+
...this.bindAggretageAttributes(params.options, this.fields),
|
|
3224
|
+
];
|
|
3204
3225
|
const result = await this.query([
|
|
3205
3226
|
{
|
|
3206
3227
|
operation: this.tableName,
|
|
@@ -3212,18 +3233,41 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3212
3233
|
: this.fields,
|
|
3213
3234
|
variables,
|
|
3214
3235
|
},
|
|
3215
|
-
...(
|
|
3236
|
+
...(aggregateFields.length > 0
|
|
3216
3237
|
? [
|
|
3217
3238
|
{
|
|
3218
3239
|
operation: `${this.tableName}_aggregate`,
|
|
3219
|
-
fields: [
|
|
3240
|
+
fields: [
|
|
3241
|
+
{
|
|
3242
|
+
aggregate: aggregateFields,
|
|
3243
|
+
},
|
|
3244
|
+
],
|
|
3220
3245
|
variables: variablesCount,
|
|
3221
3246
|
},
|
|
3222
3247
|
]
|
|
3223
3248
|
: []),
|
|
3224
3249
|
]);
|
|
3225
3250
|
const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
|
|
3226
|
-
return {
|
|
3251
|
+
return {
|
|
3252
|
+
data,
|
|
3253
|
+
count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity,
|
|
3254
|
+
...(options?.minimal?.length
|
|
3255
|
+
? {
|
|
3256
|
+
minimal: options.minimal.reduce((minimals, current) => ({
|
|
3257
|
+
...minimals,
|
|
3258
|
+
...set(minimals, current, result[`${this.tableName}_aggregate`].aggregate.min[AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)?.columnName || current]),
|
|
3259
|
+
}), {}),
|
|
3260
|
+
}
|
|
3261
|
+
: {}),
|
|
3262
|
+
...(options?.maximum?.length
|
|
3263
|
+
? {
|
|
3264
|
+
maximum: options.maximum.reduce((maximums, current) => ({
|
|
3265
|
+
...maximums,
|
|
3266
|
+
...set(maximums, current, result[`${this.tableName}_aggregate`].aggregate.max[AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)?.columnName || current]),
|
|
3267
|
+
}), {}),
|
|
3268
|
+
}
|
|
3269
|
+
: {}),
|
|
3270
|
+
};
|
|
3227
3271
|
}
|
|
3228
3272
|
};
|
|
3229
3273
|
};
|
|
@@ -3860,9 +3904,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3860
3904
|
whoMustUse: data.who_must_use,
|
|
3861
3905
|
howToUse: data.how_to_use,
|
|
3862
3906
|
brand: data.brand_description,
|
|
3907
|
+
ingredients: data.ingredients,
|
|
3863
3908
|
}),
|
|
3864
|
-
bindFindFilter: (
|
|
3865
|
-
const filters = Object.values(sentence).shift();
|
|
3909
|
+
bindFindFilter: (filters) => {
|
|
3866
3910
|
return {
|
|
3867
3911
|
...(filters?.description && { description: filters.description }),
|
|
3868
3912
|
...(filters.differentials && { differentials: filters.differentials }),
|
|
@@ -3875,6 +3919,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3875
3919
|
...(filters.brand && {
|
|
3876
3920
|
brand_description: filters.brand,
|
|
3877
3921
|
}),
|
|
3922
|
+
...(filters.ingredients && {
|
|
3923
|
+
ingredients: filters.ingredients,
|
|
3924
|
+
}),
|
|
3878
3925
|
};
|
|
3879
3926
|
},
|
|
3880
3927
|
bindPersistData: (descriptionData) => ({
|
|
@@ -3885,6 +3932,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3885
3932
|
}),
|
|
3886
3933
|
...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
|
|
3887
3934
|
...(descriptionData.brand && { brand_description: descriptionData.brand }),
|
|
3935
|
+
...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
|
|
3888
3936
|
}),
|
|
3889
3937
|
},
|
|
3890
3938
|
},
|
|
@@ -3892,6 +3940,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3892
3940
|
{ whoMustUse: { columnName: 'who_must_use' } },
|
|
3893
3941
|
{ howToUse: { columnName: 'how_to_use' } },
|
|
3894
3942
|
{ brandDescription: { columnName: 'brand_description' } },
|
|
3943
|
+
{ ingredients: { columnName: 'ingredients' } },
|
|
3895
3944
|
{ hasVariants: { columnName: 'has_variants' } },
|
|
3896
3945
|
{
|
|
3897
3946
|
images: {
|
|
@@ -3915,8 +3964,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3915
3964
|
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
3916
3965
|
subscriberPrice: data.subscriber_price,
|
|
3917
3966
|
}),
|
|
3918
|
-
bindFindFilter: (
|
|
3919
|
-
const filters = Object.values(sentence).shift();
|
|
3967
|
+
bindFindFilter: (filters) => {
|
|
3920
3968
|
return {
|
|
3921
3969
|
...((filters?.price || filters?.price === 0) && { price: filters.price }),
|
|
3922
3970
|
...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
|
|
@@ -4060,6 +4108,12 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4060
4108
|
this.fields
|
|
4061
4109
|
.map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
|
|
4062
4110
|
.filter((field) => field !== 'reviews');
|
|
4111
|
+
if (options.options?.minimal?.includes('price'))
|
|
4112
|
+
options.options?.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
|
|
4113
|
+
if (options.options?.maximum?.includes('price'))
|
|
4114
|
+
options.options?.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
|
|
4115
|
+
options.options?.minimal.splice(options.options?.minimal.indexOf('price'), 1);
|
|
4116
|
+
options.options?.maximum.splice(options.options?.maximum.indexOf('price'), 1);
|
|
4063
4117
|
return super.find({
|
|
4064
4118
|
...options,
|
|
4065
4119
|
filters: { ...filters, productId: { operator: Where.ISNULL } },
|
|
@@ -4418,5 +4472,5 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4418
4472
|
* Generated bundle index. Do not edit.
|
|
4419
4473
|
*/
|
|
4420
4474
|
|
|
4421
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, 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, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where,
|
|
4475
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, 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, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
4422
4476
|
//# sourceMappingURL=infrab4a-connect.mjs.map
|