@flusys/nestjs-entity-builder 9.1.2 → 9.2.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 +49 -25
- package/config/entity-builder.constants.d.ts +1 -0
- package/config/message-keys.d.ts +37 -2
- package/controllers/definition-bundle.controller.d.ts +2 -2
- package/controllers/entity-definition.controller.d.ts +1 -1
- package/controllers/field-definition.controller.d.ts +1 -1
- package/controllers/flow-definition.controller.d.ts +3 -1
- package/controllers/flow-runtime.controller.d.ts +4 -3
- package/dtos/definition-bundle.dto.d.ts +1 -0
- package/dtos/entity-definition.dto.d.ts +1 -2
- package/fesm/21.js +39 -5
- package/fesm/{458.js → 28.js} +110 -63
- package/fesm/677.js +1543 -513
- package/fesm/794.js +1 -1
- package/fesm/857.js +3 -3
- package/fesm/870.js +974 -558
- package/fesm/897.js +187 -51
- package/fesm/946.js +72 -43
- package/fesm/config/index.js +10 -14
- package/fesm/docs/index.js +1 -1
- package/fesm/dtos/index.js +11 -0
- package/fesm/guards/index.js +16 -10
- package/fesm/index.js +44 -26
- package/fesm/modules/index.js +4 -3
- package/fesm/services/index.js +40 -59
- package/flow-engine/flow-code-runner.d.ts +16 -0
- package/flow-engine/flow-graph.validator.d.ts +1 -0
- package/flow-engine/flow-input.validator.d.ts +16 -1
- package/flow-engine/flow-run.types.d.ts +16 -0
- package/flow-engine/flow.types.d.ts +18 -1
- package/guards/designer-writable.interceptor.d.ts +1 -0
- package/interfaces/definition-bundle.interface.d.ts +4 -1
- package/interfaces/entity-builder-module.interface.d.ts +9 -0
- package/modules/entity-builder.module.d.ts +1 -0
- package/modules/index.d.ts +1 -0
- package/modules/tenant-context-id.strategy.d.ts +16 -0
- package/package.json +3 -4
- package/services/definition-bundle.diff.d.ts +6 -2
- package/services/definition-bundle.file.d.ts +2 -1
- package/services/definition-bundle.service.d.ts +10 -3
- package/services/entity-builder-config.service.d.ts +3 -0
- package/services/entity-builder-datasource.provider.d.ts +1 -0
- package/services/entity-flow-scaffold.d.ts +2 -1
- package/services/entity-permission.service.d.ts +1 -0
- package/services/field-value-validator.d.ts +7 -0
- package/services/flow-definition.service.d.ts +11 -3
- package/services/flow-executor.service.d.ts +3 -0
- package/services/flow-runtime.service.d.ts +7 -1
- package/services/generic-entity-service.factory.d.ts +5 -1
- package/services/generic-entity.service.d.ts +25 -2
- package/services/identifier-rules.d.ts +0 -1
- package/services/save-loaded.d.ts +2 -0
- package/services/schema-change-executor.service.d.ts +1 -0
- package/services/schema-columns.d.ts +7 -2
- package/services/schema-dialect-adapter.service.d.ts +2 -0
- package/services/schema-evolution.service.d.ts +8 -2
- package/services/schema-registry.service.d.ts +12 -0
- package/services/schema-sync.service.d.ts +3 -1
- package/flow-engine/flow-code-sandbox.d.ts +0 -5
package/fesm/946.js
CHANGED
|
@@ -115,12 +115,11 @@ class EntityDefinitionController extends (0,nestjs_shared_.createApiController)(
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}) {
|
|
118
|
-
entityDefinitionService;
|
|
119
118
|
schemaSyncService;
|
|
120
119
|
evolution;
|
|
121
120
|
permissionCache;
|
|
122
121
|
constructor(entityDefinitionService, schemaSyncService, evolution, permissionCache){
|
|
123
|
-
super(entityDefinitionService), this.
|
|
122
|
+
super(entityDefinitionService), this.schemaSyncService = schemaSyncService, this.evolution = evolution, this.permissionCache = permissionCache;
|
|
124
123
|
}
|
|
125
124
|
async createEntity(dto, user) {
|
|
126
125
|
const { definition, warnings } = await this.schemaSyncService.createEntity(dto, user);
|
|
@@ -133,7 +132,6 @@ class EntityDefinitionController extends (0,nestjs_shared_.createApiController)(
|
|
|
133
132
|
return this.ok(await this.schemaSyncService.planCreateEntity(dto, user), 'Plan generated', message_keys/* .ENTITY_DEFINITION_MESSAGES.PLAN_SUCCESS */.pL.PLAN_SUCCESS);
|
|
134
133
|
}
|
|
135
134
|
async planChange(dto, user) {
|
|
136
|
-
// A plan counts records, so only someone who could apply the change may see it.
|
|
137
135
|
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);
|
|
138
136
|
return this.ok(await this.evolution.plan(dto, user), 'Plan generated', message_keys/* .ENTITY_DEFINITION_MESSAGES.PLAN_SUCCESS */.pL.PLAN_SUCCESS);
|
|
139
137
|
}
|
|
@@ -242,6 +240,7 @@ _ts_decorate([
|
|
|
242
240
|
], EntityDefinitionController.prototype, "planChange", null);
|
|
243
241
|
_ts_decorate([
|
|
244
242
|
(0,common_.Post)('apply-change'),
|
|
243
|
+
(0,designer_writable_interceptor/* .DesignerAllowsRepair */.H6)(),
|
|
245
244
|
(0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
|
|
246
245
|
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.UPDATE),
|
|
247
246
|
(0,swagger_.ApiBearerAuth)(),
|
|
@@ -320,8 +319,8 @@ _ts_decorate([
|
|
|
320
319
|
EntityDefinitionController = _ts_decorate([
|
|
321
320
|
(0,swagger_.ApiTags)('Entity Builder - Entity Definitions'),
|
|
322
321
|
(0,common_.Controller)('entity-builder/entity-definitions'),
|
|
323
|
-
(0,common_.UseInterceptors)(designer_writable_interceptor/* .DesignerWritableInterceptor */.
|
|
324
|
-
(0,designer_writable_interceptor/* .DesignerWrites */.
|
|
322
|
+
(0,common_.UseInterceptors)(designer_writable_interceptor/* .DesignerWritableInterceptor */.Xg),
|
|
323
|
+
(0,designer_writable_interceptor/* .DesignerWrites */.Wq)('createEntity', 'applyChange', 'applyDestructiveChange'),
|
|
325
324
|
_ts_param(0, (0,common_.Inject)(entity_definition_service/* .EntityDefinitionService */.o)),
|
|
326
325
|
_ts_param(1, (0,common_.Inject)(schema_sync_service/* .SchemaSyncService */.W)),
|
|
327
326
|
_ts_param(2, (0,common_.Inject)(schema_evolution_service/* .SchemaEvolutionService */._)),
|
|
@@ -403,9 +402,8 @@ class FieldDefinitionController extends (0,nestjs_shared_.createApiController)(f
|
|
|
403
402
|
}
|
|
404
403
|
}
|
|
405
404
|
}) {
|
|
406
|
-
fieldDefinitionService;
|
|
407
405
|
constructor(fieldDefinitionService){
|
|
408
|
-
super(fieldDefinitionService)
|
|
406
|
+
super(fieldDefinitionService);
|
|
409
407
|
}
|
|
410
408
|
}
|
|
411
409
|
FieldDefinitionController = field_definition_controller_ts_decorate([
|
|
@@ -744,7 +742,7 @@ flow_dto_ts_decorate([
|
|
|
744
742
|
(0,external_class_validator_.Min)(1),
|
|
745
743
|
flow_dto_ts_metadata("design:type", Number)
|
|
746
744
|
], FlowVersionRefDto.prototype, "version", void 0);
|
|
747
|
-
|
|
745
|
+
class IdBodyDto {
|
|
748
746
|
id;
|
|
749
747
|
}
|
|
750
748
|
flow_dto_ts_decorate([
|
|
@@ -1007,6 +1005,14 @@ class FlowDefinitionController extends (0,nestjs_shared_.createApiController)(Cr
|
|
|
1007
1005
|
data: flow
|
|
1008
1006
|
};
|
|
1009
1007
|
}
|
|
1008
|
+
codePackages() {
|
|
1009
|
+
return {
|
|
1010
|
+
success: true,
|
|
1011
|
+
message: 'Code packages loaded',
|
|
1012
|
+
messageKey: message_keys/* .FLOW_MESSAGES.CODE_PACKAGES_SUCCESS */.wu.CODE_PACKAGES_SUCCESS,
|
|
1013
|
+
data: this.flowDefinitionService.codePackages()
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1010
1016
|
async versions(dto) {
|
|
1011
1017
|
return {
|
|
1012
1018
|
success: true,
|
|
@@ -1101,6 +1107,19 @@ flow_definition_controller_ts_decorate([
|
|
|
1101
1107
|
]),
|
|
1102
1108
|
flow_definition_controller_ts_metadata("design:returntype", Promise)
|
|
1103
1109
|
], FlowDefinitionController.prototype, "publish", null);
|
|
1110
|
+
flow_definition_controller_ts_decorate([
|
|
1111
|
+
(0,common_.Post)('code-packages'),
|
|
1112
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
1113
|
+
(0,common_.UseGuards)(guards_.JwtAuthGuard, guards_.PermissionGuard),
|
|
1114
|
+
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(P.READ),
|
|
1115
|
+
(0,swagger_.ApiBearerAuth)(),
|
|
1116
|
+
(0,swagger_.ApiOperation)({
|
|
1117
|
+
summary: 'The package names a code step may require on this server'
|
|
1118
|
+
}),
|
|
1119
|
+
flow_definition_controller_ts_metadata("design:type", Function),
|
|
1120
|
+
flow_definition_controller_ts_metadata("design:paramtypes", []),
|
|
1121
|
+
flow_definition_controller_ts_metadata("design:returntype", typeof nestjs_shared_.SingleResponseDto === "undefined" ? Object : nestjs_shared_.SingleResponseDto)
|
|
1122
|
+
], FlowDefinitionController.prototype, "codePackages", null);
|
|
1104
1123
|
flow_definition_controller_ts_decorate([
|
|
1105
1124
|
(0,common_.Post)('versions'),
|
|
1106
1125
|
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
@@ -1209,8 +1228,8 @@ flow_definition_controller_ts_decorate([
|
|
|
1209
1228
|
FlowDefinitionController = flow_definition_controller_ts_decorate([
|
|
1210
1229
|
(0,swagger_.ApiTags)('Entity Builder - Flows'),
|
|
1211
1230
|
(0,common_.Controller)('entity-builder/flows'),
|
|
1212
|
-
(0,common_.UseInterceptors)(designer_writable_interceptor/* .DesignerWritableInterceptor */.
|
|
1213
|
-
(0,designer_writable_interceptor/* .DesignerWrites */.
|
|
1231
|
+
(0,common_.UseInterceptors)(designer_writable_interceptor/* .DesignerWritableInterceptor */.Xg),
|
|
1232
|
+
(0,designer_writable_interceptor/* .DesignerWrites */.Wq)('insert', 'update', 'delete', 'publish', 'restoreVersion', 'discardDraft'),
|
|
1214
1233
|
flow_definition_controller_ts_param(0, (0,common_.Inject)(flow_definition_service/* .FlowDefinitionService */.Tk)),
|
|
1215
1234
|
flow_definition_controller_ts_param(1, (0,common_.Inject)(flow_runtime_service/* .FlowRuntimeService */.a)),
|
|
1216
1235
|
flow_definition_controller_ts_metadata("design:type", Function),
|
|
@@ -1366,10 +1385,10 @@ class FlowRuntimeController {
|
|
|
1366
1385
|
constructor(runtime){
|
|
1367
1386
|
this.runtime = runtime;
|
|
1368
1387
|
}
|
|
1369
|
-
run(
|
|
1388
|
+
run(body, req, res) {
|
|
1370
1389
|
return this.answer(body, req, res);
|
|
1371
1390
|
}
|
|
1372
|
-
runEndpoint(
|
|
1391
|
+
runEndpoint(body, req, res) {
|
|
1373
1392
|
return this.answer(body, req, res);
|
|
1374
1393
|
}
|
|
1375
1394
|
async answer(body, req, res) {
|
|
@@ -1393,15 +1412,13 @@ flow_runtime_controller_ts_decorate([
|
|
|
1393
1412
|
(0,swagger_.ApiParam)({
|
|
1394
1413
|
name: 'slug'
|
|
1395
1414
|
}),
|
|
1396
|
-
flow_runtime_controller_ts_param(0, (0,common_.
|
|
1397
|
-
flow_runtime_controller_ts_param(1, (0,common_.
|
|
1398
|
-
flow_runtime_controller_ts_param(2, (0,common_.
|
|
1399
|
-
flow_runtime_controller_ts_param(3, (0,common_.Res)({
|
|
1415
|
+
flow_runtime_controller_ts_param(0, (0,common_.Body)()),
|
|
1416
|
+
flow_runtime_controller_ts_param(1, (0,common_.Req)()),
|
|
1417
|
+
flow_runtime_controller_ts_param(2, (0,common_.Res)({
|
|
1400
1418
|
passthrough: true
|
|
1401
1419
|
})),
|
|
1402
1420
|
flow_runtime_controller_ts_metadata("design:type", Function),
|
|
1403
1421
|
flow_runtime_controller_ts_metadata("design:paramtypes", [
|
|
1404
|
-
String,
|
|
1405
1422
|
Object,
|
|
1406
1423
|
typeof FlowRequest === "undefined" ? Object : FlowRequest,
|
|
1407
1424
|
Object
|
|
@@ -1421,17 +1438,13 @@ flow_runtime_controller_ts_decorate([
|
|
|
1421
1438
|
(0,swagger_.ApiParam)({
|
|
1422
1439
|
name: 'endpoint'
|
|
1423
1440
|
}),
|
|
1424
|
-
flow_runtime_controller_ts_param(0, (0,common_.
|
|
1425
|
-
flow_runtime_controller_ts_param(1, (0,common_.
|
|
1426
|
-
flow_runtime_controller_ts_param(2, (0,common_.
|
|
1427
|
-
flow_runtime_controller_ts_param(3, (0,common_.Req)()),
|
|
1428
|
-
flow_runtime_controller_ts_param(4, (0,common_.Res)({
|
|
1441
|
+
flow_runtime_controller_ts_param(0, (0,common_.Body)()),
|
|
1442
|
+
flow_runtime_controller_ts_param(1, (0,common_.Req)()),
|
|
1443
|
+
flow_runtime_controller_ts_param(2, (0,common_.Res)({
|
|
1429
1444
|
passthrough: true
|
|
1430
1445
|
})),
|
|
1431
1446
|
flow_runtime_controller_ts_metadata("design:type", Function),
|
|
1432
1447
|
flow_runtime_controller_ts_metadata("design:paramtypes", [
|
|
1433
|
-
String,
|
|
1434
|
-
String,
|
|
1435
1448
|
Object,
|
|
1436
1449
|
typeof FlowRequest === "undefined" ? Object : FlowRequest,
|
|
1437
1450
|
Object
|
|
@@ -1499,10 +1512,13 @@ function definition_bundle_controller_ts_param(paramIndex, decorator) {
|
|
|
1499
1512
|
|
|
1500
1513
|
|
|
1501
1514
|
|
|
1502
|
-
/**
|
|
1515
|
+
/**
|
|
1516
|
+
* The bundle is uploaded as files (not JSON): the app's JSON body limit never applies, only this package's own.
|
|
1517
|
+
* One file holds a whole export, or several hold one entity or flow each (a split folder kept in git).
|
|
1518
|
+
*/ const BundleUpload = ()=>(0,common_.UseInterceptors)((0,__rspack_external__nestjs_platform_express_cb7ac6b9.FilesInterceptor)('bundle', (/* inlined export .ENTITY_BUNDLE_MAX_FILES */1000), {
|
|
1503
1519
|
limits: {
|
|
1504
1520
|
fileSize: entity_builder_constants/* .ENTITY_BUNDLE_MAX_BYTES */.EA,
|
|
1505
|
-
files:
|
|
1521
|
+
files: (/* inlined export .ENTITY_BUNDLE_MAX_FILES */1000),
|
|
1506
1522
|
fields: 10
|
|
1507
1523
|
}
|
|
1508
1524
|
}));
|
|
@@ -1514,14 +1530,21 @@ const IMPORT_BODY = {
|
|
|
1514
1530
|
],
|
|
1515
1531
|
properties: {
|
|
1516
1532
|
bundle: {
|
|
1517
|
-
type: '
|
|
1518
|
-
|
|
1519
|
-
|
|
1533
|
+
type: 'array',
|
|
1534
|
+
items: {
|
|
1535
|
+
type: 'string',
|
|
1536
|
+
format: 'binary'
|
|
1537
|
+
},
|
|
1538
|
+
description: `One bundle file an export wrote, or the files of a split export (one per entity and flow, merged into one bundle). JSON, at most ${(/* inlined export .ENTITY_BUNDLE_MAX_FILES */1000)} files and ${entity_builder_constants/* .ENTITY_BUNDLE_MAX_BYTES */.EA / 1024 / 1024} MB together`
|
|
1520
1539
|
},
|
|
1521
1540
|
deprecateMissingFields: {
|
|
1522
1541
|
type: 'boolean',
|
|
1523
1542
|
description: 'Deprecate fields this environment has and the bundle does not (their columns and data stay)'
|
|
1524
1543
|
},
|
|
1544
|
+
deactivateMissingFlows: {
|
|
1545
|
+
type: 'boolean',
|
|
1546
|
+
description: 'Switch off (and publish) the live flows this environment has and the bundle does not (they are kept, not deleted)'
|
|
1547
|
+
},
|
|
1525
1548
|
confirm: {
|
|
1526
1549
|
type: 'boolean',
|
|
1527
1550
|
description: 'apply-import: acknowledge steps that lose (or may lose) data'
|
|
@@ -1553,7 +1576,9 @@ class DefinitionBundleController {
|
|
|
1553
1576
|
settings() {
|
|
1554
1577
|
const data = {
|
|
1555
1578
|
readOnly: this.config.isDesignerReadOnly(),
|
|
1556
|
-
variables: Object.keys(this.config.getBundleVariables()).toSorted(definition_bundle_diff/* .byCode */.VU)
|
|
1579
|
+
variables: Object.keys(this.config.getBundleVariables()).toSorted(definition_bundle_diff/* .byCode */.VU),
|
|
1580
|
+
maxFiles: (/* inlined export .ENTITY_BUNDLE_MAX_FILES */1000),
|
|
1581
|
+
maxBytes: entity_builder_constants/* .ENTITY_BUNDLE_MAX_BYTES */.EA
|
|
1557
1582
|
};
|
|
1558
1583
|
return {
|
|
1559
1584
|
success: true,
|
|
@@ -1570,10 +1595,10 @@ class DefinitionBundleController {
|
|
|
1570
1595
|
data: await this.bundles.export(dto)
|
|
1571
1596
|
};
|
|
1572
1597
|
}
|
|
1573
|
-
async planImport(
|
|
1598
|
+
async planImport(files, options, user) {
|
|
1574
1599
|
const data = await this.bundles.planImport({
|
|
1575
1600
|
...options,
|
|
1576
|
-
bundle: (0,definition_bundle_file/* .
|
|
1601
|
+
bundle: (0,definition_bundle_file/* .readBundleFiles */.K)(files)
|
|
1577
1602
|
}, user);
|
|
1578
1603
|
return {
|
|
1579
1604
|
success: true,
|
|
@@ -1582,10 +1607,10 @@ class DefinitionBundleController {
|
|
|
1582
1607
|
data
|
|
1583
1608
|
};
|
|
1584
1609
|
}
|
|
1585
|
-
async applyImport(
|
|
1610
|
+
async applyImport(files, options, user) {
|
|
1586
1611
|
const data = await this.bundles.applyImport({
|
|
1587
1612
|
...options,
|
|
1588
|
-
bundle: (0,definition_bundle_file/* .
|
|
1613
|
+
bundle: (0,definition_bundle_file/* .readBundleFiles */.K)(files)
|
|
1589
1614
|
}, user);
|
|
1590
1615
|
return data.completed ? {
|
|
1591
1616
|
success: true,
|
|
@@ -1607,7 +1632,7 @@ definition_bundle_controller_ts_decorate([
|
|
|
1607
1632
|
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequireAnyPermission)(nestjs_shared_.ENTITY_DEFINITION_PERMISSIONS.READ, nestjs_shared_.FLOW_DEFINITION_PERMISSIONS.READ),
|
|
1608
1633
|
(0,swagger_.ApiBearerAuth)(),
|
|
1609
1634
|
(0,swagger_.ApiOperation)({
|
|
1610
|
-
summary: 'Whether the designer is read-only here,
|
|
1635
|
+
summary: 'Whether the designer is read-only here, the names of the variables this environment defines, and the bundle upload limits'
|
|
1611
1636
|
}),
|
|
1612
1637
|
definition_bundle_controller_ts_metadata("design:type", Function),
|
|
1613
1638
|
definition_bundle_controller_ts_metadata("design:paramtypes", []),
|
|
@@ -1646,7 +1671,7 @@ definition_bundle_controller_ts_decorate([
|
|
|
1646
1671
|
(0,swagger_.ApiConsumes)('multipart/form-data'),
|
|
1647
1672
|
(0,swagger_.ApiBody)(IMPORT_BODY),
|
|
1648
1673
|
BundleUpload(),
|
|
1649
|
-
definition_bundle_controller_ts_param(0, (0,common_.
|
|
1674
|
+
definition_bundle_controller_ts_param(0, (0,common_.UploadedFiles)()),
|
|
1650
1675
|
definition_bundle_controller_ts_param(1, (0,common_.Body)()),
|
|
1651
1676
|
definition_bundle_controller_ts_param(2, (0,nestjs_shared_.CurrentUser)()),
|
|
1652
1677
|
definition_bundle_controller_ts_metadata("design:type", Function),
|
|
@@ -1670,7 +1695,7 @@ definition_bundle_controller_ts_decorate([
|
|
|
1670
1695
|
(0,swagger_.ApiConsumes)('multipart/form-data'),
|
|
1671
1696
|
(0,swagger_.ApiBody)(IMPORT_BODY),
|
|
1672
1697
|
BundleUpload(),
|
|
1673
|
-
definition_bundle_controller_ts_param(0, (0,common_.
|
|
1698
|
+
definition_bundle_controller_ts_param(0, (0,common_.UploadedFiles)()),
|
|
1674
1699
|
definition_bundle_controller_ts_param(1, (0,common_.Body)()),
|
|
1675
1700
|
definition_bundle_controller_ts_param(2, (0,nestjs_shared_.CurrentUser)()),
|
|
1676
1701
|
definition_bundle_controller_ts_metadata("design:type", Function),
|
|
@@ -1738,7 +1763,9 @@ function _ts_param(paramIndex, decorator) {
|
|
|
1738
1763
|
|
|
1739
1764
|
|
|
1740
1765
|
const DESIGNER_WRITE_HANDLERS = 'entity_builder:designer_write_handlers';
|
|
1766
|
+
const DESIGNER_REPAIR_HANDLER = 'entity_builder:designer_repair_handler';
|
|
1741
1767
|
/** 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);
|
|
1768
|
+
/** The one handler whose `repair` action still runs while read-only; any other handler is refused whatever its body says. */ const DesignerAllowsRepair = ()=>(0,_nestjs_common__rspack_import_0.SetMetadata)(DESIGNER_REPAIR_HANDLER, true);
|
|
1742
1769
|
class DesignerWritableInterceptor {
|
|
1743
1770
|
reflector;
|
|
1744
1771
|
config;
|
|
@@ -1758,7 +1785,9 @@ class DesignerWritableInterceptor {
|
|
|
1758
1785
|
isLocked(context) {
|
|
1759
1786
|
if (!this.config.isDesignerReadOnly()) return false;
|
|
1760
1787
|
const handlers = this.reflector.get(DESIGNER_WRITE_HANDLERS, context.getClass()) ?? [];
|
|
1761
|
-
|
|
1788
|
+
const handler = context.getHandler();
|
|
1789
|
+
if (!handlers.includes(handler.name)) return false;
|
|
1790
|
+
if (!this.reflector.get(DESIGNER_REPAIR_HANDLER, handler)) return true;
|
|
1762
1791
|
return context.switchToHttp().getRequest().body?.action !== _dtos_schema_change_dto_js__rspack_import_2/* .SchemaChangeAction.REPAIR */.M3.REPAIR;
|
|
1763
1792
|
}
|
|
1764
1793
|
}
|
|
@@ -1774,9 +1803,10 @@ DesignerWritableInterceptor = _ts_decorate([
|
|
|
1774
1803
|
], DesignerWritableInterceptor);
|
|
1775
1804
|
|
|
1776
1805
|
__webpack_require__.d(__webpack_exports__, {
|
|
1777
|
-
|
|
1806
|
+
Xg: () => (DesignerWritableInterceptor)
|
|
1778
1807
|
}, {
|
|
1779
|
-
|
|
1808
|
+
H6: DesignerAllowsRepair,
|
|
1809
|
+
Wq: DesignerWrites
|
|
1780
1810
|
});
|
|
1781
1811
|
|
|
1782
1812
|
|
|
@@ -1913,7 +1943,7 @@ class FlowAccessGuard {
|
|
|
1913
1943
|
request.flowDefinition = flow;
|
|
1914
1944
|
request.flowEndpoint = endpoint;
|
|
1915
1945
|
const ip = request.ip ?? request.socket?.remoteAddress ?? 'unknown';
|
|
1916
|
-
if (!limiter.hit(`${flow.id}|${endpoint.nodeId}|${ip}`, endpoint.rateLimitPerMinute)) {
|
|
1946
|
+
if (!limiter.hit(`${runtime.tenantScope()}|${flow.id}|${endpoint.nodeId}|${ip}`, endpoint.rateLimitPerMinute)) {
|
|
1917
1947
|
throw new common_.HttpException({
|
|
1918
1948
|
message: 'Too many requests. Try again in a minute.',
|
|
1919
1949
|
messageKey: message_keys/* .FLOW_MESSAGES.RATE_LIMITED */.wu.RATE_LIMITED
|
|
@@ -1934,8 +1964,7 @@ class FlowAccessGuard {
|
|
|
1934
1964
|
return true;
|
|
1935
1965
|
}
|
|
1936
1966
|
case 'jwt':
|
|
1937
|
-
|
|
1938
|
-
return true;
|
|
1967
|
+
return this.authenticate(context);
|
|
1939
1968
|
case 'permission':
|
|
1940
1969
|
{
|
|
1941
1970
|
if (!await this.authenticate(context)) return false;
|
package/fesm/config/index.js
CHANGED
|
@@ -3,18 +3,12 @@ export const __rspack_esm_ids = [565];
|
|
|
3
3
|
export const __webpack_modules__ = {
|
|
4
4
|
6576(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
5
|
const ENTITY_BUILDER_MODULE_OPTIONS = 'ENTITY_BUILDER_MODULE_OPTIONS';
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* Identifier whitelist enforced on every EntityDefinition/FieldDefinition `code`.
|
|
13
|
-
* Also the exact contract SchemaSyncService's DDL engine validates against
|
|
14
|
-
* before generating a table/column name.
|
|
15
|
-
*/ const ENTITY_CODE_PATTERN = /^[a-z][a-z0-9_]{2,59}$/;
|
|
16
|
-
/** Matches the `code` column length on both EntityDefinition and FieldDefinition. */ const ENTITY_CODE_MAX_LENGTH = 63;
|
|
17
|
-
/** Defense-in-depth prefix applied to every dynamically created table name. */ const ENTITY_TABLE_PREFIX = 'eb_';
|
|
6
|
+
/** The bundle is uploaded as a file, so the app's JSON body limit (Express's 100kb default) never applies to it - this does. */ const ENTITY_BUNDLE_MAX_BYTES = 20 * 1024 * 1024;
|
|
7
|
+
/** A split export writes one file per entity and per flow; together they stay under ENTITY_BUNDLE_MAX_BYTES. */ const ENTITY_BUNDLE_MAX_FILES = 1000;
|
|
8
|
+
/** Any other `${var:NAME}` name could never be resolved on import. */ const BUNDLE_VARIABLE_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
9
|
+
/** Every entity and field `code`; the DDL engine checks the same pattern before it names a table or column. */ const ENTITY_CODE_PATTERN = /^[a-z][a-z0-9_]{2,59}$/;
|
|
10
|
+
const ENTITY_CODE_MAX_LENGTH = 63;
|
|
11
|
+
const ENTITY_TABLE_PREFIX = 'eb_';
|
|
18
12
|
/** The generic API controller's record endpoints - each can be created as a ready-made flow with the entity. */ const ENTITY_FLOW_ENDPOINTS = [
|
|
19
13
|
'insert',
|
|
20
14
|
'insertMany',
|
|
@@ -40,7 +34,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
40
34
|
|
|
41
35
|
},
|
|
42
36
|
982(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
43
|
-
/**
|
|
37
|
+
/** The entity names the module publishes events under; also reserved as entity codes. */ const ENTITY_BUILDER_EVENT_ENTITIES = {
|
|
44
38
|
ENTITY_DEFINITION: 'entity_definition',
|
|
45
39
|
FIELD_DEFINITION: 'field_definition',
|
|
46
40
|
SCHEMA_CHANGE_LOG: 'schema_change_log',
|
|
@@ -89,6 +83,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
89
83
|
j4: () => (/* reexport safe */ _message_keys_js__rspack_import_2.j4),
|
|
90
84
|
oc: () => (/* reexport safe */ _message_keys_js__rspack_import_2.oc),
|
|
91
85
|
pL: () => (/* reexport safe */ _message_keys_js__rspack_import_2.pL),
|
|
86
|
+
qX: () => (/* reexport safe */ (/* inlined export _entity_builder_constants_js__rspack_import_0 */1000)),
|
|
92
87
|
qj: () => (/* reexport safe */ _message_keys_js__rspack_import_2.qj),
|
|
93
88
|
vs: () => (/* reexport safe */ _entity_builder_constants_js__rspack_import_0.vs),
|
|
94
89
|
wu: () => (/* reexport safe */ _message_keys_js__rspack_import_2.wu),
|
|
@@ -113,6 +108,7 @@ var __webpack_exports__ENTITY_BUILDER_EVENT_ENTITIES = __webpack_exports__.P1;
|
|
|
113
108
|
var __webpack_exports__ENTITY_BUILDER_EVENT_MODULE = __webpack_exports__.SD;
|
|
114
109
|
var __webpack_exports__ENTITY_BUILDER_MODULE_OPTIONS = __webpack_exports__.CP;
|
|
115
110
|
var __webpack_exports__ENTITY_BUNDLE_MAX_BYTES = __webpack_exports__.EA;
|
|
111
|
+
var __webpack_exports__ENTITY_BUNDLE_MAX_FILES = __webpack_exports__.qX;
|
|
116
112
|
var __webpack_exports__ENTITY_CODE_MAX_LENGTH = __webpack_exports__.KA;
|
|
117
113
|
var __webpack_exports__ENTITY_CODE_PATTERN = __webpack_exports__.vs;
|
|
118
114
|
var __webpack_exports__ENTITY_DEFINITION_MESSAGES = __webpack_exports__.pL;
|
|
@@ -136,4 +132,4 @@ var __webpack_exports__SCHEMA_MESSAGES = __webpack_exports__.Hu;
|
|
|
136
132
|
var __webpack_exports__SCHEMA_PRECHECK_MESSAGES = __webpack_exports__.NE;
|
|
137
133
|
var __webpack_exports__SCHEMA_STEP_MESSAGES = __webpack_exports__.EQ;
|
|
138
134
|
var __webpack_exports__SCHEMA_WARNING_MESSAGES = __webpack_exports__.Uu;
|
|
139
|
-
export { __webpack_exports__BUNDLE_MESSAGES as BUNDLE_MESSAGES, __webpack_exports__BUNDLE_VARIABLE_NAME_PATTERN as BUNDLE_VARIABLE_NAME_PATTERN, __webpack_exports__ENTITY_BUILDER_EVENT_ENTITIES as ENTITY_BUILDER_EVENT_ENTITIES, __webpack_exports__ENTITY_BUILDER_EVENT_MODULE as ENTITY_BUILDER_EVENT_MODULE, __webpack_exports__ENTITY_BUILDER_MODULE_OPTIONS as ENTITY_BUILDER_MODULE_OPTIONS, __webpack_exports__ENTITY_BUNDLE_MAX_BYTES as ENTITY_BUNDLE_MAX_BYTES, __webpack_exports__ENTITY_CODE_MAX_LENGTH as ENTITY_CODE_MAX_LENGTH, __webpack_exports__ENTITY_CODE_PATTERN as ENTITY_CODE_PATTERN, __webpack_exports__ENTITY_DEFINITION_MESSAGES as ENTITY_DEFINITION_MESSAGES, __webpack_exports__ENTITY_FLOW_ENDPOINTS as ENTITY_FLOW_ENDPOINTS, __webpack_exports__ENTITY_TABLE_PREFIX as ENTITY_TABLE_PREFIX, __webpack_exports__FIELD_DEFINITION_MESSAGES as FIELD_DEFINITION_MESSAGES, __webpack_exports__FIELD_VALIDATION_MESSAGES as FIELD_VALIDATION_MESSAGES, __webpack_exports__FLOW_DEFINITION_MESSAGES as FLOW_DEFINITION_MESSAGES, __webpack_exports__FLOW_ERROR_MESSAGES as FLOW_ERROR_MESSAGES, __webpack_exports__FLOW_MESSAGES as FLOW_MESSAGES, __webpack_exports__FLOW_SHAPE_MESSAGES as FLOW_SHAPE_MESSAGES, __webpack_exports__FLOW_SKIP_MESSAGES as FLOW_SKIP_MESSAGES, __webpack_exports__FLOW_SUBJECT_MESSAGES as FLOW_SUBJECT_MESSAGES, __webpack_exports__FLOW_VALIDATION_MESSAGES as FLOW_VALIDATION_MESSAGES, __webpack_exports__GENERIC_RECORD_MESSAGES as GENERIC_RECORD_MESSAGES, __webpack_exports__RULE_ENGINE_MESSAGES as RULE_ENGINE_MESSAGES, __webpack_exports__SCHEMA_BLOCKER_MESSAGES as SCHEMA_BLOCKER_MESSAGES, __webpack_exports__SCHEMA_FINDING_MESSAGES as SCHEMA_FINDING_MESSAGES, __webpack_exports__SCHEMA_IMPACT_MESSAGES as SCHEMA_IMPACT_MESSAGES, __webpack_exports__SCHEMA_MESSAGES as SCHEMA_MESSAGES, __webpack_exports__SCHEMA_PRECHECK_MESSAGES as SCHEMA_PRECHECK_MESSAGES, __webpack_exports__SCHEMA_STEP_MESSAGES as SCHEMA_STEP_MESSAGES, __webpack_exports__SCHEMA_WARNING_MESSAGES as SCHEMA_WARNING_MESSAGES };
|
|
135
|
+
export { __webpack_exports__BUNDLE_MESSAGES as BUNDLE_MESSAGES, __webpack_exports__BUNDLE_VARIABLE_NAME_PATTERN as BUNDLE_VARIABLE_NAME_PATTERN, __webpack_exports__ENTITY_BUILDER_EVENT_ENTITIES as ENTITY_BUILDER_EVENT_ENTITIES, __webpack_exports__ENTITY_BUILDER_EVENT_MODULE as ENTITY_BUILDER_EVENT_MODULE, __webpack_exports__ENTITY_BUILDER_MODULE_OPTIONS as ENTITY_BUILDER_MODULE_OPTIONS, __webpack_exports__ENTITY_BUNDLE_MAX_BYTES as ENTITY_BUNDLE_MAX_BYTES, __webpack_exports__ENTITY_BUNDLE_MAX_FILES as ENTITY_BUNDLE_MAX_FILES, __webpack_exports__ENTITY_CODE_MAX_LENGTH as ENTITY_CODE_MAX_LENGTH, __webpack_exports__ENTITY_CODE_PATTERN as ENTITY_CODE_PATTERN, __webpack_exports__ENTITY_DEFINITION_MESSAGES as ENTITY_DEFINITION_MESSAGES, __webpack_exports__ENTITY_FLOW_ENDPOINTS as ENTITY_FLOW_ENDPOINTS, __webpack_exports__ENTITY_TABLE_PREFIX as ENTITY_TABLE_PREFIX, __webpack_exports__FIELD_DEFINITION_MESSAGES as FIELD_DEFINITION_MESSAGES, __webpack_exports__FIELD_VALIDATION_MESSAGES as FIELD_VALIDATION_MESSAGES, __webpack_exports__FLOW_DEFINITION_MESSAGES as FLOW_DEFINITION_MESSAGES, __webpack_exports__FLOW_ERROR_MESSAGES as FLOW_ERROR_MESSAGES, __webpack_exports__FLOW_MESSAGES as FLOW_MESSAGES, __webpack_exports__FLOW_SHAPE_MESSAGES as FLOW_SHAPE_MESSAGES, __webpack_exports__FLOW_SKIP_MESSAGES as FLOW_SKIP_MESSAGES, __webpack_exports__FLOW_SUBJECT_MESSAGES as FLOW_SUBJECT_MESSAGES, __webpack_exports__FLOW_VALIDATION_MESSAGES as FLOW_VALIDATION_MESSAGES, __webpack_exports__GENERIC_RECORD_MESSAGES as GENERIC_RECORD_MESSAGES, __webpack_exports__RULE_ENGINE_MESSAGES as RULE_ENGINE_MESSAGES, __webpack_exports__SCHEMA_BLOCKER_MESSAGES as SCHEMA_BLOCKER_MESSAGES, __webpack_exports__SCHEMA_FINDING_MESSAGES as SCHEMA_FINDING_MESSAGES, __webpack_exports__SCHEMA_IMPACT_MESSAGES as SCHEMA_IMPACT_MESSAGES, __webpack_exports__SCHEMA_MESSAGES as SCHEMA_MESSAGES, __webpack_exports__SCHEMA_PRECHECK_MESSAGES as SCHEMA_PRECHECK_MESSAGES, __webpack_exports__SCHEMA_STEP_MESSAGES as SCHEMA_STEP_MESSAGES, __webpack_exports__SCHEMA_WARNING_MESSAGES as SCHEMA_WARNING_MESSAGES };
|
package/fesm/docs/index.js
CHANGED
|
@@ -50,7 +50,7 @@ to a company or branch, add fields such as \`company_id\` / \`branch_id\` and ma
|
|
|
50
50
|
- \`/entity-builder/entity-definitions/*\` - Entities, schema changes, health and history
|
|
51
51
|
- \`/entity-builder/field-definitions/*\` - Field metadata (read-only; changes go through schema changes)
|
|
52
52
|
- \`/entity-builder/flows/*\`, \`/entity-builder/flow-executions/*\` - Flows
|
|
53
|
-
- \`/api-flows/:slug\` - Call a flow
|
|
53
|
+
- \`/api-flows/:slug[/:path]\` - Call a flow (each Request step with a path answers on its own URL)
|
|
54
54
|
- \`/entity-builder/bundles/*\` - Promote entities and flows between environments: export a bundle, plan and apply its import
|
|
55
55
|
|
|
56
56
|
## Common Error Codes
|
package/fesm/dtos/index.js
CHANGED
|
@@ -383,6 +383,7 @@ _ts_decorate([
|
|
|
383
383
|
/** Form values arrive as text: `true` / `false` become booleans, anything else is left for the validator to refuse. */ const FormBoolean = ()=>(0,class_transformer__rspack_import_1.Transform)(({ value })=>value === 'true' ? true : value === 'false' ? false : value);
|
|
384
384
|
/** The form fields sent with the bundle file to plan-import / apply-import. */ class ImportBundleOptionsDto {
|
|
385
385
|
deprecateMissingFields;
|
|
386
|
+
deactivateMissingFlows;
|
|
386
387
|
confirm;
|
|
387
388
|
expectedChecksum;
|
|
388
389
|
expectedPlanChecksum;
|
|
@@ -397,6 +398,16 @@ _ts_decorate([
|
|
|
397
398
|
(0,class_validator__rspack_import_2.IsBoolean)(),
|
|
398
399
|
_ts_metadata("design:type", Boolean)
|
|
399
400
|
], ImportBundleOptionsDto.prototype, "deprecateMissingFields", void 0);
|
|
401
|
+
_ts_decorate([
|
|
402
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
403
|
+
description: 'Switch off (and publish) the live flows this environment has and the bundle does not (they are kept, not deleted)',
|
|
404
|
+
default: false
|
|
405
|
+
}),
|
|
406
|
+
(0,class_validator__rspack_import_2.IsOptional)(),
|
|
407
|
+
FormBoolean(),
|
|
408
|
+
(0,class_validator__rspack_import_2.IsBoolean)(),
|
|
409
|
+
_ts_metadata("design:type", Boolean)
|
|
410
|
+
], ImportBundleOptionsDto.prototype, "deactivateMissingFlows", void 0);
|
|
400
411
|
_ts_decorate([
|
|
401
412
|
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
402
413
|
description: 'apply-import: acknowledge steps that lose (or may lose) data',
|
package/fesm/guards/index.js
CHANGED
|
@@ -38,7 +38,9 @@ function _ts_param(paramIndex, decorator) {
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
const DESIGNER_WRITE_HANDLERS = 'entity_builder:designer_write_handlers';
|
|
41
|
+
const DESIGNER_REPAIR_HANDLER = 'entity_builder:designer_repair_handler';
|
|
41
42
|
/** 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);
|
|
43
|
+
/** The one handler whose `repair` action still runs while read-only; any other handler is refused whatever its body says. */ const DesignerAllowsRepair = ()=>(0,_nestjs_common__rspack_import_0.SetMetadata)(DESIGNER_REPAIR_HANDLER, true);
|
|
42
44
|
class DesignerWritableInterceptor {
|
|
43
45
|
reflector;
|
|
44
46
|
config;
|
|
@@ -58,7 +60,9 @@ class DesignerWritableInterceptor {
|
|
|
58
60
|
isLocked(context) {
|
|
59
61
|
if (!this.config.isDesignerReadOnly()) return false;
|
|
60
62
|
const handlers = this.reflector.get(DESIGNER_WRITE_HANDLERS, context.getClass()) ?? [];
|
|
61
|
-
|
|
63
|
+
const handler = context.getHandler();
|
|
64
|
+
if (!handlers.includes(handler.name)) return false;
|
|
65
|
+
if (!this.reflector.get(DESIGNER_REPAIR_HANDLER, handler)) return true;
|
|
62
66
|
return context.switchToHttp().getRequest().body?.action !== _dtos_schema_change_dto_js__rspack_import_2/* .SchemaChangeAction.REPAIR */.M3.REPAIR;
|
|
63
67
|
}
|
|
64
68
|
}
|
|
@@ -74,9 +78,10 @@ DesignerWritableInterceptor = _ts_decorate([
|
|
|
74
78
|
], DesignerWritableInterceptor);
|
|
75
79
|
|
|
76
80
|
__webpack_require__.d(__webpack_exports__, {
|
|
77
|
-
|
|
81
|
+
Xg: () => (DesignerWritableInterceptor)
|
|
78
82
|
}, {
|
|
79
|
-
|
|
83
|
+
H6: DesignerAllowsRepair,
|
|
84
|
+
Wq: DesignerWrites
|
|
80
85
|
});
|
|
81
86
|
|
|
82
87
|
|
|
@@ -213,7 +218,7 @@ class FlowAccessGuard {
|
|
|
213
218
|
request.flowDefinition = flow;
|
|
214
219
|
request.flowEndpoint = endpoint;
|
|
215
220
|
const ip = request.ip ?? request.socket?.remoteAddress ?? 'unknown';
|
|
216
|
-
if (!limiter.hit(`${flow.id}|${endpoint.nodeId}|${ip}`, endpoint.rateLimitPerMinute)) {
|
|
221
|
+
if (!limiter.hit(`${runtime.tenantScope()}|${flow.id}|${endpoint.nodeId}|${ip}`, endpoint.rateLimitPerMinute)) {
|
|
217
222
|
throw new common_.HttpException({
|
|
218
223
|
message: 'Too many requests. Try again in a minute.',
|
|
219
224
|
messageKey: message_keys/* .FLOW_MESSAGES.RATE_LIMITED */.wu.RATE_LIMITED
|
|
@@ -234,8 +239,7 @@ class FlowAccessGuard {
|
|
|
234
239
|
return true;
|
|
235
240
|
}
|
|
236
241
|
case 'jwt':
|
|
237
|
-
|
|
238
|
-
return true;
|
|
242
|
+
return this.authenticate(context);
|
|
239
243
|
case 'permission':
|
|
240
244
|
{
|
|
241
245
|
if (!await this.authenticate(context)) return false;
|
|
@@ -278,8 +282,9 @@ FlowAccessGuard = _ts_decorate([
|
|
|
278
282
|
|
|
279
283
|
__webpack_require__.d(__webpack_exports__, {
|
|
280
284
|
CA: () => (/* reexport safe */ _flow_access_guard_js__rspack_import_0.C),
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
H6: () => (/* reexport safe */ _designer_writable_interceptor_js__rspack_import_1.H6),
|
|
286
|
+
Wq: () => (/* reexport safe */ _designer_writable_interceptor_js__rspack_import_1.Wq),
|
|
287
|
+
Xg: () => (/* reexport safe */ _designer_writable_interceptor_js__rspack_import_1.Xg)
|
|
283
288
|
});
|
|
284
289
|
|
|
285
290
|
|
|
@@ -306,7 +311,8 @@ import * as __rspack_chunk_5 from '../677.js';
|
|
|
306
311
|
__webpack_require__.C(__rspack_chunk_5);
|
|
307
312
|
import * as __rspack_chunk_6 from './index.js';
|
|
308
313
|
__webpack_require__.C(__rspack_chunk_6);
|
|
309
|
-
var __webpack_exports__ = __webpack_exec__(5460);var
|
|
314
|
+
var __webpack_exports__ = __webpack_exec__(5460);var __webpack_exports__DesignerAllowsRepair = __webpack_exports__.H6;
|
|
315
|
+
var __webpack_exports__DesignerWritableInterceptor = __webpack_exports__.Xg;
|
|
310
316
|
var __webpack_exports__DesignerWrites = __webpack_exports__.Wq;
|
|
311
317
|
var __webpack_exports__FlowAccessGuard = __webpack_exports__.CA;
|
|
312
|
-
export { __webpack_exports__DesignerWritableInterceptor as DesignerWritableInterceptor, __webpack_exports__DesignerWrites as DesignerWrites, __webpack_exports__FlowAccessGuard as FlowAccessGuard };
|
|
318
|
+
export { __webpack_exports__DesignerAllowsRepair as DesignerAllowsRepair, __webpack_exports__DesignerWritableInterceptor as DesignerWritableInterceptor, __webpack_exports__DesignerWrites as DesignerWrites, __webpack_exports__FlowAccessGuard as FlowAccessGuard };
|