@infrab4a/connect 4.3.2-beta.6 → 4.3.3
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 +38 -3
- package/index.esm.js +37 -6
- package/package.json +2 -2
- package/src/domain/users/models/subscription/enums/index.d.ts +1 -0
- package/src/domain/users/models/subscription/enums/plans.enum.d.ts +6 -0
- package/src/domain/users/models/subscription/index.d.ts +1 -0
- package/src/domain/users/models/subscription/subscription-summary.d.ts +10 -6
- package/src/domain/users/models/subscription/types/index.d.ts +1 -0
- package/src/domain/users/models/subscription/types/plan.type.d.ts +2 -0
- package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
- package/src/utils/index.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -480,6 +480,14 @@ exports.PaymentType = void 0;
|
|
|
480
480
|
PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
|
|
481
481
|
})(exports.PaymentType || (exports.PaymentType = {}));
|
|
482
482
|
|
|
483
|
+
exports.Plans = void 0;
|
|
484
|
+
(function (Plans) {
|
|
485
|
+
Plans["SELECT"] = "SELECT";
|
|
486
|
+
Plans["PRIME"] = "PRIME";
|
|
487
|
+
Plans["SELECT_MENSAL"] = "SELECT_MENSAL";
|
|
488
|
+
Plans["PRIME_MENSAL"] = "PRIME_MENSAL";
|
|
489
|
+
})(exports.Plans || (exports.Plans = {}));
|
|
490
|
+
|
|
483
491
|
exports.Status = void 0;
|
|
484
492
|
(function (Status) {
|
|
485
493
|
Status["ACTIVE"] = "active";
|
|
@@ -4315,10 +4323,11 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4315
4323
|
{
|
|
4316
4324
|
products: {
|
|
4317
4325
|
columnName: 'products',
|
|
4318
|
-
fields: ['product_id'],
|
|
4319
|
-
from: (value) => value.map((product) => product.product_id.toString()),
|
|
4320
|
-
to: (productIds) => productIds.map((productId) => ({
|
|
4326
|
+
fields: ['product_id', 'order'],
|
|
4327
|
+
from: (value) => lodash.sortBy(value, (row) => row.order).map((product) => product.product_id.toString()),
|
|
4328
|
+
to: (productIds) => productIds.map((productId, index) => ({
|
|
4321
4329
|
product_id: +productId,
|
|
4330
|
+
order: ++index,
|
|
4322
4331
|
})),
|
|
4323
4332
|
},
|
|
4324
4333
|
},
|
|
@@ -4503,6 +4512,28 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4503
4512
|
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4504
4513
|
},
|
|
4505
4514
|
});
|
|
4515
|
+
const productsOrder = products.map((product, index) => {
|
|
4516
|
+
return {
|
|
4517
|
+
id: product,
|
|
4518
|
+
order: index,
|
|
4519
|
+
};
|
|
4520
|
+
});
|
|
4521
|
+
const updateQueries = productsOrder.map((product) => ({
|
|
4522
|
+
where: {
|
|
4523
|
+
category_id: { _eq: category.id },
|
|
4524
|
+
product_id: { _eq: product.id },
|
|
4525
|
+
},
|
|
4526
|
+
_set: {
|
|
4527
|
+
order: product.order,
|
|
4528
|
+
},
|
|
4529
|
+
}));
|
|
4530
|
+
await this.mutation('update_category_product_many', ['affected_rows'], {
|
|
4531
|
+
updates: {
|
|
4532
|
+
value: updateQueries,
|
|
4533
|
+
type: '[category_product_updates!]',
|
|
4534
|
+
required: true,
|
|
4535
|
+
},
|
|
4536
|
+
});
|
|
4506
4537
|
return plainData.products;
|
|
4507
4538
|
}
|
|
4508
4539
|
async updateMetadata(categoryId, { metadata }) {
|
|
@@ -5647,6 +5678,10 @@ Object.defineProperty(exports, 'set', {
|
|
|
5647
5678
|
enumerable: true,
|
|
5648
5679
|
get: function () { return lodash.set; }
|
|
5649
5680
|
});
|
|
5681
|
+
Object.defineProperty(exports, 'sortBy', {
|
|
5682
|
+
enumerable: true,
|
|
5683
|
+
get: function () { return lodash.sortBy; }
|
|
5684
|
+
});
|
|
5650
5685
|
Object.defineProperty(exports, 'unset', {
|
|
5651
5686
|
enumerable: true,
|
|
5652
5687
|
get: function () { return lodash.unset; }
|
package/index.esm.js
CHANGED
|
@@ -3,8 +3,8 @@ import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __r
|
|
|
3
3
|
import { plainToInstance, instanceToPlain, Type, Expose } from 'class-transformer';
|
|
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
|
-
import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
7
|
-
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
|
|
6
|
+
import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, sortBy, omit } from 'lodash';
|
|
7
|
+
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
|
|
8
8
|
import { debug } from 'debug';
|
|
9
9
|
import { CustomError } from 'ts-custom-error';
|
|
10
10
|
import axios from 'axios';
|
|
@@ -474,6 +474,14 @@ var PaymentType;
|
|
|
474
474
|
PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
|
|
475
475
|
})(PaymentType || (PaymentType = {}));
|
|
476
476
|
|
|
477
|
+
var Plans;
|
|
478
|
+
(function (Plans) {
|
|
479
|
+
Plans["SELECT"] = "SELECT";
|
|
480
|
+
Plans["PRIME"] = "PRIME";
|
|
481
|
+
Plans["SELECT_MENSAL"] = "SELECT_MENSAL";
|
|
482
|
+
Plans["PRIME_MENSAL"] = "PRIME_MENSAL";
|
|
483
|
+
})(Plans || (Plans = {}));
|
|
484
|
+
|
|
477
485
|
var Status;
|
|
478
486
|
(function (Status) {
|
|
479
487
|
Status["ACTIVE"] = "active";
|
|
@@ -4309,10 +4317,11 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4309
4317
|
{
|
|
4310
4318
|
products: {
|
|
4311
4319
|
columnName: 'products',
|
|
4312
|
-
fields: ['product_id'],
|
|
4313
|
-
from: (value) => value.map((product) => product.product_id.toString()),
|
|
4314
|
-
to: (productIds) => productIds.map((productId) => ({
|
|
4320
|
+
fields: ['product_id', 'order'],
|
|
4321
|
+
from: (value) => sortBy(value, (row) => row.order).map((product) => product.product_id.toString()),
|
|
4322
|
+
to: (productIds) => productIds.map((productId, index) => ({
|
|
4315
4323
|
product_id: +productId,
|
|
4324
|
+
order: ++index,
|
|
4316
4325
|
})),
|
|
4317
4326
|
},
|
|
4318
4327
|
},
|
|
@@ -4497,6 +4506,28 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4497
4506
|
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4498
4507
|
},
|
|
4499
4508
|
});
|
|
4509
|
+
const productsOrder = products.map((product, index) => {
|
|
4510
|
+
return {
|
|
4511
|
+
id: product,
|
|
4512
|
+
order: index,
|
|
4513
|
+
};
|
|
4514
|
+
});
|
|
4515
|
+
const updateQueries = productsOrder.map((product) => ({
|
|
4516
|
+
where: {
|
|
4517
|
+
category_id: { _eq: category.id },
|
|
4518
|
+
product_id: { _eq: product.id },
|
|
4519
|
+
},
|
|
4520
|
+
_set: {
|
|
4521
|
+
order: product.order,
|
|
4522
|
+
},
|
|
4523
|
+
}));
|
|
4524
|
+
await this.mutation('update_category_product_many', ['affected_rows'], {
|
|
4525
|
+
updates: {
|
|
4526
|
+
value: updateQueries,
|
|
4527
|
+
type: '[category_product_updates!]',
|
|
4528
|
+
required: true,
|
|
4529
|
+
},
|
|
4530
|
+
});
|
|
4500
4531
|
return plainData.products;
|
|
4501
4532
|
}
|
|
4502
4533
|
async updateMetadata(categoryId, { metadata }) {
|
|
@@ -5533,4 +5564,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5533
5564
|
}
|
|
5534
5565
|
}
|
|
5535
5566
|
|
|
5536
|
-
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, 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, 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 };
|
|
5567
|
+
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, 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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infrab4a/connect",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
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": "^
|
|
16
|
+
"firebase": "^9.9.0",
|
|
17
17
|
"gql-query-builder": "3.7.0",
|
|
18
18
|
"lodash": "^4.17.21",
|
|
19
19
|
"reflect-metadata": "^0.1.13",
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { BaseModel, GenericIdentifier } from '../../../generic';
|
|
2
|
+
import { Plan } from './types';
|
|
2
3
|
export declare class SubscriptionSummary extends BaseModel<SubscriptionSummary> {
|
|
3
4
|
id: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
plans: {
|
|
6
|
+
[plan in Plan]: {
|
|
7
|
+
subsCreated: number;
|
|
8
|
+
subsWithPaymentError: number;
|
|
9
|
+
subWithDisabledRecurrency: number;
|
|
10
|
+
subsKept: number;
|
|
11
|
+
activeSubs: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
10
14
|
static get identifiersFields(): GenericIdentifier[];
|
|
11
15
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './plan.type';
|
|
@@ -5,7 +5,7 @@ import { FirestoreRepository, FirestoreSubRepository } from '../types';
|
|
|
5
5
|
export declare const withHelpers: <TMixinBase extends MixinCtor = MixinCtor>(MixinBase: MixinCtor & TMixinBase) => {
|
|
6
6
|
new (...args: any[]): {
|
|
7
7
|
[x: string]: any;
|
|
8
|
-
toArray<T extends ModelBaseStructure<T>>(snapShot: QuerySnapshot<T
|
|
8
|
+
toArray<T extends ModelBaseStructure<T>>(snapShot: QuerySnapshot<T> | QueryDocumentSnapshot<T>[]): T[];
|
|
9
9
|
isSubCollection<T_1 extends ModelBaseStructure<T_1>, E extends ModelBaseStructure<E>>(repository: FirestoreRepository<T_1> | FirestoreSubRepository<T_1, E>): repository is FirestoreSubRepository<T_1, E>;
|
|
10
10
|
};
|
|
11
11
|
} & TMixinBase;
|
package/src/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { add, addBusinessDays, addDays, addMonths, addYears, Duration, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
2
|
-
import { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
|
|
2
|
+
import { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
|
|
3
3
|
export type DateDuration = Duration;
|
|
4
4
|
export * from './decorators';
|
|
5
5
|
export * from './get';
|
|
@@ -10,4 +10,4 @@ export * from './log.utils';
|
|
|
10
10
|
export * from './mixins';
|
|
11
11
|
export * from './parse-datetime';
|
|
12
12
|
export * from './types';
|
|
13
|
-
export { add,
|
|
13
|
+
export { add, addBusinessDays, addDays, addMonths, addYears, chunk, each, endOfDay, format, formatISO9075, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, parseISO, pick, set, sortBy, startOfDay, sub, unset, };
|