@purpleschool/gptbot 0.7.71 → 0.7.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.
Files changed (97) hide show
  1. package/api/controllers/http/index.ts +1 -0
  2. package/api/controllers/http/music.ts +16 -0
  3. package/api/controllers/http/promocode.ts +0 -1
  4. package/api/controllers/http/webmaster.ts +1 -1
  5. package/build/api/controllers/http/index.js +1 -0
  6. package/build/api/controllers/http/music.js +18 -0
  7. package/build/api/controllers/http/promocode.js +0 -1
  8. package/build/api/controllers/http/webmaster.js +1 -1
  9. package/build/commands/auth/register-user.command.js +2 -4
  10. package/build/commands/auth/vk-login.command.js +5 -2
  11. package/build/commands/auth/yandex-login.command.js +5 -2
  12. package/build/commands/cabinet/get-user-statistics-by-month.command.js +2 -0
  13. package/build/commands/product/buy-product.command.js +4 -0
  14. package/build/commands/promocode/index.js +0 -1
  15. package/build/commands/subscription/buy-subscription.command.js +4 -0
  16. package/build/commands/telegram-auth/create-telegram-auth-link.command.js +2 -0
  17. package/build/commands/telegram-profile/auth-with-telegram-web-app.command.js +4 -0
  18. package/build/commands/tools/index.js +1 -0
  19. package/build/commands/tools/music/convert-to-wav.command.js +16 -0
  20. package/build/commands/tools/music/delete-all-music-jobs.command.js +8 -0
  21. package/build/commands/tools/music/delete-music-job-by-uuid.command.js +11 -0
  22. package/build/commands/tools/music/find-music-job-by-uuid.command.js +14 -0
  23. package/build/commands/tools/music/find-music-jobs.command.js +18 -0
  24. package/build/commands/tools/music/generate-lyrics.command.js +16 -0
  25. package/build/commands/tools/music/generate-music.command.js +15 -0
  26. package/build/commands/tools/music/get-music-tool-config.command.js +11 -0
  27. package/build/commands/tools/music/index.js +27 -0
  28. package/build/commands/tools/music/retry-music-job.command.js +14 -0
  29. package/build/commands/tools/music/set-reaction-to-music-job.command.js +18 -0
  30. package/build/commands/tools/music/update-music-job-title.command.js +17 -0
  31. package/build/commands/user/get-me.command.js +1 -0
  32. package/build/constants/errors/errors.js +96 -3
  33. package/build/constants/index.js +1 -0
  34. package/build/constants/promocode/enums/promocode-promotion.enum.js +0 -1
  35. package/build/constants/tool-music/enums/index.js +21 -0
  36. package/build/constants/tool-music/enums/music-pricing-rule-type.enum.js +7 -0
  37. package/build/constants/tool-music/enums/music-strategy.enum.js +7 -0
  38. package/build/constants/tool-music/enums/music-vocal-gender.enum.js +8 -0
  39. package/build/constants/tool-music/enums/suno-mode-type.enum.js +10 -0
  40. package/build/constants/tool-music/enums/suno-model-type.enum.js +10 -0
  41. package/build/constants/tool-music/index.js +17 -0
  42. package/build/models/index.js +1 -0
  43. package/build/models/promocode.schema.js +0 -1
  44. package/build/models/tools/index.js +1 -0
  45. package/build/models/tools/music/index.js +20 -0
  46. package/build/models/tools/music/music-config.schema.js +8 -0
  47. package/build/models/tools/music/music-job.schema.js +40 -0
  48. package/build/models/tools/music/music-model.schema.js +32 -0
  49. package/build/models/tools/music/music-track.schema.js +17 -0
  50. package/build/models/user-referrals.schema.js +15 -0
  51. package/build/models/webmaster-balance.schema.js +0 -1
  52. package/commands/auth/register-user.command.ts +3 -5
  53. package/commands/auth/vk-login.command.ts +9 -6
  54. package/commands/auth/yandex-login.command.ts +7 -4
  55. package/commands/cabinet/get-user-statistics-by-month.command.ts +2 -0
  56. package/commands/product/buy-product.command.ts +4 -0
  57. package/commands/promocode/index.ts +0 -1
  58. package/commands/subscription/buy-subscription.command.ts +4 -0
  59. package/commands/telegram-auth/create-telegram-auth-link.command.ts +5 -0
  60. package/commands/telegram-profile/auth-with-telegram-web-app.command.ts +4 -0
  61. package/commands/tools/index.ts +1 -0
  62. package/commands/tools/music/convert-to-wav.command.ts +17 -0
  63. package/commands/tools/music/delete-all-music-jobs.command.ts +6 -0
  64. package/commands/tools/music/delete-music-job-by-uuid.command.ts +11 -0
  65. package/commands/tools/music/find-music-job-by-uuid.command.ts +16 -0
  66. package/commands/tools/music/find-music-jobs.command.ts +18 -0
  67. package/commands/tools/music/generate-lyrics.command.ts +17 -0
  68. package/commands/tools/music/generate-music.command.ts +16 -0
  69. package/commands/tools/music/get-music-tool-config.command.ts +10 -0
  70. package/commands/tools/music/index.ts +11 -0
  71. package/commands/tools/music/retry-music-job.command.ts +14 -0
  72. package/commands/tools/music/set-reaction-to-music-job.command.ts +20 -0
  73. package/commands/tools/music/update-music-job-title.command.ts +19 -0
  74. package/commands/user/get-me.command.ts +1 -0
  75. package/constants/errors/errors.ts +96 -3
  76. package/constants/index.ts +1 -0
  77. package/constants/promocode/enums/promocode-promotion.enum.ts +0 -1
  78. package/constants/tool-music/enums/index.ts +5 -0
  79. package/constants/tool-music/enums/music-pricing-rule-type.enum.ts +3 -0
  80. package/constants/tool-music/enums/music-strategy.enum.ts +3 -0
  81. package/constants/tool-music/enums/music-vocal-gender.enum.ts +4 -0
  82. package/constants/tool-music/enums/suno-mode-type.enum.ts +6 -0
  83. package/constants/tool-music/enums/suno-model-type.enum.ts +6 -0
  84. package/constants/tool-music/index.ts +1 -0
  85. package/models/index.ts +1 -0
  86. package/models/promocode.schema.ts +0 -1
  87. package/models/tools/index.ts +1 -0
  88. package/models/tools/music/index.ts +4 -0
  89. package/models/tools/music/music-config.schema.ts +6 -0
  90. package/models/tools/music/music-job.schema.ts +43 -0
  91. package/models/tools/music/music-model.schema.ts +33 -0
  92. package/models/tools/music/music-track.schema.ts +19 -0
  93. package/models/user-referrals.schema.ts +10 -0
  94. package/models/webmaster-balance.schema.ts +0 -1
  95. package/package.json +1 -1
  96. package/build/commands/promocode/get-webmaster-promocode.command.js +0 -17
  97. package/commands/promocode/get-webmaster-promocode.command.ts +0 -19
@@ -0,0 +1,5 @@
1
+ export * from './suno-model-type.enum';
2
+ export * from './music-strategy.enum';
3
+ export * from './music-vocal-gender.enum';
4
+ export * from './music-pricing-rule-type.enum';
5
+ export * from './suno-mode-type.enum';
@@ -0,0 +1,3 @@
1
+ export enum MUSIC_PRICING_RULE_TYPE {
2
+ FLAT = 'flat',
3
+ }
@@ -0,0 +1,3 @@
1
+ export enum MUSIC_GENERATION_STRATEGY {
2
+ SUNO_POLLING = 'SUNO_POLLING',
3
+ }
@@ -0,0 +1,4 @@
1
+ export enum MUSIC_VOCAL_GENDER {
2
+ MALE = 'm',
3
+ FEMALE = 'f',
4
+ }
@@ -0,0 +1,6 @@
1
+ export enum SUNO_MODE_TYPE {
2
+ SIMPLE = 'simple',
3
+ SIMPLE_INSTRUMENTAL = 'simple_instrumental',
4
+ CUSTOM = 'custom',
5
+ CUSTOM_INSTRUMENTAL = 'custom_instrumental',
6
+ }
@@ -0,0 +1,6 @@
1
+ export enum SUNO_MODEL_TYPE {
2
+ V4 = 'V4',
3
+ V4_5 = 'V4_5',
4
+ V4_5PLUS = 'V4_5PLUS',
5
+ V5 = 'V5',
6
+ }
@@ -0,0 +1 @@
1
+ export * from './enums';
package/models/index.ts CHANGED
@@ -52,3 +52,4 @@ export * from './users-filter-notification.schema';
52
52
  export * from './daily-streak';
53
53
  export * from './webmaster.schema';
54
54
  export * from './webmaster-balance.schema';
55
+ export * from './user-referrals.schema';
@@ -13,7 +13,6 @@ export const PromocodeSchema = z.object({
13
13
  endDate: z.date().nullable(),
14
14
  userId: z.string().uuid().nullable(),
15
15
  unregisteredUserId: z.string().uuid().nullable(),
16
- webmasterId: z.string().uuid().nullable(),
17
16
 
18
17
  createdAt: z.date(),
19
18
  updatedAt: z.date(),
@@ -6,3 +6,4 @@ export * from './video';
6
6
  export * from './writer';
7
7
  export * from './image-editor';
8
8
  export * from './video-editor';
9
+ export * from './music';
@@ -0,0 +1,4 @@
1
+ export * from './music-config.schema';
2
+ export * from './music-job.schema';
3
+ export * from './music-model.schema';
4
+ export * from './music-track.schema';
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ import { MusicModelSchema } from './music-model.schema';
3
+
4
+ export const MusicConfigSchema = z.object({
5
+ models: z.array(MusicModelSchema),
6
+ });
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { ToolJobSchema } from '../../tool-job.schema';
3
+ import { MUSIC_VOCAL_GENDER, SUNO_MODE_TYPE, USER_REACTION } from '../../../constants';
4
+ import { MusicTrackSchema } from './music-track.schema';
5
+
6
+ export const MusicJobParamsSchema = z.discriminatedUnion('mode', [
7
+ z.object({
8
+ mode: z.literal(SUNO_MODE_TYPE.SIMPLE),
9
+ prompt: z.string().min(1).max(450),
10
+ style: z.string(),
11
+ vocalGender: z.nativeEnum(MUSIC_VOCAL_GENDER),
12
+ }),
13
+ z.object({
14
+ mode: z.literal(SUNO_MODE_TYPE.SIMPLE_INSTRUMENTAL),
15
+ prompt: z.string().min(1).max(450),
16
+ style: z.string(),
17
+ }),
18
+ z.object({
19
+ mode: z.literal(SUNO_MODE_TYPE.CUSTOM),
20
+ prompt: z.string().min(1).max(5000),
21
+ title: z.string().min(1).max(80),
22
+ style: z.string().min(1).max(1000),
23
+ vocalGender: z.nativeEnum(MUSIC_VOCAL_GENDER),
24
+ }),
25
+ z.object({
26
+ mode: z.literal(SUNO_MODE_TYPE.CUSTOM_INSTRUMENTAL),
27
+ title: z.string().min(1).max(80),
28
+ style: z.string().min(1).max(1000),
29
+ }),
30
+ ]);
31
+
32
+ export type MusicJobParams = z.infer<typeof MusicJobParamsSchema>;
33
+
34
+ export const MusicJobSchema = ToolJobSchema.extend({
35
+ title: z.string(),
36
+ prompt: z.string(),
37
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
38
+ tracks: z.array(MusicTrackSchema),
39
+ params: MusicJobParamsSchema,
40
+ modelId: z.string(),
41
+ });
42
+
43
+ export type MusicJob = z.infer<typeof MusicJobSchema>;
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema } from '../../icon-variants.schema';
3
+ import { UnlockedBySchema } from '../../unlocked-by-subscription.schema';
4
+ import { MUSIC_VOCAL_GENDER } from '../../../constants';
5
+
6
+ export const MusicModelParamsSchema = z.object({
7
+ vocalGender: z.object({
8
+ options: z.array(z.nativeEnum(MUSIC_VOCAL_GENDER)),
9
+ }),
10
+ styles: z.object({
11
+ maxStyles: z.number(),
12
+ options: z.array(
13
+ z.object({
14
+ title: z.string(),
15
+ style: z.string(),
16
+ }),
17
+ ),
18
+ }),
19
+ });
20
+
21
+ export const MusicModelSchema = z.object({
22
+ uuid: z.string(),
23
+ title: z.string(),
24
+ description: z.string(),
25
+ pricePerTrack: z.number(),
26
+ order: z.number(),
27
+ icons: IconVariantsSchema,
28
+ maxPromptLength: z.number(),
29
+ maxLyricsLength: z.number(),
30
+ params: MusicModelParamsSchema,
31
+ unlockedBy: UnlockedBySchema.nullable(),
32
+ canUse: z.boolean(),
33
+ });
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+
3
+ export const MusicTrackSchema = z.object({
4
+ uuid: z.string(),
5
+ title: z.string(),
6
+ audioId: z.string(),
7
+ audioUrl: z.string(),
8
+ coverUrl: z.string(),
9
+ tags: z.string(),
10
+ duration: z.number(),
11
+
12
+ genJobId: z.string().nullable().optional(),
13
+ editorJobId: z.string().nullable().optional(),
14
+
15
+ createdAt: z.date(),
16
+ updatedAt: z.date(),
17
+ });
18
+
19
+ export type MusicTrack = z.infer<typeof MusicTrackSchema>;
@@ -0,0 +1,10 @@
1
+ import z from 'zod';
2
+
3
+ export const UserReferralsSchema = z.object({
4
+ partnerId: z.string().uuid().optional(),
5
+ webmasterAlias: z.string().optional(),
6
+ webmasterReferralProvidedAt: z
7
+ .string()
8
+ .transform((date) => new Date(date))
9
+ .optional(),
10
+ });
@@ -5,7 +5,6 @@ export const WebmasterBalanceSchema = z.object({
5
5
  uuid: z.string().uuid(),
6
6
  webmasterId: z.string().uuid(),
7
7
  orderId: z.string().uuid().nullable(),
8
- promocodeId: z.string().uuid().nullable(),
9
8
  sourceUserId: z.string().uuid().nullable(),
10
9
  amount: z.number(),
11
10
  type: z.nativeEnum(WEBMASTER_BALANCE_TYPE),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.7.71",
3
+ "version": "0.7.74",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetWebmasterPromocodeCommand = void 0;
4
- const zod_1 = require("zod");
5
- const models_1 = require("../../models");
6
- var GetWebmasterPromocodeCommand;
7
- (function (GetWebmasterPromocodeCommand) {
8
- GetWebmasterPromocodeCommand.RequestSchema = models_1.WebmasterSchema.pick({ alias: true });
9
- GetWebmasterPromocodeCommand.ResponseSchema = zod_1.z.object({
10
- data: zod_1.z.object({
11
- isEligible: zod_1.z.boolean(),
12
- promocode: zod_1.z.string().nullable(),
13
- amount: zod_1.z.number().nullable(),
14
- endDate: zod_1.z.date().nullable(),
15
- }),
16
- });
17
- })(GetWebmasterPromocodeCommand || (exports.GetWebmasterPromocodeCommand = GetWebmasterPromocodeCommand = {}));
@@ -1,19 +0,0 @@
1
- import { z } from 'zod';
2
- import { WebmasterSchema } from '../../models';
3
-
4
- export namespace GetWebmasterPromocodeCommand {
5
- export const RequestSchema = WebmasterSchema.pick({ alias: true });
6
-
7
- export type Request = z.infer<typeof RequestSchema>;
8
-
9
- export const ResponseSchema = z.object({
10
- data: z.object({
11
- isEligible: z.boolean(),
12
- promocode: z.string().nullable(),
13
- amount: z.number().nullable(),
14
- endDate: z.date().nullable(),
15
- }),
16
- });
17
-
18
- export type Response = z.infer<typeof ResponseSchema>;
19
- }