@purpleschool/gptbot 0.8.84 → 0.8.86

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,7 @@ export const USER_ROUTES = {
11
11
  GET_SUBSCRIPTIONS: (uuid: string) => `subscriptions/${uuid}`,
12
12
  CANCEL_SUBSCRIPTION: (uuid: string) => `subscriptions/${uuid}/cancel`,
13
13
  GET_PRODUCTS: (uuid: string) => `products/${uuid}`,
14
+ CANCEL_PRODUCT: (uuid: string) => `products/${uuid}/cancel`,
14
15
  GET_PAYMENTS: (uuid: string) => `payments/${uuid}`,
15
16
  GET_COUNT_NOTIFICATION: 'broadcast/count',
16
17
  SEND_NOTIFICATION: 'broadcast',
package/api/routes.ts CHANGED
@@ -33,6 +33,8 @@ export const REST_API = {
33
33
  `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CANCEL_SUBSCRIPTION(uuid)}`,
34
34
  GET_PRODUCTS: (uuid: string) =>
35
35
  `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
36
+ CANCEL_PRODUCT: (uuid: string) =>
37
+ `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CANCEL_PRODUCT(uuid)}`,
36
38
  GET_COUNT_NOTIFICATION: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_COUNT_NOTIFICATION}`,
37
39
  SEND_NOTIFICATION: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
38
40
  DELETE_ACCOUNT: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
@@ -13,6 +13,7 @@ exports.USER_ROUTES = {
13
13
  GET_SUBSCRIPTIONS: (uuid) => `subscriptions/${uuid}`,
14
14
  CANCEL_SUBSCRIPTION: (uuid) => `subscriptions/${uuid}/cancel`,
15
15
  GET_PRODUCTS: (uuid) => `products/${uuid}`,
16
+ CANCEL_PRODUCT: (uuid) => `products/${uuid}/cancel`,
16
17
  GET_PAYMENTS: (uuid) => `payments/${uuid}`,
17
18
  GET_COUNT_NOTIFICATION: 'broadcast/count',
18
19
  SEND_NOTIFICATION: 'broadcast',
@@ -61,6 +61,7 @@ exports.REST_API = {
61
61
  GET_SUBSCRIPTIONS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_SUBSCRIPTIONS(uuid)}`,
62
62
  CANCEL_SUBSCRIPTION: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CANCEL_SUBSCRIPTION(uuid)}`,
63
63
  GET_PRODUCTS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
64
+ CANCEL_PRODUCT: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CANCEL_PRODUCT(uuid)}`,
64
65
  GET_COUNT_NOTIFICATION: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_COUNT_NOTIFICATION}`,
65
66
  SEND_NOTIFICATION: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
66
67
  DELETE_ACCOUNT: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
@@ -11,7 +11,7 @@ var CreateCommunityPostCommand;
11
11
  caption: zod_1.z.string().max(500).nullable().optional(),
12
12
  toolJobId: zod_1.z.string().uuid(),
13
13
  toolType: zod_1.z.nativeEnum(constants_1.COMMUNITY_TOOL_TYPE),
14
- trackIndex: zod_1.z.number().optional(),
14
+ trackId: zod_1.z.string().uuid().optional(),
15
15
  });
16
16
  CreateCommunityPostCommand.ResponseSchema = zod_1.z.object({
17
17
  data: models_1.ResponseCommunityPostSchema,
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CancelUserProductCommand = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ var CancelUserProductCommand;
9
+ (function (CancelUserProductCommand) {
10
+ CancelUserProductCommand.RequestParamSchema = zod_1.default.object({
11
+ uuid: zod_1.default.string().uuid(),
12
+ });
13
+ CancelUserProductCommand.RequestSchema = zod_1.default.object({
14
+ userToProductId: zod_1.default.string().uuid(),
15
+ });
16
+ CancelUserProductCommand.ResponseSchema = zod_1.default.object({
17
+ data: zod_1.default.object({
18
+ isCancelled: zod_1.default.boolean(),
19
+ }),
20
+ });
21
+ })(CancelUserProductCommand || (exports.CancelUserProductCommand = CancelUserProductCommand = {}));
@@ -27,3 +27,4 @@ __exportStar(require("./delete-account.command"), exports);
27
27
  __exportStar(require("./get-aggregated-user-data.command"), exports);
28
28
  __exportStar(require("./get-user-payments.command"), exports);
29
29
  __exportStar(require("./cancel-user-subscription.command"), exports);
30
+ __exportStar(require("./cancel-user-product.command"), exports);
@@ -2642,15 +2642,15 @@ exports.ERRORS = {
2642
2642
  message: 'Произошла ошибка при получении модели для генерации изображений',
2643
2643
  httpCode: 500,
2644
2644
  },
2645
- COMMUNITY_POST_TRACK_INDEX_REQUIRED: {
2645
+ COMMUNITY_POST_TRACK_ID_REQUIRED: {
2646
2646
  code: 'A539',
2647
- message: 'Индекс трека обязателен для музыкального поста',
2647
+ message: 'ID трека обязателен для музыкального поста',
2648
2648
  httpCode: 400,
2649
2649
  },
2650
- COMMUNITY_POST_TRACK_INDEX_OUT_OF_RANGE: {
2650
+ COMMUNITY_POST_TRACK_NOT_FOUND: {
2651
2651
  code: 'A540',
2652
- message: 'Индекс трека выходит за пределы допустимого диапазона',
2653
- httpCode: 400,
2652
+ message: 'Трек не найден',
2653
+ httpCode: 404,
2654
2654
  },
2655
2655
  COMMUNITY_POST_EXISTANCE_CHECK_ERROR: {
2656
2656
  code: 'A561',
@@ -2672,4 +2672,14 @@ exports.ERRORS = {
2672
2672
  message: 'Для получения награды опубликуйте работу в сообществе',
2673
2673
  httpCode: 400,
2674
2674
  },
2675
+ PRODUCT_OWNERSHIP_ERROR: {
2676
+ code: 'A565',
2677
+ message: 'Пользователь не является владельцем продукта',
2678
+ httpCode: 400,
2679
+ },
2680
+ PRODUCT_CANCEL_ERROR: {
2681
+ code: 'A566',
2682
+ message: 'Нельзя отменить пакет, которым юзер начал пользоваться',
2683
+ httpCode: 400,
2684
+ },
2675
2685
  };
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommunityPostMediaDataSchema = exports.MusicCommunityMediaSchema = exports.VideoEditorCommunityMediaSchema = exports.VideoCommunityMediaSchema = exports.ImageEditorCommunityMediaSchema = exports.ImageCommunityMediaSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../constants");
6
- const music_track_schema_1 = require("../tools/music/music-track.schema");
7
6
  const video_job_schema_1 = require("../tools/video/video-job.schema");
8
7
  const file_schema_1 = require("../file.schema");
9
8
  const tools_1 = require("../tools");
@@ -37,12 +36,13 @@ exports.MusicCommunityMediaSchema = zod_1.z.object({
37
36
  type: zod_1.z.literal(constants_1.COMMUNITY_POST_TYPE.MUSIC),
38
37
  params: tools_1.MusicJobParamsSchema,
39
38
  prompt: zod_1.z.string(),
40
- track: music_track_schema_1.MusicTrackSchema.pick({
41
- audioUrl: true,
42
- coverUrl: true,
43
- duration: true,
44
- title: true,
45
- tags: true,
39
+ track: zod_1.z.object({
40
+ uuid: zod_1.z.string().optional(), // Опционально для backward compatibility
41
+ audioUrl: zod_1.z.string(),
42
+ coverUrl: zod_1.z.string(),
43
+ duration: zod_1.z.number(),
44
+ title: zod_1.z.string(),
45
+ tags: zod_1.z.string(),
46
46
  }),
47
47
  });
48
48
  exports.CommunityPostMediaDataSchema = zod_1.z.discriminatedUnion('type', [
@@ -8,7 +8,7 @@ export namespace CreateCommunityPostCommand {
8
8
  caption: z.string().max(500).nullable().optional(),
9
9
  toolJobId: z.string().uuid(),
10
10
  toolType: z.nativeEnum(COMMUNITY_TOOL_TYPE),
11
- trackIndex: z.number().optional(),
11
+ trackId: z.string().uuid().optional(),
12
12
  });
13
13
  export type RequestBody = z.infer<typeof RequestBodySchema>;
14
14
 
@@ -0,0 +1,21 @@
1
+ import z from 'zod';
2
+
3
+ export namespace CancelUserProductCommand {
4
+ export const RequestParamSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+
8
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
9
+
10
+ export const RequestSchema = z.object({
11
+ userToProductId: z.string().uuid(),
12
+ });
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: z.object({
16
+ isCancelled: z.boolean(),
17
+ }),
18
+ });
19
+
20
+ export type Response = z.infer<typeof ResponseSchema>;
21
+ }
@@ -11,3 +11,4 @@ export * from './delete-account.command';
11
11
  export * from './get-aggregated-user-data.command';
12
12
  export * from './get-user-payments.command';
13
13
  export * from './cancel-user-subscription.command';
14
+ export * from './cancel-user-product.command';
@@ -2650,15 +2650,15 @@ export const ERRORS = {
2650
2650
  message: 'Произошла ошибка при получении модели для генерации изображений',
2651
2651
  httpCode: 500,
2652
2652
  },
2653
- COMMUNITY_POST_TRACK_INDEX_REQUIRED: {
2653
+ COMMUNITY_POST_TRACK_ID_REQUIRED: {
2654
2654
  code: 'A539',
2655
- message: 'Индекс трека обязателен для музыкального поста',
2655
+ message: 'ID трека обязателен для музыкального поста',
2656
2656
  httpCode: 400,
2657
2657
  },
2658
- COMMUNITY_POST_TRACK_INDEX_OUT_OF_RANGE: {
2658
+ COMMUNITY_POST_TRACK_NOT_FOUND: {
2659
2659
  code: 'A540',
2660
- message: 'Индекс трека выходит за пределы допустимого диапазона',
2661
- httpCode: 400,
2660
+ message: 'Трек не найден',
2661
+ httpCode: 404,
2662
2662
  },
2663
2663
  COMMUNITY_POST_EXISTANCE_CHECK_ERROR: {
2664
2664
  code: 'A561',
@@ -2680,4 +2680,14 @@ export const ERRORS = {
2680
2680
  message: 'Для получения награды опубликуйте работу в сообществе',
2681
2681
  httpCode: 400,
2682
2682
  },
2683
+ PRODUCT_OWNERSHIP_ERROR: {
2684
+ code: 'A565',
2685
+ message: 'Пользователь не является владельцем продукта',
2686
+ httpCode: 400,
2687
+ },
2688
+ PRODUCT_CANCEL_ERROR: {
2689
+ code: 'A566',
2690
+ message: 'Нельзя отменить пакет, которым юзер начал пользоваться',
2691
+ httpCode: 400,
2692
+ },
2683
2693
  };
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  import { COMMUNITY_POST_TYPE } from '../../constants';
3
- import { MusicTrackSchema } from '../tools/music/music-track.schema';
4
3
  import { VideoJobParamsSchema } from '../tools/video/video-job.schema';
5
4
  import { FileSchema } from '../file.schema';
6
5
  import { MusicJobParamsSchema } from '../tools';
@@ -39,12 +38,13 @@ export const MusicCommunityMediaSchema = z.object({
39
38
  type: z.literal(COMMUNITY_POST_TYPE.MUSIC),
40
39
  params: MusicJobParamsSchema,
41
40
  prompt: z.string(),
42
- track: MusicTrackSchema.pick({
43
- audioUrl: true,
44
- coverUrl: true,
45
- duration: true,
46
- title: true,
47
- tags: true,
41
+ track: z.object({
42
+ uuid: z.string().optional(), // Опционально для backward compatibility
43
+ audioUrl: z.string(),
44
+ coverUrl: z.string(),
45
+ duration: z.number(),
46
+ title: z.string(),
47
+ tags: z.string(),
48
48
  }),
49
49
  });
50
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.8.84",
3
+ "version": "0.8.86",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",