@flusys/nestjs-entity-builder 9.1.0-rc.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 (115) hide show
  1. package/README.md +103 -0
  2. package/config/entity-builder.constants.d.ts +6 -0
  3. package/config/event-actions.d.ts +8 -0
  4. package/config/index.d.ts +3 -0
  5. package/config/message-keys.d.ts +481 -0
  6. package/controllers/entity-definition.controller.d.ts +40 -0
  7. package/controllers/field-definition.controller.d.ts +22 -0
  8. package/controllers/flow-api-key.controller.d.ts +14 -0
  9. package/controllers/flow-definition.controller.d.ts +45 -0
  10. package/controllers/flow-execution.controller.d.ts +21 -0
  11. package/controllers/flow-runtime.controller.d.ts +16 -0
  12. package/controllers/index.d.ts +6 -0
  13. package/docs/entity-builder-swagger.config.d.ts +3 -0
  14. package/docs/index.d.ts +1 -0
  15. package/dtos/entity-definition.dto.d.ts +58 -0
  16. package/dtos/field-definition.dto.d.ts +42 -0
  17. package/dtos/flow.dto.d.ts +85 -0
  18. package/dtos/index.d.ts +3 -0
  19. package/dtos/schema-change.dto.d.ts +53 -0
  20. package/entities/entity-definition.entity.d.ts +15 -0
  21. package/entities/field-definition.entity.d.ts +23 -0
  22. package/entities/flow-api-key.entity.d.ts +10 -0
  23. package/entities/flow-definition.entity.d.ts +20 -0
  24. package/entities/flow-execution.entity.d.ts +18 -0
  25. package/entities/index.d.ts +14 -0
  26. package/entities/schema-change-log.entity.d.ts +15 -0
  27. package/enums/ddl-operation.enum.d.ts +13 -0
  28. package/enums/entity-status.enum.d.ts +5 -0
  29. package/enums/field-type.enum.d.ts +15 -0
  30. package/enums/index.d.ts +3 -0
  31. package/fesm/21.js +515 -0
  32. package/fesm/362.js +1074 -0
  33. package/fesm/489.js +1238 -0
  34. package/fesm/606.js +1655 -0
  35. package/fesm/719.js +3615 -0
  36. package/fesm/794.js +1050 -0
  37. package/fesm/996.js +6537 -0
  38. package/fesm/config/index.js +126 -0
  39. package/fesm/controllers/index.js +28 -0
  40. package/fesm/docs/index.js +82 -0
  41. package/fesm/dtos/index.js +327 -0
  42. package/fesm/entities/index.js +18 -0
  43. package/fesm/enums/index.js +97 -0
  44. package/fesm/guards/index.js +228 -0
  45. package/fesm/index.js +1125 -0
  46. package/fesm/interfaces/index.js +80 -0
  47. package/fesm/modules/index.js +642 -0
  48. package/fesm/rule-engine/index.js +21 -0
  49. package/fesm/runtime.js +85 -0
  50. package/fesm/services/index.js +495 -0
  51. package/flow-engine/flow-api-key.d.ts +10 -0
  52. package/flow-engine/flow-code-sandbox.d.ts +5 -0
  53. package/flow-engine/flow-engine.d.ts +22 -0
  54. package/flow-engine/flow-graph.validator.d.ts +19 -0
  55. package/flow-engine/flow-http.client.d.ts +15 -0
  56. package/flow-engine/flow-input.validator.d.ts +7 -0
  57. package/flow-engine/flow-node-handlers.d.ts +5 -0
  58. package/flow-engine/flow-rate-limiter.d.ts +8 -0
  59. package/flow-engine/flow-reference.d.ts +7 -0
  60. package/flow-engine/flow-run.types.d.ts +120 -0
  61. package/flow-engine/flow.errors.d.ts +27 -0
  62. package/flow-engine/flow.types.d.ts +217 -0
  63. package/flow-engine/index.d.ts +4 -0
  64. package/flow-engine/redact.d.ts +3 -0
  65. package/flow-engine/ssrf-guard.d.ts +6 -0
  66. package/guards/flow-access.guard.d.ts +11 -0
  67. package/guards/index.d.ts +1 -0
  68. package/index.d.ts +11 -0
  69. package/interfaces/entity-builder-module.interface.d.ts +28 -0
  70. package/interfaces/field-definition.interface.d.ts +33 -0
  71. package/interfaces/flow-definition.interface.d.ts +20 -0
  72. package/interfaces/generic-record.interface.d.ts +15 -0
  73. package/interfaces/index.d.ts +5 -0
  74. package/interfaces/reference-provider.interface.d.ts +8 -0
  75. package/interfaces/schema-dialect-adapter.interface.d.ts +15 -0
  76. package/modules/entity-builder.module.d.ts +10 -0
  77. package/modules/index.d.ts +1 -0
  78. package/package.json +93 -0
  79. package/rule-engine/index.d.ts +3 -0
  80. package/rule-engine/rule-engine.service.d.ts +39 -0
  81. package/rule-engine/rule-evaluation-context.interface.d.ts +28 -0
  82. package/rule-engine/rule-ip.d.ts +3 -0
  83. package/rule-engine/rule-permission.d.ts +10 -0
  84. package/rule-engine/rule-regex.d.ts +4 -0
  85. package/rule-engine/rule-values.d.ts +5 -0
  86. package/rule-engine/rule.interface.d.ts +79 -0
  87. package/services/database-error.mapper.d.ts +2 -0
  88. package/services/definition-cache.service.d.ts +8 -0
  89. package/services/entity-builder-config.service.d.ts +12 -0
  90. package/services/entity-builder-datasource.provider.d.ts +24 -0
  91. package/services/entity-definition.service.d.ts +17 -0
  92. package/services/entity-flow-scaffold.d.ts +26 -0
  93. package/services/entity-permission.service.d.ts +8 -0
  94. package/services/field-definition.service.d.ts +17 -0
  95. package/services/field-type-conversion.d.ts +15 -0
  96. package/services/field-value-validator.d.ts +17 -0
  97. package/services/flow-api-key.service.d.ts +31 -0
  98. package/services/flow-definition.service.d.ts +49 -0
  99. package/services/flow-execution.service.d.ts +37 -0
  100. package/services/flow-executor.service.d.ts +40 -0
  101. package/services/flow-reference.provider.d.ts +13 -0
  102. package/services/flow-runtime.service.d.ts +29 -0
  103. package/services/generic-entity-service.factory.d.ts +12 -0
  104. package/services/generic-entity.service.d.ts +67 -0
  105. package/services/identifier-rules.d.ts +9 -0
  106. package/services/index.d.ts +27 -0
  107. package/services/reference-rewrite.d.ts +7 -0
  108. package/services/reference-scanner.service.d.ts +10 -0
  109. package/services/schema-change-executor.service.d.ts +39 -0
  110. package/services/schema-change.types.d.ts +59 -0
  111. package/services/schema-columns.d.ts +26 -0
  112. package/services/schema-dialect-adapter.service.d.ts +13 -0
  113. package/services/schema-evolution.service.d.ts +67 -0
  114. package/services/schema-registry.service.d.ts +13 -0
  115. package/services/schema-sync.service.d.ts +28 -0
package/fesm/606.js ADDED
@@ -0,0 +1,1655 @@
1
+ import { lastValueFrom } from "rxjs";
2
+ import * as __rspack_external__flusys_nestjs_shared_guards_3f79ddd1 from "@flusys/nestjs-shared/guards";
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];
6
+ export const __webpack_modules__ = {
7
+ 2517(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
8
+
9
+ // EXPORTS
10
+ __webpack_require__.d(__webpack_exports__, {
11
+ hv: () => (/* reexport */ EntityDefinitionController),
12
+ GX: () => (/* reexport */ FieldDefinitionController),
13
+ Sv: () => (/* reexport */ FlowApiKeyController),
14
+ W8: () => (/* reexport */ FlowDefinitionController),
15
+ VU: () => (/* reexport */ FlowExecutionController),
16
+ bw: () => (/* reexport */ FlowRuntimeController)
17
+ });
18
+
19
+ // EXTERNAL MODULE: external "@flusys/nestjs-shared"
20
+ var nestjs_shared_ = __webpack_require__(3422);
21
+ // EXTERNAL MODULE: external "@nestjs/common"
22
+ var common_ = __webpack_require__(6157);
23
+ // EXTERNAL MODULE: external "@nestjs/swagger"
24
+ var swagger_ = __webpack_require__(6176);
25
+ // EXTERNAL MODULE: external "@flusys/nestjs-shared/guards"
26
+ var guards_ = __webpack_require__(3513);
27
+ ;// CONCATENATED MODULE: external "@flusys/nestjs-shared/decorators"
28
+
29
+ // EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
30
+ var modules_ = __webpack_require__(1236);
31
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/config/message-keys.ts
32
+ var message_keys = __webpack_require__(5732);
33
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/dtos/entity-definition.dto.ts
34
+ var entity_definition_dto = __webpack_require__(680);
35
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/dtos/schema-change.dto.ts
36
+ var schema_change_dto = __webpack_require__(4945);
37
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/schema-evolution.service.ts
38
+ var schema_evolution_service = __webpack_require__(3606);
39
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/entity-definition.service.ts
40
+ var entity_definition_service = __webpack_require__(1296);
41
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/schema-sync.service.ts
42
+ var schema_sync_service = __webpack_require__(3474);
43
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/entity-definition.controller.ts
44
+ function _ts_decorate(decorators, target, key, desc) {
45
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
47
+ r = Reflect.decorate(decorators, target, key, desc);
48
+ } else {
49
+ for(var i = decorators.length - 1; i >= 0; i--){
50
+ if (d = decorators[i]) {
51
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
52
+ }
53
+ }
54
+ }
55
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
56
+ }
57
+ function _ts_metadata(metadataKey, metadataValue) {
58
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
59
+ return Reflect.metadata(metadataKey, metadataValue);
60
+ }
61
+ }
62
+ function _ts_param(paramIndex, decorator) {
63
+ return function(target, key) {
64
+ decorator(target, key, paramIndex);
65
+ };
66
+ }
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ class EntityDefinitionController extends (0,nestjs_shared_.createApiController)(entity_definition_dto/* .CreateDynamicEntityDto */.Ot, entity_definition_dto/* .UpdateEntityDefinitionDto */.hL, entity_definition_dto/* .EntityDefinitionResponseDto */.d_, {
80
+ entityName: 'entity_builder.entity_definition',
81
+ enabledEndpoints: [
82
+ 'getById',
83
+ 'getByIds',
84
+ 'getAll',
85
+ 'getByFilter'
86
+ ],
87
+ security: {
88
+ getById: {
89
+ level: 'permission',
90
+ permissions: [
91
+ nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ
92
+ ]
93
+ },
94
+ getByIds: {
95
+ level: 'permission',
96
+ permissions: [
97
+ nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ
98
+ ]
99
+ },
100
+ getAll: {
101
+ level: 'permission',
102
+ permissions: [
103
+ nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ
104
+ ]
105
+ },
106
+ getByFilter: {
107
+ level: 'permission',
108
+ permissions: [
109
+ nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ
110
+ ]
111
+ }
112
+ }
113
+ }) {
114
+ entityDefinitionService;
115
+ schemaSyncService;
116
+ evolution;
117
+ permissionCache;
118
+ constructor(entityDefinitionService, schemaSyncService, evolution, permissionCache){
119
+ super(entityDefinitionService), this.entityDefinitionService = entityDefinitionService, this.schemaSyncService = schemaSyncService, this.evolution = evolution, this.permissionCache = permissionCache;
120
+ }
121
+ async createEntity(dto, user) {
122
+ const { definition, warnings } = await this.schemaSyncService.createEntity(dto, user);
123
+ return {
124
+ ...this.ok(definition, 'Entity created successfully', message_keys/* .ENTITY_DEFINITION_MESSAGES.CREATE_SUCCESS */.pL.CREATE_SUCCESS),
125
+ warnings
126
+ };
127
+ }
128
+ async planCreateEntity(dto, user) {
129
+ return this.ok(await this.schemaSyncService.planCreateEntity(dto, user), 'Plan generated', message_keys/* .ENTITY_DEFINITION_MESSAGES.PLAN_SUCCESS */.pL.PLAN_SUCCESS);
130
+ }
131
+ async planChange(dto, user) {
132
+ // A plan counts records, so only someone who could apply the change may see it.
133
+ await this.permissionCache.assertPermission(user, (0,schema_evolution_service/* .isDestructiveSchemaAction */.C)(dto.action) ? nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.DELETE : nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.UPDATE);
134
+ return this.ok(await this.evolution.plan(dto, user), 'Plan generated', message_keys/* .ENTITY_DEFINITION_MESSAGES.PLAN_SUCCESS */.pL.PLAN_SUCCESS);
135
+ }
136
+ async applyChange(dto, user) {
137
+ if ((0,schema_evolution_service/* .isDestructiveSchemaAction */.C)(dto.action)) {
138
+ throw new common_.BadRequestException({
139
+ message: `'${dto.action}' deletes data permanently - use apply-destructive-change.`,
140
+ messageKey: message_keys/* .SCHEMA_MESSAGES.USE_DESTRUCTIVE_ENDPOINT */.Hu.USE_DESTRUCTIVE_ENDPOINT,
141
+ messageVariables: {
142
+ action: dto.action
143
+ }
144
+ });
145
+ }
146
+ return this.ok(await this.evolution.apply(dto, user), 'Change applied', message_keys/* .ENTITY_DEFINITION_MESSAGES.APPLY_SUCCESS */.pL.APPLY_SUCCESS);
147
+ }
148
+ async applyDestructiveChange(dto, user) {
149
+ if (!(0,schema_evolution_service/* .isDestructiveSchemaAction */.C)(dto.action)) {
150
+ throw new common_.BadRequestException({
151
+ message: "Only 'drop_entity' and 'purge_field' are applied here - use apply-change for the rest.",
152
+ messageKey: message_keys/* .SCHEMA_MESSAGES.USE_REGULAR_ENDPOINT */.Hu.USE_REGULAR_ENDPOINT
153
+ });
154
+ }
155
+ return this.ok(await this.evolution.apply(dto, user), 'Change applied', message_keys/* .ENTITY_DEFINITION_MESSAGES.APPLY_SUCCESS */.pL.APPLY_SUCCESS);
156
+ }
157
+ async inspect(dto) {
158
+ return this.ok(await this.evolution.inspect(dto.entityDefinitionId), 'Schema checked', message_keys/* .ENTITY_DEFINITION_MESSAGES.INSPECT_SUCCESS */.pL.INSPECT_SUCCESS);
159
+ }
160
+ async history(dto) {
161
+ return this.ok(await this.evolution.history(dto.entityDefinitionId), 'History loaded', message_keys/* .ENTITY_DEFINITION_MESSAGES.HISTORY_SUCCESS */.pL.HISTORY_SUCCESS);
162
+ }
163
+ ok(data, message, messageKey) {
164
+ return {
165
+ success: true,
166
+ message,
167
+ messageKey,
168
+ data
169
+ };
170
+ }
171
+ }
172
+ _ts_decorate([
173
+ (0,common_.Post)('create-entity'),
174
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
175
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.CREATE),
176
+ (0,swagger_.ApiBearerAuth)(),
177
+ (0,swagger_.ApiOperation)({
178
+ summary: 'Create a dynamic entity',
179
+ description: 'Creates an EntityDefinition row and its real database table (plus any initial fields) in one DDL transaction.'
180
+ }),
181
+ (0,swagger_.ApiBody)({
182
+ type: entity_definition_dto/* .CreateDynamicEntityDto */.Ot
183
+ }),
184
+ (0,swagger_.ApiResponse)({
185
+ status: 201,
186
+ type: nestjs_shared_.SingleResponseDto,
187
+ description: '`warnings`: follow-up steps that failed after the entity was created (permissions, endpoint flows)'
188
+ }),
189
+ _ts_param(0, (0,common_.Body)()),
190
+ _ts_param(1, (0,nestjs_shared_.CurrentUser)()),
191
+ _ts_metadata("design:type", Function),
192
+ _ts_metadata("design:paramtypes", [
193
+ typeof entity_definition_dto/* .CreateDynamicEntityDto */.Ot === "undefined" ? Object : entity_definition_dto/* .CreateDynamicEntityDto */.Ot,
194
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
195
+ ]),
196
+ _ts_metadata("design:returntype", Promise)
197
+ ], EntityDefinitionController.prototype, "createEntity", null);
198
+ _ts_decorate([
199
+ (0,common_.Post)('plan-create-entity'),
200
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
201
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.CREATE),
202
+ (0,swagger_.ApiBearerAuth)(),
203
+ (0,swagger_.ApiOperation)({
204
+ summary: 'Preview creating an entity: the real CREATE TABLE SQL, nothing is created'
205
+ }),
206
+ (0,swagger_.ApiBody)({
207
+ type: entity_definition_dto/* .CreateDynamicEntityDto */.Ot
208
+ }),
209
+ _ts_param(0, (0,common_.Body)()),
210
+ _ts_param(1, (0,nestjs_shared_.CurrentUser)()),
211
+ _ts_metadata("design:type", Function),
212
+ _ts_metadata("design:paramtypes", [
213
+ typeof entity_definition_dto/* .CreateDynamicEntityDto */.Ot === "undefined" ? Object : entity_definition_dto/* .CreateDynamicEntityDto */.Ot,
214
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
215
+ ]),
216
+ _ts_metadata("design:returntype", Promise)
217
+ ], EntityDefinitionController.prototype, "planCreateEntity", null);
218
+ _ts_decorate([
219
+ (0,common_.Post)('plan-change'),
220
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
221
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequireAnyPermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.UPDATE, nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.DELETE),
222
+ (0,swagger_.ApiBearerAuth)(),
223
+ (0,swagger_.ApiOperation)({
224
+ summary: 'Preview a structural change',
225
+ description: 'Dry run: returns the exact SQL (and its reverse), data checks, blockers, warnings and the flows that would be affected. Nothing changes. The plan counts records, so it needs the permission that applies the change: entity_definition.delete for drop_entity / purge_field, entity_definition.update for the rest. It never contains record values.'
226
+ }),
227
+ (0,swagger_.ApiBody)({
228
+ type: schema_change_dto/* .SchemaChangeRequestDto */.ym
229
+ }),
230
+ _ts_param(0, (0,common_.Body)()),
231
+ _ts_param(1, (0,nestjs_shared_.CurrentUser)()),
232
+ _ts_metadata("design:type", Function),
233
+ _ts_metadata("design:paramtypes", [
234
+ typeof schema_change_dto/* .SchemaChangeRequestDto */.ym === "undefined" ? Object : schema_change_dto/* .SchemaChangeRequestDto */.ym,
235
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
236
+ ]),
237
+ _ts_metadata("design:returntype", Promise)
238
+ ], EntityDefinitionController.prototype, "planChange", null);
239
+ _ts_decorate([
240
+ (0,common_.Post)('apply-change'),
241
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
242
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.UPDATE),
243
+ (0,swagger_.ApiBearerAuth)(),
244
+ (0,swagger_.ApiOperation)({
245
+ summary: 'Apply a structural change',
246
+ description: 'Add / edit / rename / restore / deprecate a field, change entity settings, or repair drift - in one locked transaction, with the SQL logged. Dropping data uses apply-destructive-change.'
247
+ }),
248
+ (0,swagger_.ApiBody)({
249
+ type: schema_change_dto/* .SchemaChangeRequestDto */.ym
250
+ }),
251
+ _ts_param(0, (0,common_.Body)()),
252
+ _ts_param(1, (0,nestjs_shared_.CurrentUser)()),
253
+ _ts_metadata("design:type", Function),
254
+ _ts_metadata("design:paramtypes", [
255
+ typeof schema_change_dto/* .SchemaChangeRequestDto */.ym === "undefined" ? Object : schema_change_dto/* .SchemaChangeRequestDto */.ym,
256
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
257
+ ]),
258
+ _ts_metadata("design:returntype", Promise)
259
+ ], EntityDefinitionController.prototype, "applyChange", null);
260
+ _ts_decorate([
261
+ (0,common_.Post)('apply-destructive-change'),
262
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
263
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.DELETE),
264
+ (0,swagger_.ApiBearerAuth)(),
265
+ (0,swagger_.ApiOperation)({
266
+ summary: 'Permanently delete a field (purge_field) or an entity (drop_entity)'
267
+ }),
268
+ (0,swagger_.ApiBody)({
269
+ type: schema_change_dto/* .SchemaChangeRequestDto */.ym
270
+ }),
271
+ _ts_param(0, (0,common_.Body)()),
272
+ _ts_param(1, (0,nestjs_shared_.CurrentUser)()),
273
+ _ts_metadata("design:type", Function),
274
+ _ts_metadata("design:paramtypes", [
275
+ typeof schema_change_dto/* .SchemaChangeRequestDto */.ym === "undefined" ? Object : schema_change_dto/* .SchemaChangeRequestDto */.ym,
276
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
277
+ ]),
278
+ _ts_metadata("design:returntype", Promise)
279
+ ], EntityDefinitionController.prototype, "applyDestructiveChange", null);
280
+ _ts_decorate([
281
+ (0,common_.Post)('inspect'),
282
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
283
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ),
284
+ (0,swagger_.ApiBearerAuth)(),
285
+ (0,swagger_.ApiOperation)({
286
+ summary: 'Compare an entity definition with its real table (drift check)'
287
+ }),
288
+ (0,swagger_.ApiBody)({
289
+ type: schema_change_dto/* .SchemaCheckRequestDto */.ct
290
+ }),
291
+ _ts_param(0, (0,common_.Body)()),
292
+ _ts_metadata("design:type", Function),
293
+ _ts_metadata("design:paramtypes", [
294
+ typeof schema_change_dto/* .SchemaCheckRequestDto */.ct === "undefined" ? Object : schema_change_dto/* .SchemaCheckRequestDto */.ct
295
+ ]),
296
+ _ts_metadata("design:returntype", Promise)
297
+ ], EntityDefinitionController.prototype, "inspect", null);
298
+ _ts_decorate([
299
+ (0,common_.Post)('schema-history'),
300
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
301
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ),
302
+ (0,swagger_.ApiBearerAuth)(),
303
+ (0,swagger_.ApiOperation)({
304
+ summary: 'Schema change history of an entity (with the SQL of each change)'
305
+ }),
306
+ (0,swagger_.ApiBody)({
307
+ type: schema_change_dto/* .SchemaCheckRequestDto */.ct
308
+ }),
309
+ _ts_param(0, (0,common_.Body)()),
310
+ _ts_metadata("design:type", Function),
311
+ _ts_metadata("design:paramtypes", [
312
+ typeof schema_change_dto/* .SchemaCheckRequestDto */.ct === "undefined" ? Object : schema_change_dto/* .SchemaCheckRequestDto */.ct
313
+ ]),
314
+ _ts_metadata("design:returntype", Promise)
315
+ ], EntityDefinitionController.prototype, "history", null);
316
+ EntityDefinitionController = _ts_decorate([
317
+ (0,swagger_.ApiTags)('Entity Builder - Entity Definitions'),
318
+ (0,common_.Controller)('entity-builder/entity-definitions'),
319
+ _ts_param(0, (0,common_.Inject)(entity_definition_service/* .EntityDefinitionService */.o)),
320
+ _ts_param(1, (0,common_.Inject)(schema_sync_service/* .SchemaSyncService */.W)),
321
+ _ts_param(2, (0,common_.Inject)(schema_evolution_service/* .SchemaEvolutionService */._)),
322
+ _ts_param(3, (0,common_.Inject)(modules_.SharedPermissionCacheService)),
323
+ _ts_metadata("design:type", Function),
324
+ _ts_metadata("design:paramtypes", [
325
+ typeof entity_definition_service/* .EntityDefinitionService */.o === "undefined" ? Object : entity_definition_service/* .EntityDefinitionService */.o,
326
+ typeof schema_sync_service/* .SchemaSyncService */.W === "undefined" ? Object : schema_sync_service/* .SchemaSyncService */.W,
327
+ typeof schema_evolution_service/* .SchemaEvolutionService */._ === "undefined" ? Object : schema_evolution_service/* .SchemaEvolutionService */._,
328
+ typeof modules_.SharedPermissionCacheService === "undefined" ? Object : modules_.SharedPermissionCacheService
329
+ ])
330
+ ], EntityDefinitionController);
331
+
332
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/dtos/field-definition.dto.ts
333
+ var field_definition_dto = __webpack_require__(2003);
334
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/field-definition.service.ts
335
+ var field_definition_service = __webpack_require__(9487);
336
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/field-definition.controller.ts
337
+ function field_definition_controller_ts_decorate(decorators, target, key, desc) {
338
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
339
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
340
+ r = Reflect.decorate(decorators, target, key, desc);
341
+ } else {
342
+ for(var i = decorators.length - 1; i >= 0; i--){
343
+ if (d = decorators[i]) {
344
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
345
+ }
346
+ }
347
+ }
348
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
349
+ }
350
+ function field_definition_controller_ts_metadata(metadataKey, metadataValue) {
351
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
352
+ return Reflect.metadata(metadataKey, metadataValue);
353
+ }
354
+ }
355
+ function field_definition_controller_ts_param(paramIndex, decorator) {
356
+ return function(target, key) {
357
+ decorator(target, key, paramIndex);
358
+ };
359
+ }
360
+
361
+
362
+
363
+
364
+
365
+ class FieldDefinitionController extends (0,nestjs_shared_.createApiController)(field_definition_dto/* .CreateFieldDefinitionDto */.Vj, field_definition_dto/* .UpdateFieldDefinitionDto */.C3, field_definition_dto/* .FieldDefinitionResponseDto */.C5, {
366
+ entityName: 'entity_builder.field_definition',
367
+ enabledEndpoints: [
368
+ 'getById',
369
+ 'getByIds',
370
+ 'getAll',
371
+ 'getByFilter'
372
+ ],
373
+ security: {
374
+ getById: {
375
+ level: 'permission',
376
+ permissions: [
377
+ nestjs_shared_.FIELD_DEFINITION_PERMISSIONS.READ
378
+ ]
379
+ },
380
+ getByIds: {
381
+ level: 'permission',
382
+ permissions: [
383
+ nestjs_shared_.FIELD_DEFINITION_PERMISSIONS.READ
384
+ ]
385
+ },
386
+ getAll: {
387
+ level: 'permission',
388
+ permissions: [
389
+ nestjs_shared_.FIELD_DEFINITION_PERMISSIONS.READ
390
+ ]
391
+ },
392
+ getByFilter: {
393
+ level: 'permission',
394
+ permissions: [
395
+ nestjs_shared_.FIELD_DEFINITION_PERMISSIONS.READ
396
+ ]
397
+ }
398
+ }
399
+ }) {
400
+ fieldDefinitionService;
401
+ constructor(fieldDefinitionService){
402
+ super(fieldDefinitionService), this.fieldDefinitionService = fieldDefinitionService;
403
+ }
404
+ }
405
+ FieldDefinitionController = field_definition_controller_ts_decorate([
406
+ (0,swagger_.ApiTags)('Entity Builder - Field Definitions'),
407
+ (0,common_.Controller)('entity-builder/field-definitions'),
408
+ field_definition_controller_ts_param(0, (0,common_.Inject)(field_definition_service/* .FieldDefinitionService */.J)),
409
+ field_definition_controller_ts_metadata("design:type", Function),
410
+ field_definition_controller_ts_metadata("design:paramtypes", [
411
+ typeof field_definition_service/* .FieldDefinitionService */.J === "undefined" ? Object : field_definition_service/* .FieldDefinitionService */.J
412
+ ])
413
+ ], FieldDefinitionController);
414
+
415
+ // EXTERNAL MODULE: external "@flusys/nestjs-shared/dtos"
416
+ var dtos_ = __webpack_require__(6873);
417
+ // EXTERNAL MODULE: external "class-transformer"
418
+ var external_class_transformer_ = __webpack_require__(5812);
419
+ // EXTERNAL MODULE: external "class-validator"
420
+ var external_class_validator_ = __webpack_require__(5421);
421
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow.types.ts
422
+ var flow_types = __webpack_require__(6256);
423
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/dtos/flow.dto.ts
424
+ function flow_dto_ts_decorate(decorators, target, key, desc) {
425
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
426
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
427
+ r = Reflect.decorate(decorators, target, key, desc);
428
+ } else {
429
+ for(var i = decorators.length - 1; i >= 0; i--){
430
+ if (d = decorators[i]) {
431
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
432
+ }
433
+ }
434
+ }
435
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
436
+ }
437
+ function flow_dto_ts_metadata(metadataKey, metadataValue) {
438
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
439
+ return Reflect.metadata(metadataKey, metadataValue);
440
+ }
441
+ }
442
+
443
+
444
+
445
+
446
+
447
+ class CreateFlowDefinitionDto {
448
+ name;
449
+ slug;
450
+ description;
451
+ isActive;
452
+ authMode;
453
+ permissionCode;
454
+ runAs;
455
+ isTransactional;
456
+ timeoutMs;
457
+ rateLimitPerMinute;
458
+ retainExecutions;
459
+ bodyType;
460
+ inputSchema;
461
+ nodes;
462
+ edges;
463
+ }
464
+ flow_dto_ts_decorate([
465
+ (0,swagger_.ApiProperty)({
466
+ example: 'Create order'
467
+ }),
468
+ (0,external_class_validator_.IsString)(),
469
+ (0,external_class_validator_.IsNotEmpty)(),
470
+ (0,external_class_validator_.MaxLength)(255),
471
+ flow_dto_ts_metadata("design:type", String)
472
+ ], CreateFlowDefinitionDto.prototype, "name", void 0);
473
+ flow_dto_ts_decorate([
474
+ (0,swagger_.ApiProperty)({
475
+ description: 'URL name: POST api-flows/<slug>',
476
+ example: 'create-order'
477
+ }),
478
+ (0,external_class_validator_.IsString)(),
479
+ (0,external_class_validator_.Matches)(flow_types/* .FLOW_SLUG_PATTERN */.YD, {
480
+ message: 'slug must be 3-63 characters: lowercase letters, digits and dashes, starting with a letter'
481
+ }),
482
+ flow_dto_ts_metadata("design:type", String)
483
+ ], CreateFlowDefinitionDto.prototype, "slug", void 0);
484
+ flow_dto_ts_decorate([
485
+ (0,swagger_.ApiPropertyOptional)(),
486
+ (0,external_class_validator_.IsString)(),
487
+ (0,external_class_validator_.IsOptional)(),
488
+ (0,external_class_validator_.MaxLength)(500),
489
+ flow_dto_ts_metadata("design:type", String)
490
+ ], CreateFlowDefinitionDto.prototype, "description", void 0);
491
+ flow_dto_ts_decorate([
492
+ (0,swagger_.ApiPropertyOptional)({
493
+ default: true
494
+ }),
495
+ (0,external_class_validator_.IsBoolean)(),
496
+ (0,external_class_validator_.IsOptional)(),
497
+ flow_dto_ts_metadata("design:type", Boolean)
498
+ ], CreateFlowDefinitionDto.prototype, "isActive", void 0);
499
+ flow_dto_ts_decorate([
500
+ (0,swagger_.ApiPropertyOptional)({
501
+ enum: flow_types/* .FLOW_AUTH_MODES */.fO,
502
+ default: 'jwt'
503
+ }),
504
+ (0,external_class_validator_.IsEnum)(flow_types/* .FLOW_AUTH_MODES */.fO),
505
+ (0,external_class_validator_.IsOptional)(),
506
+ flow_dto_ts_metadata("design:type", typeof FlowAuthMode === "undefined" ? Object : FlowAuthMode)
507
+ ], CreateFlowDefinitionDto.prototype, "authMode", void 0);
508
+ flow_dto_ts_decorate([
509
+ (0,swagger_.ApiPropertyOptional)({
510
+ description: "authMode 'permission': defaults to entity_builder.flow.<slug>.execute"
511
+ }),
512
+ (0,external_class_validator_.IsString)(),
513
+ (0,external_class_validator_.IsOptional)(),
514
+ (0,external_class_validator_.MaxLength)(255),
515
+ flow_dto_ts_metadata("design:type", String)
516
+ ], CreateFlowDefinitionDto.prototype, "permissionCode", void 0);
517
+ flow_dto_ts_decorate([
518
+ (0,swagger_.ApiPropertyOptional)({
519
+ enum: flow_types/* .FLOW_RUN_AS */.gl,
520
+ default: 'caller'
521
+ }),
522
+ (0,external_class_validator_.IsEnum)(flow_types/* .FLOW_RUN_AS */.gl),
523
+ (0,external_class_validator_.IsOptional)(),
524
+ flow_dto_ts_metadata("design:type", typeof FlowRunAs === "undefined" ? Object : FlowRunAs)
525
+ ], CreateFlowDefinitionDto.prototype, "runAs", void 0);
526
+ flow_dto_ts_decorate([
527
+ (0,swagger_.ApiPropertyOptional)({
528
+ default: false
529
+ }),
530
+ (0,external_class_validator_.IsBoolean)(),
531
+ (0,external_class_validator_.IsOptional)(),
532
+ flow_dto_ts_metadata("design:type", Boolean)
533
+ ], CreateFlowDefinitionDto.prototype, "isTransactional", void 0);
534
+ flow_dto_ts_decorate([
535
+ (0,swagger_.ApiPropertyOptional)({
536
+ default: flow_types/* .FLOW_LIMITS.DEFAULT_TIMEOUT_MS */.Or.DEFAULT_TIMEOUT_MS
537
+ }),
538
+ (0,external_class_validator_.IsInt)(),
539
+ (0,external_class_validator_.Min)(flow_types/* .FLOW_LIMITS.MIN_TIMEOUT_MS */.Or.MIN_TIMEOUT_MS),
540
+ (0,external_class_validator_.Max)(flow_types/* .FLOW_LIMITS.MAX_TIMEOUT_MS */.Or.MAX_TIMEOUT_MS),
541
+ (0,external_class_validator_.IsOptional)(),
542
+ flow_dto_ts_metadata("design:type", Number)
543
+ ], CreateFlowDefinitionDto.prototype, "timeoutMs", void 0);
544
+ flow_dto_ts_decorate([
545
+ (0,swagger_.ApiPropertyOptional)({
546
+ description: 'Per caller IP per minute; 0 = unlimited',
547
+ default: 60
548
+ }),
549
+ (0,external_class_validator_.IsInt)(),
550
+ (0,external_class_validator_.Min)(0),
551
+ (0,external_class_validator_.Max)(100000),
552
+ (0,external_class_validator_.IsOptional)(),
553
+ flow_dto_ts_metadata("design:type", Number)
554
+ ], CreateFlowDefinitionDto.prototype, "rateLimitPerMinute", void 0);
555
+ flow_dto_ts_decorate([
556
+ (0,swagger_.ApiPropertyOptional)({
557
+ default: 200
558
+ }),
559
+ (0,external_class_validator_.IsInt)(),
560
+ (0,external_class_validator_.Min)(0),
561
+ (0,external_class_validator_.Max)(10000),
562
+ (0,external_class_validator_.IsOptional)(),
563
+ flow_dto_ts_metadata("design:type", Number)
564
+ ], CreateFlowDefinitionDto.prototype, "retainExecutions", void 0);
565
+ flow_dto_ts_decorate([
566
+ (0,swagger_.ApiPropertyOptional)({
567
+ enum: flow_types/* .FLOW_BODY_TYPES */.Y3,
568
+ default: 'object',
569
+ description: 'object: the body is one object; list: the body is a list and inputSchema describes each item'
570
+ }),
571
+ (0,external_class_validator_.IsIn)(flow_types/* .FLOW_BODY_TYPES */.Y3),
572
+ (0,external_class_validator_.IsOptional)(),
573
+ flow_dto_ts_metadata("design:type", typeof FlowBodyType === "undefined" ? Object : FlowBodyType)
574
+ ], CreateFlowDefinitionDto.prototype, "bodyType", void 0);
575
+ flow_dto_ts_decorate([
576
+ (0,swagger_.ApiPropertyOptional)({
577
+ type: [
578
+ Object
579
+ ]
580
+ }),
581
+ (0,external_class_validator_.IsArray)(),
582
+ (0,external_class_validator_.IsOptional)(),
583
+ flow_dto_ts_metadata("design:type", Array)
584
+ ], CreateFlowDefinitionDto.prototype, "inputSchema", void 0);
585
+ flow_dto_ts_decorate([
586
+ (0,swagger_.ApiProperty)({
587
+ type: [
588
+ Object
589
+ ]
590
+ }),
591
+ (0,external_class_validator_.IsArray)(),
592
+ flow_dto_ts_metadata("design:type", Array)
593
+ ], CreateFlowDefinitionDto.prototype, "nodes", void 0);
594
+ flow_dto_ts_decorate([
595
+ (0,swagger_.ApiProperty)({
596
+ type: [
597
+ Object
598
+ ]
599
+ }),
600
+ (0,external_class_validator_.IsArray)(),
601
+ flow_dto_ts_metadata("design:type", Array)
602
+ ], CreateFlowDefinitionDto.prototype, "edges", void 0);
603
+ class UpdateFlowDefinitionDto extends (0,swagger_.PartialType)(CreateFlowDefinitionDto) {
604
+ id;
605
+ }
606
+ flow_dto_ts_decorate([
607
+ (0,swagger_.ApiProperty)(),
608
+ (0,external_class_validator_.IsUUID)(),
609
+ (0,external_class_validator_.IsNotEmpty)(),
610
+ flow_dto_ts_metadata("design:type", String)
611
+ ], UpdateFlowDefinitionDto.prototype, "id", void 0);
612
+ /**
613
+ * 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`),
615
+ * the name may still be empty, and the server-owned fields of a loaded flow are ignored.
616
+ */ class FlowDraftDto extends (0,swagger_.OmitType)(CreateFlowDefinitionDto, [
617
+ 'name'
618
+ ]) {
619
+ name;
620
+ id;
621
+ version;
622
+ createdAt;
623
+ updatedAt;
624
+ deletedAt;
625
+ createdById;
626
+ updatedById;
627
+ deletedById;
628
+ }
629
+ flow_dto_ts_decorate([
630
+ (0,swagger_.ApiPropertyOptional)(),
631
+ (0,external_class_validator_.IsString)(),
632
+ (0,external_class_validator_.IsOptional)(),
633
+ (0,external_class_validator_.MaxLength)(255),
634
+ flow_dto_ts_metadata("design:type", String)
635
+ ], FlowDraftDto.prototype, "name", void 0);
636
+ flow_dto_ts_decorate([
637
+ (0,swagger_.ApiPropertyOptional)(),
638
+ (0,external_class_validator_.IsUUID)(),
639
+ (0,external_class_validator_.IsOptional)(),
640
+ flow_dto_ts_metadata("design:type", String)
641
+ ], FlowDraftDto.prototype, "id", void 0);
642
+ flow_dto_ts_decorate([
643
+ (0,external_class_validator_.Allow)(),
644
+ flow_dto_ts_metadata("design:type", Object)
645
+ ], FlowDraftDto.prototype, "version", void 0);
646
+ flow_dto_ts_decorate([
647
+ (0,external_class_validator_.Allow)(),
648
+ flow_dto_ts_metadata("design:type", Object)
649
+ ], FlowDraftDto.prototype, "createdAt", void 0);
650
+ flow_dto_ts_decorate([
651
+ (0,external_class_validator_.Allow)(),
652
+ flow_dto_ts_metadata("design:type", Object)
653
+ ], FlowDraftDto.prototype, "updatedAt", void 0);
654
+ flow_dto_ts_decorate([
655
+ (0,external_class_validator_.Allow)(),
656
+ flow_dto_ts_metadata("design:type", Object)
657
+ ], FlowDraftDto.prototype, "deletedAt", void 0);
658
+ flow_dto_ts_decorate([
659
+ (0,external_class_validator_.Allow)(),
660
+ flow_dto_ts_metadata("design:type", Object)
661
+ ], FlowDraftDto.prototype, "createdById", void 0);
662
+ flow_dto_ts_decorate([
663
+ (0,external_class_validator_.Allow)(),
664
+ flow_dto_ts_metadata("design:type", Object)
665
+ ], FlowDraftDto.prototype, "updatedById", void 0);
666
+ flow_dto_ts_decorate([
667
+ (0,external_class_validator_.Allow)(),
668
+ flow_dto_ts_metadata("design:type", Object)
669
+ ], FlowDraftDto.prototype, "deletedById", void 0);
670
+ /** What a test run pretends the caller sent. */ class TestFlowRequestDto {
671
+ headers;
672
+ query;
673
+ ip;
674
+ }
675
+ flow_dto_ts_decorate([
676
+ (0,swagger_.ApiPropertyOptional)({
677
+ description: 'Headers to pretend the caller sent (credential headers are still hidden from the flow)'
678
+ }),
679
+ (0,external_class_validator_.IsObject)(),
680
+ (0,external_class_validator_.IsOptional)(),
681
+ flow_dto_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
682
+ ], TestFlowRequestDto.prototype, "headers", void 0);
683
+ flow_dto_ts_decorate([
684
+ (0,swagger_.ApiPropertyOptional)({
685
+ description: 'Query parameters to pretend the caller sent'
686
+ }),
687
+ (0,external_class_validator_.IsObject)(),
688
+ (0,external_class_validator_.IsOptional)(),
689
+ flow_dto_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
690
+ ], TestFlowRequestDto.prototype, "query", void 0);
691
+ flow_dto_ts_decorate([
692
+ (0,swagger_.ApiPropertyOptional)({
693
+ description: 'Caller IP address to pretend'
694
+ }),
695
+ (0,external_class_validator_.IsIP)(),
696
+ (0,external_class_validator_.IsOptional)(),
697
+ flow_dto_ts_metadata("design:type", String)
698
+ ], TestFlowRequestDto.prototype, "ip", void 0);
699
+ /** Runs a flow from the designer: a saved flow (flowId), an unsaved draft (definition), or both - flowId attributes/scopes the run while definition (the current draft, if sent) is what actually executes. */ class TestFlowDto {
700
+ flowId;
701
+ definition;
702
+ input;
703
+ mode;
704
+ request;
705
+ }
706
+ flow_dto_ts_decorate([
707
+ (0,swagger_.ApiPropertyOptional)(),
708
+ (0,external_class_validator_.IsUUID)(),
709
+ (0,external_class_validator_.IsOptional)(),
710
+ flow_dto_ts_metadata("design:type", String)
711
+ ], TestFlowDto.prototype, "flowId", void 0);
712
+ flow_dto_ts_decorate([
713
+ (0,swagger_.ApiPropertyOptional)({
714
+ type: FlowDraftDto
715
+ }),
716
+ (0,external_class_validator_.IsObject)(),
717
+ (0,external_class_validator_.ValidateNested)(),
718
+ (0,external_class_transformer_.Type)(()=>FlowDraftDto),
719
+ (0,external_class_validator_.IsOptional)(),
720
+ flow_dto_ts_metadata("design:type", typeof FlowDraftDto === "undefined" ? Object : FlowDraftDto)
721
+ ], TestFlowDto.prototype, "definition", void 0);
722
+ flow_dto_ts_decorate([
723
+ (0,swagger_.ApiPropertyOptional)({
724
+ description: 'The request body to test with: an object, or a list for a flow whose body is a list'
725
+ }),
726
+ (0,external_class_validator_.ValidateIf)((dto)=>!Array.isArray(dto.input)),
727
+ (0,external_class_validator_.IsObject)(),
728
+ (0,external_class_validator_.IsOptional)(),
729
+ flow_dto_ts_metadata("design:type", typeof FlowInput === "undefined" ? Object : FlowInput)
730
+ ], TestFlowDto.prototype, "input", void 0);
731
+ flow_dto_ts_decorate([
732
+ (0,swagger_.ApiPropertyOptional)({
733
+ enum: [
734
+ 'dry_run',
735
+ 'live'
736
+ ],
737
+ default: 'dry_run',
738
+ description: 'dry_run: entity writes are rolled back, HTTP requests and events are skipped'
739
+ }),
740
+ (0,external_class_validator_.IsEnum)([
741
+ 'dry_run',
742
+ 'live'
743
+ ]),
744
+ (0,external_class_validator_.IsOptional)(),
745
+ flow_dto_ts_metadata("design:type", String)
746
+ ], TestFlowDto.prototype, "mode", void 0);
747
+ flow_dto_ts_decorate([
748
+ (0,swagger_.ApiPropertyOptional)({
749
+ type: TestFlowRequestDto,
750
+ description: 'Simulated request details for rules that read headers, query parameters or the IP'
751
+ }),
752
+ (0,external_class_validator_.ValidateNested)(),
753
+ (0,external_class_transformer_.Type)(()=>TestFlowRequestDto),
754
+ (0,external_class_validator_.IsOptional)(),
755
+ flow_dto_ts_metadata("design:type", typeof TestFlowRequestDto === "undefined" ? Object : TestFlowRequestDto)
756
+ ], TestFlowDto.prototype, "request", void 0);
757
+ class ValidateFlowDto {
758
+ definition;
759
+ }
760
+ flow_dto_ts_decorate([
761
+ (0,swagger_.ApiProperty)({
762
+ type: FlowDraftDto
763
+ }),
764
+ (0,external_class_validator_.IsObject)(),
765
+ (0,external_class_validator_.ValidateNested)(),
766
+ (0,external_class_transformer_.Type)(()=>FlowDraftDto),
767
+ flow_dto_ts_metadata("design:type", typeof FlowDraftDto === "undefined" ? Object : FlowDraftDto)
768
+ ], ValidateFlowDto.prototype, "definition", void 0);
769
+ class FlowIdDto {
770
+ flowId;
771
+ }
772
+ flow_dto_ts_decorate([
773
+ (0,swagger_.ApiProperty)(),
774
+ (0,external_class_validator_.IsUUID)(),
775
+ (0,external_class_validator_.IsNotEmpty)(),
776
+ flow_dto_ts_metadata("design:type", String)
777
+ ], FlowIdDto.prototype, "flowId", void 0);
778
+ class CreateFlowApiKeyDto extends FlowIdDto {
779
+ name;
780
+ expiresAt;
781
+ }
782
+ flow_dto_ts_decorate([
783
+ (0,swagger_.ApiProperty)({
784
+ example: 'Shop backend'
785
+ }),
786
+ (0,external_class_validator_.IsString)(),
787
+ (0,external_class_validator_.IsNotEmpty)(),
788
+ (0,external_class_validator_.MaxLength)(100),
789
+ flow_dto_ts_metadata("design:type", String)
790
+ ], CreateFlowApiKeyDto.prototype, "name", void 0);
791
+ flow_dto_ts_decorate([
792
+ (0,swagger_.ApiPropertyOptional)({
793
+ description: 'ISO date-time after which the key stops working'
794
+ }),
795
+ (0,external_class_validator_.IsISO8601)(),
796
+ (0,external_class_validator_.IsOptional)(),
797
+ flow_dto_ts_metadata("design:type", String)
798
+ ], CreateFlowApiKeyDto.prototype, "expiresAt", void 0);
799
+ /** The id of a flow API key or a flow execution. */ class IdBodyDto {
800
+ id;
801
+ }
802
+ flow_dto_ts_decorate([
803
+ (0,swagger_.ApiProperty)(),
804
+ (0,external_class_validator_.IsUUID)(),
805
+ (0,external_class_validator_.IsNotEmpty)(),
806
+ flow_dto_ts_metadata("design:type", String)
807
+ ], IdBodyDto.prototype, "id", void 0);
808
+ class ListFlowExecutionsDto {
809
+ flowId;
810
+ status;
811
+ page;
812
+ pageSize;
813
+ }
814
+ flow_dto_ts_decorate([
815
+ (0,swagger_.ApiPropertyOptional)(),
816
+ (0,external_class_validator_.IsUUID)(),
817
+ (0,external_class_validator_.IsOptional)(),
818
+ flow_dto_ts_metadata("design:type", String)
819
+ ], ListFlowExecutionsDto.prototype, "flowId", void 0);
820
+ flow_dto_ts_decorate([
821
+ (0,swagger_.ApiPropertyOptional)({
822
+ enum: [
823
+ 'success',
824
+ 'failed',
825
+ 'rejected'
826
+ ]
827
+ }),
828
+ (0,external_class_validator_.IsIn)([
829
+ 'success',
830
+ 'failed',
831
+ 'rejected'
832
+ ]),
833
+ (0,external_class_validator_.IsOptional)(),
834
+ flow_dto_ts_metadata("design:type", String)
835
+ ], ListFlowExecutionsDto.prototype, "status", void 0);
836
+ flow_dto_ts_decorate([
837
+ (0,swagger_.ApiPropertyOptional)({
838
+ default: 0
839
+ }),
840
+ (0,external_class_validator_.IsInt)(),
841
+ (0,external_class_validator_.Min)(0),
842
+ (0,external_class_validator_.IsOptional)(),
843
+ flow_dto_ts_metadata("design:type", Number)
844
+ ], ListFlowExecutionsDto.prototype, "page", void 0);
845
+ flow_dto_ts_decorate([
846
+ (0,swagger_.ApiPropertyOptional)({
847
+ default: 20
848
+ }),
849
+ (0,external_class_validator_.IsInt)(),
850
+ (0,external_class_validator_.Min)(1),
851
+ (0,external_class_validator_.Max)(100),
852
+ (0,external_class_validator_.IsOptional)(),
853
+ flow_dto_ts_metadata("design:type", Number)
854
+ ], ListFlowExecutionsDto.prototype, "pageSize", void 0);
855
+ class FlowDefinitionResponseDto extends dtos_.IdentityResponseDto {
856
+ name;
857
+ slug;
858
+ description;
859
+ isActive;
860
+ authMode;
861
+ permissionCode;
862
+ runAs;
863
+ isTransactional;
864
+ timeoutMs;
865
+ rateLimitPerMinute;
866
+ retainExecutions;
867
+ bodyType;
868
+ inputSchema;
869
+ nodes;
870
+ edges;
871
+ version;
872
+ }
873
+ flow_dto_ts_decorate([
874
+ (0,external_class_transformer_.Expose)(),
875
+ (0,swagger_.ApiProperty)(),
876
+ flow_dto_ts_metadata("design:type", String)
877
+ ], FlowDefinitionResponseDto.prototype, "name", void 0);
878
+ flow_dto_ts_decorate([
879
+ (0,external_class_transformer_.Expose)(),
880
+ (0,swagger_.ApiProperty)(),
881
+ flow_dto_ts_metadata("design:type", String)
882
+ ], FlowDefinitionResponseDto.prototype, "slug", void 0);
883
+ flow_dto_ts_decorate([
884
+ (0,external_class_transformer_.Expose)(),
885
+ (0,swagger_.ApiProperty)(),
886
+ flow_dto_ts_metadata("design:type", Object)
887
+ ], FlowDefinitionResponseDto.prototype, "description", void 0);
888
+ flow_dto_ts_decorate([
889
+ (0,external_class_transformer_.Expose)(),
890
+ (0,swagger_.ApiProperty)(),
891
+ flow_dto_ts_metadata("design:type", Boolean)
892
+ ], FlowDefinitionResponseDto.prototype, "isActive", void 0);
893
+ flow_dto_ts_decorate([
894
+ (0,external_class_transformer_.Expose)(),
895
+ (0,swagger_.ApiProperty)(),
896
+ flow_dto_ts_metadata("design:type", typeof FlowAuthMode === "undefined" ? Object : FlowAuthMode)
897
+ ], FlowDefinitionResponseDto.prototype, "authMode", void 0);
898
+ flow_dto_ts_decorate([
899
+ (0,external_class_transformer_.Expose)(),
900
+ (0,swagger_.ApiProperty)(),
901
+ flow_dto_ts_metadata("design:type", Object)
902
+ ], FlowDefinitionResponseDto.prototype, "permissionCode", void 0);
903
+ flow_dto_ts_decorate([
904
+ (0,external_class_transformer_.Expose)(),
905
+ (0,swagger_.ApiProperty)(),
906
+ flow_dto_ts_metadata("design:type", typeof FlowRunAs === "undefined" ? Object : FlowRunAs)
907
+ ], FlowDefinitionResponseDto.prototype, "runAs", void 0);
908
+ flow_dto_ts_decorate([
909
+ (0,external_class_transformer_.Expose)(),
910
+ (0,swagger_.ApiProperty)(),
911
+ flow_dto_ts_metadata("design:type", Boolean)
912
+ ], FlowDefinitionResponseDto.prototype, "isTransactional", void 0);
913
+ flow_dto_ts_decorate([
914
+ (0,external_class_transformer_.Expose)(),
915
+ (0,swagger_.ApiProperty)(),
916
+ flow_dto_ts_metadata("design:type", Number)
917
+ ], FlowDefinitionResponseDto.prototype, "timeoutMs", void 0);
918
+ flow_dto_ts_decorate([
919
+ (0,external_class_transformer_.Expose)(),
920
+ (0,swagger_.ApiProperty)(),
921
+ flow_dto_ts_metadata("design:type", Number)
922
+ ], FlowDefinitionResponseDto.prototype, "rateLimitPerMinute", void 0);
923
+ 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, "retainExecutions", void 0);
928
+ flow_dto_ts_decorate([
929
+ (0,external_class_transformer_.Expose)(),
930
+ (0,swagger_.ApiProperty)({
931
+ enum: flow_types/* .FLOW_BODY_TYPES */.Y3
932
+ }),
933
+ flow_dto_ts_metadata("design:type", typeof FlowBodyType === "undefined" ? Object : FlowBodyType)
934
+ ], FlowDefinitionResponseDto.prototype, "bodyType", void 0);
935
+ flow_dto_ts_decorate([
936
+ (0,external_class_transformer_.Expose)(),
937
+ (0,swagger_.ApiProperty)(),
938
+ flow_dto_ts_metadata("design:type", Array)
939
+ ], FlowDefinitionResponseDto.prototype, "inputSchema", void 0);
940
+ flow_dto_ts_decorate([
941
+ (0,external_class_transformer_.Expose)(),
942
+ (0,swagger_.ApiProperty)(),
943
+ flow_dto_ts_metadata("design:type", Array)
944
+ ], FlowDefinitionResponseDto.prototype, "nodes", 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, "edges", void 0);
950
+ flow_dto_ts_decorate([
951
+ (0,external_class_transformer_.Expose)(),
952
+ (0,swagger_.ApiProperty)(),
953
+ flow_dto_ts_metadata("design:type", Number)
954
+ ], FlowDefinitionResponseDto.prototype, "version", void 0);
955
+
956
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
957
+ var flow_definition_service = __webpack_require__(5229);
958
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-runtime.service.ts
959
+ var flow_runtime_service = __webpack_require__(2300);
960
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-definition.controller.ts
961
+ function flow_definition_controller_ts_decorate(decorators, target, key, desc) {
962
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
963
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
964
+ r = Reflect.decorate(decorators, target, key, desc);
965
+ } else {
966
+ for(var i = decorators.length - 1; i >= 0; i--){
967
+ if (d = decorators[i]) {
968
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
969
+ }
970
+ }
971
+ }
972
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
973
+ }
974
+ function flow_definition_controller_ts_metadata(metadataKey, metadataValue) {
975
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
976
+ return Reflect.metadata(metadataKey, metadataValue);
977
+ }
978
+ }
979
+ function flow_definition_controller_ts_param(paramIndex, decorator) {
980
+ return function(target, key) {
981
+ decorator(target, key, paramIndex);
982
+ };
983
+ }
984
+
985
+
986
+
987
+
988
+
989
+
990
+
991
+
992
+
993
+ const P = nestjs_shared_.FLOW_DEFINITION_PERMISSIONS;
994
+ class FlowDefinitionController extends (0,nestjs_shared_.createApiController)(CreateFlowDefinitionDto, UpdateFlowDefinitionDto, FlowDefinitionResponseDto, {
995
+ entityName: 'entity_builder.flow_definition',
996
+ enabledEndpoints: [
997
+ 'insert',
998
+ 'getById',
999
+ 'getByIds',
1000
+ 'getAll',
1001
+ 'getByFilter',
1002
+ 'update',
1003
+ 'delete'
1004
+ ],
1005
+ security: {
1006
+ insert: {
1007
+ level: 'permission',
1008
+ permissions: [
1009
+ P.CREATE
1010
+ ]
1011
+ },
1012
+ getById: {
1013
+ level: 'permission',
1014
+ permissions: [
1015
+ P.READ
1016
+ ]
1017
+ },
1018
+ getByIds: {
1019
+ level: 'permission',
1020
+ permissions: [
1021
+ P.READ
1022
+ ]
1023
+ },
1024
+ getAll: {
1025
+ level: 'permission',
1026
+ permissions: [
1027
+ P.READ
1028
+ ]
1029
+ },
1030
+ getByFilter: {
1031
+ level: 'permission',
1032
+ permissions: [
1033
+ P.READ
1034
+ ]
1035
+ },
1036
+ update: {
1037
+ level: 'permission',
1038
+ permissions: [
1039
+ P.UPDATE
1040
+ ]
1041
+ },
1042
+ delete: {
1043
+ level: 'permission',
1044
+ permissions: [
1045
+ P.DELETE
1046
+ ]
1047
+ }
1048
+ }
1049
+ }) {
1050
+ flowDefinitionService;
1051
+ runtime;
1052
+ constructor(flowDefinitionService, runtime){
1053
+ super(flowDefinitionService), this.flowDefinitionService = flowDefinitionService, this.runtime = runtime;
1054
+ }
1055
+ async validate(dto) {
1056
+ const result = await this.flowDefinitionService.validate((0,flow_definition_service/* .toFlowSettings */.RK)(dto.definition));
1057
+ return {
1058
+ success: true,
1059
+ message: result.errors.length ? 'The flow has problems' : 'The flow is valid',
1060
+ messageKey: result.errors.length ? message_keys/* .FLOW_MESSAGES.VALIDATE_PROBLEMS */.wu.VALIDATE_PROBLEMS : message_keys/* .FLOW_MESSAGES.VALIDATE_OK */.wu.VALIDATE_OK,
1061
+ data: result
1062
+ };
1063
+ }
1064
+ async testRun(dto, user, req) {
1065
+ const { result, warnings } = await this.runtime.testRun(dto, user, {
1066
+ ip: req.ip ?? null,
1067
+ headers: req.headers
1068
+ });
1069
+ return {
1070
+ success: true,
1071
+ message: 'Test run finished',
1072
+ messageKey: message_keys/* .FLOW_MESSAGES.TEST_SUCCESS */.wu.TEST_SUCCESS,
1073
+ data: {
1074
+ ...result,
1075
+ warnings
1076
+ }
1077
+ };
1078
+ }
1079
+ }
1080
+ flow_definition_controller_ts_decorate([
1081
+ (0,common_.Post)('validate'),
1082
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1083
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1084
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.READ),
1085
+ (0,swagger_.ApiBearerAuth)(),
1086
+ (0,swagger_.ApiOperation)({
1087
+ summary: 'Check a flow without saving it: errors block saving, warnings do not'
1088
+ }),
1089
+ (0,swagger_.ApiBody)({
1090
+ type: ValidateFlowDto
1091
+ }),
1092
+ flow_definition_controller_ts_param(0, (0,common_.Body)()),
1093
+ flow_definition_controller_ts_metadata("design:type", Function),
1094
+ flow_definition_controller_ts_metadata("design:paramtypes", [
1095
+ typeof ValidateFlowDto === "undefined" ? Object : ValidateFlowDto
1096
+ ]),
1097
+ flow_definition_controller_ts_metadata("design:returntype", Promise)
1098
+ ], FlowDefinitionController.prototype, "validate", null);
1099
+ flow_definition_controller_ts_decorate([
1100
+ (0,common_.Post)('test-run'),
1101
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1102
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1103
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.TEST),
1104
+ (0,swagger_.ApiBearerAuth)(),
1105
+ (0,swagger_.ApiOperation)({
1106
+ summary: 'Run a saved flow or an unsaved draft',
1107
+ description: 'dry_run (default): entity writes happen inside a transaction that is rolled back; HTTP requests and events are skipped. live: does everything for real. Returns the answer and a per-node trace.'
1108
+ }),
1109
+ (0,swagger_.ApiBody)({
1110
+ type: TestFlowDto
1111
+ }),
1112
+ flow_definition_controller_ts_param(0, (0,common_.Body)()),
1113
+ flow_definition_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
1114
+ flow_definition_controller_ts_param(2, (0,common_.Req)()),
1115
+ flow_definition_controller_ts_metadata("design:type", Function),
1116
+ flow_definition_controller_ts_metadata("design:paramtypes", [
1117
+ typeof TestFlowDto === "undefined" ? Object : TestFlowDto,
1118
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo,
1119
+ Object
1120
+ ]),
1121
+ flow_definition_controller_ts_metadata("design:returntype", Promise)
1122
+ ], FlowDefinitionController.prototype, "testRun", null);
1123
+ FlowDefinitionController = flow_definition_controller_ts_decorate([
1124
+ (0,swagger_.ApiTags)('Entity Builder - Flows'),
1125
+ (0,common_.Controller)('entity-builder/flows'),
1126
+ flow_definition_controller_ts_param(0, (0,common_.Inject)(flow_definition_service/* .FlowDefinitionService */.Tk)),
1127
+ flow_definition_controller_ts_param(1, (0,common_.Inject)(flow_runtime_service/* .FlowRuntimeService */.a)),
1128
+ flow_definition_controller_ts_metadata("design:type", Function),
1129
+ flow_definition_controller_ts_metadata("design:paramtypes", [
1130
+ typeof flow_definition_service/* .FlowDefinitionService */.Tk === "undefined" ? Object : flow_definition_service/* .FlowDefinitionService */.Tk,
1131
+ typeof flow_runtime_service/* .FlowRuntimeService */.a === "undefined" ? Object : flow_runtime_service/* .FlowRuntimeService */.a
1132
+ ])
1133
+ ], FlowDefinitionController);
1134
+
1135
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-api-key.service.ts + 1 modules
1136
+ var flow_api_key_service = __webpack_require__(8888);
1137
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-api-key.controller.ts
1138
+ function flow_api_key_controller_ts_decorate(decorators, target, key, desc) {
1139
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1140
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1141
+ r = Reflect.decorate(decorators, target, key, desc);
1142
+ } else {
1143
+ for(var i = decorators.length - 1; i >= 0; i--){
1144
+ if (d = decorators[i]) {
1145
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1146
+ }
1147
+ }
1148
+ }
1149
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1150
+ }
1151
+ function flow_api_key_controller_ts_metadata(metadataKey, metadataValue) {
1152
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1153
+ return Reflect.metadata(metadataKey, metadataValue);
1154
+ }
1155
+ }
1156
+ function flow_api_key_controller_ts_param(paramIndex, decorator) {
1157
+ return function(target, key) {
1158
+ decorator(target, key, paramIndex);
1159
+ };
1160
+ }
1161
+
1162
+
1163
+
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+ const flow_api_key_controller_P = nestjs_shared_.FLOW_DEFINITION_PERMISSIONS;
1170
+ const ok = (data, message, messageKey)=>({
1171
+ success: true,
1172
+ message,
1173
+ messageKey,
1174
+ data
1175
+ });
1176
+ class FlowApiKeyController {
1177
+ keys;
1178
+ constructor(keys){
1179
+ this.keys = keys;
1180
+ }
1181
+ async create(dto, user) {
1182
+ return ok(await this.keys.create(dto.flowId, dto.name, dto.expiresAt, user), 'API key created', message_keys/* .FLOW_MESSAGES.API_KEY_CREATE_SUCCESS */.wu.API_KEY_CREATE_SUCCESS);
1183
+ }
1184
+ async list(dto) {
1185
+ return ok(await this.keys.list(dto.flowId), 'API keys loaded', message_keys/* .FLOW_MESSAGES.API_KEY_LIST_SUCCESS */.wu.API_KEY_LIST_SUCCESS);
1186
+ }
1187
+ async revoke(dto) {
1188
+ await this.keys.revoke(dto.id);
1189
+ return ok(null, 'API key revoked', message_keys/* .FLOW_MESSAGES.API_KEY_REVOKE_SUCCESS */.wu.API_KEY_REVOKE_SUCCESS);
1190
+ }
1191
+ async remove(dto) {
1192
+ await this.keys.remove(dto.id);
1193
+ return ok(null, 'API key deleted', message_keys/* .FLOW_MESSAGES.API_KEY_DELETE_SUCCESS */.wu.API_KEY_DELETE_SUCCESS);
1194
+ }
1195
+ }
1196
+ flow_api_key_controller_ts_decorate([
1197
+ (0,common_.Post)('create'),
1198
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1199
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
1200
+ (0,swagger_.ApiOperation)({
1201
+ summary: 'Create an API key. The key is in the response once and cannot be shown again.'
1202
+ }),
1203
+ flow_api_key_controller_ts_param(0, (0,common_.Body)()),
1204
+ flow_api_key_controller_ts_param(1, (0,nestjs_shared_.CurrentUser)()),
1205
+ flow_api_key_controller_ts_metadata("design:type", Function),
1206
+ flow_api_key_controller_ts_metadata("design:paramtypes", [
1207
+ typeof CreateFlowApiKeyDto === "undefined" ? Object : CreateFlowApiKeyDto,
1208
+ typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
1209
+ ]),
1210
+ flow_api_key_controller_ts_metadata("design:returntype", Promise)
1211
+ ], FlowApiKeyController.prototype, "create", null);
1212
+ flow_api_key_controller_ts_decorate([
1213
+ (0,common_.Post)('list'),
1214
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1215
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.READ),
1216
+ flow_api_key_controller_ts_param(0, (0,common_.Body)()),
1217
+ flow_api_key_controller_ts_metadata("design:type", Function),
1218
+ flow_api_key_controller_ts_metadata("design:paramtypes", [
1219
+ typeof FlowIdDto === "undefined" ? Object : FlowIdDto
1220
+ ]),
1221
+ flow_api_key_controller_ts_metadata("design:returntype", Promise)
1222
+ ], FlowApiKeyController.prototype, "list", null);
1223
+ flow_api_key_controller_ts_decorate([
1224
+ (0,common_.Post)('revoke'),
1225
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1226
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
1227
+ flow_api_key_controller_ts_param(0, (0,common_.Body)()),
1228
+ flow_api_key_controller_ts_metadata("design:type", Function),
1229
+ flow_api_key_controller_ts_metadata("design:paramtypes", [
1230
+ typeof IdBodyDto === "undefined" ? Object : IdBodyDto
1231
+ ]),
1232
+ flow_api_key_controller_ts_metadata("design:returntype", Promise)
1233
+ ], FlowApiKeyController.prototype, "revoke", null);
1234
+ flow_api_key_controller_ts_decorate([
1235
+ (0,common_.Post)('delete'),
1236
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1237
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(flow_api_key_controller_P.UPDATE),
1238
+ flow_api_key_controller_ts_param(0, (0,common_.Body)()),
1239
+ flow_api_key_controller_ts_metadata("design:type", Function),
1240
+ flow_api_key_controller_ts_metadata("design:paramtypes", [
1241
+ typeof IdBodyDto === "undefined" ? Object : IdBodyDto
1242
+ ]),
1243
+ flow_api_key_controller_ts_metadata("design:returntype", Promise)
1244
+ ], FlowApiKeyController.prototype, "remove", null);
1245
+ FlowApiKeyController = flow_api_key_controller_ts_decorate([
1246
+ (0,swagger_.ApiTags)('Entity Builder - Flow API keys'),
1247
+ (0,common_.Controller)('entity-builder/flow-api-keys'),
1248
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1249
+ (0,swagger_.ApiBearerAuth)(),
1250
+ flow_api_key_controller_ts_param(0, (0,common_.Inject)(flow_api_key_service/* .FlowApiKeyService */.T)),
1251
+ flow_api_key_controller_ts_metadata("design:type", Function),
1252
+ flow_api_key_controller_ts_metadata("design:paramtypes", [
1253
+ typeof flow_api_key_service/* .FlowApiKeyService */.T === "undefined" ? Object : flow_api_key_service/* .FlowApiKeyService */.T
1254
+ ])
1255
+ ], FlowApiKeyController);
1256
+
1257
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-execution.service.ts
1258
+ var flow_execution_service = __webpack_require__(7810);
1259
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-execution.controller.ts
1260
+ function flow_execution_controller_ts_decorate(decorators, target, key, desc) {
1261
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1262
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1263
+ r = Reflect.decorate(decorators, target, key, desc);
1264
+ } else {
1265
+ for(var i = decorators.length - 1; i >= 0; i--){
1266
+ if (d = decorators[i]) {
1267
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1268
+ }
1269
+ }
1270
+ }
1271
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1272
+ }
1273
+ function flow_execution_controller_ts_metadata(metadataKey, metadataValue) {
1274
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1275
+ return Reflect.metadata(metadataKey, metadataValue);
1276
+ }
1277
+ }
1278
+ function flow_execution_controller_ts_param(paramIndex, decorator) {
1279
+ return function(target, key) {
1280
+ decorator(target, key, paramIndex);
1281
+ };
1282
+ }
1283
+
1284
+
1285
+
1286
+
1287
+
1288
+
1289
+
1290
+
1291
+ class FlowExecutionController {
1292
+ executions;
1293
+ constructor(executions){
1294
+ this.executions = executions;
1295
+ }
1296
+ async list(dto) {
1297
+ const page = dto.page ?? 0;
1298
+ const pageSize = dto.pageSize ?? 20;
1299
+ const { rows, total } = await this.executions.list({
1300
+ flowId: dto.flowId,
1301
+ status: dto.status,
1302
+ page,
1303
+ pageSize
1304
+ });
1305
+ return {
1306
+ success: true,
1307
+ message: 'Executions loaded',
1308
+ messageKey: message_keys/* .FLOW_MESSAGES.EXECUTIONS_SUCCESS */.wu.EXECUTIONS_SUCCESS,
1309
+ data: rows,
1310
+ meta: {
1311
+ total,
1312
+ page,
1313
+ pageSize,
1314
+ count: rows.length,
1315
+ hasMore: (page + 1) * pageSize < total
1316
+ }
1317
+ };
1318
+ }
1319
+ async get(dto) {
1320
+ const execution = await this.executions.get(dto.id);
1321
+ if (!execution) throw new common_.NotFoundException({
1322
+ message: 'Execution not found.',
1323
+ messageKey: message_keys/* .FLOW_MESSAGES.EXECUTION_NOT_FOUND */.wu.EXECUTION_NOT_FOUND
1324
+ });
1325
+ return {
1326
+ success: true,
1327
+ message: 'Execution loaded',
1328
+ messageKey: message_keys/* .FLOW_MESSAGES.EXECUTION_SUCCESS */.wu.EXECUTION_SUCCESS,
1329
+ data: execution
1330
+ };
1331
+ }
1332
+ }
1333
+ flow_execution_controller_ts_decorate([
1334
+ (0,common_.Post)('list'),
1335
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1336
+ flow_execution_controller_ts_param(0, (0,common_.Body)()),
1337
+ flow_execution_controller_ts_metadata("design:type", Function),
1338
+ flow_execution_controller_ts_metadata("design:paramtypes", [
1339
+ typeof ListFlowExecutionsDto === "undefined" ? Object : ListFlowExecutionsDto
1340
+ ]),
1341
+ flow_execution_controller_ts_metadata("design:returntype", Promise)
1342
+ ], FlowExecutionController.prototype, "list", null);
1343
+ flow_execution_controller_ts_decorate([
1344
+ (0,common_.Post)('get'),
1345
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1346
+ flow_execution_controller_ts_param(0, (0,common_.Body)()),
1347
+ flow_execution_controller_ts_metadata("design:type", Function),
1348
+ flow_execution_controller_ts_metadata("design:paramtypes", [
1349
+ typeof IdBodyDto === "undefined" ? Object : IdBodyDto
1350
+ ]),
1351
+ flow_execution_controller_ts_metadata("design:returntype", Promise)
1352
+ ], FlowExecutionController.prototype, "get", null);
1353
+ FlowExecutionController = flow_execution_controller_ts_decorate([
1354
+ (0,swagger_.ApiTags)('Entity Builder - Flow executions'),
1355
+ (0,common_.Controller)('entity-builder/flow-executions'),
1356
+ (0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
1357
+ (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.FLOW_DEFINITION_PERMISSIONS.READ),
1358
+ (0,swagger_.ApiBearerAuth)(),
1359
+ flow_execution_controller_ts_param(0, (0,common_.Inject)(flow_execution_service/* .FlowExecutionService */.A)),
1360
+ flow_execution_controller_ts_metadata("design:type", Function),
1361
+ flow_execution_controller_ts_metadata("design:paramtypes", [
1362
+ typeof flow_execution_service/* .FlowExecutionService */.A === "undefined" ? Object : flow_execution_service/* .FlowExecutionService */.A
1363
+ ])
1364
+ ], FlowExecutionController);
1365
+
1366
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/guards/flow-access.guard.ts + 2 modules
1367
+ var flow_access_guard = __webpack_require__(4196);
1368
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/flow-runtime.controller.ts
1369
+ function flow_runtime_controller_ts_decorate(decorators, target, key, desc) {
1370
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1371
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1372
+ r = Reflect.decorate(decorators, target, key, desc);
1373
+ } else {
1374
+ for(var i = decorators.length - 1; i >= 0; i--){
1375
+ if (d = decorators[i]) {
1376
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1377
+ }
1378
+ }
1379
+ }
1380
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1381
+ }
1382
+ function flow_runtime_controller_ts_metadata(metadataKey, metadataValue) {
1383
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1384
+ return Reflect.metadata(metadataKey, metadataValue);
1385
+ }
1386
+ }
1387
+ function flow_runtime_controller_ts_param(paramIndex, decorator) {
1388
+ return function(target, key) {
1389
+ decorator(target, key, paramIndex);
1390
+ };
1391
+ }
1392
+
1393
+
1394
+
1395
+
1396
+ class FlowRuntimeController {
1397
+ runtime;
1398
+ constructor(runtime){
1399
+ this.runtime = runtime;
1400
+ }
1401
+ async run(_slug, body, req, res) {
1402
+ const result = await this.runtime.handle(req.flowDefinition, body, {
1403
+ ip: req.ip ?? null,
1404
+ headers: req.headers,
1405
+ query: req.query ?? {},
1406
+ path: req.path ?? null
1407
+ }, req.user ?? null);
1408
+ res.status(result.statusCode);
1409
+ return result.body;
1410
+ }
1411
+ }
1412
+ flow_runtime_controller_ts_decorate([
1413
+ (0,common_.Post)(':slug'),
1414
+ (0,common_.HttpCode)(common_.HttpStatus.OK),
1415
+ (0,common_.UseGuards)(flow_access_guard/* .FlowAccessGuard */.C),
1416
+ (0,swagger_.ApiOperation)({
1417
+ summary: 'Call a flow'
1418
+ }),
1419
+ (0,swagger_.ApiParam)({
1420
+ name: 'slug'
1421
+ }),
1422
+ flow_runtime_controller_ts_param(0, (0,common_.Param)('slug')),
1423
+ flow_runtime_controller_ts_param(1, (0,common_.Body)()),
1424
+ flow_runtime_controller_ts_param(2, (0,common_.Req)()),
1425
+ flow_runtime_controller_ts_param(3, (0,common_.Res)({
1426
+ passthrough: true
1427
+ })),
1428
+ flow_runtime_controller_ts_metadata("design:type", Function),
1429
+ flow_runtime_controller_ts_metadata("design:paramtypes", [
1430
+ String,
1431
+ Object,
1432
+ Object,
1433
+ Object
1434
+ ]),
1435
+ flow_runtime_controller_ts_metadata("design:returntype", Promise)
1436
+ ], FlowRuntimeController.prototype, "run", null);
1437
+ FlowRuntimeController = flow_runtime_controller_ts_decorate([
1438
+ (0,swagger_.ApiTags)('Flows (virtual APIs)'),
1439
+ (0,common_.Controller)('api-flows'),
1440
+ flow_runtime_controller_ts_param(0, (0,common_.Inject)(flow_runtime_service/* .FlowRuntimeService */.a)),
1441
+ flow_runtime_controller_ts_metadata("design:type", Function),
1442
+ flow_runtime_controller_ts_metadata("design:paramtypes", [
1443
+ typeof flow_runtime_service/* .FlowRuntimeService */.a === "undefined" ? Object : flow_runtime_service/* .FlowRuntimeService */.a
1444
+ ])
1445
+ ], FlowRuntimeController);
1446
+
1447
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/controllers/index.ts
1448
+
1449
+
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+ },
1457
+ 4196(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1458
+
1459
+ // EXPORTS
1460
+ __webpack_require__.d(__webpack_exports__, {
1461
+ C: () => (/* binding */ FlowAccessGuard)
1462
+ });
1463
+
1464
+ // EXTERNAL MODULE: external "@flusys/nestjs-shared/constants"
1465
+ var constants_ = __webpack_require__(9140);
1466
+ // EXTERNAL MODULE: external "@flusys/nestjs-shared/guards"
1467
+ var guards_ = __webpack_require__(3513);
1468
+ // EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
1469
+ var modules_ = __webpack_require__(1236);
1470
+ // EXTERNAL MODULE: external "@nestjs/common"
1471
+ var common_ = __webpack_require__(6157);
1472
+ // EXTERNAL MODULE: external "@nestjs/core"
1473
+ var core_ = __webpack_require__(3075);
1474
+ ;// CONCATENATED MODULE: external "rxjs"
1475
+
1476
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/config/message-keys.ts
1477
+ var message_keys = __webpack_require__(5732);
1478
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
1479
+ var flow_definition_service = __webpack_require__(5229);
1480
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-api-key.service.ts + 1 modules
1481
+ var flow_api_key_service = __webpack_require__(8888);
1482
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-runtime.service.ts
1483
+ var flow_runtime_service = __webpack_require__(2300);
1484
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-rate-limiter.ts
1485
+ const WINDOW_MS = 60_000;
1486
+ const DEFAULT_MAX_KEYS = 10_000;
1487
+ /**
1488
+ * Fixed-window counter per key (flow + caller IP). In memory, so each server instance counts on
1489
+ * its own - a guard against floods and brute-forcing of API keys, not an exact global quota.
1490
+ * A window is re-inserted when it starts, so the map stays ordered by expiry: expired windows are
1491
+ * dropped from the front in amortized O(1), and at `maxKeys` the oldest window is evicted.
1492
+ */ class FlowRateLimiter {
1493
+ maxKeys;
1494
+ windows = new Map();
1495
+ constructor(maxKeys = DEFAULT_MAX_KEYS){
1496
+ this.maxKeys = maxKeys;
1497
+ }
1498
+ /** @returns true if the call is allowed. limit 0 = unlimited. */ hit(key, limitPerMinute, now = Date.now()) {
1499
+ if (limitPerMinute <= 0) return true;
1500
+ this.dropExpired(now);
1501
+ const current = this.windows.get(key);
1502
+ if (current && current.resetAt > now) {
1503
+ current.count++;
1504
+ return current.count <= limitPerMinute;
1505
+ }
1506
+ if (current) this.windows.delete(key);
1507
+ if (this.windows.size >= this.maxKeys) this.windows.delete(this.windows.keys().next().value);
1508
+ this.windows.set(key, {
1509
+ count: 1,
1510
+ resetAt: now + WINDOW_MS
1511
+ });
1512
+ return true;
1513
+ }
1514
+ get size() {
1515
+ return this.windows.size;
1516
+ }
1517
+ dropExpired(now) {
1518
+ for (const [key, window] of this.windows){
1519
+ if (window.resetAt > now) return;
1520
+ this.windows.delete(key);
1521
+ }
1522
+ }
1523
+ }
1524
+
1525
+ ;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/guards/flow-access.guard.ts
1526
+ function _ts_decorate(decorators, target, key, desc) {
1527
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1528
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1529
+ r = Reflect.decorate(decorators, target, key, desc);
1530
+ } else {
1531
+ for(var i = decorators.length - 1; i >= 0; i--){
1532
+ if (d = decorators[i]) {
1533
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1534
+ }
1535
+ }
1536
+ }
1537
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1538
+ }
1539
+ function _ts_metadata(metadataKey, metadataValue) {
1540
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1541
+ return Reflect.metadata(metadataKey, metadataValue);
1542
+ }
1543
+ }
1544
+ function _ts_param(paramIndex, decorator) {
1545
+ return function(target, key) {
1546
+ decorator(target, key, paramIndex);
1547
+ };
1548
+ }
1549
+
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+
1556
+
1557
+
1558
+
1559
+
1560
+ const limiter = new FlowRateLimiter();
1561
+ class FlowAccessGuard {
1562
+ moduleRef;
1563
+ permissionCache;
1564
+ jwtGuard;
1565
+ constructor(moduleRef, permissionCache){
1566
+ this.moduleRef = moduleRef;
1567
+ this.permissionCache = permissionCache;
1568
+ }
1569
+ async canActivate(context) {
1570
+ const request = context.switchToHttp().getRequest();
1571
+ const slug = request.params?.slug;
1572
+ const contextId = core_.ContextIdFactory.getByRequest(request);
1573
+ const runtime = await this.moduleRef.resolve(flow_runtime_service/* .FlowRuntimeService */.a, contextId, {
1574
+ strict: false
1575
+ });
1576
+ const flow = slug ? await runtime.findActive(slug) : null;
1577
+ if (!flow) throw new common_.NotFoundException({
1578
+ message: 'Not found',
1579
+ messageKey: message_keys/* .FLOW_MESSAGES.NOT_FOUND */.wu.NOT_FOUND
1580
+ });
1581
+ request.flowDefinition = flow;
1582
+ const ip = request.ip ?? request.socket?.remoteAddress ?? 'unknown';
1583
+ if (!limiter.hit(`${flow.id}|${ip}`, flow.rateLimitPerMinute)) {
1584
+ throw new common_.HttpException({
1585
+ message: 'Too many requests. Try again in a minute.',
1586
+ messageKey: message_keys/* .FLOW_MESSAGES.RATE_LIMITED */.wu.RATE_LIMITED
1587
+ }, common_.HttpStatus.TOO_MANY_REQUESTS);
1588
+ }
1589
+ switch(flow.authMode){
1590
+ case 'public':
1591
+ return true;
1592
+ case 'api_key':
1593
+ {
1594
+ const keys = await this.moduleRef.resolve(flow_api_key_service/* .FlowApiKeyService */.T, contextId, {
1595
+ strict: false
1596
+ });
1597
+ const header = request.headers?.['x-api-key'];
1598
+ const check = await keys.verify(flow.id, Array.isArray(header) ? header[0] : header);
1599
+ if (check === 'expired') throw new common_.UnauthorizedException({
1600
+ message: 'This API key has expired.',
1601
+ messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_EXPIRED */.wu.API_KEY_EXPIRED
1602
+ });
1603
+ if (check !== 'valid') {
1604
+ throw new common_.UnauthorizedException({
1605
+ message: 'A valid API key is required (x-api-key header).',
1606
+ messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_INVALID */.wu.API_KEY_INVALID
1607
+ });
1608
+ }
1609
+ return true;
1610
+ }
1611
+ case 'jwt':
1612
+ if (!await this.authenticate(context)) return false;
1613
+ return true;
1614
+ case 'permission':
1615
+ {
1616
+ if (!await this.authenticate(context)) return false;
1617
+ await this.permissionCache.assertPermission(request.user, flow.permissionCode || (0,flow_definition_service/* .defaultFlowPermissionCode */.Er)(flow.slug));
1618
+ return true;
1619
+ }
1620
+ default:
1621
+ throw new common_.UnauthorizedException({
1622
+ message: 'Authentication required',
1623
+ messageKey: constants_.ERROR_MESSAGES.UNAUTHORIZED
1624
+ });
1625
+ }
1626
+ }
1627
+ async authenticate(context) {
1628
+ this.jwtGuard ??= await this.moduleRef.create(guards_.JwtAuthGuard);
1629
+ const result = this.jwtGuard.canActivate(context);
1630
+ if (typeof result === 'boolean') return result;
1631
+ if (result instanceof Promise) return result;
1632
+ return lastValueFrom(result);
1633
+ }
1634
+ }
1635
+ FlowAccessGuard = _ts_decorate([
1636
+ (0,common_.Injectable)(),
1637
+ _ts_param(0, (0,common_.Inject)(core_.ModuleRef)),
1638
+ _ts_param(1, (0,common_.Inject)(modules_.SharedPermissionCacheService)),
1639
+ _ts_metadata("design:type", Function),
1640
+ _ts_metadata("design:paramtypes", [
1641
+ typeof core_.ModuleRef === "undefined" ? Object : core_.ModuleRef,
1642
+ typeof modules_.SharedPermissionCacheService === "undefined" ? Object : modules_.SharedPermissionCacheService
1643
+ ])
1644
+ ], FlowAccessGuard);
1645
+
1646
+
1647
+ },
1648
+ 3513(module) {
1649
+
1650
+ module.exports = __rspack_external__flusys_nestjs_shared_guards_3f79ddd1;
1651
+
1652
+
1653
+ },
1654
+
1655
+ };