@purpleschool/gptbot 0.5.30 → 0.5.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.
Files changed (34) hide show
  1. package/api/controllers/http/telegram-connect.ts +1 -0
  2. package/api/controllers/http/user-to-task-private.ts +1 -0
  3. package/api/controllers/index.ts +0 -1
  4. package/build/api/controllers/http/telegram-connect.js +1 -0
  5. package/build/api/controllers/http/user-to-task-private.js +1 -0
  6. package/build/api/controllers/index.js +0 -1
  7. package/build/commands/index.js +1 -0
  8. package/build/commands/telegram/get-telegram-config.command.js +11 -0
  9. package/build/{api/controllers/amqp → commands/telegram}/index.js +1 -2
  10. package/build/commands/telegram-profile/check-telegram-profile-exists.command.js +3 -5
  11. package/build/commands/telegram-profile/index.js +0 -3
  12. package/build/commands/user-to-task/check-task-completion.command.js +14 -0
  13. package/build/commands/user-to-task/index.js +1 -0
  14. package/build/constants/errors/errors.js +15 -0
  15. package/commands/index.ts +1 -0
  16. package/commands/telegram/get-telegram-config.command.ts +12 -0
  17. package/commands/telegram/index.ts +1 -0
  18. package/commands/telegram-profile/check-telegram-profile-exists.command.ts +3 -5
  19. package/commands/telegram-profile/index.ts +0 -3
  20. package/commands/user-to-task/check-task-completion.command.ts +14 -0
  21. package/commands/user-to-task/index.ts +1 -0
  22. package/constants/errors/errors.ts +15 -0
  23. package/package.json +1 -1
  24. package/api/controllers/amqp/index.ts +0 -2
  25. package/api/controllers/amqp/telegram-connect.ts +0 -3
  26. package/api/controllers/amqp/telegram-profile.ts +0 -3
  27. package/build/api/controllers/amqp/telegram-connect.js +0 -6
  28. package/build/api/controllers/amqp/telegram-profile.js +0 -6
  29. package/build/commands/telegram-profile/check-my-telegram-profile-connected.command.js +0 -12
  30. package/build/commands/telegram-profile/connect-telegram-profile-with-verification-code.command.js +0 -15
  31. package/build/commands/telegram-profile/create-new-user-from-telegram-bot.command.js +0 -12
  32. package/commands/telegram-profile/check-my-telegram-profile-connected.command.ts +0 -11
  33. package/commands/telegram-profile/connect-telegram-profile-with-verification-code.command.ts +0 -16
  34. package/commands/telegram-profile/create-new-user-from-telegram-bot.command.ts +0 -13
@@ -2,4 +2,5 @@ export const TELEGRAM_CONNECT_CONTROLLER = 'telegram-connect' as const;
2
2
 
3
3
  export const TELEGRAM_CONNECT_ROUTES = {
4
4
  CREATE_CONNECTION_LINK: 'connect',
5
+ CONFIG: 'config',
5
6
  } as const;
@@ -4,4 +4,5 @@ export const USER_TO_TASK_PRIVATE_ROUTES = {
4
4
  MY: 'my',
5
5
  START: (uuid: string) => `${uuid}/start`,
6
6
  REWARDS: 'rewards',
7
+ CHECK: (uuid: string) => `${uuid}/check`,
7
8
  } as const;
@@ -1,2 +1 @@
1
- export * from './amqp';
2
1
  export * from './http';
@@ -4,4 +4,5 @@ exports.TELEGRAM_CONNECT_ROUTES = exports.TELEGRAM_CONNECT_CONTROLLER = void 0;
4
4
  exports.TELEGRAM_CONNECT_CONTROLLER = 'telegram-connect';
5
5
  exports.TELEGRAM_CONNECT_ROUTES = {
6
6
  CREATE_CONNECTION_LINK: 'connect',
7
+ CONFIG: 'config',
7
8
  };
@@ -6,4 +6,5 @@ exports.USER_TO_TASK_PRIVATE_ROUTES = {
6
6
  MY: 'my',
7
7
  START: (uuid) => `${uuid}/start`,
8
8
  REWARDS: 'rewards',
9
+ CHECK: (uuid) => `${uuid}/check`,
9
10
  };
@@ -14,5 +14,4 @@ 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("./amqp"), exports);
18
17
  __exportStar(require("./http"), exports);
@@ -29,6 +29,7 @@ __exportStar(require("./question"), exports);
29
29
  __exportStar(require("./referral"), exports);
30
30
  __exportStar(require("./subscription"), exports);
31
31
  __exportStar(require("./task"), exports);
32
+ __exportStar(require("./telegram"), exports);
32
33
  __exportStar(require("./telegram-profile"), exports);
33
34
  __exportStar(require("./unregistered-user"), exports);
34
35
  __exportStar(require("./user"), exports);
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetTelegramConfigCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var GetTelegramConfigCommand;
6
+ (function (GetTelegramConfigCommand) {
7
+ GetTelegramConfigCommand.RequestSchema = zod_1.z.void();
8
+ GetTelegramConfigCommand.ResponseSchema = zod_1.z.object({
9
+ tmaLink: zod_1.z.string(),
10
+ });
11
+ })(GetTelegramConfigCommand || (exports.GetTelegramConfigCommand = GetTelegramConfigCommand = {}));
@@ -14,5 +14,4 @@ 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-connect"), exports);
18
- __exportStar(require("./telegram-profile"), exports);
17
+ __exportStar(require("./get-telegram-config.command"), exports);
@@ -5,12 +5,10 @@ const zod_1 = require("zod");
5
5
  var CheckTelegramProfileExistsCommand;
6
6
  (function (CheckTelegramProfileExistsCommand) {
7
7
  CheckTelegramProfileExistsCommand.RequestBodySchema = zod_1.z.object({
8
- initData: zod_1.z.string(),
9
- platform: zod_1.z.string().nullable(),
8
+ telegramId: zod_1.z.number(),
10
9
  });
11
10
  CheckTelegramProfileExistsCommand.ResponseSchema = zod_1.z.object({
12
- data: zod_1.z.object({
13
- exists: zod_1.z.boolean(),
14
- }),
11
+ isSuccess: zod_1.z.boolean(),
12
+ exists: zod_1.z.boolean(),
15
13
  });
16
14
  })(CheckTelegramProfileExistsCommand || (exports.CheckTelegramProfileExistsCommand = CheckTelegramProfileExistsCommand = {}));
@@ -15,8 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth-with-telegram-web-app.command"), exports);
18
- __exportStar(require("./check-my-telegram-profile-connected.command"), exports);
19
18
  __exportStar(require("./check-telegram-profile-exists.command"), exports);
20
- __exportStar(require("./connect-telegram-profile-with-verification-code.command"), exports);
21
19
  __exportStar(require("./create-telegram-profile-connection-link.command"), exports);
22
- __exportStar(require("./create-new-user-from-telegram-bot.command"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckTaskCompletionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var CheckTaskCompletionCommand;
7
+ (function (CheckTaskCompletionCommand) {
8
+ CheckTaskCompletionCommand.RequestParamsSchema = models_1.UserTaskSchema.pick({
9
+ taskId: true,
10
+ });
11
+ CheckTaskCompletionCommand.ResponseSchema = zod_1.z.object({
12
+ data: models_1.UserTaskSchema,
13
+ });
14
+ })(CheckTaskCompletionCommand || (exports.CheckTaskCompletionCommand = CheckTaskCompletionCommand = {}));
@@ -14,6 +14,7 @@ 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("./check-task-completion.command"), exports);
17
18
  __exportStar(require("./claim-task-reward.command"), exports);
18
19
  __exportStar(require("./get-my-tasks.command"), exports);
19
20
  __exportStar(require("./start-task.command"), exports);
@@ -795,4 +795,19 @@ exports.ERRORS = {
795
795
  message: 'Произошла ошибка при обновлении Telegram профиля',
796
796
  httpCode: 500,
797
797
  },
798
+ TASK_NOT_READY_FOR_CHECK: {
799
+ code: 'A184',
800
+ message: 'Задание не готово к проверке',
801
+ httpCode: 400,
802
+ },
803
+ TASK_CHECK_ERROR: {
804
+ code: 'A185',
805
+ message: 'Произошла ошибка при проверке задания',
806
+ httpCode: 500,
807
+ },
808
+ TASK_TELEGRAM_CHANNEL_NOT_SUBSCRIBED: {
809
+ code: 'A186',
810
+ message: 'Пользователь не подписан на канал',
811
+ httpCode: 400,
812
+ },
798
813
  };
package/commands/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from './question';
13
13
  export * from './referral';
14
14
  export * from './subscription';
15
15
  export * from './task';
16
+ export * from './telegram';
16
17
  export * from './telegram-profile';
17
18
  export * from './unregistered-user';
18
19
  export * from './user';
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace GetTelegramConfigCommand {
4
+ export const RequestSchema = z.void();
5
+ export type Request = z.infer<typeof RequestSchema>;
6
+
7
+ export const ResponseSchema = z.object({
8
+ tmaLink: z.string(),
9
+ });
10
+
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
@@ -0,0 +1 @@
1
+ export * from './get-telegram-config.command';
@@ -2,16 +2,14 @@ import { z } from 'zod';
2
2
 
3
3
  export namespace CheckTelegramProfileExistsCommand {
4
4
  export const RequestBodySchema = z.object({
5
- initData: z.string(),
6
- platform: z.string().nullable(),
5
+ telegramId: z.number(),
7
6
  });
8
7
 
9
8
  export type RequestBody = z.infer<typeof RequestBodySchema>;
10
9
 
11
10
  export const ResponseSchema = z.object({
12
- data: z.object({
13
- exists: z.boolean(),
14
- }),
11
+ isSuccess: z.boolean(),
12
+ exists: z.boolean(),
15
13
  });
16
14
 
17
15
  export type Response = z.infer<typeof ResponseSchema>;
@@ -1,6 +1,3 @@
1
1
  export * from './auth-with-telegram-web-app.command';
2
- export * from './check-my-telegram-profile-connected.command';
3
2
  export * from './check-telegram-profile-exists.command';
4
- export * from './connect-telegram-profile-with-verification-code.command';
5
3
  export * from './create-telegram-profile-connection-link.command';
6
- export * from './create-new-user-from-telegram-bot.command';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { UserTaskSchema } from '../../models';
3
+
4
+ export namespace CheckTaskCompletionCommand {
5
+ export const RequestParamsSchema = UserTaskSchema.pick({
6
+ taskId: true,
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: UserTaskSchema,
12
+ });
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -1,3 +1,4 @@
1
+ export * from './check-task-completion.command';
1
2
  export * from './claim-task-reward.command';
2
3
  export * from './get-my-tasks.command';
3
4
  export * from './start-task.command';
@@ -795,4 +795,19 @@ export const ERRORS = {
795
795
  message: 'Произошла ошибка при обновлении Telegram профиля',
796
796
  httpCode: 500,
797
797
  },
798
+ TASK_NOT_READY_FOR_CHECK: {
799
+ code: 'A184',
800
+ message: 'Задание не готово к проверке',
801
+ httpCode: 400,
802
+ },
803
+ TASK_CHECK_ERROR: {
804
+ code: 'A185',
805
+ message: 'Произошла ошибка при проверке задания',
806
+ httpCode: 500,
807
+ },
808
+ TASK_TELEGRAM_CHANNEL_NOT_SUBSCRIBED: {
809
+ code: 'A186',
810
+ message: 'Пользователь не подписан на канал',
811
+ httpCode: 400,
812
+ },
798
813
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.30",
3
+ "version": "0.5.32",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,2 +0,0 @@
1
- export * from './telegram-connect';
2
- export * from './telegram-profile';
@@ -1,3 +0,0 @@
1
- export const TELEGRAM_CONNECT_AMQP_ROUTES = {
2
- CONNECT_WITH_CODE: 'tg.connect.connect-with-code.rpc',
3
- };
@@ -1,3 +0,0 @@
1
- export const TELEGRAM_PROFILE_AMQP_ROUTES = {
2
- CREATE_NEW_USER_FROM_BOT: 'tg.profile.create-new-user-from-bot',
3
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TELEGRAM_CONNECT_AMQP_ROUTES = void 0;
4
- exports.TELEGRAM_CONNECT_AMQP_ROUTES = {
5
- CONNECT_WITH_CODE: 'tg.connect.connect-with-code.rpc',
6
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TELEGRAM_PROFILE_AMQP_ROUTES = void 0;
4
- exports.TELEGRAM_PROFILE_AMQP_ROUTES = {
5
- CREATE_NEW_USER_FROM_BOT: 'tg.profile.create-new-user-from-bot',
6
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CheckMyTelegramProfileConnectedCommand = void 0;
4
- const zod_1 = require("zod");
5
- var CheckMyTelegramProfileConnectedCommand;
6
- (function (CheckMyTelegramProfileConnectedCommand) {
7
- CheckMyTelegramProfileConnectedCommand.ResponseSchema = zod_1.z.object({
8
- data: zod_1.z.object({
9
- connected: zod_1.z.boolean(),
10
- }),
11
- });
12
- })(CheckMyTelegramProfileConnectedCommand || (exports.CheckMyTelegramProfileConnectedCommand = CheckMyTelegramProfileConnectedCommand = {}));
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConnectTelegramProfileWithVerificationCodeCommand = void 0;
4
- const zod_1 = require("zod");
5
- const models_1 = require("../../models");
6
- var ConnectTelegramProfileWithVerificationCodeCommand;
7
- (function (ConnectTelegramProfileWithVerificationCodeCommand) {
8
- ConnectTelegramProfileWithVerificationCodeCommand.RequestSchema = models_1.TelegramUserDataSchema.extend({
9
- code: zod_1.z.string(),
10
- });
11
- ConnectTelegramProfileWithVerificationCodeCommand.ResponseSchema = zod_1.z.object({
12
- isSuccess: zod_1.z.boolean(),
13
- message: zod_1.z.string().optional(),
14
- });
15
- })(ConnectTelegramProfileWithVerificationCodeCommand || (exports.ConnectTelegramProfileWithVerificationCodeCommand = ConnectTelegramProfileWithVerificationCodeCommand = {}));
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreateNewUserFromTelegramBotCommand = void 0;
4
- const zod_1 = require("zod");
5
- const models_1 = require("../../models");
6
- var CreateNewUserFromTelegramBotCommand;
7
- (function (CreateNewUserFromTelegramBotCommand) {
8
- CreateNewUserFromTelegramBotCommand.RequestSchema = models_1.TelegramUserDataSchema.extend({
9
- partnerId: zod_1.z.string().uuid().optional(),
10
- });
11
- CreateNewUserFromTelegramBotCommand.ResponseSchema = zod_1.z.void();
12
- })(CreateNewUserFromTelegramBotCommand || (exports.CreateNewUserFromTelegramBotCommand = CreateNewUserFromTelegramBotCommand = {}));
@@ -1,11 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export namespace CheckMyTelegramProfileConnectedCommand {
4
- export const ResponseSchema = z.object({
5
- data: z.object({
6
- connected: z.boolean(),
7
- }),
8
- });
9
-
10
- export type Response = z.infer<typeof ResponseSchema>;
11
- }
@@ -1,16 +0,0 @@
1
- import { z } from 'zod';
2
- import { TelegramUserDataSchema } from '../../models';
3
-
4
- export namespace ConnectTelegramProfileWithVerificationCodeCommand {
5
- export const RequestSchema = TelegramUserDataSchema.extend({
6
- code: z.string(),
7
- });
8
-
9
- export type Request = z.infer<typeof RequestSchema>;
10
-
11
- export const ResponseSchema = z.object({
12
- isSuccess: z.boolean(),
13
- message: z.string().optional(),
14
- });
15
- export type Response = z.infer<typeof ResponseSchema>;
16
- }
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- import { TelegramUserDataSchema } from '../../models';
3
-
4
- export namespace CreateNewUserFromTelegramBotCommand {
5
- export const RequestSchema = TelegramUserDataSchema.extend({
6
- partnerId: z.string().uuid().optional(),
7
- });
8
-
9
- export type Request = z.infer<typeof RequestSchema>;
10
-
11
- export const ResponseSchema = z.void();
12
- export type Response = z.infer<typeof ResponseSchema>;
13
- }