@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
@@ -6,15 +6,17 @@ export const __webpack_modules__ = {
6
6
  // EXPORTS
7
7
  __webpack_require__.d(__webpack_exports__, {
8
8
  zb: () => (/* reexport */ generic_entity_service/* .ACTOR_BRANCH_METADATA_KEY */.zb),
9
- Ty: () => (/* reexport */ (/* inlined export .BULK_MAX_ITEMS */200)),
10
9
  Fz: () => (/* reexport */ (/* inlined export .DRAFT_TEST_RETAIN */200)),
10
+ P0: () => (/* reexport */ definition_bundle_service/* .DefinitionBundleService */.P),
11
11
  Vo: () => (/* reexport */ definition_cache_service/* .DefinitionCacheService */.V),
12
+ $I: () => (/* reexport */ definition_bundle_diff/* .ENTITY_COMPARED_KEYS */.$I),
13
+ IP: () => (/* reexport */ entity_flow_scaffold/* .ENTITY_FLOW_PATHS */.IP),
12
14
  E: () => (/* reexport */ entity_builder_config_service/* .EntityBuilderConfigService */.E),
13
15
  DR: () => (/* reexport */ entity_builder_datasource_provider/* .EntityBuilderDataSourceProvider */.D),
14
16
  oc: () => (/* reexport */ entity_definition_service/* .EntityDefinitionService */.o),
15
17
  u4: () => (/* reexport */ entity_permission_service/* .EntityPermissionService */.u),
18
+ mT: () => (/* reexport */ definition_bundle_diff/* .FIELD_COMPARED_KEYS */.mT),
16
19
  J: () => (/* reexport */ field_definition_service/* .FieldDefinitionService */.J),
17
- Td: () => (/* reexport */ flow_api_key_service/* .FlowApiKeyService */.T),
18
20
  Tk: () => (/* reexport */ flow_definition_service/* .FlowDefinitionService */.Tk),
19
21
  AJ: () => (/* reexport */ flow_execution_service/* .FlowExecutionService */.A),
20
22
  FT: () => (/* reexport */ flow_executor_service/* .FlowExecutorService */.F),
@@ -33,34 +35,50 @@ __webpack_require__.d(__webpack_exports__, {
33
35
  WQ: () => (/* reexport */ schema_sync_service/* .SchemaSyncService */.W),
34
36
  DG: () => (/* reexport */ generic_entity_service/* .actorMetadata */.DG),
35
37
  $6: () => (/* reexport */ schema_columns/* .addUnique */.$6),
38
+ gT: () => (/* reexport */ definition_bundle_diff/* .applyVariables */.gT),
36
39
  fY: () => (/* reexport */ identifier_rules/* .assertIndexableField */.fY),
37
40
  kV: () => (/* reexport */ identifier_rules/* .assertValidIdentifier */.kV),
38
41
  HK: () => (/* reexport */ schema_columns/* .auditColumns */.HK),
39
- CO: () => (/* reexport */ entity_flow_scaffold/* .buildEntityFlow */.C),
42
+ CO: () => (/* reexport */ entity_flow_scaffold/* .buildEntityFlow */.CO),
40
43
  fu: () => (/* reexport */ schema_columns/* .buildFieldColumn */.fu),
41
44
  Rm: () => (/* reexport */ schema_columns/* .buildSystemColumns */.Rm),
45
+ i9: () => (/* reexport */ definition_bundle_diff/* .bundleChecksum */.i9),
46
+ bs: () => (/* reexport */ definition_bundle_diff/* .bundleSubject */.bs),
47
+ VU: () => (/* reexport */ definition_bundle_diff/* .byCode */.VU),
48
+ Q5: () => (/* reexport */ definition_bundle_diff/* .calledFlowSlugs */.Q5),
49
+ dj: () => (/* reexport */ definition_bundle_diff/* .canonicalJson */.dj),
42
50
  Er: () => (/* reexport */ flow_definition_service/* .defaultFlowPermissionCode */.Er),
43
51
  an: () => (/* reexport */ schema_change_types/* .describeImpact */.a),
44
- x2: () => (/* reexport */ entity_flow_scaffold/* .entityFlowSlug */.x),
52
+ Sy: () => (/* reexport */ definition_bundle_diff/* .diffEntities */.zb),
53
+ x2: () => (/* reexport */ entity_flow_scaffold/* .entityFlowSlug */.x2),
54
+ lj: () => (/* reexport */ definition_bundle_diff/* .extractVariables */.lj),
45
55
  HQ: () => (/* reexport */ schema_dialect_adapter_service/* .fitIdentifier */.H),
46
56
  YW: () => (/* reexport */ flow_definition_service/* .flowNotFound */.YW),
57
+ j4: () => (/* reexport */ flow_definition_service/* .flowPermissions */.j4),
47
58
  gl: () => (/* reexport */ flow_executor_service/* .flowTimeout */.g),
48
59
  mo: () => (/* reexport */ schema_columns/* .indexName */.mo),
49
60
  C5: () => (/* reexport */ schema_evolution_service/* .isDestructiveSchemaAction */.C),
50
61
  d4: () => (/* reexport */ schema_columns/* .isIndexableFieldType */.d4),
62
+ HF: () => (/* reexport */ flow_definition_service/* .isPublished */.HF),
51
63
  Eq: () => (/* reexport */ database_error_mapper/* .mapDatabaseError */.E),
52
64
  iw: () => (/* reexport */ database_error_mapper/* .mapSchemaError */.i),
65
+ Og: () => (/* reexport */ definition_bundle_diff/* .matchDefinitions */.Og),
66
+ qG: () => (/* reexport */ definition_bundle_diff/* .orderFlows */.qG),
53
67
  v7: () => (/* reexport */ schema_columns/* .plainIndex */.v7),
54
68
  IM: () => (/* reexport */ field_type_conversion/* .planTypeConversion */.I),
69
+ zi: () => (/* reexport */ definition_bundle_file/* .readBundleFile */.z),
55
70
  e1: () => (/* reexport */ schema_change_executor_service/* .relationTargetCodes */.e),
56
71
  Sd: () => (/* reexport */ flow_runtime_service/* .requestInfo */.S),
57
72
  G7: () => (/* reexport */ schema_columns/* .sameColumns */.G7),
73
+ eY: () => (/* reexport */ flow_definition_service/* .snapshotOf */.eY),
58
74
  OG: () => (/* reexport */ schema_columns/* .softDeleteColumn */.OG),
59
75
  cg: () => (/* reexport */ schema_columns/* .sqlTypeFor */.cg),
76
+ dX: () => (/* reexport */ definition_bundle_diff/* .stripApiKeys */.dX),
60
77
  uy: () => (/* reexport */ schema_columns/* .tableUnique */.uy),
61
78
  RK: () => (/* reexport */ flow_definition_service/* .toFlowSettings */.RK),
62
79
  jp: () => (/* reexport */ schema_columns/* .typeFamily */.jp),
63
- eV: () => (/* reexport */ field_value_validator/* .validateRecord */.e)
80
+ eV: () => (/* reexport */ field_value_validator/* .validateRecord */.e),
81
+ lw: () => (/* reexport */ flow_definition_service/* .workingCopy */.lw)
64
82
  });
65
83
 
66
84
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/entity-builder-config.service.ts
@@ -105,12 +123,10 @@ var field_value_validator = __webpack_require__(3525);
105
123
  var database_error_mapper = __webpack_require__(8323);
106
124
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
107
125
  var flow_definition_service = __webpack_require__(5229);
108
- // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-api-key.service.ts + 1 modules
109
- var flow_api_key_service = __webpack_require__(8888);
110
126
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-execution.service.ts
111
127
  var flow_execution_service = __webpack_require__(7810);
112
- // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-executor.service.ts + 5 modules
113
- var flow_executor_service = __webpack_require__(4698);
128
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-executor.service.ts + 6 modules
129
+ var flow_executor_service = __webpack_require__(3908);
114
130
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-runtime.service.ts
115
131
  var flow_runtime_service = __webpack_require__(2300);
116
132
  // EXTERNAL MODULE: external "@flusys/nestjs-shared/utils"
@@ -123,6 +139,8 @@ var external_typeorm_ = __webpack_require__(7158);
123
139
  var message_keys = __webpack_require__(5732);
124
140
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/entities/flow-definition.entity.ts
125
141
  var flow_definition_entity = __webpack_require__(3770);
142
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/entities/flow-version.entity.ts
143
+ var flow_version_entity = __webpack_require__(2399);
126
144
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/services/reference-rewrite.ts
127
145
  /** Pure JSON string helpers for finding and rewriting `<prefix>.<field>` references inside definitions. */ function mapStrings(value, fn) {
128
146
  if (typeof value === 'string') return fn(value);
@@ -324,23 +342,24 @@ function _ts_param(paramIndex, decorator) {
324
342
 
325
343
 
326
344
 
345
+
327
346
  class FlowReferenceProvider {
328
347
  provider;
329
348
  constructor(provider){
330
349
  this.provider = provider;
331
350
  }
332
- async flows(manager) {
333
- return (await this.repo(manager)).find({
351
+ async flows() {
352
+ return (await this.repo(flow_definition_entity/* .FlowDefinition */.G)).find({
334
353
  where: {
335
354
  deletedAt: (0,external_typeorm_.IsNull)()
336
355
  }
337
356
  });
338
357
  }
339
- async repo(manager) {
340
- return manager ? manager.getRepository(flow_definition_entity/* .FlowDefinition */.G) : this.provider.getRepository(flow_definition_entity/* .FlowDefinition */.G);
358
+ async repo(entity, manager) {
359
+ return manager ? manager.getRepository(entity) : this.provider.getRepository(entity);
341
360
  }
342
361
  async findEntityReferences(entityCode) {
343
- return (await this.flows()).filter((f)=>flowUsesEntity(f.nodes, entityCode)).map((f)=>({
362
+ return (await this.flows()).filter((f)=>flowUsesEntity(f.nodes, entityCode) || !!f.draft && flowUsesEntity(f.draft.nodes, entityCode)).map((f)=>({
344
363
  kind: 'flow',
345
364
  id: f.id,
346
365
  name: f.name,
@@ -350,7 +369,7 @@ class FlowReferenceProvider {
350
369
  }));
351
370
  }
352
371
  async findFieldReferences(entityCode, fieldCode) {
353
- return (await this.flows()).filter((f)=>flowRefersToField(f.nodes, entityCode, fieldCode)).map((f)=>({
372
+ return (await this.flows()).filter((f)=>flowRefersToField(f.nodes, entityCode, fieldCode) || !!f.draft && flowRefersToField(f.draft.nodes, entityCode, fieldCode)).map((f)=>({
354
373
  kind: 'flow',
355
374
  id: f.id,
356
375
  name: f.name,
@@ -362,15 +381,42 @@ class FlowReferenceProvider {
362
381
  }
363
382
  async rewriteFieldReferences(entityCode, from, to, manager) {
364
383
  let count = 0;
365
- for (const flow of (await this.flows(manager))){
366
- const { nodes, changed } = rewriteFlowField(flow.nodes, entityCode, from, to);
367
- if (!changed) continue;
368
- await (await this.repo(manager)).update(flow.id, {
369
- nodes,
370
- version: flow.version + 1
384
+ const flows = await this.repo(flow_definition_entity/* .FlowDefinition */.G, manager);
385
+ // Deleted flows too: one restored later must not bring the old field name back.
386
+ for (const flow of (await flows.find({
387
+ withDeleted: true
388
+ }))){
389
+ // The published flow and its unpublished draft both keep working after the rename.
390
+ const live = rewriteFlowField(flow.nodes, entityCode, from, to);
391
+ const draft = flow.draft ? rewriteFlowField(flow.draft.nodes, entityCode, from, to) : null;
392
+ if (!live.changed && !draft?.changed) continue;
393
+ await flows.update(flow.id, {
394
+ nodes: live.nodes,
395
+ ...draft?.changed ? {
396
+ draft: {
397
+ ...flow.draft,
398
+ nodes: draft.nodes
399
+ }
400
+ } : {}
371
401
  });
372
402
  count++;
373
403
  }
404
+ // A version restored later must not bring the old field name back.
405
+ const versions = await this.repo(flow_version_entity/* .FlowVersion */.p, manager);
406
+ for (const version of (await versions.find({
407
+ select: {
408
+ id: true,
409
+ definition: true
410
+ }
411
+ }))){
412
+ const { nodes, changed } = rewriteFlowField(version.definition.nodes, entityCode, from, to);
413
+ if (changed) await versions.update(version.id, {
414
+ definition: {
415
+ ...version.definition,
416
+ nodes
417
+ }
418
+ });
419
+ }
374
420
  return count;
375
421
  }
376
422
  }
@@ -387,6 +433,12 @@ FlowReferenceProvider = _ts_decorate([
387
433
 
388
434
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/entity-flow-scaffold.ts
389
435
  var entity_flow_scaffold = __webpack_require__(8271);
436
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/definition-bundle.diff.ts
437
+ var definition_bundle_diff = __webpack_require__(3801);
438
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/definition-bundle.file.ts
439
+ var definition_bundle_file = __webpack_require__(6412);
440
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/definition-bundle.service.ts
441
+ var definition_bundle_service = __webpack_require__(7463);
390
442
  ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/services/index.ts
391
443
 
392
444
 
@@ -414,6 +466,8 @@ var entity_flow_scaffold = __webpack_require__(8271);
414
466
 
415
467
 
416
468
 
469
+
470
+
417
471
 
418
472
 
419
473
 
@@ -424,28 +478,30 @@ import { __webpack_require__ } from '../runtime.js';
424
478
  var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
425
479
  import * as __rspack_chunk_1 from '../21.js';
426
480
  __webpack_require__.C(__rspack_chunk_1);
427
- import * as __rspack_chunk_2 from '../489.js';
481
+ import * as __rspack_chunk_2 from '../897.js';
428
482
  __webpack_require__.C(__rspack_chunk_2);
429
- import * as __rspack_chunk_3 from '../794.js';
483
+ import * as __rspack_chunk_3 from '../582.js';
430
484
  __webpack_require__.C(__rspack_chunk_3);
431
- import * as __rspack_chunk_4 from '../996.js';
485
+ import * as __rspack_chunk_4 from '../794.js';
432
486
  __webpack_require__.C(__rspack_chunk_4);
433
- import * as __rspack_chunk_5 from '../362.js';
487
+ import * as __rspack_chunk_5 from '../677.js';
434
488
  __webpack_require__.C(__rspack_chunk_5);
435
- import * as __rspack_chunk_6 from '../719.js';
489
+ import * as __rspack_chunk_6 from '../870.js';
436
490
  __webpack_require__.C(__rspack_chunk_6);
437
491
  import * as __rspack_chunk_7 from './index.js';
438
492
  __webpack_require__.C(__rspack_chunk_7);
439
493
  var __webpack_exports__ = __webpack_exec__(8752);var __webpack_exports__ACTOR_BRANCH_METADATA_KEY = __webpack_exports__.zb;
440
- var __webpack_exports__BULK_MAX_ITEMS = __webpack_exports__.Ty;
441
494
  var __webpack_exports__DRAFT_TEST_RETAIN = __webpack_exports__.Fz;
495
+ var __webpack_exports__DefinitionBundleService = __webpack_exports__.P0;
442
496
  var __webpack_exports__DefinitionCacheService = __webpack_exports__.Vo;
497
+ var __webpack_exports__ENTITY_COMPARED_KEYS = __webpack_exports__.$I;
498
+ var __webpack_exports__ENTITY_FLOW_PATHS = __webpack_exports__.IP;
443
499
  var __webpack_exports__EntityBuilderConfigService = __webpack_exports__.E;
444
500
  var __webpack_exports__EntityBuilderDataSourceProvider = __webpack_exports__.DR;
445
501
  var __webpack_exports__EntityDefinitionService = __webpack_exports__.oc;
446
502
  var __webpack_exports__EntityPermissionService = __webpack_exports__.u4;
503
+ var __webpack_exports__FIELD_COMPARED_KEYS = __webpack_exports__.mT;
447
504
  var __webpack_exports__FieldDefinitionService = __webpack_exports__.J;
448
- var __webpack_exports__FlowApiKeyService = __webpack_exports__.Td;
449
505
  var __webpack_exports__FlowDefinitionService = __webpack_exports__.Tk;
450
506
  var __webpack_exports__FlowExecutionService = __webpack_exports__.AJ;
451
507
  var __webpack_exports__FlowExecutorService = __webpack_exports__.FT;
@@ -464,32 +520,48 @@ var __webpack_exports__SchemaRegistryService = __webpack_exports__.Cy;
464
520
  var __webpack_exports__SchemaSyncService = __webpack_exports__.WQ;
465
521
  var __webpack_exports__actorMetadata = __webpack_exports__.DG;
466
522
  var __webpack_exports__addUnique = __webpack_exports__.$6;
523
+ var __webpack_exports__applyVariables = __webpack_exports__.gT;
467
524
  var __webpack_exports__assertIndexableField = __webpack_exports__.fY;
468
525
  var __webpack_exports__assertValidIdentifier = __webpack_exports__.kV;
469
526
  var __webpack_exports__auditColumns = __webpack_exports__.HK;
470
527
  var __webpack_exports__buildEntityFlow = __webpack_exports__.CO;
471
528
  var __webpack_exports__buildFieldColumn = __webpack_exports__.fu;
472
529
  var __webpack_exports__buildSystemColumns = __webpack_exports__.Rm;
530
+ var __webpack_exports__bundleChecksum = __webpack_exports__.i9;
531
+ var __webpack_exports__bundleSubject = __webpack_exports__.bs;
532
+ var __webpack_exports__byCode = __webpack_exports__.VU;
533
+ var __webpack_exports__calledFlowSlugs = __webpack_exports__.Q5;
534
+ var __webpack_exports__canonicalJson = __webpack_exports__.dj;
473
535
  var __webpack_exports__defaultFlowPermissionCode = __webpack_exports__.Er;
474
536
  var __webpack_exports__describeImpact = __webpack_exports__.an;
537
+ var __webpack_exports__diffEntities = __webpack_exports__.Sy;
475
538
  var __webpack_exports__entityFlowSlug = __webpack_exports__.x2;
539
+ var __webpack_exports__extractVariables = __webpack_exports__.lj;
476
540
  var __webpack_exports__fitIdentifier = __webpack_exports__.HQ;
477
541
  var __webpack_exports__flowNotFound = __webpack_exports__.YW;
542
+ var __webpack_exports__flowPermissions = __webpack_exports__.j4;
478
543
  var __webpack_exports__flowTimeout = __webpack_exports__.gl;
479
544
  var __webpack_exports__indexName = __webpack_exports__.mo;
480
545
  var __webpack_exports__isDestructiveSchemaAction = __webpack_exports__.C5;
481
546
  var __webpack_exports__isIndexableFieldType = __webpack_exports__.d4;
547
+ var __webpack_exports__isPublished = __webpack_exports__.HF;
482
548
  var __webpack_exports__mapDatabaseError = __webpack_exports__.Eq;
483
549
  var __webpack_exports__mapSchemaError = __webpack_exports__.iw;
550
+ var __webpack_exports__matchDefinitions = __webpack_exports__.Og;
551
+ var __webpack_exports__orderFlows = __webpack_exports__.qG;
484
552
  var __webpack_exports__plainIndex = __webpack_exports__.v7;
485
553
  var __webpack_exports__planTypeConversion = __webpack_exports__.IM;
554
+ var __webpack_exports__readBundleFile = __webpack_exports__.zi;
486
555
  var __webpack_exports__relationTargetCodes = __webpack_exports__.e1;
487
556
  var __webpack_exports__requestInfo = __webpack_exports__.Sd;
488
557
  var __webpack_exports__sameColumns = __webpack_exports__.G7;
558
+ var __webpack_exports__snapshotOf = __webpack_exports__.eY;
489
559
  var __webpack_exports__softDeleteColumn = __webpack_exports__.OG;
490
560
  var __webpack_exports__sqlTypeFor = __webpack_exports__.cg;
561
+ var __webpack_exports__stripApiKeys = __webpack_exports__.dX;
491
562
  var __webpack_exports__tableUnique = __webpack_exports__.uy;
492
563
  var __webpack_exports__toFlowSettings = __webpack_exports__.RK;
493
564
  var __webpack_exports__typeFamily = __webpack_exports__.jp;
494
565
  var __webpack_exports__validateRecord = __webpack_exports__.eV;
495
- export { __webpack_exports__ACTOR_BRANCH_METADATA_KEY as ACTOR_BRANCH_METADATA_KEY, __webpack_exports__BULK_MAX_ITEMS as BULK_MAX_ITEMS, __webpack_exports__DRAFT_TEST_RETAIN as DRAFT_TEST_RETAIN, __webpack_exports__DefinitionCacheService as DefinitionCacheService, __webpack_exports__EntityBuilderConfigService as EntityBuilderConfigService, __webpack_exports__EntityBuilderDataSourceProvider as EntityBuilderDataSourceProvider, __webpack_exports__EntityDefinitionService as EntityDefinitionService, __webpack_exports__EntityPermissionService as EntityPermissionService, __webpack_exports__FieldDefinitionService as FieldDefinitionService, __webpack_exports__FlowApiKeyService as FlowApiKeyService, __webpack_exports__FlowDefinitionService as FlowDefinitionService, __webpack_exports__FlowExecutionService as FlowExecutionService, __webpack_exports__FlowExecutorService as FlowExecutorService, __webpack_exports__FlowReferenceProvider as FlowReferenceProvider, __webpack_exports__FlowRuntimeService as FlowRuntimeService, __webpack_exports__GenericEntityService as GenericEntityService, __webpack_exports__GenericEntityServiceFactory as GenericEntityServiceFactory, __webpack_exports__NON_INDEXABLE_FIELD_TYPES as NON_INDEXABLE_FIELD_TYPES, __webpack_exports__RESERVED_WORDS as RESERVED_WORDS, __webpack_exports__ReferenceScannerService as ReferenceScannerService, __webpack_exports__SYSTEM_COLUMN_NAMES as SYSTEM_COLUMN_NAMES, __webpack_exports__SchemaChangeExecutor as SchemaChangeExecutor, __webpack_exports__SchemaDialectAdapterService as SchemaDialectAdapterService, __webpack_exports__SchemaEvolutionService as SchemaEvolutionService, __webpack_exports__SchemaRegistryService as SchemaRegistryService, __webpack_exports__SchemaSyncService as SchemaSyncService, __webpack_exports__actorMetadata as actorMetadata, __webpack_exports__addUnique as addUnique, __webpack_exports__assertIndexableField as assertIndexableField, __webpack_exports__assertValidIdentifier as assertValidIdentifier, __webpack_exports__auditColumns as auditColumns, __webpack_exports__buildEntityFlow as buildEntityFlow, __webpack_exports__buildFieldColumn as buildFieldColumn, __webpack_exports__buildSystemColumns as buildSystemColumns, __webpack_exports__defaultFlowPermissionCode as defaultFlowPermissionCode, __webpack_exports__describeImpact as describeImpact, __webpack_exports__entityFlowSlug as entityFlowSlug, __webpack_exports__fitIdentifier as fitIdentifier, __webpack_exports__flowNotFound as flowNotFound, __webpack_exports__flowTimeout as flowTimeout, __webpack_exports__indexName as indexName, __webpack_exports__isDestructiveSchemaAction as isDestructiveSchemaAction, __webpack_exports__isIndexableFieldType as isIndexableFieldType, __webpack_exports__mapDatabaseError as mapDatabaseError, __webpack_exports__mapSchemaError as mapSchemaError, __webpack_exports__plainIndex as plainIndex, __webpack_exports__planTypeConversion as planTypeConversion, __webpack_exports__relationTargetCodes as relationTargetCodes, __webpack_exports__requestInfo as requestInfo, __webpack_exports__sameColumns as sameColumns, __webpack_exports__softDeleteColumn as softDeleteColumn, __webpack_exports__sqlTypeFor as sqlTypeFor, __webpack_exports__tableUnique as tableUnique, __webpack_exports__toFlowSettings as toFlowSettings, __webpack_exports__typeFamily as typeFamily, __webpack_exports__validateRecord as validateRecord };
566
+ var __webpack_exports__workingCopy = __webpack_exports__.lw;
567
+ export { __webpack_exports__ACTOR_BRANCH_METADATA_KEY as ACTOR_BRANCH_METADATA_KEY, __webpack_exports__DRAFT_TEST_RETAIN as DRAFT_TEST_RETAIN, __webpack_exports__DefinitionBundleService as DefinitionBundleService, __webpack_exports__DefinitionCacheService as DefinitionCacheService, __webpack_exports__ENTITY_COMPARED_KEYS as ENTITY_COMPARED_KEYS, __webpack_exports__ENTITY_FLOW_PATHS as ENTITY_FLOW_PATHS, __webpack_exports__EntityBuilderConfigService as EntityBuilderConfigService, __webpack_exports__EntityBuilderDataSourceProvider as EntityBuilderDataSourceProvider, __webpack_exports__EntityDefinitionService as EntityDefinitionService, __webpack_exports__EntityPermissionService as EntityPermissionService, __webpack_exports__FIELD_COMPARED_KEYS as FIELD_COMPARED_KEYS, __webpack_exports__FieldDefinitionService as FieldDefinitionService, __webpack_exports__FlowDefinitionService as FlowDefinitionService, __webpack_exports__FlowExecutionService as FlowExecutionService, __webpack_exports__FlowExecutorService as FlowExecutorService, __webpack_exports__FlowReferenceProvider as FlowReferenceProvider, __webpack_exports__FlowRuntimeService as FlowRuntimeService, __webpack_exports__GenericEntityService as GenericEntityService, __webpack_exports__GenericEntityServiceFactory as GenericEntityServiceFactory, __webpack_exports__NON_INDEXABLE_FIELD_TYPES as NON_INDEXABLE_FIELD_TYPES, __webpack_exports__RESERVED_WORDS as RESERVED_WORDS, __webpack_exports__ReferenceScannerService as ReferenceScannerService, __webpack_exports__SYSTEM_COLUMN_NAMES as SYSTEM_COLUMN_NAMES, __webpack_exports__SchemaChangeExecutor as SchemaChangeExecutor, __webpack_exports__SchemaDialectAdapterService as SchemaDialectAdapterService, __webpack_exports__SchemaEvolutionService as SchemaEvolutionService, __webpack_exports__SchemaRegistryService as SchemaRegistryService, __webpack_exports__SchemaSyncService as SchemaSyncService, __webpack_exports__actorMetadata as actorMetadata, __webpack_exports__addUnique as addUnique, __webpack_exports__applyVariables as applyVariables, __webpack_exports__assertIndexableField as assertIndexableField, __webpack_exports__assertValidIdentifier as assertValidIdentifier, __webpack_exports__auditColumns as auditColumns, __webpack_exports__buildEntityFlow as buildEntityFlow, __webpack_exports__buildFieldColumn as buildFieldColumn, __webpack_exports__buildSystemColumns as buildSystemColumns, __webpack_exports__bundleChecksum as bundleChecksum, __webpack_exports__bundleSubject as bundleSubject, __webpack_exports__byCode as byCode, __webpack_exports__calledFlowSlugs as calledFlowSlugs, __webpack_exports__canonicalJson as canonicalJson, __webpack_exports__defaultFlowPermissionCode as defaultFlowPermissionCode, __webpack_exports__describeImpact as describeImpact, __webpack_exports__diffEntities as diffEntities, __webpack_exports__entityFlowSlug as entityFlowSlug, __webpack_exports__extractVariables as extractVariables, __webpack_exports__fitIdentifier as fitIdentifier, __webpack_exports__flowNotFound as flowNotFound, __webpack_exports__flowPermissions as flowPermissions, __webpack_exports__flowTimeout as flowTimeout, __webpack_exports__indexName as indexName, __webpack_exports__isDestructiveSchemaAction as isDestructiveSchemaAction, __webpack_exports__isIndexableFieldType as isIndexableFieldType, __webpack_exports__isPublished as isPublished, __webpack_exports__mapDatabaseError as mapDatabaseError, __webpack_exports__mapSchemaError as mapSchemaError, __webpack_exports__matchDefinitions as matchDefinitions, __webpack_exports__orderFlows as orderFlows, __webpack_exports__plainIndex as plainIndex, __webpack_exports__planTypeConversion as planTypeConversion, __webpack_exports__readBundleFile as readBundleFile, __webpack_exports__relationTargetCodes as relationTargetCodes, __webpack_exports__requestInfo as requestInfo, __webpack_exports__sameColumns as sameColumns, __webpack_exports__snapshotOf as snapshotOf, __webpack_exports__softDeleteColumn as softDeleteColumn, __webpack_exports__sqlTypeFor as sqlTypeFor, __webpack_exports__stripApiKeys as stripApiKeys, __webpack_exports__tableUnique as tableUnique, __webpack_exports__toFlowSettings as toFlowSettings, __webpack_exports__typeFamily as typeFamily, __webpack_exports__validateRecord as validateRecord, __webpack_exports__workingCopy as workingCopy };
@@ -1,10 +1,6 @@
1
- export declare const API_KEY_PREFIX_LENGTH = 11;
2
- export declare function generateApiKey(): {
3
- key: string;
4
- prefix: string;
5
- hash: string;
6
- };
1
+ import { type IFlowNode, type IStoredApiKey } from './flow.types.js';
7
2
  export declare const hashApiKey: (key: string) => string;
8
3
  export declare const apiKeyPrefix: (key: string) => string;
9
4
  export declare function looksLikeApiKey(key: unknown): key is string;
10
- export declare function apiKeyMatches(presented: string, storedHash: string): boolean;
5
+ export declare const apiKeyOpens: (stored: IStoredApiKey | null, presented: unknown) => boolean;
6
+ export declare function sealApiKeys(nodes: IFlowNode[]): IFlowNode[];
@@ -1,19 +1,20 @@
1
1
  import { type IMessageRef } from '@flusys/nestjs-shared/interfaces';
2
- import { type FlowAuthMode, type FlowBodyType, type IFlowInputField, type IFlowSettings } from './flow.types.js';
2
+ import { type FlowMessageService, type IFlowEndpoint, type IFlowSettings } from './flow.types.js';
3
3
  export interface IFlowValidationResult {
4
4
  errors: IMessageRef[];
5
5
  warnings: IMessageRef[];
6
6
  }
7
7
  export interface ICallableFlow {
8
8
  isActive: boolean;
9
- authMode: FlowAuthMode;
10
- bodyType?: FlowBodyType;
11
- inputSchema: IFlowInputField[];
9
+ endpoints: Array<Omit<IFlowEndpoint, 'nodeId'>>;
12
10
  calls: string[];
13
11
  }
14
12
  export interface IFlowValidationContext {
15
13
  knownEntityCodes?: Set<string>;
16
14
  knownFlows?: Map<string, ICallableFlow>;
15
+ messageServices?: Partial<Record<FlowMessageService, boolean>>;
16
+ companyMembers?: boolean;
17
17
  }
18
18
  export declare function usesPermissionFunction(value: unknown, depth?: number): boolean;
19
19
  export declare function validateFlow(flow: IFlowSettings, context?: IFlowValidationContext): IFlowValidationResult;
20
+ export declare function callProblems(caller: IFlowSettings, slug: string, known: Map<string, ICallableFlow>): IMessageRef[];
@@ -0,0 +1,2 @@
1
+ import { type ILogicNode } from '@flusys/nestjs-shared/interfaces';
2
+ export declare const permissionAction: (code: string) => ILogicNode;
@@ -1,9 +1,9 @@
1
- import { type ILoggedUserInfo, type IMessageRef } from '@flusys/nestjs-shared/interfaces';
1
+ import { type IEmailAdapter, type ILogicNode, type ILoggedUserInfo, type IMessageRef, type INotificationAdapter, type IUserCompanyAccess } from '@flusys/nestjs-shared/interfaces';
2
2
  import { type QueryRunner } from 'typeorm';
3
3
  import { type IGenericRecord } from '../interfaces/generic-record.interface.js';
4
4
  import { type IRulePermissionResolver, type RuleEngineService, type RuleExpression } from '../rule-engine/index.js';
5
5
  import { type IFlowHttpRequest, type IFlowHttpResponse } from './flow-http.client.js';
6
- import { type FlowInput, type FlowRunAs, type FlowRunMode } from './flow.types.js';
6
+ import { type FlowInput, type FlowRunMode } from './flow.types.js';
7
7
  export interface IFlowTraceEntry {
8
8
  nodeId: string;
9
9
  name: string;
@@ -17,14 +17,18 @@ export interface IFlowTraceEntry {
17
17
  }
18
18
  export interface IPendingRecordEvent {
19
19
  entityCode: string;
20
- action: 'created' | 'updated' | 'deleted';
20
+ action: 'created' | 'updated' | 'deleted' | 'purged';
21
21
  row: IGenericRecord;
22
22
  }
23
23
  export interface IPendingFlowEvent {
24
24
  eventName: string;
25
25
  payload: Record<string, unknown>;
26
26
  }
27
- export type IPendingEvent = IPendingRecordEvent | IPendingFlowEvent;
27
+ export interface IPendingDelivery {
28
+ delivery: string;
29
+ send: () => Promise<void>;
30
+ }
31
+ export type IPendingEvent = IPendingRecordEvent | IPendingFlowEvent | IPendingDelivery;
28
32
  export interface IFlowLoopScope {
29
33
  item: unknown;
30
34
  index: number;
@@ -36,18 +40,19 @@ export interface IFlowSavePoint {
36
40
  at: string;
37
41
  }
38
42
  export interface IFlowRunState {
43
+ startAt?: string;
39
44
  input: FlowInput;
40
45
  vars: Record<string, unknown>;
41
46
  context: Record<string, unknown>;
42
47
  loop?: IFlowLoopScope;
43
48
  request: Record<string, unknown>;
44
49
  user: ILoggedUserInfo | null;
50
+ authorization?: string;
45
51
  permissions?: IRulePermissionResolver;
46
52
  mode: FlowRunMode;
47
- runAs: FlowRunAs;
48
- systemAuthorized?: boolean;
49
53
  steps: number;
50
54
  httpCalls: number;
55
+ messages: number;
51
56
  writes: number;
52
57
  deadline: number;
53
58
  qr?: QueryRunner;
@@ -64,20 +69,25 @@ export interface IFlowRunState {
64
69
  export interface IFlowEnv {
65
70
  ruleEngine: RuleEngineService;
66
71
  entityService(entityCode: string, queryRunner?: QueryRunner): Promise<IFlowEntityAccess>;
67
- callFlow(slug: string, input: unknown, state: IFlowRunState): Promise<unknown>;
72
+ callFlow(slug: string, input: unknown, state: IFlowRunState, endpoint?: string): Promise<unknown>;
68
73
  http(request: IFlowHttpRequest): Promise<IFlowHttpResponse>;
69
74
  publish(eventName: string, payload: Record<string, unknown>, user: ILoggedUserInfo | null): Promise<void>;
70
75
  atomic<T>(state: IFlowRunState, work: () => Promise<T>): Promise<T>;
71
76
  commit(state: IFlowRunState): Promise<void>;
72
- assertPermission(code: string, user: ILoggedUserInfo | null): Promise<void>;
77
+ companyAccess(userId: string): Promise<IUserCompanyAccess>;
78
+ branchTree?(branchIds: string[]): Promise<string[]>;
79
+ companyMembers?(companyId: string, branchIds?: string[]): Promise<string[]>;
80
+ assertPermissions(logic: ILogicNode, user: ILoggedUserInfo | null): Promise<void>;
73
81
  allowPrivateHttp: boolean;
82
+ notifications?: INotificationAdapter;
83
+ email?: IEmailAdapter;
74
84
  }
75
85
  export interface IFlowEntityAccess {
76
86
  insert(dto: Record<string, unknown>, user: ILoggedUserInfo | null, options?: IFlowWriteOptions): Promise<IGenericRecord>;
77
87
  update(dto: Record<string, unknown> & {
78
88
  id: string;
79
89
  }, user: ILoggedUserInfo | null, options?: IFlowWriteOptions): Promise<IGenericRecord>;
80
- delete(id: string, user: ILoggedUserInfo | null, options?: IFlowWriteOptions): Promise<unknown>;
90
+ delete(id: string, user: ILoggedUserInfo | null, options?: IFlowWriteOptions): Promise<'deleted' | 'purged'>;
81
91
  findById(id: string, options?: IFlowReadOptions): Promise<IGenericRecord>;
82
92
  getAll(search: string | undefined, dto: {
83
93
  filter?: Record<string, unknown>;
@@ -1,12 +1,13 @@
1
+ import { type ILogicNode } from '@flusys/nestjs-shared/interfaces';
1
2
  import { type RecordFilterOp } from '../interfaces/generic-record.interface.js';
2
3
  import { type RuleExpression, type RuleGroup } from '../rule-engine/index.js';
3
- export declare const FLOW_NODE_TYPES: readonly ["trigger", "validate", "permission_check", "set", "condition", "switch", "foreach", "entity_insert", "entity_update", "entity_delete", "entity_get", "entity_query", "commit", "call_flow", "http_request", "publish_event", "respond", "code"];
4
+ export declare const FLOW_NODE_TYPES: readonly ["trigger", "validate", "permission_check", "company_branch_check", "set", "condition", "switch", "foreach", "entity_insert", "entity_update", "entity_delete", "entity_get", "entity_query", "commit", "call_flow", "http_request", "publish_event", "send_notification", "send_email", "respond", "code"];
4
5
  export type FlowNodeType = (typeof FLOW_NODE_TYPES)[number];
5
6
  export declare const NON_CONTINUABLE_NODE_TYPES: ReadonlySet<FlowNodeType>;
6
7
  export declare const FLOW_AUTH_MODES: readonly ["public", "api_key", "jwt", "permission", "internal"];
7
8
  export type FlowAuthMode = (typeof FLOW_AUTH_MODES)[number];
8
- export declare const FLOW_RUN_AS: readonly ["caller", "system"];
9
- export type FlowRunAs = (typeof FLOW_RUN_AS)[number];
9
+ export declare const DEFAULT_AUTH_MODE: FlowAuthMode;
10
+ export declare const KEYLESS_AUTH_MODES: ReadonlySet<FlowAuthMode>;
10
11
  export type FlowRunMode = 'live' | 'dry_run';
11
12
  export declare const FLOW_BODY_TYPES: readonly ["object", "list"];
12
13
  export type FlowBodyType = (typeof FLOW_BODY_TYPES)[number];
@@ -52,11 +53,6 @@ export interface IFlowGraph {
52
53
  }
53
54
  export interface IFlowSettings extends IFlowGraph {
54
55
  slug: string;
55
- authMode: FlowAuthMode;
56
- runAs: FlowRunAs;
57
- isTransactional: boolean;
58
- bodyType: FlowBodyType;
59
- inputSchema: IFlowInputField[];
60
56
  }
61
57
  export type ExpressionMap = Record<string, RuleExpression>;
62
58
  export interface IValidateCheck {
@@ -73,9 +69,24 @@ export interface IValidateConfig {
73
69
  }
74
70
  export type PermissionDeniedMode = 'reject' | 'branch';
75
71
  export interface IPermissionCheckConfig {
76
- codes: string[] | string;
77
- match?: 'any' | 'all';
78
- branch?: RuleExpression | null;
72
+ permissions: ILogicNode;
73
+ onDenied?: PermissionDeniedMode;
74
+ statusCode?: number;
75
+ message?: string;
76
+ }
77
+ export declare const FLOW_ACCESS_SUBJECTS: readonly ["caller", "user"];
78
+ export type FlowAccessSubject = (typeof FLOW_ACCESS_SUBJECTS)[number];
79
+ export declare const FLOW_BRANCH_MATCHES: readonly ["direct", "within"];
80
+ export type FlowBranchMatch = (typeof FLOW_BRANCH_MATCHES)[number];
81
+ export declare const FLOW_BRANCH_COMPANIES: readonly ["any", "current"];
82
+ export type FlowBranchCompany = (typeof FLOW_BRANCH_COMPANIES)[number];
83
+ export interface ICompanyBranchCheckConfig {
84
+ subject?: FlowAccessSubject;
85
+ userId?: RuleExpression;
86
+ companyIds?: RuleExpression;
87
+ branchIds?: RuleExpression;
88
+ branchMatch?: FlowBranchMatch;
89
+ branchCompany?: FlowBranchCompany;
79
90
  onDenied?: PermissionDeniedMode;
80
91
  statusCode?: number;
81
92
  message?: string;
@@ -154,8 +165,25 @@ export interface IEntityQueryConfig {
154
165
  };
155
166
  limit?: number;
156
167
  }
168
+ export interface ITriggerConfig {
169
+ path?: string;
170
+ bodyType?: FlowBodyType;
171
+ inputSchema?: IFlowInputField[];
172
+ authMode?: FlowAuthMode;
173
+ permissions?: ILogicNode;
174
+ isTransactional?: boolean;
175
+ timeoutMs?: number;
176
+ rateLimitPerMinute?: number;
177
+ apiKey?: string | IStoredApiKey;
178
+ }
179
+ export interface IStoredApiKey {
180
+ prefix: string;
181
+ hash: string;
182
+ }
183
+ export declare function isStoredApiKey(value: unknown): value is IStoredApiKey;
157
184
  export interface ICallFlowConfig {
158
185
  flowSlug: string;
186
+ endpoint?: string;
159
187
  input?: ExpressionMap;
160
188
  inputList?: RuleExpression;
161
189
  }
@@ -165,11 +193,57 @@ export interface IHttpRequestConfig {
165
193
  headers?: ExpressionMap;
166
194
  body?: ExpressionMap;
167
195
  timeoutMs?: number;
196
+ forwardAuth?: boolean;
168
197
  }
169
198
  export interface IPublishEventConfig {
170
199
  eventName: string;
171
200
  payload: ExpressionMap;
172
201
  }
202
+ export declare const FLOW_MESSAGE_SERVICES: {
203
+ readonly send_notification: "notification";
204
+ readonly send_email: "email";
205
+ };
206
+ export type FlowMessageNodeType = keyof typeof FLOW_MESSAGE_SERVICES;
207
+ export type FlowMessageService = (typeof FLOW_MESSAGE_SERVICES)[FlowMessageNodeType];
208
+ export declare const isMessageNode: (type: string) => type is FlowMessageNodeType;
209
+ export declare const FLOW_NOTIFICATION_TYPES: readonly ["info", "success", "warning", "error"];
210
+ export type FlowNotificationType = (typeof FLOW_NOTIFICATION_TYPES)[number];
211
+ export declare const FLOW_NOTIFICATION_TARGETS: readonly ["one", "many", "company"];
212
+ export type FlowNotificationTarget = (typeof FLOW_NOTIFICATION_TARGETS)[number];
213
+ export declare const FLOW_EMAIL_TARGETS: readonly ["one", "many"];
214
+ export type FlowEmailTarget = (typeof FLOW_EMAIL_TARGETS)[number];
215
+ export interface ISendNotificationConfig {
216
+ target?: FlowNotificationTarget;
217
+ items?: RuleExpression;
218
+ userIds?: RuleExpression;
219
+ companyIds?: RuleExpression;
220
+ branchIds?: RuleExpression;
221
+ title: RuleExpression;
222
+ message?: RuleExpression;
223
+ type?: FlowNotificationType;
224
+ data?: ExpressionMap;
225
+ companyId?: RuleExpression;
226
+ realtime?: boolean;
227
+ }
228
+ export declare const FLOW_EMAIL_MODES: readonly ["content", "template"];
229
+ export type FlowEmailMode = (typeof FLOW_EMAIL_MODES)[number];
230
+ export declare const FLOW_EMAIL_FORMATS: readonly ["text", "html"];
231
+ export type FlowEmailFormat = (typeof FLOW_EMAIL_FORMATS)[number];
232
+ export interface ISendEmailConfig {
233
+ target?: FlowEmailTarget;
234
+ items?: RuleExpression;
235
+ to: RuleExpression;
236
+ cc?: RuleExpression;
237
+ bcc?: RuleExpression;
238
+ replyTo?: RuleExpression;
239
+ mode?: FlowEmailMode;
240
+ subject?: RuleExpression;
241
+ body?: RuleExpression;
242
+ format?: FlowEmailFormat;
243
+ templateSlug?: string;
244
+ variables?: ExpressionMap;
245
+ emailConfigId?: string;
246
+ }
173
247
  export interface IRespondConfig {
174
248
  statusCode: number;
175
249
  body?: ExpressionMap;
@@ -187,6 +261,13 @@ export declare const FLOW_LIMITS: {
187
261
  readonly MAX_LOOP_DEPTH: 3;
188
262
  readonly MAX_CALL_DEPTH: 5;
189
263
  readonly MAX_HTTP_CALLS: 10;
264
+ readonly MAX_MESSAGES_PER_RUN: 100;
265
+ readonly MAX_NOTIFICATION_RECIPIENTS: 500;
266
+ readonly MAX_COMPANY_NOTIFICATION_RECIPIENTS: 5000;
267
+ readonly MAX_EMAIL_RECIPIENTS: 50;
268
+ readonly MAX_NOTIFICATION_TITLE_LENGTH: 255;
269
+ readonly MAX_EMAIL_SUBJECT_LENGTH: 255;
270
+ readonly MAX_EMAIL_TEMPLATE_SLUG_LENGTH: 255;
190
271
  readonly MAX_HTTP_TIMEOUT_MS: 15000;
191
272
  readonly MAX_HTTP_RESPONSE_BYTES: 1000000;
192
273
  readonly MAX_QUERY_LIMIT: 200;
@@ -197,6 +278,8 @@ export declare const FLOW_LIMITS: {
197
278
  readonly DEFAULT_TIMEOUT_MS: 30000;
198
279
  readonly MIN_TIMEOUT_MS: 1000;
199
280
  readonly MAX_TIMEOUT_MS: 120000;
281
+ readonly DEFAULT_RATE_LIMIT_PER_MINUTE: 60;
282
+ readonly MAX_RATE_LIMIT_PER_MINUTE: 100000;
200
283
  readonly TRACE_PREVIEW_CHARS: 2000;
201
284
  readonly MAX_INPUT_FIELDS: 50;
202
285
  readonly MAX_INPUT_DEPTH: 4;
@@ -214,4 +297,25 @@ export declare const FLOW_LIMITS: {
214
297
  export declare const FLOW_NODE_ID_PATTERN: RegExp;
215
298
  export declare const FLOW_SLUG_PATTERN: RegExp;
216
299
  export declare const FLOW_INPUT_NAME_PATTERN: RegExp;
300
+ export declare const FLOW_ENDPOINT_PATH_PATTERN: RegExp;
301
+ export declare const FLOW_ID_PATTERN: RegExp;
302
+ export interface IFlowEndpoint {
303
+ nodeId: string;
304
+ path: string | null;
305
+ bodyType: FlowBodyType;
306
+ inputSchema: IFlowInputField[];
307
+ authMode: FlowAuthMode;
308
+ permissions: ILogicNode | null;
309
+ isTransactional: boolean;
310
+ timeoutMs: number;
311
+ rateLimitPerMinute: number;
312
+ apiKey: IStoredApiKey | null;
313
+ }
314
+ type EndpointSource = Pick<IFlowSettings, 'nodes'>;
315
+ export declare const isFunctionFlow: (flow: EndpointSource) => boolean;
316
+ export declare function triggerPath(node: Pick<IFlowNode, 'config'>): string | null;
317
+ export declare function flowEndpoints(flow: EndpointSource): IFlowEndpoint[];
318
+ export declare function findEndpoint(flow: EndpointSource, path?: string | null): IFlowEndpoint | undefined;
319
+ export declare function startEndpoint(flow: EndpointSource, nodeId?: string): IFlowEndpoint | undefined;
217
320
  export declare function portsOf(node: Pick<IFlowNode, 'type' | 'config'>): string[];
321
+ export {};
@@ -0,0 +1,12 @@
1
+ import { type CallHandler, type ExecutionContext, type NestInterceptor } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { type Observable } from 'rxjs';
4
+ import { EntityBuilderConfigService } from '../services/entity-builder-config.service.js';
5
+ export declare const DesignerWrites: (...handlers: string[]) => import("@nestjs/common").CustomDecorator<string>;
6
+ export declare class DesignerWritableInterceptor implements NestInterceptor {
7
+ private readonly reflector;
8
+ private readonly config;
9
+ constructor(reflector: Reflector, config: EntityBuilderConfigService);
10
+ intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
11
+ private isLocked;
12
+ }
package/guards/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './flow-access.guard.js';
2
+ export * from './designer-writable.interceptor.js';