@flusys/nestjs-entity-builder 9.0.1 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +22 -28
  2. package/config/message-keys.d.ts +9 -62
  3. package/controllers/flow-api-key.controller.d.ts +14 -0
  4. package/controllers/flow-definition.controller.d.ts +1 -7
  5. package/controllers/index.d.ts +1 -0
  6. package/dtos/flow.dto.d.ts +20 -10
  7. package/entities/flow-api-key.entity.d.ts +10 -0
  8. package/entities/flow-definition.entity.d.ts +9 -3
  9. package/entities/flow-execution.entity.d.ts +0 -1
  10. package/entities/index.d.ts +3 -3
  11. package/fesm/21.js +11 -64
  12. package/fesm/{582.js → 489.js} +11 -20
  13. package/fesm/{913.js → 606.js} +295 -209
  14. package/fesm/719.js +186 -162
  15. package/fesm/794.js +187 -116
  16. package/fesm/{677.js → 996.js} +616 -1490
  17. package/fesm/controllers/index.js +6 -5
  18. package/fesm/docs/index.js +2 -2
  19. package/fesm/entities/index.js +2 -2
  20. package/fesm/guards/index.js +19 -12
  21. package/fesm/index.js +638 -50
  22. package/fesm/modules/index.js +625 -7
  23. package/fesm/rule-engine/index.js +2 -2
  24. package/fesm/services/index.js +25 -54
  25. package/flow-engine/flow-api-key.d.ts +7 -3
  26. package/flow-engine/flow-graph.validator.d.ts +2 -4
  27. package/flow-engine/flow-run.types.d.ts +4 -14
  28. package/flow-engine/flow.types.d.ts +9 -91
  29. package/interfaces/flow-definition.interface.d.ts +9 -13
  30. package/package.json +5 -5
  31. package/rule-engine/rule-engine.service.d.ts +0 -1
  32. package/services/entity-flow-scaffold.d.ts +1 -1
  33. package/services/flow-api-key.service.d.ts +31 -0
  34. package/services/flow-definition.service.d.ts +12 -24
  35. package/services/flow-execution.service.d.ts +0 -1
  36. package/services/flow-executor.service.d.ts +7 -7
  37. package/services/generic-entity.service.d.ts +1 -1
  38. package/services/index.d.ts +1 -0
  39. package/entities/flow-version.entity.d.ts +0 -10
  40. package/fesm/458.js +0 -649
package/fesm/794.js CHANGED
@@ -332,6 +332,111 @@ __webpack_require__.d(__webpack_exports__, {
332
332
  });
333
333
 
334
334
 
335
+ },
336
+ 201(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
337
+ /* import */ var _flusys_nestjs_shared__rspack_import_0 = __webpack_require__(3422);
338
+ /* import */ var typeorm__rspack_import_1 = __webpack_require__(7158);
339
+ function _ts_decorate(decorators, target, key, desc) {
340
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
341
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
342
+ r = Reflect.decorate(decorators, target, key, desc);
343
+ } else {
344
+ for(var i = decorators.length - 1; i >= 0; i--){
345
+ if (d = decorators[i]) {
346
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
347
+ }
348
+ }
349
+ }
350
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
351
+ }
352
+ function _ts_metadata(metadataKey, metadataValue) {
353
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
354
+ return Reflect.metadata(metadataKey, metadataValue);
355
+ }
356
+ }
357
+
358
+
359
+ class FlowApiKey extends _flusys_nestjs_shared__rspack_import_0.Identity {
360
+ flowId;
361
+ name;
362
+ /** First characters of the key, to find it and to recognise it in the UI. */ keyPrefix;
363
+ keyHash;
364
+ isActive;
365
+ expiresAt;
366
+ lastUsedAt;
367
+ }
368
+ _ts_decorate([
369
+ (0,typeorm__rspack_import_1.Column)({
370
+ type: 'uuid',
371
+ name: 'flow_id'
372
+ }),
373
+ _ts_metadata("design:type", String)
374
+ ], FlowApiKey.prototype, "flowId", void 0);
375
+ _ts_decorate([
376
+ (0,typeorm__rspack_import_1.Column)({
377
+ type: 'varchar',
378
+ length: 100
379
+ }),
380
+ _ts_metadata("design:type", String)
381
+ ], FlowApiKey.prototype, "name", void 0);
382
+ _ts_decorate([
383
+ (0,typeorm__rspack_import_1.Column)({
384
+ type: 'varchar',
385
+ length: 16,
386
+ name: 'key_prefix'
387
+ }),
388
+ _ts_metadata("design:type", String)
389
+ ], FlowApiKey.prototype, "keyPrefix", void 0);
390
+ _ts_decorate([
391
+ (0,typeorm__rspack_import_1.Column)({
392
+ type: 'varchar',
393
+ length: 64,
394
+ name: 'key_hash',
395
+ select: false
396
+ }),
397
+ _ts_metadata("design:type", String)
398
+ ], FlowApiKey.prototype, "keyHash", void 0);
399
+ _ts_decorate([
400
+ (0,typeorm__rspack_import_1.Column)({
401
+ type: 'boolean',
402
+ default: true,
403
+ name: 'is_active'
404
+ }),
405
+ _ts_metadata("design:type", Boolean)
406
+ ], FlowApiKey.prototype, "isActive", void 0);
407
+ _ts_decorate([
408
+ (0,typeorm__rspack_import_1.Column)({
409
+ type: 'timestamp',
410
+ nullable: true,
411
+ name: 'expires_at'
412
+ }),
413
+ _ts_metadata("design:type", Object)
414
+ ], FlowApiKey.prototype, "expiresAt", void 0);
415
+ _ts_decorate([
416
+ (0,typeorm__rspack_import_1.Column)({
417
+ type: 'timestamp',
418
+ nullable: true,
419
+ name: 'last_used_at'
420
+ }),
421
+ _ts_metadata("design:type", Object)
422
+ ], FlowApiKey.prototype, "lastUsedAt", void 0);
423
+ FlowApiKey = _ts_decorate([
424
+ (0,typeorm__rspack_import_1.Entity)({
425
+ name: 'eb_flow_api_key'
426
+ }),
427
+ (0,typeorm__rspack_import_1.Index)([
428
+ 'flowId'
429
+ ]),
430
+ (0,typeorm__rspack_import_1.Index)([
431
+ 'keyPrefix'
432
+ ])
433
+ ], FlowApiKey);
434
+
435
+ __webpack_require__.d(__webpack_exports__, {
436
+ S: () => (FlowApiKey)
437
+ });
438
+
439
+
335
440
  },
336
441
  3770(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
337
442
  /* import */ var _flusys_nestjs_shared__rspack_import_0 = __webpack_require__(3422);
@@ -361,11 +466,18 @@ class FlowDefinition extends _flusys_nestjs_shared__rspack_import_0.Identity {
361
466
  /** URL segment: POST api-flows/<slug>. */ slug;
362
467
  description;
363
468
  isActive;
469
+ authMode;
470
+ /** authMode `permission`: the permission a caller needs. Defaults to `entity_builder.flow.<slug>.execute`. */ permissionCode;
471
+ runAs;
472
+ /** Entity writes of one run commit or roll back together. */ isTransactional;
473
+ timeoutMs;
474
+ /** Per caller IP, per minute; 0 = unlimited. */ rateLimitPerMinute;
364
475
  /** How many execution logs to keep for this flow. */ retainExecutions;
476
+ bodyType;
477
+ inputSchema;
365
478
  nodes;
366
479
  edges;
367
- /** The published version: 0 until the flow is first published (it cannot be called before), then bumped on every publish. */ version;
368
- /** Saved, unpublished edits of a published flow; null when the flow is as published. */ draft;
480
+ /** Bumped on every change. */ version;
369
481
  }
370
482
  _ts_decorate([
371
483
  (0,typeorm__rspack_import_1.Column)({
@@ -397,6 +509,57 @@ _ts_decorate([
397
509
  }),
398
510
  _ts_metadata("design:type", Boolean)
399
511
  ], FlowDefinition.prototype, "isActive", void 0);
512
+ _ts_decorate([
513
+ (0,typeorm__rspack_import_1.Column)({
514
+ type: 'varchar',
515
+ length: 20,
516
+ name: 'auth_mode',
517
+ default: 'jwt'
518
+ }),
519
+ _ts_metadata("design:type", typeof FlowAuthMode === "undefined" ? Object : FlowAuthMode)
520
+ ], FlowDefinition.prototype, "authMode", void 0);
521
+ _ts_decorate([
522
+ (0,typeorm__rspack_import_1.Column)({
523
+ type: 'varchar',
524
+ length: 255,
525
+ name: 'permission_code',
526
+ nullable: true
527
+ }),
528
+ _ts_metadata("design:type", Object)
529
+ ], FlowDefinition.prototype, "permissionCode", void 0);
530
+ _ts_decorate([
531
+ (0,typeorm__rspack_import_1.Column)({
532
+ type: 'varchar',
533
+ length: 10,
534
+ name: 'run_as',
535
+ default: 'caller'
536
+ }),
537
+ _ts_metadata("design:type", typeof FlowRunAs === "undefined" ? Object : FlowRunAs)
538
+ ], FlowDefinition.prototype, "runAs", void 0);
539
+ _ts_decorate([
540
+ (0,typeorm__rspack_import_1.Column)({
541
+ type: 'boolean',
542
+ default: false,
543
+ name: 'is_transactional'
544
+ }),
545
+ _ts_metadata("design:type", Boolean)
546
+ ], FlowDefinition.prototype, "isTransactional", void 0);
547
+ _ts_decorate([
548
+ (0,typeorm__rspack_import_1.Column)({
549
+ type: 'int',
550
+ default: 30000,
551
+ name: 'timeout_ms'
552
+ }),
553
+ _ts_metadata("design:type", Number)
554
+ ], FlowDefinition.prototype, "timeoutMs", void 0);
555
+ _ts_decorate([
556
+ (0,typeorm__rspack_import_1.Column)({
557
+ type: 'int',
558
+ default: 60,
559
+ name: 'rate_limit_per_minute'
560
+ }),
561
+ _ts_metadata("design:type", Number)
562
+ ], FlowDefinition.prototype, "rateLimitPerMinute", void 0);
400
563
  _ts_decorate([
401
564
  (0,typeorm__rspack_import_1.Column)({
402
565
  type: 'int',
@@ -405,6 +568,22 @@ _ts_decorate([
405
568
  }),
406
569
  _ts_metadata("design:type", Number)
407
570
  ], FlowDefinition.prototype, "retainExecutions", void 0);
571
+ _ts_decorate([
572
+ (0,typeorm__rspack_import_1.Column)({
573
+ type: 'varchar',
574
+ length: 10,
575
+ name: 'body_type',
576
+ default: 'object'
577
+ }),
578
+ _ts_metadata("design:type", typeof FlowBodyType === "undefined" ? Object : FlowBodyType)
579
+ ], FlowDefinition.prototype, "bodyType", void 0);
580
+ _ts_decorate([
581
+ (0,typeorm__rspack_import_1.Column)({
582
+ type: (0,_flusys_nestjs_shared__rspack_import_0.getJsonColumnType)(),
583
+ name: 'input_schema'
584
+ }),
585
+ _ts_metadata("design:type", Array)
586
+ ], FlowDefinition.prototype, "inputSchema", void 0);
408
587
  _ts_decorate([
409
588
  (0,typeorm__rspack_import_1.Column)({
410
589
  type: (0,_flusys_nestjs_shared__rspack_import_0.getJsonColumnType)()
@@ -424,13 +603,6 @@ _ts_decorate([
424
603
  }),
425
604
  _ts_metadata("design:type", Number)
426
605
  ], FlowDefinition.prototype, "version", void 0);
427
- _ts_decorate([
428
- (0,typeorm__rspack_import_1.Column)({
429
- type: (0,_flusys_nestjs_shared__rspack_import_0.getJsonColumnType)(),
430
- nullable: true
431
- }),
432
- _ts_metadata("design:type", Object)
433
- ], FlowDefinition.prototype, "draft", void 0);
434
606
  FlowDefinition = _ts_decorate([
435
607
  (0,typeorm__rspack_import_1.Entity)({
436
608
  name: 'eb_flow_definition'
@@ -474,7 +646,6 @@ function _ts_metadata(metadataKey, metadataValue) {
474
646
  class FlowExecution extends _flusys_nestjs_shared__rspack_import_0.Identity {
475
647
  flowId;
476
648
  flowSlug;
477
- /** The published version that ran; null for a test run of the designer's draft. */ flowVersion;
478
649
  /** success | failed | rejected (the caller was turned away: invalid input, failed validation, no permission). */ status;
479
650
  /** webhook | test */ trigger;
480
651
  /** live | dry_run */ mode;
@@ -504,14 +675,6 @@ _ts_decorate([
504
675
  }),
505
676
  _ts_metadata("design:type", String)
506
677
  ], FlowExecution.prototype, "flowSlug", void 0);
507
- _ts_decorate([
508
- (0,typeorm__rspack_import_1.Column)({
509
- type: 'int',
510
- name: 'flow_version',
511
- nullable: true
512
- }),
513
- _ts_metadata("design:type", Object)
514
- ], FlowExecution.prototype, "flowVersion", void 0);
515
678
  _ts_decorate([
516
679
  (0,typeorm__rspack_import_1.Column)({
517
680
  type: 'varchar',
@@ -614,106 +777,14 @@ __webpack_require__.d(__webpack_exports__, {
614
777
  });
615
778
 
616
779
 
617
- },
618
- 2399(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
619
- /* import */ var _flusys_nestjs_shared__rspack_import_0 = __webpack_require__(3422);
620
- /* import */ var typeorm__rspack_import_1 = __webpack_require__(7158);
621
- function _ts_decorate(decorators, target, key, desc) {
622
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
623
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
624
- r = Reflect.decorate(decorators, target, key, desc);
625
- } else {
626
- for(var i = decorators.length - 1; i >= 0; i--){
627
- if (d = decorators[i]) {
628
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
629
- }
630
- }
631
- }
632
- return c > 3 && r && Object.defineProperty(target, key, r), r;
633
- }
634
- function _ts_metadata(metadataKey, metadataValue) {
635
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
636
- return Reflect.metadata(metadataKey, metadataValue);
637
- }
638
- }
639
-
640
-
641
- class FlowVersion extends _flusys_nestjs_shared__rspack_import_0.Identity {
642
- flowId;
643
- version;
644
- definition;
645
- note;
646
- /** Null for a version that went live before versions were kept (recorded when the next one was published). */ publishedAt;
647
- publishedById;
648
- }
649
- _ts_decorate([
650
- (0,typeorm__rspack_import_1.Column)({
651
- type: 'uuid',
652
- name: 'flow_id'
653
- }),
654
- _ts_metadata("design:type", String)
655
- ], FlowVersion.prototype, "flowId", void 0);
656
- _ts_decorate([
657
- (0,typeorm__rspack_import_1.Column)({
658
- type: 'int'
659
- }),
660
- _ts_metadata("design:type", Number)
661
- ], FlowVersion.prototype, "version", void 0);
662
- _ts_decorate([
663
- (0,typeorm__rspack_import_1.Column)({
664
- type: (0,_flusys_nestjs_shared__rspack_import_0.getJsonColumnType)()
665
- }),
666
- _ts_metadata("design:type", typeof IFlowSnapshot === "undefined" ? Object : IFlowSnapshot)
667
- ], FlowVersion.prototype, "definition", void 0);
668
- _ts_decorate([
669
- (0,typeorm__rspack_import_1.Column)({
670
- type: 'varchar',
671
- length: 500,
672
- nullable: true
673
- }),
674
- _ts_metadata("design:type", Object)
675
- ], FlowVersion.prototype, "note", void 0);
676
- _ts_decorate([
677
- (0,typeorm__rspack_import_1.Column)({
678
- type: 'timestamp',
679
- name: 'published_at',
680
- nullable: true
681
- }),
682
- _ts_metadata("design:type", Object)
683
- ], FlowVersion.prototype, "publishedAt", void 0);
684
- _ts_decorate([
685
- (0,typeorm__rspack_import_1.Column)({
686
- type: 'uuid',
687
- name: 'published_by_id',
688
- nullable: true
689
- }),
690
- _ts_metadata("design:type", Object)
691
- ], FlowVersion.prototype, "publishedById", void 0);
692
- FlowVersion = _ts_decorate([
693
- (0,typeorm__rspack_import_1.Entity)({
694
- name: 'eb_flow_version'
695
- }),
696
- (0,typeorm__rspack_import_1.Index)([
697
- 'flowId',
698
- 'version'
699
- ], {
700
- unique: true
701
- })
702
- ], FlowVersion);
703
-
704
- __webpack_require__.d(__webpack_exports__, {
705
- p: () => (FlowVersion)
706
- });
707
-
708
-
709
780
  },
710
781
  665(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
711
782
  /* import */ var _entity_definition_entity_js__rspack_import_0 = __webpack_require__(3189);
712
783
  /* import */ var _field_definition_entity_js__rspack_import_1 = __webpack_require__(2206);
713
784
  /* import */ var _schema_change_log_entity_js__rspack_import_2 = __webpack_require__(875);
714
785
  /* import */ var _flow_definition_entity_js__rspack_import_3 = __webpack_require__(3770);
715
- /* import */ var _flow_execution_entity_js__rspack_import_4 = __webpack_require__(9641);
716
- /* import */ var _flow_version_entity_js__rspack_import_5 = __webpack_require__(2399);
786
+ /* import */ var _flow_api_key_entity_js__rspack_import_4 = __webpack_require__(201);
787
+ /* import */ var _flow_execution_entity_js__rspack_import_5 = __webpack_require__(9641);
717
788
  // Every entity builder table is tenant-wide: definitions, flows and their runs are shared by all
718
789
  // companies, and records carry only the fields the entity designer defines.
719
790
 
@@ -733,8 +804,8 @@ const EntityBuilderEntities = [
733
804
  _field_definition_entity_js__rspack_import_1/* .FieldDefinition */.c,
734
805
  _schema_change_log_entity_js__rspack_import_2/* .SchemaChangeLog */.W,
735
806
  _flow_definition_entity_js__rspack_import_3/* .FlowDefinition */.G,
736
- _flow_execution_entity_js__rspack_import_4/* .FlowExecution */.j,
737
- _flow_version_entity_js__rspack_import_5/* .FlowVersion */.p
807
+ _flow_api_key_entity_js__rspack_import_4/* .FlowApiKey */.S,
808
+ _flow_execution_entity_js__rspack_import_5/* .FlowExecution */.j
738
809
  ];
739
810
  /** A copy on every call: a DataSource's entities array grows with runtime schemas and must never be shared. */ function getEntityBuilderEntities() {
740
811
  return [
@@ -744,12 +815,12 @@ const EntityBuilderEntities = [
744
815
 
745
816
  __webpack_require__.d(__webpack_exports__, {
746
817
  G: () => (/* reexport safe */ _flow_definition_entity_js__rspack_import_3.G),
818
+ Sf: () => (/* reexport safe */ _flow_api_key_entity_js__rspack_import_4.S),
747
819
  We: () => (/* reexport safe */ _schema_change_log_entity_js__rspack_import_2.W),
748
820
  ac: () => (getEntityBuilderEntities),
749
821
  ck: () => (/* reexport safe */ _field_definition_entity_js__rspack_import_1.c),
750
822
  f6: () => (/* reexport safe */ _entity_definition_entity_js__rspack_import_0.f),
751
- j5: () => (/* reexport safe */ _flow_execution_entity_js__rspack_import_4.j),
752
- pj: () => (/* reexport safe */ _flow_version_entity_js__rspack_import_5.p)
823
+ j5: () => (/* reexport safe */ _flow_execution_entity_js__rspack_import_5.j)
753
824
  }, {
754
825
  Ui: EntityBuilderEntities
755
826
  });