@purpleschool/gptbot-tools 0.0.118 → 0.0.119-stage-2

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 (141) hide show
  1. package/build/image-editor/commands/get-image-editor-price.command.js +24 -0
  2. package/build/image-editor/commands/image-editor.command.js +2 -1
  3. package/build/image-editor/commands/index.js +1 -0
  4. package/build/image-editor/commands/retry-image-editor-job.command.js +2 -1
  5. package/build/image-editor/commands/update-published-status-image-editor-jobs.command.js +7 -1
  6. package/build/image-editor/models/image-editor-job.schema.js +2 -0
  7. package/build/image-editor/routes/image-editor.amqp.routes.js +1 -0
  8. package/build/image-generation/commands/execute-image-generation.command.js +3 -2
  9. package/build/image-generation/commands/get-image-generation-price.command.js +22 -0
  10. package/build/image-generation/commands/index.js +1 -0
  11. package/build/image-generation/commands/retry-image-generation-job.command.js +4 -3
  12. package/build/image-generation/commands/update-published-status-image-generation-jobs.command.js +7 -1
  13. package/build/image-generation/models/image-generation-job.schema.js +2 -0
  14. package/build/image-generation/queries/find-image-generation-job-by-id.query.js +1 -5
  15. package/build/image-generation/routes/image-generation.amqp.routes.js +1 -0
  16. package/build/music/commands/generate-music.command.js +2 -1
  17. package/build/music/commands/get-music-price.command.js +19 -0
  18. package/build/music/commands/index.js +1 -0
  19. package/build/music/commands/retry-music-job.command.js +2 -1
  20. package/build/music/commands/update-published-status-music-jobs.command.js +7 -1
  21. package/build/music/models/music-job.schema.js +2 -0
  22. package/build/music/routes/music.amqp.routes.js +1 -0
  23. package/build/paraphrase/commands/get-paraphrase-price.command.js +15 -0
  24. package/build/paraphrase/commands/index.js +1 -0
  25. package/build/paraphrase/commands/paraphrase.command.js +2 -1
  26. package/build/paraphrase/commands/retry-paraphrase-job.command.js +2 -1
  27. package/build/paraphrase/models/paraphrase-job.schema.js +1 -0
  28. package/build/paraphrase/routes/paraphrase.amqp.routes.js +1 -0
  29. package/build/presentation/commands/generate-slides.command.js +2 -1
  30. package/build/presentation/commands/get-presentation-slides-generation-price.command.js +15 -0
  31. package/build/presentation/commands/index.js +1 -0
  32. package/build/presentation/models/presentation.schema.js +1 -0
  33. package/build/presentation/routes/presentation.routes.js +1 -0
  34. package/build/stt/commands/get-stt-price.command.js +16 -0
  35. package/build/stt/commands/index.js +1 -0
  36. package/build/stt/commands/retry-stt-job.command.js +2 -1
  37. package/build/stt/commands/stt.command.js +2 -1
  38. package/build/stt/models/stt-job.schema.js +1 -0
  39. package/build/stt/routes/stt.amqp.routes.js +1 -0
  40. package/build/tools/events/index.js +1 -0
  41. package/build/tools/events/tool-job-failed.event.js +14 -0
  42. package/build/tools/models/tool-job.schema.js +1 -0
  43. package/build/tools/routes/tools.aqmp.routes.js +1 -0
  44. package/build/tts/commands/get-tts-price.command.js +16 -0
  45. package/build/tts/commands/index.js +1 -0
  46. package/build/tts/commands/retry-tts-job.command.js +2 -1
  47. package/build/tts/commands/tts.command.js +2 -1
  48. package/build/tts/models/tts-job.schema.js +1 -0
  49. package/build/tts/routes/tts.amqp.routes.js +1 -0
  50. package/build/video/commands/get-video-price.command.js +17 -0
  51. package/build/video/commands/index.js +1 -0
  52. package/build/video/commands/retry-video-job.command.js +2 -1
  53. package/build/video/commands/update-published-status-video-jobs.command.js +7 -1
  54. package/build/video/commands/video.command.js +2 -1
  55. package/build/video/models/video-job.schema.js +3 -0
  56. package/build/video/routes/video.amqp.routes.js +1 -0
  57. package/build/video-editor/commands/edit-video.command.js +2 -1
  58. package/build/video-editor/commands/get-video-editor-price.command.js +15 -0
  59. package/build/video-editor/commands/index.js +1 -0
  60. package/build/video-editor/commands/retry-video-editor-job.command.js +2 -1
  61. package/build/video-editor/commands/update-published-status-video-editor-jobs.command.js +7 -1
  62. package/build/video-editor/models/video-editor-job.schema.js +2 -0
  63. package/build/video-editor/queries/find-video-editor-job-by-id.query.js +1 -5
  64. package/build/video-editor/routes/video-editor.amqp.routes.js +1 -0
  65. package/build/writer/commands/generate-document-contents.command.js +2 -1
  66. package/build/writer/commands/get-writer-content-generation-price.command.js +16 -0
  67. package/build/writer/commands/index.js +1 -0
  68. package/build/writer/models/writer-document.schema.js +1 -0
  69. package/build/writer/routes/writer.routes.js +1 -0
  70. package/image-editor/commands/get-image-editor-price.command.ts +26 -0
  71. package/image-editor/commands/image-editor.command.ts +2 -1
  72. package/image-editor/commands/index.ts +1 -0
  73. package/image-editor/commands/retry-image-editor-job.command.ts +2 -1
  74. package/image-editor/commands/update-published-status-image-editor-jobs.command.ts +9 -3
  75. package/image-editor/models/image-editor-job.schema.ts +2 -0
  76. package/image-editor/routes/image-editor.amqp.routes.ts +1 -0
  77. package/image-generation/commands/execute-image-generation.command.ts +3 -2
  78. package/image-generation/commands/get-image-generation-price.command.ts +24 -0
  79. package/image-generation/commands/index.ts +1 -0
  80. package/image-generation/commands/retry-image-generation-job.command.ts +4 -3
  81. package/image-generation/commands/update-published-status-image-generation-jobs.command.ts +9 -3
  82. package/image-generation/models/image-generation-job.schema.ts +2 -0
  83. package/image-generation/queries/find-image-generation-job-by-id.query.ts +5 -9
  84. package/image-generation/routes/image-generation.amqp.routes.ts +1 -0
  85. package/music/commands/generate-music.command.ts +2 -1
  86. package/music/commands/get-music-price.command.ts +21 -0
  87. package/music/commands/index.ts +1 -0
  88. package/music/commands/retry-music-job.command.ts +2 -1
  89. package/music/commands/update-published-status-music-jobs.command.ts +9 -3
  90. package/music/models/music-job.schema.ts +2 -0
  91. package/music/routes/music.amqp.routes.ts +1 -0
  92. package/package.json +1 -1
  93. package/paraphrase/commands/get-paraphrase-price.command.ts +16 -0
  94. package/paraphrase/commands/index.ts +1 -0
  95. package/paraphrase/commands/paraphrase.command.ts +2 -1
  96. package/paraphrase/commands/retry-paraphrase-job.command.ts +2 -1
  97. package/paraphrase/models/paraphrase-job.schema.ts +1 -0
  98. package/paraphrase/routes/paraphrase.amqp.routes.ts +1 -0
  99. package/presentation/commands/generate-slides.command.ts +2 -1
  100. package/presentation/commands/get-presentation-slides-generation-price.command.ts +16 -0
  101. package/presentation/commands/index.ts +1 -0
  102. package/presentation/models/presentation.schema.ts +1 -0
  103. package/presentation/routes/presentation.routes.ts +1 -0
  104. package/stt/commands/get-stt-price.command.ts +17 -0
  105. package/stt/commands/index.ts +1 -0
  106. package/stt/commands/retry-stt-job.command.ts +2 -1
  107. package/stt/commands/stt.command.ts +2 -1
  108. package/stt/models/stt-job.schema.ts +1 -0
  109. package/stt/routes/stt.amqp.routes.ts +1 -0
  110. package/tools/enums/index.ts +1 -1
  111. package/tools/enums/job-request-origin.enum.ts +3 -3
  112. package/tools/events/index.ts +1 -0
  113. package/tools/events/tool-job-failed.event.ts +13 -0
  114. package/tools/models/tool-job.schema.ts +1 -0
  115. package/tools/routes/tools.aqmp.routes.ts +1 -0
  116. package/tts/commands/get-tts-price.command.ts +17 -0
  117. package/tts/commands/index.ts +1 -0
  118. package/tts/commands/retry-tts-job.command.ts +2 -1
  119. package/tts/commands/tts.command.ts +2 -1
  120. package/tts/models/tts-job.schema.ts +1 -0
  121. package/tts/routes/tts.amqp.routes.ts +1 -0
  122. package/video/commands/get-video-price.command.ts +18 -0
  123. package/video/commands/index.ts +1 -0
  124. package/video/commands/retry-video-job.command.ts +2 -1
  125. package/video/commands/update-published-status-video-jobs.command.ts +9 -3
  126. package/video/commands/video.command.ts +2 -1
  127. package/video/models/video-job.schema.ts +3 -0
  128. package/video/routes/video.amqp.routes.ts +1 -0
  129. package/video-editor/commands/edit-video.command.ts +2 -1
  130. package/video-editor/commands/get-video-editor-price.command.ts +16 -0
  131. package/video-editor/commands/index.ts +1 -0
  132. package/video-editor/commands/retry-video-editor-job.command.ts +2 -1
  133. package/video-editor/commands/update-published-status-video-editor-jobs.command.ts +9 -3
  134. package/video-editor/models/video-editor-job.schema.ts +2 -0
  135. package/video-editor/queries/find-video-editor-job-by-id.query.ts +5 -9
  136. package/video-editor/routes/video-editor.amqp.routes.ts +1 -0
  137. package/writer/commands/generate-document-contents.command.ts +2 -1
  138. package/writer/commands/get-writer-content-generation-price.command.ts +17 -0
  139. package/writer/commands/index.ts +1 -0
  140. package/writer/models/writer-document.schema.ts +1 -0
  141. package/writer/routes/writer.routes.ts +1 -0
@@ -25,6 +25,7 @@ exports.TTSJobSchema = zod_1.z.object({
25
25
  duration: zod_1.z.number(),
26
26
  userId: zod_1.z.string().nullable(),
27
27
  unregisteredUserId: zod_1.z.string().nullable(),
28
+ tokenReservationId: zod_1.z.string().nullable().optional(),
28
29
  isDeleted: zod_1.z.boolean(),
29
30
  params: exports.TTSJobParamsSchema,
30
31
  createdAt: zod_1.z.date(),
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TTS_AMQP_ROUTES = void 0;
4
4
  exports.TTS_AMQP_ROUTES = {
5
5
  EXECUTE: 'tools.tts.execute.rpc',
6
+ GET_PRICE: 'tools.tts.get-price.rpc',
6
7
  CONFIG: 'tools.tts.config.rpc',
7
8
  GET_JOB: 'tools.tts.jobs.get.rpc',
8
9
  LIST_JOBS: 'tools.tts.jobs.list.rpc',
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetVideoPriceCommand = 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 GetVideoPriceCommand;
8
+ (function (GetVideoPriceCommand) {
9
+ GetVideoPriceCommand.RequestSchema = zod_1.z.object({
10
+ modelId: zod_1.z.string(),
11
+ params: models_1.VideoGenerationRequestParamsSchema,
12
+ });
13
+ GetVideoPriceCommand.ResponseDataSchema = zod_1.z.object({
14
+ price: zod_1.z.number(),
15
+ });
16
+ GetVideoPriceCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(GetVideoPriceCommand.ResponseDataSchema);
17
+ })(GetVideoPriceCommand || (exports.GetVideoPriceCommand = GetVideoPriceCommand = {}));
@@ -19,6 +19,7 @@ __exportStar(require("./delete-all-video-jobs.command"), exports);
19
19
  __exportStar(require("./retry-video-job.command"), exports);
20
20
  __exportStar(require("./set-reaction-to-video-job.command"), exports);
21
21
  __exportStar(require("./video.command"), exports);
22
+ __exportStar(require("./get-video-price.command"), exports);
22
23
  __exportStar(require("./update-video-job-title.command"), exports);
23
24
  __exportStar(require("./video-model"), exports);
24
25
  __exportStar(require("./update-published-status-video-jobs.command"), exports);
@@ -9,12 +9,13 @@ var RetryVideoJobCommand;
9
9
  (function (RetryVideoJobCommand) {
10
10
  RetryVideoJobCommand.RequestSchema = zod_1.z.object({
11
11
  uuid: zod_1.z.string().uuid(),
12
- userBalance: zod_1.z.number(),
13
12
  userId: zod_1.z.string().uuid().nullable().optional(),
14
13
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
15
14
  prompt: zod_1.z.string().optional(),
16
15
  modelId: zod_1.z.string().uuid().optional(),
17
16
  params: models_1.VideoGenerationRequestParamsSchema.optional(),
17
+ tokenReservationId: zod_1.z.string().uuid(),
18
+ precalculatedPrice: zod_1.z.number(),
18
19
  });
19
20
  RetryVideoJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_job_schema_1.VideoJobSchema);
20
21
  })(RetryVideoJobCommand || (exports.RetryVideoJobCommand = RetryVideoJobCommand = {}));
@@ -12,8 +12,14 @@ var UpdatePublishedStatusVideoJobsCommand;
12
12
  userId: zod_1.z.string().uuid().nullable().optional(),
13
13
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
14
14
  }),
15
- data: zod_1.z.object({
15
+ data: zod_1.z
16
+ .object({
16
17
  isPublished: zod_1.z.boolean(),
18
+ postId: zod_1.z.string().nullable().optional(),
19
+ })
20
+ .refine((data) => (data.isPublished ? !!data.postId : true), {
21
+ message: 'Post ID is required when job is published',
22
+ path: ['postId'],
17
23
  }),
18
24
  });
19
25
  UpdatePublishedStatusVideoJobsCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.VideoJobSchema);
@@ -11,9 +11,10 @@ var VideoCommand;
11
11
  userId: zod_1.z.string().uuid().nullable().optional(),
12
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
13
  prompt: zod_1.z.string(),
14
- userBalance: zod_1.z.number(),
15
14
  modelId: zod_1.z.string(),
16
15
  params: models_1.VideoGenerationRequestParamsSchema,
16
+ tokenReservationId: zod_1.z.string().uuid(),
17
+ precalculatedPrice: zod_1.z.number(),
17
18
  });
18
19
  VideoCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_job_schema_1.VideoJobSchema);
19
20
  })(VideoCommand || (exports.VideoCommand = VideoCommand = {}));
@@ -17,6 +17,8 @@ exports.VideoJobSchema = zod_1.z.object({
17
17
  uuid: zod_1.z.string(),
18
18
  prompt: zod_1.z.string(),
19
19
  reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
20
+ isPublished: zod_1.z.boolean(),
21
+ postId: zod_1.z.string().nullable(),
20
22
  dislikeReason: zod_1.z.string().nullable(),
21
23
  externalId: zod_1.z.string().nullable(),
22
24
  title: zod_1.z.string(),
@@ -29,6 +31,7 @@ exports.VideoJobSchema = zod_1.z.object({
29
31
  attempts: zod_1.z.array(zod_1.z.any()),
30
32
  userId: zod_1.z.string().nullable().optional(),
31
33
  unregisteredUserId: zod_1.z.string().nullable().optional(),
34
+ tokenReservationId: zod_1.z.string().nullable().optional(),
32
35
  isDeleted: zod_1.z.boolean(),
33
36
  createdAt: zod_1.z.date(),
34
37
  completedAt: zod_1.z.date().nullable().optional(),
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VIDEO_AMQP_ROUTES = void 0;
4
4
  exports.VIDEO_AMQP_ROUTES = {
5
5
  EXECUTE: 'tools.video.execute.rpc',
6
+ GET_PRICE: 'tools.video.get-price.rpc',
6
7
  CONFIG: 'tools.video.config.rpc',
7
8
  GET_JOB: 'tools.video.jobs.get.rpc',
8
9
  LIST_JOBS: 'tools.video.jobs.list.rpc',
@@ -13,8 +13,9 @@ var EditVideoCommand;
13
13
  inputVideoId: zod_1.z.string().uuid(),
14
14
  inputVideoUrl: zod_1.z.string(),
15
15
  duration: zod_1.z.number(),
16
- userBalance: zod_1.z.number(),
17
16
  modelId: zod_1.z.string().uuid(),
17
+ tokenReservationId: zod_1.z.string().uuid(),
18
+ precalculatedPrice: zod_1.z.number(),
18
19
  });
19
20
  EditVideoCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.VideoEditorJobSchema);
20
21
  })(EditVideoCommand || (exports.EditVideoCommand = EditVideoCommand = {}));
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetVideoEditorPriceCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ var GetVideoEditorPriceCommand;
7
+ (function (GetVideoEditorPriceCommand) {
8
+ GetVideoEditorPriceCommand.RequestSchema = zod_1.z.object({
9
+ modelId: zod_1.z.string(),
10
+ });
11
+ GetVideoEditorPriceCommand.ResponseDataSchema = zod_1.z.object({
12
+ price: zod_1.z.number(),
13
+ });
14
+ GetVideoEditorPriceCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(GetVideoEditorPriceCommand.ResponseDataSchema);
15
+ })(GetVideoEditorPriceCommand || (exports.GetVideoEditorPriceCommand = GetVideoEditorPriceCommand = {}));
@@ -21,4 +21,5 @@ __exportStar(require("./set-reaction-to-video-editor-job.command"), exports);
21
21
  __exportStar(require("./update-video-editor-job-title.command"), exports);
22
22
  __exportStar(require("./update-published-status-video-editor-jobs.command"), exports);
23
23
  __exportStar(require("./edit-video.command"), exports);
24
+ __exportStar(require("./get-video-editor-price.command"), exports);
24
25
  __exportStar(require("./video-editor-model"), exports);
@@ -8,7 +8,6 @@ var RetryVideoEditorJobCommand;
8
8
  (function (RetryVideoEditorJobCommand) {
9
9
  RetryVideoEditorJobCommand.RequestSchema = zod_1.z.object({
10
10
  uuid: zod_1.z.string().uuid(),
11
- userBalance: zod_1.z.number(),
12
11
  userId: zod_1.z.string().uuid().nullable().optional(),
13
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
14
13
  prompt: zod_1.z.string().optional(),
@@ -16,6 +15,8 @@ var RetryVideoEditorJobCommand;
16
15
  inputVideoUrl: zod_1.z.string().optional(),
17
16
  duration: zod_1.z.number().optional(),
18
17
  modelId: zod_1.z.string().uuid().optional(),
18
+ tokenReservationId: zod_1.z.string().uuid(),
19
+ precalculatedPrice: zod_1.z.number(),
19
20
  });
20
21
  RetryVideoEditorJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_editor_job_schema_1.VideoEditorJobSchema);
21
22
  })(RetryVideoEditorJobCommand || (exports.RetryVideoEditorJobCommand = RetryVideoEditorJobCommand = {}));
@@ -12,8 +12,14 @@ var UpdatePublishedStatusVideoEditorJobsCommand;
12
12
  userId: zod_1.z.string().uuid().nullable().optional(),
13
13
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
14
14
  }),
15
- data: zod_1.z.object({
15
+ data: zod_1.z
16
+ .object({
16
17
  isPublished: zod_1.z.boolean(),
18
+ postId: zod_1.z.string().nullable().optional(),
19
+ })
20
+ .refine((data) => (data.isPublished ? !!data.postId : true), {
21
+ message: 'Post ID is required when job is published',
22
+ path: ['postId'],
17
23
  }),
18
24
  });
19
25
  UpdatePublishedStatusVideoEditorJobsCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_editor_job_schema_1.VideoEditorJobSchema);
@@ -23,7 +23,9 @@ exports.VideoEditorJobSchema = zod_1.z.object({
23
23
  attempts: zod_1.z.array(zod_1.z.any()),
24
24
  userId: zod_1.z.string().nullable().optional(),
25
25
  unregisteredUserId: zod_1.z.string().nullable().optional(),
26
+ tokenReservationId: zod_1.z.string().nullable().optional(),
26
27
  isPublished: zod_1.z.boolean(),
28
+ postId: zod_1.z.string().nullable(),
27
29
  isDeleted: zod_1.z.boolean(),
28
30
  createdAt: zod_1.z.date(),
29
31
  completedAt: zod_1.z.date().nullable().optional(),
@@ -6,14 +6,10 @@ const command_response_schema_1 = require("../../common/models/command-response.
6
6
  const video_editor_job_schema_1 = require("../models/video-editor-job.schema");
7
7
  var FindVideoEditorJobByIdQuery;
8
8
  (function (FindVideoEditorJobByIdQuery) {
9
- FindVideoEditorJobByIdQuery.RequestSchema = zod_1.z
10
- .object({
9
+ FindVideoEditorJobByIdQuery.RequestSchema = zod_1.z.object({
11
10
  uuid: zod_1.z.string(),
12
11
  userId: zod_1.z.string().uuid().nullable().optional(),
13
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
14
- })
15
- .refine((data) => data.userId || data.unregisteredUserId, {
16
- message: 'Either userId or unregisteredUserId must be provided',
17
13
  });
18
14
  FindVideoEditorJobByIdQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_editor_job_schema_1.VideoEditorJobSchema);
19
15
  })(FindVideoEditorJobByIdQuery || (exports.FindVideoEditorJobByIdQuery = FindVideoEditorJobByIdQuery = {}));
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VIDEO_EDITOR_AMQP_ROUTES = void 0;
4
4
  exports.VIDEO_EDITOR_AMQP_ROUTES = {
5
5
  EXECUTE: 'tools.video-editor.execute.rpc',
6
+ GET_PRICE: 'tools.video-editor.get-price.rpc',
6
7
  CONFIG: 'tools.video-editor.config.rpc',
7
8
  GET_JOB: 'tools.video-editor.jobs.get.rpc',
8
9
  LIST_JOBS: 'tools.video-editor.jobs.list.rpc',
@@ -10,7 +10,8 @@ var GenerateWriterDocumentContentsCommand;
10
10
  documentId: zod_1.z.string().uuid(),
11
11
  userId: zod_1.z.string().uuid().nullable().optional(),
12
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
- userBalance: zod_1.z.number(),
13
+ tokenReservationId: zod_1.z.string().uuid(),
14
+ precalculatedPrice: zod_1.z.number(),
14
15
  modelId: zod_1.z.string(),
15
16
  });
16
17
  GenerateWriterDocumentContentsCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(models_1.WriterDocumentSchema);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetWriterContentGenerationPriceCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ var GetWriterContentGenerationPriceCommand;
7
+ (function (GetWriterContentGenerationPriceCommand) {
8
+ GetWriterContentGenerationPriceCommand.RequestSchema = zod_1.z.object({
9
+ documentId: zod_1.z.string().uuid(),
10
+ modelId: zod_1.z.string().uuid(),
11
+ });
12
+ GetWriterContentGenerationPriceCommand.ResponseDataSchema = zod_1.z.object({
13
+ price: zod_1.z.number(),
14
+ });
15
+ GetWriterContentGenerationPriceCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(GetWriterContentGenerationPriceCommand.ResponseDataSchema);
16
+ })(GetWriterContentGenerationPriceCommand || (exports.GetWriterContentGenerationPriceCommand = GetWriterContentGenerationPriceCommand = {}));
@@ -20,6 +20,7 @@ __exportStar(require("./delete-all-user-writer-documents.command"), exports);
20
20
  __exportStar(require("./update-writer-document-outline.command"), exports);
21
21
  __exportStar(require("./export-writer-document-as-docx.command"), exports);
22
22
  __exportStar(require("./generate-document-contents.command"), exports);
23
+ __exportStar(require("./get-writer-content-generation-price.command"), exports);
23
24
  __exportStar(require("./writer-paraphrase.command"), exports);
24
25
  __exportStar(require("./writer-extend-text.command"), exports);
25
26
  __exportStar(require("./writer-shorten-text.command"), exports);
@@ -21,6 +21,7 @@ exports.WriterDocumentSchema = zod_1.z.object({
21
21
  dislikeReason: zod_1.z.string().nullable(),
22
22
  pages: zod_1.z.number(),
23
23
  isDeleted: zod_1.z.boolean(),
24
+ tokenReservationId: zod_1.z.string().nullable().optional(),
24
25
  createdAt: zod_1.z.date(),
25
26
  updatedAt: zod_1.z.date(),
26
27
  completedAt: zod_1.z.date().nullable(),
@@ -11,6 +11,7 @@ exports.WRITER_AMQP_ROUTES = {
11
11
  UPDATE_DOCUMENT_OUTLINE: 'tools.writer.update-document-outline.rpc',
12
12
  UPDATE_DOCUMENT_CONTENTS: 'tools.writer.update-document-contents.rpc',
13
13
  GENERATE_DOCUMENT_CONTENTS: 'tools.writer.generate-document-contents.rpc',
14
+ GET_CONTENT_GENERATION_PRICE: 'tools.writer.content-generation.get-price.rpc',
14
15
  PARAPHRASE: 'tools.writer.actions.paraphrase.rpc',
15
16
  EXTEND_TEXT: 'tools.writer.actions.extend-text.rpc',
16
17
  SHORTEN_TEXT: 'tools.writer.actions.shorten-text.rpc',
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { AttachedFileSchema } from '../../common';
4
+
5
+ export namespace GetImageEditorPriceCommand {
6
+ export const RequestSchema = z.object({
7
+ modelId: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ prompt: z.string(),
11
+ params: z.object({
12
+ attachedFiles: z.array(AttachedFileSchema),
13
+ systemPromptId: z.string().optional(),
14
+ }),
15
+ userHasActiveSubscriptionOrProduct: z.boolean(),
16
+ });
17
+ export type Request = z.infer<typeof RequestSchema>;
18
+
19
+ export const ResponseDataSchema = z.object({
20
+ price: z.number(),
21
+ });
22
+ export type ResponseData = z.infer<typeof ResponseDataSchema>;
23
+
24
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
25
+ export type Response = z.infer<typeof ResponseSchema>;
26
+ }
@@ -8,13 +8,14 @@ export namespace ImageEditorCommand {
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
10
  prompt: z.string(),
11
- userBalance: z.number(),
12
11
  modelId: z.string(),
13
12
  params: z.object({
14
13
  attachedFiles: z.array(AttachedFileSchema),
15
14
  systemPromptId: z.string().optional(),
16
15
  }),
17
16
  userHasActiveSubscriptionOrProduct: z.boolean(),
17
+ tokenReservationId: z.string().uuid(),
18
+ precalculatedPrice: z.number(),
18
19
  });
19
20
  export type Request = z.infer<typeof RequestSchema>;
20
21
 
@@ -1,5 +1,6 @@
1
1
  export * from './delete-image-editor-job-by-uuid.command';
2
2
  export * from './delete-all-image-editor-jobs.command';
3
+ export * from './get-image-editor-price.command';
3
4
  export * from './retry-image-editor-job.command';
4
5
  export * from './set-reaction-to-image-editor-job.command';
5
6
  export * from './image-editor.command';
@@ -5,10 +5,11 @@ import { ImageEditorJobParamsSchema, ImageEditorJobSchema } from '../models';
5
5
  export namespace RetryImageEditorJobCommand {
6
6
  export const RequestSchema = z.object({
7
7
  uuid: z.string().uuid(),
8
- userBalance: z.number(),
9
8
  userId: z.string().uuid().nullable().optional(),
10
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
11
10
  userHasActiveSubscriptionOrProduct: z.boolean(),
11
+ tokenReservationId: z.string().uuid(),
12
+ precalculatedPrice: z.number(),
12
13
  modelId: z.string().optional(),
13
14
  prompt: z.string().optional(),
14
15
  params: ImageEditorJobParamsSchema.optional(),
@@ -9,9 +9,15 @@ export namespace UpdatePublishedStatusImageEditorJobsCommand {
9
9
  userId: z.string().uuid().nullable().optional(),
10
10
  unregisteredUserId: z.string().uuid().nullable().optional(),
11
11
  }),
12
- data: z.object({
13
- isPublished: z.boolean(),
14
- }),
12
+ data: z
13
+ .object({
14
+ isPublished: z.boolean(),
15
+ postId: z.string().nullable().optional(),
16
+ })
17
+ .refine((data) => (data.isPublished ? !!data.postId : true), {
18
+ message: 'Post ID is required when job is published',
19
+ path: ['postId'],
20
+ }),
15
21
  });
16
22
  export type Request = z.infer<typeof RequestSchema>;
17
23
 
@@ -27,7 +27,9 @@ export const ImageEditorJobSchema = z.object({
27
27
  userId: z.string().nullable().optional(),
28
28
  unregisteredUserId: z.string().nullable().optional(),
29
29
  isPublished: z.boolean(),
30
+ postId: z.string().nullable(),
30
31
  isDeleted: z.boolean(),
32
+ tokenReservationId: z.string().nullable().optional(),
31
33
  createdAt: z.date(),
32
34
  completedAt: z.date().nullable().optional(),
33
35
  updatedAt: z.date(),
@@ -1,5 +1,6 @@
1
1
  export const IMAGE_EDITOR_AMQP_ROUTES = {
2
2
  EXECUTE: 'tools.image.execute.rpc',
3
+ GET_PRICE: 'tools.image.get-price.rpc',
3
4
  CONFIG: 'tools.image.config.rpc',
4
5
  GET_JOB: 'tools.image.jobs.get.rpc',
5
6
  LIST_JOBS: 'tools.image.jobs.list.rpc',
@@ -1,19 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
- import { ImageGenerationJobSchema, ImageGenerationRequestParamsSchema } from '../models';
4
3
  import { JOB_REQUEST_ORIGIN } from '../../tools';
4
+ import { ImageGenerationJobSchema, ImageGenerationRequestParamsSchema } from '../models';
5
5
 
6
6
  export namespace ExecuteImageGenerationCommand {
7
7
  export const RequestSchema = z.object({
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
10
  prompt: z.string(),
11
- userBalance: z.number(),
12
11
  modelId: z.string().uuid(),
13
12
  params: ImageGenerationRequestParamsSchema,
14
13
  presetId: z.string().uuid().nullable().optional(),
15
14
  origin: z.nativeEnum(JOB_REQUEST_ORIGIN).default(JOB_REQUEST_ORIGIN.API),
16
15
  userHasActiveSubscriptionOrProduct: z.boolean(),
16
+ tokenReservationId: z.string().uuid(),
17
+ precalculatedPrice: z.number(),
17
18
  });
18
19
  export type Request = z.infer<typeof RequestSchema>;
19
20
 
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageGenerationRequestParamsSchema } from '../models';
4
+
5
+ export namespace GetImageGenerationPriceCommand {
6
+ export const RequestSchema = z.object({
7
+ modelId: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ prompt: z.string(),
11
+ params: ImageGenerationRequestParamsSchema,
12
+ presetId: z.string().uuid().nullable().optional(),
13
+ userHasActiveSubscriptionOrProduct: z.boolean(),
14
+ });
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const ResponseDataSchema = z.object({
18
+ price: z.number(),
19
+ });
20
+ export type ResponseData = z.infer<typeof ResponseDataSchema>;
21
+
22
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
23
+ export type Response = z.infer<typeof ResponseSchema>;
24
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './execute-image-generation.command';
2
2
  export * from './forward-image-generation-job.command';
3
+ export * from './get-image-generation-price.command';
3
4
  export * from './save-image-generation-job.command';
4
5
  export * from './soft-delete-image-generation-job-by-uuid.command';
5
6
  export * from './soft-delete-image-generation-jobs-by-criteria.command';
@@ -7,12 +7,13 @@ export namespace RetryImageGenerationJobCommand {
7
7
  uuid: z.string().uuid(),
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
- prompt: z.string().optional(),
11
- userBalance: z.number(),
10
+ userHasActiveSubscriptionOrProduct: z.boolean(),
11
+ tokenReservationId: z.string().uuid(),
12
+ precalculatedPrice: z.number(),
12
13
  modelId: z.string().uuid().optional(),
14
+ prompt: z.string().optional(),
13
15
  params: ImageGenerationRequestParamsSchema.optional(),
14
16
  presetId: z.string().uuid().nullable().optional(),
15
- userHasActiveSubscriptionOrProduct: z.boolean(),
16
17
  });
17
18
  export type Request = z.infer<typeof RequestSchema>;
18
19
 
@@ -9,9 +9,15 @@ export namespace UpdatePublishedStatusImageGenerationJobsCommand {
9
9
  userId: z.string().uuid().nullable().optional(),
10
10
  unregisteredUserId: z.string().uuid().nullable().optional(),
11
11
  }),
12
- data: z.object({
13
- isPublished: z.boolean(),
14
- }),
12
+ data: z
13
+ .object({
14
+ isPublished: z.boolean(),
15
+ postId: z.string().nullable().optional(),
16
+ })
17
+ .refine((data) => (data.isPublished ? !!data.postId : true), {
18
+ message: 'Post ID is required when job is published',
19
+ path: ['postId'],
20
+ }),
15
21
  });
16
22
  export type Request = z.infer<typeof RequestSchema>;
17
23
 
@@ -29,8 +29,10 @@ export const ImageGenerationJobSchema = z.object({
29
29
  userId: z.string().nullable().optional(),
30
30
  unregisteredUserId: z.string().nullable().optional(),
31
31
  isPublished: z.boolean(),
32
+ postId: z.string().nullable(),
32
33
  isDeleted: z.boolean(),
33
34
  internalError: z.string().nullable(),
35
+ tokenReservationId: z.string().nullable().optional(),
34
36
  createdAt: z.date(),
35
37
  updatedAt: z.date(),
36
38
  });
@@ -3,15 +3,11 @@ import { ICommandResponseSchema } from '../../common/models/command-response.sch
3
3
  import { ImageGenerationJobSchema } from '../models';
4
4
 
5
5
  export namespace FindImageGenerationJobByIdQuery {
6
- export const RequestSchema = z
7
- .object({
8
- uuid: z.string(),
9
- userId: z.string().uuid().nullable().optional(),
10
- unregisteredUserId: z.string().uuid().nullable().optional(),
11
- })
12
- .refine((data) => data.userId || data.unregisteredUserId, {
13
- message: 'Either userId or unregisteredUserId must be provided',
14
- });
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ });
15
11
  export type Request = z.infer<typeof RequestSchema>;
16
12
 
17
13
  export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
@@ -1,5 +1,6 @@
1
1
  export const IMAGE_GENERATION_AMQP_ROUTES = {
2
2
  EXECUTE: 'tools.image-generation.execute.rpc',
3
+ GET_PRICE: 'tools.image-generation.get-price.rpc',
3
4
  CONFIG: 'tools.image-generation.config.rpc',
4
5
  FORWARD_JOB: 'tools.image-generation.jobs.forward.rpc',
5
6
  GET_JOB: 'tools.image-generation.jobs.get.rpc',
@@ -7,9 +7,10 @@ export namespace GenerateMusicCommand {
7
7
  export const RequestSchema = z.object({
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
- userBalance: z.number(),
11
10
  modelId: z.string(),
12
11
  params: MusicJobParamsSchema,
12
+ tokenReservationId: z.string().uuid(),
13
+ precalculatedPrice: z.number(),
13
14
  });
14
15
  export type Request = z.infer<typeof RequestSchema>;
15
16
 
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { MusicJobParamsSchema } from '../models';
4
+
5
+ export namespace GetMusicPriceCommand {
6
+ export const RequestSchema = z.object({
7
+ modelId: z.string(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ params: MusicJobParamsSchema,
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseDataSchema = z.object({
15
+ price: z.number(),
16
+ });
17
+ export type ResponseData = z.infer<typeof ResponseDataSchema>;
18
+
19
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
20
+ export type Response = z.infer<typeof ResponseSchema>;
21
+ }
@@ -3,6 +3,7 @@ export * from './delete-all-music-jobs.command';
3
3
  export * from './retry-music-job.command';
4
4
  export * from './set-reaction-to-music-job.command';
5
5
  export * from './generate-music.command';
6
+ export * from './get-music-price.command';
6
7
  export * from './update-music-job-title.command';
7
8
  export * from './convert-to-wav.command';
8
9
  export * from './generate-lyrics.command';
@@ -5,9 +5,10 @@ import { MusicJobParamsSchema, MusicJobSchema } from '../models/music-job.schema
5
5
  export namespace RetryMusicJobCommand {
6
6
  export const RequestSchema = z.object({
7
7
  uuid: z.string().uuid(),
8
- userBalance: z.number(),
9
8
  userId: z.string().uuid().nullable().optional(),
10
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ tokenReservationId: z.string().uuid(),
11
+ precalculatedPrice: z.number(),
11
12
  modelId: z.string().uuid().optional(),
12
13
  params: MusicJobParamsSchema.optional(),
13
14
  });
@@ -9,9 +9,15 @@ export namespace UpdatePublishedStatusMusicJobsCommand {
9
9
  userId: z.string().uuid().nullable().optional(),
10
10
  unregisteredUserId: z.string().uuid().nullable().optional(),
11
11
  }),
12
- data: z.object({
13
- isPublished: z.boolean(),
14
- }),
12
+ data: z
13
+ .object({
14
+ isPublished: z.boolean(),
15
+ postId: z.string().nullable().optional(),
16
+ })
17
+ .refine((data) => (data.isPublished ? !!data.postId : true), {
18
+ message: 'Post ID is required when job is published',
19
+ path: ['postId'],
20
+ }),
15
21
  });
16
22
  export type Request = z.infer<typeof RequestSchema>;
17
23
 
@@ -48,7 +48,9 @@ export const MusicJobSchema = z.object({
48
48
  userId: z.string().nullable().optional(),
49
49
  unregisteredUserId: z.string().nullable().optional(),
50
50
  isPublished: z.boolean(),
51
+ postId: z.string().nullable(),
51
52
  isDeleted: z.boolean(),
53
+ tokenReservationId: z.string().nullable().optional(),
52
54
  createdAt: z.date(),
53
55
  completedAt: z.date().nullable().optional(),
54
56
  updatedAt: z.date(),
@@ -1,5 +1,6 @@
1
1
  export const MUSIC_AMQP_ROUTES = {
2
2
  EXECUTE: 'tools.music.execute.rpc',
3
+ GET_PRICE: 'tools.music.get-price.rpc',
3
4
  GENERATE_LYRICS: 'tools.music.generate-lyrics.rpc',
4
5
  CONVERT_TO_WAV: 'tools.music.convert-to-wav.rpc',
5
6
  CONFIG: 'tools.music.config.rpc',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.0.118",
3
+ "version": "0.0.119-stage-2",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {