@flusys/nestjs-entity-builder 9.1.0-rc.1 → 9.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.
Files changed (63) hide show
  1. package/README.md +52 -23
  2. package/config/entity-builder.constants.d.ts +2 -0
  3. package/config/message-keys.d.ts +102 -13
  4. package/controllers/definition-bundle.controller.d.ts +15 -0
  5. package/controllers/flow-definition.controller.d.ts +7 -1
  6. package/controllers/flow-runtime.controller.d.ts +16 -8
  7. package/controllers/index.d.ts +1 -1
  8. package/dtos/definition-bundle.dto.d.ts +57 -0
  9. package/dtos/flow.dto.d.ts +13 -20
  10. package/dtos/index.d.ts +1 -0
  11. package/entities/flow-definition.entity.d.ts +3 -9
  12. package/entities/flow-execution.entity.d.ts +3 -0
  13. package/entities/flow-version.entity.d.ts +10 -0
  14. package/entities/index.d.ts +3 -3
  15. package/fesm/21.js +105 -15
  16. package/fesm/458.js +695 -0
  17. package/fesm/{489.js → 582.js} +22 -30
  18. package/fesm/{996.js → 677.js} +1562 -1064
  19. package/fesm/794.js +135 -240
  20. package/fesm/{719.js → 870.js} +2065 -324
  21. package/fesm/{362.js → 897.js} +572 -8
  22. package/fesm/{606.js → 946.js} +621 -296
  23. package/fesm/config/index.js +15 -2
  24. package/fesm/controllers/index.js +9 -9
  25. package/fesm/docs/index.js +7 -4
  26. package/fesm/dtos/index.js +451 -256
  27. package/fesm/entities/index.js +58 -3
  28. package/fesm/guards/index.js +106 -22
  29. package/fesm/index.js +429 -937
  30. package/fesm/interfaces/index.js +19 -2
  31. package/fesm/modules/index.js +10 -627
  32. package/fesm/rule-engine/index.js +12 -3
  33. package/fesm/services/index.js +101 -29
  34. package/flow-engine/flow-api-key.d.ts +3 -7
  35. package/flow-engine/flow-graph.validator.d.ts +5 -4
  36. package/flow-engine/flow-permission-logic.d.ts +2 -0
  37. package/flow-engine/flow-run.types.d.ts +19 -9
  38. package/flow-engine/flow.types.d.ts +115 -11
  39. package/guards/designer-writable.interceptor.d.ts +12 -0
  40. package/guards/index.d.ts +1 -0
  41. package/interfaces/definition-bundle.interface.d.ts +111 -0
  42. package/interfaces/entity-builder-module.interface.d.ts +6 -0
  43. package/interfaces/flow-definition.interface.d.ts +13 -9
  44. package/interfaces/index.d.ts +1 -0
  45. package/package.json +5 -5
  46. package/rule-engine/rule-engine.service.d.ts +1 -0
  47. package/rule-engine/rule-permission.d.ts +3 -7
  48. package/services/definition-bundle.diff.d.ts +62 -0
  49. package/services/definition-bundle.file.d.ts +7 -0
  50. package/services/definition-bundle.service.d.ts +32 -0
  51. package/services/entity-builder-config.service.d.ts +2 -0
  52. package/services/entity-flow-scaffold.d.ts +4 -3
  53. package/services/flow-definition.service.d.ts +26 -12
  54. package/services/flow-execution.service.d.ts +7 -0
  55. package/services/flow-executor.service.d.ts +9 -8
  56. package/services/flow-runtime.service.d.ts +2 -1
  57. package/services/generic-entity.service.d.ts +1 -1
  58. package/services/index.d.ts +3 -1
  59. package/services/schema-evolution.service.d.ts +3 -1
  60. package/services/schema-sync.service.d.ts +6 -2
  61. package/controllers/flow-api-key.controller.d.ts +0 -14
  62. package/entities/flow-api-key.entity.d.ts +0 -10
  63. package/services/flow-api-key.service.d.ts +0 -31
@@ -1,16 +1,17 @@
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 = 606;
5
- export const __rspack_esm_ids = [606];
4
+ import * as __rspack_external__nestjs_platform_express_cb7ac6b9 from "@nestjs/platform-express";
5
+ export const __rspack_esm_id = 946;
6
+ export const __rspack_esm_ids = [946];
6
7
  export const __webpack_modules__ = {
7
- 2517(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
8
+ 729(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
8
9
 
9
10
  // EXPORTS
10
11
  __webpack_require__.d(__webpack_exports__, {
12
+ AP: () => (/* reexport */ DefinitionBundleController),
11
13
  hv: () => (/* reexport */ EntityDefinitionController),
12
14
  GX: () => (/* reexport */ FieldDefinitionController),
13
- Sv: () => (/* reexport */ FlowApiKeyController),
14
15
  W8: () => (/* reexport */ FlowDefinitionController),
15
16
  VU: () => (/* reexport */ FlowExecutionController),
16
17
  bw: () => (/* reexport */ FlowRuntimeController)
@@ -30,6 +31,8 @@ var guards_ = __webpack_require__(3513);
30
31
  var modules_ = __webpack_require__(1236);
31
32
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/config/message-keys.ts
32
33
  var message_keys = __webpack_require__(5732);
34
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/guards/designer-writable.interceptor.ts
35
+ var designer_writable_interceptor = __webpack_require__(417);
33
36
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/dtos/entity-definition.dto.ts
34
37
  var entity_definition_dto = __webpack_require__(680);
35
38
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/dtos/schema-change.dto.ts
@@ -76,6 +79,7 @@ function _ts_param(paramIndex, decorator) {
76
79
 
77
80
 
78
81
 
82
+
79
83
  class EntityDefinitionController extends (0,nestjs_shared_.createApiController)(entity_definition_dto/* .CreateDynamicEntityDto */.Ot, entity_definition_dto/* .UpdateEntityDefinitionDto */.hL, entity_definition_dto/* .EntityDefinitionResponseDto */.d_, {
80
84
  entityName: 'entity_builder.entity_definition',
81
85
  enabledEndpoints: [
@@ -316,6 +320,8 @@ _ts_decorate([
316
320
  EntityDefinitionController = _ts_decorate([
317
321
  (0,swagger_.ApiTags)('Entity Builder - Entity Definitions'),
318
322
  (0,common_.Controller)('entity-builder/entity-definitions'),
323
+ (0,common_.UseInterceptors)(designer_writable_interceptor/* .DesignerWritableInterceptor */.X),
324
+ (0,designer_writable_interceptor/* .DesignerWrites */.W)('createEntity', 'applyChange', 'applyDestructiveChange'),
319
325
  _ts_param(0, (0,common_.Inject)(entity_definition_service/* .EntityDefinitionService */.o)),
320
326
  _ts_param(1, (0,common_.Inject)(schema_sync_service/* .SchemaSyncService */.W)),
321
327
  _ts_param(2, (0,common_.Inject)(schema_evolution_service/* .SchemaEvolutionService */._)),
@@ -449,15 +455,7 @@ class CreateFlowDefinitionDto {
449
455
  slug;
450
456
  description;
451
457
  isActive;
452
- authMode;
453
- permissionCode;
454
- runAs;
455
- isTransactional;
456
- timeoutMs;
457
- rateLimitPerMinute;
458
458
  retainExecutions;
459
- bodyType;
460
- inputSchema;
461
459
  nodes;
462
460
  edges;
463
461
  }
@@ -472,7 +470,7 @@ flow_dto_ts_decorate([
472
470
  ], CreateFlowDefinitionDto.prototype, "name", void 0);
473
471
  flow_dto_ts_decorate([
474
472
  (0,swagger_.ApiProperty)({
475
- description: 'URL name: POST api-flows/<slug>',
473
+ description: 'URL name: POST api-flows/<slug> (and api-flows/<slug>/<path> for each Request step with a path)',
476
474
  example: 'create-order'
477
475
  }),
478
476
  (0,external_class_validator_.IsString)(),
@@ -496,62 +494,6 @@ flow_dto_ts_decorate([
496
494
  (0,external_class_validator_.IsOptional)(),
497
495
  flow_dto_ts_metadata("design:type", Boolean)
498
496
  ], 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);
555
497
  flow_dto_ts_decorate([
556
498
  (0,swagger_.ApiPropertyOptional)({
557
499
  default: 200
@@ -562,31 +504,12 @@ flow_dto_ts_decorate([
562
504
  (0,external_class_validator_.IsOptional)(),
563
505
  flow_dto_ts_metadata("design:type", Number)
564
506
  ], 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);
585
507
  flow_dto_ts_decorate([
586
508
  (0,swagger_.ApiProperty)({
587
509
  type: [
588
510
  Object
589
- ]
511
+ ],
512
+ description: 'Steps; each Request step (trigger) carries its own path, body (bodyType, inputSchema), access (authMode: signed-in by default, permissions: an AND / OR rule of permission codes), isTransactional, timeoutMs and rateLimitPerMinute'
590
513
  }),
591
514
  (0,external_class_validator_.IsArray)(),
592
515
  flow_dto_ts_metadata("design:type", Array)
@@ -611,7 +534,7 @@ flow_dto_ts_decorate([
611
534
  ], UpdateFlowDefinitionDto.prototype, "id", void 0);
612
535
  /**
613
536
  * A flow as the designer holds it, for a test run or a check: every setting is validated like a
614
- * saved flow's (run-as, auth mode, time-out and limits are bounded, the graph by `validateFlow`),
537
+ * saved flow's (the graph, with each Request step's access and limits, by `validateFlow`),
615
538
  * the name may still be empty, and the server-owned fields of a loaded flow are ignored.
616
539
  */ class FlowDraftDto extends (0,swagger_.OmitType)(CreateFlowDefinitionDto, [
617
540
  'name'
@@ -619,6 +542,7 @@ flow_dto_ts_decorate([
619
542
  name;
620
543
  id;
621
544
  version;
545
+ draft;
622
546
  createdAt;
623
547
  updatedAt;
624
548
  deletedAt;
@@ -643,6 +567,10 @@ flow_dto_ts_decorate([
643
567
  (0,external_class_validator_.Allow)(),
644
568
  flow_dto_ts_metadata("design:type", Object)
645
569
  ], FlowDraftDto.prototype, "version", void 0);
570
+ flow_dto_ts_decorate([
571
+ (0,external_class_validator_.Allow)(),
572
+ flow_dto_ts_metadata("design:type", Object)
573
+ ], FlowDraftDto.prototype, "draft", void 0);
646
574
  flow_dto_ts_decorate([
647
575
  (0,external_class_validator_.Allow)(),
648
576
  flow_dto_ts_metadata("design:type", Object)
@@ -699,6 +627,7 @@ flow_dto_ts_decorate([
699
627
  /** Runs a flow from the designer: a saved flow (flowId), an unsaved draft (definition), or both - flowId attributes/scopes the run while definition (the current draft, if sent) is what actually executes. */ class TestFlowDto {
700
628
  flowId;
701
629
  definition;
630
+ endpoint;
702
631
  input;
703
632
  mode;
704
633
  request;
@@ -721,7 +650,16 @@ flow_dto_ts_decorate([
721
650
  ], TestFlowDto.prototype, "definition", void 0);
722
651
  flow_dto_ts_decorate([
723
652
  (0,swagger_.ApiPropertyOptional)({
724
- description: 'The request body to test with: an object, or a list for a flow whose body is a list'
653
+ description: 'Path of the Request step to start at; left out, the one on the flow\'s own URL',
654
+ example: 'insert-many'
655
+ }),
656
+ (0,external_class_validator_.Matches)(flow_types/* .FLOW_ENDPOINT_PATH_PATTERN */.YO),
657
+ (0,external_class_validator_.IsOptional)(),
658
+ flow_dto_ts_metadata("design:type", String)
659
+ ], TestFlowDto.prototype, "endpoint", void 0);
660
+ flow_dto_ts_decorate([
661
+ (0,swagger_.ApiPropertyOptional)({
662
+ description: 'The request body to test with: an object, or a list for a Request step whose body is a list'
725
663
  }),
726
664
  (0,external_class_validator_.ValidateIf)((dto)=>!Array.isArray(dto.input)),
727
665
  (0,external_class_validator_.IsObject)(),
@@ -775,27 +713,37 @@ flow_dto_ts_decorate([
775
713
  (0,external_class_validator_.IsNotEmpty)(),
776
714
  flow_dto_ts_metadata("design:type", String)
777
715
  ], FlowIdDto.prototype, "flowId", void 0);
778
- class CreateFlowApiKeyDto extends FlowIdDto {
779
- name;
780
- expiresAt;
716
+ class PublishFlowDto {
717
+ id;
718
+ note;
781
719
  }
782
720
  flow_dto_ts_decorate([
783
- (0,swagger_.ApiProperty)({
784
- example: 'Shop backend'
785
- }),
786
- (0,external_class_validator_.IsString)(),
721
+ (0,swagger_.ApiProperty)(),
722
+ (0,external_class_validator_.IsUUID)(),
787
723
  (0,external_class_validator_.IsNotEmpty)(),
788
- (0,external_class_validator_.MaxLength)(100),
789
724
  flow_dto_ts_metadata("design:type", String)
790
- ], CreateFlowApiKeyDto.prototype, "name", void 0);
725
+ ], PublishFlowDto.prototype, "id", void 0);
791
726
  flow_dto_ts_decorate([
792
727
  (0,swagger_.ApiPropertyOptional)({
793
- description: 'ISO date-time after which the key stops working'
728
+ description: 'What changed in this version',
729
+ example: 'Checks the branch before saving'
794
730
  }),
795
- (0,external_class_validator_.IsISO8601)(),
731
+ (0,external_class_validator_.IsString)(),
796
732
  (0,external_class_validator_.IsOptional)(),
733
+ (0,external_class_validator_.MaxLength)(500),
797
734
  flow_dto_ts_metadata("design:type", String)
798
- ], CreateFlowApiKeyDto.prototype, "expiresAt", void 0);
735
+ ], PublishFlowDto.prototype, "note", void 0);
736
+ class FlowVersionRefDto extends FlowIdDto {
737
+ version;
738
+ }
739
+ flow_dto_ts_decorate([
740
+ (0,swagger_.ApiProperty)({
741
+ example: 3
742
+ }),
743
+ (0,external_class_validator_.IsInt)(),
744
+ (0,external_class_validator_.Min)(1),
745
+ flow_dto_ts_metadata("design:type", Number)
746
+ ], FlowVersionRefDto.prototype, "version", void 0);
799
747
  /** The id of a flow API key or a flow execution. */ class IdBodyDto {
800
748
  id;
801
749
  }
@@ -808,6 +756,8 @@ flow_dto_ts_decorate([
808
756
  class ListFlowExecutionsDto {
809
757
  flowId;
810
758
  status;
759
+ trigger;
760
+ endpointNodeId;
811
761
  page;
812
762
  pageSize;
813
763
  }
@@ -833,6 +783,28 @@ flow_dto_ts_decorate([
833
783
  (0,external_class_validator_.IsOptional)(),
834
784
  flow_dto_ts_metadata("design:type", String)
835
785
  ], ListFlowExecutionsDto.prototype, "status", void 0);
786
+ flow_dto_ts_decorate([
787
+ (0,swagger_.ApiPropertyOptional)({
788
+ enum: [
789
+ 'webhook',
790
+ 'test'
791
+ ]
792
+ }),
793
+ (0,external_class_validator_.IsIn)([
794
+ 'webhook',
795
+ 'test'
796
+ ]),
797
+ (0,external_class_validator_.IsOptional)(),
798
+ flow_dto_ts_metadata("design:type", String)
799
+ ], ListFlowExecutionsDto.prototype, "trigger", void 0);
800
+ flow_dto_ts_decorate([
801
+ (0,swagger_.ApiPropertyOptional)({
802
+ description: 'Only runs that came in through this Request step'
803
+ }),
804
+ (0,external_class_validator_.Matches)(flow_types/* .FLOW_NODE_ID_PATTERN */.z6),
805
+ (0,external_class_validator_.IsOptional)(),
806
+ flow_dto_ts_metadata("design:type", String)
807
+ ], ListFlowExecutionsDto.prototype, "endpointNodeId", void 0);
836
808
  flow_dto_ts_decorate([
837
809
  (0,swagger_.ApiPropertyOptional)({
838
810
  default: 0
@@ -857,18 +829,11 @@ class FlowDefinitionResponseDto extends dtos_.IdentityResponseDto {
857
829
  slug;
858
830
  description;
859
831
  isActive;
860
- authMode;
861
- permissionCode;
862
- runAs;
863
- isTransactional;
864
- timeoutMs;
865
- rateLimitPerMinute;
866
832
  retainExecutions;
867
- bodyType;
868
- inputSchema;
869
833
  nodes;
870
834
  edges;
871
835
  version;
836
+ draft;
872
837
  }
873
838
  flow_dto_ts_decorate([
874
839
  (0,external_class_transformer_.Expose)(),
@@ -890,53 +855,11 @@ flow_dto_ts_decorate([
890
855
  (0,swagger_.ApiProperty)(),
891
856
  flow_dto_ts_metadata("design:type", Boolean)
892
857
  ], FlowDefinitionResponseDto.prototype, "isActive", void 0);
893
- flow_dto_ts_decorate([
894
- (0,external_class_transformer_.Expose)(),
895
- (0,swagger_.ApiProperty)(),
896
- flow_dto_ts_metadata("design:type", typeof FlowAuthMode === "undefined" ? Object : FlowAuthMode)
897
- ], FlowDefinitionResponseDto.prototype, "authMode", void 0);
898
- flow_dto_ts_decorate([
899
- (0,external_class_transformer_.Expose)(),
900
- (0,swagger_.ApiProperty)(),
901
- flow_dto_ts_metadata("design:type", Object)
902
- ], FlowDefinitionResponseDto.prototype, "permissionCode", 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 FlowRunAs === "undefined" ? Object : FlowRunAs)
907
- ], FlowDefinitionResponseDto.prototype, "runAs", void 0);
908
- flow_dto_ts_decorate([
909
- (0,external_class_transformer_.Expose)(),
910
- (0,swagger_.ApiProperty)(),
911
- flow_dto_ts_metadata("design:type", Boolean)
912
- ], FlowDefinitionResponseDto.prototype, "isTransactional", void 0);
913
- flow_dto_ts_decorate([
914
- (0,external_class_transformer_.Expose)(),
915
- (0,swagger_.ApiProperty)(),
916
- flow_dto_ts_metadata("design:type", Number)
917
- ], FlowDefinitionResponseDto.prototype, "timeoutMs", void 0);
918
- flow_dto_ts_decorate([
919
- (0,external_class_transformer_.Expose)(),
920
- (0,swagger_.ApiProperty)(),
921
- flow_dto_ts_metadata("design:type", Number)
922
- ], FlowDefinitionResponseDto.prototype, "rateLimitPerMinute", void 0);
923
858
  flow_dto_ts_decorate([
924
859
  (0,external_class_transformer_.Expose)(),
925
860
  (0,swagger_.ApiProperty)(),
926
861
  flow_dto_ts_metadata("design:type", Number)
927
862
  ], FlowDefinitionResponseDto.prototype, "retainExecutions", void 0);
928
- flow_dto_ts_decorate([
929
- (0,external_class_transformer_.Expose)(),
930
- (0,swagger_.ApiProperty)({
931
- enum: flow_types/* .FLOW_BODY_TYPES */.Y3
932
- }),
933
- flow_dto_ts_metadata("design:type", typeof FlowBodyType === "undefined" ? Object : FlowBodyType)
934
- ], FlowDefinitionResponseDto.prototype, "bodyType", void 0);
935
- flow_dto_ts_decorate([
936
- (0,external_class_transformer_.Expose)(),
937
- (0,swagger_.ApiProperty)(),
938
- flow_dto_ts_metadata("design:type", Array)
939
- ], FlowDefinitionResponseDto.prototype, "inputSchema", void 0);
940
863
  flow_dto_ts_decorate([
941
864
  (0,external_class_transformer_.Expose)(),
942
865
  (0,swagger_.ApiProperty)(),
@@ -949,9 +872,19 @@ flow_dto_ts_decorate([
949
872
  ], FlowDefinitionResponseDto.prototype, "edges", void 0);
950
873
  flow_dto_ts_decorate([
951
874
  (0,external_class_transformer_.Expose)(),
952
- (0,swagger_.ApiProperty)(),
875
+ (0,swagger_.ApiProperty)({
876
+ description: 'The published version; 0 until the flow is first published'
877
+ }),
953
878
  flow_dto_ts_metadata("design:type", Number)
954
879
  ], FlowDefinitionResponseDto.prototype, "version", void 0);
880
+ flow_dto_ts_decorate([
881
+ (0,external_class_transformer_.Expose)(),
882
+ (0,swagger_.ApiProperty)({
883
+ description: 'Saved changes not yet published',
884
+ nullable: true
885
+ }),
886
+ flow_dto_ts_metadata("design:type", Object)
887
+ ], FlowDefinitionResponseDto.prototype, "draft", void 0);
955
888
 
956
889
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
957
890
  var flow_definition_service = __webpack_require__(5229);
@@ -990,6 +923,7 @@ function flow_definition_controller_ts_param(paramIndex, decorator) {
990
923
 
991
924
 
992
925
 
926
+
993
927
  const P = nestjs_shared_.FLOW_DEFINITION_PERMISSIONS;
994
928
  class FlowDefinitionController extends (0,nestjs_shared_.createApiController)(CreateFlowDefinitionDto, UpdateFlowDefinitionDto, FlowDefinitionResponseDto, {
995
929
  entityName: 'entity_builder.flow_definition',
@@ -1061,6 +995,55 @@ class FlowDefinitionController extends (0,nestjs_shared_.createApiController)(Cr
1061
995
  data: result
1062
996
  };
1063
997
  }
998
+ async publish(dto, user) {
999
+ const flow = await this.flowDefinitionService.publish(dto.id, dto.note, user);
1000
+ return {
1001
+ success: true,
1002
+ message: `Version ${flow.version} published`,
1003
+ messageKey: message_keys/* .FLOW_MESSAGES.PUBLISH_SUCCESS */.wu.PUBLISH_SUCCESS,
1004
+ messageVariables: {
1005
+ version: flow.version
1006
+ },
1007
+ data: flow
1008
+ };
1009
+ }
1010
+ async versions(dto) {
1011
+ return {
1012
+ success: true,
1013
+ message: 'Versions loaded',
1014
+ messageKey: message_keys/* .FLOW_MESSAGES.VERSIONS_SUCCESS */.wu.VERSIONS_SUCCESS,
1015
+ data: await this.flowDefinitionService.listVersions(dto.flowId)
1016
+ };
1017
+ }
1018
+ async version(dto) {
1019
+ return {
1020
+ success: true,
1021
+ message: 'Version loaded',
1022
+ messageKey: message_keys/* .FLOW_MESSAGES.VERSION_SUCCESS */.wu.VERSION_SUCCESS,
1023
+ data: await this.flowDefinitionService.getVersion(dto.flowId, dto.version)
1024
+ };
1025
+ }
1026
+ async restoreVersion(dto, user) {
1027
+ const flow = await this.flowDefinitionService.restoreVersion(dto.flowId, dto.version, user);
1028
+ return {
1029
+ success: true,
1030
+ message: `Version ${dto.version} restored to the draft`,
1031
+ messageKey: message_keys/* .FLOW_MESSAGES.VERSION_RESTORED */.wu.VERSION_RESTORED,
1032
+ messageVariables: {
1033
+ version: dto.version
1034
+ },
1035
+ data: flow
1036
+ };
1037
+ }
1038
+ async discardDraft(dto, user) {
1039
+ const flow = await this.flowDefinitionService.discardDraft(dto.flowId, user);
1040
+ return {
1041
+ success: true,
1042
+ message: 'Unpublished changes discarded',
1043
+ messageKey: message_keys/* .FLOW_MESSAGES.DRAFT_DISCARDED */.wu.DRAFT_DISCARDED,
1044
+ data: flow
1045
+ };
1046
+ }
1064
1047
  async testRun(dto, user, req) {
1065
1048
  const { result, warnings } = await this.runtime.testRun(dto, user, {
1066
1049
  ip: req.ip ?? null,
@@ -1096,6 +1079,109 @@ flow_definition_controller_ts_decorate([
1096
1079
  ]),
1097
1080
  flow_definition_controller_ts_metadata("design:returntype", Promise)
1098
1081
  ], FlowDefinitionController.prototype, "validate", null);
1082
+ flow_definition_controller_ts_decorate([
1083
+ (0,common_.Post)('publish'),
1084
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1085
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1086
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.UPDATE),
1087
+ (0,swagger_.ApiBearerAuth)(),
1088
+ (0,swagger_.ApiOperation)({
1089
+ summary: 'Make the saved changes live as the next version',
1090
+ description: 'Checked like a save, plus that no other flow calls a URL name or path this version drops.'
1091
+ }),
1092
+ (0,swagger_.ApiBody)({
1093
+ type: PublishFlowDto
1094
+ }),
1095
+ flow_definition_controller_ts_param(0, (0,common_.Body)()),
1096
+ flow_definition_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
1097
+ flow_definition_controller_ts_metadata("design:type", Function),
1098
+ flow_definition_controller_ts_metadata("design:paramtypes", [
1099
+ typeof PublishFlowDto === "undefined" ? Object : PublishFlowDto,
1100
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
1101
+ ]),
1102
+ flow_definition_controller_ts_metadata("design:returntype", Promise)
1103
+ ], FlowDefinitionController.prototype, "publish", null);
1104
+ flow_definition_controller_ts_decorate([
1105
+ (0,common_.Post)('versions'),
1106
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1107
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1108
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.READ),
1109
+ (0,swagger_.ApiBearerAuth)(),
1110
+ (0,swagger_.ApiOperation)({
1111
+ summary: 'Published versions of a flow, newest first'
1112
+ }),
1113
+ (0,swagger_.ApiBody)({
1114
+ type: FlowIdDto
1115
+ }),
1116
+ flow_definition_controller_ts_param(0, (0,common_.Body)()),
1117
+ flow_definition_controller_ts_metadata("design:type", Function),
1118
+ flow_definition_controller_ts_metadata("design:paramtypes", [
1119
+ typeof FlowIdDto === "undefined" ? Object : FlowIdDto
1120
+ ]),
1121
+ flow_definition_controller_ts_metadata("design:returntype", Promise)
1122
+ ], FlowDefinitionController.prototype, "versions", null);
1123
+ flow_definition_controller_ts_decorate([
1124
+ (0,common_.Post)('version'),
1125
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1126
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1127
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.READ),
1128
+ (0,swagger_.ApiBearerAuth)(),
1129
+ (0,swagger_.ApiOperation)({
1130
+ summary: 'One published version in full'
1131
+ }),
1132
+ (0,swagger_.ApiBody)({
1133
+ type: FlowVersionRefDto
1134
+ }),
1135
+ flow_definition_controller_ts_param(0, (0,common_.Body)()),
1136
+ flow_definition_controller_ts_metadata("design:type", Function),
1137
+ flow_definition_controller_ts_metadata("design:paramtypes", [
1138
+ typeof FlowVersionRefDto === "undefined" ? Object : FlowVersionRefDto
1139
+ ]),
1140
+ flow_definition_controller_ts_metadata("design:returntype", Promise)
1141
+ ], FlowDefinitionController.prototype, "version", null);
1142
+ flow_definition_controller_ts_decorate([
1143
+ (0,common_.Post)('restore-version'),
1144
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1145
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1146
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.UPDATE),
1147
+ (0,swagger_.ApiBearerAuth)(),
1148
+ (0,swagger_.ApiOperation)({
1149
+ summary: 'Put an old version back into the draft',
1150
+ description: 'Callers keep running the published flow until the draft is published.'
1151
+ }),
1152
+ (0,swagger_.ApiBody)({
1153
+ type: FlowVersionRefDto
1154
+ }),
1155
+ flow_definition_controller_ts_param(0, (0,common_.Body)()),
1156
+ flow_definition_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
1157
+ flow_definition_controller_ts_metadata("design:type", Function),
1158
+ flow_definition_controller_ts_metadata("design:paramtypes", [
1159
+ typeof FlowVersionRefDto === "undefined" ? Object : FlowVersionRefDto,
1160
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
1161
+ ]),
1162
+ flow_definition_controller_ts_metadata("design:returntype", Promise)
1163
+ ], FlowDefinitionController.prototype, "restoreVersion", null);
1164
+ flow_definition_controller_ts_decorate([
1165
+ (0,common_.Post)('discard-draft'),
1166
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1167
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1168
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.UPDATE),
1169
+ (0,swagger_.ApiBearerAuth)(),
1170
+ (0,swagger_.ApiOperation)({
1171
+ summary: 'Drop the unpublished changes: the flow goes back to what is published'
1172
+ }),
1173
+ (0,swagger_.ApiBody)({
1174
+ type: FlowIdDto
1175
+ }),
1176
+ flow_definition_controller_ts_param(0, (0,common_.Body)()),
1177
+ flow_definition_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
1178
+ flow_definition_controller_ts_metadata("design:type", Function),
1179
+ flow_definition_controller_ts_metadata("design:paramtypes", [
1180
+ typeof FlowIdDto === "undefined" ? Object : FlowIdDto,
1181
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
1182
+ ]),
1183
+ flow_definition_controller_ts_metadata("design:returntype", Promise)
1184
+ ], FlowDefinitionController.prototype, "discardDraft", null);
1099
1185
  flow_definition_controller_ts_decorate([
1100
1186
  (0,common_.Post)('test-run'),
1101
1187
  (0,common_.HttpCode)(common_.HttpStatus.OK),
@@ -1123,6 +1209,8 @@ flow_definition_controller_ts_decorate([
1123
1209
  FlowDefinitionController = flow_definition_controller_ts_decorate([
1124
1210
  (0,swagger_.ApiTags)('Entity Builder - Flows'),
1125
1211
  (0,common_.Controller)('entity-builder/flows'),
1212
+ (0,common_.UseInterceptors)(designer_writable_interceptor/* .DesignerWritableInterceptor */.X),
1213
+ (0,designer_writable_interceptor/* .DesignerWrites */.W)('insert', 'update', 'delete', 'publish', 'restoreVersion', 'discardDraft'),
1126
1214
  flow_definition_controller_ts_param(0, (0,common_.Inject)(flow_definition_service/* .FlowDefinitionService */.Tk)),
1127
1215
  flow_definition_controller_ts_param(1, (0,common_.Inject)(flow_runtime_service/* .FlowRuntimeService */.a)),
1128
1216
  flow_definition_controller_ts_metadata("design:type", Function),
@@ -1132,128 +1220,6 @@ FlowDefinitionController = flow_definition_controller_ts_decorate([
1132
1220
  ])
1133
1221
  ], FlowDefinitionController);
1134
1222
 
1135
- // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-api-key.service.ts + 1 modules
1136
- var flow_api_key_service = __webpack_require__(8888);
1137
- ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-api-key.controller.ts
1138
- function flow_api_key_controller_ts_decorate(decorators, target, key, desc) {
1139
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1140
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1141
- r = Reflect.decorate(decorators, target, key, desc);
1142
- } else {
1143
- for(var i = decorators.length - 1; i >= 0; i--){
1144
- if (d = decorators[i]) {
1145
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1146
- }
1147
- }
1148
- }
1149
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1150
- }
1151
- function flow_api_key_controller_ts_metadata(metadataKey, metadataValue) {
1152
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1153
- return Reflect.metadata(metadataKey, metadataValue);
1154
- }
1155
- }
1156
- function flow_api_key_controller_ts_param(paramIndex, decorator) {
1157
- return function(target, key) {
1158
- decorator(target, key, paramIndex);
1159
- };
1160
- }
1161
-
1162
-
1163
-
1164
-
1165
-
1166
-
1167
-
1168
-
1169
- const flow_api_key_controller_P = nestjs_shared_.FLOW_DEFINITION_PERMISSIONS;
1170
- const ok = (data, message, messageKey)=>({
1171
- success: true,
1172
- message,
1173
- messageKey,
1174
- data
1175
- });
1176
- class FlowApiKeyController {
1177
- keys;
1178
- constructor(keys){
1179
- this.keys = keys;
1180
- }
1181
- async create(dto, user) {
1182
- 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);
1183
- }
1184
- async list(dto) {
1185
- return ok(await this.keys.list(dto.flowId), 'API keys loaded', message_keys/* .FLOW_MESSAGES.API_KEY_LIST_SUCCESS */.wu.API_KEY_LIST_SUCCESS);
1186
- }
1187
- async revoke(dto) {
1188
- await this.keys.revoke(dto.id);
1189
- return ok(null, 'API key revoked', message_keys/* .FLOW_MESSAGES.API_KEY_REVOKE_SUCCESS */.wu.API_KEY_REVOKE_SUCCESS);
1190
- }
1191
- async remove(dto) {
1192
- await this.keys.remove(dto.id);
1193
- return ok(null, 'API key deleted', message_keys/* .FLOW_MESSAGES.API_KEY_DELETE_SUCCESS */.wu.API_KEY_DELETE_SUCCESS);
1194
- }
1195
- }
1196
- flow_api_key_controller_ts_decorate([
1197
- (0,common_.Post)('create'),
1198
- (0,common_.HttpCode)(common_.HttpStatus.OK),
1199
- (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
1200
- (0,swagger_.ApiOperation)({
1201
- summary: 'Create an API key. The key is in the response once and cannot be shown again.'
1202
- }),
1203
- flow_api_key_controller_ts_param(0, (0,common_.Body)()),
1204
- flow_api_key_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
1205
- flow_api_key_controller_ts_metadata("design:type", Function),
1206
- flow_api_key_controller_ts_metadata("design:paramtypes", [
1207
- typeof CreateFlowApiKeyDto === "undefined" ? Object : CreateFlowApiKeyDto,
1208
- typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
1209
- ]),
1210
- flow_api_key_controller_ts_metadata("design:returntype", Promise)
1211
- ], FlowApiKeyController.prototype, "create", null);
1212
- flow_api_key_controller_ts_decorate([
1213
- (0,common_.Post)('list'),
1214
- (0,common_.HttpCode)(common_.HttpStatus.OK),
1215
- (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.READ),
1216
- flow_api_key_controller_ts_param(0, (0,common_.Body)()),
1217
- flow_api_key_controller_ts_metadata("design:type", Function),
1218
- flow_api_key_controller_ts_metadata("design:paramtypes", [
1219
- typeof FlowIdDto === "undefined" ? Object : FlowIdDto
1220
- ]),
1221
- flow_api_key_controller_ts_metadata("design:returntype", Promise)
1222
- ], FlowApiKeyController.prototype, "list", null);
1223
- flow_api_key_controller_ts_decorate([
1224
- (0,common_.Post)('revoke'),
1225
- (0,common_.HttpCode)(common_.HttpStatus.OK),
1226
- (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
1227
- flow_api_key_controller_ts_param(0, (0,common_.Body)()),
1228
- flow_api_key_controller_ts_metadata("design:type", Function),
1229
- flow_api_key_controller_ts_metadata("design:paramtypes", [
1230
- typeof IdBodyDto === "undefined" ? Object : IdBodyDto
1231
- ]),
1232
- flow_api_key_controller_ts_metadata("design:returntype", Promise)
1233
- ], FlowApiKeyController.prototype, "revoke", null);
1234
- flow_api_key_controller_ts_decorate([
1235
- (0,common_.Post)('delete'),
1236
- (0,common_.HttpCode)(common_.HttpStatus.OK),
1237
- (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
1238
- flow_api_key_controller_ts_param(0, (0,common_.Body)()),
1239
- flow_api_key_controller_ts_metadata("design:type", Function),
1240
- flow_api_key_controller_ts_metadata("design:paramtypes", [
1241
- typeof IdBodyDto === "undefined" ? Object : IdBodyDto
1242
- ]),
1243
- flow_api_key_controller_ts_metadata("design:returntype", Promise)
1244
- ], FlowApiKeyController.prototype, "remove", null);
1245
- FlowApiKeyController = flow_api_key_controller_ts_decorate([
1246
- (0,swagger_.ApiTags)('Entity Builder - Flow API keys'),
1247
- (0,common_.Controller)('entity-builder/flow-api-keys'),
1248
- (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1249
- (0,swagger_.ApiBearerAuth)(),
1250
- flow_api_key_controller_ts_param(0, (0,common_.Inject)(flow_api_key_service/* .FlowApiKeyService */.T)),
1251
- flow_api_key_controller_ts_metadata("design:type", Function),
1252
- flow_api_key_controller_ts_metadata("design:paramtypes", [
1253
- typeof flow_api_key_service/* .FlowApiKeyService */.T === "undefined" ? Object : flow_api_key_service/* .FlowApiKeyService */.T
1254
- ])
1255
- ], FlowApiKeyController);
1256
-
1257
1223
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-execution.service.ts
1258
1224
  var flow_execution_service = __webpack_require__(7810);
1259
1225
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-execution.controller.ts
@@ -1299,6 +1265,8 @@ class FlowExecutionController {
1299
1265
  const { rows, total } = await this.executions.list({
1300
1266
  flowId: dto.flowId,
1301
1267
  status: dto.status,
1268
+ trigger: dto.trigger,
1269
+ endpointNodeId: dto.endpointNodeId,
1302
1270
  page,
1303
1271
  pageSize
1304
1272
  });
@@ -1398,8 +1366,14 @@ class FlowRuntimeController {
1398
1366
  constructor(runtime){
1399
1367
  this.runtime = runtime;
1400
1368
  }
1401
- async run(_slug, body, req, res) {
1402
- const result = await this.runtime.handle(req.flowDefinition, body, {
1369
+ run(_slug, body, req, res) {
1370
+ return this.answer(body, req, res);
1371
+ }
1372
+ runEndpoint(_slug, _endpoint, body, req, res) {
1373
+ return this.answer(body, req, res);
1374
+ }
1375
+ async answer(body, req, res) {
1376
+ const result = await this.runtime.handle(req.flowDefinition, req.flowEndpoint, body, {
1403
1377
  ip: req.ip ?? null,
1404
1378
  headers: req.headers,
1405
1379
  query: req.query ?? {},
@@ -1429,11 +1403,41 @@ flow_runtime_controller_ts_decorate([
1429
1403
  flow_runtime_controller_ts_metadata("design:paramtypes", [
1430
1404
  String,
1431
1405
  Object,
1432
- Object,
1406
+ typeof FlowRequest === "undefined" ? Object : FlowRequest,
1433
1407
  Object
1434
1408
  ]),
1435
- flow_runtime_controller_ts_metadata("design:returntype", Promise)
1409
+ flow_runtime_controller_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1436
1410
  ], FlowRuntimeController.prototype, "run", null);
1411
+ flow_runtime_controller_ts_decorate([
1412
+ (0,common_.Post)(':slug/:endpoint'),
1413
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1414
+ (0,common_.UseGuards)(flow_access_guard/* .FlowAccessGuard */.C),
1415
+ (0,swagger_.ApiOperation)({
1416
+ summary: 'Call one of the URLs of a flow'
1417
+ }),
1418
+ (0,swagger_.ApiParam)({
1419
+ name: 'slug'
1420
+ }),
1421
+ (0,swagger_.ApiParam)({
1422
+ name: 'endpoint'
1423
+ }),
1424
+ flow_runtime_controller_ts_param(0, (0,common_.Param)('slug')),
1425
+ flow_runtime_controller_ts_param(1, (0,common_.Param)('endpoint')),
1426
+ flow_runtime_controller_ts_param(2, (0,common_.Body)()),
1427
+ flow_runtime_controller_ts_param(3, (0,common_.Req)()),
1428
+ flow_runtime_controller_ts_param(4, (0,common_.Res)({
1429
+ passthrough: true
1430
+ })),
1431
+ flow_runtime_controller_ts_metadata("design:type", Function),
1432
+ flow_runtime_controller_ts_metadata("design:paramtypes", [
1433
+ String,
1434
+ String,
1435
+ Object,
1436
+ typeof FlowRequest === "undefined" ? Object : FlowRequest,
1437
+ Object
1438
+ ]),
1439
+ flow_runtime_controller_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
1440
+ ], FlowRuntimeController.prototype, "runEndpoint", null);
1437
1441
  FlowRuntimeController = flow_runtime_controller_ts_decorate([
1438
1442
  (0,swagger_.ApiTags)('Flows (virtual APIs)'),
1439
1443
  (0,common_.Controller)('api-flows'),
@@ -1444,6 +1448,251 @@ FlowRuntimeController = flow_runtime_controller_ts_decorate([
1444
1448
  ])
1445
1449
  ], FlowRuntimeController);
1446
1450
 
1451
+ ;// CONCATENATED MODULE: external "@nestjs/platform-express"
1452
+
1453
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/config/entity-builder.constants.ts
1454
+ var entity_builder_constants = __webpack_require__(6576);
1455
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/dtos/definition-bundle.dto.ts
1456
+ var definition_bundle_dto = __webpack_require__(6691);
1457
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/definition-bundle.diff.ts
1458
+ var definition_bundle_diff = __webpack_require__(3801);
1459
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/definition-bundle.file.ts
1460
+ var definition_bundle_file = __webpack_require__(6412);
1461
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/definition-bundle.service.ts
1462
+ var definition_bundle_service = __webpack_require__(7463);
1463
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/entity-builder-config.service.ts
1464
+ var entity_builder_config_service = __webpack_require__(4281);
1465
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/definition-bundle.controller.ts
1466
+ function definition_bundle_controller_ts_decorate(decorators, target, key, desc) {
1467
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1468
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1469
+ r = Reflect.decorate(decorators, target, key, desc);
1470
+ } else {
1471
+ for(var i = decorators.length - 1; i >= 0; i--){
1472
+ if (d = decorators[i]) {
1473
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1474
+ }
1475
+ }
1476
+ }
1477
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1478
+ }
1479
+ function definition_bundle_controller_ts_metadata(metadataKey, metadataValue) {
1480
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1481
+ return Reflect.metadata(metadataKey, metadataValue);
1482
+ }
1483
+ }
1484
+ function definition_bundle_controller_ts_param(paramIndex, decorator) {
1485
+ return function(target, key) {
1486
+ decorator(target, key, paramIndex);
1487
+ };
1488
+ }
1489
+
1490
+
1491
+
1492
+
1493
+
1494
+
1495
+
1496
+
1497
+
1498
+
1499
+
1500
+
1501
+
1502
+ /** The bundle is uploaded as a file (not JSON): the app's JSON body limit never applies, only this package's own. */ const BundleUpload = ()=>(0,common_.UseInterceptors)((0,__rspack_external__nestjs_platform_express_cb7ac6b9.FileInterceptor)('bundle', {
1503
+ limits: {
1504
+ fileSize: entity_builder_constants/* .ENTITY_BUNDLE_MAX_BYTES */.EA,
1505
+ files: 1,
1506
+ fields: 10
1507
+ }
1508
+ }));
1509
+ const IMPORT_BODY = {
1510
+ schema: {
1511
+ type: 'object',
1512
+ required: [
1513
+ 'bundle'
1514
+ ],
1515
+ properties: {
1516
+ bundle: {
1517
+ type: 'string',
1518
+ format: 'binary',
1519
+ description: `The bundle file an export wrote (JSON, at most ${entity_builder_constants/* .ENTITY_BUNDLE_MAX_BYTES */.EA / 1024 / 1024} MB)`
1520
+ },
1521
+ deprecateMissingFields: {
1522
+ type: 'boolean',
1523
+ description: 'Deprecate fields this environment has and the bundle does not (their columns and data stay)'
1524
+ },
1525
+ confirm: {
1526
+ type: 'boolean',
1527
+ description: 'apply-import: acknowledge steps that lose (or may lose) data'
1528
+ },
1529
+ expectedChecksum: {
1530
+ type: 'string',
1531
+ description: 'apply-import: the checksum of the bundle that was reviewed'
1532
+ },
1533
+ expectedPlanChecksum: {
1534
+ type: 'string',
1535
+ description: 'apply-import: the planChecksum of the plan that was reviewed (required with confirm)'
1536
+ }
1537
+ }
1538
+ }
1539
+ };
1540
+ const IMPORT_PERMISSIONS = [
1541
+ nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.CREATE,
1542
+ nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.UPDATE,
1543
+ nestjs_shared_.FLOW_DEFINITION_PERMISSIONS.CREATE,
1544
+ nestjs_shared_.FLOW_DEFINITION_PERMISSIONS.UPDATE
1545
+ ];
1546
+ class DefinitionBundleController {
1547
+ bundles;
1548
+ config;
1549
+ constructor(bundles, config){
1550
+ this.bundles = bundles;
1551
+ this.config = config;
1552
+ }
1553
+ settings() {
1554
+ const data = {
1555
+ readOnly: this.config.isDesignerReadOnly(),
1556
+ variables: Object.keys(this.config.getBundleVariables()).toSorted(definition_bundle_diff/* .byCode */.VU)
1557
+ };
1558
+ return {
1559
+ success: true,
1560
+ message: 'Settings loaded',
1561
+ messageKey: message_keys/* .BUNDLE_MESSAGES.SETTINGS_SUCCESS */.iX.SETTINGS_SUCCESS,
1562
+ data
1563
+ };
1564
+ }
1565
+ async export(dto) {
1566
+ return {
1567
+ success: true,
1568
+ message: 'Bundle exported',
1569
+ messageKey: message_keys/* .BUNDLE_MESSAGES.EXPORT_SUCCESS */.iX.EXPORT_SUCCESS,
1570
+ data: await this.bundles.export(dto)
1571
+ };
1572
+ }
1573
+ async planImport(file, options, user) {
1574
+ const data = await this.bundles.planImport({
1575
+ ...options,
1576
+ bundle: (0,definition_bundle_file/* .readBundleFile */.z)(file)
1577
+ }, user);
1578
+ return {
1579
+ success: true,
1580
+ message: 'Import planned',
1581
+ messageKey: message_keys/* .BUNDLE_MESSAGES.PLAN_SUCCESS */.iX.PLAN_SUCCESS,
1582
+ data
1583
+ };
1584
+ }
1585
+ async applyImport(file, options, user) {
1586
+ const data = await this.bundles.applyImport({
1587
+ ...options,
1588
+ bundle: (0,definition_bundle_file/* .readBundleFile */.z)(file)
1589
+ }, user);
1590
+ return data.completed ? {
1591
+ success: true,
1592
+ message: 'Bundle imported',
1593
+ messageKey: message_keys/* .BUNDLE_MESSAGES.APPLY_SUCCESS */.iX.APPLY_SUCCESS,
1594
+ data
1595
+ } : {
1596
+ success: false,
1597
+ message: 'The import stopped at a step that failed. The steps before it were applied.',
1598
+ messageKey: message_keys/* .BUNDLE_MESSAGES.APPLY_PARTIAL */.iX.APPLY_PARTIAL,
1599
+ data
1600
+ };
1601
+ }
1602
+ }
1603
+ definition_bundle_controller_ts_decorate([
1604
+ (0,common_.Post)('settings'),
1605
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1606
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1607
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequireAnyPermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ, nestjs_shared_.FLOW_DEFINITION_PERMISSIONS.READ),
1608
+ (0,swagger_.ApiBearerAuth)(),
1609
+ (0,swagger_.ApiOperation)({
1610
+ summary: 'Whether the designer is read-only here, and the names of the variables this environment defines'
1611
+ }),
1612
+ definition_bundle_controller_ts_metadata("design:type", Function),
1613
+ definition_bundle_controller_ts_metadata("design:paramtypes", []),
1614
+ definition_bundle_controller_ts_metadata("design:returntype", typeof nestjs_shared_.SingleResponseDto === "undefined" ? Object : nestjs_shared_.SingleResponseDto)
1615
+ ], DefinitionBundleController.prototype, "settings", null);
1616
+ definition_bundle_controller_ts_decorate([
1617
+ (0,common_.Post)('export'),
1618
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1619
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1620
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ, nestjs_shared_.FLOW_DEFINITION_PERMISSIONS.READ),
1621
+ (0,swagger_.ApiBearerAuth)(),
1622
+ (0,swagger_.ApiOperation)({
1623
+ summary: 'Export entities and published flows as a bundle',
1624
+ description: 'Keyed by entity code, field id/code and flow slug; API keys left out and this environment\'s variable values replaced by `${var:NAME}`. Commit it to git and import it into the next environment.'
1625
+ }),
1626
+ (0,swagger_.ApiBody)({
1627
+ type: definition_bundle_dto/* .ExportBundleDto */.QJ
1628
+ }),
1629
+ definition_bundle_controller_ts_param(0, (0,common_.Body)()),
1630
+ definition_bundle_controller_ts_metadata("design:type", Function),
1631
+ definition_bundle_controller_ts_metadata("design:paramtypes", [
1632
+ typeof definition_bundle_dto/* .ExportBundleDto */.QJ === "undefined" ? Object : definition_bundle_dto/* .ExportBundleDto */.QJ
1633
+ ]),
1634
+ definition_bundle_controller_ts_metadata("design:returntype", Promise)
1635
+ ], DefinitionBundleController.prototype, "export", null);
1636
+ definition_bundle_controller_ts_decorate([
1637
+ (0,common_.Post)('plan-import'),
1638
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1639
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1640
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(...IMPORT_PERMISSIONS),
1641
+ (0,swagger_.ApiBearerAuth)(),
1642
+ (0,swagger_.ApiOperation)({
1643
+ summary: 'Preview importing a bundle: nothing changes',
1644
+ description: 'Every step the import would run, in order, with the real SQL and data checks of each step that can be previewed on its own, the definitions this environment has and the bundle does not (never removed), and the blockers.'
1645
+ }),
1646
+ (0,swagger_.ApiConsumes)('multipart/form-data'),
1647
+ (0,swagger_.ApiBody)(IMPORT_BODY),
1648
+ BundleUpload(),
1649
+ definition_bundle_controller_ts_param(0, (0,common_.UploadedFile)()),
1650
+ definition_bundle_controller_ts_param(1, (0,common_.Body)()),
1651
+ definition_bundle_controller_ts_param(2, (0,nestjs_shared_.CurrentUser)()),
1652
+ definition_bundle_controller_ts_metadata("design:type", Function),
1653
+ definition_bundle_controller_ts_metadata("design:paramtypes", [
1654
+ Object,
1655
+ typeof definition_bundle_dto/* .ImportBundleOptionsDto */.vS === "undefined" ? Object : definition_bundle_dto/* .ImportBundleOptionsDto */.vS,
1656
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
1657
+ ]),
1658
+ definition_bundle_controller_ts_metadata("design:returntype", Promise)
1659
+ ], DefinitionBundleController.prototype, "planImport", null);
1660
+ definition_bundle_controller_ts_decorate([
1661
+ (0,common_.Post)('apply-import'),
1662
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1663
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1664
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(...IMPORT_PERMISSIONS),
1665
+ (0,swagger_.ApiBearerAuth)(),
1666
+ (0,swagger_.ApiOperation)({
1667
+ summary: 'Import a bundle',
1668
+ description: 'Refused while the plan has blockers, when it no longer matches expectedPlanChecksum, or when it loses data without confirm: true and expectedPlanChecksum. Steps run in order and the first that fails stops the import (the earlier ones stay); importing the same bundle again continues from there. Works while the designer is read-only. New API keys are answered once.'
1669
+ }),
1670
+ (0,swagger_.ApiConsumes)('multipart/form-data'),
1671
+ (0,swagger_.ApiBody)(IMPORT_BODY),
1672
+ BundleUpload(),
1673
+ definition_bundle_controller_ts_param(0, (0,common_.UploadedFile)()),
1674
+ definition_bundle_controller_ts_param(1, (0,common_.Body)()),
1675
+ definition_bundle_controller_ts_param(2, (0,nestjs_shared_.CurrentUser)()),
1676
+ definition_bundle_controller_ts_metadata("design:type", Function),
1677
+ definition_bundle_controller_ts_metadata("design:paramtypes", [
1678
+ Object,
1679
+ typeof definition_bundle_dto/* .ImportBundleOptionsDto */.vS === "undefined" ? Object : definition_bundle_dto/* .ImportBundleOptionsDto */.vS,
1680
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
1681
+ ]),
1682
+ definition_bundle_controller_ts_metadata("design:returntype", Promise)
1683
+ ], DefinitionBundleController.prototype, "applyImport", null);
1684
+ DefinitionBundleController = definition_bundle_controller_ts_decorate([
1685
+ (0,swagger_.ApiTags)('Entity Builder - Bundles'),
1686
+ (0,common_.Controller)('entity-builder/bundles'),
1687
+ definition_bundle_controller_ts_param(0, (0,common_.Inject)(definition_bundle_service/* .DefinitionBundleService */.P)),
1688
+ definition_bundle_controller_ts_param(1, (0,common_.Inject)(entity_builder_config_service/* .EntityBuilderConfigService */.E)),
1689
+ definition_bundle_controller_ts_metadata("design:type", Function),
1690
+ definition_bundle_controller_ts_metadata("design:paramtypes", [
1691
+ typeof definition_bundle_service/* .DefinitionBundleService */.P === "undefined" ? Object : definition_bundle_service/* .DefinitionBundleService */.P,
1692
+ typeof entity_builder_config_service/* .EntityBuilderConfigService */.E === "undefined" ? Object : entity_builder_config_service/* .EntityBuilderConfigService */.E
1693
+ ])
1694
+ ], DefinitionBundleController);
1695
+
1447
1696
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/index.ts
1448
1697
 
1449
1698
 
@@ -1453,6 +1702,84 @@ FlowRuntimeController = flow_runtime_controller_ts_decorate([
1453
1702
 
1454
1703
 
1455
1704
 
1705
+ },
1706
+ 417(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1707
+ /* import */ var _nestjs_common__rspack_import_0 = __webpack_require__(6157);
1708
+ /* import */ var _nestjs_core__rspack_import_1 = __webpack_require__(3075);
1709
+ /* import */ var _config_message_keys_js__rspack_import_4 = __webpack_require__(5732);
1710
+ /* import */ var _dtos_schema_change_dto_js__rspack_import_2 = __webpack_require__(4945);
1711
+ /* import */ var _services_entity_builder_config_service_js__rspack_import_3 = __webpack_require__(4281);
1712
+ function _ts_decorate(decorators, target, key, desc) {
1713
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1714
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1715
+ r = Reflect.decorate(decorators, target, key, desc);
1716
+ } else {
1717
+ for(var i = decorators.length - 1; i >= 0; i--){
1718
+ if (d = decorators[i]) {
1719
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1720
+ }
1721
+ }
1722
+ }
1723
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1724
+ }
1725
+ function _ts_metadata(metadataKey, metadataValue) {
1726
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1727
+ return Reflect.metadata(metadataKey, metadataValue);
1728
+ }
1729
+ }
1730
+ function _ts_param(paramIndex, decorator) {
1731
+ return function(target, key) {
1732
+ decorator(target, key, paramIndex);
1733
+ };
1734
+ }
1735
+
1736
+
1737
+
1738
+
1739
+
1740
+ const DESIGNER_WRITE_HANDLERS = 'entity_builder:designer_write_handlers';
1741
+ /** The handlers of a controller (inherited ones included) that change definitions by hand. */ const DesignerWrites = (...handlers)=>(0,_nestjs_common__rspack_import_0.SetMetadata)(DESIGNER_WRITE_HANDLERS, handlers);
1742
+ class DesignerWritableInterceptor {
1743
+ reflector;
1744
+ config;
1745
+ constructor(reflector, config){
1746
+ this.reflector = reflector;
1747
+ this.config = config;
1748
+ }
1749
+ intercept(context, next) {
1750
+ if (this.isLocked(context)) {
1751
+ throw new _nestjs_common__rspack_import_0.HttpException({
1752
+ message: 'Definitions are read-only in this environment. Change them where they are designed and import the bundle here.',
1753
+ messageKey: _config_message_keys_js__rspack_import_4/* .BUNDLE_MESSAGES.DESIGNER_READ_ONLY */.iX.DESIGNER_READ_ONLY
1754
+ }, _nestjs_common__rspack_import_0.HttpStatus.LOCKED);
1755
+ }
1756
+ return next.handle();
1757
+ }
1758
+ isLocked(context) {
1759
+ if (!this.config.isDesignerReadOnly()) return false;
1760
+ const handlers = this.reflector.get(DESIGNER_WRITE_HANDLERS, context.getClass()) ?? [];
1761
+ if (!handlers.includes(context.getHandler().name)) return false;
1762
+ return context.switchToHttp().getRequest().body?.action !== _dtos_schema_change_dto_js__rspack_import_2/* .SchemaChangeAction.REPAIR */.M3.REPAIR;
1763
+ }
1764
+ }
1765
+ DesignerWritableInterceptor = _ts_decorate([
1766
+ (0,_nestjs_common__rspack_import_0.Injectable)(),
1767
+ _ts_param(0, (0,_nestjs_common__rspack_import_0.Inject)(_nestjs_core__rspack_import_1.Reflector)),
1768
+ _ts_param(1, (0,_nestjs_common__rspack_import_0.Inject)(_services_entity_builder_config_service_js__rspack_import_3/* .EntityBuilderConfigService */.E)),
1769
+ _ts_metadata("design:type", Function),
1770
+ _ts_metadata("design:paramtypes", [
1771
+ typeof _nestjs_core__rspack_import_1.Reflector === "undefined" ? Object : _nestjs_core__rspack_import_1.Reflector,
1772
+ typeof _services_entity_builder_config_service_js__rspack_import_3/* .EntityBuilderConfigService */.E === "undefined" ? Object : _services_entity_builder_config_service_js__rspack_import_3/* .EntityBuilderConfigService */.E
1773
+ ])
1774
+ ], DesignerWritableInterceptor);
1775
+
1776
+ __webpack_require__.d(__webpack_exports__, {
1777
+ X: () => (DesignerWritableInterceptor)
1778
+ }, {
1779
+ W: DesignerWrites
1780
+ });
1781
+
1782
+
1456
1783
  },
1457
1784
  4196(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1458
1785
 
@@ -1477,8 +1804,6 @@ var core_ = __webpack_require__(3075);
1477
1804
  var message_keys = __webpack_require__(5732);
1478
1805
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
1479
1806
  var flow_definition_service = __webpack_require__(5229);
1480
- // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-api-key.service.ts + 1 modules
1481
- var flow_api_key_service = __webpack_require__(8888);
1482
1807
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-runtime.service.ts
1483
1808
  var flow_runtime_service = __webpack_require__(2300);
1484
1809
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-rate-limiter.ts
@@ -1522,6 +1847,10 @@ const DEFAULT_MAX_KEYS = 10_000;
1522
1847
  }
1523
1848
  }
1524
1849
 
1850
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-api-key.ts
1851
+ var flow_api_key = __webpack_require__(4816);
1852
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow.types.ts
1853
+ var flow_types = __webpack_require__(6256);
1525
1854
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/guards/flow-access.guard.ts
1526
1855
  function _ts_decorate(decorators, target, key, desc) {
1527
1856
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1557,6 +1886,7 @@ function _ts_param(paramIndex, decorator) {
1557
1886
 
1558
1887
 
1559
1888
 
1889
+
1560
1890
  const limiter = new FlowRateLimiter();
1561
1891
  class FlowAccessGuard {
1562
1892
  moduleRef;
@@ -1574,33 +1904,28 @@ class FlowAccessGuard {
1574
1904
  strict: false
1575
1905
  });
1576
1906
  const flow = slug ? await runtime.findActive(slug) : null;
1577
- if (!flow) throw new common_.NotFoundException({
1907
+ const endpoint = flow ? (0,flow_types/* .findEndpoint */.vS)(flow, request.params?.endpoint) : undefined;
1908
+ // A Request step for other flows only has no URL: it looks the same as an unknown one.
1909
+ if (!flow || !endpoint || endpoint.authMode === 'internal') throw new common_.NotFoundException({
1578
1910
  message: 'Not found',
1579
1911
  messageKey: message_keys/* .FLOW_MESSAGES.NOT_FOUND */.wu.NOT_FOUND
1580
1912
  });
1581
1913
  request.flowDefinition = flow;
1914
+ request.flowEndpoint = endpoint;
1582
1915
  const ip = request.ip ?? request.socket?.remoteAddress ?? 'unknown';
1583
- if (!limiter.hit(`${flow.id}|${ip}`, flow.rateLimitPerMinute)) {
1916
+ if (!limiter.hit(`${flow.id}|${endpoint.nodeId}|${ip}`, endpoint.rateLimitPerMinute)) {
1584
1917
  throw new common_.HttpException({
1585
1918
  message: 'Too many requests. Try again in a minute.',
1586
1919
  messageKey: message_keys/* .FLOW_MESSAGES.RATE_LIMITED */.wu.RATE_LIMITED
1587
1920
  }, common_.HttpStatus.TOO_MANY_REQUESTS);
1588
1921
  }
1589
- switch(flow.authMode){
1922
+ switch(endpoint.authMode){
1590
1923
  case 'public':
1591
1924
  return true;
1592
1925
  case 'api_key':
1593
1926
  {
1594
- const keys = await this.moduleRef.resolve(flow_api_key_service/* .FlowApiKeyService */.T, contextId, {
1595
- strict: false
1596
- });
1597
1927
  const header = request.headers?.['x-api-key'];
1598
- const check = await keys.verify(flow.id, Array.isArray(header) ? header[0] : header);
1599
- if (check === 'expired') throw new common_.UnauthorizedException({
1600
- message: 'This API key has expired.',
1601
- messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_EXPIRED */.wu.API_KEY_EXPIRED
1602
- });
1603
- if (check !== 'valid') {
1928
+ if (!(0,flow_api_key/* .apiKeyOpens */.NT)(endpoint.apiKey, Array.isArray(header) ? header[0] : header)) {
1604
1929
  throw new common_.UnauthorizedException({
1605
1930
  message: 'A valid API key is required (x-api-key header).',
1606
1931
  messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_INVALID */.wu.API_KEY_INVALID
@@ -1614,7 +1939,7 @@ class FlowAccessGuard {
1614
1939
  case 'permission':
1615
1940
  {
1616
1941
  if (!await this.authenticate(context)) return false;
1617
- await this.permissionCache.assertPermission(request.user, flow.permissionCode || (0,flow_definition_service/* .defaultFlowPermissionCode */.Er)(flow.slug));
1942
+ await this.permissionCache.assertPermissionLogic(request.user, (0,flow_definition_service/* .flowPermissions */.j4)(endpoint, flow.slug));
1618
1943
  return true;
1619
1944
  }
1620
1945
  default: