@flusys/nestjs-entity-builder 9.0.1 → 9.1.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/README.md +22 -28
- package/config/message-keys.d.ts +9 -62
- package/controllers/flow-api-key.controller.d.ts +14 -0
- package/controllers/flow-definition.controller.d.ts +1 -7
- package/controllers/index.d.ts +1 -0
- package/dtos/flow.dto.d.ts +20 -10
- package/entities/flow-api-key.entity.d.ts +10 -0
- package/entities/flow-definition.entity.d.ts +9 -3
- package/entities/flow-execution.entity.d.ts +0 -1
- package/entities/index.d.ts +3 -3
- package/fesm/21.js +11 -64
- package/fesm/{582.js → 489.js} +11 -20
- package/fesm/{913.js → 606.js} +295 -209
- package/fesm/719.js +186 -162
- package/fesm/794.js +187 -116
- package/fesm/{677.js → 996.js} +616 -1490
- package/fesm/controllers/index.js +6 -5
- package/fesm/docs/index.js +2 -2
- package/fesm/entities/index.js +2 -2
- package/fesm/guards/index.js +19 -12
- package/fesm/index.js +638 -50
- package/fesm/modules/index.js +625 -7
- package/fesm/rule-engine/index.js +2 -2
- package/fesm/services/index.js +25 -54
- package/flow-engine/flow-api-key.d.ts +7 -3
- package/flow-engine/flow-graph.validator.d.ts +2 -4
- package/flow-engine/flow-run.types.d.ts +4 -14
- package/flow-engine/flow.types.d.ts +9 -91
- package/interfaces/flow-definition.interface.d.ts +9 -13
- package/package.json +5 -5
- package/rule-engine/rule-engine.service.d.ts +0 -1
- package/services/entity-flow-scaffold.d.ts +1 -1
- package/services/flow-api-key.service.d.ts +31 -0
- package/services/flow-definition.service.d.ts +12 -24
- package/services/flow-execution.service.d.ts +0 -1
- package/services/flow-executor.service.d.ts +7 -7
- package/services/generic-entity.service.d.ts +1 -1
- package/services/index.d.ts +1 -0
- package/entities/flow-version.entity.d.ts +0 -10
- package/fesm/458.js +0 -649
package/fesm/{913.js → 606.js}
RENAMED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { lastValueFrom } from "rxjs";
|
|
2
2
|
import * as __rspack_external__flusys_nestjs_shared_guards_3f79ddd1 from "@flusys/nestjs-shared/guards";
|
|
3
3
|
import * as __rspack_external__flusys_nestjs_shared_decorators_c129b601 from "@flusys/nestjs-shared/decorators";
|
|
4
|
-
export const __rspack_esm_id =
|
|
5
|
-
export const __rspack_esm_ids = [
|
|
4
|
+
export const __rspack_esm_id = 606;
|
|
5
|
+
export const __rspack_esm_ids = [606];
|
|
6
6
|
export const __webpack_modules__ = {
|
|
7
|
-
|
|
7
|
+
2517(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
8
8
|
|
|
9
9
|
// EXPORTS
|
|
10
10
|
__webpack_require__.d(__webpack_exports__, {
|
|
11
11
|
hv: () => (/* reexport */ EntityDefinitionController),
|
|
12
12
|
GX: () => (/* reexport */ FieldDefinitionController),
|
|
13
|
+
Sv: () => (/* reexport */ FlowApiKeyController),
|
|
13
14
|
W8: () => (/* reexport */ FlowDefinitionController),
|
|
14
15
|
VU: () => (/* reexport */ FlowExecutionController),
|
|
15
16
|
bw: () => (/* reexport */ FlowRuntimeController)
|
|
@@ -448,7 +449,15 @@ class CreateFlowDefinitionDto {
|
|
|
448
449
|
slug;
|
|
449
450
|
description;
|
|
450
451
|
isActive;
|
|
452
|
+
authMode;
|
|
453
|
+
permissionCode;
|
|
454
|
+
runAs;
|
|
455
|
+
isTransactional;
|
|
456
|
+
timeoutMs;
|
|
457
|
+
rateLimitPerMinute;
|
|
451
458
|
retainExecutions;
|
|
459
|
+
bodyType;
|
|
460
|
+
inputSchema;
|
|
452
461
|
nodes;
|
|
453
462
|
edges;
|
|
454
463
|
}
|
|
@@ -487,6 +496,62 @@ flow_dto_ts_decorate([
|
|
|
487
496
|
(0,external_class_validator_.IsOptional)(),
|
|
488
497
|
flow_dto_ts_metadata("design:type", Boolean)
|
|
489
498
|
], CreateFlowDefinitionDto.prototype, "isActive", void 0);
|
|
499
|
+
flow_dto_ts_decorate([
|
|
500
|
+
(0,swagger_.ApiPropertyOptional)({
|
|
501
|
+
enum: flow_types/* .FLOW_AUTH_MODES */.fO,
|
|
502
|
+
default: 'jwt'
|
|
503
|
+
}),
|
|
504
|
+
(0,external_class_validator_.IsEnum)(flow_types/* .FLOW_AUTH_MODES */.fO),
|
|
505
|
+
(0,external_class_validator_.IsOptional)(),
|
|
506
|
+
flow_dto_ts_metadata("design:type", typeof FlowAuthMode === "undefined" ? Object : FlowAuthMode)
|
|
507
|
+
], CreateFlowDefinitionDto.prototype, "authMode", void 0);
|
|
508
|
+
flow_dto_ts_decorate([
|
|
509
|
+
(0,swagger_.ApiPropertyOptional)({
|
|
510
|
+
description: "authMode 'permission': defaults to entity_builder.flow.<slug>.execute"
|
|
511
|
+
}),
|
|
512
|
+
(0,external_class_validator_.IsString)(),
|
|
513
|
+
(0,external_class_validator_.IsOptional)(),
|
|
514
|
+
(0,external_class_validator_.MaxLength)(255),
|
|
515
|
+
flow_dto_ts_metadata("design:type", String)
|
|
516
|
+
], CreateFlowDefinitionDto.prototype, "permissionCode", void 0);
|
|
517
|
+
flow_dto_ts_decorate([
|
|
518
|
+
(0,swagger_.ApiPropertyOptional)({
|
|
519
|
+
enum: flow_types/* .FLOW_RUN_AS */.gl,
|
|
520
|
+
default: 'caller'
|
|
521
|
+
}),
|
|
522
|
+
(0,external_class_validator_.IsEnum)(flow_types/* .FLOW_RUN_AS */.gl),
|
|
523
|
+
(0,external_class_validator_.IsOptional)(),
|
|
524
|
+
flow_dto_ts_metadata("design:type", typeof FlowRunAs === "undefined" ? Object : FlowRunAs)
|
|
525
|
+
], CreateFlowDefinitionDto.prototype, "runAs", void 0);
|
|
526
|
+
flow_dto_ts_decorate([
|
|
527
|
+
(0,swagger_.ApiPropertyOptional)({
|
|
528
|
+
default: false
|
|
529
|
+
}),
|
|
530
|
+
(0,external_class_validator_.IsBoolean)(),
|
|
531
|
+
(0,external_class_validator_.IsOptional)(),
|
|
532
|
+
flow_dto_ts_metadata("design:type", Boolean)
|
|
533
|
+
], CreateFlowDefinitionDto.prototype, "isTransactional", void 0);
|
|
534
|
+
flow_dto_ts_decorate([
|
|
535
|
+
(0,swagger_.ApiPropertyOptional)({
|
|
536
|
+
default: flow_types/* .FLOW_LIMITS.DEFAULT_TIMEOUT_MS */.Or.DEFAULT_TIMEOUT_MS
|
|
537
|
+
}),
|
|
538
|
+
(0,external_class_validator_.IsInt)(),
|
|
539
|
+
(0,external_class_validator_.Min)(flow_types/* .FLOW_LIMITS.MIN_TIMEOUT_MS */.Or.MIN_TIMEOUT_MS),
|
|
540
|
+
(0,external_class_validator_.Max)(flow_types/* .FLOW_LIMITS.MAX_TIMEOUT_MS */.Or.MAX_TIMEOUT_MS),
|
|
541
|
+
(0,external_class_validator_.IsOptional)(),
|
|
542
|
+
flow_dto_ts_metadata("design:type", Number)
|
|
543
|
+
], CreateFlowDefinitionDto.prototype, "timeoutMs", void 0);
|
|
544
|
+
flow_dto_ts_decorate([
|
|
545
|
+
(0,swagger_.ApiPropertyOptional)({
|
|
546
|
+
description: 'Per caller IP per minute; 0 = unlimited',
|
|
547
|
+
default: 60
|
|
548
|
+
}),
|
|
549
|
+
(0,external_class_validator_.IsInt)(),
|
|
550
|
+
(0,external_class_validator_.Min)(0),
|
|
551
|
+
(0,external_class_validator_.Max)(100000),
|
|
552
|
+
(0,external_class_validator_.IsOptional)(),
|
|
553
|
+
flow_dto_ts_metadata("design:type", Number)
|
|
554
|
+
], CreateFlowDefinitionDto.prototype, "rateLimitPerMinute", void 0);
|
|
490
555
|
flow_dto_ts_decorate([
|
|
491
556
|
(0,swagger_.ApiPropertyOptional)({
|
|
492
557
|
default: 200
|
|
@@ -497,12 +562,31 @@ flow_dto_ts_decorate([
|
|
|
497
562
|
(0,external_class_validator_.IsOptional)(),
|
|
498
563
|
flow_dto_ts_metadata("design:type", Number)
|
|
499
564
|
], CreateFlowDefinitionDto.prototype, "retainExecutions", void 0);
|
|
565
|
+
flow_dto_ts_decorate([
|
|
566
|
+
(0,swagger_.ApiPropertyOptional)({
|
|
567
|
+
enum: flow_types/* .FLOW_BODY_TYPES */.Y3,
|
|
568
|
+
default: 'object',
|
|
569
|
+
description: 'object: the body is one object; list: the body is a list and inputSchema describes each item'
|
|
570
|
+
}),
|
|
571
|
+
(0,external_class_validator_.IsIn)(flow_types/* .FLOW_BODY_TYPES */.Y3),
|
|
572
|
+
(0,external_class_validator_.IsOptional)(),
|
|
573
|
+
flow_dto_ts_metadata("design:type", typeof FlowBodyType === "undefined" ? Object : FlowBodyType)
|
|
574
|
+
], CreateFlowDefinitionDto.prototype, "bodyType", void 0);
|
|
575
|
+
flow_dto_ts_decorate([
|
|
576
|
+
(0,swagger_.ApiPropertyOptional)({
|
|
577
|
+
type: [
|
|
578
|
+
Object
|
|
579
|
+
]
|
|
580
|
+
}),
|
|
581
|
+
(0,external_class_validator_.IsArray)(),
|
|
582
|
+
(0,external_class_validator_.IsOptional)(),
|
|
583
|
+
flow_dto_ts_metadata("design:type", Array)
|
|
584
|
+
], CreateFlowDefinitionDto.prototype, "inputSchema", void 0);
|
|
500
585
|
flow_dto_ts_decorate([
|
|
501
586
|
(0,swagger_.ApiProperty)({
|
|
502
587
|
type: [
|
|
503
588
|
Object
|
|
504
|
-
]
|
|
505
|
-
description: 'Steps; each Request step (trigger) carries its own path, body (bodyType, inputSchema), access (authMode: signed-in by default, permissionCode), runAs (caller by default), isTransactional, timeoutMs and rateLimitPerMinute'
|
|
589
|
+
]
|
|
506
590
|
}),
|
|
507
591
|
(0,external_class_validator_.IsArray)(),
|
|
508
592
|
flow_dto_ts_metadata("design:type", Array)
|
|
@@ -527,7 +611,7 @@ flow_dto_ts_decorate([
|
|
|
527
611
|
], UpdateFlowDefinitionDto.prototype, "id", void 0);
|
|
528
612
|
/**
|
|
529
613
|
* A flow as the designer holds it, for a test run or a check: every setting is validated like a
|
|
530
|
-
* saved flow's (
|
|
614
|
+
* saved flow's (run-as, auth mode, time-out and limits are bounded, the graph by `validateFlow`),
|
|
531
615
|
* the name may still be empty, and the server-owned fields of a loaded flow are ignored.
|
|
532
616
|
*/ class FlowDraftDto extends (0,swagger_.OmitType)(CreateFlowDefinitionDto, [
|
|
533
617
|
'name'
|
|
@@ -535,7 +619,6 @@ flow_dto_ts_decorate([
|
|
|
535
619
|
name;
|
|
536
620
|
id;
|
|
537
621
|
version;
|
|
538
|
-
draft;
|
|
539
622
|
createdAt;
|
|
540
623
|
updatedAt;
|
|
541
624
|
deletedAt;
|
|
@@ -560,10 +643,6 @@ flow_dto_ts_decorate([
|
|
|
560
643
|
(0,external_class_validator_.Allow)(),
|
|
561
644
|
flow_dto_ts_metadata("design:type", Object)
|
|
562
645
|
], FlowDraftDto.prototype, "version", void 0);
|
|
563
|
-
flow_dto_ts_decorate([
|
|
564
|
-
(0,external_class_validator_.Allow)(),
|
|
565
|
-
flow_dto_ts_metadata("design:type", Object)
|
|
566
|
-
], FlowDraftDto.prototype, "draft", void 0);
|
|
567
646
|
flow_dto_ts_decorate([
|
|
568
647
|
(0,external_class_validator_.Allow)(),
|
|
569
648
|
flow_dto_ts_metadata("design:type", Object)
|
|
@@ -706,37 +785,27 @@ flow_dto_ts_decorate([
|
|
|
706
785
|
(0,external_class_validator_.IsNotEmpty)(),
|
|
707
786
|
flow_dto_ts_metadata("design:type", String)
|
|
708
787
|
], FlowIdDto.prototype, "flowId", void 0);
|
|
709
|
-
class
|
|
710
|
-
|
|
711
|
-
|
|
788
|
+
class CreateFlowApiKeyDto extends FlowIdDto {
|
|
789
|
+
name;
|
|
790
|
+
expiresAt;
|
|
712
791
|
}
|
|
713
792
|
flow_dto_ts_decorate([
|
|
714
|
-
(0,swagger_.ApiProperty)(
|
|
715
|
-
|
|
793
|
+
(0,swagger_.ApiProperty)({
|
|
794
|
+
example: 'Shop backend'
|
|
795
|
+
}),
|
|
796
|
+
(0,external_class_validator_.IsString)(),
|
|
716
797
|
(0,external_class_validator_.IsNotEmpty)(),
|
|
798
|
+
(0,external_class_validator_.MaxLength)(100),
|
|
717
799
|
flow_dto_ts_metadata("design:type", String)
|
|
718
|
-
],
|
|
800
|
+
], CreateFlowApiKeyDto.prototype, "name", void 0);
|
|
719
801
|
flow_dto_ts_decorate([
|
|
720
802
|
(0,swagger_.ApiPropertyOptional)({
|
|
721
|
-
description: '
|
|
722
|
-
example: 'Checks the branch before saving'
|
|
803
|
+
description: 'ISO date-time after which the key stops working'
|
|
723
804
|
}),
|
|
724
|
-
(0,external_class_validator_.
|
|
805
|
+
(0,external_class_validator_.IsISO8601)(),
|
|
725
806
|
(0,external_class_validator_.IsOptional)(),
|
|
726
|
-
(0,external_class_validator_.MaxLength)(500),
|
|
727
807
|
flow_dto_ts_metadata("design:type", String)
|
|
728
|
-
],
|
|
729
|
-
class FlowVersionRefDto extends FlowIdDto {
|
|
730
|
-
version;
|
|
731
|
-
}
|
|
732
|
-
flow_dto_ts_decorate([
|
|
733
|
-
(0,swagger_.ApiProperty)({
|
|
734
|
-
example: 3
|
|
735
|
-
}),
|
|
736
|
-
(0,external_class_validator_.IsInt)(),
|
|
737
|
-
(0,external_class_validator_.Min)(1),
|
|
738
|
-
flow_dto_ts_metadata("design:type", Number)
|
|
739
|
-
], FlowVersionRefDto.prototype, "version", void 0);
|
|
808
|
+
], CreateFlowApiKeyDto.prototype, "expiresAt", void 0);
|
|
740
809
|
/** The id of a flow API key or a flow execution. */ class IdBodyDto {
|
|
741
810
|
id;
|
|
742
811
|
}
|
|
@@ -798,11 +867,18 @@ class FlowDefinitionResponseDto extends dtos_.IdentityResponseDto {
|
|
|
798
867
|
slug;
|
|
799
868
|
description;
|
|
800
869
|
isActive;
|
|
870
|
+
authMode;
|
|
871
|
+
permissionCode;
|
|
872
|
+
runAs;
|
|
873
|
+
isTransactional;
|
|
874
|
+
timeoutMs;
|
|
875
|
+
rateLimitPerMinute;
|
|
801
876
|
retainExecutions;
|
|
877
|
+
bodyType;
|
|
878
|
+
inputSchema;
|
|
802
879
|
nodes;
|
|
803
880
|
edges;
|
|
804
881
|
version;
|
|
805
|
-
draft;
|
|
806
882
|
}
|
|
807
883
|
flow_dto_ts_decorate([
|
|
808
884
|
(0,external_class_transformer_.Expose)(),
|
|
@@ -824,11 +900,53 @@ flow_dto_ts_decorate([
|
|
|
824
900
|
(0,swagger_.ApiProperty)(),
|
|
825
901
|
flow_dto_ts_metadata("design:type", Boolean)
|
|
826
902
|
], FlowDefinitionResponseDto.prototype, "isActive", void 0);
|
|
903
|
+
flow_dto_ts_decorate([
|
|
904
|
+
(0,external_class_transformer_.Expose)(),
|
|
905
|
+
(0,swagger_.ApiProperty)(),
|
|
906
|
+
flow_dto_ts_metadata("design:type", typeof FlowAuthMode === "undefined" ? Object : FlowAuthMode)
|
|
907
|
+
], FlowDefinitionResponseDto.prototype, "authMode", void 0);
|
|
908
|
+
flow_dto_ts_decorate([
|
|
909
|
+
(0,external_class_transformer_.Expose)(),
|
|
910
|
+
(0,swagger_.ApiProperty)(),
|
|
911
|
+
flow_dto_ts_metadata("design:type", Object)
|
|
912
|
+
], FlowDefinitionResponseDto.prototype, "permissionCode", void 0);
|
|
913
|
+
flow_dto_ts_decorate([
|
|
914
|
+
(0,external_class_transformer_.Expose)(),
|
|
915
|
+
(0,swagger_.ApiProperty)(),
|
|
916
|
+
flow_dto_ts_metadata("design:type", typeof FlowRunAs === "undefined" ? Object : FlowRunAs)
|
|
917
|
+
], FlowDefinitionResponseDto.prototype, "runAs", void 0);
|
|
918
|
+
flow_dto_ts_decorate([
|
|
919
|
+
(0,external_class_transformer_.Expose)(),
|
|
920
|
+
(0,swagger_.ApiProperty)(),
|
|
921
|
+
flow_dto_ts_metadata("design:type", Boolean)
|
|
922
|
+
], FlowDefinitionResponseDto.prototype, "isTransactional", void 0);
|
|
923
|
+
flow_dto_ts_decorate([
|
|
924
|
+
(0,external_class_transformer_.Expose)(),
|
|
925
|
+
(0,swagger_.ApiProperty)(),
|
|
926
|
+
flow_dto_ts_metadata("design:type", Number)
|
|
927
|
+
], FlowDefinitionResponseDto.prototype, "timeoutMs", void 0);
|
|
928
|
+
flow_dto_ts_decorate([
|
|
929
|
+
(0,external_class_transformer_.Expose)(),
|
|
930
|
+
(0,swagger_.ApiProperty)(),
|
|
931
|
+
flow_dto_ts_metadata("design:type", Number)
|
|
932
|
+
], FlowDefinitionResponseDto.prototype, "rateLimitPerMinute", void 0);
|
|
827
933
|
flow_dto_ts_decorate([
|
|
828
934
|
(0,external_class_transformer_.Expose)(),
|
|
829
935
|
(0,swagger_.ApiProperty)(),
|
|
830
936
|
flow_dto_ts_metadata("design:type", Number)
|
|
831
937
|
], FlowDefinitionResponseDto.prototype, "retainExecutions", void 0);
|
|
938
|
+
flow_dto_ts_decorate([
|
|
939
|
+
(0,external_class_transformer_.Expose)(),
|
|
940
|
+
(0,swagger_.ApiProperty)({
|
|
941
|
+
enum: flow_types/* .FLOW_BODY_TYPES */.Y3
|
|
942
|
+
}),
|
|
943
|
+
flow_dto_ts_metadata("design:type", typeof FlowBodyType === "undefined" ? Object : FlowBodyType)
|
|
944
|
+
], FlowDefinitionResponseDto.prototype, "bodyType", void 0);
|
|
945
|
+
flow_dto_ts_decorate([
|
|
946
|
+
(0,external_class_transformer_.Expose)(),
|
|
947
|
+
(0,swagger_.ApiProperty)(),
|
|
948
|
+
flow_dto_ts_metadata("design:type", Array)
|
|
949
|
+
], FlowDefinitionResponseDto.prototype, "inputSchema", void 0);
|
|
832
950
|
flow_dto_ts_decorate([
|
|
833
951
|
(0,external_class_transformer_.Expose)(),
|
|
834
952
|
(0,swagger_.ApiProperty)(),
|
|
@@ -841,22 +959,12 @@ flow_dto_ts_decorate([
|
|
|
841
959
|
], FlowDefinitionResponseDto.prototype, "edges", void 0);
|
|
842
960
|
flow_dto_ts_decorate([
|
|
843
961
|
(0,external_class_transformer_.Expose)(),
|
|
844
|
-
(0,swagger_.ApiProperty)(
|
|
845
|
-
description: 'The published version; 0 until the flow is first published'
|
|
846
|
-
}),
|
|
962
|
+
(0,swagger_.ApiProperty)(),
|
|
847
963
|
flow_dto_ts_metadata("design:type", Number)
|
|
848
964
|
], FlowDefinitionResponseDto.prototype, "version", void 0);
|
|
849
|
-
flow_dto_ts_decorate([
|
|
850
|
-
(0,external_class_transformer_.Expose)(),
|
|
851
|
-
(0,swagger_.ApiProperty)({
|
|
852
|
-
description: 'Saved changes not yet published',
|
|
853
|
-
nullable: true
|
|
854
|
-
}),
|
|
855
|
-
flow_dto_ts_metadata("design:type", Object)
|
|
856
|
-
], FlowDefinitionResponseDto.prototype, "draft", void 0);
|
|
857
965
|
|
|
858
|
-
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
|
|
859
|
-
var flow_definition_service = __webpack_require__(
|
|
966
|
+
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
|
|
967
|
+
var flow_definition_service = __webpack_require__(5229);
|
|
860
968
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-runtime.service.ts
|
|
861
969
|
var flow_runtime_service = __webpack_require__(2300);
|
|
862
970
|
;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-definition.controller.ts
|
|
@@ -963,55 +1071,6 @@ class FlowDefinitionController extends (0,nestjs_shared_.createApiController)(Cr
|
|
|
963
1071
|
data: result
|
|
964
1072
|
};
|
|
965
1073
|
}
|
|
966
|
-
async publish(dto, user) {
|
|
967
|
-
const flow = await this.flowDefinitionService.publish(dto.id, dto.note, user);
|
|
968
|
-
return {
|
|
969
|
-
success: true,
|
|
970
|
-
message: `Version ${flow.version} published`,
|
|
971
|
-
messageKey: message_keys/* .FLOW_MESSAGES.PUBLISH_SUCCESS */.wu.PUBLISH_SUCCESS,
|
|
972
|
-
messageVariables: {
|
|
973
|
-
version: flow.version
|
|
974
|
-
},
|
|
975
|
-
data: flow
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
async versions(dto) {
|
|
979
|
-
return {
|
|
980
|
-
success: true,
|
|
981
|
-
message: 'Versions loaded',
|
|
982
|
-
messageKey: message_keys/* .FLOW_MESSAGES.VERSIONS_SUCCESS */.wu.VERSIONS_SUCCESS,
|
|
983
|
-
data: await this.flowDefinitionService.listVersions(dto.flowId)
|
|
984
|
-
};
|
|
985
|
-
}
|
|
986
|
-
async version(dto) {
|
|
987
|
-
return {
|
|
988
|
-
success: true,
|
|
989
|
-
message: 'Version loaded',
|
|
990
|
-
messageKey: message_keys/* .FLOW_MESSAGES.VERSION_SUCCESS */.wu.VERSION_SUCCESS,
|
|
991
|
-
data: await this.flowDefinitionService.getVersion(dto.flowId, dto.version)
|
|
992
|
-
};
|
|
993
|
-
}
|
|
994
|
-
async restoreVersion(dto, user) {
|
|
995
|
-
const flow = await this.flowDefinitionService.restoreVersion(dto.flowId, dto.version, user);
|
|
996
|
-
return {
|
|
997
|
-
success: true,
|
|
998
|
-
message: `Version ${dto.version} restored to the draft`,
|
|
999
|
-
messageKey: message_keys/* .FLOW_MESSAGES.VERSION_RESTORED */.wu.VERSION_RESTORED,
|
|
1000
|
-
messageVariables: {
|
|
1001
|
-
version: dto.version
|
|
1002
|
-
},
|
|
1003
|
-
data: flow
|
|
1004
|
-
};
|
|
1005
|
-
}
|
|
1006
|
-
async discardDraft(dto, user) {
|
|
1007
|
-
const flow = await this.flowDefinitionService.discardDraft(dto.flowId, user);
|
|
1008
|
-
return {
|
|
1009
|
-
success: true,
|
|
1010
|
-
message: 'Unpublished changes discarded',
|
|
1011
|
-
messageKey: message_keys/* .FLOW_MESSAGES.DRAFT_DISCARDED */.wu.DRAFT_DISCARDED,
|
|
1012
|
-
data: flow
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
1074
|
async testRun(dto, user, req) {
|
|
1016
1075
|
const { result, warnings } = await this.runtime.testRun(dto, user, {
|
|
1017
1076
|
ip: req.ip ?? null,
|
|
@@ -1047,109 +1106,6 @@ flow_definition_controller_ts_decorate([
|
|
|
1047
1106
|
]),
|
|
1048
1107
|
flow_definition_controller_ts_metadata("design:returntype", Promise)
|
|
1049
1108
|
], FlowDefinitionController.prototype, "validate", null);
|
|
1050
|
-
flow_definition_controller_ts_decorate([
|
|
1051
|
-
(0,common_.Post)('publish'),
|
|
1052
|
-
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1053
|
-
(0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
|
|
1054
|
-
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.UPDATE),
|
|
1055
|
-
(0,swagger_.ApiBearerAuth)(),
|
|
1056
|
-
(0,swagger_.ApiOperation)({
|
|
1057
|
-
summary: 'Make the saved changes live as the next version',
|
|
1058
|
-
description: 'Checked like a save, plus that no other flow calls a URL name or path this version drops.'
|
|
1059
|
-
}),
|
|
1060
|
-
(0,swagger_.ApiBody)({
|
|
1061
|
-
type: PublishFlowDto
|
|
1062
|
-
}),
|
|
1063
|
-
flow_definition_controller_ts_param(0, (0,common_.Body)()),
|
|
1064
|
-
flow_definition_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
|
|
1065
|
-
flow_definition_controller_ts_metadata("design:type", Function),
|
|
1066
|
-
flow_definition_controller_ts_metadata("design:paramtypes", [
|
|
1067
|
-
typeof PublishFlowDto === "undefined" ? Object : PublishFlowDto,
|
|
1068
|
-
typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
|
|
1069
|
-
]),
|
|
1070
|
-
flow_definition_controller_ts_metadata("design:returntype", Promise)
|
|
1071
|
-
], FlowDefinitionController.prototype, "publish", null);
|
|
1072
|
-
flow_definition_controller_ts_decorate([
|
|
1073
|
-
(0,common_.Post)('versions'),
|
|
1074
|
-
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1075
|
-
(0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
|
|
1076
|
-
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.READ),
|
|
1077
|
-
(0,swagger_.ApiBearerAuth)(),
|
|
1078
|
-
(0,swagger_.ApiOperation)({
|
|
1079
|
-
summary: 'Published versions of a flow, newest first'
|
|
1080
|
-
}),
|
|
1081
|
-
(0,swagger_.ApiBody)({
|
|
1082
|
-
type: FlowIdDto
|
|
1083
|
-
}),
|
|
1084
|
-
flow_definition_controller_ts_param(0, (0,common_.Body)()),
|
|
1085
|
-
flow_definition_controller_ts_metadata("design:type", Function),
|
|
1086
|
-
flow_definition_controller_ts_metadata("design:paramtypes", [
|
|
1087
|
-
typeof FlowIdDto === "undefined" ? Object : FlowIdDto
|
|
1088
|
-
]),
|
|
1089
|
-
flow_definition_controller_ts_metadata("design:returntype", Promise)
|
|
1090
|
-
], FlowDefinitionController.prototype, "versions", null);
|
|
1091
|
-
flow_definition_controller_ts_decorate([
|
|
1092
|
-
(0,common_.Post)('version'),
|
|
1093
|
-
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1094
|
-
(0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
|
|
1095
|
-
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.READ),
|
|
1096
|
-
(0,swagger_.ApiBearerAuth)(),
|
|
1097
|
-
(0,swagger_.ApiOperation)({
|
|
1098
|
-
summary: 'One published version in full'
|
|
1099
|
-
}),
|
|
1100
|
-
(0,swagger_.ApiBody)({
|
|
1101
|
-
type: FlowVersionRefDto
|
|
1102
|
-
}),
|
|
1103
|
-
flow_definition_controller_ts_param(0, (0,common_.Body)()),
|
|
1104
|
-
flow_definition_controller_ts_metadata("design:type", Function),
|
|
1105
|
-
flow_definition_controller_ts_metadata("design:paramtypes", [
|
|
1106
|
-
typeof FlowVersionRefDto === "undefined" ? Object : FlowVersionRefDto
|
|
1107
|
-
]),
|
|
1108
|
-
flow_definition_controller_ts_metadata("design:returntype", Promise)
|
|
1109
|
-
], FlowDefinitionController.prototype, "version", null);
|
|
1110
|
-
flow_definition_controller_ts_decorate([
|
|
1111
|
-
(0,common_.Post)('restore-version'),
|
|
1112
|
-
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1113
|
-
(0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
|
|
1114
|
-
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.UPDATE),
|
|
1115
|
-
(0,swagger_.ApiBearerAuth)(),
|
|
1116
|
-
(0,swagger_.ApiOperation)({
|
|
1117
|
-
summary: 'Put an old version back into the draft',
|
|
1118
|
-
description: 'Callers keep running the published flow until the draft is published.'
|
|
1119
|
-
}),
|
|
1120
|
-
(0,swagger_.ApiBody)({
|
|
1121
|
-
type: FlowVersionRefDto
|
|
1122
|
-
}),
|
|
1123
|
-
flow_definition_controller_ts_param(0, (0,common_.Body)()),
|
|
1124
|
-
flow_definition_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
|
|
1125
|
-
flow_definition_controller_ts_metadata("design:type", Function),
|
|
1126
|
-
flow_definition_controller_ts_metadata("design:paramtypes", [
|
|
1127
|
-
typeof FlowVersionRefDto === "undefined" ? Object : FlowVersionRefDto,
|
|
1128
|
-
typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
|
|
1129
|
-
]),
|
|
1130
|
-
flow_definition_controller_ts_metadata("design:returntype", Promise)
|
|
1131
|
-
], FlowDefinitionController.prototype, "restoreVersion", null);
|
|
1132
|
-
flow_definition_controller_ts_decorate([
|
|
1133
|
-
(0,common_.Post)('discard-draft'),
|
|
1134
|
-
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1135
|
-
(0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
|
|
1136
|
-
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.UPDATE),
|
|
1137
|
-
(0,swagger_.ApiBearerAuth)(),
|
|
1138
|
-
(0,swagger_.ApiOperation)({
|
|
1139
|
-
summary: 'Drop the unpublished changes: the flow goes back to what is published'
|
|
1140
|
-
}),
|
|
1141
|
-
(0,swagger_.ApiBody)({
|
|
1142
|
-
type: FlowIdDto
|
|
1143
|
-
}),
|
|
1144
|
-
flow_definition_controller_ts_param(0, (0,common_.Body)()),
|
|
1145
|
-
flow_definition_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
|
|
1146
|
-
flow_definition_controller_ts_metadata("design:type", Function),
|
|
1147
|
-
flow_definition_controller_ts_metadata("design:paramtypes", [
|
|
1148
|
-
typeof FlowIdDto === "undefined" ? Object : FlowIdDto,
|
|
1149
|
-
typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
|
|
1150
|
-
]),
|
|
1151
|
-
flow_definition_controller_ts_metadata("design:returntype", Promise)
|
|
1152
|
-
], FlowDefinitionController.prototype, "discardDraft", null);
|
|
1153
1109
|
flow_definition_controller_ts_decorate([
|
|
1154
1110
|
(0,common_.Post)('test-run'),
|
|
1155
1111
|
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
@@ -1186,6 +1142,128 @@ FlowDefinitionController = flow_definition_controller_ts_decorate([
|
|
|
1186
1142
|
])
|
|
1187
1143
|
], FlowDefinitionController);
|
|
1188
1144
|
|
|
1145
|
+
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-api-key.service.ts + 1 modules
|
|
1146
|
+
var flow_api_key_service = __webpack_require__(8888);
|
|
1147
|
+
;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-api-key.controller.ts
|
|
1148
|
+
function flow_api_key_controller_ts_decorate(decorators, target, key, desc) {
|
|
1149
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1150
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1151
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1152
|
+
} else {
|
|
1153
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
1154
|
+
if (d = decorators[i]) {
|
|
1155
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1160
|
+
}
|
|
1161
|
+
function flow_api_key_controller_ts_metadata(metadataKey, metadataValue) {
|
|
1162
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1163
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function flow_api_key_controller_ts_param(paramIndex, decorator) {
|
|
1167
|
+
return function(target, key) {
|
|
1168
|
+
decorator(target, key, paramIndex);
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
const flow_api_key_controller_P = nestjs_shared_.FLOW_DEFINITION_PERMISSIONS;
|
|
1180
|
+
const ok = (data, message, messageKey)=>({
|
|
1181
|
+
success: true,
|
|
1182
|
+
message,
|
|
1183
|
+
messageKey,
|
|
1184
|
+
data
|
|
1185
|
+
});
|
|
1186
|
+
class FlowApiKeyController {
|
|
1187
|
+
keys;
|
|
1188
|
+
constructor(keys){
|
|
1189
|
+
this.keys = keys;
|
|
1190
|
+
}
|
|
1191
|
+
async create(dto, user) {
|
|
1192
|
+
return ok(await this.keys.create(dto.flowId, dto.name, dto.expiresAt, user), 'API key created', message_keys/* .FLOW_MESSAGES.API_KEY_CREATE_SUCCESS */.wu.API_KEY_CREATE_SUCCESS);
|
|
1193
|
+
}
|
|
1194
|
+
async list(dto) {
|
|
1195
|
+
return ok(await this.keys.list(dto.flowId), 'API keys loaded', message_keys/* .FLOW_MESSAGES.API_KEY_LIST_SUCCESS */.wu.API_KEY_LIST_SUCCESS);
|
|
1196
|
+
}
|
|
1197
|
+
async revoke(dto) {
|
|
1198
|
+
await this.keys.revoke(dto.id);
|
|
1199
|
+
return ok(null, 'API key revoked', message_keys/* .FLOW_MESSAGES.API_KEY_REVOKE_SUCCESS */.wu.API_KEY_REVOKE_SUCCESS);
|
|
1200
|
+
}
|
|
1201
|
+
async remove(dto) {
|
|
1202
|
+
await this.keys.remove(dto.id);
|
|
1203
|
+
return ok(null, 'API key deleted', message_keys/* .FLOW_MESSAGES.API_KEY_DELETE_SUCCESS */.wu.API_KEY_DELETE_SUCCESS);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
flow_api_key_controller_ts_decorate([
|
|
1207
|
+
(0,common_.Post)('create'),
|
|
1208
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1209
|
+
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
|
|
1210
|
+
(0,swagger_.ApiOperation)({
|
|
1211
|
+
summary: 'Create an API key. The key is in the response once and cannot be shown again.'
|
|
1212
|
+
}),
|
|
1213
|
+
flow_api_key_controller_ts_param(0, (0,common_.Body)()),
|
|
1214
|
+
flow_api_key_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
|
|
1215
|
+
flow_api_key_controller_ts_metadata("design:type", Function),
|
|
1216
|
+
flow_api_key_controller_ts_metadata("design:paramtypes", [
|
|
1217
|
+
typeof CreateFlowApiKeyDto === "undefined" ? Object : CreateFlowApiKeyDto,
|
|
1218
|
+
typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
|
|
1219
|
+
]),
|
|
1220
|
+
flow_api_key_controller_ts_metadata("design:returntype", Promise)
|
|
1221
|
+
], FlowApiKeyController.prototype, "create", null);
|
|
1222
|
+
flow_api_key_controller_ts_decorate([
|
|
1223
|
+
(0,common_.Post)('list'),
|
|
1224
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1225
|
+
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.READ),
|
|
1226
|
+
flow_api_key_controller_ts_param(0, (0,common_.Body)()),
|
|
1227
|
+
flow_api_key_controller_ts_metadata("design:type", Function),
|
|
1228
|
+
flow_api_key_controller_ts_metadata("design:paramtypes", [
|
|
1229
|
+
typeof FlowIdDto === "undefined" ? Object : FlowIdDto
|
|
1230
|
+
]),
|
|
1231
|
+
flow_api_key_controller_ts_metadata("design:returntype", Promise)
|
|
1232
|
+
], FlowApiKeyController.prototype, "list", null);
|
|
1233
|
+
flow_api_key_controller_ts_decorate([
|
|
1234
|
+
(0,common_.Post)('revoke'),
|
|
1235
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1236
|
+
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
|
|
1237
|
+
flow_api_key_controller_ts_param(0, (0,common_.Body)()),
|
|
1238
|
+
flow_api_key_controller_ts_metadata("design:type", Function),
|
|
1239
|
+
flow_api_key_controller_ts_metadata("design:paramtypes", [
|
|
1240
|
+
typeof IdBodyDto === "undefined" ? Object : IdBodyDto
|
|
1241
|
+
]),
|
|
1242
|
+
flow_api_key_controller_ts_metadata("design:returntype", Promise)
|
|
1243
|
+
], FlowApiKeyController.prototype, "revoke", null);
|
|
1244
|
+
flow_api_key_controller_ts_decorate([
|
|
1245
|
+
(0,common_.Post)('delete'),
|
|
1246
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1247
|
+
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
|
|
1248
|
+
flow_api_key_controller_ts_param(0, (0,common_.Body)()),
|
|
1249
|
+
flow_api_key_controller_ts_metadata("design:type", Function),
|
|
1250
|
+
flow_api_key_controller_ts_metadata("design:paramtypes", [
|
|
1251
|
+
typeof IdBodyDto === "undefined" ? Object : IdBodyDto
|
|
1252
|
+
]),
|
|
1253
|
+
flow_api_key_controller_ts_metadata("design:returntype", Promise)
|
|
1254
|
+
], FlowApiKeyController.prototype, "remove", null);
|
|
1255
|
+
FlowApiKeyController = flow_api_key_controller_ts_decorate([
|
|
1256
|
+
(0,swagger_.ApiTags)('Entity Builder - Flow API keys'),
|
|
1257
|
+
(0,common_.Controller)('entity-builder/flow-api-keys'),
|
|
1258
|
+
(0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
|
|
1259
|
+
(0,swagger_.ApiBearerAuth)(),
|
|
1260
|
+
flow_api_key_controller_ts_param(0, (0,common_.Inject)(flow_api_key_service/* .FlowApiKeyService */.T)),
|
|
1261
|
+
flow_api_key_controller_ts_metadata("design:type", Function),
|
|
1262
|
+
flow_api_key_controller_ts_metadata("design:paramtypes", [
|
|
1263
|
+
typeof flow_api_key_service/* .FlowApiKeyService */.T === "undefined" ? Object : flow_api_key_service/* .FlowApiKeyService */.T
|
|
1264
|
+
])
|
|
1265
|
+
], FlowApiKeyController);
|
|
1266
|
+
|
|
1189
1267
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-execution.service.ts
|
|
1190
1268
|
var flow_execution_service = __webpack_require__(7810);
|
|
1191
1269
|
;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-execution.controller.ts
|
|
@@ -1420,6 +1498,7 @@ FlowRuntimeController = flow_runtime_controller_ts_decorate([
|
|
|
1420
1498
|
|
|
1421
1499
|
|
|
1422
1500
|
|
|
1501
|
+
|
|
1423
1502
|
},
|
|
1424
1503
|
4196(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1425
1504
|
|
|
@@ -1442,8 +1521,10 @@ var core_ = __webpack_require__(3075);
|
|
|
1442
1521
|
|
|
1443
1522
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/config/message-keys.ts
|
|
1444
1523
|
var message_keys = __webpack_require__(5732);
|
|
1445
|
-
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
|
|
1446
|
-
var flow_definition_service = __webpack_require__(
|
|
1524
|
+
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
|
|
1525
|
+
var flow_definition_service = __webpack_require__(5229);
|
|
1526
|
+
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-api-key.service.ts + 1 modules
|
|
1527
|
+
var flow_api_key_service = __webpack_require__(8888);
|
|
1447
1528
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-runtime.service.ts
|
|
1448
1529
|
var flow_runtime_service = __webpack_require__(2300);
|
|
1449
1530
|
;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-rate-limiter.ts
|
|
@@ -1487,8 +1568,6 @@ const DEFAULT_MAX_KEYS = 10_000;
|
|
|
1487
1568
|
}
|
|
1488
1569
|
}
|
|
1489
1570
|
|
|
1490
|
-
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-api-key.ts
|
|
1491
|
-
var flow_api_key = __webpack_require__(4816);
|
|
1492
1571
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow.types.ts
|
|
1493
1572
|
var flow_types = __webpack_require__(6256);
|
|
1494
1573
|
;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/guards/flow-access.guard.ts
|
|
@@ -1545,27 +1624,34 @@ class FlowAccessGuard {
|
|
|
1545
1624
|
});
|
|
1546
1625
|
const flow = slug ? await runtime.findActive(slug) : null;
|
|
1547
1626
|
const endpoint = flow ? (0,flow_types/* .findEndpoint */.vS)(flow, request.params?.endpoint) : undefined;
|
|
1548
|
-
|
|
1549
|
-
if (!flow || !endpoint || endpoint.authMode === 'internal') throw new common_.NotFoundException({
|
|
1627
|
+
if (!flow || !endpoint) throw new common_.NotFoundException({
|
|
1550
1628
|
message: 'Not found',
|
|
1551
1629
|
messageKey: message_keys/* .FLOW_MESSAGES.NOT_FOUND */.wu.NOT_FOUND
|
|
1552
1630
|
});
|
|
1553
1631
|
request.flowDefinition = flow;
|
|
1554
1632
|
request.flowEndpoint = endpoint;
|
|
1555
1633
|
const ip = request.ip ?? request.socket?.remoteAddress ?? 'unknown';
|
|
1556
|
-
if (!limiter.hit(`${flow.id}|${
|
|
1634
|
+
if (!limiter.hit(`${flow.id}|${ip}`, flow.rateLimitPerMinute)) {
|
|
1557
1635
|
throw new common_.HttpException({
|
|
1558
1636
|
message: 'Too many requests. Try again in a minute.',
|
|
1559
1637
|
messageKey: message_keys/* .FLOW_MESSAGES.RATE_LIMITED */.wu.RATE_LIMITED
|
|
1560
1638
|
}, common_.HttpStatus.TOO_MANY_REQUESTS);
|
|
1561
1639
|
}
|
|
1562
|
-
switch(
|
|
1640
|
+
switch(flow.authMode){
|
|
1563
1641
|
case 'public':
|
|
1564
1642
|
return true;
|
|
1565
1643
|
case 'api_key':
|
|
1566
1644
|
{
|
|
1645
|
+
const keys = await this.moduleRef.resolve(flow_api_key_service/* .FlowApiKeyService */.T, contextId, {
|
|
1646
|
+
strict: false
|
|
1647
|
+
});
|
|
1567
1648
|
const header = request.headers?.['x-api-key'];
|
|
1568
|
-
|
|
1649
|
+
const check = await keys.verify(flow.id, Array.isArray(header) ? header[0] : header);
|
|
1650
|
+
if (check === 'expired') throw new common_.UnauthorizedException({
|
|
1651
|
+
message: 'This API key has expired.',
|
|
1652
|
+
messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_EXPIRED */.wu.API_KEY_EXPIRED
|
|
1653
|
+
});
|
|
1654
|
+
if (check !== 'valid') {
|
|
1569
1655
|
throw new common_.UnauthorizedException({
|
|
1570
1656
|
message: 'A valid API key is required (x-api-key header).',
|
|
1571
1657
|
messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_INVALID */.wu.API_KEY_INVALID
|
|
@@ -1579,7 +1665,7 @@ class FlowAccessGuard {
|
|
|
1579
1665
|
case 'permission':
|
|
1580
1666
|
{
|
|
1581
1667
|
if (!await this.authenticate(context)) return false;
|
|
1582
|
-
await this.permissionCache.assertPermission(request.user,
|
|
1668
|
+
await this.permissionCache.assertPermission(request.user, flow.permissionCode || (0,flow_definition_service/* .defaultFlowPermissionCode */.Er)(flow.slug));
|
|
1583
1669
|
return true;
|
|
1584
1670
|
}
|
|
1585
1671
|
default:
|