@purpleschool/gptbot 0.5.8 → 0.5.14
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/api/controllers/index.ts +11 -8
- package/api/controllers/payment.ts +5 -0
- package/api/controllers/referral.ts +5 -0
- package/api/controllers/subscription.ts +3 -0
- package/build/api/controllers/index.js +11 -8
- package/build/api/controllers/payment.js +7 -0
- package/build/api/controllers/referral.js +7 -0
- package/build/api/controllers/subscription.js +3 -0
- package/build/commands/ai-model/index.js +2 -2
- package/build/commands/auth/index.js +4 -3
- package/build/commands/auth/register-user.command.js +3 -4
- package/build/commands/blog/index.js +2 -2
- package/build/commands/category/index.js +2 -2
- package/build/commands/chat/index.js +9 -8
- package/build/commands/index.js +8 -6
- package/build/commands/message/index.js +1 -1
- package/build/commands/page/index.js +3 -3
- package/build/commands/payment/get-payment-history.command.js +11 -0
- package/build/commands/payment/index.js +18 -0
- package/build/commands/product/buy-product.command.js +1 -0
- package/build/commands/product/index.js +3 -3
- package/build/commands/question/index.js +2 -2
- package/build/commands/referral/get-by-bonuses.command.js +15 -0
- package/build/commands/referral/index.js +17 -0
- package/build/commands/subscription/buy-subscription.command.js +1 -0
- package/build/commands/subscription/create-custom-subscription-plan.command.js +24 -0
- package/build/commands/subscription/find-subscription.command.js +1 -1
- package/build/commands/subscription/get-available-upgrades.command.js +13 -0
- package/build/commands/subscription/index.js +7 -3
- package/build/commands/subscription/upgrade-subscription.command.js +41 -0
- package/build/commands/user/index.js +1 -1
- package/build/constants/category/enums/index.js +1 -1
- package/build/constants/chat/enums/index.js +1 -1
- package/build/constants/domains/index.js +17 -0
- package/build/constants/email/index.js +18 -0
- package/build/constants/errors/errors.js +65 -0
- package/build/constants/index.js +13 -7
- package/build/constants/order/enums/index.js +1 -0
- package/build/constants/order/enums/order-type.enum.js +8 -0
- package/build/constants/payment/enums/index.js +1 -0
- package/build/constants/payment/enums/payment-history-item-type.enum.js +8 -0
- package/build/constants/referral/enums/index.js +17 -0
- package/build/constants/referral/enums/referral-bonus-type.enum.js +8 -0
- package/build/constants/referral/index.js +17 -0
- package/build/constants/subscription/enums/index.js +4 -0
- package/build/constants/subscription/enums/subscription-action.enum.js +10 -0
- package/build/constants/subscription/enums/subscription-plan.enum.js +8 -0
- package/build/constants/subscription/enums/subscription-status.enum.js +1 -0
- package/build/constants/subscription/enums/subscription-type.enum.js +8 -0
- package/build/constants/subscription/enums/user-to-subscription-type.enum.js +8 -0
- package/build/constants/transaction/enums/index.js +17 -0
- package/build/constants/transaction/enums/user-balance-status.enum.js +1 -0
- package/build/constants/transaction/index.js +17 -0
- package/build/constants/user/enums/index.js +17 -0
- package/build/constants/user/index.js +18 -0
- package/build/helpers/index.js +17 -0
- package/build/helpers/subscription/calc-custom-subscription-price.helper.js +19 -0
- package/build/helpers/subscription/index.js +17 -0
- package/build/index.js +3 -2
- package/build/models/index.js +11 -7
- package/build/models/message.schema.js +1 -1
- package/build/models/payment-history-item.schema.js +14 -0
- package/build/models/referral-bonus.schema.js +19 -0
- package/build/models/subscription-upgrade-schema.js +8 -0
- package/build/models/subscription.schema.js +14 -2
- package/build/models/user-to-subscription.schema.js +1 -0
- package/commands/ai-model/index.ts +2 -2
- package/commands/auth/index.ts +4 -3
- package/commands/auth/register-user.command.ts +6 -4
- package/commands/blog/index.ts +2 -2
- package/commands/category/index.ts +2 -2
- package/commands/chat/index.ts +9 -8
- package/commands/index.ts +8 -6
- package/commands/message/index.ts +1 -1
- package/commands/page/index.ts +3 -3
- package/commands/payment/get-payment-history.command.ts +10 -0
- package/commands/payment/index.ts +2 -0
- package/commands/product/buy-product.command.ts +1 -0
- package/commands/product/index.ts +3 -3
- package/commands/question/index.ts +2 -2
- package/commands/referral/get-by-bonuses.command.ts +14 -0
- package/commands/referral/index.ts +1 -0
- package/commands/subscription/buy-subscription.command.ts +1 -0
- package/commands/subscription/create-custom-subscription-plan.command.ts +26 -0
- package/commands/subscription/find-subscription.command.ts +2 -2
- package/commands/subscription/get-available-upgrades.command.ts +15 -0
- package/commands/subscription/index.ts +7 -3
- package/commands/subscription/upgrade-subscription.command.ts +46 -0
- package/commands/user/index.ts +1 -1
- package/constants/category/enums/index.ts +1 -1
- package/constants/chat/enums/index.ts +1 -1
- package/constants/domains/index.ts +1 -0
- package/constants/email/index.ts +2 -0
- package/constants/errors/errors.ts +65 -0
- package/constants/index.ts +13 -7
- package/constants/order/enums/index.ts +1 -0
- package/constants/order/enums/order-type.enum.ts +4 -0
- package/constants/payment/enums/index.ts +1 -0
- package/constants/payment/enums/payment-history-item-type.enum.ts +4 -0
- package/constants/referral/enums/index.ts +1 -0
- package/constants/referral/enums/referral-bonus-type.enum.ts +4 -0
- package/constants/referral/index.ts +1 -0
- package/constants/subscription/enums/index.ts +4 -0
- package/constants/subscription/enums/subscription-action.enum.ts +6 -0
- package/constants/subscription/enums/subscription-plan.enum.ts +4 -0
- package/constants/subscription/enums/subscription-status.enum.ts +1 -0
- package/constants/subscription/enums/subscription-type.enum.ts +4 -0
- package/constants/subscription/enums/user-to-subscription-type.enum.ts +4 -0
- package/constants/transaction/enums/index.ts +2 -0
- package/constants/transaction/enums/user-balance-status.enum.ts +1 -0
- package/constants/transaction/index.ts +1 -0
- package/constants/user/enums/index.ts +1 -0
- package/constants/user/index.ts +2 -0
- package/helpers/index.ts +1 -0
- package/helpers/subscription/calc-custom-subscription-price.helper.ts +19 -0
- package/helpers/subscription/index.ts +1 -0
- package/index.ts +3 -2
- package/models/index.ts +11 -7
- package/models/message.schema.ts +1 -1
- package/models/payment-history-item.schema.ts +12 -0
- package/models/referral-bonus.schema.ts +18 -0
- package/models/subscription-upgrade-schema.ts +9 -0
- package/models/subscription.schema.ts +21 -1
- package/models/user-to-subscription.schema.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace CreateCustomSubscriptionPlanCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
tokens: z
|
|
7
|
+
.number()
|
|
8
|
+
.refine((val) => val % 500 === 0, {
|
|
9
|
+
message: 'tokens must be a multiple of 500',
|
|
10
|
+
})
|
|
11
|
+
.refine((val) => val > 1000, {
|
|
12
|
+
message: 'tokens must be greater than 1000',
|
|
13
|
+
})
|
|
14
|
+
.refine((val) => val <= 10000, {
|
|
15
|
+
message: 'tokens must be equal or less than 10000',
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
20
|
+
|
|
21
|
+
export const ResponseSchema = z.object({
|
|
22
|
+
data: SubscriptionSchema,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
26
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { SubscriptionSchema } from '../../models';
|
|
2
|
+
import { SubscriptionSchema, SubscriptionWithSubTypesSchema } from '../../models';
|
|
3
3
|
|
|
4
4
|
export namespace FindSubscriptionCommand {
|
|
5
5
|
export const RequestSchema = SubscriptionSchema.pick({
|
|
@@ -9,7 +9,7 @@ export namespace FindSubscriptionCommand {
|
|
|
9
9
|
export type Request = z.infer<typeof RequestSchema>;
|
|
10
10
|
|
|
11
11
|
export const ResponseSchema = z.object({
|
|
12
|
-
data: z.array(
|
|
12
|
+
data: z.array(SubscriptionWithSubTypesSchema),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from '../../models';
|
|
3
|
+
import { SubscriptionUpgradeSchema } from '../../models/subscription-upgrade-schema';
|
|
4
|
+
|
|
5
|
+
export namespace GetAvailableUpgradesCommand {
|
|
6
|
+
export const RequestSchema = SubscriptionSchema.pick({});
|
|
7
|
+
|
|
8
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: z.array(SubscriptionUpgradeSchema),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './buy-subscription.command';
|
|
2
|
+
export * from './cancel-subscription.command';
|
|
3
|
+
export * from './create-custom-subscription-plan.command';
|
|
3
4
|
export * from './create-subscription.command';
|
|
5
|
+
export * from './delete-subscription.command';
|
|
4
6
|
export * from './find-subscription.command';
|
|
5
|
-
export * from './
|
|
7
|
+
export * from './get-available-upgrades.command';
|
|
6
8
|
export * from './recover-subscription.command';
|
|
9
|
+
export * from './update-subscription.command';
|
|
10
|
+
export * from './upgrade-subscription.command';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UpgradeSubscriptionCommand {
|
|
5
|
+
export const RequestSchema = SubscriptionSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
const IReceiptOrderSchema = z.object({
|
|
12
|
+
items: z.array(
|
|
13
|
+
z.object({
|
|
14
|
+
label: z.string(),
|
|
15
|
+
price: z.number(),
|
|
16
|
+
quantity: z.number(),
|
|
17
|
+
amount: z.number(),
|
|
18
|
+
vat: z.number(),
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
email: z.string(),
|
|
22
|
+
isBso: z.boolean(),
|
|
23
|
+
amounts: z.object({
|
|
24
|
+
electronic: z.number(),
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const ResponseSchema = z.object({
|
|
29
|
+
publicId: z.string(),
|
|
30
|
+
amount: z.number(),
|
|
31
|
+
currency: z.string(),
|
|
32
|
+
accountId: z.string(),
|
|
33
|
+
description: z.string(),
|
|
34
|
+
invoiceId: z.string(),
|
|
35
|
+
email: z.string(),
|
|
36
|
+
skin: z.string(),
|
|
37
|
+
autoClose: z.number(),
|
|
38
|
+
data: z.object({
|
|
39
|
+
CloudPayments: z.object({
|
|
40
|
+
CustomerReceipt: IReceiptOrderSchema,
|
|
41
|
+
}),
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
46
|
+
}
|
package/commands/user/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './white-list';
|
|
@@ -515,4 +515,69 @@ export const ERRORS = {
|
|
|
515
515
|
message: 'Электронная почта уже подтверждена',
|
|
516
516
|
httpCode: 400,
|
|
517
517
|
},
|
|
518
|
+
GET_UNREGISTERED_SESSION_ERROR: {
|
|
519
|
+
code: 'A117',
|
|
520
|
+
message: 'Не удалось получить сессию с данным идентификатором',
|
|
521
|
+
httpCode: 500,
|
|
522
|
+
},
|
|
523
|
+
UNREGISTERED_USER_LIMIT_UPDATE_ERROR: {
|
|
524
|
+
code: 'A118',
|
|
525
|
+
message: 'Не удалось обновить баланс пользователя',
|
|
526
|
+
httpCode: 500,
|
|
527
|
+
},
|
|
528
|
+
PAYMENT_HISTORY_ERROR: {
|
|
529
|
+
code: 'A119',
|
|
530
|
+
message: 'Не удалось получить историю платежей',
|
|
531
|
+
httpCode: 500,
|
|
532
|
+
},
|
|
533
|
+
SUBSCRIPTION_GET_UPGRADES_ERROR: {
|
|
534
|
+
code: 'A120',
|
|
535
|
+
message: 'Не удалось получить информацию о возможных улучшениях для подписки',
|
|
536
|
+
httpCode: 500,
|
|
537
|
+
},
|
|
538
|
+
SUBSCRIPTION_UPGRADE_ERROR: {
|
|
539
|
+
code: 'A121',
|
|
540
|
+
message: 'Не удалось улучшить подписку',
|
|
541
|
+
httpCode: 500,
|
|
542
|
+
},
|
|
543
|
+
RECURRENT_UPDATE_ERROR: {
|
|
544
|
+
code: 'A122',
|
|
545
|
+
message: 'Не удалось изменить данные подписки',
|
|
546
|
+
httpCode: 500,
|
|
547
|
+
},
|
|
548
|
+
ALREADY_HAS_SUBSCRIPTION: {
|
|
549
|
+
code: 'A123',
|
|
550
|
+
message: 'На данной учетной записи уже есть подписка',
|
|
551
|
+
httpCode: 409,
|
|
552
|
+
},
|
|
553
|
+
SUBSCRIPTION_UPGRADE_INVALID: {
|
|
554
|
+
code: 'A124',
|
|
555
|
+
message: 'Невозможно улучшить подписку с данными параметрами',
|
|
556
|
+
httpCode: 400,
|
|
557
|
+
},
|
|
558
|
+
PARTNER_NOT_FOUND: {
|
|
559
|
+
code: 'A125',
|
|
560
|
+
message: 'Не удалось найти партнера по реферальной программе',
|
|
561
|
+
httpCode: 404,
|
|
562
|
+
},
|
|
563
|
+
REFERRAL_BONUSES_NOT_FOUND: {
|
|
564
|
+
code: 'A126',
|
|
565
|
+
message: 'Не удалось найти бонусы по реферальной программе',
|
|
566
|
+
httpCode: 404,
|
|
567
|
+
},
|
|
568
|
+
REFERRAL_BONUS_UPDATE_ERROR: {
|
|
569
|
+
code: 'A127',
|
|
570
|
+
message: 'Не удалось обновить бонусы по реферальной программе',
|
|
571
|
+
httpCode: 500,
|
|
572
|
+
},
|
|
573
|
+
REFERRAL_BONUS_STATS_ERROR: {
|
|
574
|
+
code: 'A128',
|
|
575
|
+
message: 'Не удалось получить статистику по бонусам по реферальной программе',
|
|
576
|
+
httpCode: 500,
|
|
577
|
+
},
|
|
578
|
+
REFERRAL_BONUS_APPLY_ERROR: {
|
|
579
|
+
code: 'A129',
|
|
580
|
+
message: 'Не удалось применить бонусы по реферальной программе',
|
|
581
|
+
httpCode: 500,
|
|
582
|
+
},
|
|
518
583
|
};
|
package/constants/index.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
export * from './ai-model';
|
|
2
|
+
export * from './category';
|
|
3
|
+
export * from './chat';
|
|
4
|
+
export * from './cloud-payments';
|
|
5
|
+
export * from './domains';
|
|
6
|
+
export * from './email';
|
|
1
7
|
export * from './errors';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './payment';
|
|
8
|
+
export * from './message';
|
|
4
9
|
export * from './order';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './subscription';
|
|
10
|
+
export * from './payment';
|
|
7
11
|
export * from './product';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
12
|
+
export * from './referral';
|
|
13
|
+
export * from './roles';
|
|
14
|
+
export * from './subscription';
|
|
15
|
+
export * from './transaction';
|
|
16
|
+
export * from './user';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './referral-bonus-type.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './user-status';
|
package/helpers/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './subscription';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function calcCustomSubscriptionPrice(tokenCount: number, period: number) {
|
|
2
|
+
const MIN_TOKEN_COUNT = 1000;
|
|
3
|
+
const MAX_DISCOUNT = 0.85;
|
|
4
|
+
const DISCOUNT_PER_STEP = 0.005;
|
|
5
|
+
const STEP = 500;
|
|
6
|
+
const BASE_PRICE = 0.95;
|
|
7
|
+
|
|
8
|
+
if (tokenCount < 0) {
|
|
9
|
+
throw new Error('Token count must be a non-negative integer');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (tokenCount < MIN_TOKEN_COUNT) {
|
|
13
|
+
throw new Error(`Token count must be at least ${MIN_TOKEN_COUNT}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const discount = Math.max(0, (tokenCount - MIN_TOKEN_COUNT) / STEP) * DISCOUNT_PER_STEP;
|
|
17
|
+
const priceMultiplier = Math.max(BASE_PRICE - discount, MAX_DISCOUNT);
|
|
18
|
+
return Math.round(tokenCount * priceMultiplier * period);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calc-custom-subscription-price.helper';
|
package/index.ts
CHANGED
package/models/index.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './page.schema';
|
|
1
|
+
export * from './ai-model.schema';
|
|
3
2
|
export * from './category.schema';
|
|
4
|
-
export * from './question.schema';
|
|
5
|
-
export * from './unregistered-user.schema';
|
|
6
3
|
export * from './chat.schema';
|
|
7
4
|
export * from './message.schema';
|
|
8
|
-
export * from './ai-model.schema';
|
|
9
|
-
export * from './product.schema';
|
|
10
|
-
export * from './subscription.schema';
|
|
11
5
|
export * from './order.schema';
|
|
6
|
+
export * from './page.schema';
|
|
7
|
+
export * from './payment-history-item.schema';
|
|
8
|
+
export * from './payment.schema';
|
|
12
9
|
export * from './post.schema';
|
|
10
|
+
export * from './product.schema';
|
|
11
|
+
export * from './question.schema';
|
|
12
|
+
export * from './referral-bonus.schema';
|
|
13
|
+
export * from './subscription-upgrade-schema';
|
|
14
|
+
export * from './subscription.schema';
|
|
15
|
+
export * from './unregistered-user.schema';
|
|
13
16
|
export * from './user-to-subscription.schema';
|
|
17
|
+
export * from './user.schema';
|
package/models/message.schema.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PAYMENT_HISTORY_ITEM_TYPE, PAYMENT_STATUS } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const PaymentHistoryItemSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
status: z.nativeEnum(PAYMENT_STATUS),
|
|
7
|
+
sum: z.number(),
|
|
8
|
+
description: z.string(),
|
|
9
|
+
type: z.nativeEnum(PAYMENT_HISTORY_ITEM_TYPE),
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ReferralBonusType } from '../constants/referral';
|
|
3
|
+
|
|
4
|
+
export const ReferralBonusSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
partnerId: z.string().uuid(),
|
|
7
|
+
referralId: z.string().uuid(),
|
|
8
|
+
initial: z.number(),
|
|
9
|
+
total: z.number(),
|
|
10
|
+
type: z.nativeEnum(ReferralBonusType),
|
|
11
|
+
createdAt: z.date(),
|
|
12
|
+
updatedAt: z.date(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const ReferralBonusStatisticsSchema = z.object({
|
|
16
|
+
initial: z.number(),
|
|
17
|
+
weekStart: z.date(),
|
|
18
|
+
});
|
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { FeaturesSchema } from './product.schema';
|
|
3
|
+
import { SUBSCRIPTION_ACTION, SUBSCRIPTION_PLAN, SUBSCRIPTION_TYPE } from '../constants';
|
|
3
4
|
|
|
4
5
|
export const SubscriptionSchema = z.object({
|
|
5
6
|
uuid: z.string().uuid(),
|
|
7
|
+
mainSubscriptionId: z.nullable(z.string().uuid()),
|
|
6
8
|
name: z.string().min(3).max(16384),
|
|
7
9
|
requests: z.number(),
|
|
8
10
|
price: z.number(),
|
|
9
11
|
features: z.array(FeaturesSchema),
|
|
10
|
-
|
|
12
|
+
plan: z.nativeEnum(SUBSCRIPTION_PLAN),
|
|
13
|
+
type: z.nativeEnum(SUBSCRIPTION_TYPE),
|
|
14
|
+
discount: z.number(),
|
|
15
|
+
period: z.number(),
|
|
16
|
+
tokens: z.number(),
|
|
11
17
|
createdAt: z.date(),
|
|
12
18
|
updatedAt: z.date(),
|
|
13
19
|
});
|
|
20
|
+
|
|
21
|
+
export const SubscriptionWithActionSchema = z.intersection(
|
|
22
|
+
SubscriptionSchema,
|
|
23
|
+
z.object({
|
|
24
|
+
action: z.nativeEnum(SUBSCRIPTION_ACTION),
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const SubscriptionWithSubTypesSchema = z.intersection(
|
|
29
|
+
SubscriptionWithActionSchema,
|
|
30
|
+
z.object({
|
|
31
|
+
subTypes: z.array(SubscriptionWithActionSchema),
|
|
32
|
+
}),
|
|
33
|
+
);
|