@purpleschool/gptbot 0.7.35-texteditor → 0.7.36-texteditor

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.
@@ -40,6 +40,7 @@ export * from './review';
40
40
  export * from './prompt-category';
41
41
  export * from './prompt-topic';
42
42
  export * from './prompt';
43
+ export * from './user-private';
43
44
  export * from './folder';
44
45
  export * from './user-to-product';
45
46
  export * from './user-to-subscription';
@@ -0,0 +1,5 @@
1
+ export const USER_PRIVATE_CONTROLLER = 'users/private' as const;
2
+
3
+ export const USER_PRIVATE_ROUTES = {
4
+ GET_USER_BATCH: 'get-by-ids',
5
+ } as const;
package/api/routes.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { POST_TYPE } from '../constants';
2
2
  import * as CONTROLLERS from './controllers';
3
-
4
3
  export const ROOT = '/api' as const;
5
4
 
6
5
  export const REST_API = {
@@ -31,6 +30,9 @@ export const REST_API = {
31
30
  SEND_NOTIFICATION: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
32
31
  DELETE_ACCOUNT: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
33
32
  },
33
+ USER_PRIVATE: {
34
+ GET_USER_BATCH: `${ROOT}/${CONTROLLERS.USER_PRIVATE_CONTROLLER}/${CONTROLLERS.USER_PRIVATE_ROUTES.GET_USER_BATCH}`,
35
+ },
34
36
  PAGE: {
35
37
  GET: `${ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${CONTROLLERS.PAGE_ROUTES.GET_ALL}`,
36
38
  PATCH: (uuid: string) => `${ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${uuid}`,
@@ -56,6 +56,7 @@ __exportStar(require("./review"), exports);
56
56
  __exportStar(require("./prompt-category"), exports);
57
57
  __exportStar(require("./prompt-topic"), exports);
58
58
  __exportStar(require("./prompt"), exports);
59
+ __exportStar(require("./user-private"), exports);
59
60
  __exportStar(require("./folder"), exports);
60
61
  __exportStar(require("./user-to-product"), exports);
61
62
  __exportStar(require("./user-to-subscription"), exports);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_PRIVATE_ROUTES = exports.USER_PRIVATE_CONTROLLER = void 0;
4
+ exports.USER_PRIVATE_CONTROLLER = 'users/private';
5
+ exports.USER_PRIVATE_ROUTES = {
6
+ GET_USER_BATCH: 'get-by-ids',
7
+ };
@@ -60,6 +60,9 @@ exports.REST_API = {
60
60
  SEND_NOTIFICATION: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
61
61
  DELETE_ACCOUNT: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
62
62
  },
63
+ USER_PRIVATE: {
64
+ GET_USER_BATCH: `${exports.ROOT}/${CONTROLLERS.USER_PRIVATE_CONTROLLER}/${CONTROLLERS.USER_PRIVATE_ROUTES.GET_USER_BATCH}`,
65
+ },
63
66
  PAGE: {
64
67
  GET: `${exports.ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${CONTROLLERS.PAGE_ROUTES.GET_ALL}`,
65
68
  PATCH: (uuid) => `${exports.ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${uuid}`,
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetAggregatedUserData = void 0;
4
+ const zod_1 = require("zod");
5
+ var GetAggregatedUserData;
6
+ (function (GetAggregatedUserData) {
7
+ GetAggregatedUserData.RequestSchema = zod_1.z.object({
8
+ uuids: zod_1.z.array(zod_1.z.string().uuid()).min(1),
9
+ });
10
+ GetAggregatedUserData.AggregatedUserSchema = zod_1.z.object({
11
+ uuid: zod_1.z.string().uuid(),
12
+ email: zod_1.z.string().email().nullable(),
13
+ telegramId: zod_1.z.number().nullable(),
14
+ lastActivityAt: zod_1.z.string().datetime(),
15
+ registeredAt: zod_1.z.string().datetime(),
16
+ tokenBalance: zod_1.z.number(),
17
+ hasActiveSubscription: zod_1.z.boolean(),
18
+ hasActiveProduct: zod_1.z.boolean(),
19
+ isCustomer: zod_1.z.boolean(),
20
+ });
21
+ GetAggregatedUserData.ResponseSchema = zod_1.z.object({
22
+ data: zod_1.z.array(GetAggregatedUserData.AggregatedUserSchema),
23
+ });
24
+ })(GetAggregatedUserData || (exports.GetAggregatedUserData = GetAggregatedUserData = {}));
@@ -11,4 +11,5 @@ exports.EMAIL_SUBJECTS = {
11
11
  SUBSCRIPTION_RENEWAL_REMINDER: 'Продление подписки',
12
12
  RESTORE_PASSWORD: 'Восстановление пароля',
13
13
  FAST_REGISTRATION: 'Быстрая регистрация',
14
+ SUBSCRIPTION_BEFORE_CANCEL: 'Завтра всё изменится',
14
15
  };
@@ -6,5 +6,6 @@ var USER_TO_SUBSCRIPTION_MARKS;
6
6
  USER_TO_SUBSCRIPTION_MARKS["WITHOUT_AUTO_RENEWAL"] = "WITHOUT_AUTO_RENEWAL";
7
7
  USER_TO_SUBSCRIPTION_MARKS["MOCK"] = "MOCK";
8
8
  USER_TO_SUBSCRIPTION_MARKS["SENT_RENEWAL_REMINDER"] = "SENT_RENEWAL_REMINDER";
9
+ USER_TO_SUBSCRIPTION_MARKS["SENT_CANCELLATION_WARNING"] = "SENT_CANCELLATION_WARNING";
9
10
  USER_TO_SUBSCRIPTION_MARKS["SENT_PAST_DUE_RECOVER_REQUEST"] = "SENT_PAST_DUE_RECOVER_REQUEST";
10
11
  })(USER_TO_SUBSCRIPTION_MARKS || (exports.USER_TO_SUBSCRIPTION_MARKS = USER_TO_SUBSCRIPTION_MARKS = {}));
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageEditorConfigSchema = exports.PromptGroupSchema = exports.SystemPromptSchema = void 0;
3
+ exports.ImageEditorConfigSchema = exports.PromptGroupSchema = exports.SystemPromptSchema = exports.SystemPromptParamsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const image_editor_model_schema_1 = require("./image-editor-model.schema");
6
6
  const icon_variants_schema_1 = require("../../icon-variants.schema");
7
+ exports.SystemPromptParamsSchema = zod_1.z.object({
8
+ imageSettings: zod_1.z.object({
9
+ minImages: zod_1.z.number(),
10
+ maxImages: zod_1.z.number(),
11
+ }),
12
+ });
7
13
  exports.SystemPromptSchema = zod_1.z.object({
8
14
  uuid: zod_1.z.string(),
9
15
  title: zod_1.z.string(),
@@ -11,6 +17,7 @@ exports.SystemPromptSchema = zod_1.z.object({
11
17
  prompt: zod_1.z.string(),
12
18
  allowUserPrompt: zod_1.z.boolean(),
13
19
  groupId: zod_1.z.string().uuid(),
20
+ params: exports.SystemPromptParamsSchema,
14
21
  preview: zod_1.z
15
22
  .object({
16
23
  before: zod_1.z.string(),
@@ -18,6 +25,7 @@ exports.SystemPromptSchema = zod_1.z.object({
18
25
  })
19
26
  .optional()
20
27
  .nullable(),
28
+ order: zod_1.z.number(),
21
29
  });
22
30
  exports.PromptGroupSchema = zod_1.z.object({
23
31
  uuid: zod_1.z.string(),
@@ -28,5 +36,5 @@ exports.PromptGroupSchema = zod_1.z.object({
28
36
  });
29
37
  exports.ImageEditorConfigSchema = zod_1.z.object({
30
38
  models: zod_1.z.array(image_editor_model_schema_1.ImageEditorModelSchema),
31
- promptGroups: zod_1.z.array(exports.SystemPromptSchema),
39
+ promptGroups: zod_1.z.array(exports.PromptGroupSchema),
32
40
  });
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ImageEditorJobSchema = exports.ImageEditorJobParamsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../../constants");
6
+ const tool_job_schema_1 = require("../../tool-job.schema");
6
7
  exports.ImageEditorJobParamsSchema = zod_1.z.object({
7
8
  imageUrls: zod_1.z.array(zod_1.z.string()).optional(),
8
9
  systemPromptId: zod_1.z.string().optional(),
9
10
  });
10
- exports.ImageEditorJobSchema = zod_1.z.object({
11
+ exports.ImageEditorJobSchema = tool_job_schema_1.ToolJobSchema.extend({
11
12
  title: zod_1.z.string(),
12
13
  prompt: zod_1.z.string(),
13
14
  reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace GetAggregatedUserData {
4
+ export const RequestSchema = z.object({
5
+ uuids: z.array(z.string().uuid()).min(1),
6
+ });
7
+
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const AggregatedUserSchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ email: z.string().email().nullable(),
13
+ telegramId: z.number().nullable(),
14
+ lastActivityAt: z.string().datetime(),
15
+ registeredAt: z.string().datetime(),
16
+ tokenBalance: z.number(),
17
+ hasActiveSubscription: z.boolean(),
18
+ hasActiveProduct: z.boolean(),
19
+ isCustomer: z.boolean(),
20
+ });
21
+
22
+ export type AggregatedUser = z.infer<typeof AggregatedUserSchema>;
23
+
24
+ export const ResponseSchema = z.object({
25
+ data: z.array(AggregatedUserSchema),
26
+ });
27
+
28
+ export type Response = z.infer<typeof ResponseSchema>;
29
+ }
@@ -8,4 +8,5 @@ export const EMAIL_SUBJECTS = {
8
8
  SUBSCRIPTION_RENEWAL_REMINDER: 'Продление подписки',
9
9
  RESTORE_PASSWORD: 'Восстановление пароля',
10
10
  FAST_REGISTRATION: 'Быстрая регистрация',
11
+ SUBSCRIPTION_BEFORE_CANCEL: 'Завтра всё изменится',
11
12
  };
@@ -2,5 +2,6 @@ export enum USER_TO_SUBSCRIPTION_MARKS {
2
2
  WITHOUT_AUTO_RENEWAL = 'WITHOUT_AUTO_RENEWAL',
3
3
  MOCK = 'MOCK',
4
4
  SENT_RENEWAL_REMINDER = 'SENT_RENEWAL_REMINDER',
5
+ SENT_CANCELLATION_WARNING = 'SENT_CANCELLATION_WARNING',
5
6
  SENT_PAST_DUE_RECOVER_REQUEST = 'SENT_PAST_DUE_RECOVER_REQUEST',
6
7
  }
@@ -2,6 +2,15 @@ import { z } from 'zod';
2
2
  import { ImageEditorModelSchema } from './image-editor-model.schema';
3
3
  import { IconVariantsSchema } from '../../icon-variants.schema';
4
4
 
5
+ export const SystemPromptParamsSchema = z.object({
6
+ imageSettings: z.object({
7
+ minImages: z.number(),
8
+ maxImages: z.number(),
9
+ }),
10
+ });
11
+
12
+ export type SystemPromptParams = z.infer<typeof SystemPromptParamsSchema>;
13
+
5
14
  export const SystemPromptSchema = z.object({
6
15
  uuid: z.string(),
7
16
  title: z.string(),
@@ -9,6 +18,7 @@ export const SystemPromptSchema = z.object({
9
18
  prompt: z.string(),
10
19
  allowUserPrompt: z.boolean(),
11
20
  groupId: z.string().uuid(),
21
+ params: SystemPromptParamsSchema,
12
22
  preview: z
13
23
  .object({
14
24
  before: z.string(),
@@ -16,6 +26,7 @@ export const SystemPromptSchema = z.object({
16
26
  })
17
27
  .optional()
18
28
  .nullable(),
29
+ order: z.number(),
19
30
  });
20
31
 
21
32
  export const PromptGroupSchema = z.object({
@@ -28,5 +39,5 @@ export const PromptGroupSchema = z.object({
28
39
 
29
40
  export const ImageEditorConfigSchema = z.object({
30
41
  models: z.array(ImageEditorModelSchema),
31
- promptGroups: z.array(SystemPromptSchema),
42
+ promptGroups: z.array(PromptGroupSchema),
32
43
  });
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { USER_REACTION } from '../../../constants';
3
+ import { ToolJobSchema } from '../../tool-job.schema';
3
4
 
4
5
  export const ImageEditorJobParamsSchema = z.object({
5
6
  imageUrls: z.array(z.string()).optional(),
@@ -8,7 +9,7 @@ export const ImageEditorJobParamsSchema = z.object({
8
9
 
9
10
  export type ImageEditorJobParams = z.infer<typeof ImageEditorJobParamsSchema>;
10
11
 
11
- export const ImageEditorJobSchema = z.object({
12
+ export const ImageEditorJobSchema = ToolJobSchema.extend({
12
13
  title: z.string(),
13
14
  prompt: z.string(),
14
15
  reaction: z.nativeEnum(USER_REACTION).nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.7.35-texteditor",
3
+ "version": "0.7.36-texteditor",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",