@purpleschool/gptbot 0.5.90 → 0.5.92

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 (31) hide show
  1. package/api/controllers/http/stt.ts +1 -0
  2. package/build/api/controllers/http/stt.js +1 -0
  3. package/build/commands/tools/stt/delete-stt-job-by-uuid.command.js +1 -1
  4. package/build/commands/tools/stt/index.js +1 -0
  5. package/build/commands/tools/stt/set-reaction-to-stt-job.command.js +1 -1
  6. package/build/commands/tools/stt/update-stt-job-title.command.js +17 -0
  7. package/build/commands/tools/tts/delete-tts-job-by-uuid.command.js +1 -1
  8. package/build/commands/tools/tts/set-reaction-to-tts-job.command.js +1 -1
  9. package/build/commands/tools/tts/update-tts-job-title.command.js +1 -1
  10. package/build/helpers/index.js +2 -0
  11. package/build/helpers/stt/calculate-stt-price.helper.js +7 -0
  12. package/build/helpers/stt/index.js +17 -0
  13. package/build/helpers/tts/calculate-tts-price.helper.js +7 -0
  14. package/build/helpers/tts/index.js +17 -0
  15. package/build/models/tools/stt/stt-model.schema.js +1 -1
  16. package/build/models/tools/tts/tts-model.schema.js +1 -1
  17. package/commands/tools/stt/delete-stt-job-by-uuid.command.ts +1 -1
  18. package/commands/tools/stt/index.ts +1 -0
  19. package/commands/tools/stt/set-reaction-to-stt-job.command.ts +1 -1
  20. package/commands/tools/stt/update-stt-job-title.command.ts +19 -0
  21. package/commands/tools/tts/delete-tts-job-by-uuid.command.ts +1 -1
  22. package/commands/tools/tts/set-reaction-to-tts-job.command.ts +1 -1
  23. package/commands/tools/tts/update-tts-job-title.command.ts +1 -1
  24. package/helpers/index.ts +2 -0
  25. package/helpers/stt/calculate-stt-price.helper.ts +4 -0
  26. package/helpers/stt/index.ts +1 -0
  27. package/helpers/tts/calculate-tts-price.helper.ts +4 -0
  28. package/helpers/tts/index.ts +1 -0
  29. package/models/tools/stt/stt-model.schema.ts +1 -1
  30. package/models/tools/tts/tts-model.schema.ts +1 -1
  31. package/package.json +1 -1
@@ -7,6 +7,7 @@ export const STT_ROUTES = {
7
7
  GET_JOBS: 'jobs',
8
8
  GET_JOB: (uuid: string) => `jobs/${uuid}`,
9
9
  SET_REACTION: (uuid: string) => `jobs/${uuid}/reaction`,
10
+ UPDATE: (uuid: string) => `jobs/${uuid}`,
10
11
  DELETE: (uuid: string) => `jobs/${uuid}`,
11
12
  DELETE_ALL: 'jobs',
12
13
  } as const;
@@ -9,6 +9,7 @@ exports.STT_ROUTES = {
9
9
  GET_JOBS: 'jobs',
10
10
  GET_JOB: (uuid) => `jobs/${uuid}`,
11
11
  SET_REACTION: (uuid) => `jobs/${uuid}/reaction`,
12
+ UPDATE: (uuid) => `jobs/${uuid}`,
12
13
  DELETE: (uuid) => `jobs/${uuid}`,
13
14
  DELETE_ALL: 'jobs',
14
15
  };
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
5
5
  var DeleteSTTJobByUUIDCommand;
6
6
  (function (DeleteSTTJobByUUIDCommand) {
7
7
  DeleteSTTJobByUUIDCommand.RequestParamsSchema = zod_1.z.object({
8
- uuid: zod_1.z.string(),
8
+ uuid: zod_1.z.string().uuid(),
9
9
  });
10
10
  DeleteSTTJobByUUIDCommand.ResponseSchema = zod_1.z.void();
11
11
  })(DeleteSTTJobByUUIDCommand || (exports.DeleteSTTJobByUUIDCommand = DeleteSTTJobByUUIDCommand = {}));
@@ -21,3 +21,4 @@ __exportStar(require("./find-stt-jobs.command"), exports);
21
21
  __exportStar(require("./get-stt-tool-config.command"), exports);
22
22
  __exportStar(require("./set-reaction-to-stt-job.command"), exports);
23
23
  __exportStar(require("./stt.command"), exports);
24
+ __exportStar(require("./update-stt-job-title.command"), exports);
@@ -10,7 +10,7 @@ var SetReactionToSTTJobCommand;
10
10
  reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
11
11
  });
12
12
  SetReactionToSTTJobCommand.RequestParamsSchema = zod_1.z.object({
13
- uuid: zod_1.z.string(),
13
+ uuid: zod_1.z.string().uuid(),
14
14
  });
15
15
  SetReactionToSTTJobCommand.ResponseSchema = zod_1.z.object({
16
16
  data: models_1.STTJobSchema,
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateSTTJobTitleCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var UpdateSTTJobTitleCommand;
7
+ (function (UpdateSTTJobTitleCommand) {
8
+ UpdateSTTJobTitleCommand.RequestSchema = zod_1.z.object({
9
+ title: zod_1.z.string().min(1).max(40).trim(),
10
+ });
11
+ UpdateSTTJobTitleCommand.RequestParamsSchema = zod_1.z.object({
12
+ uuid: zod_1.z.string().uuid(),
13
+ });
14
+ UpdateSTTJobTitleCommand.ResponseSchema = zod_1.z.object({
15
+ data: models_1.STTJobSchema,
16
+ });
17
+ })(UpdateSTTJobTitleCommand || (exports.UpdateSTTJobTitleCommand = UpdateSTTJobTitleCommand = {}));
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
5
5
  var DeleteTTSJobByUUIDCommand;
6
6
  (function (DeleteTTSJobByUUIDCommand) {
7
7
  DeleteTTSJobByUUIDCommand.RequestParamsSchema = zod_1.z.object({
8
- uuid: zod_1.z.string(),
8
+ uuid: zod_1.z.string().uuid(),
9
9
  });
10
10
  DeleteTTSJobByUUIDCommand.ResponseSchema = zod_1.z.void();
11
11
  })(DeleteTTSJobByUUIDCommand || (exports.DeleteTTSJobByUUIDCommand = DeleteTTSJobByUUIDCommand = {}));
@@ -10,7 +10,7 @@ var SetReactionToTTSJobCommand;
10
10
  reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
11
11
  });
12
12
  SetReactionToTTSJobCommand.RequestParamsSchema = zod_1.z.object({
13
- uuid: zod_1.z.string(),
13
+ uuid: zod_1.z.string().uuid(),
14
14
  });
15
15
  SetReactionToTTSJobCommand.ResponseSchema = zod_1.z.object({
16
16
  data: models_1.TTSJobSchema,
@@ -9,7 +9,7 @@ var UpdateTTSJobTitleCommand;
9
9
  title: zod_1.z.string().min(1).max(40).trim(),
10
10
  });
11
11
  UpdateTTSJobTitleCommand.RequestParamsSchema = zod_1.z.object({
12
- uuid: zod_1.z.string(),
12
+ uuid: zod_1.z.string().uuid(),
13
13
  });
14
14
  UpdateTTSJobTitleCommand.ResponseSchema = zod_1.z.object({
15
15
  data: models_1.TTSJobSchema,
@@ -14,4 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./stt"), exports);
17
18
  __exportStar(require("./subscription"), exports);
19
+ __exportStar(require("./tts"), exports);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateSTTPrice = calculateSTTPrice;
4
+ function calculateSTTPrice(durationInSeconds, pricePerSecond) {
5
+ const rawCost = durationInSeconds * pricePerSecond;
6
+ return Math.ceil(rawCost);
7
+ }
@@ -0,0 +1,17 @@
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("./calculate-stt-price.helper"), exports);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateTTSPrice = calculateTTSPrice;
4
+ function calculateTTSPrice(inputLength, pricePerSymbol) {
5
+ const rawCost = inputLength * pricePerSymbol;
6
+ return Math.ceil(rawCost);
7
+ }
@@ -0,0 +1,17 @@
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("./calculate-tts-price.helper"), exports);
@@ -7,7 +7,7 @@ exports.STTModelSchema = zod_1.z.object({
7
7
  uuid: zod_1.z.string(),
8
8
  title: zod_1.z.string(),
9
9
  description: zod_1.z.string(),
10
- pricePerMin: zod_1.z.number(),
10
+ pricePerSecond: zod_1.z.number(),
11
11
  order: zod_1.z.number(),
12
12
  icons: icon_variants_schema_1.IconVariantsSchema,
13
13
  maxDurationSeconds: zod_1.z.number(),
@@ -40,7 +40,7 @@ exports.TTSModelSchema = zod_1.z.object({
40
40
  uuid: zod_1.z.string(),
41
41
  title: zod_1.z.string(),
42
42
  description: zod_1.z.string(),
43
- pricePerThousandSymbols: zod_1.z.number(),
43
+ pricePerSymbol: zod_1.z.number(),
44
44
  order: zod_1.z.number(),
45
45
  icons: icon_variants_schema_1.IconVariantsSchema,
46
46
  maxInputLength: zod_1.z.number(),
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
 
3
3
  export namespace DeleteSTTJobByUUIDCommand {
4
4
  export const RequestParamsSchema = z.object({
5
- uuid: z.string(),
5
+ uuid: z.string().uuid(),
6
6
  });
7
7
  export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
8
 
@@ -5,3 +5,4 @@ export * from './find-stt-jobs.command';
5
5
  export * from './get-stt-tool-config.command';
6
6
  export * from './set-reaction-to-stt-job.command';
7
7
  export * from './stt.command';
8
+ export * from './update-stt-job-title.command';
@@ -9,7 +9,7 @@ export namespace SetReactionToSTTJobCommand {
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
11
  export const RequestParamsSchema = z.object({
12
- uuid: z.string(),
12
+ uuid: z.string().uuid(),
13
13
  });
14
14
  export type RequestParams = z.infer<typeof RequestParamsSchema>;
15
15
 
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { STTJobSchema } from '../../../models';
3
+
4
+ export namespace UpdateSTTJobTitleCommand {
5
+ export const RequestSchema = z.object({
6
+ title: z.string().min(1).max(40).trim(),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const RequestParamsSchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ });
13
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: STTJobSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
 
3
3
  export namespace DeleteTTSJobByUUIDCommand {
4
4
  export const RequestParamsSchema = z.object({
5
- uuid: z.string(),
5
+ uuid: z.string().uuid(),
6
6
  });
7
7
  export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
8
 
@@ -9,7 +9,7 @@ export namespace SetReactionToTTSJobCommand {
9
9
  export type Request = z.infer<typeof RequestSchema>;
10
10
 
11
11
  export const RequestParamsSchema = z.object({
12
- uuid: z.string(),
12
+ uuid: z.string().uuid(),
13
13
  });
14
14
  export type RequestParams = z.infer<typeof RequestParamsSchema>;
15
15
 
@@ -8,7 +8,7 @@ export namespace UpdateTTSJobTitleCommand {
8
8
  export type Request = z.infer<typeof RequestSchema>;
9
9
 
10
10
  export const RequestParamsSchema = z.object({
11
- uuid: z.string(),
11
+ uuid: z.string().uuid(),
12
12
  });
13
13
  export type RequestParams = z.infer<typeof RequestParamsSchema>;
14
14
 
package/helpers/index.ts CHANGED
@@ -1 +1,3 @@
1
+ export * from './stt';
1
2
  export * from './subscription';
3
+ export * from './tts';
@@ -0,0 +1,4 @@
1
+ export function calculateSTTPrice(durationInSeconds: number, pricePerSecond: number): number {
2
+ const rawCost = durationInSeconds * pricePerSecond;
3
+ return Math.ceil(rawCost);
4
+ }
@@ -0,0 +1 @@
1
+ export * from './calculate-stt-price.helper';
@@ -0,0 +1,4 @@
1
+ export function calculateTTSPrice(inputLength: number, pricePerSymbol: number): number {
2
+ const rawCost = inputLength * pricePerSymbol;
3
+ return Math.ceil(rawCost);
4
+ }
@@ -0,0 +1 @@
1
+ export * from './calculate-tts-price.helper';
@@ -5,7 +5,7 @@ export const STTModelSchema = z.object({
5
5
  uuid: z.string(),
6
6
  title: z.string(),
7
7
  description: z.string(),
8
- pricePerMin: z.number(),
8
+ pricePerSecond: z.number(),
9
9
  order: z.number(),
10
10
  icons: IconVariantsSchema,
11
11
  maxDurationSeconds: z.number(),
@@ -43,7 +43,7 @@ export const TTSModelSchema = z.object({
43
43
  uuid: z.string(),
44
44
  title: z.string(),
45
45
  description: z.string(),
46
- pricePerThousandSymbols: z.number(),
46
+ pricePerSymbol: z.number(),
47
47
  order: z.number(),
48
48
  icons: IconVariantsSchema,
49
49
  maxInputLength: z.number(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.90",
3
+ "version": "0.5.92",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",