@skroz/profile-api 1.0.13 → 1.0.14
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.
- package/dist/dto/{RegisterInput.d.ts → AuthInput.d.ts} +6 -2
- package/dist/dto/{RegisterInput.js → AuthInput.js} +13 -9
- package/dist/dto/SendTokenPayload.d.ts +1 -1
- package/dist/dto/SendTokenPayload.js +1 -1
- package/dist/dto/index.d.ts +1 -2
- package/dist/dto/index.js +6 -9
- package/dist/resolvers/AuthResolver.js +4 -4
- package/package.json +3 -3
- package/src/dto/{RegisterInput.ts → AuthInput.ts} +15 -7
- package/src/dto/SendTokenPayload.ts +2 -2
- package/src/dto/index.ts +6 -2
- package/src/resolvers/AuthResolver.ts +6 -12
- package/dist/dto/LoginInput.d.ts +0 -12
- package/dist/dto/LoginInput.js +0 -64
- package/src/dto/LoginInput.ts +0 -20
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import PasswordInput from './PasswordInput';
|
|
2
|
-
export default class
|
|
2
|
+
export default class AuthInput extends PasswordInput {
|
|
3
3
|
email: string;
|
|
4
4
|
isUserAgreementAgree?: boolean;
|
|
5
5
|
isPrivacyPolicyAgree?: boolean;
|
|
6
6
|
}
|
|
7
|
+
export declare const loginValidators: {
|
|
8
|
+
email: import("@os-team/graphql-validators").Validator[];
|
|
9
|
+
password: import("@os-team/graphql-validators").Validator[];
|
|
10
|
+
};
|
|
7
11
|
export declare const registerValidators: {
|
|
8
12
|
password: import("@os-team/graphql-validators").Validator[];
|
|
9
13
|
email: import("@os-team/graphql-validators").Validator[];
|
|
10
14
|
isUserAgreementAgree: import("@os-team/graphql-validators").Validator[];
|
|
11
15
|
isPrivacyPolicyAgree: import("@os-team/graphql-validators").Validator[];
|
|
12
16
|
};
|
|
13
|
-
export declare const
|
|
17
|
+
export declare const authTransformers: {
|
|
14
18
|
password: import("@os-team/graphql-transformers").Transformer[];
|
|
15
19
|
email: import("@os-team/graphql-transformers").Transformer[];
|
|
16
20
|
};
|
|
@@ -45,29 +45,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.
|
|
48
|
+
exports.authTransformers = exports.registerValidators = exports.loginValidators = void 0;
|
|
49
49
|
const type_graphql_1 = require("type-graphql");
|
|
50
50
|
const graphql_validators_1 = require("@os-team/graphql-validators");
|
|
51
51
|
const graphql_transformers_1 = require("@os-team/graphql-transformers");
|
|
52
52
|
const PasswordInput_1 = __importStar(require("./PasswordInput"));
|
|
53
53
|
const isTrue_1 = __importDefault(require("../validators/isTrue"));
|
|
54
|
-
let
|
|
54
|
+
let AuthInput = class AuthInput extends PasswordInput_1.default {
|
|
55
55
|
};
|
|
56
56
|
__decorate([
|
|
57
57
|
(0, type_graphql_1.Field)(),
|
|
58
58
|
__metadata("design:type", String)
|
|
59
|
-
],
|
|
59
|
+
], AuthInput.prototype, "email", void 0);
|
|
60
60
|
__decorate([
|
|
61
61
|
(0, type_graphql_1.Field)(() => Boolean, { nullable: true }),
|
|
62
62
|
__metadata("design:type", Boolean)
|
|
63
|
-
],
|
|
63
|
+
], AuthInput.prototype, "isUserAgreementAgree", void 0);
|
|
64
64
|
__decorate([
|
|
65
65
|
(0, type_graphql_1.Field)(() => Boolean, { nullable: true }),
|
|
66
66
|
__metadata("design:type", Boolean)
|
|
67
|
-
],
|
|
68
|
-
|
|
67
|
+
], AuthInput.prototype, "isPrivacyPolicyAgree", void 0);
|
|
68
|
+
AuthInput = __decorate([
|
|
69
69
|
(0, type_graphql_1.InputType)()
|
|
70
|
-
],
|
|
71
|
-
exports.default =
|
|
70
|
+
], AuthInput);
|
|
71
|
+
exports.default = AuthInput;
|
|
72
|
+
exports.loginValidators = {
|
|
73
|
+
email: [graphql_validators_1.isEmail],
|
|
74
|
+
password: [graphql_validators_1.isNotEmpty],
|
|
75
|
+
};
|
|
72
76
|
exports.registerValidators = Object.assign({ email: [graphql_validators_1.isEmail], isUserAgreementAgree: [isTrue_1.default], isPrivacyPolicyAgree: [isTrue_1.default] }, PasswordInput_1.passwordValidators);
|
|
73
|
-
exports.
|
|
77
|
+
exports.authTransformers = Object.assign({ email: [graphql_transformers_1.trim, graphql_transformers_1.toLowerCase] }, PasswordInput_1.passwordTransformers);
|
|
@@ -17,7 +17,7 @@ __decorate([
|
|
|
17
17
|
__metadata("design:type", Boolean)
|
|
18
18
|
], SendTokenPayload.prototype, "codeIsSent", void 0);
|
|
19
19
|
__decorate([
|
|
20
|
-
(0, type_graphql_1.Field)(() => Number
|
|
20
|
+
(0, type_graphql_1.Field)(() => Number),
|
|
21
21
|
__metadata("design:type", Number)
|
|
22
22
|
], SendTokenPayload.prototype, "limitExpiresAt", void 0);
|
|
23
23
|
SendTokenPayload = __decorate([
|
package/dist/dto/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as PasswordInput, passwordTransformers, passwordValidators } from './PasswordInput';
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as LoginInput, loginTransformers, loginValidators } from './LoginInput';
|
|
2
|
+
export { default as AuthInput, registerValidators, loginValidators, authTransformers, } from './AuthInput';
|
|
4
3
|
export { default as ForgotPasswordInput, forgotPasswordTransformers, forgotPasswordValidators } from './ForgotPasswordInput';
|
|
5
4
|
export { default as ConfirmEmailInput, confirmEmailValidators } from './ConfirmEmailInput';
|
|
6
5
|
export { default as StatusPayload } from './StatusPayload';
|
package/dist/dto/index.js
CHANGED
|
@@ -3,19 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.recoverPasswordValidators = exports.recoverPasswordTransformers = exports.RecoverPasswordInput = exports.sendTokenValidators = exports.sendTokenTransformers = exports.SendTokenInput = exports.updateProfileValidators = exports.updateProfileTransformers = exports.UpdateProfileInput = exports.updateEmailValidators = exports.updateEmailTransformers = exports.UpdateEmailInput = exports.updatePasswordValidators = exports.updatePasswordTransformers = exports.UpdatePasswordInput = exports.SendTokenPayload = exports.StatusPayload = exports.confirmEmailValidators = exports.ConfirmEmailInput = exports.forgotPasswordValidators = exports.forgotPasswordTransformers = exports.ForgotPasswordInput = exports.
|
|
6
|
+
exports.recoverPasswordValidators = exports.recoverPasswordTransformers = exports.RecoverPasswordInput = exports.sendTokenValidators = exports.sendTokenTransformers = exports.SendTokenInput = exports.updateProfileValidators = exports.updateProfileTransformers = exports.UpdateProfileInput = exports.updateEmailValidators = exports.updateEmailTransformers = exports.UpdateEmailInput = exports.updatePasswordValidators = exports.updatePasswordTransformers = exports.UpdatePasswordInput = exports.SendTokenPayload = exports.StatusPayload = exports.confirmEmailValidators = exports.ConfirmEmailInput = exports.forgotPasswordValidators = exports.forgotPasswordTransformers = exports.ForgotPasswordInput = exports.authTransformers = exports.loginValidators = exports.registerValidators = exports.AuthInput = exports.passwordValidators = exports.passwordTransformers = exports.PasswordInput = void 0;
|
|
7
7
|
var PasswordInput_1 = require("./PasswordInput");
|
|
8
8
|
Object.defineProperty(exports, "PasswordInput", { enumerable: true, get: function () { return __importDefault(PasswordInput_1).default; } });
|
|
9
9
|
Object.defineProperty(exports, "passwordTransformers", { enumerable: true, get: function () { return PasswordInput_1.passwordTransformers; } });
|
|
10
10
|
Object.defineProperty(exports, "passwordValidators", { enumerable: true, get: function () { return PasswordInput_1.passwordValidators; } });
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
Object.defineProperty(exports, "
|
|
14
|
-
Object.defineProperty(exports, "
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(exports, "LoginInput", { enumerable: true, get: function () { return __importDefault(LoginInput_1).default; } });
|
|
17
|
-
Object.defineProperty(exports, "loginTransformers", { enumerable: true, get: function () { return LoginInput_1.loginTransformers; } });
|
|
18
|
-
Object.defineProperty(exports, "loginValidators", { enumerable: true, get: function () { return LoginInput_1.loginValidators; } });
|
|
11
|
+
var AuthInput_1 = require("./AuthInput");
|
|
12
|
+
Object.defineProperty(exports, "AuthInput", { enumerable: true, get: function () { return __importDefault(AuthInput_1).default; } });
|
|
13
|
+
Object.defineProperty(exports, "registerValidators", { enumerable: true, get: function () { return AuthInput_1.registerValidators; } });
|
|
14
|
+
Object.defineProperty(exports, "loginValidators", { enumerable: true, get: function () { return AuthInput_1.loginValidators; } });
|
|
15
|
+
Object.defineProperty(exports, "authTransformers", { enumerable: true, get: function () { return AuthInput_1.authTransformers; } });
|
|
19
16
|
var ForgotPasswordInput_1 = require("./ForgotPasswordInput");
|
|
20
17
|
Object.defineProperty(exports, "ForgotPasswordInput", { enumerable: true, get: function () { return __importDefault(ForgotPasswordInput_1).default; } });
|
|
21
18
|
Object.defineProperty(exports, "forgotPasswordTransformers", { enumerable: true, get: function () { return ForgotPasswordInput_1.forgotPasswordTransformers; } });
|
|
@@ -166,23 +166,23 @@ function createAuthResolver(deps) {
|
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
__decorate([
|
|
169
|
-
(0, graphql_transformers_1.TransformArgs)(dto_1.
|
|
169
|
+
(0, graphql_transformers_1.TransformArgs)(dto_1.authTransformers, { arg: 'input' }),
|
|
170
170
|
(0, graphql_validators_1.ValidateArgs)(dto_1.registerValidators, { arg: 'input', tKey: 'register' }),
|
|
171
171
|
(0, type_graphql_1.Mutation)(() => userType),
|
|
172
172
|
__param(0, (0, type_graphql_1.Arg)('input')),
|
|
173
173
|
__param(1, (0, type_graphql_1.Ctx)()),
|
|
174
174
|
__metadata("design:type", Function),
|
|
175
|
-
__metadata("design:paramtypes", [dto_1.
|
|
175
|
+
__metadata("design:paramtypes", [dto_1.AuthInput, Object]),
|
|
176
176
|
__metadata("design:returntype", Promise)
|
|
177
177
|
], AuthResolver.prototype, "register", null);
|
|
178
178
|
__decorate([
|
|
179
|
-
(0, graphql_transformers_1.TransformArgs)(dto_1.
|
|
179
|
+
(0, graphql_transformers_1.TransformArgs)(dto_1.authTransformers, { arg: 'input' }),
|
|
180
180
|
(0, graphql_validators_1.ValidateArgs)(dto_1.loginValidators, { arg: 'input', tKey: 'register' }),
|
|
181
181
|
(0, type_graphql_1.Mutation)(() => graphql_utils_1.StatusPayload),
|
|
182
182
|
__param(0, (0, type_graphql_1.Arg)('input')),
|
|
183
183
|
__param(1, (0, type_graphql_1.Ctx)()),
|
|
184
184
|
__metadata("design:type", Function),
|
|
185
|
-
__metadata("design:paramtypes", [dto_1.
|
|
185
|
+
__metadata("design:paramtypes", [dto_1.AuthInput, Object]),
|
|
186
186
|
__metadata("design:returntype", Promise)
|
|
187
187
|
], AuthResolver.prototype, "login", null);
|
|
188
188
|
__decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skroz/profile-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "git@gitlab.com:skroz/libs/utils.git",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"!**/*.test.ts"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"clean": "
|
|
14
|
+
"clean": "rm -rf dist",
|
|
15
15
|
"build": "yarn clean && tsc --outDir dist && cp -R src/email-templates dist/email-templates",
|
|
16
16
|
"ncu": "ncu -u"
|
|
17
17
|
},
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"type-graphql": "^1.1.1",
|
|
44
44
|
"typeorm": "^0.2.45"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "f2cd3aab624bb4b31ac099f978526c14689a34a9"
|
|
47
47
|
}
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import { Field, InputType } from 'type-graphql';
|
|
2
|
-
import { isEmail } from '@os-team/graphql-validators';
|
|
2
|
+
import { isEmail, isNotEmpty } from '@os-team/graphql-validators';
|
|
3
3
|
import { toLowerCase, trim } from '@os-team/graphql-transformers';
|
|
4
|
-
import PasswordInput, {
|
|
4
|
+
import PasswordInput, {
|
|
5
|
+
passwordTransformers,
|
|
6
|
+
passwordValidators,
|
|
7
|
+
} from './PasswordInput';
|
|
5
8
|
import isTrue from '../validators/isTrue';
|
|
6
9
|
|
|
7
10
|
@InputType()
|
|
8
|
-
export default class
|
|
11
|
+
export default class AuthInput extends PasswordInput {
|
|
9
12
|
@Field()
|
|
10
|
-
email!: string;
|
|
13
|
+
public email!: string;
|
|
11
14
|
|
|
12
15
|
@Field(() => Boolean, { nullable: true })
|
|
13
|
-
isUserAgreementAgree?: boolean;
|
|
16
|
+
public isUserAgreementAgree?: boolean;
|
|
14
17
|
|
|
15
18
|
@Field(() => Boolean, { nullable: true })
|
|
16
|
-
isPrivacyPolicyAgree?: boolean;
|
|
19
|
+
public isPrivacyPolicyAgree?: boolean;
|
|
17
20
|
}
|
|
18
21
|
|
|
22
|
+
export const loginValidators = {
|
|
23
|
+
email: [isEmail],
|
|
24
|
+
password: [isNotEmpty],
|
|
25
|
+
};
|
|
26
|
+
|
|
19
27
|
export const registerValidators = {
|
|
20
28
|
email: [isEmail],
|
|
21
29
|
isUserAgreementAgree: [isTrue],
|
|
@@ -23,7 +31,7 @@ export const registerValidators = {
|
|
|
23
31
|
...passwordValidators,
|
|
24
32
|
};
|
|
25
33
|
|
|
26
|
-
export const
|
|
34
|
+
export const authTransformers = {
|
|
27
35
|
email: [trim, toLowerCase],
|
|
28
36
|
...passwordTransformers,
|
|
29
37
|
};
|
package/src/dto/index.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export { default as PasswordInput, passwordTransformers, passwordValidators } from './PasswordInput';
|
|
2
|
-
export {
|
|
3
|
-
|
|
2
|
+
export {
|
|
3
|
+
default as AuthInput,
|
|
4
|
+
registerValidators,
|
|
5
|
+
loginValidators,
|
|
6
|
+
authTransformers,
|
|
7
|
+
} from './AuthInput';
|
|
4
8
|
export { default as ForgotPasswordInput, forgotPasswordTransformers, forgotPasswordValidators } from './ForgotPasswordInput';
|
|
5
9
|
export { default as ConfirmEmailInput, confirmEmailValidators } from './ConfirmEmailInput';
|
|
6
10
|
export { default as StatusPayload } from './StatusPayload';
|
|
@@ -8,16 +8,11 @@ import {
|
|
|
8
8
|
} from '../services/ProfileAuthService';
|
|
9
9
|
import { ProfileContext } from '../types';
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
registerTransformers,
|
|
11
|
+
AuthInput,
|
|
13
12
|
registerValidators,
|
|
14
|
-
LoginInput,
|
|
15
|
-
loginTransformers,
|
|
16
13
|
loginValidators,
|
|
14
|
+
authTransformers,
|
|
17
15
|
ConfirmEmailInput,
|
|
18
|
-
ForgotPasswordInput,
|
|
19
|
-
forgotPasswordTransformers,
|
|
20
|
-
forgotPasswordValidators,
|
|
21
16
|
RecoverPasswordInput,
|
|
22
17
|
recoverPasswordTransformers,
|
|
23
18
|
recoverPasswordValidators,
|
|
@@ -62,10 +57,10 @@ export function createAuthResolver<
|
|
|
62
57
|
|
|
63
58
|
@Resolver(() => userType)
|
|
64
59
|
class AuthResolver {
|
|
65
|
-
@TransformArgs(
|
|
60
|
+
@TransformArgs(authTransformers, { arg: 'input' })
|
|
66
61
|
@ValidateArgs(registerValidators, { arg: 'input', tKey: 'register' })
|
|
67
62
|
@Mutation(() => userType)
|
|
68
|
-
async register(@Arg('input') input:
|
|
63
|
+
async register(@Arg('input') input: AuthInput, @Ctx() ctx: TContext) {
|
|
69
64
|
const { t } = ctx;
|
|
70
65
|
const service = getAuthService();
|
|
71
66
|
if (await service.db.isEmailTaken(input.email)) {
|
|
@@ -93,10 +88,10 @@ export function createAuthResolver<
|
|
|
93
88
|
return user;
|
|
94
89
|
}
|
|
95
90
|
|
|
96
|
-
@TransformArgs(
|
|
91
|
+
@TransformArgs(authTransformers, { arg: 'input' })
|
|
97
92
|
@ValidateArgs(loginValidators, { arg: 'input', tKey: 'register' })
|
|
98
93
|
@Mutation(() => StatusPayload)
|
|
99
|
-
async login(@Arg('input') input:
|
|
94
|
+
async login(@Arg('input') input: AuthInput, @Ctx() ctx: TContext) {
|
|
100
95
|
const { t } = ctx;
|
|
101
96
|
const service = getAuthService();
|
|
102
97
|
const user = await service.db.findUserByEmail(input.email);
|
|
@@ -182,7 +177,6 @@ export function createAuthResolver<
|
|
|
182
177
|
return user;
|
|
183
178
|
}
|
|
184
179
|
|
|
185
|
-
|
|
186
180
|
@TransformArgs(sendTokenTransformers, { arg: 'input' })
|
|
187
181
|
@ValidateArgs(sendTokenValidators, { arg: 'input', tKey: 'sendToken' })
|
|
188
182
|
@Mutation(() => SendTokenPayload)
|
package/dist/dto/LoginInput.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import PasswordInput from './PasswordInput';
|
|
2
|
-
export default 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
|
-
};
|
package/dist/dto/LoginInput.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
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;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.loginTransformers = exports.loginValidators = void 0;
|
|
46
|
-
const type_graphql_1 = require("type-graphql");
|
|
47
|
-
const graphql_validators_1 = require("@os-team/graphql-validators");
|
|
48
|
-
const graphql_transformers_1 = require("@os-team/graphql-transformers");
|
|
49
|
-
const PasswordInput_1 = __importStar(require("./PasswordInput"));
|
|
50
|
-
let LoginInput = class LoginInput extends PasswordInput_1.default {
|
|
51
|
-
};
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, type_graphql_1.Field)(),
|
|
54
|
-
__metadata("design:type", String)
|
|
55
|
-
], LoginInput.prototype, "email", void 0);
|
|
56
|
-
LoginInput = __decorate([
|
|
57
|
-
(0, type_graphql_1.InputType)()
|
|
58
|
-
], LoginInput);
|
|
59
|
-
exports.default = LoginInput;
|
|
60
|
-
exports.loginValidators = {
|
|
61
|
-
email: [graphql_validators_1.isEmail],
|
|
62
|
-
password: [graphql_validators_1.isNotEmpty],
|
|
63
|
-
};
|
|
64
|
-
exports.loginTransformers = Object.assign({ email: [graphql_transformers_1.trim, graphql_transformers_1.toLowerCase] }, PasswordInput_1.passwordTransformers);
|
package/src/dto/LoginInput.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Field, InputType } from 'type-graphql';
|
|
2
|
-
import { isEmail, isNotEmpty } from '@os-team/graphql-validators';
|
|
3
|
-
import { toLowerCase, trim } from '@os-team/graphql-transformers';
|
|
4
|
-
import PasswordInput, { passwordTransformers } from './PasswordInput';
|
|
5
|
-
|
|
6
|
-
@InputType()
|
|
7
|
-
export default class LoginInput extends PasswordInput {
|
|
8
|
-
@Field()
|
|
9
|
-
email!: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const loginValidators = {
|
|
13
|
-
email: [isEmail],
|
|
14
|
-
password: [isNotEmpty],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const loginTransformers = {
|
|
18
|
-
email: [trim, toLowerCase],
|
|
19
|
-
...passwordTransformers,
|
|
20
|
-
};
|