@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.
- package/README.md +52 -23
- package/config/entity-builder.constants.d.ts +2 -0
- package/config/message-keys.d.ts +102 -13
- package/controllers/definition-bundle.controller.d.ts +15 -0
- package/controllers/flow-definition.controller.d.ts +7 -1
- package/controllers/flow-runtime.controller.d.ts +16 -8
- package/controllers/index.d.ts +1 -1
- package/dtos/definition-bundle.dto.d.ts +57 -0
- package/dtos/flow.dto.d.ts +13 -20
- package/dtos/index.d.ts +1 -0
- package/entities/flow-definition.entity.d.ts +3 -9
- package/entities/flow-execution.entity.d.ts +3 -0
- package/entities/flow-version.entity.d.ts +10 -0
- package/entities/index.d.ts +3 -3
- package/fesm/21.js +105 -15
- package/fesm/458.js +695 -0
- package/fesm/{489.js → 582.js} +22 -30
- package/fesm/{996.js → 677.js} +1562 -1064
- package/fesm/794.js +135 -240
- package/fesm/{719.js → 870.js} +2065 -324
- package/fesm/{362.js → 897.js} +572 -8
- package/fesm/{606.js → 946.js} +621 -296
- package/fesm/config/index.js +15 -2
- package/fesm/controllers/index.js +9 -9
- package/fesm/docs/index.js +7 -4
- package/fesm/dtos/index.js +451 -256
- package/fesm/entities/index.js +58 -3
- package/fesm/guards/index.js +106 -22
- package/fesm/index.js +429 -937
- package/fesm/interfaces/index.js +19 -2
- package/fesm/modules/index.js +10 -627
- package/fesm/rule-engine/index.js +12 -3
- package/fesm/services/index.js +101 -29
- package/flow-engine/flow-api-key.d.ts +3 -7
- package/flow-engine/flow-graph.validator.d.ts +5 -4
- package/flow-engine/flow-permission-logic.d.ts +2 -0
- package/flow-engine/flow-run.types.d.ts +19 -9
- package/flow-engine/flow.types.d.ts +115 -11
- package/guards/designer-writable.interceptor.d.ts +12 -0
- package/guards/index.d.ts +1 -0
- package/interfaces/definition-bundle.interface.d.ts +111 -0
- package/interfaces/entity-builder-module.interface.d.ts +6 -0
- package/interfaces/flow-definition.interface.d.ts +13 -9
- package/interfaces/index.d.ts +1 -0
- package/package.json +5 -5
- package/rule-engine/rule-engine.service.d.ts +1 -0
- package/rule-engine/rule-permission.d.ts +3 -7
- package/services/definition-bundle.diff.d.ts +62 -0
- package/services/definition-bundle.file.d.ts +7 -0
- package/services/definition-bundle.service.d.ts +32 -0
- package/services/entity-builder-config.service.d.ts +2 -0
- package/services/entity-flow-scaffold.d.ts +4 -3
- package/services/flow-definition.service.d.ts +26 -12
- package/services/flow-execution.service.d.ts +7 -0
- package/services/flow-executor.service.d.ts +9 -8
- package/services/flow-runtime.service.d.ts +2 -1
- package/services/generic-entity.service.d.ts +1 -1
- package/services/index.d.ts +3 -1
- package/services/schema-evolution.service.d.ts +3 -1
- package/services/schema-sync.service.d.ts +6 -2
- package/controllers/flow-api-key.controller.d.ts +0 -14
- package/entities/flow-api-key.entity.d.ts +0 -10
- package/services/flow-api-key.service.d.ts +0 -31
package/fesm/entities/index.js
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
|
+
import * as __rspack_external_typeorm from "typeorm";
|
|
1
2
|
export const __rspack_esm_id = 604;
|
|
2
3
|
export const __rspack_esm_ids = [604];
|
|
3
|
-
export const __webpack_modules__ = {
|
|
4
|
+
export const __webpack_modules__ = {
|
|
5
|
+
1313(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6
|
+
/**
|
|
7
|
+
* Lifecycle status of an EntityDefinition.
|
|
8
|
+
* DRAFT - metadata created, table not yet materialized.
|
|
9
|
+
* ACTIVE - table exists; flows read and write its records.
|
|
10
|
+
* DEPRECATED - no new writes; physical table/data left intact.
|
|
11
|
+
*/ var EntityStatus = /*#__PURE__*/ function(EntityStatus) {
|
|
12
|
+
EntityStatus["DRAFT"] = "DRAFT";
|
|
13
|
+
EntityStatus["ACTIVE"] = "ACTIVE";
|
|
14
|
+
EntityStatus["DEPRECATED"] = "DEPRECATED";
|
|
15
|
+
return EntityStatus;
|
|
16
|
+
}({});
|
|
17
|
+
|
|
18
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
19
|
+
c: () => (EntityStatus)
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
},
|
|
24
|
+
9614(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
25
|
+
/**
|
|
26
|
+
* Storable field types a FieldDefinition can declare.
|
|
27
|
+
* Mapped to a driver-specific column type by SchemaDialectAdapterService.
|
|
28
|
+
*/ var FieldType = /*#__PURE__*/ function(FieldType) {
|
|
29
|
+
FieldType["TEXT"] = "TEXT";
|
|
30
|
+
FieldType["LONG_TEXT"] = "LONG_TEXT";
|
|
31
|
+
FieldType["INTEGER"] = "INTEGER";
|
|
32
|
+
FieldType["DECIMAL"] = "DECIMAL";
|
|
33
|
+
FieldType["BOOLEAN"] = "BOOLEAN";
|
|
34
|
+
FieldType["DATE"] = "DATE";
|
|
35
|
+
FieldType["DATETIME"] = "DATETIME";
|
|
36
|
+
FieldType["EMAIL"] = "EMAIL";
|
|
37
|
+
FieldType["SINGLE_SELECT"] = "SINGLE_SELECT";
|
|
38
|
+
FieldType["MULTI_SELECT"] = "MULTI_SELECT";
|
|
39
|
+
FieldType["RELATION"] = "RELATION";
|
|
40
|
+
FieldType["JSON"] = "JSON";
|
|
41
|
+
FieldType["FILE"] = "FILE";
|
|
42
|
+
return FieldType;
|
|
43
|
+
}({});
|
|
44
|
+
|
|
45
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
46
|
+
P: () => (FieldType)
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
},
|
|
51
|
+
7158(module) {
|
|
52
|
+
|
|
53
|
+
module.exports = __rspack_external_typeorm;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
};
|
|
4
59
|
import { __webpack_require__ } from '../runtime.js';
|
|
5
60
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
6
61
|
import * as __rspack_chunk_1 from '../794.js';
|
|
@@ -10,9 +65,9 @@ __webpack_require__.C(__rspack_chunk_2);
|
|
|
10
65
|
var __webpack_exports__ = __webpack_exec__(665);var __webpack_exports__EntityBuilderEntities = __webpack_exports__.Ui;
|
|
11
66
|
var __webpack_exports__EntityDefinition = __webpack_exports__.f6;
|
|
12
67
|
var __webpack_exports__FieldDefinition = __webpack_exports__.ck;
|
|
13
|
-
var __webpack_exports__FlowApiKey = __webpack_exports__.Sf;
|
|
14
68
|
var __webpack_exports__FlowDefinition = __webpack_exports__.G;
|
|
15
69
|
var __webpack_exports__FlowExecution = __webpack_exports__.j5;
|
|
70
|
+
var __webpack_exports__FlowVersion = __webpack_exports__.pj;
|
|
16
71
|
var __webpack_exports__SchemaChangeLog = __webpack_exports__.We;
|
|
17
72
|
var __webpack_exports__getEntityBuilderEntities = __webpack_exports__.ac;
|
|
18
|
-
export { __webpack_exports__EntityBuilderEntities as EntityBuilderEntities, __webpack_exports__EntityDefinition as EntityDefinition, __webpack_exports__FieldDefinition as FieldDefinition,
|
|
73
|
+
export { __webpack_exports__EntityBuilderEntities as EntityBuilderEntities, __webpack_exports__EntityDefinition as EntityDefinition, __webpack_exports__FieldDefinition as FieldDefinition, __webpack_exports__FlowDefinition as FlowDefinition, __webpack_exports__FlowExecution as FlowExecution, __webpack_exports__FlowVersion as FlowVersion, __webpack_exports__SchemaChangeLog as SchemaChangeLog, __webpack_exports__getEntityBuilderEntities as getEntityBuilderEntities };
|
package/fesm/guards/index.js
CHANGED
|
@@ -3,6 +3,84 @@ import * as __rspack_external__flusys_nestjs_shared_guards_3f79ddd1 from "@flusy
|
|
|
3
3
|
export const __rspack_esm_id = 333;
|
|
4
4
|
export const __rspack_esm_ids = [333];
|
|
5
5
|
export const __webpack_modules__ = {
|
|
6
|
+
417(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
+
/* import */ var _nestjs_common__rspack_import_0 = __webpack_require__(6157);
|
|
8
|
+
/* import */ var _nestjs_core__rspack_import_1 = __webpack_require__(3075);
|
|
9
|
+
/* import */ var _config_message_keys_js__rspack_import_4 = __webpack_require__(5732);
|
|
10
|
+
/* import */ var _dtos_schema_change_dto_js__rspack_import_2 = __webpack_require__(4945);
|
|
11
|
+
/* import */ var _services_entity_builder_config_service_js__rspack_import_3 = __webpack_require__(4281);
|
|
12
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
13
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
} else {
|
|
17
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
18
|
+
if (d = decorators[i]) {
|
|
19
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24
|
+
}
|
|
25
|
+
function _ts_metadata(metadataKey, metadataValue) {
|
|
26
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
27
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function _ts_param(paramIndex, decorator) {
|
|
31
|
+
return function(target, key) {
|
|
32
|
+
decorator(target, key, paramIndex);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const DESIGNER_WRITE_HANDLERS = 'entity_builder:designer_write_handlers';
|
|
41
|
+
/** The handlers of a controller (inherited ones included) that change definitions by hand. */ const DesignerWrites = (...handlers)=>(0,_nestjs_common__rspack_import_0.SetMetadata)(DESIGNER_WRITE_HANDLERS, handlers);
|
|
42
|
+
class DesignerWritableInterceptor {
|
|
43
|
+
reflector;
|
|
44
|
+
config;
|
|
45
|
+
constructor(reflector, config){
|
|
46
|
+
this.reflector = reflector;
|
|
47
|
+
this.config = config;
|
|
48
|
+
}
|
|
49
|
+
intercept(context, next) {
|
|
50
|
+
if (this.isLocked(context)) {
|
|
51
|
+
throw new _nestjs_common__rspack_import_0.HttpException({
|
|
52
|
+
message: 'Definitions are read-only in this environment. Change them where they are designed and import the bundle here.',
|
|
53
|
+
messageKey: _config_message_keys_js__rspack_import_4/* .BUNDLE_MESSAGES.DESIGNER_READ_ONLY */.iX.DESIGNER_READ_ONLY
|
|
54
|
+
}, _nestjs_common__rspack_import_0.HttpStatus.LOCKED);
|
|
55
|
+
}
|
|
56
|
+
return next.handle();
|
|
57
|
+
}
|
|
58
|
+
isLocked(context) {
|
|
59
|
+
if (!this.config.isDesignerReadOnly()) return false;
|
|
60
|
+
const handlers = this.reflector.get(DESIGNER_WRITE_HANDLERS, context.getClass()) ?? [];
|
|
61
|
+
if (!handlers.includes(context.getHandler().name)) return false;
|
|
62
|
+
return context.switchToHttp().getRequest().body?.action !== _dtos_schema_change_dto_js__rspack_import_2/* .SchemaChangeAction.REPAIR */.M3.REPAIR;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
DesignerWritableInterceptor = _ts_decorate([
|
|
66
|
+
(0,_nestjs_common__rspack_import_0.Injectable)(),
|
|
67
|
+
_ts_param(0, (0,_nestjs_common__rspack_import_0.Inject)(_nestjs_core__rspack_import_1.Reflector)),
|
|
68
|
+
_ts_param(1, (0,_nestjs_common__rspack_import_0.Inject)(_services_entity_builder_config_service_js__rspack_import_3/* .EntityBuilderConfigService */.E)),
|
|
69
|
+
_ts_metadata("design:type", Function),
|
|
70
|
+
_ts_metadata("design:paramtypes", [
|
|
71
|
+
typeof _nestjs_core__rspack_import_1.Reflector === "undefined" ? Object : _nestjs_core__rspack_import_1.Reflector,
|
|
72
|
+
typeof _services_entity_builder_config_service_js__rspack_import_3/* .EntityBuilderConfigService */.E === "undefined" ? Object : _services_entity_builder_config_service_js__rspack_import_3/* .EntityBuilderConfigService */.E
|
|
73
|
+
])
|
|
74
|
+
], DesignerWritableInterceptor);
|
|
75
|
+
|
|
76
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
77
|
+
X: () => (DesignerWritableInterceptor)
|
|
78
|
+
}, {
|
|
79
|
+
W: DesignerWrites
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
},
|
|
6
84
|
4196(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
85
|
|
|
8
86
|
// EXPORTS
|
|
@@ -26,8 +104,6 @@ var core_ = __webpack_require__(3075);
|
|
|
26
104
|
var message_keys = __webpack_require__(5732);
|
|
27
105
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-definition.service.ts
|
|
28
106
|
var flow_definition_service = __webpack_require__(5229);
|
|
29
|
-
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-api-key.service.ts + 1 modules
|
|
30
|
-
var flow_api_key_service = __webpack_require__(8888);
|
|
31
107
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/flow-runtime.service.ts
|
|
32
108
|
var flow_runtime_service = __webpack_require__(2300);
|
|
33
109
|
;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-rate-limiter.ts
|
|
@@ -71,6 +147,10 @@ const DEFAULT_MAX_KEYS = 10_000;
|
|
|
71
147
|
}
|
|
72
148
|
}
|
|
73
149
|
|
|
150
|
+
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow-api-key.ts
|
|
151
|
+
var flow_api_key = __webpack_require__(4816);
|
|
152
|
+
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow.types.ts
|
|
153
|
+
var flow_types = __webpack_require__(6256);
|
|
74
154
|
;// CONCATENATED MODULE: ./projects/nestjs-entity-builder/src/guards/flow-access.guard.ts
|
|
75
155
|
function _ts_decorate(decorators, target, key, desc) {
|
|
76
156
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -106,6 +186,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
106
186
|
|
|
107
187
|
|
|
108
188
|
|
|
189
|
+
|
|
109
190
|
const limiter = new FlowRateLimiter();
|
|
110
191
|
class FlowAccessGuard {
|
|
111
192
|
moduleRef;
|
|
@@ -123,33 +204,28 @@ class FlowAccessGuard {
|
|
|
123
204
|
strict: false
|
|
124
205
|
});
|
|
125
206
|
const flow = slug ? await runtime.findActive(slug) : null;
|
|
126
|
-
|
|
207
|
+
const endpoint = flow ? (0,flow_types/* .findEndpoint */.vS)(flow, request.params?.endpoint) : undefined;
|
|
208
|
+
// A Request step for other flows only has no URL: it looks the same as an unknown one.
|
|
209
|
+
if (!flow || !endpoint || endpoint.authMode === 'internal') throw new common_.NotFoundException({
|
|
127
210
|
message: 'Not found',
|
|
128
211
|
messageKey: message_keys/* .FLOW_MESSAGES.NOT_FOUND */.wu.NOT_FOUND
|
|
129
212
|
});
|
|
130
213
|
request.flowDefinition = flow;
|
|
214
|
+
request.flowEndpoint = endpoint;
|
|
131
215
|
const ip = request.ip ?? request.socket?.remoteAddress ?? 'unknown';
|
|
132
|
-
if (!limiter.hit(`${flow.id}|${ip}`,
|
|
216
|
+
if (!limiter.hit(`${flow.id}|${endpoint.nodeId}|${ip}`, endpoint.rateLimitPerMinute)) {
|
|
133
217
|
throw new common_.HttpException({
|
|
134
218
|
message: 'Too many requests. Try again in a minute.',
|
|
135
219
|
messageKey: message_keys/* .FLOW_MESSAGES.RATE_LIMITED */.wu.RATE_LIMITED
|
|
136
220
|
}, common_.HttpStatus.TOO_MANY_REQUESTS);
|
|
137
221
|
}
|
|
138
|
-
switch(
|
|
222
|
+
switch(endpoint.authMode){
|
|
139
223
|
case 'public':
|
|
140
224
|
return true;
|
|
141
225
|
case 'api_key':
|
|
142
226
|
{
|
|
143
|
-
const keys = await this.moduleRef.resolve(flow_api_key_service/* .FlowApiKeyService */.T, contextId, {
|
|
144
|
-
strict: false
|
|
145
|
-
});
|
|
146
227
|
const header = request.headers?.['x-api-key'];
|
|
147
|
-
|
|
148
|
-
if (check === 'expired') throw new common_.UnauthorizedException({
|
|
149
|
-
message: 'This API key has expired.',
|
|
150
|
-
messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_EXPIRED */.wu.API_KEY_EXPIRED
|
|
151
|
-
});
|
|
152
|
-
if (check !== 'valid') {
|
|
228
|
+
if (!(0,flow_api_key/* .apiKeyOpens */.NT)(endpoint.apiKey, Array.isArray(header) ? header[0] : header)) {
|
|
153
229
|
throw new common_.UnauthorizedException({
|
|
154
230
|
message: 'A valid API key is required (x-api-key header).',
|
|
155
231
|
messageKey: message_keys/* .FLOW_MESSAGES.API_KEY_INVALID */.wu.API_KEY_INVALID
|
|
@@ -163,7 +239,7 @@ class FlowAccessGuard {
|
|
|
163
239
|
case 'permission':
|
|
164
240
|
{
|
|
165
241
|
if (!await this.authenticate(context)) return false;
|
|
166
|
-
await this.permissionCache.
|
|
242
|
+
await this.permissionCache.assertPermissionLogic(request.user, (0,flow_definition_service/* .flowPermissions */.j4)(endpoint, flow.slug));
|
|
167
243
|
return true;
|
|
168
244
|
}
|
|
169
245
|
default:
|
|
@@ -196,10 +272,14 @@ FlowAccessGuard = _ts_decorate([
|
|
|
196
272
|
},
|
|
197
273
|
5460(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
198
274
|
/* import */ var _flow_access_guard_js__rspack_import_0 = __webpack_require__(4196);
|
|
275
|
+
/* import */ var _designer_writable_interceptor_js__rspack_import_1 = __webpack_require__(417);
|
|
276
|
+
|
|
199
277
|
|
|
200
278
|
|
|
201
279
|
__webpack_require__.d(__webpack_exports__, {
|
|
202
|
-
|
|
280
|
+
CA: () => (/* reexport safe */ _flow_access_guard_js__rspack_import_0.C),
|
|
281
|
+
Wq: () => (/* reexport safe */ _designer_writable_interceptor_js__rspack_import_1.W),
|
|
282
|
+
Xg: () => (/* reexport safe */ _designer_writable_interceptor_js__rspack_import_1.X)
|
|
203
283
|
});
|
|
204
284
|
|
|
205
285
|
|
|
@@ -216,13 +296,17 @@ import { __webpack_require__ } from '../runtime.js';
|
|
|
216
296
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
217
297
|
import * as __rspack_chunk_1 from '../21.js';
|
|
218
298
|
__webpack_require__.C(__rspack_chunk_1);
|
|
219
|
-
import * as __rspack_chunk_2 from '../
|
|
299
|
+
import * as __rspack_chunk_2 from '../897.js';
|
|
220
300
|
__webpack_require__.C(__rspack_chunk_2);
|
|
221
|
-
import * as __rspack_chunk_3 from '../
|
|
301
|
+
import * as __rspack_chunk_3 from '../582.js';
|
|
222
302
|
__webpack_require__.C(__rspack_chunk_3);
|
|
223
|
-
import * as __rspack_chunk_4 from '../
|
|
303
|
+
import * as __rspack_chunk_4 from '../794.js';
|
|
224
304
|
__webpack_require__.C(__rspack_chunk_4);
|
|
225
|
-
import * as __rspack_chunk_5 from '
|
|
305
|
+
import * as __rspack_chunk_5 from '../677.js';
|
|
226
306
|
__webpack_require__.C(__rspack_chunk_5);
|
|
227
|
-
|
|
228
|
-
|
|
307
|
+
import * as __rspack_chunk_6 from './index.js';
|
|
308
|
+
__webpack_require__.C(__rspack_chunk_6);
|
|
309
|
+
var __webpack_exports__ = __webpack_exec__(5460);var __webpack_exports__DesignerWritableInterceptor = __webpack_exports__.Xg;
|
|
310
|
+
var __webpack_exports__DesignerWrites = __webpack_exports__.Wq;
|
|
311
|
+
var __webpack_exports__FlowAccessGuard = __webpack_exports__.CA;
|
|
312
|
+
export { __webpack_exports__DesignerWritableInterceptor as DesignerWritableInterceptor, __webpack_exports__DesignerWrites as DesignerWrites, __webpack_exports__FlowAccessGuard as FlowAccessGuard };
|