mongodb-dynamic-api 4.10.0 → 4.12.0
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/CHANGELOG.md +20 -0
- package/package.json +1 -1
- package/src/gateways/base.gateway.d.ts +2 -2
- package/src/gateways/base.gateway.js +2 -3
- package/src/gateways/base.gateway.js.map +1 -1
- package/src/helpers/resolve-rooms.helper.d.ts +1 -1
- package/src/helpers/resolve-rooms.helper.js +2 -2
- package/src/helpers/resolve-rooms.helper.js.map +1 -1
- package/src/interfaces/dynamic-api-ability.interface.d.ts +1 -1
- package/src/interfaces/dynamic-api-broadcast-config.interface.d.ts +4 -4
- package/src/interfaces/dynamic-api-route-config.interface.d.ts +2 -2
- package/src/interfaces/dynamic-api-service-before-save-callback.interface.d.ts +21 -21
- package/src/modules/auth/auth.helper.d.ts +13 -3
- package/src/modules/auth/auth.helper.js +20 -6
- package/src/modules/auth/auth.helper.js.map +1 -1
- package/src/modules/auth/auth.module.js +24 -3
- package/src/modules/auth/auth.module.js.map +1 -1
- package/src/modules/auth/dtos/send-otp-code.dto.d.ts +3 -0
- package/src/modules/auth/dtos/send-otp-code.dto.js +24 -0
- package/src/modules/auth/dtos/send-otp-code.dto.js.map +1 -0
- package/src/modules/auth/dtos/verify-otp-code.dto.d.ts +4 -0
- package/src/modules/auth/dtos/verify-otp-code.dto.js +31 -0
- package/src/modules/auth/dtos/verify-otp-code.dto.js.map +1 -0
- package/src/modules/auth/guards/index.d.ts +1 -0
- package/src/modules/auth/guards/index.js +1 -0
- package/src/modules/auth/guards/index.js.map +1 -1
- package/src/modules/auth/guards/passwordless/passwordless.guard.d.ts +6 -0
- package/src/modules/auth/guards/passwordless/passwordless.guard.js +30 -0
- package/src/modules/auth/guards/passwordless/passwordless.guard.js.map +1 -0
- package/src/modules/auth/interfaces/auth-controller.interface.d.ts +7 -0
- package/src/modules/auth/interfaces/auth-options.interface.d.ts +8 -1
- package/src/modules/auth/interfaces/auth-service.interface.d.ts +2 -0
- package/src/modules/auth/mixins/auth-controller.mixin.d.ts +11 -2
- package/src/modules/auth/mixins/auth-controller.mixin.js +39 -1
- package/src/modules/auth/mixins/auth-controller.mixin.js.map +1 -1
- package/src/modules/auth/models/otp-code.model.d.ts +15 -0
- package/src/modules/auth/models/otp-code.model.js +38 -0
- package/src/modules/auth/models/otp-code.model.js.map +1 -0
- package/src/modules/auth/services/base-auth.service.d.ts +7 -2
- package/src/modules/auth/services/base-auth.service.js +38 -1
- package/src/modules/auth/services/base-auth.service.js.map +1 -1
- package/src/services/dynamic-api-broadcast/dynamic-api-broadcast.service.d.ts +2 -2
- package/src/services/dynamic-api-broadcast/dynamic-api-broadcast.service.js.map +1 -1
- package/src/version.json +1 -1
- package/test/for-feature/room-broadcast.e2e-spec.js +37 -0
- package/test/for-feature/room-broadcast.e2e-spec.js.map +1 -1
- package/test/for-feature/websockets.e2e-spec.js.map +1 -1
- package/test/for-root/auth-api-passwordless.e2e-spec.d.ts +1 -0
- package/test/for-root/auth-api-passwordless.e2e-spec.js +150 -0
- package/test/for-root/auth-api-passwordless.e2e-spec.js.map +1 -0
- package/test/shared/entities/index.d.ts +1 -0
- package/test/shared/entities/index.js +1 -0
- package/test/shared/entities/index.js.map +1 -1
- package/test/shared/entities/passwordless-user.factory.d.ts +12 -0
- package/test/shared/entities/passwordless-user.factory.js +31 -0
- package/test/shared/entities/passwordless-user.factory.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jwt_1 = require("@nestjs/jwt");
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const src_1 = require("../../src");
|
|
6
|
+
const e2e_setup_1 = require("../e2e.setup");
|
|
7
|
+
require("dotenv/config");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const shared_1 = require("../shared");
|
|
10
|
+
describe('DynamicApiModule forRoot - useAuth with passwordless options (e2e)', () => {
|
|
11
|
+
const User = (0, shared_1.createPasswordlessUserEntity)();
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
src_1.DynamicApiModule.state['resetState']();
|
|
14
|
+
});
|
|
15
|
+
afterEach(async () => {
|
|
16
|
+
await (0, e2e_setup_1.closeTestingApp)(mongoose_1.default.connections);
|
|
17
|
+
});
|
|
18
|
+
let model;
|
|
19
|
+
let app;
|
|
20
|
+
let capturedCode;
|
|
21
|
+
const sendCodeCallback = jest.fn();
|
|
22
|
+
const user = { email: 'passwordless@test.co' };
|
|
23
|
+
beforeEach(async () => {
|
|
24
|
+
capturedCode = undefined;
|
|
25
|
+
sendCodeCallback.mockReset();
|
|
26
|
+
sendCodeCallback.mockImplementation(async (_identifier, code) => {
|
|
27
|
+
capturedCode = code;
|
|
28
|
+
});
|
|
29
|
+
const fixtures = async (_) => {
|
|
30
|
+
model = await (0, utils_1.getModelFromEntity)(User);
|
|
31
|
+
await model.insertMany([user]);
|
|
32
|
+
};
|
|
33
|
+
app = await (0, shared_1.initModule)({
|
|
34
|
+
useAuth: {
|
|
35
|
+
userEntity: User,
|
|
36
|
+
passwordless: {
|
|
37
|
+
otpExpirationMinutes: 10,
|
|
38
|
+
sendCodeCallback,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}, fixtures);
|
|
42
|
+
});
|
|
43
|
+
describe('POST /auth/passwordless/send-code', () => {
|
|
44
|
+
it('should return 503 when passwordless is not enabled', async () => {
|
|
45
|
+
src_1.DynamicApiModule.state['resetState']();
|
|
46
|
+
await (0, e2e_setup_1.closeTestingApp)(mongoose_1.default.connections);
|
|
47
|
+
app = await (0, shared_1.initModule)({
|
|
48
|
+
useAuth: {
|
|
49
|
+
userEntity: User,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const { status } = await e2e_setup_1.server.post('/auth/passwordless/send-code', {
|
|
53
|
+
identifier: user.email,
|
|
54
|
+
});
|
|
55
|
+
expect(status).toBe(503);
|
|
56
|
+
});
|
|
57
|
+
it('should return 400 when identifier is missing', async () => {
|
|
58
|
+
const { status } = await e2e_setup_1.server.post('/auth/passwordless/send-code', {});
|
|
59
|
+
expect(status).toBe(400);
|
|
60
|
+
});
|
|
61
|
+
it('should return 204 and call sendCodeCallback with identifier and 6-digit code', async () => {
|
|
62
|
+
const { status } = await e2e_setup_1.server.post('/auth/passwordless/send-code', {
|
|
63
|
+
identifier: user.email,
|
|
64
|
+
});
|
|
65
|
+
expect(status).toBe(204);
|
|
66
|
+
expect(sendCodeCallback).toHaveBeenCalledTimes(1);
|
|
67
|
+
expect(sendCodeCallback).toHaveBeenCalledWith(user.email, expect.stringMatching(/^\d{6}$/));
|
|
68
|
+
expect(capturedCode).toMatch(/^\d{6}$/);
|
|
69
|
+
});
|
|
70
|
+
it('should replace existing OTP when send-code is called twice (upsert)', async () => {
|
|
71
|
+
await e2e_setup_1.server.post('/auth/passwordless/send-code', { identifier: user.email });
|
|
72
|
+
const firstCode = capturedCode;
|
|
73
|
+
await e2e_setup_1.server.post('/auth/passwordless/send-code', { identifier: user.email });
|
|
74
|
+
const secondCode = capturedCode;
|
|
75
|
+
expect(sendCodeCallback).toHaveBeenCalledTimes(2);
|
|
76
|
+
expect(firstCode).toMatch(/^\d{6}$/);
|
|
77
|
+
expect(secondCode).toMatch(/^\d{6}$/);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe('POST /auth/passwordless/verify-code', () => {
|
|
81
|
+
it('should return 503 when passwordless is not enabled', async () => {
|
|
82
|
+
src_1.DynamicApiModule.state['resetState']();
|
|
83
|
+
await (0, e2e_setup_1.closeTestingApp)(mongoose_1.default.connections);
|
|
84
|
+
app = await (0, shared_1.initModule)({
|
|
85
|
+
useAuth: {
|
|
86
|
+
userEntity: User,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
const { status } = await e2e_setup_1.server.post('/auth/passwordless/verify-code', {
|
|
90
|
+
identifier: user.email,
|
|
91
|
+
code: '123456',
|
|
92
|
+
});
|
|
93
|
+
expect(status).toBe(503);
|
|
94
|
+
});
|
|
95
|
+
it('should return 400 when body fields are missing', async () => {
|
|
96
|
+
const { status } = await e2e_setup_1.server.post('/auth/passwordless/verify-code', {});
|
|
97
|
+
expect(status).toBe(400);
|
|
98
|
+
});
|
|
99
|
+
it('should return 401 when no OTP has been sent', async () => {
|
|
100
|
+
const { status } = await e2e_setup_1.server.post('/auth/passwordless/verify-code', {
|
|
101
|
+
identifier: user.email,
|
|
102
|
+
code: '123456',
|
|
103
|
+
});
|
|
104
|
+
expect(status).toBe(401);
|
|
105
|
+
});
|
|
106
|
+
it('should return 401 when code is incorrect', async () => {
|
|
107
|
+
await e2e_setup_1.server.post('/auth/passwordless/send-code', { identifier: user.email });
|
|
108
|
+
const { status } = await e2e_setup_1.server.post('/auth/passwordless/verify-code', {
|
|
109
|
+
identifier: user.email,
|
|
110
|
+
code: '000000',
|
|
111
|
+
});
|
|
112
|
+
expect(status).toBe(401);
|
|
113
|
+
});
|
|
114
|
+
it('should return 200 with accessToken and refreshToken on valid code', async () => {
|
|
115
|
+
await e2e_setup_1.server.post('/auth/passwordless/send-code', { identifier: user.email });
|
|
116
|
+
const { status, body } = await e2e_setup_1.server.post('/auth/passwordless/verify-code', {
|
|
117
|
+
identifier: user.email,
|
|
118
|
+
code: capturedCode,
|
|
119
|
+
});
|
|
120
|
+
expect(status).toBe(200);
|
|
121
|
+
expect(body).toHaveProperty('accessToken');
|
|
122
|
+
expect(typeof body.accessToken).toBe('string');
|
|
123
|
+
});
|
|
124
|
+
it('should decode accessToken and contain user identifier', async () => {
|
|
125
|
+
await e2e_setup_1.server.post('/auth/passwordless/send-code', { identifier: user.email });
|
|
126
|
+
const { body } = await e2e_setup_1.server.post('/auth/passwordless/verify-code', {
|
|
127
|
+
identifier: user.email,
|
|
128
|
+
code: capturedCode,
|
|
129
|
+
});
|
|
130
|
+
src_1.DynamicApiModule.state['resetState']();
|
|
131
|
+
const jwtService = new jwt_1.JwtService({ secret: 'dynamic-api-jwt-secret' });
|
|
132
|
+
const decoded = jwtService.decode(body.accessToken);
|
|
133
|
+
expect(decoded).toHaveProperty('email', user.email);
|
|
134
|
+
});
|
|
135
|
+
it('should return 401 when same code is used twice (OTP deleted on first use)', async () => {
|
|
136
|
+
await e2e_setup_1.server.post('/auth/passwordless/send-code', { identifier: user.email });
|
|
137
|
+
const code = capturedCode;
|
|
138
|
+
await e2e_setup_1.server.post('/auth/passwordless/verify-code', {
|
|
139
|
+
identifier: user.email,
|
|
140
|
+
code,
|
|
141
|
+
});
|
|
142
|
+
const { status } = await e2e_setup_1.server.post('/auth/passwordless/verify-code', {
|
|
143
|
+
identifier: user.email,
|
|
144
|
+
code,
|
|
145
|
+
});
|
|
146
|
+
expect(status).toBe(401);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
//# sourceMappingURL=auth-api-passwordless.e2e-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-api-passwordless.e2e-spec.js","sourceRoot":"","sources":["../../../libs/dynamic-api/test/for-root/auth-api-passwordless.e2e-spec.ts"],"names":[],"mappings":";;AACA,qCAAyC;AACzC,uCAAgD;AAChD,mCAA6C;AAC7C,4CAAuD;AACvD,yBAAuB;AACvB,oCAA8C;AAC9C,sCAAqE;AAErE,QAAQ,CAAC,oEAAoE,EAAE,GAAG,EAAE;IAClF,MAAM,IAAI,GAAG,IAAA,qCAA4B,GAAE,CAAC;IAG5C,UAAU,CAAC,GAAG,EAAE;QACd,sBAAgB,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,IAAA,2BAAe,EAAC,kBAAQ,CAAC,WAAW,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,IAAI,KAA2B,CAAC;IAChC,IAAI,GAAqB,C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';
|
|
|
2
2
|
export * from './validated-user.factory';
|
|
3
3
|
export * from './register-user.factory';
|
|
4
4
|
export * from './login-user.factory';
|
|
5
|
+
export * from './passwordless-user.factory';
|
|
5
6
|
export * from './reset-password-user.factory';
|
|
6
7
|
export * from './broadcast-user.factory';
|
|
7
8
|
export * from './refresh-token-user.factory';
|
|
@@ -18,6 +18,7 @@ __exportStar(require("./basic-user.factory"), exports);
|
|
|
18
18
|
__exportStar(require("./validated-user.factory"), exports);
|
|
19
19
|
__exportStar(require("./register-user.factory"), exports);
|
|
20
20
|
__exportStar(require("./login-user.factory"), exports);
|
|
21
|
+
__exportStar(require("./passwordless-user.factory"), exports);
|
|
21
22
|
__exportStar(require("./reset-password-user.factory"), exports);
|
|
22
23
|
__exportStar(require("./broadcast-user.factory"), exports);
|
|
23
24
|
__exportStar(require("./refresh-token-user.factory"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/test/shared/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,2DAAyC;AACzC,0DAAwC;AACxC,uDAAqC;AACrC,gEAA8C;AAC9C,2DAAyC;AACzC,+DAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/test/shared/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,2DAAyC;AACzC,0DAAwC;AACxC,uDAAqC;AACrC,8DAA4C;AAC5C,gEAA8C;AAC9C,2DAAyC;AACzC,+DAA6C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function createPasswordlessUserEntity(): {
|
|
2
|
+
new (): {
|
|
3
|
+
email: string;
|
|
4
|
+
password?: string;
|
|
5
|
+
_id: import("mongoose").ObjectId;
|
|
6
|
+
__v: number;
|
|
7
|
+
id: string;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type PasswordlessUserEntityType = InstanceType<ReturnType<typeof createPasswordlessUserEntity>>;
|
|
@@ -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.createPasswordlessUserEntity = createPasswordlessUserEntity;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const src_1 = require("../../../src");
|
|
15
|
+
function createPasswordlessUserEntity() {
|
|
16
|
+
let PasswordlessUserEntity = class PasswordlessUserEntity extends src_1.BaseEntity {
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], PasswordlessUserEntity.prototype, "email", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, mongoose_1.Prop)({ type: String }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], PasswordlessUserEntity.prototype, "password", void 0);
|
|
26
|
+
PasswordlessUserEntity = __decorate([
|
|
27
|
+
(0, mongoose_1.Schema)({ collection: 'users' })
|
|
28
|
+
], PasswordlessUserEntity);
|
|
29
|
+
return PasswordlessUserEntity;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=passwordless-user.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passwordless-user.factory.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/test/shared/entities/passwordless-user.factory.ts"],"names":[],"mappings":";;;;;;;;;;;AAQA,oEAWC;AAnBD,+CAAgD;AAChD,sCAA0C;AAO1C,SAAgB,4BAA4B;IAE1C,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,gBAAU;KAM9C,CAAA;IAJC;QADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACzB;IAGd;QADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DACL;IALd,sBAAsB;QAD3B,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;OAC1B,sBAAsB,CAM3B;IAED,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|