@purpleschool/gptbot-tools 0.0.73 → 0.0.74

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.
@@ -11,6 +11,11 @@ exports.ERRORS = {
11
11
  message: 'Произошла ошибка при поиске инструмента',
12
12
  httpCode: 500,
13
13
  },
14
+ GET_GLOBAL_TOOLS_CONFIG_ERROR: {
15
+ code: 'TOOL.GET_GLOBAL_TOOLS_CONFIG_ERROR',
16
+ message: 'Произошла ошибка при получении глобальных конфигураций инструментов',
17
+ httpCode: 500,
18
+ },
14
19
  },
15
20
  // PARAPHRASE
16
21
  PARAPHRASE: {
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./job-status.enum"), exports);
18
18
  __exportStar(require("./tool-type.enum"), exports);
19
- __exportStar(require("./content-type.enum"), exports);
19
+ __exportStar(require("./tool-content-type.enum"), exports);
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GlobalToolsConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const enums_1 = require("../enums");
6
+ const video_1 = require("../../video");
7
+ const music_1 = require("../../music");
8
+ const writer_1 = require("../../writer");
9
+ const image_editor_1 = require("../../image-editor");
10
+ const paraphrase_1 = require("../../paraphrase");
11
+ const presentation_1 = require("../../presentation");
12
+ const video_editor_1 = require("../../video-editor");
13
+ const tts_1 = require("../../tts");
14
+ const stt_1 = require("../../stt");
15
+ exports.GlobalToolsConfigSchema = zod_1.z.object({
16
+ [enums_1.TOOL_CONTENT_TYPE.VIDEO]: video_1.VideoConfigSchema,
17
+ [enums_1.TOOL_CONTENT_TYPE.MUSIC]: music_1.MusicConfigSchema,
18
+ [enums_1.TOOL_CONTENT_TYPE.WRITER]: writer_1.WriterConfigSchema,
19
+ [enums_1.TOOL_CONTENT_TYPE.IMAGE_EDITOR]: image_editor_1.ImageEditorConfigSchema,
20
+ [enums_1.TOOL_CONTENT_TYPE.REPHRASE]: paraphrase_1.ParaphraseToolConfigSchema,
21
+ [enums_1.TOOL_CONTENT_TYPE.PRESENTATION]: presentation_1.PresentationConfigSchema,
22
+ [enums_1.TOOL_CONTENT_TYPE.VIDEO_EDITOR]: video_editor_1.VideoEditorConfigSchema,
23
+ [enums_1.TOOL_CONTENT_TYPE.TEXT_TO_SPEECH]: tts_1.TTSConfigSchema,
24
+ [enums_1.TOOL_CONTENT_TYPE.SPEECH_TO_TEXT]: stt_1.STTConfigSchema,
25
+ });
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./tool-job.schema"), exports);
18
18
  __exportStar(require("./tool.schema"), exports);
19
+ __exportStar(require("./global-tools-config.schema"), exports);
20
+ __exportStar(require("./tools-with-configs.schema"), exports);
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ToolsWithConfigsSchema = exports.ToolWithConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const enums_1 = require("../enums");
6
+ const video_1 = require("../../video");
7
+ const music_1 = require("../../music");
8
+ const writer_1 = require("../../writer");
9
+ const image_editor_1 = require("../../image-editor");
10
+ const paraphrase_1 = require("../../paraphrase");
11
+ const presentation_1 = require("../../presentation");
12
+ const video_editor_1 = require("../../video-editor");
13
+ const tts_1 = require("../../tts");
14
+ const stt_1 = require("../../stt");
15
+ const tool_schema_1 = require("./tool.schema");
16
+ // Discriminated union array: Tools with their configs
17
+ exports.ToolWithConfigSchema = zod_1.z.discriminatedUnion('contentType', [
18
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
19
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.VIDEO),
20
+ config: video_1.VideoConfigSchema,
21
+ })),
22
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
23
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.MUSIC),
24
+ config: music_1.MusicConfigSchema,
25
+ })),
26
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
27
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.WRITER),
28
+ config: writer_1.WriterConfigSchema,
29
+ })),
30
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
31
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.IMAGE_EDITOR),
32
+ config: image_editor_1.ImageEditorConfigSchema,
33
+ })),
34
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
35
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.REPHRASE),
36
+ config: paraphrase_1.ParaphraseToolConfigSchema,
37
+ })),
38
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
39
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.PRESENTATION),
40
+ config: presentation_1.PresentationConfigSchema,
41
+ })),
42
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
43
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.VIDEO_EDITOR),
44
+ config: video_editor_1.VideoEditorConfigSchema,
45
+ })),
46
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
47
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.TEXT_TO_SPEECH),
48
+ config: tts_1.TTSConfigSchema,
49
+ })),
50
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
51
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.SPEECH_TO_TEXT),
52
+ config: stt_1.STTConfigSchema,
53
+ })),
54
+ ]);
55
+ exports.ToolsWithConfigsSchema = zod_1.z.array(exports.ToolWithConfigSchema);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetGlobalToolsConfigQuery = void 0;
4
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
5
+ const models_1 = require("../models");
6
+ var GetGlobalToolsConfigQuery;
7
+ (function (GetGlobalToolsConfigQuery) {
8
+ GetGlobalToolsConfigQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.GlobalToolsConfigSchema);
9
+ })(GetGlobalToolsConfigQuery || (exports.GetGlobalToolsConfigQuery = GetGlobalToolsConfigQuery = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetToolsWithConfigsQuery = void 0;
4
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
5
+ const models_1 = require("../models");
6
+ var GetToolsWithConfigsQuery;
7
+ (function (GetToolsWithConfigsQuery) {
8
+ GetToolsWithConfigsQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ToolsWithConfigsSchema);
9
+ })(GetToolsWithConfigsQuery || (exports.GetToolsWithConfigsQuery = GetToolsWithConfigsQuery = {}));
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./find-all-tools.query"), exports);
18
+ __exportStar(require("./get-global-tools-config.query"), exports);
19
+ __exportStar(require("./get-tools-with-configs.query"), exports);
@@ -4,4 +4,6 @@ exports.TOOLS_AMQP_ROUTES = void 0;
4
4
  exports.TOOLS_AMQP_ROUTES = {
5
5
  JOB_COMPLETED: 'tools.job.completed',
6
6
  FIND_ALL: 'tools.find.all.rpc',
7
+ GET_GLOBAL_TOOLS_CONFIG: 'tools.config.rpc',
8
+ GET_TOOLS_WITH_CONFIGS: 'tools.with-configs.rpc',
7
9
  };
@@ -9,6 +9,11 @@ export const ERRORS = {
9
9
  message: 'Произошла ошибка при поиске инструмента',
10
10
  httpCode: 500,
11
11
  },
12
+ GET_GLOBAL_TOOLS_CONFIG_ERROR: {
13
+ code: 'TOOL.GET_GLOBAL_TOOLS_CONFIG_ERROR',
14
+ message: 'Произошла ошибка при получении глобальных конфигураций инструментов',
15
+ httpCode: 500,
16
+ },
12
17
  },
13
18
 
14
19
  // PARAPHRASE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -1,3 +1,3 @@
1
1
  export * from './job-status.enum';
2
2
  export * from './tool-type.enum';
3
- export * from './content-type.enum';
3
+ export * from './tool-content-type.enum';
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { TOOL_CONTENT_TYPE } from '../enums';
3
+ import { VideoConfigSchema } from '../../video';
4
+ import { MusicConfigSchema } from '../../music';
5
+ import { WriterConfigSchema } from '../../writer';
6
+ import { ImageEditorConfigSchema } from '../../image-editor';
7
+ import { ParaphraseToolConfigSchema } from '../../paraphrase';
8
+ import { PresentationConfigSchema } from '../../presentation';
9
+ import { VideoEditorConfigSchema } from '../../video-editor';
10
+ import { TTSConfigSchema } from '../../tts';
11
+ import { STTConfigSchema } from '../../stt';
12
+
13
+ export const GlobalToolsConfigSchema = z.object({
14
+ [TOOL_CONTENT_TYPE.VIDEO]: VideoConfigSchema,
15
+ [TOOL_CONTENT_TYPE.MUSIC]: MusicConfigSchema,
16
+ [TOOL_CONTENT_TYPE.WRITER]: WriterConfigSchema,
17
+ [TOOL_CONTENT_TYPE.IMAGE_EDITOR]: ImageEditorConfigSchema,
18
+ [TOOL_CONTENT_TYPE.REPHRASE]: ParaphraseToolConfigSchema,
19
+ [TOOL_CONTENT_TYPE.PRESENTATION]: PresentationConfigSchema,
20
+ [TOOL_CONTENT_TYPE.VIDEO_EDITOR]: VideoEditorConfigSchema,
21
+ [TOOL_CONTENT_TYPE.TEXT_TO_SPEECH]: TTSConfigSchema,
22
+ [TOOL_CONTENT_TYPE.SPEECH_TO_TEXT]: STTConfigSchema,
23
+ });
24
+
25
+ export type GlobalToolsConfig = z.infer<typeof GlobalToolsConfigSchema>;
@@ -1,2 +1,4 @@
1
1
  export * from './tool-job.schema';
2
2
  export * from './tool.schema';
3
+ export * from './global-tools-config.schema';
4
+ export * from './tools-with-configs.schema';
@@ -0,0 +1,75 @@
1
+ import { z } from 'zod';
2
+ import { TOOL_CONTENT_TYPE } from '../enums';
3
+ import { VideoConfigSchema } from '../../video';
4
+ import { MusicConfigSchema } from '../../music';
5
+ import { WriterConfigSchema } from '../../writer';
6
+ import { ImageEditorConfigSchema } from '../../image-editor';
7
+ import { ParaphraseToolConfigSchema } from '../../paraphrase';
8
+ import { PresentationConfigSchema } from '../../presentation';
9
+ import { VideoEditorConfigSchema } from '../../video-editor';
10
+ import { TTSConfigSchema } from '../../tts';
11
+ import { STTConfigSchema } from '../../stt';
12
+ import { ToolSchema } from './tool.schema';
13
+
14
+ // Discriminated union array: Tools with their configs
15
+ export const ToolWithConfigSchema = z.discriminatedUnion('contentType', [
16
+ ToolSchema.merge(
17
+ z.object({
18
+ contentType: z.literal(TOOL_CONTENT_TYPE.VIDEO),
19
+ config: VideoConfigSchema,
20
+ }),
21
+ ),
22
+ ToolSchema.merge(
23
+ z.object({
24
+ contentType: z.literal(TOOL_CONTENT_TYPE.MUSIC),
25
+ config: MusicConfigSchema,
26
+ }),
27
+ ),
28
+ ToolSchema.merge(
29
+ z.object({
30
+ contentType: z.literal(TOOL_CONTENT_TYPE.WRITER),
31
+ config: WriterConfigSchema,
32
+ }),
33
+ ),
34
+ ToolSchema.merge(
35
+ z.object({
36
+ contentType: z.literal(TOOL_CONTENT_TYPE.IMAGE_EDITOR),
37
+ config: ImageEditorConfigSchema,
38
+ }),
39
+ ),
40
+ ToolSchema.merge(
41
+ z.object({
42
+ contentType: z.literal(TOOL_CONTENT_TYPE.REPHRASE),
43
+ config: ParaphraseToolConfigSchema,
44
+ }),
45
+ ),
46
+ ToolSchema.merge(
47
+ z.object({
48
+ contentType: z.literal(TOOL_CONTENT_TYPE.PRESENTATION),
49
+ config: PresentationConfigSchema,
50
+ }),
51
+ ),
52
+ ToolSchema.merge(
53
+ z.object({
54
+ contentType: z.literal(TOOL_CONTENT_TYPE.VIDEO_EDITOR),
55
+ config: VideoEditorConfigSchema,
56
+ }),
57
+ ),
58
+ ToolSchema.merge(
59
+ z.object({
60
+ contentType: z.literal(TOOL_CONTENT_TYPE.TEXT_TO_SPEECH),
61
+ config: TTSConfigSchema,
62
+ }),
63
+ ),
64
+ ToolSchema.merge(
65
+ z.object({
66
+ contentType: z.literal(TOOL_CONTENT_TYPE.SPEECH_TO_TEXT),
67
+ config: STTConfigSchema,
68
+ }),
69
+ ),
70
+ ]);
71
+
72
+ export type ToolWithConfig = z.infer<typeof ToolWithConfigSchema>;
73
+
74
+ export const ToolsWithConfigsSchema = z.array(ToolWithConfigSchema);
75
+ export type ToolsWithConfigs = z.infer<typeof ToolsWithConfigsSchema>;
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { GlobalToolsConfigSchema } from '../models';
4
+
5
+ export namespace GetGlobalToolsConfigQuery {
6
+ export const ResponseSchema = ICommandResponseSchema(GlobalToolsConfigSchema);
7
+ export type Response = z.infer<typeof ResponseSchema>;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ToolsWithConfigsSchema } from '../models';
4
+
5
+ export namespace GetToolsWithConfigsQuery {
6
+ export const ResponseSchema = ICommandResponseSchema(ToolsWithConfigsSchema);
7
+ export type Response = z.infer<typeof ResponseSchema>;
8
+ }
@@ -1 +1,3 @@
1
1
  export * from './find-all-tools.query';
2
+ export * from './get-global-tools-config.query';
3
+ export * from './get-tools-with-configs.query';
@@ -1,4 +1,6 @@
1
1
  export const TOOLS_AMQP_ROUTES = {
2
2
  JOB_COMPLETED: 'tools.job.completed',
3
3
  FIND_ALL: 'tools.find.all.rpc',
4
+ GET_GLOBAL_TOOLS_CONFIG: 'tools.config.rpc',
5
+ GET_TOOLS_WITH_CONFIGS: 'tools.with-configs.rpc',
4
6
  };
@@ -11,6 +11,6 @@ var TOOL_CONTENT_TYPE;
11
11
  TOOL_CONTENT_TYPE["PRESENTATION"] = "PRESENTATION";
12
12
  TOOL_CONTENT_TYPE["WRITER"] = "WRITER";
13
13
  TOOL_CONTENT_TYPE["VIDEO_EDITOR"] = "VIDEO_EDITOR";
14
- TOOL_CONTENT_TYPE["NONE"] = "NONE";
15
14
  TOOL_CONTENT_TYPE["MUSIC"] = "MUSIC";
15
+ TOOL_CONTENT_TYPE["NONE"] = "NONE";
16
16
  })(TOOL_CONTENT_TYPE || (exports.TOOL_CONTENT_TYPE = TOOL_CONTENT_TYPE = {}));
@@ -7,6 +7,6 @@ export enum TOOL_CONTENT_TYPE {
7
7
  PRESENTATION = 'PRESENTATION',
8
8
  WRITER = 'WRITER',
9
9
  VIDEO_EDITOR = 'VIDEO_EDITOR',
10
- NONE = 'NONE',
11
10
  MUSIC = 'MUSIC',
11
+ NONE = 'NONE',
12
12
  }