@purpleschool/gptbot 0.8.60 → 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 (51) hide show
  1. package/api/controllers/http/chat-private.ts +1 -0
  2. package/api/controllers/http/index.ts +1 -1
  3. package/api/controllers/http/kie.ts +5 -0
  4. package/api/routes.ts +6 -8
  5. package/build/api/controllers/http/chat-private.js +1 -0
  6. package/build/api/controllers/http/index.js +1 -1
  7. package/build/api/controllers/http/kie.js +7 -0
  8. package/build/api/routes.js +5 -8
  9. package/build/commands/community/create-community-post.command.js +4 -19
  10. package/build/commands/community/get-all-community-posts-by-criteria.command.js +4 -4
  11. package/build/commands/community/get-community-post-by-uuid.command.js +1 -1
  12. package/build/commands/community/get-my-community-posts-by-criteria.command.js +5 -5
  13. package/build/commands/community/set-like-community-post.command.js +1 -1
  14. package/build/commands/index.js +0 -1
  15. package/build/commands/{b2b/send-image-request.command.js → message/create-image-message.command.js} +12 -11
  16. package/build/commands/message/index.js +1 -0
  17. package/build/constants/community/enums/community-tool-type.enum.js +1 -0
  18. package/build/constants/errors/errors.js +10 -15
  19. package/build/constants/form-submission/enums/form-type.enum.js +0 -1
  20. package/build/models/community/community-post-media-data.schema.js +2 -2
  21. package/build/models/community/community-post.schema.js +19 -1
  22. package/build/models/index.js +0 -1
  23. package/commands/community/create-community-post.command.ts +7 -28
  24. package/commands/community/get-all-community-posts-by-criteria.command.ts +5 -5
  25. package/commands/community/get-community-post-by-uuid.command.ts +2 -2
  26. package/commands/community/get-my-community-posts-by-criteria.command.ts +6 -6
  27. package/commands/community/set-like-community-post.command.ts +2 -2
  28. package/commands/index.ts +0 -1
  29. package/commands/{b2b/send-image-request.command.ts → message/create-image-message.command.ts} +8 -6
  30. package/commands/message/index.ts +1 -0
  31. package/constants/community/enums/community-tool-type.enum.ts +1 -0
  32. package/constants/errors/errors.ts +10 -15
  33. package/constants/form-submission/enums/form-type.enum.ts +0 -1
  34. package/models/community/community-post-media-data.schema.ts +7 -9
  35. package/models/community/community-post.schema.ts +19 -0
  36. package/models/index.ts +0 -1
  37. package/package.json +1 -1
  38. package/api/controllers/http/b2b.ts +0 -10
  39. package/build/api/controllers/http/b2b.js +0 -12
  40. package/build/commands/b2b/get-api-key.command.js +0 -12
  41. package/build/commands/b2b/index.js +0 -21
  42. package/build/commands/b2b/refresh-api-key.command.js +0 -12
  43. package/build/commands/b2b/send-text-request.command.js +0 -22
  44. package/build/commands/b2b/submit-balance-top-up-form.command.js +0 -21
  45. package/build/models/api-key.schema.js +0 -15
  46. package/commands/b2b/get-api-key.command.ts +0 -11
  47. package/commands/b2b/index.ts +0 -5
  48. package/commands/b2b/refresh-api-key.command.ts +0 -11
  49. package/commands/b2b/send-text-request.command.ts +0 -26
  50. package/commands/b2b/submit-balance-top-up-form.command.ts +0 -22
  51. package/models/api-key.schema.ts +0 -10
@@ -9,6 +9,7 @@ export const CHAT_PRIVATE_ROUTES = {
9
9
  FIND_MANY: '',
10
10
  FIND_BY_UUID: (uuid: string) => `${uuid}`,
11
11
  SEND_TEXT_MESSAGE: (uuid: string) => `${uuid}/messages/text`,
12
+ SEND_IMAGE_MESSAGE: (uuid: string) => `${uuid}/messages/image`,
12
13
  ARCHIVE: 'archive',
13
14
  DELETE: (uuid: string) => `${uuid}`,
14
15
  UPDATE: (uuid: string) => `${uuid}`,
@@ -14,6 +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 './kie';
17
18
  export * from './page';
18
19
  export * from './payment';
19
20
  export * from './presentation';
@@ -52,7 +53,6 @@ export * from './cabinet';
52
53
  export * from './webmaster';
53
54
  export * from './music';
54
55
  export * from './webmaster-click';
55
- export * from './b2b';
56
56
  export * from './community';
57
57
  export * from './user-profile';
58
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
@@ -104,6 +104,8 @@ export const REST_API = {
104
104
  `${ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.SEND_TEXT_MESSAGE(uuid)}`,
105
105
  CREATE_SUGGESTIONS: (uuid: string) =>
106
106
  `${ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.CREATE_SUGGESTIONS(uuid)}`,
107
+ SEND_IMAGE_MESSAGE: (uuid: string) =>
108
+ `${ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.SEND_IMAGE_MESSAGE(uuid)}`,
107
109
  ARCHIVE: `${ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.ARCHIVE}`,
108
110
  DELETE: (uuid: string) =>
109
111
  `${ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.DELETE(uuid)}`,
@@ -842,17 +844,12 @@ export const REST_API = {
842
844
  DELETE_BY_KEY: (namespace: string, key: string) =>
843
845
  `${ROOT}/${CONTROLLERS.KEY_VALUE_NAMESPACE_CONTROLLER}/${CONTROLLERS.KEY_VALUE_NAMESPACE_ROUTES.DELETE_BY_KEY(namespace, key)}`,
844
846
  },
847
+ KIE: {
848
+ CALLBACK: `${ROOT}/${CONTROLLERS.KIE_CONTROLLER}/${CONTROLLERS.KIE_ROUTES.CALLBACK}`,
849
+ },
845
850
  CLOUD_PAYMENTS: {
846
851
  CALLBACK: `${ROOT}/${CONTROLLERS.CLOUD_PAYMENTS_CONTROLLER}/${CONTROLLERS.CLOUD_PAYMENTS_ROUTES.CALLBACK}`,
847
852
  },
848
- B2B: {
849
- GET_API_TOKEN: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.GET_API_TOKEN}`,
850
- REFRESH_API_TOKEN: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.REFRESH_API_TOKEN}`,
851
- SEND_TEXT_REQUEST: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_TEXT_REQUEST}`,
852
- SEND_IMAGE_REQUEST: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_IMAGE_REQUEST}`,
853
- FILE_UPLOAD: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.FILE_UPLOAD}`,
854
- BALANCE_TOP_UP: `${ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.BALANCE_TOP_UP}`,
855
- },
856
853
  COMMUNITY_PRIVATE: {
857
854
  GET_ALL: `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.GET_ALL}`,
858
855
  GET_MY: `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.GET_MY}`,
@@ -875,6 +872,7 @@ export const REST_API = {
875
872
  `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.FAVORITE(uuid)}`,
876
873
  REPORT: (uuid: string) =>
877
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}`,
878
876
  },
879
877
  COMMUNITY_PUBLIC: {
880
878
  GET_ALL: `${ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PUBLIC}/${CONTROLLERS.COMMUNITY_ROUTES_PUBLIC.GET_ALL}`,
@@ -11,6 +11,7 @@ exports.CHAT_PRIVATE_ROUTES = {
11
11
  FIND_MANY: '',
12
12
  FIND_BY_UUID: (uuid) => `${uuid}`,
13
13
  SEND_TEXT_MESSAGE: (uuid) => `${uuid}/messages/text`,
14
+ SEND_IMAGE_MESSAGE: (uuid) => `${uuid}/messages/image`,
14
15
  ARCHIVE: 'archive',
15
16
  DELETE: (uuid) => `${uuid}`,
16
17
  UPDATE: (uuid) => `${uuid}`,
@@ -30,6 +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("./kie"), exports);
33
34
  __exportStar(require("./page"), exports);
34
35
  __exportStar(require("./payment"), exports);
35
36
  __exportStar(require("./presentation"), exports);
@@ -68,7 +69,6 @@ __exportStar(require("./cabinet"), exports);
68
69
  __exportStar(require("./webmaster"), exports);
69
70
  __exportStar(require("./music"), exports);
70
71
  __exportStar(require("./webmaster-click"), exports);
71
- __exportStar(require("./b2b"), exports);
72
72
  __exportStar(require("./community"), exports);
73
73
  __exportStar(require("./user-profile"), exports);
74
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
+ };
@@ -123,6 +123,7 @@ exports.REST_API = {
123
123
  FIND_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.FIND_BY_UUID(uuid)}`,
124
124
  SEND_TEXT_MESSAGE: (uuid) => `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.SEND_TEXT_MESSAGE(uuid)}`,
125
125
  CREATE_SUGGESTIONS: (uuid) => `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.CREATE_SUGGESTIONS(uuid)}`,
126
+ SEND_IMAGE_MESSAGE: (uuid) => `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.SEND_IMAGE_MESSAGE(uuid)}`,
126
127
  ARCHIVE: `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.ARCHIVE}`,
127
128
  DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.DELETE(uuid)}`,
128
129
  UPDATE: (uuid) => `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.UPDATE(uuid)}`,
@@ -651,17 +652,12 @@ exports.REST_API = {
651
652
  CREATE: (namespace) => `${exports.ROOT}/${CONTROLLERS.KEY_VALUE_NAMESPACE_CONTROLLER}/${CONTROLLERS.KEY_VALUE_NAMESPACE_ROUTES.CREATE(namespace)}`,
652
653
  DELETE_BY_KEY: (namespace, key) => `${exports.ROOT}/${CONTROLLERS.KEY_VALUE_NAMESPACE_CONTROLLER}/${CONTROLLERS.KEY_VALUE_NAMESPACE_ROUTES.DELETE_BY_KEY(namespace, key)}`,
653
654
  },
655
+ KIE: {
656
+ CALLBACK: `${exports.ROOT}/${CONTROLLERS.KIE_CONTROLLER}/${CONTROLLERS.KIE_ROUTES.CALLBACK}`,
657
+ },
654
658
  CLOUD_PAYMENTS: {
655
659
  CALLBACK: `${exports.ROOT}/${CONTROLLERS.CLOUD_PAYMENTS_CONTROLLER}/${CONTROLLERS.CLOUD_PAYMENTS_ROUTES.CALLBACK}`,
656
660
  },
657
- B2B: {
658
- GET_API_TOKEN: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.GET_API_TOKEN}`,
659
- REFRESH_API_TOKEN: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.REFRESH_API_TOKEN}`,
660
- SEND_TEXT_REQUEST: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_TEXT_REQUEST}`,
661
- SEND_IMAGE_REQUEST: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.SEND_IMAGE_REQUEST}`,
662
- FILE_UPLOAD: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.FILE_UPLOAD}`,
663
- BALANCE_TOP_UP: `${exports.ROOT}/${CONTROLLERS.B2B_CONTROLLER}/${CONTROLLERS.B2B_ROUTES.BALANCE_TOP_UP}`,
664
- },
665
661
  COMMUNITY_PRIVATE: {
666
662
  GET_ALL: `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.GET_ALL}`,
667
663
  GET_MY: `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.GET_MY}`,
@@ -676,6 +672,7 @@ exports.REST_API = {
676
672
  LIKE: (uuid) => `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.LIKE(uuid)}`,
677
673
  FAVORITE: (uuid) => `${exports.ROOT}/${CONTROLLERS.COMMUNITY_CONTROLLER_PRIVATE}/${CONTROLLERS.COMMUNITY_ROUTES_PRIVATE.FAVORITE(uuid)}`,
678
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}`,
679
676
  },
680
677
  COMMUNITY_PUBLIC: {
681
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);
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SendImageRequestCommand = void 0;
3
+ exports.CreateImageMessageCommand = void 0;
4
+ const models_1 = require("../../models");
4
5
  const zod_1 = require("zod");
5
6
  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(),
7
+ var CreateImageMessageCommand;
8
+ (function (CreateImageMessageCommand) {
9
+ CreateImageMessageCommand.RequestSchema = zod_1.z.object({
10
+ text: zod_1.z.string(),
11
11
  params: zod_1.z.array(zod_1.z.object({
12
12
  type: zod_1.z.nativeEnum(constants_1.AI_MODEL_CONFIG_PARAM),
13
13
  option: zod_1.z.string().uuid(),
@@ -16,9 +16,10 @@ var SendImageRequestCommand;
16
16
  features: zod_1.z.array(zod_1.z.nativeEnum(constants_1.AI_MODEL_FEATURE)).optional().default([]),
17
17
  files: zod_1.z.array(zod_1.z.string().uuid()).optional().default([]),
18
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
- }),
19
+ CreateImageMessageCommand.RequestParamSchema = models_1.ChatSchema.pick({
20
+ uuid: true,
23
21
  });
24
- })(SendImageRequestCommand || (exports.SendImageRequestCommand = SendImageRequestCommand = {}));
22
+ CreateImageMessageCommand.ResponseSchema = zod_1.z.object({
23
+ data: models_1.MessageSchema,
24
+ });
25
+ })(CreateImageMessageCommand || (exports.CreateImageMessageCommand = CreateImageMessageCommand = {}));
@@ -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("./create-image-message.command"), exports);
17
18
  __exportStar(require("./create-text-message.command"), exports);
18
19
  __exportStar(require("./find-message-by-uuid.command"), exports);
19
20
  __exportStar(require("./rate-message.command"), 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,10 +1,10 @@
1
+ import { ChatSchema, MessageSchema } from '../../models';
1
2
  import { z } from 'zod';
2
3
  import { AI_MODEL_CONFIG_PARAM, AI_MODEL_FEATURE } from '../../constants';
3
4
 
4
- export namespace SendImageRequestCommand {
5
+ export namespace CreateImageMessageCommand {
5
6
  export const RequestSchema = z.object({
6
- model: z.string(),
7
- prompt: z.string(),
7
+ text: z.string(),
8
8
  params: z.array(
9
9
  z.object({
10
10
  type: z.nativeEnum(AI_MODEL_CONFIG_PARAM),
@@ -16,12 +16,14 @@ export namespace SendImageRequestCommand {
16
16
  files: z.array(z.string().uuid()).optional().default([]),
17
17
  });
18
18
 
19
+ export const RequestParamSchema = ChatSchema.pick({
20
+ uuid: true,
21
+ });
22
+
19
23
  export type Request = z.infer<typeof RequestSchema>;
20
24
 
21
25
  export const ResponseSchema = z.object({
22
- data: z.object({
23
- urls: z.array(z.string()),
24
- }),
26
+ data: MessageSchema,
25
27
  });
26
28
 
27
29
  export type Response = z.infer<typeof ResponseSchema>;
@@ -1,3 +1,4 @@
1
+ export * from './create-image-message.command';
1
2
  export * from './create-text-message.command';
2
3
  export * from './find-message-by-uuid.command';
3
4
  export * from './rate-message.command';
@@ -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.60",
3
+ "version": "0.8.61",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -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,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,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,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
- });