@skroz/profile-api 1.0.5

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 (65) hide show
  1. package/LICENCE.md +21 -0
  2. package/dist/adapters/TypeOrmProfileAdapter.d.ts +13 -0
  3. package/dist/adapters/TypeOrmProfileAdapter.js +54 -0
  4. package/dist/dto/ConfirmEmailInput.d.ts +6 -0
  5. package/dist/dto/ConfirmEmailInput.js +27 -0
  6. package/dist/dto/ForgotPasswordInput.d.ts +9 -0
  7. package/dist/dto/ForgotPasswordInput.js +31 -0
  8. package/dist/dto/LoginInput.d.ts +12 -0
  9. package/dist/dto/LoginInput.js +31 -0
  10. package/dist/dto/PasswordInput.d.ts +9 -0
  11. package/dist/dto/PasswordInput.js +31 -0
  12. package/dist/dto/RecoverPasswordInput.d.ts +12 -0
  13. package/dist/dto/RecoverPasswordInput.js +28 -0
  14. package/dist/dto/RegisterInput.d.ts +16 -0
  15. package/dist/dto/RegisterInput.js +40 -0
  16. package/dist/dto/SendTokenPayload.d.ts +4 -0
  17. package/dist/dto/SendTokenPayload.js +27 -0
  18. package/dist/dto/StatusPayload.d.ts +3 -0
  19. package/dist/dto/StatusPayload.js +23 -0
  20. package/dist/dto/UpdateEmailInput.d.ts +9 -0
  21. package/dist/dto/UpdateEmailInput.js +31 -0
  22. package/dist/dto/UpdatePasswordInput.d.ts +12 -0
  23. package/dist/dto/UpdatePasswordInput.js +28 -0
  24. package/dist/dto/UpdateProfileInput.d.ts +9 -0
  25. package/dist/dto/UpdateProfileInput.js +31 -0
  26. package/dist/dto/index.d.ts +11 -0
  27. package/dist/dto/index.js +27 -0
  28. package/dist/entities/TypeOrmBaseUser.d.ts +25 -0
  29. package/dist/entities/TypeOrmBaseUser.js +117 -0
  30. package/dist/index.d.ts +8 -0
  31. package/dist/index.js +24 -0
  32. package/dist/resolvers/AuthResolver.d.ts +38 -0
  33. package/dist/resolvers/AuthResolver.js +219 -0
  34. package/dist/resolvers/ProfileResolver.d.ts +24 -0
  35. package/dist/resolvers/ProfileResolver.js +145 -0
  36. package/dist/services/ProfileAuthService.d.ts +24 -0
  37. package/dist/services/ProfileAuthService.js +94 -0
  38. package/dist/services/ProfileEmailService.d.ts +15 -0
  39. package/dist/services/ProfileEmailService.js +105 -0
  40. package/dist/types/index.d.ts +98 -0
  41. package/dist/types/index.js +10 -0
  42. package/dist/validators/isTrue.d.ts +3 -0
  43. package/dist/validators/isTrue.js +7 -0
  44. package/package.json +45 -0
  45. package/src/adapters/TypeOrmProfileAdapter.ts +40 -0
  46. package/src/dto/ConfirmEmailInput.ts +12 -0
  47. package/src/dto/ForgotPasswordInput.ts +17 -0
  48. package/src/dto/LoginInput.ts +20 -0
  49. package/src/dto/PasswordInput.ts +17 -0
  50. package/src/dto/RecoverPasswordInput.ts +20 -0
  51. package/src/dto/RegisterInput.ts +29 -0
  52. package/src/dto/SendTokenPayload.ts +10 -0
  53. package/src/dto/StatusPayload.ts +7 -0
  54. package/src/dto/UpdateEmailInput.ts +17 -0
  55. package/src/dto/UpdatePasswordInput.ts +20 -0
  56. package/src/dto/UpdateProfileInput.ts +17 -0
  57. package/src/dto/index.ts +11 -0
  58. package/src/entities/TypeOrmBaseUser.ts +87 -0
  59. package/src/index.ts +8 -0
  60. package/src/resolvers/AuthResolver.ts +195 -0
  61. package/src/resolvers/ProfileResolver.ts +107 -0
  62. package/src/services/ProfileAuthService.ts +122 -0
  63. package/src/services/ProfileEmailService.ts +158 -0
  64. package/src/types/index.ts +102 -0
  65. package/src/validators/isTrue.ts +8 -0
package/LICENCE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present, Mikhail Skroznikov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ import { AuthUser, ProfileDbAdapter } from '../types';
2
+ export declare class TypeOrmProfileAdapter implements ProfileDbAdapter {
3
+ private repository;
4
+ constructor(userEntity: any);
5
+ findUserByEmail(email: string): Promise<AuthUser | null>;
6
+ findUserById(id: number): Promise<AuthUser | null>;
7
+ findUserByTelegramId(telegramId: string): Promise<AuthUser | null>;
8
+ createUser(data: {
9
+ email: string;
10
+ passwordHash: string;
11
+ }): Promise<AuthUser>;
12
+ isEmailTaken(email: string, excludeUserId?: number): Promise<boolean>;
13
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TypeOrmProfileAdapter = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ class TypeOrmProfileAdapter {
15
+ constructor(userEntity) {
16
+ this.repository = (0, typeorm_1.getConnection)().getRepository(userEntity);
17
+ }
18
+ findUserByEmail(email) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ return this.repository.findOne({ where: { email: email.toLowerCase() } });
21
+ });
22
+ }
23
+ findUserById(id) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ return this.repository.findOne(id);
26
+ });
27
+ }
28
+ findUserByTelegramId(telegramId) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ return this.repository.findOne({ where: { telegramId } });
31
+ });
32
+ }
33
+ createUser(data) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const user = this.repository.create({
36
+ email: data.email.toLowerCase(),
37
+ password: data.passwordHash,
38
+ isEmailConfirmed: false,
39
+ });
40
+ return (yield this.repository.save(user));
41
+ });
42
+ }
43
+ isEmailTaken(email, excludeUserId) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const where = { email: email.toLowerCase() };
46
+ if (excludeUserId) {
47
+ where.id = (0, typeorm_1.Not)(excludeUserId);
48
+ }
49
+ const count = yield this.repository.count({ where });
50
+ return count > 0;
51
+ });
52
+ }
53
+ }
54
+ exports.TypeOrmProfileAdapter = TypeOrmProfileAdapter;
@@ -0,0 +1,6 @@
1
+ export declare class ConfirmEmailInput {
2
+ token: string;
3
+ }
4
+ export declare const confirmEmailValidators: {
5
+ token: import("@os-team/graphql-validators").Validator[];
6
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.confirmEmailValidators = exports.ConfirmEmailInput = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const graphql_validators_1 = require("@os-team/graphql-validators");
15
+ let ConfirmEmailInput = class ConfirmEmailInput {
16
+ };
17
+ exports.ConfirmEmailInput = ConfirmEmailInput;
18
+ __decorate([
19
+ (0, type_graphql_1.Field)(),
20
+ __metadata("design:type", String)
21
+ ], ConfirmEmailInput.prototype, "token", void 0);
22
+ exports.ConfirmEmailInput = ConfirmEmailInput = __decorate([
23
+ (0, type_graphql_1.InputType)()
24
+ ], ConfirmEmailInput);
25
+ exports.confirmEmailValidators = {
26
+ token: [graphql_validators_1.isNotEmpty],
27
+ };
@@ -0,0 +1,9 @@
1
+ export declare class ForgotPasswordInput {
2
+ email: string;
3
+ }
4
+ export declare const forgotPasswordValidators: {
5
+ email: import("@os-team/graphql-validators").Validator[];
6
+ };
7
+ export declare const forgotPasswordTransformers: {
8
+ email: import("@os-team/graphql-transformers").Transformer[];
9
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.forgotPasswordTransformers = exports.forgotPasswordValidators = exports.ForgotPasswordInput = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const graphql_validators_1 = require("@os-team/graphql-validators");
15
+ const graphql_transformers_1 = require("@os-team/graphql-transformers");
16
+ let ForgotPasswordInput = class ForgotPasswordInput {
17
+ };
18
+ exports.ForgotPasswordInput = ForgotPasswordInput;
19
+ __decorate([
20
+ (0, type_graphql_1.Field)(),
21
+ __metadata("design:type", String)
22
+ ], ForgotPasswordInput.prototype, "email", void 0);
23
+ exports.ForgotPasswordInput = ForgotPasswordInput = __decorate([
24
+ (0, type_graphql_1.InputType)()
25
+ ], ForgotPasswordInput);
26
+ exports.forgotPasswordValidators = {
27
+ email: [graphql_validators_1.isEmail],
28
+ };
29
+ exports.forgotPasswordTransformers = {
30
+ email: [graphql_transformers_1.trim, graphql_transformers_1.toLowerCase],
31
+ };
@@ -0,0 +1,12 @@
1
+ import { PasswordInput } from './PasswordInput';
2
+ export declare class LoginInput extends PasswordInput {
3
+ email: string;
4
+ }
5
+ export declare const loginValidators: {
6
+ email: import("@os-team/graphql-validators").Validator[];
7
+ password: import("@os-team/graphql-validators").Validator[];
8
+ };
9
+ export declare const loginTransformers: {
10
+ password: import("@os-team/graphql-transformers").Transformer[];
11
+ email: import("@os-team/graphql-transformers").Transformer[];
12
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.loginTransformers = exports.loginValidators = exports.LoginInput = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const graphql_validators_1 = require("@os-team/graphql-validators");
15
+ const graphql_transformers_1 = require("@os-team/graphql-transformers");
16
+ const PasswordInput_1 = require("./PasswordInput");
17
+ let LoginInput = class LoginInput extends PasswordInput_1.PasswordInput {
18
+ };
19
+ exports.LoginInput = LoginInput;
20
+ __decorate([
21
+ (0, type_graphql_1.Field)(),
22
+ __metadata("design:type", String)
23
+ ], LoginInput.prototype, "email", void 0);
24
+ exports.LoginInput = LoginInput = __decorate([
25
+ (0, type_graphql_1.InputType)()
26
+ ], LoginInput);
27
+ exports.loginValidators = {
28
+ email: [graphql_validators_1.isEmail],
29
+ password: [graphql_validators_1.isNotEmpty],
30
+ };
31
+ exports.loginTransformers = Object.assign({ email: [graphql_transformers_1.trim, graphql_transformers_1.toLowerCase] }, PasswordInput_1.passwordTransformers);
@@ -0,0 +1,9 @@
1
+ export declare class PasswordInput {
2
+ password: string;
3
+ }
4
+ export declare const passwordValidators: {
5
+ password: import("@os-team/graphql-validators").Validator[];
6
+ };
7
+ export declare const passwordTransformers: {
8
+ password: import("@os-team/graphql-transformers").Transformer[];
9
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.passwordTransformers = exports.passwordValidators = exports.PasswordInput = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const graphql_validators_1 = require("@os-team/graphql-validators");
15
+ const graphql_transformers_1 = require("@os-team/graphql-transformers");
16
+ let PasswordInput = class PasswordInput {
17
+ };
18
+ exports.PasswordInput = PasswordInput;
19
+ __decorate([
20
+ (0, type_graphql_1.Field)(),
21
+ __metadata("design:type", String)
22
+ ], PasswordInput.prototype, "password", void 0);
23
+ exports.PasswordInput = PasswordInput = __decorate([
24
+ (0, type_graphql_1.InputType)({ isAbstract: true })
25
+ ], PasswordInput);
26
+ exports.passwordValidators = {
27
+ password: [(0, graphql_validators_1.minLength)(6), (0, graphql_validators_1.maxLength)(64)],
28
+ };
29
+ exports.passwordTransformers = {
30
+ password: [graphql_transformers_1.trim],
31
+ };
@@ -0,0 +1,12 @@
1
+ import { PasswordInput } from './PasswordInput';
2
+ export declare class RecoverPasswordInput extends PasswordInput {
3
+ token: string;
4
+ }
5
+ export declare const recoverPasswordTransformers: {
6
+ token: import("@os-team/graphql-transformers").Transformer[];
7
+ password: import("@os-team/graphql-transformers").Transformer[];
8
+ };
9
+ export declare const recoverPasswordValidators: {
10
+ token: import("@os-team/graphql-validators").Validator[];
11
+ password: import("@os-team/graphql-validators").Validator[];
12
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.recoverPasswordValidators = exports.recoverPasswordTransformers = exports.RecoverPasswordInput = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const graphql_validators_1 = require("@os-team/graphql-validators");
15
+ const graphql_transformers_1 = require("@os-team/graphql-transformers");
16
+ const PasswordInput_1 = require("./PasswordInput");
17
+ let RecoverPasswordInput = class RecoverPasswordInput extends PasswordInput_1.PasswordInput {
18
+ };
19
+ exports.RecoverPasswordInput = RecoverPasswordInput;
20
+ __decorate([
21
+ (0, type_graphql_1.Field)(),
22
+ __metadata("design:type", String)
23
+ ], RecoverPasswordInput.prototype, "token", void 0);
24
+ exports.RecoverPasswordInput = RecoverPasswordInput = __decorate([
25
+ (0, type_graphql_1.InputType)()
26
+ ], RecoverPasswordInput);
27
+ exports.recoverPasswordTransformers = Object.assign(Object.assign({}, PasswordInput_1.passwordTransformers), { token: [graphql_transformers_1.trim] });
28
+ exports.recoverPasswordValidators = Object.assign(Object.assign({}, PasswordInput_1.passwordValidators), { token: [graphql_validators_1.isNotEmpty] });
@@ -0,0 +1,16 @@
1
+ import { PasswordInput } from './PasswordInput';
2
+ export declare class RegisterInput extends PasswordInput {
3
+ email: string;
4
+ isUserAgreementAgree?: boolean;
5
+ isPrivacyPolicyAgree?: boolean;
6
+ }
7
+ export declare const registerValidators: {
8
+ password: import("@os-team/graphql-validators").Validator[];
9
+ email: import("@os-team/graphql-validators").Validator[];
10
+ isUserAgreementAgree: import("@os-team/graphql-validators").Validator[];
11
+ isPrivacyPolicyAgree: import("@os-team/graphql-validators").Validator[];
12
+ };
13
+ export declare const registerTransformers: {
14
+ password: import("@os-team/graphql-transformers").Transformer[];
15
+ email: import("@os-team/graphql-transformers").Transformer[];
16
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.registerTransformers = exports.registerValidators = exports.RegisterInput = void 0;
16
+ const type_graphql_1 = require("type-graphql");
17
+ const graphql_validators_1 = require("@os-team/graphql-validators");
18
+ const graphql_transformers_1 = require("@os-team/graphql-transformers");
19
+ const PasswordInput_1 = require("./PasswordInput");
20
+ const isTrue_1 = __importDefault(require("../validators/isTrue"));
21
+ let RegisterInput = class RegisterInput extends PasswordInput_1.PasswordInput {
22
+ };
23
+ exports.RegisterInput = RegisterInput;
24
+ __decorate([
25
+ (0, type_graphql_1.Field)(),
26
+ __metadata("design:type", String)
27
+ ], RegisterInput.prototype, "email", void 0);
28
+ __decorate([
29
+ (0, type_graphql_1.Field)(() => Boolean, { nullable: true }),
30
+ __metadata("design:type", Boolean)
31
+ ], RegisterInput.prototype, "isUserAgreementAgree", void 0);
32
+ __decorate([
33
+ (0, type_graphql_1.Field)(() => Boolean, { nullable: true }),
34
+ __metadata("design:type", Boolean)
35
+ ], RegisterInput.prototype, "isPrivacyPolicyAgree", void 0);
36
+ exports.RegisterInput = RegisterInput = __decorate([
37
+ (0, type_graphql_1.InputType)()
38
+ ], RegisterInput);
39
+ exports.registerValidators = Object.assign({ email: [graphql_validators_1.isEmail], isUserAgreementAgree: [isTrue_1.default], isPrivacyPolicyAgree: [isTrue_1.default] }, PasswordInput_1.passwordValidators);
40
+ exports.registerTransformers = Object.assign({ email: [graphql_transformers_1.trim, graphql_transformers_1.toLowerCase] }, PasswordInput_1.passwordTransformers);
@@ -0,0 +1,4 @@
1
+ export declare class SendTokenPayload {
2
+ confirmationLinkIsSent: boolean;
3
+ limitExpiresAt?: number;
4
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SendTokenPayload = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ let SendTokenPayload = class SendTokenPayload {
15
+ };
16
+ exports.SendTokenPayload = SendTokenPayload;
17
+ __decorate([
18
+ (0, type_graphql_1.Field)(),
19
+ __metadata("design:type", Boolean)
20
+ ], SendTokenPayload.prototype, "confirmationLinkIsSent", void 0);
21
+ __decorate([
22
+ (0, type_graphql_1.Field)(() => Number, { nullable: true }),
23
+ __metadata("design:type", Number)
24
+ ], SendTokenPayload.prototype, "limitExpiresAt", void 0);
25
+ exports.SendTokenPayload = SendTokenPayload = __decorate([
26
+ (0, type_graphql_1.ObjectType)()
27
+ ], SendTokenPayload);
@@ -0,0 +1,3 @@
1
+ export declare class StatusPayload {
2
+ ok: boolean;
3
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.StatusPayload = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ let StatusPayload = class StatusPayload {
15
+ };
16
+ exports.StatusPayload = StatusPayload;
17
+ __decorate([
18
+ (0, type_graphql_1.Field)(),
19
+ __metadata("design:type", Boolean)
20
+ ], StatusPayload.prototype, "ok", void 0);
21
+ exports.StatusPayload = StatusPayload = __decorate([
22
+ (0, type_graphql_1.ObjectType)()
23
+ ], StatusPayload);
@@ -0,0 +1,9 @@
1
+ export declare class UpdateEmailInput {
2
+ email: string;
3
+ }
4
+ export declare const updateEmailTransformers: {
5
+ email: import("@os-team/graphql-transformers").Transformer[];
6
+ };
7
+ export declare const updateEmailValidators: {
8
+ email: import("@os-team/graphql-validators").Validator[];
9
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.updateEmailValidators = exports.updateEmailTransformers = exports.UpdateEmailInput = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const graphql_validators_1 = require("@os-team/graphql-validators");
15
+ const graphql_transformers_1 = require("@os-team/graphql-transformers");
16
+ let UpdateEmailInput = class UpdateEmailInput {
17
+ };
18
+ exports.UpdateEmailInput = UpdateEmailInput;
19
+ __decorate([
20
+ (0, type_graphql_1.Field)(),
21
+ __metadata("design:type", String)
22
+ ], UpdateEmailInput.prototype, "email", void 0);
23
+ exports.UpdateEmailInput = UpdateEmailInput = __decorate([
24
+ (0, type_graphql_1.InputType)()
25
+ ], UpdateEmailInput);
26
+ exports.updateEmailTransformers = {
27
+ email: [graphql_transformers_1.trim, graphql_transformers_1.toLowerCase],
28
+ };
29
+ exports.updateEmailValidators = {
30
+ email: [graphql_validators_1.isNotEmpty, graphql_validators_1.isEmail],
31
+ };
@@ -0,0 +1,12 @@
1
+ import { PasswordInput } from './PasswordInput';
2
+ export declare class UpdatePasswordInput extends PasswordInput {
3
+ oldPassword: string;
4
+ }
5
+ export declare const updatePasswordTransformers: {
6
+ oldPassword: import("@os-team/graphql-transformers").Transformer[];
7
+ password: import("@os-team/graphql-transformers").Transformer[];
8
+ };
9
+ export declare const updatePasswordValidators: {
10
+ oldPassword: import("@os-team/graphql-validators").Validator[];
11
+ password: import("@os-team/graphql-validators").Validator[];
12
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.updatePasswordValidators = exports.updatePasswordTransformers = exports.UpdatePasswordInput = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const graphql_validators_1 = require("@os-team/graphql-validators");
15
+ const graphql_transformers_1 = require("@os-team/graphql-transformers");
16
+ const PasswordInput_1 = require("./PasswordInput");
17
+ let UpdatePasswordInput = class UpdatePasswordInput extends PasswordInput_1.PasswordInput {
18
+ };
19
+ exports.UpdatePasswordInput = UpdatePasswordInput;
20
+ __decorate([
21
+ (0, type_graphql_1.Field)(),
22
+ __metadata("design:type", String)
23
+ ], UpdatePasswordInput.prototype, "oldPassword", void 0);
24
+ exports.UpdatePasswordInput = UpdatePasswordInput = __decorate([
25
+ (0, type_graphql_1.InputType)()
26
+ ], UpdatePasswordInput);
27
+ exports.updatePasswordTransformers = Object.assign(Object.assign({}, PasswordInput_1.passwordTransformers), { oldPassword: [graphql_transformers_1.trim] });
28
+ exports.updatePasswordValidators = Object.assign(Object.assign({}, PasswordInput_1.passwordValidators), { oldPassword: [graphql_validators_1.isNotEmpty] });
@@ -0,0 +1,9 @@
1
+ export declare class UpdateProfileInput {
2
+ name: string;
3
+ }
4
+ export declare const updateProfileTransformers: {
5
+ name: import("@os-team/graphql-transformers").Transformer[];
6
+ };
7
+ export declare const updateProfileValidators: {
8
+ name: import("@os-team/graphql-validators").Validator[];
9
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.updateProfileValidators = exports.updateProfileTransformers = exports.UpdateProfileInput = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const graphql_validators_1 = require("@os-team/graphql-validators");
15
+ const graphql_transformers_1 = require("@os-team/graphql-transformers");
16
+ let UpdateProfileInput = class UpdateProfileInput {
17
+ };
18
+ exports.UpdateProfileInput = UpdateProfileInput;
19
+ __decorate([
20
+ (0, type_graphql_1.Field)(),
21
+ __metadata("design:type", String)
22
+ ], UpdateProfileInput.prototype, "name", void 0);
23
+ exports.UpdateProfileInput = UpdateProfileInput = __decorate([
24
+ (0, type_graphql_1.InputType)()
25
+ ], UpdateProfileInput);
26
+ exports.updateProfileTransformers = {
27
+ name: [graphql_transformers_1.trim],
28
+ };
29
+ exports.updateProfileValidators = {
30
+ name: [graphql_validators_1.isNotEmpty],
31
+ };
@@ -0,0 +1,11 @@
1
+ export * from './PasswordInput';
2
+ export * from './RegisterInput';
3
+ export * from './LoginInput';
4
+ export * from './ForgotPasswordInput';
5
+ export * from './ConfirmEmailInput';
6
+ export * from './StatusPayload';
7
+ export * from './SendTokenPayload';
8
+ export * from './UpdatePasswordInput';
9
+ export * from './UpdateEmailInput';
10
+ export * from './UpdateProfileInput';
11
+ export * from './RecoverPasswordInput';
@@ -0,0 +1,27 @@
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("./PasswordInput"), exports);
18
+ __exportStar(require("./RegisterInput"), exports);
19
+ __exportStar(require("./LoginInput"), exports);
20
+ __exportStar(require("./ForgotPasswordInput"), exports);
21
+ __exportStar(require("./ConfirmEmailInput"), exports);
22
+ __exportStar(require("./StatusPayload"), exports);
23
+ __exportStar(require("./SendTokenPayload"), exports);
24
+ __exportStar(require("./UpdatePasswordInput"), exports);
25
+ __exportStar(require("./UpdateEmailInput"), exports);
26
+ __exportStar(require("./UpdateProfileInput"), exports);
27
+ __exportStar(require("./RecoverPasswordInput"), exports);
@@ -0,0 +1,25 @@
1
+ import { BaseEntity as TypeORMBaseEntity } from 'typeorm';
2
+ export declare abstract class TypeOrmBaseUser extends TypeORMBaseEntity {
3
+ static config: {
4
+ isOnlineSeconds: number;
5
+ isOnlineRecentlySeconds: number;
6
+ };
7
+ id: number;
8
+ createdAt: Date;
9
+ updatedAt: Date;
10
+ email: string | null;
11
+ password: string;
12
+ isTempPassword: boolean;
13
+ isEmailConfirmed: boolean;
14
+ isEmailNotificationEnabled: boolean;
15
+ isTelegramNotificationEnabled: boolean;
16
+ isBanned: boolean;
17
+ isDeleted: boolean;
18
+ urlSlug?: string;
19
+ telegramId: string | null;
20
+ avatar?: string | null;
21
+ lastSeenAt: Date;
22
+ checkOnline(seconds: number): boolean;
23
+ get isOnline(): boolean;
24
+ get isOnlineRecently(): boolean;
25
+ }