@flusys/nestjs-entity-builder 9.1.0 → 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 (61) hide show
  1. package/README.md +52 -25
  2. package/config/entity-builder.constants.d.ts +2 -0
  3. package/config/message-keys.d.ts +93 -12
  4. package/controllers/definition-bundle.controller.d.ts +15 -0
  5. package/controllers/flow-definition.controller.d.ts +7 -1
  6. package/controllers/index.d.ts +1 -1
  7. package/dtos/definition-bundle.dto.d.ts +57 -0
  8. package/dtos/flow.dto.d.ts +12 -20
  9. package/dtos/index.d.ts +1 -0
  10. package/entities/flow-definition.entity.d.ts +3 -9
  11. package/entities/flow-execution.entity.d.ts +3 -0
  12. package/entities/flow-version.entity.d.ts +10 -0
  13. package/entities/index.d.ts +3 -3
  14. package/fesm/21.js +96 -14
  15. package/fesm/458.js +695 -0
  16. package/fesm/{489.js → 582.js} +22 -30
  17. package/fesm/{996.js → 677.js} +1453 -1078
  18. package/fesm/794.js +135 -240
  19. package/fesm/{719.js → 870.js} +1955 -220
  20. package/fesm/{362.js → 897.js} +566 -2
  21. package/fesm/{606.js → 946.js} +564 -290
  22. package/fesm/config/index.js +15 -2
  23. package/fesm/controllers/index.js +9 -9
  24. package/fesm/docs/index.js +7 -4
  25. package/fesm/dtos/index.js +451 -256
  26. package/fesm/entities/index.js +58 -3
  27. package/fesm/guards/index.js +101 -22
  28. package/fesm/index.js +429 -948
  29. package/fesm/interfaces/index.js +19 -2
  30. package/fesm/modules/index.js +10 -628
  31. package/fesm/rule-engine/index.js +12 -3
  32. package/fesm/services/index.js +97 -27
  33. package/flow-engine/flow-api-key.d.ts +3 -7
  34. package/flow-engine/flow-graph.validator.d.ts +4 -2
  35. package/flow-engine/flow-permission-logic.d.ts +2 -0
  36. package/flow-engine/flow-run.types.d.ts +17 -8
  37. package/flow-engine/flow.types.d.ts +101 -13
  38. package/guards/designer-writable.interceptor.d.ts +12 -0
  39. package/guards/index.d.ts +1 -0
  40. package/interfaces/definition-bundle.interface.d.ts +111 -0
  41. package/interfaces/entity-builder-module.interface.d.ts +6 -0
  42. package/interfaces/flow-definition.interface.d.ts +13 -9
  43. package/interfaces/index.d.ts +1 -0
  44. package/package.json +5 -5
  45. package/rule-engine/rule-engine.service.d.ts +1 -0
  46. package/rule-engine/rule-permission.d.ts +3 -7
  47. package/services/definition-bundle.diff.d.ts +62 -0
  48. package/services/definition-bundle.file.d.ts +7 -0
  49. package/services/definition-bundle.service.d.ts +32 -0
  50. package/services/entity-builder-config.service.d.ts +2 -0
  51. package/services/entity-flow-scaffold.d.ts +1 -1
  52. package/services/flow-definition.service.d.ts +25 -12
  53. package/services/flow-execution.service.d.ts +7 -0
  54. package/services/flow-executor.service.d.ts +8 -8
  55. package/services/generic-entity.service.d.ts +1 -1
  56. package/services/index.d.ts +3 -1
  57. package/services/schema-evolution.service.d.ts +3 -1
  58. package/services/schema-sync.service.d.ts +5 -1
  59. package/controllers/flow-api-key.controller.d.ts +0 -14
  60. package/entities/flow-api-key.entity.d.ts +0 -10
  61. 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
  }
@@ -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)
@@ -785,27 +713,37 @@ flow_dto_ts_decorate([
785
713
  (0,external_class_validator_.IsNotEmpty)(),
786
714
  flow_dto_ts_metadata("design:type", String)
787
715
  ], FlowIdDto.prototype, "flowId", void 0);
788
- class CreateFlowApiKeyDto extends FlowIdDto {
789
- name;
790
- expiresAt;
716
+ class PublishFlowDto {
717
+ id;
718
+ note;
791
719
  }
792
720
  flow_dto_ts_decorate([
793
- (0,swagger_.ApiProperty)({
794
- example: 'Shop backend'
795
- }),
796
- (0,external_class_validator_.IsString)(),
721
+ (0,swagger_.ApiProperty)(),
722
+ (0,external_class_validator_.IsUUID)(),
797
723
  (0,external_class_validator_.IsNotEmpty)(),
798
- (0,external_class_validator_.MaxLength)(100),
799
724
  flow_dto_ts_metadata("design:type", String)
800
- ], CreateFlowApiKeyDto.prototype, "name", void 0);
725
+ ], PublishFlowDto.prototype, "id", void 0);
801
726
  flow_dto_ts_decorate([
802
727
  (0,swagger_.ApiPropertyOptional)({
803
- description: 'ISO date-time after which the key stops working'
728
+ description: 'What changed in this version',
729
+ example: 'Checks the branch before saving'
804
730
  }),
805
- (0,external_class_validator_.IsISO8601)(),
731
+ (0,external_class_validator_.IsString)(),
806
732
  (0,external_class_validator_.IsOptional)(),
733
+ (0,external_class_validator_.MaxLength)(500),
807
734
  flow_dto_ts_metadata("design:type", String)
808
- ], 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);
809
747
  /** The id of a flow API key or a flow execution. */ class IdBodyDto {
810
748
  id;
811
749
  }
@@ -818,6 +756,8 @@ flow_dto_ts_decorate([
818
756
  class ListFlowExecutionsDto {
819
757
  flowId;
820
758
  status;
759
+ trigger;
760
+ endpointNodeId;
821
761
  page;
822
762
  pageSize;
823
763
  }
@@ -843,6 +783,28 @@ flow_dto_ts_decorate([
843
783
  (0,external_class_validator_.IsOptional)(),
844
784
  flow_dto_ts_metadata("design:type", String)
845
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);
846
808
  flow_dto_ts_decorate([
847
809
  (0,swagger_.ApiPropertyOptional)({
848
810
  default: 0
@@ -867,18 +829,11 @@ class FlowDefinitionResponseDto extends dtos_.IdentityResponseDto {
867
829
  slug;
868
830
  description;
869
831
  isActive;
870
- authMode;
871
- permissionCode;
872
- runAs;
873
- isTransactional;
874
- timeoutMs;
875
- rateLimitPerMinute;
876
832
  retainExecutions;
877
- bodyType;
878
- inputSchema;
879
833
  nodes;
880
834
  edges;
881
835
  version;
836
+ draft;
882
837
  }
883
838
  flow_dto_ts_decorate([
884
839
  (0,external_class_transformer_.Expose)(),
@@ -900,53 +855,11 @@ flow_dto_ts_decorate([
900
855
  (0,swagger_.ApiProperty)(),
901
856
  flow_dto_ts_metadata("design:type", Boolean)
902
857
  ], 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);
933
858
  flow_dto_ts_decorate([
934
859
  (0,external_class_transformer_.Expose)(),
935
860
  (0,swagger_.ApiProperty)(),
936
861
  flow_dto_ts_metadata("design:type", Number)
937
862
  ], 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);
950
863
  flow_dto_ts_decorate([
951
864
  (0,external_class_transformer_.Expose)(),
952
865
  (0,swagger_.ApiProperty)(),
@@ -959,9 +872,19 @@ flow_dto_ts_decorate([
959
872
  ], FlowDefinitionResponseDto.prototype, "edges", void 0);
960
873
  flow_dto_ts_decorate([
961
874
  (0,external_class_transformer_.Expose)(),
962
- (0,swagger_.ApiProperty)(),
875
+ (0,swagger_.ApiProperty)({
876
+ description: 'The published version; 0 until the flow is first published'
877
+ }),
963
878
  flow_dto_ts_metadata("design:type", Number)
964
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);
965
888
 
966
889
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
967
890
  var flow_definition_service = __webpack_require__(5229);
@@ -1000,6 +923,7 @@ function flow_definition_controller_ts_param(paramIndex, decorator) {
1000
923
 
1001
924
 
1002
925
 
926
+
1003
927
  const P = nestjs_shared_.FLOW_DEFINITION_PERMISSIONS;
1004
928
  class FlowDefinitionController extends (0,nestjs_shared_.createApiController)(CreateFlowDefinitionDto, UpdateFlowDefinitionDto, FlowDefinitionResponseDto, {
1005
929
  entityName: 'entity_builder.flow_definition',
@@ -1071,6 +995,55 @@ class FlowDefinitionController extends (0,nestjs_shared_.createApiController)(Cr
1071
995
  data: result
1072
996
  };
1073
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
+ }
1074
1047
  async testRun(dto, user, req) {
1075
1048
  const { result, warnings } = await this.runtime.testRun(dto, user, {
1076
1049
  ip: req.ip ?? null,
@@ -1106,6 +1079,109 @@ flow_definition_controller_ts_decorate([
1106
1079
  ]),
1107
1080
  flow_definition_controller_ts_metadata("design:returntype", Promise)
1108
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);
1109
1185
  flow_definition_controller_ts_decorate([
1110
1186
  (0,common_.Post)('test-run'),
1111
1187
  (0,common_.HttpCode)(common_.HttpStatus.OK),
@@ -1133,6 +1209,8 @@ flow_definition_controller_ts_decorate([
1133
1209
  FlowDefinitionController = flow_definition_controller_ts_decorate([
1134
1210
  (0,swagger_.ApiTags)('Entity Builder - Flows'),
1135
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'),
1136
1214
  flow_definition_controller_ts_param(0, (0,common_.Inject)(flow_definition_service/* .FlowDefinitionService */.Tk)),
1137
1215
  flow_definition_controller_ts_param(1, (0,common_.Inject)(flow_runtime_service/* .FlowRuntimeService */.a)),
1138
1216
  flow_definition_controller_ts_metadata("design:type", Function),
@@ -1142,128 +1220,6 @@ FlowDefinitionController = flow_definition_controller_ts_decorate([
1142
1220
  ])
1143
1221
  ], FlowDefinitionController);
1144
1222
 
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
-
1267
1223
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-execution.service.ts
1268
1224
  var flow_execution_service = __webpack_require__(7810);
1269
1225
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-execution.controller.ts
@@ -1309,6 +1265,8 @@ class FlowExecutionController {
1309
1265
  const { rows, total } = await this.executions.list({
1310
1266
  flowId: dto.flowId,
1311
1267
  status: dto.status,
1268
+ trigger: dto.trigger,
1269
+ endpointNodeId: dto.endpointNodeId,
1312
1270
  page,
1313
1271
  pageSize
1314
1272
  });
@@ -1490,6 +1448,251 @@ FlowRuntimeController = flow_runtime_controller_ts_decorate([
1490
1448
  ])
1491
1449
  ], FlowRuntimeController);
1492
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
+
1493
1696
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/index.ts
1494
1697
 
1495
1698
 
@@ -1499,6 +1702,84 @@ FlowRuntimeController = flow_runtime_controller_ts_decorate([
1499
1702
 
1500
1703
 
1501
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
+
1502
1783
  },
1503
1784
  4196(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1504
1785
 
@@ -1523,8 +1804,6 @@ var core_ = __webpack_require__(3075);
1523
1804
  var message_keys = __webpack_require__(5732);
1524
1805
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
1525
1806
  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);
1528
1807
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-runtime.service.ts
1529
1808
  var flow_runtime_service = __webpack_require__(2300);
1530
1809
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-rate-limiter.ts
@@ -1568,6 +1847,8 @@ const DEFAULT_MAX_KEYS = 10_000;
1568
1847
  }
1569
1848
  }
1570
1849
 
1850
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-api-key.ts
1851
+ var flow_api_key = __webpack_require__(4816);
1571
1852
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow.types.ts
1572
1853
  var flow_types = __webpack_require__(6256);
1573
1854
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/guards/flow-access.guard.ts
@@ -1624,34 +1905,27 @@ class FlowAccessGuard {
1624
1905
  });
1625
1906
  const flow = slug ? await runtime.findActive(slug) : null;
1626
1907
  const endpoint = flow ? (0,flow_types/* .findEndpoint */.vS)(flow, request.params?.endpoint) : undefined;
1627
- if (!flow || !endpoint) throw new common_.NotFoundException({
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({
1628
1910
  message: 'Not found',
1629
1911
  messageKey: message_keys/* .FLOW_MESSAGES.NOT_FOUND */.wu.NOT_FOUND
1630
1912
  });
1631
1913
  request.flowDefinition = flow;
1632
1914
  request.flowEndpoint = endpoint;
1633
1915
  const ip = request.ip ?? request.socket?.remoteAddress ?? 'unknown';
1634
- if (!limiter.hit(`${flow.id}|${ip}`, flow.rateLimitPerMinute)) {
1916
+ if (!limiter.hit(`${flow.id}|${endpoint.nodeId}|${ip}`, endpoint.rateLimitPerMinute)) {
1635
1917
  throw new common_.HttpException({
1636
1918
  message: 'Too many requests. Try again in a minute.',
1637
1919
  messageKey: message_keys/* .FLOW_MESSAGES.RATE_LIMITED */.wu.RATE_LIMITED
1638
1920
  }, common_.HttpStatus.TOO_MANY_REQUESTS);
1639
1921
  }
1640
- switch(flow.authMode){
1922
+ switch(endpoint.authMode){
1641
1923
  case 'public':
1642
1924
  return true;
1643
1925
  case 'api_key':
1644
1926
  {
1645
- const keys = await this.moduleRef.resolve(flow_api_key_service/* .FlowApiKeyService */.T, contextId, {
1646
- strict: false
1647
- });
1648
1927
  const header = request.headers?.['x-api-key'];
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') {
1928
+ if (!(0,flow_api_key/* .apiKeyOpens */.NT)(endpoint.apiKey, Array.isArray(header) ? header[0] : header)) {
1655
1929
  throw new common_.UnauthorizedException({
1656
1930
  message: 'A valid API key is required (x-api-key header).',
1657
1931
  messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_INVALID */.wu.API_KEY_INVALID
@@ -1665,7 +1939,7 @@ class FlowAccessGuard {
1665
1939
  case 'permission':
1666
1940
  {
1667
1941
  if (!await this.authenticate(context)) return false;
1668
- 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));
1669
1943
  return true;
1670
1944
  }
1671
1945
  default: