@flusys/nestjs-form-builder 8.0.3 → 8.1.1
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/README.md +47 -6
- package/config/message-keys.d.ts +9 -0
- package/controllers/form-email-auth.controller.d.ts +11 -0
- package/controllers/form-result.controller.d.ts +6 -3
- package/controllers/form.controller.d.ts +5 -2
- package/controllers/index.d.ts +1 -0
- package/dtos/form-email-auth.dto.d.ts +20 -0
- package/dtos/form-result.dto.d.ts +2 -0
- package/dtos/form.dto.d.ts +3 -0
- package/dtos/index.d.ts +1 -0
- package/entities/form-email-verification.entity.d.ts +11 -0
- package/entities/form-result.entity.d.ts +1 -0
- package/entities/index.d.ts +4 -2
- package/enums/form-access-type.enum.d.ts +2 -1
- package/fesm/{262.js → 432.js} +561 -37
- package/fesm/{98.js → 720.js} +364 -36
- package/fesm/config/index.js +11 -2
- package/fesm/controllers/index.js +6 -5
- package/fesm/dtos/index.js +170 -4
- package/fesm/entities/index.js +136 -6
- package/fesm/enums/index.js +1 -0
- package/fesm/index.js +66 -21
- package/fesm/interfaces/index.js +23 -2
- package/fesm/modules/index.js +22 -12
- package/fesm/services/index.js +8 -4
- package/interfaces/form-builder-email-provider.interface.d.ts +4 -0
- package/interfaces/form-builder-module.interface.d.ts +3 -1
- package/interfaces/form-result.interface.d.ts +1 -0
- package/interfaces/index.d.ts +1 -0
- package/package.json +3 -3
- package/services/form-email-auth.service.d.ts +29 -0
- package/services/form-result.service.d.ts +10 -1
- package/services/form.service.d.ts +2 -0
- package/services/index.d.ts +1 -0
package/fesm/{98.js → 720.js}
RENAMED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { JwtAuthGuard, PermissionGuard } from "@flusys/nestjs-shared/guards";
|
|
2
|
-
|
|
3
|
-
export const
|
|
1
|
+
import { JwtAuthGuard, OptionalJwtGuard, PermissionGuard } from "@flusys/nestjs-shared/guards";
|
|
2
|
+
import { Throttle } from "@nestjs/throttler";
|
|
3
|
+
export const __rspack_esm_id = 720;
|
|
4
|
+
export const __rspack_esm_ids = [720];
|
|
4
5
|
export const __webpack_modules__ = {
|
|
5
|
-
|
|
6
|
+
971(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6
7
|
|
|
7
8
|
// EXPORTS
|
|
8
9
|
__webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
Xq: () => (/* reexport */ FormController),
|
|
11
|
+
Vh: () => (/* reexport */ FormEmailAuthController),
|
|
12
|
+
Ye: () => (/* reexport */ FormResultController)
|
|
11
13
|
});
|
|
12
14
|
|
|
13
15
|
// EXTERNAL MODULE: external "@flusys/nestjs-shared/classes"
|
|
@@ -22,10 +24,12 @@ var common_ = __webpack_require__(157);
|
|
|
22
24
|
var swagger_ = __webpack_require__(176);
|
|
23
25
|
// EXTERNAL MODULE: ./projects/nestjs-form-builder/src/config/message-keys.ts
|
|
24
26
|
var message_keys = __webpack_require__(137);
|
|
25
|
-
// EXTERNAL MODULE: ./projects/nestjs-form-builder/src/dtos/index.ts +
|
|
26
|
-
var dtos = __webpack_require__(
|
|
27
|
-
// EXTERNAL MODULE: ./projects/nestjs-form-builder/src/services/form.service.ts +
|
|
28
|
-
var
|
|
27
|
+
// EXTERNAL MODULE: ./projects/nestjs-form-builder/src/dtos/index.ts + 2 modules
|
|
28
|
+
var dtos = __webpack_require__(472);
|
|
29
|
+
// EXTERNAL MODULE: ./projects/nestjs-form-builder/src/services/form-email-auth.service.ts + 1 modules
|
|
30
|
+
var form_email_auth_service = __webpack_require__(474);
|
|
31
|
+
// EXTERNAL MODULE: ./projects/nestjs-form-builder/src/services/form.service.ts + 1 modules
|
|
32
|
+
var form_service = __webpack_require__(134);
|
|
29
33
|
;// CONCATENATED MODULE: ./projects/nestjs-form-builder/src/controllers/form.controller.ts
|
|
30
34
|
function _ts_decorate(decorators, target, key, desc) {
|
|
31
35
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -58,6 +62,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
58
62
|
|
|
59
63
|
|
|
60
64
|
|
|
65
|
+
|
|
61
66
|
class FormController extends (0,classes_.createApiController)(dtos/* .CreateFormDto */.YD, dtos/* .UpdateFormDto */.jQ, dtos/* .FormResponseDto */.bV, {
|
|
62
67
|
entityName: 'form',
|
|
63
68
|
security: {
|
|
@@ -106,13 +111,12 @@ class FormController extends (0,classes_.createApiController)(dtos/* .CreateForm
|
|
|
106
111
|
}
|
|
107
112
|
}) {
|
|
108
113
|
formService;
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
formEmailAuthService;
|
|
115
|
+
constructor(formService, formEmailAuthService){
|
|
116
|
+
super(formService), this.formService = formService, this.formEmailAuthService = formEmailAuthService;
|
|
111
117
|
}
|
|
112
118
|
// Public Endpoints
|
|
113
|
-
|
|
114
|
-
* Get form access info (no authentication required)
|
|
115
|
-
*/ async getFormAccessInfo(id) {
|
|
119
|
+
async getFormAccessInfo(id) {
|
|
116
120
|
const data = await this.formService.getFormAccessInfo(id);
|
|
117
121
|
return {
|
|
118
122
|
success: true,
|
|
@@ -139,6 +143,29 @@ class FormController extends (0,classes_.createApiController)(dtos/* .CreateForm
|
|
|
139
143
|
data
|
|
140
144
|
};
|
|
141
145
|
}
|
|
146
|
+
// OptionalJwtGuard: an already-logged-in visitor is auto-identified by their
|
|
147
|
+
// account email; an anonymous visitor must supply a verified access token.
|
|
148
|
+
async getEmailVerifiedForm(id, dto, user) {
|
|
149
|
+
const [form, email] = await Promise.all([
|
|
150
|
+
this.formService.getEmailVerifiedForm(id),
|
|
151
|
+
this.formEmailAuthService.resolveSubmitterEmail(id, user, dto.accessToken)
|
|
152
|
+
]);
|
|
153
|
+
if (!email) {
|
|
154
|
+
throw new common_.UnauthorizedException({
|
|
155
|
+
message: 'Email verification required to access this form',
|
|
156
|
+
messageKey: message_keys/* .FORM_MESSAGES.EMAIL_VERIFICATION_REQUIRED */.Q.EMAIL_VERIFICATION_REQUIRED
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
success: true,
|
|
161
|
+
message: 'Form retrieved',
|
|
162
|
+
messageKey: message_keys/* .FORM_MESSAGES.GET_SUCCESS */.Q.GET_SUCCESS,
|
|
163
|
+
data: {
|
|
164
|
+
...form,
|
|
165
|
+
verifiedEmail: email
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
142
169
|
async getBySlug(slug, _user) {
|
|
143
170
|
const data = await this.formService.getBySlug(slug);
|
|
144
171
|
return {
|
|
@@ -203,6 +230,25 @@ _ts_decorate([
|
|
|
203
230
|
]),
|
|
204
231
|
_ts_metadata("design:returntype", Promise)
|
|
205
232
|
], FormController.prototype, "getAuthenticatedForm", null);
|
|
233
|
+
_ts_decorate([
|
|
234
|
+
(0,common_.Post)('email-verified/:id'),
|
|
235
|
+
(0,common_.UseGuards)(OptionalJwtGuard),
|
|
236
|
+
(0,swagger_.ApiBearerAuth)(),
|
|
237
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
238
|
+
(0,swagger_.ApiOperation)({
|
|
239
|
+
summary: 'Get form for email-verified submission (optionally authenticated)'
|
|
240
|
+
}),
|
|
241
|
+
_ts_param(0, (0,common_.Param)('id')),
|
|
242
|
+
_ts_param(1, (0,common_.Body)()),
|
|
243
|
+
_ts_param(2, (0,decorators_.CurrentUser)()),
|
|
244
|
+
_ts_metadata("design:type", Function),
|
|
245
|
+
_ts_metadata("design:paramtypes", [
|
|
246
|
+
String,
|
|
247
|
+
typeof dtos/* .LoadEmailVerifiedFormDto */.gI === "undefined" ? Object : dtos/* .LoadEmailVerifiedFormDto */.gI,
|
|
248
|
+
Object
|
|
249
|
+
]),
|
|
250
|
+
_ts_metadata("design:returntype", Promise)
|
|
251
|
+
], FormController.prototype, "getEmailVerifiedForm", null);
|
|
206
252
|
_ts_decorate([
|
|
207
253
|
(0,common_.Post)('by-slug/:slug'),
|
|
208
254
|
(0,common_.UseGuards)(JwtAuthGuard, PermissionGuard),
|
|
@@ -239,9 +285,11 @@ FormController = _ts_decorate([
|
|
|
239
285
|
(0,swagger_.ApiTags)('Form Builder - Forms'),
|
|
240
286
|
(0,common_.Controller)('form-builder/form'),
|
|
241
287
|
_ts_param(0, (0,common_.Inject)(form_service/* .FormService */.u)),
|
|
288
|
+
_ts_param(1, (0,common_.Inject)(form_email_auth_service/* .FormEmailAuthService */.w)),
|
|
242
289
|
_ts_metadata("design:type", Function),
|
|
243
290
|
_ts_metadata("design:paramtypes", [
|
|
244
|
-
typeof form_service/* .FormService */.u === "undefined" ? Object : form_service/* .FormService */.u
|
|
291
|
+
typeof form_service/* .FormService */.u === "undefined" ? Object : form_service/* .FormService */.u,
|
|
292
|
+
typeof form_email_auth_service/* .FormEmailAuthService */.w === "undefined" ? Object : form_email_auth_service/* .FormEmailAuthService */.w
|
|
245
293
|
])
|
|
246
294
|
], FormController);
|
|
247
295
|
|
|
@@ -279,6 +327,7 @@ function form_result_controller_ts_param(paramIndex, decorator) {
|
|
|
279
327
|
|
|
280
328
|
|
|
281
329
|
|
|
330
|
+
|
|
282
331
|
class FormResultController extends (0,classes_.createApiController)(dtos/* .CreateFormResultDto */.pZ, dtos/* .UpdateFormResultDto */.Uj, dtos/* .FormResultResponseDto */._$, {
|
|
283
332
|
entityName: 'form.result',
|
|
284
333
|
security: {
|
|
@@ -327,13 +376,12 @@ class FormResultController extends (0,classes_.createApiController)(dtos/* .Crea
|
|
|
327
376
|
}
|
|
328
377
|
}) {
|
|
329
378
|
formResultService;
|
|
330
|
-
|
|
331
|
-
|
|
379
|
+
formEmailAuthService;
|
|
380
|
+
constructor(formResultService, formEmailAuthService){
|
|
381
|
+
super(formResultService), this.formResultService = formResultService, this.formEmailAuthService = formEmailAuthService;
|
|
332
382
|
}
|
|
333
383
|
// Submit Endpoints
|
|
334
|
-
|
|
335
|
-
* Submit form with authentication
|
|
336
|
-
*/ async submitForm(dto, user) {
|
|
384
|
+
async submitForm(dto, user) {
|
|
337
385
|
const data = await this.formResultService.submitForm(dto, user, false);
|
|
338
386
|
return {
|
|
339
387
|
success: true,
|
|
@@ -342,8 +390,8 @@ class FormResultController extends (0,classes_.createApiController)(dtos/* .Crea
|
|
|
342
390
|
data
|
|
343
391
|
};
|
|
344
392
|
}
|
|
345
|
-
async submitPublicForm(dto) {
|
|
346
|
-
const data = await this.formResultService.submitForm(dto, null, true);
|
|
393
|
+
async submitPublicForm(dto, user) {
|
|
394
|
+
const data = await this.formResultService.submitForm(dto, user ?? null, true);
|
|
347
395
|
return {
|
|
348
396
|
success: true,
|
|
349
397
|
message: 'Form submitted successfully',
|
|
@@ -371,9 +419,7 @@ class FormResultController extends (0,classes_.createApiController)(dtos/* .Crea
|
|
|
371
419
|
};
|
|
372
420
|
}
|
|
373
421
|
// Query Endpoints
|
|
374
|
-
|
|
375
|
-
* Get results by form ID with pagination
|
|
376
|
-
*/ async getByFormId(dto, user) {
|
|
422
|
+
async getByFormId(dto, user) {
|
|
377
423
|
const page = dto.page ?? 0;
|
|
378
424
|
const pageSize = dto.pageSize ?? 10;
|
|
379
425
|
const result = await this.formResultService.getByFormId(dto.formId, user, {
|
|
@@ -393,10 +439,7 @@ class FormResultController extends (0,classes_.createApiController)(dtos/* .Crea
|
|
|
393
439
|
}
|
|
394
440
|
};
|
|
395
441
|
}
|
|
396
|
-
|
|
397
|
-
* Check if current user has already submitted this form (non-draft)
|
|
398
|
-
* Used for single response mode
|
|
399
|
-
*/ async hasUserSubmitted(dto, user) {
|
|
442
|
+
async hasUserSubmitted(dto, user) {
|
|
400
443
|
const hasSubmitted = await this.formResultService.hasUserSubmitted(dto.formId, user);
|
|
401
444
|
return {
|
|
402
445
|
success: true,
|
|
@@ -405,6 +448,18 @@ class FormResultController extends (0,classes_.createApiController)(dtos/* .Crea
|
|
|
405
448
|
data: hasSubmitted
|
|
406
449
|
};
|
|
407
450
|
}
|
|
451
|
+
// Anonymous-path counterpart to has-submitted: resolves identity from an
|
|
452
|
+
// optional JWT or a verified email access token instead of requiring login.
|
|
453
|
+
async hasSubmittedEmail(dto, user) {
|
|
454
|
+
const email = await this.formEmailAuthService.resolveSubmitterEmail(dto.formId, user, dto.accessToken);
|
|
455
|
+
const hasSubmitted = email ? await this.formResultService.hasSubmittedByEmail(dto.formId, email) : false;
|
|
456
|
+
return {
|
|
457
|
+
success: true,
|
|
458
|
+
message: hasSubmitted ? 'Already submitted this form' : 'Not yet submitted this form',
|
|
459
|
+
messageKey: hasSubmitted ? message_keys/* .FORM_RESULT_MESSAGES.HAS_SUBMITTED_SUCCESS */.y.HAS_SUBMITTED_SUCCESS : message_keys/* .FORM_RESULT_MESSAGES.HAS_NOT_SUBMITTED_SUCCESS */.y.HAS_NOT_SUBMITTED_SUCCESS,
|
|
460
|
+
data: hasSubmitted
|
|
461
|
+
};
|
|
462
|
+
}
|
|
408
463
|
}
|
|
409
464
|
form_result_controller_ts_decorate([
|
|
410
465
|
(0,common_.Post)('submit'),
|
|
@@ -425,15 +480,18 @@ form_result_controller_ts_decorate([
|
|
|
425
480
|
], FormResultController.prototype, "submitForm", null);
|
|
426
481
|
form_result_controller_ts_decorate([
|
|
427
482
|
(0,common_.Post)('submit-public'),
|
|
428
|
-
(0,
|
|
483
|
+
(0,common_.UseGuards)(OptionalJwtGuard),
|
|
484
|
+
(0,swagger_.ApiBearerAuth)(),
|
|
429
485
|
(0,common_.HttpCode)(common_.HttpStatus.CREATED),
|
|
430
486
|
(0,swagger_.ApiOperation)({
|
|
431
|
-
summary: 'Submit public form (no auth required)'
|
|
487
|
+
summary: 'Submit public form (no auth required; EMAIL_VERIFIED forms resolve identity from an optional JWT or access token)'
|
|
432
488
|
}),
|
|
433
489
|
form_result_controller_ts_param(0, (0,common_.Body)()),
|
|
490
|
+
form_result_controller_ts_param(1, (0,decorators_.CurrentUser)()),
|
|
434
491
|
form_result_controller_ts_metadata("design:type", Function),
|
|
435
492
|
form_result_controller_ts_metadata("design:paramtypes", [
|
|
436
|
-
typeof dtos/* .SubmitFormDto */.sH === "undefined" ? Object : dtos/* .SubmitFormDto */.sH
|
|
493
|
+
typeof dtos/* .SubmitFormDto */.sH === "undefined" ? Object : dtos/* .SubmitFormDto */.sH,
|
|
494
|
+
Object
|
|
437
495
|
]),
|
|
438
496
|
form_result_controller_ts_metadata("design:returntype", Promise)
|
|
439
497
|
], FormResultController.prototype, "submitPublicForm", null);
|
|
@@ -506,38 +564,171 @@ form_result_controller_ts_decorate([
|
|
|
506
564
|
]),
|
|
507
565
|
form_result_controller_ts_metadata("design:returntype", Promise)
|
|
508
566
|
], FormResultController.prototype, "hasUserSubmitted", null);
|
|
567
|
+
form_result_controller_ts_decorate([
|
|
568
|
+
(0,common_.Post)('has-submitted-email'),
|
|
569
|
+
(0,common_.UseGuards)(OptionalJwtGuard),
|
|
570
|
+
(0,swagger_.ApiBearerAuth)(),
|
|
571
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
572
|
+
(0,swagger_.ApiOperation)({
|
|
573
|
+
summary: 'Check if the resolved email has already submitted this form'
|
|
574
|
+
}),
|
|
575
|
+
form_result_controller_ts_param(0, (0,common_.Body)()),
|
|
576
|
+
form_result_controller_ts_param(1, (0,decorators_.CurrentUser)()),
|
|
577
|
+
form_result_controller_ts_metadata("design:type", Function),
|
|
578
|
+
form_result_controller_ts_metadata("design:paramtypes", [
|
|
579
|
+
typeof dtos/* .HasSubmittedEmailDto */.BW === "undefined" ? Object : dtos/* .HasSubmittedEmailDto */.BW,
|
|
580
|
+
Object
|
|
581
|
+
]),
|
|
582
|
+
form_result_controller_ts_metadata("design:returntype", Promise)
|
|
583
|
+
], FormResultController.prototype, "hasSubmittedEmail", null);
|
|
509
584
|
FormResultController = form_result_controller_ts_decorate([
|
|
510
585
|
(0,swagger_.ApiTags)('Form Builder - Results'),
|
|
511
586
|
(0,common_.Controller)('form-builder/result'),
|
|
512
587
|
form_result_controller_ts_param(0, (0,common_.Inject)(form_result_service/* .FormResultService */.v)),
|
|
588
|
+
form_result_controller_ts_param(1, (0,common_.Inject)(form_email_auth_service/* .FormEmailAuthService */.w)),
|
|
513
589
|
form_result_controller_ts_metadata("design:type", Function),
|
|
514
590
|
form_result_controller_ts_metadata("design:paramtypes", [
|
|
515
|
-
typeof form_result_service/* .FormResultService */.v === "undefined" ? Object : form_result_service/* .FormResultService */.v
|
|
591
|
+
typeof form_result_service/* .FormResultService */.v === "undefined" ? Object : form_result_service/* .FormResultService */.v,
|
|
592
|
+
typeof form_email_auth_service/* .FormEmailAuthService */.w === "undefined" ? Object : form_email_auth_service/* .FormEmailAuthService */.w
|
|
516
593
|
])
|
|
517
594
|
], FormResultController);
|
|
518
595
|
|
|
596
|
+
;// CONCATENATED MODULE: external "@nestjs/throttler"
|
|
597
|
+
|
|
598
|
+
;// CONCATENATED MODULE: ./projects/nestjs-form-builder/src/controllers/form-email-auth.controller.ts
|
|
599
|
+
function form_email_auth_controller_ts_decorate(decorators, target, key, desc) {
|
|
600
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
601
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
602
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
603
|
+
} else {
|
|
604
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
605
|
+
if (d = decorators[i]) {
|
|
606
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
611
|
+
}
|
|
612
|
+
function form_email_auth_controller_ts_metadata(metadataKey, metadataValue) {
|
|
613
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
614
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function form_email_auth_controller_ts_param(paramIndex, decorator) {
|
|
618
|
+
return function(target, key) {
|
|
619
|
+
decorator(target, key, paramIndex);
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
class FormEmailAuthController {
|
|
631
|
+
formEmailAuthService;
|
|
632
|
+
formService;
|
|
633
|
+
constructor(formEmailAuthService, formService){
|
|
634
|
+
this.formEmailAuthService = formEmailAuthService;
|
|
635
|
+
this.formService = formService;
|
|
636
|
+
}
|
|
637
|
+
async requestOtp(dto) {
|
|
638
|
+
const form = await this.formService.getEmailVerifiedFormEntity(dto.formId);
|
|
639
|
+
return this.formEmailAuthService.requestOtp(dto.formId, dto.email, form.name);
|
|
640
|
+
}
|
|
641
|
+
async verifyOtp(dto) {
|
|
642
|
+
const data = await this.formEmailAuthService.verifyOtp(dto.formId, dto.email, dto.code);
|
|
643
|
+
return {
|
|
644
|
+
success: true,
|
|
645
|
+
message: 'Email verified successfully',
|
|
646
|
+
messageKey: message_keys/* .FORM_MESSAGES.OTP_VERIFIED */.Q.OTP_VERIFIED,
|
|
647
|
+
data
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
form_email_auth_controller_ts_decorate([
|
|
652
|
+
(0,common_.Post)('request-otp'),
|
|
653
|
+
(0,decorators_.Public)(),
|
|
654
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
655
|
+
Throttle({
|
|
656
|
+
default: {
|
|
657
|
+
limit: 3,
|
|
658
|
+
ttl: 300000
|
|
659
|
+
}
|
|
660
|
+
}),
|
|
661
|
+
(0,swagger_.ApiOperation)({
|
|
662
|
+
summary: 'Request an email verification code (no auth required)'
|
|
663
|
+
}),
|
|
664
|
+
form_email_auth_controller_ts_param(0, (0,common_.Body)()),
|
|
665
|
+
form_email_auth_controller_ts_metadata("design:type", Function),
|
|
666
|
+
form_email_auth_controller_ts_metadata("design:paramtypes", [
|
|
667
|
+
typeof dtos/* .RequestFormEmailOtpDto */.ME === "undefined" ? Object : dtos/* .RequestFormEmailOtpDto */.ME
|
|
668
|
+
]),
|
|
669
|
+
form_email_auth_controller_ts_metadata("design:returntype", Promise)
|
|
670
|
+
], FormEmailAuthController.prototype, "requestOtp", null);
|
|
671
|
+
form_email_auth_controller_ts_decorate([
|
|
672
|
+
(0,common_.Post)('verify-otp'),
|
|
673
|
+
(0,decorators_.Public)(),
|
|
674
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
675
|
+
Throttle({
|
|
676
|
+
default: {
|
|
677
|
+
limit: 10,
|
|
678
|
+
ttl: 60000
|
|
679
|
+
}
|
|
680
|
+
}),
|
|
681
|
+
(0,swagger_.ApiOperation)({
|
|
682
|
+
summary: 'Verify an email verification code (no auth required)'
|
|
683
|
+
}),
|
|
684
|
+
form_email_auth_controller_ts_param(0, (0,common_.Body)()),
|
|
685
|
+
form_email_auth_controller_ts_metadata("design:type", Function),
|
|
686
|
+
form_email_auth_controller_ts_metadata("design:paramtypes", [
|
|
687
|
+
typeof dtos/* .VerifyFormEmailOtpDto */.uY === "undefined" ? Object : dtos/* .VerifyFormEmailOtpDto */.uY
|
|
688
|
+
]),
|
|
689
|
+
form_email_auth_controller_ts_metadata("design:returntype", Promise)
|
|
690
|
+
], FormEmailAuthController.prototype, "verifyOtp", null);
|
|
691
|
+
FormEmailAuthController = form_email_auth_controller_ts_decorate([
|
|
692
|
+
(0,swagger_.ApiTags)('Form Builder - Email Auth'),
|
|
693
|
+
(0,common_.Controller)('form-builder/form-email-auth'),
|
|
694
|
+
form_email_auth_controller_ts_param(0, (0,common_.Inject)(form_email_auth_service/* .FormEmailAuthService */.w)),
|
|
695
|
+
form_email_auth_controller_ts_param(1, (0,common_.Inject)(form_service/* .FormService */.u)),
|
|
696
|
+
form_email_auth_controller_ts_metadata("design:type", Function),
|
|
697
|
+
form_email_auth_controller_ts_metadata("design:paramtypes", [
|
|
698
|
+
typeof form_email_auth_service/* .FormEmailAuthService */.w === "undefined" ? Object : form_email_auth_service/* .FormEmailAuthService */.w,
|
|
699
|
+
typeof form_service/* .FormService */.u === "undefined" ? Object : form_service/* .FormService */.u
|
|
700
|
+
])
|
|
701
|
+
], FormEmailAuthController);
|
|
702
|
+
|
|
519
703
|
;// CONCATENATED MODULE: ./projects/nestjs-form-builder/src/controllers/index.ts
|
|
520
704
|
|
|
521
705
|
|
|
522
706
|
|
|
523
707
|
|
|
708
|
+
|
|
524
709
|
},
|
|
525
|
-
|
|
710
|
+
472(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
526
711
|
|
|
527
712
|
// EXPORTS
|
|
528
713
|
__webpack_require__.d(__webpack_exports__, {
|
|
529
714
|
YD: () => (/* reexport */ CreateFormDto),
|
|
530
715
|
pZ: () => (/* reexport */ form_result_dto/* .CreateFormResultDto */.pZ),
|
|
716
|
+
d7: () => (/* reexport */ EmailVerifiedFormResponseDto),
|
|
531
717
|
Xe: () => (/* reexport */ FormAccessInfoResponseDto),
|
|
532
718
|
bV: () => (/* reexport */ FormResponseDto),
|
|
533
719
|
_$: () => (/* reexport */ form_result_dto/* .FormResultResponseDto */._$),
|
|
534
720
|
D5: () => (/* reexport */ form_result_dto/* .GetMyDraftDto */.D5),
|
|
535
721
|
rp: () => (/* reexport */ form_result_dto/* .GetResultsByFormDto */.rp),
|
|
722
|
+
BW: () => (/* reexport */ HasSubmittedEmailDto),
|
|
723
|
+
gI: () => (/* reexport */ LoadEmailVerifiedFormDto),
|
|
536
724
|
M4: () => (/* reexport */ PublicFormResponseDto),
|
|
725
|
+
ME: () => (/* reexport */ RequestFormEmailOtpDto),
|
|
537
726
|
sH: () => (/* reexport */ form_result_dto/* .SubmitFormDto */.sH),
|
|
538
727
|
CQ: () => (/* reexport */ form_result_dto/* .UpdateDraftDto */.CQ),
|
|
539
728
|
jQ: () => (/* reexport */ UpdateFormDto),
|
|
540
|
-
Uj: () => (/* reexport */ form_result_dto/* .UpdateFormResultDto */.Uj)
|
|
729
|
+
Uj: () => (/* reexport */ form_result_dto/* .UpdateFormResultDto */.Uj),
|
|
730
|
+
uY: () => (/* reexport */ VerifyFormEmailOtpDto),
|
|
731
|
+
TU: () => (/* reexport */ VerifyOtpResponseDto)
|
|
541
732
|
});
|
|
542
733
|
|
|
543
734
|
// EXTERNAL MODULE: external "@flusys/nestjs-shared/dtos"
|
|
@@ -794,14 +985,151 @@ class FormAccessInfoResponseDto extends (0,swagger_.PickType)(FormResponseDto, [
|
|
|
794
985
|
'isActive'
|
|
795
986
|
]) {
|
|
796
987
|
}
|
|
988
|
+
class EmailVerifiedFormResponseDto extends PublicFormResponseDto {
|
|
989
|
+
verifiedEmail;
|
|
990
|
+
}
|
|
991
|
+
_ts_decorate([
|
|
992
|
+
(0,external_class_transformer_.Expose)(),
|
|
993
|
+
(0,swagger_.ApiProperty)({
|
|
994
|
+
description: 'The verified email this form will be submitted as'
|
|
995
|
+
}),
|
|
996
|
+
_ts_metadata("design:type", String)
|
|
997
|
+
], EmailVerifiedFormResponseDto.prototype, "verifiedEmail", void 0);
|
|
797
998
|
|
|
798
999
|
// EXTERNAL MODULE: ./projects/nestjs-form-builder/src/dtos/form-result.dto.ts
|
|
799
1000
|
var form_result_dto = __webpack_require__(788);
|
|
1001
|
+
;// CONCATENATED MODULE: ./projects/nestjs-form-builder/src/dtos/form-email-auth.dto.ts
|
|
1002
|
+
function form_email_auth_dto_ts_decorate(decorators, target, key, desc) {
|
|
1003
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1004
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1005
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1006
|
+
} else {
|
|
1007
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
1008
|
+
if (d = decorators[i]) {
|
|
1009
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1014
|
+
}
|
|
1015
|
+
function form_email_auth_dto_ts_metadata(metadataKey, metadataValue) {
|
|
1016
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1017
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
class RequestFormEmailOtpDto {
|
|
1023
|
+
formId;
|
|
1024
|
+
email;
|
|
1025
|
+
}
|
|
1026
|
+
form_email_auth_dto_ts_decorate([
|
|
1027
|
+
(0,swagger_.ApiProperty)({
|
|
1028
|
+
description: 'Form ID to verify an email against',
|
|
1029
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
1030
|
+
}),
|
|
1031
|
+
(0,external_class_validator_.IsUUID)(),
|
|
1032
|
+
(0,external_class_validator_.IsNotEmpty)(),
|
|
1033
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1034
|
+
], RequestFormEmailOtpDto.prototype, "formId", void 0);
|
|
1035
|
+
form_email_auth_dto_ts_decorate([
|
|
1036
|
+
(0,swagger_.ApiProperty)({
|
|
1037
|
+
description: 'Email address to verify',
|
|
1038
|
+
example: 'visitor@example.com'
|
|
1039
|
+
}),
|
|
1040
|
+
(0,external_class_validator_.IsEmail)(),
|
|
1041
|
+
(0,external_class_validator_.IsNotEmpty)(),
|
|
1042
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1043
|
+
], RequestFormEmailOtpDto.prototype, "email", void 0);
|
|
1044
|
+
class VerifyFormEmailOtpDto {
|
|
1045
|
+
formId;
|
|
1046
|
+
email;
|
|
1047
|
+
code;
|
|
1048
|
+
}
|
|
1049
|
+
form_email_auth_dto_ts_decorate([
|
|
1050
|
+
(0,swagger_.ApiProperty)({
|
|
1051
|
+
description: 'Form ID to verify an email against',
|
|
1052
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
1053
|
+
}),
|
|
1054
|
+
(0,external_class_validator_.IsUUID)(),
|
|
1055
|
+
(0,external_class_validator_.IsNotEmpty)(),
|
|
1056
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1057
|
+
], VerifyFormEmailOtpDto.prototype, "formId", void 0);
|
|
1058
|
+
form_email_auth_dto_ts_decorate([
|
|
1059
|
+
(0,swagger_.ApiProperty)({
|
|
1060
|
+
description: 'Email address to verify',
|
|
1061
|
+
example: 'visitor@example.com'
|
|
1062
|
+
}),
|
|
1063
|
+
(0,external_class_validator_.IsEmail)(),
|
|
1064
|
+
(0,external_class_validator_.IsNotEmpty)(),
|
|
1065
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1066
|
+
], VerifyFormEmailOtpDto.prototype, "email", void 0);
|
|
1067
|
+
form_email_auth_dto_ts_decorate([
|
|
1068
|
+
(0,swagger_.ApiProperty)({
|
|
1069
|
+
description: '6-digit verification code',
|
|
1070
|
+
example: '482913'
|
|
1071
|
+
}),
|
|
1072
|
+
(0,external_class_validator_.IsString)(),
|
|
1073
|
+
(0,external_class_validator_.Length)(6, 6),
|
|
1074
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1075
|
+
], VerifyFormEmailOtpDto.prototype, "code", void 0);
|
|
1076
|
+
class VerifyOtpResponseDto {
|
|
1077
|
+
accessToken;
|
|
1078
|
+
expiresAt;
|
|
1079
|
+
}
|
|
1080
|
+
form_email_auth_dto_ts_decorate([
|
|
1081
|
+
(0,swagger_.ApiProperty)({
|
|
1082
|
+
description: 'Opaque access token identifying the verified email session'
|
|
1083
|
+
}),
|
|
1084
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1085
|
+
], VerifyOtpResponseDto.prototype, "accessToken", void 0);
|
|
1086
|
+
form_email_auth_dto_ts_decorate([
|
|
1087
|
+
(0,swagger_.ApiProperty)({
|
|
1088
|
+
description: 'Access token expiry (sliding on subsequent use)'
|
|
1089
|
+
}),
|
|
1090
|
+
form_email_auth_dto_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1091
|
+
], VerifyOtpResponseDto.prototype, "expiresAt", void 0);
|
|
1092
|
+
class LoadEmailVerifiedFormDto {
|
|
1093
|
+
accessToken;
|
|
1094
|
+
}
|
|
1095
|
+
form_email_auth_dto_ts_decorate([
|
|
1096
|
+
(0,swagger_.ApiProperty)({
|
|
1097
|
+
description: 'Access token from a prior email verification (omit if already logged in)',
|
|
1098
|
+
required: false
|
|
1099
|
+
}),
|
|
1100
|
+
(0,external_class_validator_.IsString)(),
|
|
1101
|
+
(0,external_class_validator_.IsOptional)(),
|
|
1102
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1103
|
+
], LoadEmailVerifiedFormDto.prototype, "accessToken", void 0);
|
|
1104
|
+
class HasSubmittedEmailDto {
|
|
1105
|
+
formId;
|
|
1106
|
+
accessToken;
|
|
1107
|
+
}
|
|
1108
|
+
form_email_auth_dto_ts_decorate([
|
|
1109
|
+
(0,swagger_.ApiProperty)({
|
|
1110
|
+
description: 'Form ID to check',
|
|
1111
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
1112
|
+
}),
|
|
1113
|
+
(0,external_class_validator_.IsUUID)(),
|
|
1114
|
+
(0,external_class_validator_.IsNotEmpty)(),
|
|
1115
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1116
|
+
], HasSubmittedEmailDto.prototype, "formId", void 0);
|
|
1117
|
+
form_email_auth_dto_ts_decorate([
|
|
1118
|
+
(0,swagger_.ApiProperty)({
|
|
1119
|
+
description: 'Access token from a prior email verification (omit if already logged in)',
|
|
1120
|
+
required: false
|
|
1121
|
+
}),
|
|
1122
|
+
(0,external_class_validator_.IsString)(),
|
|
1123
|
+
(0,external_class_validator_.IsOptional)(),
|
|
1124
|
+
form_email_auth_dto_ts_metadata("design:type", String)
|
|
1125
|
+
], HasSubmittedEmailDto.prototype, "accessToken", void 0);
|
|
1126
|
+
|
|
800
1127
|
;// CONCATENATED MODULE: ./projects/nestjs-form-builder/src/dtos/index.ts
|
|
801
1128
|
|
|
802
1129
|
|
|
803
1130
|
|
|
804
1131
|
|
|
1132
|
+
|
|
805
1133
|
},
|
|
806
1134
|
|
|
807
1135
|
};
|
package/fesm/config/index.js
CHANGED
|
@@ -63,7 +63,15 @@ const FORM_MESSAGES = {
|
|
|
63
63
|
INVALID_ACCESS_TYPE: 'form.invalid.access.type',
|
|
64
64
|
PERMISSION_CHECK_FAILED: 'form.permission.check.failed',
|
|
65
65
|
GET_SUCCESS: 'form.get.success',
|
|
66
|
-
GET_ACCESS_INFO_SUCCESS: 'form.get.access.info.success'
|
|
66
|
+
GET_ACCESS_INFO_SUCCESS: 'form.get.access.info.success',
|
|
67
|
+
EMAIL_NOT_CONFIGURED: 'form.email.not.configured',
|
|
68
|
+
EMAIL_VERIFICATION_REQUIRED: 'form.email.verification.required',
|
|
69
|
+
OTP_SENT: 'form.email.otp.sent',
|
|
70
|
+
OTP_SEND_FAILED: 'form.email.otp.send.failed',
|
|
71
|
+
OTP_INVALID: 'form.email.otp.invalid',
|
|
72
|
+
OTP_EXPIRED: 'form.email.otp.expired',
|
|
73
|
+
OTP_TOO_MANY_ATTEMPTS: 'form.email.otp.too.many.attempts',
|
|
74
|
+
OTP_VERIFIED: 'form.email.otp.verified'
|
|
67
75
|
};
|
|
68
76
|
const FORM_RESULT_MESSAGES = {
|
|
69
77
|
GET_ALL_SUCCESS: 'form.result.get.all.success',
|
|
@@ -72,7 +80,8 @@ const FORM_RESULT_MESSAGES = {
|
|
|
72
80
|
HAS_NOT_SUBMITTED_SUCCESS: 'form.result.has.not.submitted.success',
|
|
73
81
|
SUBMIT_SUCCESS: 'form.result.submit.success',
|
|
74
82
|
DRAFT_GET_SUCCESS: 'form.result.draft.get.success',
|
|
75
|
-
DRAFT_UPDATE_SUCCESS: 'form.result.draft.update.success'
|
|
83
|
+
DRAFT_UPDATE_SUCCESS: 'form.result.draft.update.success',
|
|
84
|
+
ALREADY_SUBMITTED: 'form.result.already.submitted'
|
|
76
85
|
};
|
|
77
86
|
|
|
78
87
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -3,12 +3,13 @@ export const __rspack_esm_ids = [24];
|
|
|
3
3
|
export const __webpack_modules__ = {};
|
|
4
4
|
import { __webpack_require__ } from '../runtime.js';
|
|
5
5
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
6
|
-
import * as __rspack_chunk_1 from '../
|
|
6
|
+
import * as __rspack_chunk_1 from '../432.js';
|
|
7
7
|
__webpack_require__.C(__rspack_chunk_1);
|
|
8
|
-
import * as __rspack_chunk_2 from '../
|
|
8
|
+
import * as __rspack_chunk_2 from '../720.js';
|
|
9
9
|
__webpack_require__.C(__rspack_chunk_2);
|
|
10
10
|
import * as __rspack_chunk_3 from './index.js';
|
|
11
11
|
__webpack_require__.C(__rspack_chunk_3);
|
|
12
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
13
|
-
var
|
|
14
|
-
|
|
12
|
+
var __webpack_exports__ = __webpack_exec__(971);var __webpack_exports__FormController = __webpack_exports__.Xq;
|
|
13
|
+
var __webpack_exports__FormEmailAuthController = __webpack_exports__.Vh;
|
|
14
|
+
var __webpack_exports__FormResultController = __webpack_exports__.Ye;
|
|
15
|
+
export { __webpack_exports__FormController as FormController, __webpack_exports__FormEmailAuthController as FormEmailAuthController, __webpack_exports__FormResultController as FormResultController };
|