@flusys/nestjs-form-builder 9.1.0 → 9.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/config/message-keys.d.ts +1 -0
- package/dtos/form.dto.d.ts +5 -4
- package/entities/form.entity.d.ts +2 -1
- package/fesm/432.js +270 -302
- package/fesm/720.js +39 -17
- package/fesm/config/index.js +2 -1
- package/fesm/docs/index.js +1 -1
- package/fesm/dtos/index.js +47 -18
- package/fesm/entities/index.js +3 -3
- package/fesm/index.js +10 -6
- package/interfaces/form.interface.d.ts +2 -2
- package/package.json +5 -5
- package/services/form-result.service.d.ts +5 -3
- package/services/form.service.d.ts +7 -4
- package/utils/computed-field.utils.d.ts +13 -37
- package/utils/permission.utils.d.ts +3 -3
package/fesm/720.js
CHANGED
|
@@ -733,6 +733,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
733
733
|
|
|
734
734
|
// EXTERNAL MODULE: external "@flusys/nestjs-shared/dtos"
|
|
735
735
|
var dtos_ = __webpack_require__(873);
|
|
736
|
+
// EXTERNAL MODULE: external "@flusys/nestjs-shared/utils"
|
|
737
|
+
var utils_ = __webpack_require__(216);
|
|
736
738
|
// EXTERNAL MODULE: external "@nestjs/swagger"
|
|
737
739
|
var swagger_ = __webpack_require__(176);
|
|
738
740
|
// EXTERNAL MODULE: external "class-transformer"
|
|
@@ -765,13 +767,23 @@ function _ts_metadata(metadataKey, metadataValue) {
|
|
|
765
767
|
|
|
766
768
|
|
|
767
769
|
|
|
770
|
+
|
|
771
|
+
function IsPermissionLogic() {
|
|
772
|
+
return (0,external_class_validator_.ValidateBy)({
|
|
773
|
+
name: 'isPermissionLogic',
|
|
774
|
+
validator: {
|
|
775
|
+
validate: (value)=>(0,utils_.permissionLogicProblem)(value) === null,
|
|
776
|
+
defaultMessage: ()=>`$property must be a non-empty AND / OR permission rule with at most ${utils_.MAX_PERMISSION_LOGIC_CODES} permissions`
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
}
|
|
768
780
|
class CreateFormDto {
|
|
769
781
|
name;
|
|
770
782
|
description;
|
|
771
783
|
slug;
|
|
772
784
|
schema;
|
|
773
785
|
accessType;
|
|
774
|
-
|
|
786
|
+
permissionLogic;
|
|
775
787
|
tags;
|
|
776
788
|
companyId;
|
|
777
789
|
isActive;
|
|
@@ -833,20 +845,28 @@ _ts_decorate([
|
|
|
833
845
|
], CreateFormDto.prototype, "accessType", void 0);
|
|
834
846
|
_ts_decorate([
|
|
835
847
|
(0,swagger_.ApiProperty)({
|
|
836
|
-
description: '
|
|
837
|
-
example:
|
|
838
|
-
'
|
|
839
|
-
'
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
848
|
+
description: 'AND / OR permission rule a user must pass (only used when accessType is action_group)',
|
|
849
|
+
example: {
|
|
850
|
+
type: 'group',
|
|
851
|
+
operator: 'OR',
|
|
852
|
+
children: [
|
|
853
|
+
{
|
|
854
|
+
type: 'action',
|
|
855
|
+
actionId: 'hr.survey.submit'
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
type: 'action',
|
|
859
|
+
actionId: 'employee.feedback.submit'
|
|
860
|
+
}
|
|
861
|
+
]
|
|
862
|
+
},
|
|
863
|
+
required: false,
|
|
864
|
+
nullable: true
|
|
846
865
|
}),
|
|
866
|
+
IsPermissionLogic(),
|
|
847
867
|
(0,external_class_validator_.IsOptional)(),
|
|
848
|
-
_ts_metadata("design:type",
|
|
849
|
-
], CreateFormDto.prototype, "
|
|
868
|
+
_ts_metadata("design:type", Object)
|
|
869
|
+
], CreateFormDto.prototype, "permissionLogic", void 0);
|
|
850
870
|
_ts_decorate([
|
|
851
871
|
(0,swagger_.ApiProperty)({
|
|
852
872
|
description: 'Tags used by consuming modules to fetch this form (e.g. survey, review)',
|
|
@@ -911,7 +931,7 @@ class FormResponseDto extends dtos_.IdentityResponseDto {
|
|
|
911
931
|
schema;
|
|
912
932
|
schemaVersion;
|
|
913
933
|
accessType;
|
|
914
|
-
|
|
934
|
+
permissionLogic;
|
|
915
935
|
tags;
|
|
916
936
|
companyId;
|
|
917
937
|
isActive;
|
|
@@ -950,9 +970,11 @@ _ts_decorate([
|
|
|
950
970
|
], FormResponseDto.prototype, "accessType", void 0);
|
|
951
971
|
_ts_decorate([
|
|
952
972
|
(0,external_class_transformer_.Expose)(),
|
|
953
|
-
(0,swagger_.ApiProperty)(
|
|
973
|
+
(0,swagger_.ApiProperty)({
|
|
974
|
+
nullable: true
|
|
975
|
+
}),
|
|
954
976
|
_ts_metadata("design:type", Object)
|
|
955
|
-
], FormResponseDto.prototype, "
|
|
977
|
+
], FormResponseDto.prototype, "permissionLogic", void 0);
|
|
956
978
|
_ts_decorate([
|
|
957
979
|
(0,external_class_transformer_.Expose)(),
|
|
958
980
|
(0,swagger_.ApiProperty)(),
|
|
@@ -981,7 +1003,7 @@ class FormAccessInfoResponseDto extends (0,swagger_.PickType)(FormResponseDto, [
|
|
|
981
1003
|
'name',
|
|
982
1004
|
'description',
|
|
983
1005
|
'accessType',
|
|
984
|
-
'
|
|
1006
|
+
'permissionLogic',
|
|
985
1007
|
'isActive'
|
|
986
1008
|
]) {
|
|
987
1009
|
}
|
package/fesm/config/index.js
CHANGED
|
@@ -71,7 +71,8 @@ const FORM_MESSAGES = {
|
|
|
71
71
|
OTP_INVALID: 'form.email.otp.invalid',
|
|
72
72
|
OTP_EXPIRED: 'form.email.otp.expired',
|
|
73
73
|
OTP_TOO_MANY_ATTEMPTS: 'form.email.otp.too.many.attempts',
|
|
74
|
-
OTP_VERIFIED: 'form.email.otp.verified'
|
|
74
|
+
OTP_VERIFIED: 'form.email.otp.verified',
|
|
75
|
+
INVALID_COMPUTED_FIELD: 'form.invalid.computed.field'
|
|
75
76
|
};
|
|
76
77
|
const FORM_RESULT_MESSAGES = {
|
|
77
78
|
GET_ALL_SUCCESS: 'form.result.get.all.success',
|
package/fesm/docs/index.js
CHANGED
|
@@ -99,7 +99,7 @@ All queries automatically filter by current user's company context.
|
|
|
99
99
|
|
|
100
100
|
### Action Group Forms
|
|
101
101
|
- Permission-based access via IAM
|
|
102
|
-
- User must
|
|
102
|
+
- User must pass the form's \`permissionLogic\` AND / OR rule (an \`ILogicNode\` tree)
|
|
103
103
|
- Use \`/form-builder/form/authenticated/:id\` to get form
|
|
104
104
|
- Use \`/form-builder/result/submit\` to submit
|
|
105
105
|
|
package/fesm/dtos/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as __rspack_external__flusys_nestjs_shared_dtos_c4585026 from "@flusys/nestjs-shared/dtos";
|
|
2
|
+
import * as __rspack_external__flusys_nestjs_shared_utils_9125c1f1 from "@flusys/nestjs-shared/utils";
|
|
2
3
|
import * as __rspack_external__nestjs_swagger_7cd450b5 from "@nestjs/swagger";
|
|
3
4
|
import * as __rspack_external_class_transformer_c5a479fb from "class-transformer";
|
|
4
5
|
import * as __rspack_external_class_validator_7b99ef4d from "class-validator";
|
|
@@ -270,6 +271,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
270
271
|
|
|
271
272
|
// EXTERNAL MODULE: external "@flusys/nestjs-shared/dtos"
|
|
272
273
|
var dtos_ = __webpack_require__(873);
|
|
274
|
+
// EXTERNAL MODULE: external "@flusys/nestjs-shared/utils"
|
|
275
|
+
var utils_ = __webpack_require__(216);
|
|
273
276
|
// EXTERNAL MODULE: external "@nestjs/swagger"
|
|
274
277
|
var swagger_ = __webpack_require__(176);
|
|
275
278
|
// EXTERNAL MODULE: external "class-transformer"
|
|
@@ -302,13 +305,23 @@ function _ts_metadata(metadataKey, metadataValue) {
|
|
|
302
305
|
|
|
303
306
|
|
|
304
307
|
|
|
308
|
+
|
|
309
|
+
function IsPermissionLogic() {
|
|
310
|
+
return (0,external_class_validator_.ValidateBy)({
|
|
311
|
+
name: 'isPermissionLogic',
|
|
312
|
+
validator: {
|
|
313
|
+
validate: (value)=>(0,utils_.permissionLogicProblem)(value) === null,
|
|
314
|
+
defaultMessage: ()=>`$property must be a non-empty AND / OR permission rule with at most ${utils_.MAX_PERMISSION_LOGIC_CODES} permissions`
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
305
318
|
class CreateFormDto {
|
|
306
319
|
name;
|
|
307
320
|
description;
|
|
308
321
|
slug;
|
|
309
322
|
schema;
|
|
310
323
|
accessType;
|
|
311
|
-
|
|
324
|
+
permissionLogic;
|
|
312
325
|
tags;
|
|
313
326
|
companyId;
|
|
314
327
|
isActive;
|
|
@@ -370,20 +383,28 @@ _ts_decorate([
|
|
|
370
383
|
], CreateFormDto.prototype, "accessType", void 0);
|
|
371
384
|
_ts_decorate([
|
|
372
385
|
(0,swagger_.ApiProperty)({
|
|
373
|
-
description: '
|
|
374
|
-
example:
|
|
375
|
-
'
|
|
376
|
-
'
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
386
|
+
description: 'AND / OR permission rule a user must pass (only used when accessType is action_group)',
|
|
387
|
+
example: {
|
|
388
|
+
type: 'group',
|
|
389
|
+
operator: 'OR',
|
|
390
|
+
children: [
|
|
391
|
+
{
|
|
392
|
+
type: 'action',
|
|
393
|
+
actionId: 'hr.survey.submit'
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
type: 'action',
|
|
397
|
+
actionId: 'employee.feedback.submit'
|
|
398
|
+
}
|
|
399
|
+
]
|
|
400
|
+
},
|
|
401
|
+
required: false,
|
|
402
|
+
nullable: true
|
|
403
|
+
}),
|
|
404
|
+
IsPermissionLogic(),
|
|
384
405
|
(0,external_class_validator_.IsOptional)(),
|
|
385
|
-
_ts_metadata("design:type",
|
|
386
|
-
], CreateFormDto.prototype, "
|
|
406
|
+
_ts_metadata("design:type", Object)
|
|
407
|
+
], CreateFormDto.prototype, "permissionLogic", void 0);
|
|
387
408
|
_ts_decorate([
|
|
388
409
|
(0,swagger_.ApiProperty)({
|
|
389
410
|
description: 'Tags used by consuming modules to fetch this form (e.g. survey, review)',
|
|
@@ -448,7 +469,7 @@ class FormResponseDto extends dtos_.IdentityResponseDto {
|
|
|
448
469
|
schema;
|
|
449
470
|
schemaVersion;
|
|
450
471
|
accessType;
|
|
451
|
-
|
|
472
|
+
permissionLogic;
|
|
452
473
|
tags;
|
|
453
474
|
companyId;
|
|
454
475
|
isActive;
|
|
@@ -487,9 +508,11 @@ _ts_decorate([
|
|
|
487
508
|
], FormResponseDto.prototype, "accessType", void 0);
|
|
488
509
|
_ts_decorate([
|
|
489
510
|
(0,external_class_transformer_.Expose)(),
|
|
490
|
-
(0,swagger_.ApiProperty)(
|
|
511
|
+
(0,swagger_.ApiProperty)({
|
|
512
|
+
nullable: true
|
|
513
|
+
}),
|
|
491
514
|
_ts_metadata("design:type", Object)
|
|
492
|
-
], FormResponseDto.prototype, "
|
|
515
|
+
], FormResponseDto.prototype, "permissionLogic", void 0);
|
|
493
516
|
_ts_decorate([
|
|
494
517
|
(0,external_class_transformer_.Expose)(),
|
|
495
518
|
(0,swagger_.ApiProperty)(),
|
|
@@ -518,7 +541,7 @@ class FormAccessInfoResponseDto extends (0,swagger_.PickType)(FormResponseDto, [
|
|
|
518
541
|
'name',
|
|
519
542
|
'description',
|
|
520
543
|
'accessType',
|
|
521
|
-
'
|
|
544
|
+
'permissionLogic',
|
|
522
545
|
'isActive'
|
|
523
546
|
]) {
|
|
524
547
|
}
|
|
@@ -691,6 +714,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
691
714
|
module.exports = __rspack_external__flusys_nestjs_shared_dtos_c4585026;
|
|
692
715
|
|
|
693
716
|
|
|
717
|
+
},
|
|
718
|
+
216(module) {
|
|
719
|
+
|
|
720
|
+
module.exports = __rspack_external__flusys_nestjs_shared_utils_9125c1f1;
|
|
721
|
+
|
|
722
|
+
|
|
694
723
|
},
|
|
695
724
|
176(module) {
|
|
696
725
|
|
package/fesm/entities/index.js
CHANGED
|
@@ -56,7 +56,7 @@ class Form extends entities_Identity {
|
|
|
56
56
|
schema;
|
|
57
57
|
schemaVersion;
|
|
58
58
|
accessType;
|
|
59
|
-
|
|
59
|
+
permissionLogic;
|
|
60
60
|
tags;
|
|
61
61
|
isActive;
|
|
62
62
|
}
|
|
@@ -113,10 +113,10 @@ _ts_decorate([
|
|
|
113
113
|
(0,external_typeorm_.Column)({
|
|
114
114
|
type: getJsonColumnType(),
|
|
115
115
|
nullable: true,
|
|
116
|
-
name: '
|
|
116
|
+
name: 'permission_logic'
|
|
117
117
|
}),
|
|
118
118
|
_ts_metadata("design:type", Object)
|
|
119
|
-
], Form.prototype, "
|
|
119
|
+
], Form.prototype, "permissionLogic", void 0);
|
|
120
120
|
_ts_decorate([
|
|
121
121
|
(0,external_typeorm_.Column)({
|
|
122
122
|
type: getJsonColumnType(),
|
package/fesm/index.js
CHANGED
|
@@ -118,7 +118,7 @@ All queries automatically filter by current user's company context.
|
|
|
118
118
|
|
|
119
119
|
### Action Group Forms
|
|
120
120
|
- Permission-based access via IAM
|
|
121
|
-
- User must
|
|
121
|
+
- User must pass the form's \`permissionLogic\` AND / OR rule (an \`ILogicNode\` tree)
|
|
122
122
|
- Use \`/form-builder/form/authenticated/:id\` to get form
|
|
123
123
|
- Use \`/form-builder/result/submit\` to submit
|
|
124
124
|
|
|
@@ -194,6 +194,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
194
194
|
|
|
195
195
|
// EXPORTS
|
|
196
196
|
__webpack_require__.d(__webpack_exports__, {
|
|
197
|
+
xI: () => (/* reexport */ computed_field_utils/* .COMPUTED_REF_PREFIX */.xI),
|
|
197
198
|
YD: () => (/* reexport */ dtos/* .CreateFormDto */.YD),
|
|
198
199
|
pZ: () => (/* reexport */ dtos/* .CreateFormResultDto */.pZ),
|
|
199
200
|
d7: () => (/* reexport */ dtos/* .EmailVerifiedFormResponseDto */.d7),
|
|
@@ -236,10 +237,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
236
237
|
Uj: () => (/* reexport */ dtos/* .UpdateFormResultDto */.Uj),
|
|
237
238
|
uY: () => (/* reexport */ dtos/* .VerifyFormEmailOtpDto */.uY),
|
|
238
239
|
TU: () => (/* reexport */ dtos/* .VerifyOtpResponseDto */.TU),
|
|
239
|
-
XZ: () => (/* reexport */ computed_field_utils/* .calculateComputedFields */.
|
|
240
|
+
XZ: () => (/* reexport */ computed_field_utils/* .calculateComputedFields */.XZ),
|
|
241
|
+
Qc: () => (/* reexport */ computed_field_utils/* .findComputedFieldIssue */.Qc),
|
|
240
242
|
aY: () => (/* reexport */ docs/* .formBuilderSwaggerConfig */.a),
|
|
241
243
|
iO: () => (/* reexport */ entities.getFormBuilderEntitiesByConfig),
|
|
242
|
-
|
|
244
|
+
EY: () => (/* reexport */ permission_utils/* .hasFormPermission */.E)
|
|
243
245
|
});
|
|
244
246
|
|
|
245
247
|
// EXTERNAL MODULE: ./projects/nestjs-form-builder/src/config/index.ts
|
|
@@ -488,7 +490,8 @@ import * as __rspack_chunk_2 from './720.js';
|
|
|
488
490
|
__webpack_require__.C(__rspack_chunk_2);
|
|
489
491
|
import * as __rspack_chunk_3 from './index.js';
|
|
490
492
|
__webpack_require__.C(__rspack_chunk_3);
|
|
491
|
-
var __webpack_exports__ = __webpack_exec__(851);var
|
|
493
|
+
var __webpack_exports__ = __webpack_exec__(851);var __webpack_exports__COMPUTED_REF_PREFIX = __webpack_exports__.xI;
|
|
494
|
+
var __webpack_exports__CreateFormDto = __webpack_exports__.YD;
|
|
492
495
|
var __webpack_exports__CreateFormResultDto = __webpack_exports__.pZ;
|
|
493
496
|
var __webpack_exports__EmailVerifiedFormResponseDto = __webpack_exports__.d7;
|
|
494
497
|
var __webpack_exports__FORM_BUILDER_EMAIL_PROVIDER = __webpack_exports__.Q3;
|
|
@@ -531,7 +534,8 @@ var __webpack_exports__UpdateFormResultDto = __webpack_exports__.Uj;
|
|
|
531
534
|
var __webpack_exports__VerifyFormEmailOtpDto = __webpack_exports__.uY;
|
|
532
535
|
var __webpack_exports__VerifyOtpResponseDto = __webpack_exports__.TU;
|
|
533
536
|
var __webpack_exports__calculateComputedFields = __webpack_exports__.XZ;
|
|
537
|
+
var __webpack_exports__findComputedFieldIssue = __webpack_exports__.Qc;
|
|
534
538
|
var __webpack_exports__formBuilderSwaggerConfig = __webpack_exports__.aY;
|
|
535
539
|
var __webpack_exports__getFormBuilderEntitiesByConfig = __webpack_exports__.iO;
|
|
536
|
-
var
|
|
537
|
-
export { __webpack_exports__CreateFormDto as CreateFormDto, __webpack_exports__CreateFormResultDto as CreateFormResultDto, __webpack_exports__EmailVerifiedFormResponseDto as EmailVerifiedFormResponseDto, __webpack_exports__FORM_BUILDER_EMAIL_PROVIDER as FORM_BUILDER_EMAIL_PROVIDER, __webpack_exports__FORM_BUILDER_EVENT_ACTIONS as FORM_BUILDER_EVENT_ACTIONS, __webpack_exports__FORM_BUILDER_EVENT_ENTITIES as FORM_BUILDER_EVENT_ENTITIES, __webpack_exports__FORM_BUILDER_EVENT_MODULE as FORM_BUILDER_EVENT_MODULE, __webpack_exports__FORM_BUILDER_MODULE_OPTIONS as FORM_BUILDER_MODULE_OPTIONS, __webpack_exports__FORM_MESSAGES as FORM_MESSAGES, __webpack_exports__FORM_RESULT_MESSAGES as FORM_RESULT_MESSAGES, __webpack_exports__Form as Form, __webpack_exports__FormAccessInfoResponseDto as FormAccessInfoResponseDto, __webpack_exports__FormAccessType as FormAccessType, __webpack_exports__FormBase as FormBase, __webpack_exports__FormBuilderConfigService as FormBuilderConfigService, __webpack_exports__FormBuilderDataSourceProvider as FormBuilderDataSourceProvider, __webpack_exports__FormBuilderModule as FormBuilderModule, __webpack_exports__FormCompanyEntities as FormCompanyEntities, __webpack_exports__FormController as FormController, __webpack_exports__FormCoreEntities as FormCoreEntities, __webpack_exports__FormEmailAuthController as FormEmailAuthController, __webpack_exports__FormEmailAuthService as FormEmailAuthService, __webpack_exports__FormEmailVerification as FormEmailVerification, __webpack_exports__FormResponseDto as FormResponseDto, __webpack_exports__FormResult as FormResult, __webpack_exports__FormResultController as FormResultController, __webpack_exports__FormResultResponseDto as FormResultResponseDto, __webpack_exports__FormResultService as FormResultService, __webpack_exports__FormService as FormService, __webpack_exports__FormWithCompany as FormWithCompany, __webpack_exports__GetMyDraftDto as GetMyDraftDto, __webpack_exports__GetResultsByFormDto as GetResultsByFormDto, __webpack_exports__HasSubmittedEmailDto as HasSubmittedEmailDto, __webpack_exports__LoadEmailVerifiedFormDto as LoadEmailVerifiedFormDto, __webpack_exports__PublicFormResponseDto as PublicFormResponseDto, __webpack_exports__RequestFormEmailOtpDto as RequestFormEmailOtpDto, __webpack_exports__SubmitFormDto as SubmitFormDto, __webpack_exports__UpdateDraftDto as UpdateDraftDto, __webpack_exports__UpdateFormDto as UpdateFormDto, __webpack_exports__UpdateFormResultDto as UpdateFormResultDto, __webpack_exports__VerifyFormEmailOtpDto as VerifyFormEmailOtpDto, __webpack_exports__VerifyOtpResponseDto as VerifyOtpResponseDto, __webpack_exports__calculateComputedFields as calculateComputedFields, __webpack_exports__formBuilderSwaggerConfig as formBuilderSwaggerConfig, __webpack_exports__getFormBuilderEntitiesByConfig as getFormBuilderEntitiesByConfig,
|
|
540
|
+
var __webpack_exports__hasFormPermission = __webpack_exports__.EY;
|
|
541
|
+
export { __webpack_exports__COMPUTED_REF_PREFIX as COMPUTED_REF_PREFIX, __webpack_exports__CreateFormDto as CreateFormDto, __webpack_exports__CreateFormResultDto as CreateFormResultDto, __webpack_exports__EmailVerifiedFormResponseDto as EmailVerifiedFormResponseDto, __webpack_exports__FORM_BUILDER_EMAIL_PROVIDER as FORM_BUILDER_EMAIL_PROVIDER, __webpack_exports__FORM_BUILDER_EVENT_ACTIONS as FORM_BUILDER_EVENT_ACTIONS, __webpack_exports__FORM_BUILDER_EVENT_ENTITIES as FORM_BUILDER_EVENT_ENTITIES, __webpack_exports__FORM_BUILDER_EVENT_MODULE as FORM_BUILDER_EVENT_MODULE, __webpack_exports__FORM_BUILDER_MODULE_OPTIONS as FORM_BUILDER_MODULE_OPTIONS, __webpack_exports__FORM_MESSAGES as FORM_MESSAGES, __webpack_exports__FORM_RESULT_MESSAGES as FORM_RESULT_MESSAGES, __webpack_exports__Form as Form, __webpack_exports__FormAccessInfoResponseDto as FormAccessInfoResponseDto, __webpack_exports__FormAccessType as FormAccessType, __webpack_exports__FormBase as FormBase, __webpack_exports__FormBuilderConfigService as FormBuilderConfigService, __webpack_exports__FormBuilderDataSourceProvider as FormBuilderDataSourceProvider, __webpack_exports__FormBuilderModule as FormBuilderModule, __webpack_exports__FormCompanyEntities as FormCompanyEntities, __webpack_exports__FormController as FormController, __webpack_exports__FormCoreEntities as FormCoreEntities, __webpack_exports__FormEmailAuthController as FormEmailAuthController, __webpack_exports__FormEmailAuthService as FormEmailAuthService, __webpack_exports__FormEmailVerification as FormEmailVerification, __webpack_exports__FormResponseDto as FormResponseDto, __webpack_exports__FormResult as FormResult, __webpack_exports__FormResultController as FormResultController, __webpack_exports__FormResultResponseDto as FormResultResponseDto, __webpack_exports__FormResultService as FormResultService, __webpack_exports__FormService as FormService, __webpack_exports__FormWithCompany as FormWithCompany, __webpack_exports__GetMyDraftDto as GetMyDraftDto, __webpack_exports__GetResultsByFormDto as GetResultsByFormDto, __webpack_exports__HasSubmittedEmailDto as HasSubmittedEmailDto, __webpack_exports__LoadEmailVerifiedFormDto as LoadEmailVerifiedFormDto, __webpack_exports__PublicFormResponseDto as PublicFormResponseDto, __webpack_exports__RequestFormEmailOtpDto as RequestFormEmailOtpDto, __webpack_exports__SubmitFormDto as SubmitFormDto, __webpack_exports__UpdateDraftDto as UpdateDraftDto, __webpack_exports__UpdateFormDto as UpdateFormDto, __webpack_exports__UpdateFormResultDto as UpdateFormResultDto, __webpack_exports__VerifyFormEmailOtpDto as VerifyFormEmailOtpDto, __webpack_exports__VerifyOtpResponseDto as VerifyOtpResponseDto, __webpack_exports__calculateComputedFields as calculateComputedFields, __webpack_exports__findComputedFieldIssue as findComputedFieldIssue, __webpack_exports__formBuilderSwaggerConfig as formBuilderSwaggerConfig, __webpack_exports__getFormBuilderEntitiesByConfig as getFormBuilderEntitiesByConfig, __webpack_exports__hasFormPermission as hasFormPermission };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IIdentity } from '@flusys/nestjs-shared/interfaces';
|
|
1
|
+
import { type IIdentity, type ILogicNode } from '@flusys/nestjs-shared/interfaces';
|
|
2
2
|
import { FormAccessType } from '../enums/form-access-type.enum.js';
|
|
3
3
|
export interface IForm extends IIdentity {
|
|
4
4
|
name: string;
|
|
@@ -7,7 +7,7 @@ export interface IForm extends IIdentity {
|
|
|
7
7
|
schema: Record<string, unknown>;
|
|
8
8
|
schemaVersion: number;
|
|
9
9
|
accessType: FormAccessType;
|
|
10
|
-
|
|
10
|
+
permissionLogic: ILogicNode | null;
|
|
11
11
|
tags: string[] | null;
|
|
12
12
|
isActive: boolean;
|
|
13
13
|
companyId: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-form-builder",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.2",
|
|
4
4
|
"description": "Dynamic form builder module with schema versioning and access control",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./fesm/index.js",
|
|
@@ -65,17 +65,17 @@
|
|
|
65
65
|
"@nestjs/common": "^12.0.0",
|
|
66
66
|
"@nestjs/config": "^12.0.0",
|
|
67
67
|
"@nestjs/core": "^12.0.0",
|
|
68
|
-
"@nestjs/platform-express": "^12.
|
|
68
|
+
"@nestjs/platform-express": "^12.1.2",
|
|
69
69
|
"@nestjs/swagger": "^12.0.0",
|
|
70
70
|
"@nestjs/throttler": "^6.5.0",
|
|
71
71
|
"@nestjs/typeorm": "^12.0.0",
|
|
72
72
|
"class-transformer": "^0.5.1",
|
|
73
73
|
"class-validator": "^0.15.0",
|
|
74
|
-
"typeorm": "^0.3.
|
|
74
|
+
"typeorm": "^0.3.31",
|
|
75
75
|
"express": "^5.0.0"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@flusys/nestjs-core": "9.1.
|
|
79
|
-
"@flusys/nestjs-shared": "9.1.
|
|
78
|
+
"@flusys/nestjs-core": "9.1.2",
|
|
79
|
+
"@flusys/nestjs-shared": "9.1.2"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
|
|
2
2
|
import { FilterAndPaginationDto } from '@flusys/nestjs-shared/dtos';
|
|
3
|
-
import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
4
|
-
import { UtilsService } from '@flusys/nestjs-shared/modules';
|
|
3
|
+
import { type ILoggedUserInfo, type IPermissionResolver } from '@flusys/nestjs-shared/interfaces';
|
|
4
|
+
import { SharedPermissionCacheService, UtilsService } from '@flusys/nestjs-shared/modules';
|
|
5
5
|
import { SelectQueryBuilder } from 'typeorm';
|
|
6
6
|
import { CreateFormResultDto, SubmitFormDto, UpdateFormResultDto } from '../dtos/form-result.dto.js';
|
|
7
7
|
import { FormResult } from '../entities/index.js';
|
|
@@ -15,9 +15,11 @@ export declare class FormResultService extends ApiService<CreateFormResultDto, U
|
|
|
15
15
|
private readonly formBuilderConfig;
|
|
16
16
|
private readonly dataSourceProvider;
|
|
17
17
|
private readonly formEmailAuthService;
|
|
18
|
+
private readonly permissionResolver?;
|
|
19
|
+
private readonly permissionCache?;
|
|
18
20
|
private formRepository;
|
|
19
21
|
private static readonly submissionLocks;
|
|
20
|
-
constructor(cacheManager: HybridCache, utilsService: UtilsService, formBuilderConfig: FormBuilderConfigService, dataSourceProvider: FormBuilderDataSourceProvider, formEmailAuthService: FormEmailAuthService);
|
|
22
|
+
constructor(cacheManager: HybridCache, utilsService: UtilsService, formBuilderConfig: FormBuilderConfigService, dataSourceProvider: FormBuilderDataSourceProvider, formEmailAuthService: FormEmailAuthService, permissionResolver?: IPermissionResolver | undefined, permissionCache?: SharedPermissionCacheService | undefined);
|
|
21
23
|
private ensureFormRepositoryInitialized;
|
|
22
24
|
private withSubmissionLock;
|
|
23
25
|
private getActiveForm;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
|
|
2
2
|
import { FilterAndPaginationDto } from '@flusys/nestjs-shared/dtos';
|
|
3
|
-
import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
4
|
-
import { UtilsService } from '@flusys/nestjs-shared/modules';
|
|
3
|
+
import { type ILoggedUserInfo, type ILogicNode, type IPermissionResolver } from '@flusys/nestjs-shared/interfaces';
|
|
4
|
+
import { SharedPermissionCacheService, UtilsService } from '@flusys/nestjs-shared/modules';
|
|
5
5
|
import { SelectQueryBuilder } from 'typeorm';
|
|
6
6
|
import { CreateFormDto, UpdateFormDto } from '../dtos/form.dto.js';
|
|
7
7
|
import { Form } from '../entities/index.js';
|
|
@@ -13,8 +13,11 @@ export declare class FormService extends ApiService<CreateFormDto, UpdateFormDto
|
|
|
13
13
|
protected cacheManager: HybridCache;
|
|
14
14
|
protected utilsService: UtilsService;
|
|
15
15
|
private readonly formBuilderConfig;
|
|
16
|
-
|
|
16
|
+
private readonly permissionResolver?;
|
|
17
|
+
private readonly permissionCache?;
|
|
18
|
+
constructor(cacheManager: HybridCache, utilsService: UtilsService, formBuilderConfig: FormBuilderConfigService, dataSourceProvider: FormBuilderDataSourceProvider, permissionResolver?: IPermissionResolver | undefined, permissionCache?: SharedPermissionCacheService | undefined);
|
|
17
19
|
convertSingleDtoToEntity(dto: CreateFormDto | UpdateFormDto, user: ILoggedUserInfo | null): Promise<Form>;
|
|
20
|
+
private assertValidComputedFields;
|
|
18
21
|
getSelectQuery(query: SelectQueryBuilder<Form>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
|
|
19
22
|
query: SelectQueryBuilder<Form>;
|
|
20
23
|
isRaw: boolean;
|
|
@@ -40,7 +43,7 @@ export declare class FormService extends ApiService<CreateFormDto, UpdateFormDto
|
|
|
40
43
|
name: string;
|
|
41
44
|
description: string | null;
|
|
42
45
|
accessType: FormAccessType;
|
|
43
|
-
|
|
46
|
+
permissionLogic: ILogicNode | null;
|
|
44
47
|
isActive: boolean;
|
|
45
48
|
}>;
|
|
46
49
|
getEmailVerifiedFormEntity(formId: string): Promise<Form>;
|
|
@@ -1,48 +1,24 @@
|
|
|
1
|
+
import type { Expression, IExpressionConditionGroup } from '@flusys/nestjs-shared/interfaces';
|
|
2
|
+
export type ComputedValueType = 'string' | 'number' | 'boolean';
|
|
1
3
|
export interface IComputedField {
|
|
2
4
|
id: string;
|
|
3
5
|
name: string;
|
|
4
6
|
key: string;
|
|
5
|
-
valueType:
|
|
7
|
+
valueType: ComputedValueType;
|
|
6
8
|
rules: IComputedRule[];
|
|
7
|
-
defaultValue?: string | number | null;
|
|
9
|
+
defaultValue?: string | number | boolean | null;
|
|
8
10
|
description?: string;
|
|
9
11
|
}
|
|
10
12
|
export interface IComputedRule {
|
|
11
13
|
id: string;
|
|
12
|
-
condition?:
|
|
13
|
-
|
|
14
|
+
condition?: IExpressionConditionGroup;
|
|
15
|
+
value: Expression;
|
|
14
16
|
}
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
export declare const COMPUTED_REF_PREFIX = "computed.";
|
|
18
|
+
export interface IComputedFieldIssue {
|
|
19
|
+
field: string;
|
|
20
|
+
code: string;
|
|
21
|
+
variables: Record<string, string | number>;
|
|
18
22
|
}
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
comparison: string;
|
|
22
|
-
value: unknown;
|
|
23
|
-
}
|
|
24
|
-
export interface IComputation {
|
|
25
|
-
type: ComputationType;
|
|
26
|
-
config: IDirectValueConfig | IFieldReferenceConfig | IArithmeticConfig;
|
|
27
|
-
}
|
|
28
|
-
export type ComputationType = 'direct' | 'field_reference' | 'arithmetic';
|
|
29
|
-
export interface IDirectValueConfig {
|
|
30
|
-
type: 'direct';
|
|
31
|
-
value: string | number;
|
|
32
|
-
}
|
|
33
|
-
export interface IFieldReferenceConfig {
|
|
34
|
-
type: 'field_reference';
|
|
35
|
-
fieldId: string;
|
|
36
|
-
}
|
|
37
|
-
export interface IArithmeticConfig {
|
|
38
|
-
type: 'arithmetic';
|
|
39
|
-
operation: ArithmeticOperation;
|
|
40
|
-
operands: IArithmeticOperand[];
|
|
41
|
-
}
|
|
42
|
-
export type ArithmeticOperation = 'sum' | 'subtract' | 'multiply' | 'divide' | 'average' | 'min' | 'max' | 'increment' | 'decrement';
|
|
43
|
-
export interface IArithmeticOperand {
|
|
44
|
-
type: 'field' | 'constant';
|
|
45
|
-
fieldId?: string;
|
|
46
|
-
value?: number;
|
|
47
|
-
}
|
|
48
|
-
export declare function calculateComputedFields(formData: Record<string, unknown>, computedFields: IComputedField[] | undefined): Record<string, unknown>;
|
|
23
|
+
export declare function calculateComputedFields(data: Record<string, unknown>, schema: unknown): Record<string, unknown>;
|
|
24
|
+
export declare function findComputedFieldIssue(schema: unknown): IComputedFieldIssue | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
export declare function
|
|
1
|
+
import { type ILoggedUserInfo, type ILogicNode } from '@flusys/nestjs-shared/interfaces';
|
|
2
|
+
import { type IPermissionSources } from '@flusys/nestjs-shared/utils';
|
|
3
|
+
export declare function hasFormPermission(user: ILoggedUserInfo, logic: ILogicNode, sources: IPermissionSources): Promise<boolean>;
|