@purpleschool/gptbot-tools 0.0.34 → 0.0.35

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/build/common/errors/errors.js +81 -0
  2. package/build/image-editor/commands/delete-all-image-editor-jobs.command.js +13 -0
  3. package/build/image-editor/commands/delete-image-editor-job-by-uuid.command.js +14 -0
  4. package/build/image-editor/commands/image-editor.command.js +21 -0
  5. package/build/image-editor/commands/index.js +22 -0
  6. package/build/image-editor/commands/retry-image-editor-job.command.js +16 -0
  7. package/build/image-editor/commands/set-reaction-to-image-editor-job.command.js +17 -0
  8. package/build/image-editor/commands/update-image-editor-job-title.command.js +16 -0
  9. package/build/image-editor/enums/image-editor-model-type.enum.js +7 -0
  10. package/build/image-editor/enums/image-editor-strategy.enum.js +8 -0
  11. package/build/image-editor/enums/index.js +18 -0
  12. package/build/image-editor/index.js +21 -0
  13. package/build/image-editor/models/image-editor-config.schema.js +32 -0
  14. package/build/image-editor/models/image-editor-job.schema.js +30 -0
  15. package/build/image-editor/models/image-editor-model.schema.js +27 -0
  16. package/build/image-editor/models/index.js +19 -0
  17. package/build/image-editor/queries/find-image-editor-job-by-id.query.js +10 -0
  18. package/build/image-editor/queries/find-image-editor-jobs.query.js +21 -0
  19. package/build/image-editor/queries/find-image-jobs.query.js +21 -0
  20. package/build/image-editor/queries/get-image-editor-config.query.js +9 -0
  21. package/build/image-editor/queries/index.js +19 -0
  22. package/build/image-editor/routes/image-editor.amqp.routes.js +14 -0
  23. package/build/image-editor/routes/image-editor.http.routes.js +7 -0
  24. package/build/image-editor/routes/index.js +18 -0
  25. package/build/index.js +3 -0
  26. package/common/errors/errors.ts +82 -0
  27. package/image-editor/commands/delete-all-image-editor-jobs.command.ts +13 -0
  28. package/image-editor/commands/delete-image-editor-job-by-uuid.command.ts +14 -0
  29. package/image-editor/commands/image-editor.command.ts +21 -0
  30. package/image-editor/commands/index.ts +6 -0
  31. package/image-editor/commands/retry-image-editor-job.command.ts +16 -0
  32. package/image-editor/commands/set-reaction-to-image-editor-job.command.ts +17 -0
  33. package/image-editor/commands/update-image-editor-job-title.command.ts +16 -0
  34. package/image-editor/enums/image-editor-model-type.enum.ts +3 -0
  35. package/image-editor/enums/image-editor-strategy.enum.ts +4 -0
  36. package/image-editor/enums/index.ts +2 -0
  37. package/image-editor/index.ts +5 -0
  38. package/image-editor/models/image-editor-config.schema.ts +34 -0
  39. package/image-editor/models/image-editor-job.schema.ts +33 -0
  40. package/image-editor/models/image-editor-model.schema.ts +30 -0
  41. package/image-editor/models/index.ts +3 -0
  42. package/image-editor/queries/find-image-editor-job-by-id.query.ts +11 -0
  43. package/image-editor/queries/find-image-editor-jobs.query.ts +23 -0
  44. package/image-editor/queries/find-image-jobs.query.ts +23 -0
  45. package/image-editor/queries/get-image-editor-config.query.ts +8 -0
  46. package/image-editor/queries/index.ts +3 -0
  47. package/image-editor/routes/image-editor.amqp.routes.ts +11 -0
  48. package/image-editor/routes/image-editor.http.routes.ts +5 -0
  49. package/image-editor/routes/index.ts +2 -0
  50. package/index.ts +3 -0
  51. package/package.json +1 -1
@@ -548,4 +548,85 @@ exports.ERRORS = {
548
548
  httpCode: 500,
549
549
  },
550
550
  },
551
+ IMAGE_EDITOR: {
552
+ AI_ERROR: {
553
+ code: 'IMAGE_EDITOR.AI_ERROR',
554
+ message: 'Произошла ошибка во время запроса к ИИ',
555
+ httpCode: 500,
556
+ },
557
+ INSUFFICIENT_BALANCE: {
558
+ code: 'IMAGE_EDITOR.INSUFFICIENT_BALANCE',
559
+ message: 'У пользователя недостаточно средств',
560
+ httpCode: 400,
561
+ },
562
+ INVALID_PARAMS: {
563
+ code: 'IMAGE_EDITOR.INVALID_PARAMS',
564
+ message: 'Некорректные параметры картинки',
565
+ httpCode: 400,
566
+ },
567
+ DELETE_ERROR: {
568
+ code: 'IMAGE_EDITOR.DELETE_ERROR',
569
+ message: 'Произошла ошибка при удалении редактирования картинки',
570
+ httpCode: 500,
571
+ },
572
+ MAX_PROMPT_LENGTH_EXCEEDED: {
573
+ code: 'IMAGE_EDITOR.MAX_PROMPT_LENGTH_EXCEEDED',
574
+ message: 'Превышена максимальная длина запроса',
575
+ httpCode: 400,
576
+ },
577
+ SYSTEM_PROMPT_NOT_FOUND: {
578
+ code: 'IMAGE_EDITOR.SYSTEM_PROMPT_NOT_FOUND',
579
+ message: 'Произошла ошибка при поиске системного запроса',
580
+ httpCode: 404,
581
+ },
582
+ },
583
+ IMAGE_EDITOR_MODEL: {
584
+ SAVE_ERROR: {
585
+ code: 'IMAGE_EDITOR_MODEL.SAVE_ERROR',
586
+ message: 'Произошла ошибка при сохранении модели для редактирования картинки',
587
+ httpCode: 500,
588
+ },
589
+ FIND_ERROR: {
590
+ code: 'IMAGE_EDITOR_MODEL.FIND_ERROR',
591
+ message: 'Произошла ошибка при поиске модели для редактирования картинки',
592
+ httpCode: 500,
593
+ },
594
+ NOT_FOUND: {
595
+ code: 'IMAGE_EDITOR_MODEL.NOT_FOUND',
596
+ message: 'Модель для редактирования картинки не найдена',
597
+ httpCode: 404,
598
+ },
599
+ },
600
+ IMAGE_EDITOR_JOB: {
601
+ SAVE_ERROR: {
602
+ code: 'IMAGE_EDITOR_JOB.SAVE_ERROR',
603
+ message: 'Произошла ошибка при сохранении задания на редактирование картинки',
604
+ httpCode: 500,
605
+ },
606
+ FIND_ERROR: {
607
+ code: 'IMAGE_EDITOR_JOB.FIND_ERROR',
608
+ message: 'Произошла ошибка при поиске задания на редактирование картинки',
609
+ httpCode: 500,
610
+ },
611
+ NOT_FOUND: {
612
+ code: 'IMAGE_EDITOR_JOB.NOT_FOUND',
613
+ message: 'Задание на редактирование картинки не найдено',
614
+ httpCode: 404,
615
+ },
616
+ NOT_AN_OWNER: {
617
+ code: 'IMAGE_EDITOR_JOB.NOT_AN_OWNER',
618
+ message: 'Пользователь не является владельцем задания на редактирование картинки',
619
+ httpCode: 403,
620
+ },
621
+ NOT_IN_FAILED_STATE_TO_RETRY: {
622
+ code: 'IMAGE_EDITOR_JOB.NOT_IN_FAILED_STATE_TO_RETRY',
623
+ message: 'Задание на редактирование картинки не в состоянии "failed". Невозможно повторить',
624
+ httpCode: 400,
625
+ },
626
+ DELETE_ERROR: {
627
+ code: 'IMAGE_EDITOR_JOB.DELETE_ERROR',
628
+ message: 'Произошла ошибка при удалении задания на редактирование картинки',
629
+ httpCode: 500,
630
+ },
631
+ },
551
632
  };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteAllImageEditorJobsCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ var DeleteAllImageEditorJobsCommand;
7
+ (function (DeleteAllImageEditorJobsCommand) {
8
+ DeleteAllImageEditorJobsCommand.RequestSchema = zod_1.z.object({
9
+ userId: zod_1.z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
11
+ });
12
+ DeleteAllImageEditorJobsCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.boolean());
13
+ })(DeleteAllImageEditorJobsCommand || (exports.DeleteAllImageEditorJobsCommand = DeleteAllImageEditorJobsCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteImageEditorJobByUuidCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ var DeleteImageEditorJobByUuidCommand;
7
+ (function (DeleteImageEditorJobByUuidCommand) {
8
+ DeleteImageEditorJobByUuidCommand.RequestSchema = zod_1.z.object({
9
+ userId: zod_1.z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
11
+ uuid: zod_1.z.string(),
12
+ });
13
+ DeleteImageEditorJobByUuidCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.boolean());
14
+ })(DeleteImageEditorJobByUuidCommand || (exports.DeleteImageEditorJobByUuidCommand = DeleteImageEditorJobByUuidCommand = {}));
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageEditorCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var ImageEditorCommand;
8
+ (function (ImageEditorCommand) {
9
+ ImageEditorCommand.RequestSchema = zod_1.z.object({
10
+ userId: zod_1.z.string().uuid().nullable().optional(),
11
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
12
+ prompt: zod_1.z.string(),
13
+ userBalance: zod_1.z.number(),
14
+ modelId: zod_1.z.string(),
15
+ params: zod_1.z.object({
16
+ imageUrls: zod_1.z.array(zod_1.z.string()),
17
+ systemPromptId: zod_1.z.string().optional(),
18
+ }),
19
+ });
20
+ ImageEditorCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageEditorJobSchema);
21
+ })(ImageEditorCommand || (exports.ImageEditorCommand = ImageEditorCommand = {}));
@@ -0,0 +1,22 @@
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("./delete-image-editor-job-by-uuid.command"), exports);
18
+ __exportStar(require("./delete-all-image-editor-jobs.command"), exports);
19
+ __exportStar(require("./retry-image-editor-job.command"), exports);
20
+ __exportStar(require("./set-reaction-to-image-editor-job.command"), exports);
21
+ __exportStar(require("./image-editor.command"), exports);
22
+ __exportStar(require("./update-image-editor-job-title.command"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryImageEditorJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var RetryImageEditorJobCommand;
8
+ (function (RetryImageEditorJobCommand) {
9
+ RetryImageEditorJobCommand.RequestSchema = zod_1.z.object({
10
+ uuid: zod_1.z.string().uuid(),
11
+ userBalance: zod_1.z.number(),
12
+ userId: zod_1.z.string().uuid().nullable().optional(),
13
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
14
+ });
15
+ RetryImageEditorJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageEditorJobSchema);
16
+ })(RetryImageEditorJobCommand || (exports.RetryImageEditorJobCommand = RetryImageEditorJobCommand = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetReactionToImageEditorJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ const common_1 = require("../../common");
8
+ var SetReactionToImageEditorJobCommand;
9
+ (function (SetReactionToImageEditorJobCommand) {
10
+ SetReactionToImageEditorJobCommand.RequestSchema = zod_1.z.object({
11
+ userId: zod_1.z.string().uuid().nullable().optional(),
12
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
+ uuid: zod_1.z.string(),
14
+ reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
15
+ });
16
+ SetReactionToImageEditorJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageEditorJobSchema);
17
+ })(SetReactionToImageEditorJobCommand || (exports.SetReactionToImageEditorJobCommand = SetReactionToImageEditorJobCommand = {}));
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateImageEditorJobTitleCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var UpdateImageEditorJobTitleCommand;
8
+ (function (UpdateImageEditorJobTitleCommand) {
9
+ UpdateImageEditorJobTitleCommand.RequestSchema = zod_1.z.object({
10
+ uuid: zod_1.z.string().uuid(),
11
+ userId: zod_1.z.string().uuid().nullable().optional(),
12
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
+ title: zod_1.z.string().min(1).max(40),
14
+ });
15
+ UpdateImageEditorJobTitleCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageEditorJobSchema);
16
+ })(UpdateImageEditorJobTitleCommand || (exports.UpdateImageEditorJobTitleCommand = UpdateImageEditorJobTitleCommand = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IMAGE_EDITOR_MODEL_TYPE = void 0;
4
+ var IMAGE_EDITOR_MODEL_TYPE;
5
+ (function (IMAGE_EDITOR_MODEL_TYPE) {
6
+ IMAGE_EDITOR_MODEL_TYPE["NANO_BANANA_EDIT"] = "NANO_BANANA_EDIT";
7
+ })(IMAGE_EDITOR_MODEL_TYPE || (exports.IMAGE_EDITOR_MODEL_TYPE = IMAGE_EDITOR_MODEL_TYPE = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IMAGE_EDITING_STRATEGY = void 0;
4
+ var IMAGE_EDITING_STRATEGY;
5
+ (function (IMAGE_EDITING_STRATEGY) {
6
+ IMAGE_EDITING_STRATEGY["NANO_BANANA_POLLING"] = "NANO_BANANA_POLLING";
7
+ IMAGE_EDITING_STRATEGY["NANO_BANANA_CALLBACK"] = "NANO_BANANA_CALLBACK";
8
+ })(IMAGE_EDITING_STRATEGY || (exports.IMAGE_EDITING_STRATEGY = IMAGE_EDITING_STRATEGY = {}));
@@ -0,0 +1,18 @@
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("./image-editor-model-type.enum"), exports);
18
+ __exportStar(require("./image-editor-strategy.enum"), exports);
@@ -0,0 +1,21 @@
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("./commands"), exports);
18
+ __exportStar(require("./enums"), exports);
19
+ __exportStar(require("./models"), exports);
20
+ __exportStar(require("./queries"), exports);
21
+ __exportStar(require("./routes"), exports);
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageEditorConfigSchema = exports.ImageEditorActionGroup = exports.SystemPromptSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const image_editor_model_schema_1 = require("./image-editor-model.schema");
6
+ const common_1 = require("../../common");
7
+ exports.SystemPromptSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string(),
9
+ title: zod_1.z.string(),
10
+ description: zod_1.z.string(),
11
+ prompt: zod_1.z.string(),
12
+ allowUserPrompt: zod_1.z.boolean(),
13
+ groupId: zod_1.z.string().uuid(),
14
+ preview: zod_1.z
15
+ .object({
16
+ before: zod_1.z.string(),
17
+ after: zod_1.z.string(),
18
+ })
19
+ .nullable(),
20
+ order: zod_1.z.number(),
21
+ });
22
+ exports.ImageEditorActionGroup = zod_1.z.object({
23
+ uuid: zod_1.z.string(),
24
+ title: zod_1.z.string(),
25
+ icons: common_1.IconVariantsSchema,
26
+ prompts: zod_1.z.array(exports.SystemPromptSchema),
27
+ order: zod_1.z.number(),
28
+ });
29
+ exports.ImageEditorConfigSchema = zod_1.z.object({
30
+ models: zod_1.z.array(image_editor_model_schema_1.ImageEditorModelSchema),
31
+ promptGroups: zod_1.z.array(exports.ImageEditorActionGroup),
32
+ });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageEditorJobSchema = exports.ImageEditorJobParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const tools_1 = require("../../tools");
6
+ const common_1 = require("../../common");
7
+ exports.ImageEditorJobParamsSchema = zod_1.z.object({
8
+ imageUrls: zod_1.z.array(zod_1.z.string()).optional(),
9
+ systemPromptId: zod_1.z.string().optional(),
10
+ });
11
+ exports.ImageEditorJobSchema = zod_1.z.object({
12
+ uuid: zod_1.z.string(),
13
+ prompt: zod_1.z.string(),
14
+ reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
15
+ externalId: zod_1.z.string().nullable(),
16
+ title: zod_1.z.string(),
17
+ status: zod_1.z.nativeEnum(tools_1.JOB_STATUS),
18
+ error: zod_1.z.string().nullable(),
19
+ modelId: zod_1.z.string(),
20
+ price: zod_1.z.number(),
21
+ params: exports.ImageEditorJobParamsSchema,
22
+ imageUrls: zod_1.z.array(zod_1.z.string()).nullable(),
23
+ attempts: zod_1.z.array(zod_1.z.any()),
24
+ userId: zod_1.z.string().nullable().optional(),
25
+ unregisteredUserId: zod_1.z.string().nullable().optional(),
26
+ isDeleted: zod_1.z.boolean(),
27
+ createdAt: zod_1.z.date(),
28
+ completedAt: zod_1.z.date().nullable().optional(),
29
+ updatedAt: zod_1.z.date(),
30
+ });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageEditorModelSchema = exports.ImageEditorModelParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ const enums_1 = require("../enums");
7
+ exports.ImageEditorModelParamsSchema = zod_1.z.object({
8
+ imageAttachment: zod_1.z.object({
9
+ supported: zod_1.z.boolean(),
10
+ maxImages: zod_1.z.number(),
11
+ acceptedTypes: zod_1.z.array(zod_1.z.string()),
12
+ }),
13
+ });
14
+ exports.ImageEditorModelSchema = zod_1.z.object({
15
+ uuid: zod_1.z.string(),
16
+ title: zod_1.z.string(),
17
+ description: zod_1.z.string(),
18
+ aiModel: zod_1.z.string(),
19
+ pricePerImage: zod_1.z.number(),
20
+ order: zod_1.z.number(),
21
+ icons: common_1.IconVariantsSchema,
22
+ strategy: zod_1.z.nativeEnum(enums_1.IMAGE_EDITING_STRATEGY),
23
+ maxInputLength: zod_1.z.number(),
24
+ params: exports.ImageEditorModelParamsSchema,
25
+ createdAt: zod_1.z.date(),
26
+ updatedAt: zod_1.z.date(),
27
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./image-editor-config.schema"), exports);
18
+ __exportStar(require("./image-editor-job.schema"), exports);
19
+ __exportStar(require("./image-editor-model.schema"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindImageEditorJobByIdQuery = void 0;
4
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
5
+ const models_1 = require("../models");
6
+ var FindImageEditorJobByIdQuery;
7
+ (function (FindImageEditorJobByIdQuery) {
8
+ FindImageEditorJobByIdQuery.RequestSchema = models_1.ImageEditorJobSchema.pick({ uuid: true });
9
+ FindImageEditorJobByIdQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageEditorJobSchema);
10
+ })(FindImageEditorJobByIdQuery || (exports.FindImageEditorJobByIdQuery = FindImageEditorJobByIdQuery = {}));
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindImageEditorJobsQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var FindImageEditorJobsQuery;
8
+ (function (FindImageEditorJobsQuery) {
9
+ FindImageEditorJobsQuery.RequestSchema = zod_1.z.object({
10
+ userId: zod_1.z.string().uuid().optional(),
11
+ unregisteredUserId: zod_1.z.string().uuid().optional(),
12
+ title: zod_1.z.string().optional(),
13
+ limit: zod_1.z.coerce.number().min(1).optional(),
14
+ offset: zod_1.z.coerce.number().min(0).default(0).optional(),
15
+ });
16
+ FindImageEditorJobsQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.object({
17
+ data: zod_1.z.array(models_1.ImageEditorJobSchema),
18
+ page: zod_1.z.number(),
19
+ totalPages: zod_1.z.number(),
20
+ }));
21
+ })(FindImageEditorJobsQuery || (exports.FindImageEditorJobsQuery = FindImageEditorJobsQuery = {}));
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindImageJobsQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var FindImageJobsQuery;
8
+ (function (FindImageJobsQuery) {
9
+ FindImageJobsQuery.RequestSchema = zod_1.z.object({
10
+ userId: zod_1.z.string().uuid().optional(),
11
+ unregisteredUserId: zod_1.z.string().uuid().optional(),
12
+ title: zod_1.z.string().optional(),
13
+ limit: zod_1.z.coerce.number().min(1).optional(),
14
+ offset: zod_1.z.coerce.number().min(0).default(0).optional(),
15
+ });
16
+ FindImageJobsQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.object({
17
+ data: zod_1.z.array(models_1.ImageEditorJobSchema),
18
+ page: zod_1.z.number(),
19
+ totalPages: zod_1.z.number(),
20
+ }));
21
+ })(FindImageJobsQuery || (exports.FindImageJobsQuery = FindImageJobsQuery = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetImageEditorConfigQuery = void 0;
4
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
5
+ const models_1 = require("../models");
6
+ var GetImageEditorConfigQuery;
7
+ (function (GetImageEditorConfigQuery) {
8
+ GetImageEditorConfigQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageEditorConfigSchema);
9
+ })(GetImageEditorConfigQuery || (exports.GetImageEditorConfigQuery = GetImageEditorConfigQuery = {}));
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./find-image-editor-job-by-id.query"), exports);
18
+ __exportStar(require("./find-image-editor-jobs.query"), exports);
19
+ __exportStar(require("./get-image-editor-config.query"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IMAGE_EDITOR_AMQP_ROUTES = void 0;
4
+ exports.IMAGE_EDITOR_AMQP_ROUTES = {
5
+ EXECUTE: 'tools.image.execute.rpc',
6
+ CONFIG: 'tools.image.config.rpc',
7
+ GET_JOB: 'tools.image.jobs.get.rpc',
8
+ LIST_JOBS: 'tools.image.jobs.list.rpc',
9
+ SET_REACTION: 'tools.image.jobs.set-reaction.rpc',
10
+ UPDATE_TITLE: 'tools.image.jobs.update-title.rpc',
11
+ SOFT_DELETE: 'tools.image.jobs.soft-delete.rpc',
12
+ SOFT_DELETE_ALL: 'tools.image.jobs.soft-delete-all.rpc',
13
+ RETRY: 'tools.image.jobs.retry.rpc',
14
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IMAGE_EDITOR_ROUTES = exports.IMAGE_EDITOR_CONTROLLER = void 0;
4
+ exports.IMAGE_EDITOR_CONTROLLER = 'image-editor';
5
+ exports.IMAGE_EDITOR_ROUTES = {
6
+ KIE_NANO_BANANA_CALLBACK: 'kie/nano-banana/callback',
7
+ };
@@ -0,0 +1,18 @@
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("./image-editor.amqp.routes"), exports);
18
+ __exportStar(require("./image-editor.http.routes"), exports);
package/build/index.js CHANGED
@@ -44,6 +44,7 @@ __exportStar(require("./stt"), exports);
44
44
  __exportStar(require("./tts"), exports);
45
45
  __exportStar(require("./language"), exports);
46
46
  __exportStar(require("./video"), exports);
47
+ __exportStar(require("./image-editor"), exports);
47
48
  const common = __importStar(require("./common"));
48
49
  const paraphrase = __importStar(require("./paraphrase"));
49
50
  const tools = __importStar(require("./tools"));
@@ -52,6 +53,7 @@ const tts = __importStar(require("./tts"));
52
53
  const presentation = __importStar(require("./presentation"));
53
54
  const language = __importStar(require("./language"));
54
55
  const video = __importStar(require("./video"));
56
+ const imageEditor = __importStar(require("./image-editor"));
55
57
  var ToolService;
56
58
  (function (ToolService) {
57
59
  ToolService.Common = common;
@@ -62,4 +64,5 @@ var ToolService;
62
64
  ToolService.Presentation = presentation;
63
65
  ToolService.Language = language;
64
66
  ToolService.Video = video;
67
+ ToolService.ImageEditor = imageEditor;
65
68
  })(ToolService || (exports.ToolService = ToolService = {}));
@@ -547,4 +547,86 @@ export const ERRORS = {
547
547
  httpCode: 500,
548
548
  },
549
549
  },
550
+ IMAGE_EDITOR: {
551
+ AI_ERROR: {
552
+ code: 'IMAGE_EDITOR.AI_ERROR',
553
+ message: 'Произошла ошибка во время запроса к ИИ',
554
+ httpCode: 500,
555
+ },
556
+ INSUFFICIENT_BALANCE: {
557
+ code: 'IMAGE_EDITOR.INSUFFICIENT_BALANCE',
558
+ message: 'У пользователя недостаточно средств',
559
+ httpCode: 400,
560
+ },
561
+ INVALID_PARAMS: {
562
+ code: 'IMAGE_EDITOR.INVALID_PARAMS',
563
+ message: 'Некорректные параметры картинки',
564
+ httpCode: 400,
565
+ },
566
+ DELETE_ERROR: {
567
+ code: 'IMAGE_EDITOR.DELETE_ERROR',
568
+ message: 'Произошла ошибка при удалении редактирования картинки',
569
+ httpCode: 500,
570
+ },
571
+ MAX_PROMPT_LENGTH_EXCEEDED: {
572
+ code: 'IMAGE_EDITOR.MAX_PROMPT_LENGTH_EXCEEDED',
573
+ message: 'Превышена максимальная длина запроса',
574
+ httpCode: 400,
575
+ },
576
+ SYSTEM_PROMPT_NOT_FOUND: {
577
+ code: 'IMAGE_EDITOR.SYSTEM_PROMPT_NOT_FOUND',
578
+ message: 'Произошла ошибка при поиске системного запроса',
579
+ httpCode: 404,
580
+ },
581
+ },
582
+ IMAGE_EDITOR_MODEL: {
583
+ SAVE_ERROR: {
584
+ code: 'IMAGE_EDITOR_MODEL.SAVE_ERROR',
585
+ message: 'Произошла ошибка при сохранении модели для редактирования картинки',
586
+ httpCode: 500,
587
+ },
588
+ FIND_ERROR: {
589
+ code: 'IMAGE_EDITOR_MODEL.FIND_ERROR',
590
+ message: 'Произошла ошибка при поиске модели для редактирования картинки',
591
+ httpCode: 500,
592
+ },
593
+ NOT_FOUND: {
594
+ code: 'IMAGE_EDITOR_MODEL.NOT_FOUND',
595
+ message: 'Модель для редактирования картинки не найдена',
596
+ httpCode: 404,
597
+ },
598
+ },
599
+ IMAGE_EDITOR_JOB: {
600
+ SAVE_ERROR: {
601
+ code: 'IMAGE_EDITOR_JOB.SAVE_ERROR',
602
+ message: 'Произошла ошибка при сохранении задания на редактирование картинки',
603
+ httpCode: 500,
604
+ },
605
+ FIND_ERROR: {
606
+ code: 'IMAGE_EDITOR_JOB.FIND_ERROR',
607
+ message: 'Произошла ошибка при поиске задания на редактирование картинки',
608
+ httpCode: 500,
609
+ },
610
+ NOT_FOUND: {
611
+ code: 'IMAGE_EDITOR_JOB.NOT_FOUND',
612
+ message: 'Задание на редактирование картинки не найдено',
613
+ httpCode: 404,
614
+ },
615
+ NOT_AN_OWNER: {
616
+ code: 'IMAGE_EDITOR_JOB.NOT_AN_OWNER',
617
+ message: 'Пользователь не является владельцем задания на редактирование картинки',
618
+ httpCode: 403,
619
+ },
620
+ NOT_IN_FAILED_STATE_TO_RETRY: {
621
+ code: 'IMAGE_EDITOR_JOB.NOT_IN_FAILED_STATE_TO_RETRY',
622
+ message:
623
+ 'Задание на редактирование картинки не в состоянии "failed". Невозможно повторить',
624
+ httpCode: 400,
625
+ },
626
+ DELETE_ERROR: {
627
+ code: 'IMAGE_EDITOR_JOB.DELETE_ERROR',
628
+ message: 'Произошла ошибка при удалении задания на редактирование картинки',
629
+ httpCode: 500,
630
+ },
631
+ },
550
632
  } as const;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+
4
+ export namespace DeleteAllImageEditorJobsCommand {
5
+ export const RequestSchema = z.object({
6
+ userId: z.string().uuid().nullable().optional(),
7
+ unregisteredUserId: z.string().uuid().nullable().optional(),
8
+ });
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = ICommandResponseSchema(z.boolean());
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+
4
+ export namespace DeleteImageEditorJobByUuidCommand {
5
+ export const RequestSchema = z.object({
6
+ userId: z.string().uuid().nullable().optional(),
7
+ unregisteredUserId: z.string().uuid().nullable().optional(),
8
+ uuid: z.string(),
9
+ });
10
+ export type Request = z.infer<typeof RequestSchema>;
11
+
12
+ export const ResponseSchema = ICommandResponseSchema(z.boolean());
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageEditorJobSchema } from '../models';
4
+
5
+ export namespace ImageEditorCommand {
6
+ export const RequestSchema = z.object({
7
+ userId: z.string().uuid().nullable().optional(),
8
+ unregisteredUserId: z.string().uuid().nullable().optional(),
9
+ prompt: z.string(),
10
+ userBalance: z.number(),
11
+ modelId: z.string(),
12
+ params: z.object({
13
+ imageUrls: z.array(z.string()),
14
+ systemPromptId: z.string().optional(),
15
+ }),
16
+ });
17
+ export type Request = z.infer<typeof RequestSchema>;
18
+
19
+ export const ResponseSchema = ICommandResponseSchema(ImageEditorJobSchema);
20
+ export type Response = z.infer<typeof ResponseSchema>;
21
+ }
@@ -0,0 +1,6 @@
1
+ export * from './delete-image-editor-job-by-uuid.command';
2
+ export * from './delete-all-image-editor-jobs.command';
3
+ export * from './retry-image-editor-job.command';
4
+ export * from './set-reaction-to-image-editor-job.command';
5
+ export * from './image-editor.command';
6
+ export * from './update-image-editor-job-title.command';
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageEditorJobSchema } from '../models';
4
+
5
+ export namespace RetryImageEditorJobCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userBalance: z.number(),
9
+ userId: z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: z.string().uuid().nullable().optional(),
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = ICommandResponseSchema(ImageEditorJobSchema);
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageEditorJobSchema } from '../models';
4
+ import { USER_REACTION } from '../../common';
5
+
6
+ export namespace SetReactionToImageEditorJobCommand {
7
+ export const RequestSchema = z.object({
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ uuid: z.string(),
11
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
12
+ });
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseSchema = ICommandResponseSchema(ImageEditorJobSchema);
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageEditorJobSchema } from '../models';
4
+
5
+ export namespace UpdateImageEditorJobTitleCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ title: z.string().min(1).max(40),
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = ICommandResponseSchema(ImageEditorJobSchema);
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,3 @@
1
+ export enum IMAGE_EDITOR_MODEL_TYPE {
2
+ NANO_BANANA_EDIT = 'NANO_BANANA_EDIT',
3
+ }
@@ -0,0 +1,4 @@
1
+ export enum IMAGE_EDITING_STRATEGY {
2
+ NANO_BANANA_POLLING = 'NANO_BANANA_POLLING',
3
+ NANO_BANANA_CALLBACK = 'NANO_BANANA_CALLBACK',
4
+ }
@@ -0,0 +1,2 @@
1
+ export * from './image-editor-model-type.enum';
2
+ export * from './image-editor-strategy.enum';
@@ -0,0 +1,5 @@
1
+ export * from './commands';
2
+ export * from './enums';
3
+ export * from './models';
4
+ export * from './queries';
5
+ export * from './routes';
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { ImageEditorModelSchema } from './image-editor-model.schema';
3
+ import { IconVariantsSchema } from '../../common';
4
+
5
+ export const SystemPromptSchema = z.object({
6
+ uuid: z.string(),
7
+ title: z.string(),
8
+ description: z.string(),
9
+ prompt: z.string(),
10
+ allowUserPrompt: z.boolean(),
11
+ groupId: z.string().uuid(),
12
+ preview: z
13
+ .object({
14
+ before: z.string(),
15
+ after: z.string(),
16
+ })
17
+ .nullable(),
18
+ order: z.number(),
19
+ });
20
+
21
+ export const ImageEditorActionGroup = z.object({
22
+ uuid: z.string(),
23
+ title: z.string(),
24
+ icons: IconVariantsSchema,
25
+ prompts: z.array(SystemPromptSchema),
26
+ order: z.number(),
27
+ });
28
+
29
+ export const ImageEditorConfigSchema = z.object({
30
+ models: z.array(ImageEditorModelSchema),
31
+ promptGroups: z.array(ImageEditorActionGroup),
32
+ });
33
+
34
+ export type ImageEditorConfig = z.infer<typeof ImageEditorConfigSchema>;
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { JOB_STATUS } from '../../tools';
3
+ import { USER_REACTION } from '../../common';
4
+
5
+ export const ImageEditorJobParamsSchema = z.object({
6
+ imageUrls: z.array(z.string()).optional(),
7
+ systemPromptId: z.string().optional(),
8
+ });
9
+
10
+ export type ImageEditorJobParams = z.infer<typeof ImageEditorJobParamsSchema>;
11
+
12
+ export const ImageEditorJobSchema = z.object({
13
+ uuid: z.string(),
14
+ prompt: z.string(),
15
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
16
+ externalId: z.string().nullable(),
17
+ title: z.string(),
18
+ status: z.nativeEnum(JOB_STATUS),
19
+ error: z.string().nullable(),
20
+ modelId: z.string(),
21
+ price: z.number(),
22
+ params: ImageEditorJobParamsSchema,
23
+ imageUrls: z.array(z.string()).nullable(),
24
+ attempts: z.array(z.any()),
25
+ userId: z.string().nullable().optional(),
26
+ unregisteredUserId: z.string().nullable().optional(),
27
+ isDeleted: z.boolean(),
28
+ createdAt: z.date(),
29
+ completedAt: z.date().nullable().optional(),
30
+ updatedAt: z.date(),
31
+ });
32
+
33
+ export type ImageEditorJob = z.infer<typeof ImageEditorJobSchema>;
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema } from '../../common';
3
+ import { IMAGE_EDITING_STRATEGY } from '../enums';
4
+
5
+ export const ImageEditorModelParamsSchema = z.object({
6
+ imageAttachment: z.object({
7
+ supported: z.boolean(),
8
+ maxImages: z.number(),
9
+ acceptedTypes: z.array(z.string()),
10
+ }),
11
+ });
12
+
13
+ export type ImageEditorModelParams = z.infer<typeof ImageEditorModelParamsSchema>;
14
+
15
+ export const ImageEditorModelSchema = z.object({
16
+ uuid: z.string(),
17
+ title: z.string(),
18
+ description: z.string(),
19
+ aiModel: z.string(),
20
+ pricePerImage: z.number(),
21
+ order: z.number(),
22
+ icons: IconVariantsSchema,
23
+ strategy: z.nativeEnum(IMAGE_EDITING_STRATEGY),
24
+ maxInputLength: z.number(),
25
+ params: ImageEditorModelParamsSchema,
26
+ createdAt: z.date(),
27
+ updatedAt: z.date(),
28
+ });
29
+
30
+ export type ImageEditorModel = z.infer<typeof ImageEditorModelSchema>;
@@ -0,0 +1,3 @@
1
+ export * from './image-editor-config.schema';
2
+ export * from './image-editor-job.schema';
3
+ export * from './image-editor-model.schema';
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageEditorJobSchema } from '../models';
4
+
5
+ export namespace FindImageEditorJobByIdQuery {
6
+ export const RequestSchema = ImageEditorJobSchema.pick({ uuid: true });
7
+ export type Request = z.infer<typeof RequestSchema>;
8
+
9
+ export const ResponseSchema = ICommandResponseSchema(ImageEditorJobSchema);
10
+ export type Response = z.infer<typeof ResponseSchema>;
11
+ }
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageEditorJobSchema } from '../models';
4
+
5
+ export namespace FindImageEditorJobsQuery {
6
+ export const RequestSchema = z.object({
7
+ userId: z.string().uuid().optional(),
8
+ unregisteredUserId: z.string().uuid().optional(),
9
+ title: z.string().optional(),
10
+ limit: z.coerce.number().min(1).optional(),
11
+ offset: z.coerce.number().min(0).default(0).optional(),
12
+ });
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseSchema = ICommandResponseSchema(
16
+ z.object({
17
+ data: z.array(ImageEditorJobSchema),
18
+ page: z.number(),
19
+ totalPages: z.number(),
20
+ }),
21
+ );
22
+ export type Response = z.infer<typeof ResponseSchema>;
23
+ }
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageEditorJobSchema } from '../models';
4
+
5
+ export namespace FindImageJobsQuery {
6
+ export const RequestSchema = z.object({
7
+ userId: z.string().uuid().optional(),
8
+ unregisteredUserId: z.string().uuid().optional(),
9
+ title: z.string().optional(),
10
+ limit: z.coerce.number().min(1).optional(),
11
+ offset: z.coerce.number().min(0).default(0).optional(),
12
+ });
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseSchema = ICommandResponseSchema(
16
+ z.object({
17
+ data: z.array(ImageEditorJobSchema),
18
+ page: z.number(),
19
+ totalPages: z.number(),
20
+ }),
21
+ );
22
+ export type Response = z.infer<typeof ResponseSchema>;
23
+ }
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageEditorConfigSchema } from '../models';
4
+
5
+ export namespace GetImageEditorConfigQuery {
6
+ export const ResponseSchema = ICommandResponseSchema(ImageEditorConfigSchema);
7
+ export type Response = z.infer<typeof ResponseSchema>;
8
+ }
@@ -0,0 +1,3 @@
1
+ export * from './find-image-editor-job-by-id.query';
2
+ export * from './find-image-editor-jobs.query';
3
+ export * from './get-image-editor-config.query';
@@ -0,0 +1,11 @@
1
+ export const IMAGE_EDITOR_AMQP_ROUTES = {
2
+ EXECUTE: 'tools.image.execute.rpc',
3
+ CONFIG: 'tools.image.config.rpc',
4
+ GET_JOB: 'tools.image.jobs.get.rpc',
5
+ LIST_JOBS: 'tools.image.jobs.list.rpc',
6
+ SET_REACTION: 'tools.image.jobs.set-reaction.rpc',
7
+ UPDATE_TITLE: 'tools.image.jobs.update-title.rpc',
8
+ SOFT_DELETE: 'tools.image.jobs.soft-delete.rpc',
9
+ SOFT_DELETE_ALL: 'tools.image.jobs.soft-delete-all.rpc',
10
+ RETRY: 'tools.image.jobs.retry.rpc',
11
+ } as const;
@@ -0,0 +1,5 @@
1
+ export const IMAGE_EDITOR_CONTROLLER = 'image-editor';
2
+
3
+ export const IMAGE_EDITOR_ROUTES = {
4
+ KIE_NANO_BANANA_CALLBACK: 'kie/nano-banana/callback',
5
+ };
@@ -0,0 +1,2 @@
1
+ export * from './image-editor.amqp.routes';
2
+ export * from './image-editor.http.routes';
package/index.ts CHANGED
@@ -5,6 +5,7 @@ export * from './stt';
5
5
  export * from './tts';
6
6
  export * from './language';
7
7
  export * from './video';
8
+ export * from './image-editor';
8
9
 
9
10
  import * as common from './common';
10
11
  import * as paraphrase from './paraphrase';
@@ -14,6 +15,7 @@ import * as tts from './tts';
14
15
  import * as presentation from './presentation';
15
16
  import * as language from './language';
16
17
  import * as video from './video';
18
+ import * as imageEditor from './image-editor';
17
19
 
18
20
  export namespace ToolService {
19
21
  export import Common = common;
@@ -24,4 +26,5 @@ export namespace ToolService {
24
26
  export import Presentation = presentation;
25
27
  export import Language = language;
26
28
  export import Video = video;
29
+ export import ImageEditor = imageEditor;
27
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {