@purpleschool/gptbot 0.8.59 → 0.8.61

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 (49) hide show
  1. package/api/controllers/http/index.ts +1 -2
  2. package/api/controllers/http/kie.ts +5 -0
  3. package/api/routes.ts +3 -10
  4. package/build/api/controllers/http/index.js +1 -2
  5. package/build/api/controllers/http/kie.js +7 -0
  6. package/build/api/routes.js +3 -10
  7. package/build/commands/community/create-community-post.command.js +4 -19
  8. package/build/commands/community/get-all-community-posts-by-criteria.command.js +4 -4
  9. package/build/commands/community/get-community-post-by-uuid.command.js +1 -1
  10. package/build/commands/community/get-my-community-posts-by-criteria.command.js +5 -5
  11. package/build/commands/community/set-like-community-post.command.js +1 -1
  12. package/build/commands/index.js +0 -1
  13. package/build/constants/community/enums/community-tool-type.enum.js +1 -0
  14. package/build/constants/errors/errors.js +10 -15
  15. package/build/constants/form-submission/enums/form-type.enum.js +0 -1
  16. package/build/models/community/community-post-media-data.schema.js +2 -2
  17. package/build/models/community/community-post.schema.js +19 -1
  18. package/build/models/index.js +0 -1
  19. package/commands/community/create-community-post.command.ts +7 -28
  20. package/commands/community/get-all-community-posts-by-criteria.command.ts +5 -5
  21. package/commands/community/get-community-post-by-uuid.command.ts +2 -2
  22. package/commands/community/get-my-community-posts-by-criteria.command.ts +6 -6
  23. package/commands/community/set-like-community-post.command.ts +2 -2
  24. package/commands/index.ts +0 -1
  25. package/constants/community/enums/community-tool-type.enum.ts +1 -0
  26. package/constants/errors/errors.ts +10 -15
  27. package/constants/form-submission/enums/form-type.enum.ts +0 -1
  28. package/models/community/community-post-media-data.schema.ts +7 -9
  29. package/models/community/community-post.schema.ts +19 -0
  30. package/models/index.ts +0 -1
  31. package/package.json +1 -1
  32. package/api/controllers/http/ai-proxy.ts +0 -5
  33. package/api/controllers/http/b2b.ts +0 -10
  34. package/build/api/controllers/http/ai-proxy.js +0 -7
  35. package/build/api/controllers/http/b2b.js +0 -12
  36. package/build/commands/b2b/get-api-key.command.js +0 -12
  37. package/build/commands/b2b/index.js +0 -21
  38. package/build/commands/b2b/refresh-api-key.command.js +0 -12
  39. package/build/commands/b2b/send-image-request.command.js +0 -24
  40. package/build/commands/b2b/send-text-request.command.js +0 -22
  41. package/build/commands/b2b/submit-balance-top-up-form.command.js +0 -21
  42. package/build/models/api-key.schema.js +0 -15
  43. package/commands/b2b/get-api-key.command.ts +0 -11
  44. package/commands/b2b/index.ts +0 -5
  45. package/commands/b2b/refresh-api-key.command.ts +0 -11
  46. package/commands/b2b/send-image-request.command.ts +0 -28
  47. package/commands/b2b/send-text-request.command.ts +0 -26
  48. package/commands/b2b/submit-balance-top-up-form.command.ts +0 -22
  49. package/models/api-key.schema.ts +0 -10
@@ -14,7 +14,7 @@ export * from './form-submission';
14
14
  export * from './key-value';
15
15
  export * from './referral';
16
16
  export * from './message';
17
- export * from './ai-proxy';
17
+ export * from './kie';
18
18
  export * from './page';
19
19
  export * from './payment';
20
20
  export * from './presentation';
@@ -53,7 +53,6 @@ export * from './cabinet';
53
53
  export * from './webmaster';
54
54
  export * from './music';
55
55
  export * from './webmaster-click';
56
- export * from './b2b';
57
56
  export * from './community';
58
57
  export * from './user-profile';
59
58
  export * from './image-generation';
@@ -0,0 +1,5 @@
1
+ export const KIE_CONTROLLER = 'kie' as const;
2
+
3
+ export const KIE_ROUTES = {
4
+ CALLBACK: 'callback',
5
+ } as const;
package/api/routes.ts CHANGED
@@ -844,20 +844,12 @@ export const REST_API = {
844
844
  DELETE_BY_KEY: (namespace: string, key: string) =>
845
845
  `${ROOT}/${CONTROLLERS.KEY_VALUE_NAMESPACE_CONTROLLER}/${CONTROLLERS.KEY_VALUE_NAMESPACE_ROUTES.DELETE_BY_KEY(namespace, key)}`,
846
846
  },
847
- AI_PROXY: {
848
- IMAGE_CALLBACK: `${ROOT}/${CONTROLLERS.AI_PROXY_CONTROLLER}/${CONTROLLERS.AI_PROXY_ROUTES.IMAGE_CALLBACK}`,
847
+ KIE: {
848
+ CALLBACK: `${ROOT}/${CONTROLLERS.KIE_CONTROLLER}/${CONTROLLERS.KIE_ROUTES.CALLBACK}`,
849
849
  },
850
850
  CLOUD_PAYMENTS: {
851
851
  CALLBACK: `${ROOT}/${CONTROLLERS.CLOUD_PAYMENTS_CONTROLLER}/${CONTROLLERS.CLOUD_PAYMENTS_ROUTES.CALLBACK}`,
852
852
  },
853
- B2B: {
854
- GET_API_TOKEN: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.GET_API_TOKEN}`,
855
- REFRESH_API_TOKEN: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.REFRESH_API_TOKEN}`,
856
- SEND_TEXT_REQUEST: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_TEXT_REQUEST}`,
857
- SEND_IMAGE_REQUEST: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_IMAGE_REQUEST}`,
858
- FILE_UPLOAD: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.FILE_UPLOAD}`,
859
- BALANCE_TOP_UP: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.BALANCE_TOP_UP}`,
860
- },
861
853
  COMMUNITY_PRIVATE: {
862
854
  GET_ALL: `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.GET_ALL}`,
863
855
  GET_MY: `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.GET_MY}`,
@@ -880,6 +872,7 @@ export const REST_API = {
880
872
  `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.FAVORITE(uuid)}`,
881
873
  REPORT: (uuid: string) =>
882
874
  `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.REPORT(uuid)}`,
875
+ LIKES_COUNT: `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.LIKES_COUNT}`,
883
876
  },
884
877
  COMMUNITY_PUBLIC: {
885
878
  GET_ALL: `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PUBLIC}/${CONTROLLERS.COMMUNITY_ROUTES_PUBLIC.GET_ALL}`,
@@ -30,7 +30,7 @@ __exportStar(require("./form-submission"), exports);
30
30
  __exportStar(require("./key-value"), exports);
31
31
  __exportStar(require("./referral"), exports);
32
32
  __exportStar(require("./message"), exports);
33
- __exportStar(require("./ai-proxy"), exports);
33
+ __exportStar(require("./kie"), exports);
34
34
  __exportStar(require("./page"), exports);
35
35
  __exportStar(require("./payment"), exports);
36
36
  __exportStar(require("./presentation"), exports);
@@ -69,7 +69,6 @@ __exportStar(require("./cabinet"), exports);
69
69
  __exportStar(require("./webmaster"), exports);
70
70
  __exportStar(require("./music"), exports);
71
71
  __exportStar(require("./webmaster-click"), exports);
72
- __exportStar(require("./b2b"), exports);
73
72
  __exportStar(require("./community"), exports);
74
73
  __exportStar(require("./user-profile"), exports);
75
74
  __exportStar(require("./image-generation"), exports);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KIE_ROUTES = exports.KIE_CONTROLLER = void 0;
4
+ exports.KIE_CONTROLLER = 'kie';
5
+ exports.KIE_ROUTES = {
6
+ CALLBACK: 'callback',
7
+ };
@@ -652,20 +652,12 @@ exports.REST_API = {
652
652
  CREATE: (namespace) => `${exports.ROOT}/${CONTROLLERS.KEY_VALUE_NAMESPACE_CONTROLLER}/${CONTROLLERS.KEY_VALUE_NAMESPACE_ROUTES.CREATE(namespace)}`,
653
653
  DELETE_BY_KEY: (namespace, key) => `${exports.ROOT}/${CONTROLLERS.KEY_VALUE_NAMESPACE_CONTROLLER}/${CONTROLLERS.KEY_VALUE_NAMESPACE_ROUTES.DELETE_BY_KEY(namespace, key)}`,
654
654
  },
655
- AI_PROXY: {
656
- IMAGE_CALLBACK: `${exports.ROOT}/${CONTROLLERS.AI_PROXY_CONTROLLER}/${CONTROLLERS.AI_PROXY_ROUTES.IMAGE_CALLBACK}`,
655
+ KIE: {
656
+ CALLBACK: `${exports.ROOT}/${CONTROLLERS.KIE_CONTROLLER}/${CONTROLLERS.KIE_ROUTES.CALLBACK}`,
657
657
  },
658
658
  CLOUD_PAYMENTS: {
659
659
  CALLBACK: `${exports.ROOT}/${CONTROLLERS.CLOUD_PAYMENTS_CONTROLLER}/${CONTROLLERS.CLOUD_PAYMENTS_ROUTES.CALLBACK}`,
660
660
  },
661
- B2B: {
662
- GET_API_TOKEN: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.GET_API_TOKEN}`,
663
- REFRESH_API_TOKEN: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.REFRESH_API_TOKEN}`,
664
- SEND_TEXT_REQUEST: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_TEXT_REQUEST}`,
665
- SEND_IMAGE_REQUEST: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_IMAGE_REQUEST}`,
666
- FILE_UPLOAD: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.FILE_UPLOAD}`,
667
- BALANCE_TOP_UP: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.BALANCE_TOP_UP}`,
668
- },
669
661
  COMMUNITY_PRIVATE: {
670
662
  GET_ALL: `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.GET_ALL}`,
671
663
  GET_MY: `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.GET_MY}`,
@@ -680,6 +672,7 @@ exports.REST_API = {
680
672
  LIKE: (uuid) => `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.LIKE(uuid)}`,
681
673
  FAVORITE: (uuid) => `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.FAVORITE(uuid)}`,
682
674
  REPORT: (uuid) => `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.REPORT(uuid)}`,
675
+ LIKES_COUNT: `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.LIKES_COUNT}`,
683
676
  },
684
677
  COMMUNITY_PUBLIC: {
685
678
  GET_ALL: `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PUBLIC}/${CONTROLLERS.COMMUNITY_ROUTES_PUBLIC.GET_ALL}`,
@@ -6,27 +6,12 @@ const models_1 = require("../../models");
6
6
  const constants_1 = require("../../constants");
7
7
  var CreateCommunityPostCommand;
8
8
  (function (CreateCommunityPostCommand) {
9
- CreateCommunityPostCommand.RequestBodySchema = zod_1.z
10
- .object({
9
+ CreateCommunityPostCommand.RequestBodySchema = zod_1.z.object({
11
10
  visibility: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_VISIBILITY),
12
11
  caption: zod_1.z.string().max(500).nullable().optional(),
13
- messageId: zod_1.z.string().uuid().nullable().optional(),
14
- toolJobId: zod_1.z.string().uuid().nullable().optional(),
15
- toolType: zod_1.z.nativeEnum(constants_1.COMMUNITY_TOOL_TYPE).nullable().optional(),
16
- })
17
- .refine((data) => {
18
- const hasMessageId = data.messageId != null;
19
- const hasToolJobId = data.toolJobId != null;
20
- if (!(hasMessageId !== hasToolJobId)) {
21
- return false;
22
- }
23
- if (hasToolJobId && data.toolType == null) {
24
- return false;
25
- }
26
- return true;
27
- }, {
28
- message: 'Either messageId or toolJobId must be provided, but not both.',
29
- path: ['messageId'],
12
+ toolJobId: zod_1.z.string().uuid(),
13
+ toolType: zod_1.z.nativeEnum(constants_1.COMMUNITY_TOOL_TYPE),
14
+ trackIndex: zod_1.z.number().optional(),
30
15
  });
31
16
  CreateCommunityPostCommand.ResponseSchema = zod_1.z.object({
32
17
  data: models_1.ResponseCommunityPostSchema,
@@ -7,8 +7,8 @@ const constants_1 = require("../../constants");
7
7
  var GetAllCommunityPostsCommand;
8
8
  (function (GetAllCommunityPostsCommand) {
9
9
  GetAllCommunityPostsCommand.RequestQuerySchema = zod_1.z.object({
10
- // Pagination
11
- cursor: zod_1.z.string().uuid().nullable().optional(),
10
+ // Pagination (cursor is base64url encoded keyset cursor)
11
+ cursor: zod_1.z.string().nullable().optional(),
12
12
  limit: zod_1.z.coerce.number().int().positive().max(100).default(30).optional(),
13
13
  // Sorting
14
14
  sortBy: zod_1.z.enum(['publishedAt', 'views', 'likesCount']).optional(),
@@ -18,8 +18,8 @@ var GetAllCommunityPostsCommand;
18
18
  type: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_TYPE).optional(),
19
19
  });
20
20
  GetAllCommunityPostsCommand.ResponseSchema = zod_1.z.object({
21
- data: zod_1.z.array(models_1.ResponseCommunityPostSchema),
22
- cursor: zod_1.z.string().uuid().nullable(),
21
+ data: zod_1.z.array(models_1.ResponseCommunityPostWithRelationsSchema),
22
+ cursor: zod_1.z.string().nullable(),
23
23
  hasNext: zod_1.z.boolean(),
24
24
  });
25
25
  })(GetAllCommunityPostsCommand || (exports.GetAllCommunityPostsCommand = GetAllCommunityPostsCommand = {}));
@@ -9,6 +9,6 @@ var GetCommunityPostByUuidCommand;
9
9
  uuid: zod_1.z.string().uuid(),
10
10
  });
11
11
  GetCommunityPostByUuidCommand.ResponseSchema = zod_1.z.object({
12
- data: models_1.ResponseCommunityPostSchema,
12
+ data: models_1.ResponseCommunityPostWithRelationsSchema,
13
13
  });
14
14
  })(GetCommunityPostByUuidCommand || (exports.GetCommunityPostByUuidCommand = GetCommunityPostByUuidCommand = {}));
@@ -7,8 +7,8 @@ const constants_1 = require("../../constants");
7
7
  var GetMyCommunityPostsByCriteriaCommand;
8
8
  (function (GetMyCommunityPostsByCriteriaCommand) {
9
9
  GetMyCommunityPostsByCriteriaCommand.RequestQuerySchema = zod_1.z.object({
10
- // Pagination
11
- cursor: zod_1.z.string().uuid().nullable().optional(),
10
+ // Pagination (cursor is base64url encoded keyset cursor)
11
+ cursor: zod_1.z.string().nullable().optional(),
12
12
  limit: zod_1.z.coerce
13
13
  .number()
14
14
  .int()
@@ -17,7 +17,7 @@ var GetMyCommunityPostsByCriteriaCommand;
17
17
  .default(constants_1.DEFAULT_PAGINATION_LIMIT)
18
18
  .optional(),
19
19
  // Sorting
20
- sortBy: zod_1.z.enum(['publishedAt', 'views', 'likesCount']).optional(),
20
+ sortBy: zod_1.z.enum(['publishedAt', 'views', 'likesCount', 'type']).optional(),
21
21
  sortOrder: zod_1.z.nativeEnum(constants_1.SORT_ORDER).optional(),
22
22
  // Criteria
23
23
  visibility: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_VISIBILITY).optional(),
@@ -25,8 +25,8 @@ var GetMyCommunityPostsByCriteriaCommand;
25
25
  status: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_STATUS).optional(),
26
26
  });
27
27
  GetMyCommunityPostsByCriteriaCommand.ResponseSchema = zod_1.z.object({
28
- data: zod_1.z.array(models_1.ResponseCommunityPostSchema),
29
- cursor: zod_1.z.string().uuid().nullable(),
28
+ data: zod_1.z.array(models_1.ResponseCommunityPostWithRelationsSchema),
29
+ cursor: zod_1.z.string().nullable(),
30
30
  hasNext: zod_1.z.boolean(),
31
31
  });
32
32
  })(GetMyCommunityPostsByCriteriaCommand || (exports.GetMyCommunityPostsByCriteriaCommand = GetMyCommunityPostsByCriteriaCommand = {}));
@@ -9,6 +9,6 @@ var SetLikeCommunityPostCommand;
9
9
  uuid: zod_1.z.string().uuid(),
10
10
  });
11
11
  SetLikeCommunityPostCommand.ResponseSchema = zod_1.z.object({
12
- data: models_1.ResponseCommunityPostSchema,
12
+ data: models_1.ResponseCommunityPostWithRelationsSchema,
13
13
  });
14
14
  })(SetLikeCommunityPostCommand || (exports.SetLikeCommunityPostCommand = SetLikeCommunityPostCommand = {}));
@@ -55,6 +55,5 @@ __exportStar(require("./daily-streak"), exports);
55
55
  __exportStar(require("./cabinet"), exports);
56
56
  __exportStar(require("./webmaster"), exports);
57
57
  __exportStar(require("./webmaster-click"), exports);
58
- __exportStar(require("./b2b"), exports);
59
58
  __exportStar(require("./community"), exports);
60
59
  __exportStar(require("./user-profile"), exports);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.COMMUNITY_TOOL_TYPE = void 0;
4
4
  var COMMUNITY_TOOL_TYPE;
5
5
  (function (COMMUNITY_TOOL_TYPE) {
6
+ COMMUNITY_TOOL_TYPE["IMAGE"] = "image";
6
7
  COMMUNITY_TOOL_TYPE["IMAGE_EDITOR"] = "image_editor";
7
8
  COMMUNITY_TOOL_TYPE["VIDEO"] = "video";
8
9
  COMMUNITY_TOOL_TYPE["VIDEO_EDITOR"] = "video_editor";
@@ -2607,29 +2607,24 @@ exports.ERRORS = {
2607
2607
  message: 'Произошла ошибка при установке оценки презентации',
2608
2608
  httpCode: 500,
2609
2609
  },
2610
- FAILED_TO_GENERATE_API_KEY: {
2610
+ USER_NOT_FOUND_AGGREGATE_ERROR: {
2611
2611
  code: 'A532',
2612
- message: 'Не удалось сгенерировать ключ API',
2612
+ message: 'Произошла ошибка при получении пользователя',
2613
2613
  httpCode: 500,
2614
2614
  },
2615
- FAILED_TO_REFRESH_API_KEY: {
2615
+ IMAGE_GENERATION_MODEL_FIND_ERROR: {
2616
2616
  code: 'A533',
2617
- message: 'Не удалось обновить ключ API',
2617
+ message: 'Произошла ошибка при получении модели для генерации изображений',
2618
2618
  httpCode: 500,
2619
2619
  },
2620
- API_KEY_NOT_FOUND: {
2620
+ COMMUNITY_POST_TRACK_INDEX_REQUIRED: {
2621
2621
  code: 'A534',
2622
- message: 'Ключ API не найден',
2623
- httpCode: 404,
2622
+ message: 'Индекс трека обязателен для музыкального поста',
2623
+ httpCode: 400,
2624
2624
  },
2625
- API_KEY_IS_INACTIVE: {
2625
+ COMMUNITY_POST_TRACK_INDEX_OUT_OF_RANGE: {
2626
2626
  code: 'A535',
2627
- message: 'Ключ API не активен',
2628
- httpCode: 403,
2629
- },
2630
- API_KEY_ALREADY_EXISTS: {
2631
- code: 'A536',
2632
- message: 'Ключ API уже существует, если потеряли ключ воспользуйтесь GET token/refresh',
2633
- httpCode: 409,
2627
+ message: 'Индекс трека выходит за пределы допустимого диапазона',
2628
+ httpCode: 400,
2634
2629
  },
2635
2630
  };
@@ -4,5 +4,4 @@ exports.FORM_TYPE = void 0;
4
4
  var FORM_TYPE;
5
5
  (function (FORM_TYPE) {
6
6
  FORM_TYPE["PARTNERSHIP"] = "partnership";
7
- FORM_TYPE["B2B"] = "b2b_balance_top_up";
8
7
  })(FORM_TYPE || (exports.FORM_TYPE = FORM_TYPE = {}));
@@ -36,13 +36,13 @@ exports.MusicCommunityMediaSchema = zod_1.z.object({
36
36
  type: zod_1.z.literal(constants_1.COMMUNITY_POST_TYPE.MUSIC),
37
37
  params: tools_1.MusicJobParamsSchema,
38
38
  prompt: zod_1.z.string(),
39
- tracks: zod_1.z.array(music_track_schema_1.MusicTrackSchema.pick({
39
+ track: music_track_schema_1.MusicTrackSchema.pick({
40
40
  audioUrl: true,
41
41
  coverUrl: true,
42
42
  duration: true,
43
43
  title: true,
44
44
  tags: true,
45
- })),
45
+ }),
46
46
  });
47
47
  exports.CommunityPostMediaDataSchema = zod_1.z.discriminatedUnion('type', [
48
48
  exports.ImageCommunityMediaSchema,
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResponseCommunityPostSchema = exports.CommunityPostSchema = void 0;
3
+ exports.ResponseCommunityPostWithRelationsSchema = exports.ResponseCommunityPostSchema = exports.CommunityPostSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../constants");
6
6
  const community_post_media_data_schema_1 = require("./community-post-media-data.schema");
7
7
  const icon_variants_schema_1 = require("../icon-variants.schema");
8
+ const user_profile_schema_1 = require("../user-profile.schema");
8
9
  exports.CommunityPostSchema = zod_1.z.object({
9
10
  uuid: zod_1.z.string().uuid(),
10
11
  userId: zod_1.z.string().uuid(),
@@ -42,3 +43,20 @@ exports.ResponseCommunityPostSchema = zod_1.z.object({
42
43
  likesCount: zod_1.z.number(),
43
44
  publishedAt: zod_1.z.date().nullable(),
44
45
  });
46
+ exports.ResponseCommunityPostWithRelationsSchema = zod_1.z.object({
47
+ uuid: zod_1.z.string().uuid(),
48
+ userProfile: user_profile_schema_1.UserProfileResponseSchema,
49
+ caption: zod_1.z.string().nullable(),
50
+ status: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_STATUS),
51
+ visibility: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_VISIBILITY),
52
+ type: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_TYPE),
53
+ mediaData: community_post_media_data_schema_1.CommunityPostMediaDataSchema,
54
+ aiModelId: zod_1.z.string().uuid(),
55
+ aiModelTitle: zod_1.z.string(),
56
+ aiModelIcons: icon_variants_schema_1.IconVariantsSchema,
57
+ isLikedByCurrentUser: zod_1.z.boolean(),
58
+ isFavoritedByCurrentUser: zod_1.z.boolean(),
59
+ views: zod_1.z.number(),
60
+ likesCount: zod_1.z.number(),
61
+ publishedAt: zod_1.z.date().nullable(),
62
+ });
@@ -70,6 +70,5 @@ __exportStar(require("./webmaster.schema"), exports);
70
70
  __exportStar(require("./webmaster-balance.schema"), exports);
71
71
  __exportStar(require("./user-referrals.schema"), exports);
72
72
  __exportStar(require("./webmaster-click.schema"), exports);
73
- __exportStar(require("./api-key.schema"), exports);
74
73
  __exportStar(require("./community"), exports);
75
74
  __exportStar(require("./user-profile.schema"), exports);
@@ -3,34 +3,13 @@ import { ResponseCommunityPostSchema } from '../../models';
3
3
  import { COMMUNITY_POST_VISIBILITY, COMMUNITY_TOOL_TYPE } from '../../constants';
4
4
 
5
5
  export namespace CreateCommunityPostCommand {
6
- export const RequestBodySchema = z
7
- .object({
8
- visibility: z.nativeEnum(COMMUNITY_POST_VISIBILITY),
9
- caption: z.string().max(500).nullable().optional(),
10
- messageId: z.string().uuid().nullable().optional(),
11
- toolJobId: z.string().uuid().nullable().optional(),
12
- toolType: z.nativeEnum(COMMUNITY_TOOL_TYPE).nullable().optional(),
13
- })
14
- .refine(
15
- (data) => {
16
- const hasMessageId = data.messageId != null;
17
- const hasToolJobId = data.toolJobId != null;
18
-
19
- if (!(hasMessageId !== hasToolJobId)) {
20
- return false;
21
- }
22
-
23
- if (hasToolJobId && data.toolType == null) {
24
- return false;
25
- }
26
-
27
- return true;
28
- },
29
- {
30
- message: 'Either messageId or toolJobId must be provided, but not both.',
31
- path: ['messageId'],
32
- },
33
- );
6
+ export const RequestBodySchema = z.object({
7
+ visibility: z.nativeEnum(COMMUNITY_POST_VISIBILITY),
8
+ caption: z.string().max(500).nullable().optional(),
9
+ toolJobId: z.string().uuid(),
10
+ toolType: z.nativeEnum(COMMUNITY_TOOL_TYPE),
11
+ trackIndex: z.number().optional(),
12
+ });
34
13
  export type RequestBody = z.infer<typeof RequestBodySchema>;
35
14
 
36
15
  export const ResponseSchema = z.object({
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { ResponseCommunityPostSchema } from '../../models';
2
+ import { ResponseCommunityPostWithRelationsSchema } from '../../models';
3
3
  import { SORT_ORDER, COMMUNITY_POST_TYPE } from '../../constants';
4
4
 
5
5
  export namespace GetAllCommunityPostsCommand {
6
6
  export const RequestQuerySchema = z.object({
7
- // Pagination
8
- cursor: z.string().uuid().nullable().optional(),
7
+ // Pagination (cursor is base64url encoded keyset cursor)
8
+ cursor: z.string().nullable().optional(),
9
9
  limit: z.coerce.number().int().positive().max(100).default(30).optional(),
10
10
 
11
11
  // Sorting
@@ -20,8 +20,8 @@ export namespace GetAllCommunityPostsCommand {
20
20
  export type RequestQuery = z.infer<typeof RequestQuerySchema>;
21
21
 
22
22
  export const ResponseSchema = z.object({
23
- data: z.array(ResponseCommunityPostSchema),
24
- cursor: z.string().uuid().nullable(),
23
+ data: z.array(ResponseCommunityPostWithRelationsSchema),
24
+ cursor: z.string().nullable(),
25
25
  hasNext: z.boolean(),
26
26
  });
27
27
 
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ResponseCommunityPostSchema } from '../../models';
2
+ import { ResponseCommunityPostWithRelationsSchema } from '../../models';
3
3
 
4
4
  export namespace GetCommunityPostByUuidCommand {
5
5
  export const RequestSchema = z.object({
@@ -9,7 +9,7 @@ export namespace GetCommunityPostByUuidCommand {
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
11
  export const ResponseSchema = z.object({
12
- data: ResponseCommunityPostSchema,
12
+ data: ResponseCommunityPostWithRelationsSchema,
13
13
  });
14
14
 
15
15
  export type Response = z.infer<typeof ResponseSchema>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ResponseCommunityPostSchema } from '../../models';
2
+ import { ResponseCommunityPostWithRelationsSchema } from '../../models';
3
3
  import {
4
4
  COMMUNITY_POST_STATUS,
5
5
  COMMUNITY_POST_TYPE,
@@ -10,8 +10,8 @@ import {
10
10
 
11
11
  export namespace GetMyCommunityPostsByCriteriaCommand {
12
12
  export const RequestQuerySchema = z.object({
13
- // Pagination
14
- cursor: z.string().uuid().nullable().optional(),
13
+ // Pagination (cursor is base64url encoded keyset cursor)
14
+ cursor: z.string().nullable().optional(),
15
15
  limit: z.coerce
16
16
  .number()
17
17
  .int()
@@ -21,7 +21,7 @@ export namespace GetMyCommunityPostsByCriteriaCommand {
21
21
  .optional(),
22
22
 
23
23
  // Sorting
24
- sortBy: z.enum(['publishedAt', 'views', 'likesCount']).optional(),
24
+ sortBy: z.enum(['publishedAt', 'views', 'likesCount', 'type']).optional(),
25
25
  sortOrder: z.nativeEnum(SORT_ORDER).optional(),
26
26
 
27
27
  // Criteria
@@ -32,8 +32,8 @@ export namespace GetMyCommunityPostsByCriteriaCommand {
32
32
  export type RequestQuery = z.infer<typeof RequestQuerySchema>;
33
33
 
34
34
  export const ResponseSchema = z.object({
35
- data: z.array(ResponseCommunityPostSchema),
36
- cursor: z.string().uuid().nullable(),
35
+ data: z.array(ResponseCommunityPostWithRelationsSchema),
36
+ cursor: z.string().nullable(),
37
37
  hasNext: z.boolean(),
38
38
  });
39
39
  export type Response = z.infer<typeof ResponseSchema>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ResponseCommunityPostSchema } from '../../models';
2
+ import { ResponseCommunityPostWithRelationsSchema } from '../../models';
3
3
 
4
4
  export namespace SetLikeCommunityPostCommand {
5
5
  export const RequestParamsSchema = z.object({
@@ -8,7 +8,7 @@ export namespace SetLikeCommunityPostCommand {
8
8
  export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
9
 
10
10
  export const ResponseSchema = z.object({
11
- data: ResponseCommunityPostSchema,
11
+ data: ResponseCommunityPostWithRelationsSchema,
12
12
  });
13
13
  export type Response = z.infer<typeof ResponseSchema>;
14
14
  }
package/commands/index.ts CHANGED
@@ -39,6 +39,5 @@ export * from './daily-streak';
39
39
  export * from './cabinet';
40
40
  export * from './webmaster';
41
41
  export * from './webmaster-click';
42
- export * from './b2b';
43
42
  export * from './community';
44
43
  export * from './user-profile';
@@ -1,4 +1,5 @@
1
1
  export enum COMMUNITY_TOOL_TYPE {
2
+ IMAGE = 'image',
2
3
  IMAGE_EDITOR = 'image_editor',
3
4
  VIDEO = 'video',
4
5
  VIDEO_EDITOR = 'video_editor',
@@ -2616,29 +2616,24 @@ export const ERRORS = {
2616
2616
  message: 'Произошла ошибка при установке оценки презентации',
2617
2617
  httpCode: 500,
2618
2618
  },
2619
- FAILED_TO_GENERATE_API_KEY: {
2619
+ USER_NOT_FOUND_AGGREGATE_ERROR: {
2620
2620
  code: 'A532',
2621
- message: 'Не удалось сгенерировать ключ API',
2621
+ message: 'Произошла ошибка при получении пользователя',
2622
2622
  httpCode: 500,
2623
2623
  },
2624
- FAILED_TO_REFRESH_API_KEY: {
2624
+ IMAGE_GENERATION_MODEL_FIND_ERROR: {
2625
2625
  code: 'A533',
2626
- message: 'Не удалось обновить ключ API',
2626
+ message: 'Произошла ошибка при получении модели для генерации изображений',
2627
2627
  httpCode: 500,
2628
2628
  },
2629
- API_KEY_NOT_FOUND: {
2629
+ COMMUNITY_POST_TRACK_INDEX_REQUIRED: {
2630
2630
  code: 'A534',
2631
- message: 'Ключ API не найден',
2632
- httpCode: 404,
2631
+ message: 'Индекс трека обязателен для музыкального поста',
2632
+ httpCode: 400,
2633
2633
  },
2634
- API_KEY_IS_INACTIVE: {
2634
+ COMMUNITY_POST_TRACK_INDEX_OUT_OF_RANGE: {
2635
2635
  code: 'A535',
2636
- message: 'Ключ API не активен',
2637
- httpCode: 403,
2638
- },
2639
- API_KEY_ALREADY_EXISTS: {
2640
- code: 'A536',
2641
- message: 'Ключ API уже существует, если потеряли ключ воспользуйтесь GET token/refresh',
2642
- httpCode: 409,
2636
+ message: 'Индекс трека выходит за пределы допустимого диапазона',
2637
+ httpCode: 400,
2643
2638
  },
2644
2639
  };
@@ -1,4 +1,3 @@
1
1
  export enum FORM_TYPE {
2
2
  PARTNERSHIP = 'partnership',
3
- B2B = 'b2b_balance_top_up',
4
3
  }
@@ -38,15 +38,13 @@ export const MusicCommunityMediaSchema = z.object({
38
38
  type: z.literal(COMMUNITY_POST_TYPE.MUSIC),
39
39
  params: MusicJobParamsSchema,
40
40
  prompt: z.string(),
41
- tracks: z.array(
42
- MusicTrackSchema.pick({
43
- audioUrl: true,
44
- coverUrl: true,
45
- duration: true,
46
- title: true,
47
- tags: true,
48
- }),
49
- ),
41
+ track: MusicTrackSchema.pick({
42
+ audioUrl: true,
43
+ coverUrl: true,
44
+ duration: true,
45
+ title: true,
46
+ tags: true,
47
+ }),
50
48
  });
51
49
 
52
50
  export const CommunityPostMediaDataSchema = z.discriminatedUnion('type', [
@@ -7,6 +7,7 @@ import {
7
7
  } from '../../constants';
8
8
  import { CommunityPostMediaDataSchema } from './community-post-media-data.schema';
9
9
  import { IconVariantsSchema } from '../icon-variants.schema';
10
+ import { UserProfileResponseSchema } from '../user-profile.schema';
10
11
 
11
12
  export const CommunityPostSchema = z.object({
12
13
  uuid: z.string().uuid(),
@@ -46,3 +47,21 @@ export const ResponseCommunityPostSchema = z.object({
46
47
  likesCount: z.number(),
47
48
  publishedAt: z.date().nullable(),
48
49
  });
50
+
51
+ export const ResponseCommunityPostWithRelationsSchema = z.object({
52
+ uuid: z.string().uuid(),
53
+ userProfile: UserProfileResponseSchema,
54
+ caption: z.string().nullable(),
55
+ status: z.nativeEnum(COMMUNITY_POST_STATUS),
56
+ visibility: z.nativeEnum(COMMUNITY_POST_VISIBILITY),
57
+ type: z.nativeEnum(COMMUNITY_POST_TYPE),
58
+ mediaData: CommunityPostMediaDataSchema,
59
+ aiModelId: z.string().uuid(),
60
+ aiModelTitle: z.string(),
61
+ aiModelIcons: IconVariantsSchema,
62
+ isLikedByCurrentUser: z.boolean(),
63
+ isFavoritedByCurrentUser: z.boolean(),
64
+ views: z.number(),
65
+ likesCount: z.number(),
66
+ publishedAt: z.date().nullable(),
67
+ });
package/models/index.ts CHANGED
@@ -54,6 +54,5 @@ export * from './webmaster.schema';
54
54
  export * from './webmaster-balance.schema';
55
55
  export * from './user-referrals.schema';
56
56
  export * from './webmaster-click.schema';
57
- export * from './api-key.schema';
58
57
  export * from './community';
59
58
  export * from './user-profile.schema';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.8.59",
3
+ "version": "0.8.61",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,5 +0,0 @@
1
- export const AI_PROXY_CONTROLLER = 'ai-proxy' as const;
2
-
3
- export const AI_PROXY_ROUTES = {
4
- IMAGE_CALLBACK: 'image-callback',
5
- } as const;
@@ -1,10 +0,0 @@
1
- export const B2B_CONTROLLER = 'private/b2b' as const;
2
-
3
- export const B2B_ROUTES = {
4
- GET_API_TOKEN: 'token',
5
- REFRESH_API_TOKEN: 'token/refresh',
6
- SEND_TEXT_REQUEST: 'completions',
7
- SEND_IMAGE_REQUEST: 'image/generation',
8
- FILE_UPLOAD: 'file/upload',
9
- BALANCE_TOP_UP: 'balance/top-up',
10
- } as const;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AI_PROXY_ROUTES = exports.AI_PROXY_CONTROLLER = void 0;
4
- exports.AI_PROXY_CONTROLLER = 'ai-proxy';
5
- exports.AI_PROXY_ROUTES = {
6
- IMAGE_CALLBACK: 'image-callback',
7
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.B2B_ROUTES = exports.B2B_CONTROLLER = void 0;
4
- exports.B2B_CONTROLLER = 'private/b2b';
5
- exports.B2B_ROUTES = {
6
- GET_API_TOKEN: 'token',
7
- REFRESH_API_TOKEN: 'token/refresh',
8
- SEND_TEXT_REQUEST: 'completions',
9
- SEND_IMAGE_REQUEST: 'image/generation',
10
- FILE_UPLOAD: 'file/upload',
11
- BALANCE_TOP_UP: 'balance/top-up',
12
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetApiKeyCommand = void 0;
4
- const zod_1 = require("zod");
5
- var GetApiKeyCommand;
6
- (function (GetApiKeyCommand) {
7
- GetApiKeyCommand.ResponseSchema = zod_1.z.object({
8
- data: zod_1.z.object({
9
- apiKey: zod_1.z.string(),
10
- }),
11
- });
12
- })(GetApiKeyCommand || (exports.GetApiKeyCommand = GetApiKeyCommand = {}));
@@ -1,21 +0,0 @@
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("./get-api-key.command"), exports);
18
- __exportStar(require("./refresh-api-key.command"), exports);
19
- __exportStar(require("./send-text-request.command"), exports);
20
- __exportStar(require("./send-image-request.command"), exports);
21
- __exportStar(require("./submit-balance-top-up-form.command"), exports);
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RefreshApiKeyCommand = void 0;
4
- const zod_1 = require("zod");
5
- var RefreshApiKeyCommand;
6
- (function (RefreshApiKeyCommand) {
7
- RefreshApiKeyCommand.ResponseSchema = zod_1.z.object({
8
- data: zod_1.z.object({
9
- apiKey: zod_1.z.string(),
10
- }),
11
- });
12
- })(RefreshApiKeyCommand || (exports.RefreshApiKeyCommand = RefreshApiKeyCommand = {}));
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SendImageRequestCommand = void 0;
4
- const zod_1 = require("zod");
5
- const constants_1 = require("../../constants");
6
- var SendImageRequestCommand;
7
- (function (SendImageRequestCommand) {
8
- SendImageRequestCommand.RequestSchema = zod_1.z.object({
9
- model: zod_1.z.string(),
10
- prompt: zod_1.z.string(),
11
- params: zod_1.z.array(zod_1.z.object({
12
- type: zod_1.z.nativeEnum(constants_1.AI_MODEL_CONFIG_PARAM),
13
- option: zod_1.z.string().uuid(),
14
- })),
15
- refinePrompt: zod_1.z.boolean().default(false),
16
- features: zod_1.z.array(zod_1.z.nativeEnum(constants_1.AI_MODEL_FEATURE)).optional().default([]),
17
- files: zod_1.z.array(zod_1.z.string().uuid()).optional().default([]),
18
- });
19
- SendImageRequestCommand.ResponseSchema = zod_1.z.object({
20
- data: zod_1.z.object({
21
- urls: zod_1.z.array(zod_1.z.string()),
22
- }),
23
- });
24
- })(SendImageRequestCommand || (exports.SendImageRequestCommand = SendImageRequestCommand = {}));
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SendTextRequestCommand = void 0;
4
- const zod_1 = require("zod");
5
- const constants_1 = require("../../constants");
6
- var SendTextRequestCommand;
7
- (function (SendTextRequestCommand) {
8
- SendTextRequestCommand.BodySchema = zod_1.z.object({
9
- model: zod_1.z.string(),
10
- prompt: zod_1.z.string(),
11
- files: zod_1.z.array(zod_1.z.string().uuid()),
12
- features: zod_1.z.array(zod_1.z.nativeEnum(constants_1.AI_MODEL_FEATURE)),
13
- });
14
- SendTextRequestCommand.HeadersSchema = zod_1.z.object({
15
- 'x-rugpt-key': zod_1.z.string(),
16
- });
17
- SendTextRequestCommand.ResponseSchema = zod_1.z.object({
18
- data: zod_1.z.object({
19
- text: zod_1.z.string(),
20
- }),
21
- });
22
- })(SendTextRequestCommand || (exports.SendTextRequestCommand = SendTextRequestCommand = {}));
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubmitBalanceTopUpFormCommand = void 0;
4
- const zod_1 = require("zod");
5
- const constants_1 = require("../../constants");
6
- var SubmitBalanceTopUpFormCommand;
7
- (function (SubmitBalanceTopUpFormCommand) {
8
- SubmitBalanceTopUpFormCommand.BodySchema = zod_1.z.object({
9
- organizationType: zod_1.z.nativeEnum(constants_1.ORGANIZATION_TYPE),
10
- tin: zod_1.z.string().regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр'),
11
- telegram: zod_1.z.string(),
12
- amount: zod_1.z.number().int().min(10000, {
13
- message: 'Minimum top-up amount is 10000',
14
- }),
15
- });
16
- SubmitBalanceTopUpFormCommand.ResponseSchema = zod_1.z.object({
17
- data: zod_1.z.object({
18
- isSuccess: zod_1.z.boolean(),
19
- }),
20
- });
21
- })(SubmitBalanceTopUpFormCommand || (exports.SubmitBalanceTopUpFormCommand = SubmitBalanceTopUpFormCommand = {}));
@@ -1,15 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ApiKeySchema = void 0;
7
- const zod_1 = __importDefault(require("zod"));
8
- exports.ApiKeySchema = zod_1.default.object({
9
- uuid: zod_1.default.string().uuid(),
10
- userId: zod_1.default.string().uuid(),
11
- key: zod_1.default.string(),
12
- isActive: zod_1.default.boolean(),
13
- createdAt: zod_1.default.date(),
14
- updatedAt: zod_1.default.date(),
15
- });
@@ -1,11 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export namespace GetApiKeyCommand {
4
- export const ResponseSchema = z.object({
5
- data: z.object({
6
- apiKey: z.string(),
7
- }),
8
- });
9
-
10
- export type Response = z.infer<typeof ResponseSchema>;
11
- }
@@ -1,5 +0,0 @@
1
- export * from './get-api-key.command';
2
- export * from './refresh-api-key.command';
3
- export * from './send-text-request.command';
4
- export * from './send-image-request.command';
5
- export * from './submit-balance-top-up-form.command';
@@ -1,11 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export namespace RefreshApiKeyCommand {
4
- export const ResponseSchema = z.object({
5
- data: z.object({
6
- apiKey: z.string(),
7
- }),
8
- });
9
-
10
- export type Response = z.infer<typeof ResponseSchema>;
11
- }
@@ -1,28 +0,0 @@
1
- import { z } from 'zod';
2
- import { AI_MODEL_CONFIG_PARAM, AI_MODEL_FEATURE } from '../../constants';
3
-
4
- export namespace SendImageRequestCommand {
5
- export const RequestSchema = z.object({
6
- model: z.string(),
7
- prompt: z.string(),
8
- params: z.array(
9
- z.object({
10
- type: z.nativeEnum(AI_MODEL_CONFIG_PARAM),
11
- option: z.string().uuid(),
12
- }),
13
- ),
14
- refinePrompt: z.boolean().default(false),
15
- features: z.array(z.nativeEnum(AI_MODEL_FEATURE)).optional().default([]),
16
- files: z.array(z.string().uuid()).optional().default([]),
17
- });
18
-
19
- export type Request = z.infer<typeof RequestSchema>;
20
-
21
- export const ResponseSchema = z.object({
22
- data: z.object({
23
- urls: z.array(z.string()),
24
- }),
25
- });
26
-
27
- export type Response = z.infer<typeof ResponseSchema>;
28
- }
@@ -1,26 +0,0 @@
1
- import { z } from 'zod';
2
- import { AI_MODEL_FEATURE } from '../../constants';
3
-
4
- export namespace SendTextRequestCommand {
5
- export const BodySchema = z.object({
6
- model: z.string(),
7
- prompt: z.string(),
8
- files: z.array(z.string().uuid()),
9
- features: z.array(z.nativeEnum(AI_MODEL_FEATURE)),
10
- });
11
-
12
- export const HeadersSchema = z.object({
13
- 'x-rugpt-key': z.string(),
14
- });
15
-
16
- export const ResponseSchema = z.object({
17
- data: z.object({
18
- text: z.string(),
19
- }),
20
- });
21
-
22
- // ✅ Types
23
- export type Body = z.infer<typeof BodySchema>;
24
- export type Headers = z.infer<typeof HeadersSchema>;
25
- export type Response = z.infer<typeof ResponseSchema>;
26
- }
@@ -1,22 +0,0 @@
1
- import { z } from 'zod';
2
- import { ORGANIZATION_TYPE } from '../../constants';
3
-
4
- export namespace SubmitBalanceTopUpFormCommand {
5
- export const BodySchema = z.object({
6
- organizationType: z.nativeEnum(ORGANIZATION_TYPE),
7
- tin: z.string().regex(/^\d{10}$|^\d{12}$/, 'ИНН должен быть длинной в 10 или 12 цифр'),
8
- telegram: z.string(),
9
- amount: z.number().int().min(10000, {
10
- message: 'Minimum top-up amount is 10000',
11
- }),
12
- });
13
-
14
- export const ResponseSchema = z.object({
15
- data: z.object({
16
- isSuccess: z.boolean(),
17
- }),
18
- });
19
-
20
- export type Body = z.infer<typeof BodySchema>;
21
- export type Response = z.infer<typeof ResponseSchema>;
22
- }
@@ -1,10 +0,0 @@
1
- import z from 'zod';
2
-
3
- export const ApiKeySchema = z.object({
4
- uuid: z.string().uuid(),
5
- userId: z.string().uuid(),
6
- key: z.string(),
7
- isActive: z.boolean(),
8
- createdAt: z.date(),
9
- updatedAt: z.date(),
10
- });