@purpleschool/gptbot 0.5.45 → 0.5.47
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/http/ai-model.ts +1 -0
- package/api/controllers/http/index.ts +1 -0
- package/api/controllers/http/telegram-auth.ts +7 -0
- package/api/routes.ts +11 -0
- package/build/api/controllers/http/ai-model.js +1 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/controllers/http/telegram-auth.js +9 -0
- package/build/api/routes.js +8 -0
- package/build/commands/ai-model/find-ai-models-available-to-user.comand.js +12 -0
- package/build/commands/ai-model/index.js +1 -0
- package/build/commands/index.js +1 -0
- package/build/commands/telegram-auth/create-telegram-auth-link.command.js +13 -0
- package/build/commands/telegram-auth/get-telegram-auth-session-status.command.js +18 -0
- package/build/commands/telegram-auth/index.js +19 -0
- package/build/commands/telegram-auth/redeem-telegram-auth-session.command.js +15 -0
- package/build/constants/errors/errors.js +42 -2
- package/build/constants/subscription/enums/index.js +1 -0
- package/build/constants/subscription/enums/subscription-feature-type.enum.js +10 -0
- package/build/constants/telegram/index.js +1 -0
- package/build/constants/telegram/telegram-auth/enums/index.js +17 -0
- package/build/constants/telegram/telegram-auth/enums/telegram-auth-status.enum.js +10 -0
- package/build/constants/telegram/telegram-auth/index.js +17 -0
- package/build/models/ai-model.schema.js +2 -0
- package/build/models/index.js +1 -0
- package/build/models/product.schema.js +3 -1
- package/build/models/subscription-feature.schema.js +35 -0
- package/build/models/subscription.schema.js +10 -5
- package/commands/ai-model/find-ai-models-available-to-user.comand.ts +12 -0
- package/commands/ai-model/index.ts +1 -0
- package/commands/index.ts +1 -0
- package/commands/telegram-auth/create-telegram-auth-link.command.ts +11 -0
- package/commands/telegram-auth/get-telegram-auth-session-status.command.ts +19 -0
- package/commands/telegram-auth/index.ts +3 -0
- package/commands/telegram-auth/redeem-telegram-auth-session.command.ts +16 -0
- package/constants/errors/errors.ts +43 -2
- package/constants/subscription/enums/index.ts +1 -0
- package/constants/subscription/enums/subscription-feature-type.enum.ts +6 -0
- package/constants/telegram/index.ts +1 -0
- package/constants/telegram/telegram-auth/enums/index.ts +1 -0
- package/constants/telegram/telegram-auth/enums/telegram-auth-status.enum.ts +6 -0
- package/constants/telegram/telegram-auth/index.ts +1 -0
- package/models/ai-model.schema.ts +2 -0
- package/models/index.ts +1 -0
- package/models/product.schema.ts +3 -1
- package/models/subscription-feature.schema.ts +39 -0
- package/models/subscription.schema.ts +10 -4
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export * from './product';
|
|
|
18
18
|
export * from './question';
|
|
19
19
|
export * from './subscription';
|
|
20
20
|
export * from './task';
|
|
21
|
+
export * from './telegram-auth';
|
|
21
22
|
export * from './telegram-connect';
|
|
22
23
|
export * from './telegram-profile';
|
|
23
24
|
export * from './unregistered-user';
|
package/api/routes.ts
CHANGED
|
@@ -121,6 +121,11 @@ export const REST_API = {
|
|
|
121
121
|
PATCH: (uuid: string) => `${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}`,
|
|
122
122
|
DELETE: (uuid: string) => `${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}`,
|
|
123
123
|
CREATE: `${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}`,
|
|
124
|
+
UPGRADE: (uuid: string) =>
|
|
125
|
+
`${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}/${CONTROLLERS.SUBSCRIPTION_ROUTES.UPGRADE}`,
|
|
126
|
+
GET_AVAILABLE_UPGRADES: (uuid: string) =>
|
|
127
|
+
`${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}/${CONTROLLERS.SUBSCRIPTION_ROUTES.GET_AVAILABLE_UPGRADES}`,
|
|
128
|
+
CREATE_CUSTOM: `${ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.CREATE_CUSTOM}`,
|
|
124
129
|
},
|
|
125
130
|
FILES: {
|
|
126
131
|
UPLOAD_FILE: `${ROOT}/${CONTROLLERS.FILE_CONTROLLER}/${CONTROLLERS.FILE_ROUTES.UPLOAD_FILE}`,
|
|
@@ -165,4 +170,10 @@ export const REST_API = {
|
|
|
165
170
|
VALIDATE_PUBLIC: (code: string) =>
|
|
166
171
|
`${ROOT}/${CONTROLLERS.PROMOCODE_PUBLIC_CONTROLLER}/${CONTROLLERS.PROMOCODE_ROUTES.VALIDATE}/${code}`,
|
|
167
172
|
},
|
|
173
|
+
TELEGRAM_AUTH: {
|
|
174
|
+
CREATE_SESSION: `${ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}`,
|
|
175
|
+
STATUS: (uuid: string) =>
|
|
176
|
+
`${ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}/${CONTROLLERS.TELEGRAM_AUTH_ROUTES.STATUS(uuid)}`,
|
|
177
|
+
REDEEM: `${ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}/${CONTROLLERS.TELEGRAM_AUTH_ROUTES.REDEEM}`,
|
|
178
|
+
},
|
|
168
179
|
} as const;
|
|
@@ -34,6 +34,7 @@ __exportStar(require("./product"), exports);
|
|
|
34
34
|
__exportStar(require("./question"), exports);
|
|
35
35
|
__exportStar(require("./subscription"), exports);
|
|
36
36
|
__exportStar(require("./task"), exports);
|
|
37
|
+
__exportStar(require("./telegram-auth"), exports);
|
|
37
38
|
__exportStar(require("./telegram-connect"), exports);
|
|
38
39
|
__exportStar(require("./telegram-profile"), exports);
|
|
39
40
|
__exportStar(require("./unregistered-user"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TELEGRAM_AUTH_ROUTES = exports.TELEGRAM_AUTH_CONTROLLER = void 0;
|
|
4
|
+
exports.TELEGRAM_AUTH_CONTROLLER = 'telegram-auth';
|
|
5
|
+
exports.TELEGRAM_AUTH_ROUTES = {
|
|
6
|
+
CREATE_SESSION: '',
|
|
7
|
+
STATUS: (uuid) => `${uuid}/status`,
|
|
8
|
+
REDEEM: 'redeem',
|
|
9
|
+
};
|
package/build/api/routes.js
CHANGED
|
@@ -136,6 +136,9 @@ exports.REST_API = {
|
|
|
136
136
|
PATCH: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}`,
|
|
137
137
|
DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}`,
|
|
138
138
|
CREATE: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}`,
|
|
139
|
+
UPGRADE: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}/${CONTROLLERS.SUBSCRIPTION_ROUTES.UPGRADE}`,
|
|
140
|
+
GET_AVAILABLE_UPGRADES: (uuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${uuid}/${CONTROLLERS.SUBSCRIPTION_ROUTES.GET_AVAILABLE_UPGRADES}`,
|
|
141
|
+
CREATE_CUSTOM: `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_PRIVATE_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.CREATE_CUSTOM}`,
|
|
139
142
|
},
|
|
140
143
|
FILES: {
|
|
141
144
|
UPLOAD_FILE: `${exports.ROOT}/${CONTROLLERS.FILE_CONTROLLER}/${CONTROLLERS.FILE_ROUTES.UPLOAD_FILE}`,
|
|
@@ -170,4 +173,9 @@ exports.REST_API = {
|
|
|
170
173
|
VALIDATE_PRIVATE: (code) => `${exports.ROOT}/${CONTROLLERS.PROMOCODE_PRIVATE_CONTROLLER}/${CONTROLLERS.PROMOCODE_ROUTES.VALIDATE}/${code}`,
|
|
171
174
|
VALIDATE_PUBLIC: (code) => `${exports.ROOT}/${CONTROLLERS.PROMOCODE_PUBLIC_CONTROLLER}/${CONTROLLERS.PROMOCODE_ROUTES.VALIDATE}/${code}`,
|
|
172
175
|
},
|
|
176
|
+
TELEGRAM_AUTH: {
|
|
177
|
+
CREATE_SESSION: `${exports.ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}`,
|
|
178
|
+
STATUS: (uuid) => `${exports.ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}/${CONTROLLERS.TELEGRAM_AUTH_ROUTES.STATUS(uuid)}`,
|
|
179
|
+
REDEEM: `${exports.ROOT}/${CONTROLLERS.TELEGRAM_AUTH_CONTROLLER}/${CONTROLLERS.TELEGRAM_AUTH_ROUTES.REDEEM}`,
|
|
180
|
+
},
|
|
173
181
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindAiModelsAvailableToUserCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var FindAiModelsAvailableToUserCommand;
|
|
7
|
+
(function (FindAiModelsAvailableToUserCommand) {
|
|
8
|
+
FindAiModelsAvailableToUserCommand.RequestSchema = zod_1.z.void();
|
|
9
|
+
FindAiModelsAvailableToUserCommand.ResponseSchema = zod_1.z.object({
|
|
10
|
+
data: zod_1.z.array(models_1.AiModelSchema),
|
|
11
|
+
});
|
|
12
|
+
})(FindAiModelsAvailableToUserCommand || (exports.FindAiModelsAvailableToUserCommand = FindAiModelsAvailableToUserCommand = {}));
|
|
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./create-ai-model.command"), exports);
|
|
18
18
|
__exportStar(require("./delete-ai-model.command"), exports);
|
|
19
19
|
__exportStar(require("./find-ai-model.command"), exports);
|
|
20
|
+
__exportStar(require("./find-ai-models-available-to-user.comand"), exports);
|
|
20
21
|
__exportStar(require("./find-formatted-ai-model.command"), exports);
|
|
21
22
|
__exportStar(require("./update-ai-model.command"), exports);
|
package/build/commands/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __exportStar(require("./referral"), exports);
|
|
|
33
33
|
__exportStar(require("./subscription"), exports);
|
|
34
34
|
__exportStar(require("./task"), exports);
|
|
35
35
|
__exportStar(require("./telegram"), exports);
|
|
36
|
+
__exportStar(require("./telegram-auth"), exports);
|
|
36
37
|
__exportStar(require("./telegram-profile"), exports);
|
|
37
38
|
__exportStar(require("./unregistered-user"), exports);
|
|
38
39
|
__exportStar(require("./user"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateTelegramAuthLinkCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var CreateTelegramAuthLinkCommand;
|
|
6
|
+
(function (CreateTelegramAuthLinkCommand) {
|
|
7
|
+
CreateTelegramAuthLinkCommand.ResponseSchema = zod_1.z.object({
|
|
8
|
+
data: zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
link: zod_1.z.string(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
})(CreateTelegramAuthLinkCommand || (exports.CreateTelegramAuthLinkCommand = CreateTelegramAuthLinkCommand = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetTelegramAuthSessionStatusCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var GetTelegramAuthSessionStatusCommand;
|
|
7
|
+
(function (GetTelegramAuthSessionStatusCommand) {
|
|
8
|
+
GetTelegramAuthSessionStatusCommand.RequestParamsSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
});
|
|
11
|
+
GetTelegramAuthSessionStatusCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: zod_1.z.object({
|
|
13
|
+
uuid: zod_1.z.string().uuid(),
|
|
14
|
+
status: zod_1.z.nativeEnum(constants_1.TELEGRAM_AUTH_STATUS),
|
|
15
|
+
expiresAt: zod_1.z.date(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
})(GetTelegramAuthSessionStatusCommand || (exports.GetTelegramAuthSessionStatusCommand = GetTelegramAuthSessionStatusCommand = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-telegram-auth-link.command"), exports);
|
|
18
|
+
__exportStar(require("./get-telegram-auth-session-status.command"), exports);
|
|
19
|
+
__exportStar(require("./redeem-telegram-auth-session.command"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RedeemTelegramAuthSessionCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var RedeemTelegramAuthSessionCommand;
|
|
6
|
+
(function (RedeemTelegramAuthSessionCommand) {
|
|
7
|
+
RedeemTelegramAuthSessionCommand.RequestSchema = zod_1.z.object({
|
|
8
|
+
uuid: zod_1.z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
RedeemTelegramAuthSessionCommand.ResponseSchema = zod_1.z.object({
|
|
11
|
+
data: zod_1.z.object({
|
|
12
|
+
accessToken: zod_1.z.string(),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
})(RedeemTelegramAuthSessionCommand || (exports.RedeemTelegramAuthSessionCommand = RedeemTelegramAuthSessionCommand = {}));
|
|
@@ -870,9 +870,9 @@ exports.ERRORS = {
|
|
|
870
870
|
message: 'Превышено максимальное количество прикрепленных файлов',
|
|
871
871
|
httpCode: 400,
|
|
872
872
|
},
|
|
873
|
-
|
|
873
|
+
AI_MODEL_USER_HAS_NO_ACCESS: {
|
|
874
874
|
code: 'A199',
|
|
875
|
-
message: 'У пользователя нет доступа к
|
|
875
|
+
message: 'У пользователя нет доступа к данной ИИ модели',
|
|
876
876
|
httpCode: 400,
|
|
877
877
|
},
|
|
878
878
|
CHAT_TRANSFER_ERROR: {
|
|
@@ -915,4 +915,44 @@ exports.ERRORS = {
|
|
|
915
915
|
message: 'Промокод не провалидирован',
|
|
916
916
|
httpCode: 500,
|
|
917
917
|
},
|
|
918
|
+
TELEGRAM_AUTH_CODE_CREATE_ERROR: {
|
|
919
|
+
code: 'A209',
|
|
920
|
+
message: 'Произошла ошибка при создании ссылки для авторизации через Telegram',
|
|
921
|
+
httpCode: 500,
|
|
922
|
+
},
|
|
923
|
+
TELEGRAM_AUTH_CODE_INVALID: {
|
|
924
|
+
code: 'A210',
|
|
925
|
+
message: 'Ссылка для авторизации через Telegram недействительна или устарела',
|
|
926
|
+
httpCode: 400,
|
|
927
|
+
},
|
|
928
|
+
TELEGRAM_AUTH_SESSION_UPDATE_ERROR: {
|
|
929
|
+
code: 'A211',
|
|
930
|
+
message: 'Произошла ошибка при обновлении сессии авторизации через Telegram',
|
|
931
|
+
httpCode: 500,
|
|
932
|
+
},
|
|
933
|
+
TELEGRAM_AUTH_CODE_ALREADY_USED: {
|
|
934
|
+
code: 'A212',
|
|
935
|
+
message: 'Ссылка для авторизации через телеграм уже была использована',
|
|
936
|
+
httpCode: 400,
|
|
937
|
+
},
|
|
938
|
+
AI_MODEL_MAX_INPUT_LENGTH_EXCEEDED: {
|
|
939
|
+
code: 'A213',
|
|
940
|
+
message: 'Превышено максимальное количество символов в запросе',
|
|
941
|
+
httpCode: 400,
|
|
942
|
+
},
|
|
943
|
+
AI_MODEL_MAX_INPUT_TOKENS_EXCEEDED: {
|
|
944
|
+
code: 'A214',
|
|
945
|
+
message: 'Превышено максимальное количество токенов в запросе',
|
|
946
|
+
httpCode: 400,
|
|
947
|
+
},
|
|
948
|
+
AI_MODEL_FAILED_TO_CHECK_ACCESS: {
|
|
949
|
+
code: 'A215',
|
|
950
|
+
message: 'Не удалось проверить наличие доступа к ИИ модели',
|
|
951
|
+
httpCode: 500,
|
|
952
|
+
},
|
|
953
|
+
AI_MODEL_FAILED_TO_FIND_AVAILABLE_MODELS: {
|
|
954
|
+
code: 'A216',
|
|
955
|
+
message: 'Произошла ошибка при поиске доступных ИИ моделей',
|
|
956
|
+
httpCode: 500,
|
|
957
|
+
},
|
|
918
958
|
};
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./subscription-action.enum"), exports);
|
|
18
|
+
__exportStar(require("./subscription-feature-type.enum"), exports);
|
|
18
19
|
__exportStar(require("./subscription-plan.enum"), exports);
|
|
19
20
|
__exportStar(require("./subscription-status.enum"), exports);
|
|
20
21
|
__exportStar(require("./subscription-type.enum"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUBSCRIPTION_FEATURE_TYPE = void 0;
|
|
4
|
+
var SUBSCRIPTION_FEATURE_TYPE;
|
|
5
|
+
(function (SUBSCRIPTION_FEATURE_TYPE) {
|
|
6
|
+
SUBSCRIPTION_FEATURE_TYPE["REQUESTS_QUOTA"] = "requests_quota";
|
|
7
|
+
SUBSCRIPTION_FEATURE_TYPE["AI_MODEL_ACCESS"] = "ai_model_access";
|
|
8
|
+
SUBSCRIPTION_FEATURE_TYPE["MAX_INPUT_LENGTH"] = "max_input_length";
|
|
9
|
+
SUBSCRIPTION_FEATURE_TYPE["INFO"] = "info";
|
|
10
|
+
})(SUBSCRIPTION_FEATURE_TYPE || (exports.SUBSCRIPTION_FEATURE_TYPE = SUBSCRIPTION_FEATURE_TYPE = {}));
|
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./telegram-auth"), exports);
|
|
17
18
|
__exportStar(require("./telegram-auth-log"), exports);
|
|
18
19
|
__exportStar(require("./telegram-connect"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./telegram-auth-status.enum"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TELEGRAM_AUTH_STATUS = void 0;
|
|
4
|
+
var TELEGRAM_AUTH_STATUS;
|
|
5
|
+
(function (TELEGRAM_AUTH_STATUS) {
|
|
6
|
+
TELEGRAM_AUTH_STATUS["PENDING"] = "pending";
|
|
7
|
+
TELEGRAM_AUTH_STATUS["APPROVED"] = "approved";
|
|
8
|
+
TELEGRAM_AUTH_STATUS["REDEEMED"] = "redeemed";
|
|
9
|
+
TELEGRAM_AUTH_STATUS["EXPIRED"] = "expired";
|
|
10
|
+
})(TELEGRAM_AUTH_STATUS || (exports.TELEGRAM_AUTH_STATUS = TELEGRAM_AUTH_STATUS = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
|
@@ -16,6 +16,8 @@ exports.AiModelSchema = zod_1.z.object({
|
|
|
16
16
|
status: zod_1.z.nativeEnum(constants_1.AI_MODEL_STATUS),
|
|
17
17
|
contentType: zod_1.z.enum(Object.values(constants_1.AI_MODEL_CONTENT_TYPE)),
|
|
18
18
|
features: zod_1.z.array(zod_1.z.nativeEnum(constants_1.AI_MODEL_FEATURE)),
|
|
19
|
+
maxInputLength: zod_1.z.number(),
|
|
20
|
+
maxInputTokens: zod_1.z.number(),
|
|
19
21
|
createdAt: zod_1.z.date(),
|
|
20
22
|
updatedAt: zod_1.z.date(),
|
|
21
23
|
});
|
package/build/models/index.js
CHANGED
|
@@ -35,6 +35,7 @@ __exportStar(require("./product.schema"), exports);
|
|
|
35
35
|
__exportStar(require("./question.schema"), exports);
|
|
36
36
|
__exportStar(require("./referral-bonus.schema"), exports);
|
|
37
37
|
__exportStar(require("./section.schema"), exports);
|
|
38
|
+
__exportStar(require("./subscription-feature.schema"), exports);
|
|
38
39
|
__exportStar(require("./subscription-upgrade-schema"), exports);
|
|
39
40
|
__exportStar(require("./subscription.schema"), exports);
|
|
40
41
|
__exportStar(require("./telegram-user-data.schema"), exports);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProductSchema = exports.FeaturesSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const subscription_feature_schema_1 = require("./subscription-feature.schema");
|
|
5
6
|
exports.FeaturesSchema = zod_1.z.object({
|
|
6
7
|
icon: zod_1.z.string(),
|
|
7
8
|
title: zod_1.z.string(),
|
|
@@ -11,7 +12,8 @@ exports.ProductSchema = zod_1.z.object({
|
|
|
11
12
|
name: zod_1.z.string().min(3).max(16384),
|
|
12
13
|
requests: zod_1.z.number(),
|
|
13
14
|
price: zod_1.z.number(),
|
|
14
|
-
|
|
15
|
+
icon: zod_1.z.string(),
|
|
16
|
+
features: zod_1.z.array(subscription_feature_schema_1.SubscriptionFeatureSchema),
|
|
15
17
|
createdAt: zod_1.z.date(),
|
|
16
18
|
updatedAt: zod_1.z.date(),
|
|
17
19
|
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionFeatureSchema = exports.MaxInputLengthFeatureSchema = exports.RequestsQuotaFeatureSchema = exports.AiModelAccessFeatureSchema = exports.SubscriptionFeatureBaseSchema = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.SubscriptionFeatureBaseSchema = zod_1.z.object({
|
|
7
|
+
title: zod_1.z.string(),
|
|
8
|
+
icon: zod_1.z.string(),
|
|
9
|
+
type: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_FEATURE_TYPE),
|
|
10
|
+
});
|
|
11
|
+
exports.AiModelAccessFeatureSchema = exports.SubscriptionFeatureBaseSchema.extend({
|
|
12
|
+
type: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_TYPE.AI_MODEL_ACCESS),
|
|
13
|
+
value: zod_1.z.object({
|
|
14
|
+
isAvailable: zod_1.z.boolean(),
|
|
15
|
+
order: zod_1.z.number(),
|
|
16
|
+
contentType: zod_1.z.nativeEnum(constants_1.AI_MODEL_CONTENT_TYPE),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
exports.RequestsQuotaFeatureSchema = exports.SubscriptionFeatureBaseSchema.extend({
|
|
20
|
+
type: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_TYPE.REQUESTS_QUOTA),
|
|
21
|
+
value: zod_1.z.object({
|
|
22
|
+
tokens: zod_1.z.number(),
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
exports.MaxInputLengthFeatureSchema = exports.SubscriptionFeatureBaseSchema.extend({
|
|
26
|
+
type: zod_1.z.literal(constants_1.SUBSCRIPTION_FEATURE_TYPE.MAX_INPUT_LENGTH),
|
|
27
|
+
value: zod_1.z.object({
|
|
28
|
+
maxInputLength: zod_1.z.number(),
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
exports.SubscriptionFeatureSchema = zod_1.z.union([
|
|
32
|
+
exports.AiModelAccessFeatureSchema,
|
|
33
|
+
exports.RequestsQuotaFeatureSchema,
|
|
34
|
+
exports.MaxInputLengthFeatureSchema,
|
|
35
|
+
]);
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubscriptionWithSubTypesSchema = exports.SubscriptionWithActionSchema = exports.SubscriptionSchema = void 0;
|
|
3
|
+
exports.SubscriptionWithFeaturesSchema = exports.SubscriptionWithSubTypesSchema = exports.SubscriptionWithActionSchema = exports.SubscriptionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const product_schema_1 = require("./product.schema");
|
|
6
5
|
const constants_1 = require("../constants");
|
|
6
|
+
const subscription_feature_schema_1 = require("./subscription-feature.schema");
|
|
7
7
|
exports.SubscriptionSchema = zod_1.z.object({
|
|
8
8
|
uuid: zod_1.z.string().uuid(),
|
|
9
9
|
mainSubscriptionId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
10
10
|
name: zod_1.z.string().min(3).max(16384),
|
|
11
11
|
requests: zod_1.z.number(),
|
|
12
12
|
price: zod_1.z.number(),
|
|
13
|
-
features: zod_1.z.array(product_schema_1.FeaturesSchema),
|
|
14
13
|
plan: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_PLAN),
|
|
15
14
|
type: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_TYPE),
|
|
16
15
|
discount: zod_1.z.number(),
|
|
17
16
|
period: zod_1.z.number(),
|
|
18
17
|
tokens: zod_1.z.number(),
|
|
18
|
+
icon: zod_1.z.string(),
|
|
19
|
+
action: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_ACTION).optional().nullable(),
|
|
20
|
+
features: zod_1.z.array(subscription_feature_schema_1.SubscriptionFeatureSchema),
|
|
19
21
|
createdAt: zod_1.z.date(),
|
|
20
22
|
updatedAt: zod_1.z.date(),
|
|
21
23
|
});
|
|
22
24
|
exports.SubscriptionWithActionSchema = zod_1.z.intersection(exports.SubscriptionSchema, zod_1.z.object({
|
|
23
25
|
action: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_ACTION),
|
|
24
26
|
}));
|
|
25
|
-
exports.SubscriptionWithSubTypesSchema = zod_1.z.intersection(exports.
|
|
26
|
-
subTypes: zod_1.z.array(exports.
|
|
27
|
+
exports.SubscriptionWithSubTypesSchema = zod_1.z.intersection(exports.SubscriptionSchema, zod_1.z.object({
|
|
28
|
+
subTypes: zod_1.z.array(exports.SubscriptionSchema),
|
|
27
29
|
}));
|
|
30
|
+
exports.SubscriptionWithFeaturesSchema = exports.SubscriptionSchema.extend({
|
|
31
|
+
features: zod_1.z.array(subscription_feature_schema_1.SubscriptionFeatureSchema),
|
|
32
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AiModelSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindAiModelsAvailableToUserCommand {
|
|
5
|
+
export const RequestSchema = z.void();
|
|
6
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
7
|
+
|
|
8
|
+
export const ResponseSchema = z.object({
|
|
9
|
+
data: z.array(AiModelSchema),
|
|
10
|
+
});
|
|
11
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
12
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './create-ai-model.command';
|
|
2
2
|
export * from './delete-ai-model.command';
|
|
3
3
|
export * from './find-ai-model.command';
|
|
4
|
+
export * from './find-ai-models-available-to-user.comand';
|
|
4
5
|
export * from './find-formatted-ai-model.command';
|
|
5
6
|
export * from './update-ai-model.command';
|
package/commands/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './referral';
|
|
|
17
17
|
export * from './subscription';
|
|
18
18
|
export * from './task';
|
|
19
19
|
export * from './telegram';
|
|
20
|
+
export * from './telegram-auth';
|
|
20
21
|
export * from './telegram-profile';
|
|
21
22
|
export * from './unregistered-user';
|
|
22
23
|
export * from './user';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace CreateTelegramAuthLinkCommand {
|
|
4
|
+
export const ResponseSchema = z.object({
|
|
5
|
+
data: z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
link: z.string(),
|
|
8
|
+
}),
|
|
9
|
+
});
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TELEGRAM_AUTH_STATUS } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export namespace GetTelegramAuthSessionStatusCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.object({
|
|
13
|
+
uuid: z.string().uuid(),
|
|
14
|
+
status: z.nativeEnum(TELEGRAM_AUTH_STATUS),
|
|
15
|
+
expiresAt: z.date(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace RedeemTelegramAuthSessionCommand {
|
|
4
|
+
export const RequestSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: z.object({
|
|
12
|
+
accessToken: z.string(),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -872,11 +872,12 @@ export const ERRORS = {
|
|
|
872
872
|
message: 'Превышено максимальное количество прикрепленных файлов',
|
|
873
873
|
httpCode: 400,
|
|
874
874
|
},
|
|
875
|
-
|
|
875
|
+
AI_MODEL_USER_HAS_NO_ACCESS: {
|
|
876
876
|
code: 'A199',
|
|
877
|
-
message: 'У пользователя нет доступа к
|
|
877
|
+
message: 'У пользователя нет доступа к данной ИИ модели',
|
|
878
878
|
httpCode: 400,
|
|
879
879
|
},
|
|
880
|
+
|
|
880
881
|
CHAT_TRANSFER_ERROR: {
|
|
881
882
|
code: 'A200',
|
|
882
883
|
message: 'Произошла ошибка при переносе чата',
|
|
@@ -917,4 +918,44 @@ export const ERRORS = {
|
|
|
917
918
|
message: 'Промокод не провалидирован',
|
|
918
919
|
httpCode: 500,
|
|
919
920
|
},
|
|
921
|
+
TELEGRAM_AUTH_CODE_CREATE_ERROR: {
|
|
922
|
+
code: 'A209',
|
|
923
|
+
message: 'Произошла ошибка при создании ссылки для авторизации через Telegram',
|
|
924
|
+
httpCode: 500,
|
|
925
|
+
},
|
|
926
|
+
TELEGRAM_AUTH_CODE_INVALID: {
|
|
927
|
+
code: 'A210',
|
|
928
|
+
message: 'Ссылка для авторизации через Telegram недействительна или устарела',
|
|
929
|
+
httpCode: 400,
|
|
930
|
+
},
|
|
931
|
+
TELEGRAM_AUTH_SESSION_UPDATE_ERROR: {
|
|
932
|
+
code: 'A211',
|
|
933
|
+
message: 'Произошла ошибка при обновлении сессии авторизации через Telegram',
|
|
934
|
+
httpCode: 500,
|
|
935
|
+
},
|
|
936
|
+
TELEGRAM_AUTH_CODE_ALREADY_USED: {
|
|
937
|
+
code: 'A212',
|
|
938
|
+
message: 'Ссылка для авторизации через телеграм уже была использована',
|
|
939
|
+
httpCode: 400,
|
|
940
|
+
},
|
|
941
|
+
AI_MODEL_MAX_INPUT_LENGTH_EXCEEDED: {
|
|
942
|
+
code: 'A213',
|
|
943
|
+
message: 'Превышено максимальное количество символов в запросе',
|
|
944
|
+
httpCode: 400,
|
|
945
|
+
},
|
|
946
|
+
AI_MODEL_MAX_INPUT_TOKENS_EXCEEDED: {
|
|
947
|
+
code: 'A214',
|
|
948
|
+
message: 'Превышено максимальное количество токенов в запросе',
|
|
949
|
+
httpCode: 400,
|
|
950
|
+
},
|
|
951
|
+
AI_MODEL_FAILED_TO_CHECK_ACCESS: {
|
|
952
|
+
code: 'A215',
|
|
953
|
+
message: 'Не удалось проверить наличие доступа к ИИ модели',
|
|
954
|
+
httpCode: 500,
|
|
955
|
+
},
|
|
956
|
+
AI_MODEL_FAILED_TO_FIND_AVAILABLE_MODELS: {
|
|
957
|
+
code: 'A216',
|
|
958
|
+
message: 'Произошла ошибка при поиске доступных ИИ моделей',
|
|
959
|
+
httpCode: 500,
|
|
960
|
+
},
|
|
920
961
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './telegram-auth-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -19,6 +19,8 @@ export const AiModelSchema = z.object({
|
|
|
19
19
|
status: z.nativeEnum(AI_MODEL_STATUS),
|
|
20
20
|
contentType: z.enum(Object.values(AI_MODEL_CONTENT_TYPE) as [TAIModelContentTypeEnum]),
|
|
21
21
|
features: z.array(z.nativeEnum(AI_MODEL_FEATURE)),
|
|
22
|
+
maxInputLength: z.number(),
|
|
23
|
+
maxInputTokens: z.number(),
|
|
22
24
|
createdAt: z.date(),
|
|
23
25
|
updatedAt: z.date(),
|
|
24
26
|
});
|
package/models/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './product.schema';
|
|
|
19
19
|
export * from './question.schema';
|
|
20
20
|
export * from './referral-bonus.schema';
|
|
21
21
|
export * from './section.schema';
|
|
22
|
+
export * from './subscription-feature.schema';
|
|
22
23
|
export * from './subscription-upgrade-schema';
|
|
23
24
|
export * from './subscription.schema';
|
|
24
25
|
export * from './telegram-user-data.schema';
|
package/models/product.schema.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionFeatureSchema } from './subscription-feature.schema';
|
|
2
3
|
|
|
3
4
|
export const FeaturesSchema = z.object({
|
|
4
5
|
icon: z.string(),
|
|
@@ -10,7 +11,8 @@ export const ProductSchema = z.object({
|
|
|
10
11
|
name: z.string().min(3).max(16384),
|
|
11
12
|
requests: z.number(),
|
|
12
13
|
price: z.number(),
|
|
13
|
-
|
|
14
|
+
icon: z.string(),
|
|
15
|
+
features: z.array(SubscriptionFeatureSchema),
|
|
14
16
|
createdAt: z.date(),
|
|
15
17
|
updatedAt: z.date(),
|
|
16
18
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AI_MODEL_CONTENT_TYPE, SUBSCRIPTION_FEATURE_TYPE } from '../constants';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export const SubscriptionFeatureBaseSchema = z.object({
|
|
5
|
+
title: z.string(),
|
|
6
|
+
icon: z.string(),
|
|
7
|
+
type: z.nativeEnum(SUBSCRIPTION_FEATURE_TYPE),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const AiModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
|
|
11
|
+
type: z.literal(SUBSCRIPTION_FEATURE_TYPE.AI_MODEL_ACCESS),
|
|
12
|
+
value: z.object({
|
|
13
|
+
isAvailable: z.boolean(),
|
|
14
|
+
order: z.number(),
|
|
15
|
+
contentType: z.nativeEnum(AI_MODEL_CONTENT_TYPE),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const RequestsQuotaFeatureSchema = SubscriptionFeatureBaseSchema.extend({
|
|
20
|
+
type: z.literal(SUBSCRIPTION_FEATURE_TYPE.REQUESTS_QUOTA),
|
|
21
|
+
value: z.object({
|
|
22
|
+
tokens: z.number(),
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const MaxInputLengthFeatureSchema = SubscriptionFeatureBaseSchema.extend({
|
|
27
|
+
type: z.literal(SUBSCRIPTION_FEATURE_TYPE.MAX_INPUT_LENGTH),
|
|
28
|
+
value: z.object({
|
|
29
|
+
maxInputLength: z.number(),
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const SubscriptionFeatureSchema = z.union([
|
|
34
|
+
AiModelAccessFeatureSchema,
|
|
35
|
+
RequestsQuotaFeatureSchema,
|
|
36
|
+
MaxInputLengthFeatureSchema,
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
export type SubscriptionFeature = z.infer<typeof SubscriptionFeatureSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { FeaturesSchema } from './product.schema';
|
|
3
2
|
import { SUBSCRIPTION_ACTION, SUBSCRIPTION_PLAN, SUBSCRIPTION_TYPE } from '../constants';
|
|
3
|
+
import { SubscriptionFeatureSchema } from './subscription-feature.schema';
|
|
4
4
|
|
|
5
5
|
export const SubscriptionSchema = z.object({
|
|
6
6
|
uuid: z.string().uuid(),
|
|
@@ -8,12 +8,14 @@ export const SubscriptionSchema = z.object({
|
|
|
8
8
|
name: z.string().min(3).max(16384),
|
|
9
9
|
requests: z.number(),
|
|
10
10
|
price: z.number(),
|
|
11
|
-
features: z.array(FeaturesSchema),
|
|
12
11
|
plan: z.nativeEnum(SUBSCRIPTION_PLAN),
|
|
13
12
|
type: z.nativeEnum(SUBSCRIPTION_TYPE),
|
|
14
13
|
discount: z.number(),
|
|
15
14
|
period: z.number(),
|
|
16
15
|
tokens: z.number(),
|
|
16
|
+
icon: z.string(),
|
|
17
|
+
action: z.nativeEnum(SUBSCRIPTION_ACTION).optional().nullable(),
|
|
18
|
+
features: z.array(SubscriptionFeatureSchema),
|
|
17
19
|
createdAt: z.date(),
|
|
18
20
|
updatedAt: z.date(),
|
|
19
21
|
});
|
|
@@ -26,8 +28,12 @@ export const SubscriptionWithActionSchema = z.intersection(
|
|
|
26
28
|
);
|
|
27
29
|
|
|
28
30
|
export const SubscriptionWithSubTypesSchema = z.intersection(
|
|
29
|
-
|
|
31
|
+
SubscriptionSchema,
|
|
30
32
|
z.object({
|
|
31
|
-
subTypes: z.array(
|
|
33
|
+
subTypes: z.array(SubscriptionSchema),
|
|
32
34
|
}),
|
|
33
35
|
);
|
|
36
|
+
|
|
37
|
+
export const SubscriptionWithFeaturesSchema = SubscriptionSchema.extend({
|
|
38
|
+
features: z.array(SubscriptionFeatureSchema),
|
|
39
|
+
});
|