@purpleschool/gptbot 0.20.17-stage-2 → 0.20.18-stage-2

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.
@@ -5,6 +5,8 @@ export declare const AUTH_ROUTES: {
5
5
  readonly LOGIN: 'login';
6
6
  readonly VK_LOGIN: 'vk/login';
7
7
  readonly YANDEX_LOGIN: 'yandex/login';
8
+ readonly VK_LINK: 'vk/link';
9
+ readonly YANDEX_LINK: 'yandex/link';
8
10
  readonly CREATE_USER: 'create-user';
9
11
  readonly RESTORE_PASSWORD: 'restore-password';
10
12
  readonly RESET_PASSWORD: 'reset-password';
@@ -8,6 +8,8 @@ exports.AUTH_ROUTES = {
8
8
  LOGIN: 'login',
9
9
  VK_LOGIN: 'vk/login',
10
10
  YANDEX_LOGIN: 'yandex/login',
11
+ VK_LINK: 'vk/link',
12
+ YANDEX_LINK: 'yandex/link',
11
13
  CREATE_USER: 'create-user',
12
14
  RESTORE_PASSWORD: 'restore-password',
13
15
  RESET_PASSWORD: 'reset-password',
@@ -1,6 +1,8 @@
1
1
  export declare const USER_CONTROLLER: 'users';
2
2
  export declare const USER_ROUTES: {
3
3
  readonly GET: 'me';
4
+ readonly ATTACH_EMAIL: 'me/attach-email';
5
+ readonly CONFIRM_ATTACH_EMAIL: 'attach-email/confirm';
4
6
  readonly GET_CLIENT_COUNTRY_CODE: 'country-code';
5
7
  readonly PATCH_LOCALE: 'me/locale';
6
8
  readonly PATCH_DIGITAL_PROCESSING_CONSENT: 'me/digital-processing-consent';
@@ -4,6 +4,8 @@ exports.USER_ROUTES = exports.USER_CONTROLLER = void 0;
4
4
  exports.USER_CONTROLLER = 'users';
5
5
  exports.USER_ROUTES = {
6
6
  GET: 'me',
7
+ ATTACH_EMAIL: 'me/attach-email',
8
+ CONFIRM_ATTACH_EMAIL: 'attach-email/confirm',
7
9
  GET_CLIENT_COUNTRY_CODE: 'country-code',
8
10
  PATCH_LOCALE: 'me/locale',
9
11
  PATCH_DIGITAL_PROCESSING_CONSENT: 'me/digital-processing-consent',
@@ -37,6 +37,8 @@ export declare const REST_API: {
37
37
  readonly ADMIN_LOGIN: "/api/auth/admin/login";
38
38
  readonly VK_LOGIN: "/api/auth/vk/login";
39
39
  readonly YANDEX_LOGIN: "/api/auth/yandex/login";
40
+ readonly VK_LINK: "/api/auth/vk/link";
41
+ readonly YANDEX_LINK: "/api/auth/yandex/link";
40
42
  readonly CREATE_USER: "/api/auth/create-user";
41
43
  readonly RESTORE_PASSWORD: "/api/auth/restore-password";
42
44
  readonly RESET_PASSWORD: "/api/auth/reset-password";
@@ -46,6 +48,8 @@ export declare const REST_API: {
46
48
  };
47
49
  readonly USERS: {
48
50
  readonly GET: "/api/users/me";
51
+ readonly ATTACH_EMAIL: "/api/users/me/attach-email";
52
+ readonly CONFIRM_ATTACH_EMAIL: "/api/users/attach-email/confirm";
49
53
  readonly GET_CLIENT_COUNTRY_CODE: "/api/users/country-code";
50
54
  readonly PATCH_LOCALE: "/api/users/me/locale";
51
55
  readonly POST: "/api/users/up-balance";
@@ -76,6 +76,8 @@ exports.REST_API = {
76
76
  ADMIN_LOGIN: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.ADMIN_LOGIN}`,
77
77
  VK_LOGIN: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.VK_LOGIN}`,
78
78
  YANDEX_LOGIN: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.YANDEX_LOGIN}`,
79
+ VK_LINK: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.VK_LINK}`,
80
+ YANDEX_LINK: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.YANDEX_LINK}`,
79
81
  CREATE_USER: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.CREATE_USER}`,
80
82
  RESTORE_PASSWORD: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.RESTORE_PASSWORD}`,
81
83
  RESET_PASSWORD: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.RESET_PASSWORD}`,
@@ -85,6 +87,8 @@ exports.REST_API = {
85
87
  },
86
88
  USERS: {
87
89
  GET: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET}`,
90
+ ATTACH_EMAIL: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.ATTACH_EMAIL}`,
91
+ CONFIRM_ATTACH_EMAIL: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CONFIRM_ATTACH_EMAIL}`,
88
92
  GET_CLIENT_COUNTRY_CODE: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_CLIENT_COUNTRY_CODE}`,
89
93
  PATCH_LOCALE: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.PATCH_LOCALE}`,
90
94
  POST: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.POST}`,
@@ -1,4 +1,5 @@
1
1
  export * from './create-user.command';
2
+ export * from './link-oauth.command';
2
3
  export * from './login.command';
3
4
  export * from './register-user.command';
4
5
  export * from './reset-password.command';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-user.command"), exports);
18
+ __exportStar(require("./link-oauth.command"), exports);
18
19
  __exportStar(require("./login.command"), exports);
19
20
  __exportStar(require("./register-user.command"), exports);
20
21
  __exportStar(require("./reset-password.command"), exports);
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ export declare namespace LinkVKCommand {
3
+ const RequestSchema: z.ZodObject<{
4
+ code: z.ZodString;
5
+ code_verifier: z.ZodString;
6
+ device_id: z.ZodString;
7
+ state: z.ZodString;
8
+ }, z.core.$strip>;
9
+ type Request = z.infer<typeof RequestSchema>;
10
+ const ResponseSchema: z.ZodObject<{
11
+ data: z.ZodObject<{
12
+ linked: z.ZodLiteral<true>;
13
+ }, z.core.$strip>;
14
+ }, z.core.$strip>;
15
+ type Response = z.infer<typeof ResponseSchema>;
16
+ }
17
+ export declare namespace LinkYandexCommand {
18
+ const RequestSchema: z.ZodObject<{
19
+ code: z.ZodString;
20
+ code_verifier: z.ZodString;
21
+ }, z.core.$strip>;
22
+ type Request = z.infer<typeof RequestSchema>;
23
+ const ResponseSchema: z.ZodObject<{
24
+ data: z.ZodObject<{
25
+ linked: z.ZodLiteral<true>;
26
+ }, z.core.$strip>;
27
+ }, z.core.$strip>;
28
+ type Response = z.infer<typeof ResponseSchema>;
29
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkYandexCommand = exports.LinkVKCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var LinkVKCommand;
6
+ (function (LinkVKCommand) {
7
+ LinkVKCommand.RequestSchema = zod_1.z.object({
8
+ code: zod_1.z.string().min(1),
9
+ code_verifier: zod_1.z.string().min(1),
10
+ device_id: zod_1.z.string().min(1),
11
+ state: zod_1.z.string().min(1),
12
+ });
13
+ LinkVKCommand.ResponseSchema = zod_1.z.object({ data: zod_1.z.object({ linked: zod_1.z.literal(true) }) });
14
+ })(LinkVKCommand || (exports.LinkVKCommand = LinkVKCommand = {}));
15
+ var LinkYandexCommand;
16
+ (function (LinkYandexCommand) {
17
+ LinkYandexCommand.RequestSchema = LinkVKCommand.RequestSchema.pick({
18
+ code: true,
19
+ code_verifier: true,
20
+ });
21
+ LinkYandexCommand.ResponseSchema = LinkVKCommand.ResponseSchema;
22
+ })(LinkYandexCommand || (exports.LinkYandexCommand = LinkYandexCommand = {}));
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { LOCALE } from '@purpleschool/rugpt-lib-common';
3
+ export declare namespace AttachEmailCommand {
4
+ const EmailSchema: z.ZodPipe<z.ZodString, z.ZodEmail>;
5
+ const RequestSchema: z.ZodObject<{
6
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
7
+ locale: z.ZodOptional<z.ZodEnum<typeof LOCALE>>;
8
+ }, z.core.$strip>;
9
+ type Request = z.infer<typeof RequestSchema>;
10
+ const ResponseSchema: z.ZodObject<{
11
+ data: z.ZodObject<{
12
+ retryAfterSeconds: z.ZodNumber;
13
+ }, z.core.$strip>;
14
+ }, z.core.$strip>;
15
+ type Response = z.infer<typeof ResponseSchema>;
16
+ }
17
+ export declare namespace ConfirmAttachEmailCommand {
18
+ const RequestSchema: z.ZodObject<{
19
+ token: z.ZodString;
20
+ password: z.ZodString;
21
+ }, z.core.$strip>;
22
+ type Request = z.infer<typeof RequestSchema>;
23
+ const ResponseSchema: z.ZodObject<{
24
+ data: z.ZodObject<{
25
+ accessToken: z.ZodString;
26
+ }, z.core.$strip>;
27
+ }, z.core.$strip>;
28
+ type Response = z.infer<typeof ResponseSchema>;
29
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfirmAttachEmailCommand = exports.AttachEmailCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const rugpt_lib_common_1 = require("@purpleschool/rugpt-lib-common");
6
+ var AttachEmailCommand;
7
+ (function (AttachEmailCommand) {
8
+ AttachEmailCommand.EmailSchema = zod_1.z
9
+ .string()
10
+ .trim()
11
+ .toLowerCase()
12
+ .pipe(zod_1.z.email())
13
+ .refine((email) => !email.endsWith('@t.me'));
14
+ AttachEmailCommand.RequestSchema = zod_1.z.object({
15
+ email: AttachEmailCommand.EmailSchema,
16
+ locale: zod_1.z.enum(rugpt_lib_common_1.LOCALE).optional(),
17
+ });
18
+ AttachEmailCommand.ResponseSchema = zod_1.z.object({
19
+ data: zod_1.z.object({ retryAfterSeconds: zod_1.z.number().int().nonnegative() }),
20
+ });
21
+ })(AttachEmailCommand || (exports.AttachEmailCommand = AttachEmailCommand = {}));
22
+ var ConfirmAttachEmailCommand;
23
+ (function (ConfirmAttachEmailCommand) {
24
+ ConfirmAttachEmailCommand.RequestSchema = zod_1.z.object({
25
+ token: zod_1.z.string().min(1).max(4096),
26
+ password: zod_1.z
27
+ .string()
28
+ .min(1)
29
+ .refine((password) => {
30
+ return new TextEncoder().encode(password).length <= 72;
31
+ }, 'Password must not exceed 72 UTF-8 bytes'),
32
+ });
33
+ ConfirmAttachEmailCommand.ResponseSchema = zod_1.z.object({ data: zod_1.z.object({ accessToken: zod_1.z.string() }) });
34
+ })(ConfirmAttachEmailCommand || (exports.ConfirmAttachEmailCommand = ConfirmAttachEmailCommand = {}));
@@ -22,6 +22,8 @@ export declare namespace GetMeCommand {
22
22
  readonly DEACTIVATED: 'deactivated';
23
23
  }>;
24
24
  signupMethod: z.ZodEnum<typeof SIGNUP_METHOD>;
25
+ hasVk: z.ZodBoolean;
26
+ hasYandex: z.ZodBoolean;
25
27
  telegramId: z.ZodNullable<z.ZodNumber>;
26
28
  telegramUserName: z.ZodNullable<z.ZodString>;
27
29
  webmasterId: z.ZodNullable<z.ZodUUID>;
@@ -19,6 +19,8 @@ var GetMeCommand;
19
19
  status: zod_1.z.enum(constants_1.USER_STATUS),
20
20
  role: zod_1.z.enum(constants_1.ROLE),
21
21
  signupMethod: zod_1.z.enum(constants_1.SIGNUP_METHOD),
22
+ hasVk: zod_1.z.boolean(),
23
+ hasYandex: zod_1.z.boolean(),
22
24
  telegramId: zod_1.z.number().nullable(),
23
25
  telegramUserName: zod_1.z.string().nullable(),
24
26
  webmasterId: zod_1.z.uuid().nullable(),
@@ -1,4 +1,5 @@
1
1
  export * from './check-email.command';
2
+ export * from './attach-email.command';
2
3
  export * from './find-user-by-uuid.command';
3
4
  export * from './get-client-country-code.command';
4
5
  export * from './get-me.command';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./check-email.command"), exports);
18
+ __exportStar(require("./attach-email.command"), exports);
18
19
  __exportStar(require("./find-user-by-uuid.command"), exports);
19
20
  __exportStar(require("./get-client-country-code.command"), exports);
20
21
  __exportStar(require("./get-me.command"), exports);
@@ -12,6 +12,7 @@ exports.UserLoyaltyStatusResponseSchema = zod_1.z.object({
12
12
  nextLevelRenewalBonusPercent: zod_1.z.number().int().nullable(),
13
13
  monthsToNextLevel: zod_1.z.number().int().nullable(),
14
14
  isLapsed: zod_1.z.boolean(),
15
+ /** Exclusive recovery boundary, identical to the UTC calendar tenure reset. */
15
16
  winBackDeadline: zod_1.z.date().nullable(),
16
17
  levels: zod_1.z.array(zod_1.z.object({
17
18
  level: zod_1.z.enum(constants_1.LOYALTY_LEVEL),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.20.17-stage-2",
3
+ "version": "0.20.18-stage-2",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",