@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/897.js
CHANGED
|
@@ -9,18 +9,12 @@ export const __rspack_esm_ids = [897];
|
|
|
9
9
|
export const __webpack_modules__ = {
|
|
10
10
|
6576(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11
11
|
const ENTITY_BUILDER_MODULE_OPTIONS = 'ENTITY_BUILDER_MODULE_OPTIONS';
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Identifier whitelist enforced on every EntityDefinition/FieldDefinition `code`.
|
|
19
|
-
* Also the exact contract SchemaSyncService's DDL engine validates against
|
|
20
|
-
* before generating a table/column name.
|
|
21
|
-
*/ const ENTITY_CODE_PATTERN = /^[a-z][a-z0-9_]{2,59}$/;
|
|
22
|
-
/** Matches the `code` column length on both EntityDefinition and FieldDefinition. */ const ENTITY_CODE_MAX_LENGTH = 63;
|
|
23
|
-
/** Defense-in-depth prefix applied to every dynamically created table name. */ const ENTITY_TABLE_PREFIX = 'eb_';
|
|
12
|
+
/** 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;
|
|
13
|
+
/** 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;
|
|
14
|
+
/** Any other `${var:NAME}` name could never be resolved on import. */ const BUNDLE_VARIABLE_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
15
|
+
/** 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}$/;
|
|
16
|
+
const ENTITY_CODE_MAX_LENGTH = 63;
|
|
17
|
+
const ENTITY_TABLE_PREFIX = 'eb_';
|
|
24
18
|
/** The generic API controller's record endpoints - each can be created as a ready-made flow with the entity. */ const ENTITY_FLOW_ENDPOINTS = [
|
|
25
19
|
'insert',
|
|
26
20
|
'insertMany',
|
|
@@ -156,11 +150,7 @@ _ts_decorate([
|
|
|
156
150
|
(0,class_validator__rspack_import_3.IsNotEmpty)(),
|
|
157
151
|
_ts_metadata("design:type", String)
|
|
158
152
|
], UpdateEntityDefinitionDto.prototype, "id", void 0);
|
|
159
|
-
/**
|
|
160
|
-
* One initial field spec passed alongside entity creation - identical to
|
|
161
|
-
* CreateFieldDefinitionDto but without entityDefinitionId, which does not
|
|
162
|
-
* exist yet until SchemaSyncService.createEntity assigns it.
|
|
163
|
-
*/ class EntityFieldSpecDto extends (0,_nestjs_swagger__rspack_import_1.OmitType)(_field_definition_dto_js__rspack_import_4/* .CreateFieldDefinitionDto */.Vj, [
|
|
153
|
+
/** A field created with its entity (or by add_field): the entity id comes from the request, not the field. */ class EntityFieldSpecDto extends (0,_nestjs_swagger__rspack_import_1.OmitType)(_field_definition_dto_js__rspack_import_4/* .CreateFieldDefinitionDto */.Vj, [
|
|
164
154
|
'entityDefinitionId'
|
|
165
155
|
]) {
|
|
166
156
|
}
|
|
@@ -269,8 +259,6 @@ _ts_decorate([
|
|
|
269
259
|
], EntityFlowNamesDto.prototype, "delete", void 0);
|
|
270
260
|
/** Labels of the inputs the endpoints add besides the entity fields. */ class EntityFlowInputLabelsDto {
|
|
271
261
|
id;
|
|
272
|
-
ids;
|
|
273
|
-
search;
|
|
274
262
|
}
|
|
275
263
|
_ts_decorate([
|
|
276
264
|
(0,_nestjs_swagger__rspack_import_1.ApiPropertyOptional)({
|
|
@@ -281,24 +269,6 @@ _ts_decorate([
|
|
|
281
269
|
(0,class_validator__rspack_import_3.MaxLength)(FLOW_TEXT_MAX_LENGTH),
|
|
282
270
|
_ts_metadata("design:type", String)
|
|
283
271
|
], EntityFlowInputLabelsDto.prototype, "id", void 0);
|
|
284
|
-
_ts_decorate([
|
|
285
|
-
(0,_nestjs_swagger__rspack_import_1.ApiPropertyOptional)({
|
|
286
|
-
example: 'Ids'
|
|
287
|
-
}),
|
|
288
|
-
(0,class_validator__rspack_import_3.IsString)(),
|
|
289
|
-
(0,class_validator__rspack_import_3.IsOptional)(),
|
|
290
|
-
(0,class_validator__rspack_import_3.MaxLength)(FLOW_TEXT_MAX_LENGTH),
|
|
291
|
-
_ts_metadata("design:type", String)
|
|
292
|
-
], EntityFlowInputLabelsDto.prototype, "ids", void 0);
|
|
293
|
-
_ts_decorate([
|
|
294
|
-
(0,_nestjs_swagger__rspack_import_1.ApiPropertyOptional)({
|
|
295
|
-
example: 'Search'
|
|
296
|
-
}),
|
|
297
|
-
(0,class_validator__rspack_import_3.IsString)(),
|
|
298
|
-
(0,class_validator__rspack_import_3.IsOptional)(),
|
|
299
|
-
(0,class_validator__rspack_import_3.MaxLength)(FLOW_TEXT_MAX_LENGTH),
|
|
300
|
-
_ts_metadata("design:type", String)
|
|
301
|
-
], EntityFlowInputLabelsDto.prototype, "search", void 0);
|
|
302
272
|
/**
|
|
303
273
|
* Text written into the entity's flow, sent by the designer in the creator's language so the
|
|
304
274
|
* saved flow reads like one the user wrote. Anything left out falls back to English.
|
|
@@ -306,6 +276,7 @@ _ts_decorate([
|
|
|
306
276
|
names;
|
|
307
277
|
inputLabels;
|
|
308
278
|
noMatchMessage;
|
|
279
|
+
deleteOnlyMessage;
|
|
309
280
|
}
|
|
310
281
|
_ts_decorate([
|
|
311
282
|
(0,_nestjs_swagger__rspack_import_1.ApiPropertyOptional)({
|
|
@@ -335,12 +306,17 @@ _ts_decorate([
|
|
|
335
306
|
(0,class_validator__rspack_import_3.MaxLength)(255),
|
|
336
307
|
_ts_metadata("design:type", String)
|
|
337
308
|
], EntityFlowTextsDto.prototype, "noMatchMessage", void 0);
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
309
|
+
_ts_decorate([
|
|
310
|
+
(0,_nestjs_swagger__rspack_import_1.ApiPropertyOptional)({
|
|
311
|
+
description: 'Message of the 400 answer of the delete endpoint for a restore or permanent delete',
|
|
312
|
+
example: 'Only delete is supported.'
|
|
313
|
+
}),
|
|
314
|
+
(0,class_validator__rspack_import_3.IsString)(),
|
|
315
|
+
(0,class_validator__rspack_import_3.IsOptional)(),
|
|
316
|
+
(0,class_validator__rspack_import_3.MaxLength)(255),
|
|
317
|
+
_ts_metadata("design:type", String)
|
|
318
|
+
], EntityFlowTextsDto.prototype, "deleteOnlyMessage", void 0);
|
|
319
|
+
/** create-entity: the entity, its table and initial fields in one DDL transaction (the generic insert is disabled). */ class CreateDynamicEntityDto extends CreateEntityDefinitionDto {
|
|
344
320
|
fields;
|
|
345
321
|
flowEndpoints;
|
|
346
322
|
flowTexts;
|
|
@@ -606,6 +582,7 @@ _ts_decorate([
|
|
|
606
582
|
(0,_nestjs_swagger__rspack_import_1.ApiPropertyOptional)({
|
|
607
583
|
description: 'Options for SINGLE_SELECT/MULTI_SELECT fields'
|
|
608
584
|
}),
|
|
585
|
+
(0,class_validator__rspack_import_3.IsArray)(),
|
|
609
586
|
(0,class_validator__rspack_import_3.IsOptional)(),
|
|
610
587
|
_ts_metadata("design:type", Array)
|
|
611
588
|
], CreateFieldDefinitionDto.prototype, "selectOptions", void 0);
|
|
@@ -1181,6 +1158,41 @@ const FLOW_NODE_TYPES = [
|
|
|
1181
1158
|
'object',
|
|
1182
1159
|
'list'
|
|
1183
1160
|
];
|
|
1161
|
+
/**
|
|
1162
|
+
* Which API controller endpoint a Request step stands in for. It fixes the body shape (a list for the
|
|
1163
|
+
* `*_many` / `bulk_upsert` ones) and adds that endpoint's own fields ahead of the designer's: get_all takes
|
|
1164
|
+
* `FilterAndPaginationDto` (`filter`, `pagination`, `sort`, `select`, `withDeleted`; search arrives as `?q=`),
|
|
1165
|
+
* get_by_id `{ id, select }`, get_by_ids `{ ids, select }`, update / update_many an `id`, delete `DeleteDto`
|
|
1166
|
+
* (`id`: one id or a list, read as a list; `type`). custom (default): only the declared body and fields.
|
|
1167
|
+
*/ const FLOW_REQUEST_CONTRACTS = [
|
|
1168
|
+
'custom',
|
|
1169
|
+
'get_all',
|
|
1170
|
+
'get_by_id',
|
|
1171
|
+
'get_by_ids',
|
|
1172
|
+
'get_by_filter',
|
|
1173
|
+
'insert',
|
|
1174
|
+
'insert_many',
|
|
1175
|
+
'update',
|
|
1176
|
+
'update_many',
|
|
1177
|
+
'bulk_upsert',
|
|
1178
|
+
'delete'
|
|
1179
|
+
];
|
|
1180
|
+
const LIST_BODY_CONTRACTS = new Set([
|
|
1181
|
+
'insert_many',
|
|
1182
|
+
'update_many',
|
|
1183
|
+
'bulk_upsert'
|
|
1184
|
+
]);
|
|
1185
|
+
/**
|
|
1186
|
+
* The shape a Respond step answers in. raw (default): the body exactly as built. The others are the API
|
|
1187
|
+
* controller envelope `{ success, message, messageKey, messageVariables?, data?, meta? }`: single (`data`
|
|
1188
|
+
* one value), list (`data` a list, `meta` paging), bulk (`data` a list, `meta` counts), message (no data).
|
|
1189
|
+
*/ const FLOW_RESPONSE_FORMATS = [
|
|
1190
|
+
'raw',
|
|
1191
|
+
'single',
|
|
1192
|
+
'list',
|
|
1193
|
+
'bulk',
|
|
1194
|
+
'message'
|
|
1195
|
+
];
|
|
1184
1196
|
const FLOW_INPUT_TYPES = [
|
|
1185
1197
|
'string',
|
|
1186
1198
|
'text',
|
|
@@ -1276,6 +1288,7 @@ const FLOW_LIMITS = {
|
|
|
1276
1288
|
MAX_EMAIL_TEMPLATE_SLUG_LENGTH: 255,
|
|
1277
1289
|
MAX_HTTP_TIMEOUT_MS: 15_000,
|
|
1278
1290
|
MAX_HTTP_RESPONSE_BYTES: 1_000_000,
|
|
1291
|
+
DEFAULT_QUERY_LIMIT: 50,
|
|
1279
1292
|
MAX_QUERY_LIMIT: 200,
|
|
1280
1293
|
MAX_WRITE_ITEMS: 1000,
|
|
1281
1294
|
DEFAULT_WRITE_FILTER_LIMIT: 100,
|
|
@@ -1294,8 +1307,7 @@ const FLOW_LIMITS = {
|
|
|
1294
1307
|
DEFAULT_CODE_TIMEOUT_MS: 1000,
|
|
1295
1308
|
MIN_CODE_TIMEOUT_MS: 10,
|
|
1296
1309
|
MAX_CODE_TIMEOUT_MS: 5000,
|
|
1297
|
-
CODE_MEMORY_LIMIT_BYTES:
|
|
1298
|
-
CODE_STACK_SIZE_BYTES: 512 * 1024,
|
|
1310
|
+
/** Heap plus buffers of the worker a code step runs on, packages it loaded included. */ CODE_MEMORY_LIMIT_BYTES: 128 * 1024 * 1024,
|
|
1299
1311
|
MAX_CODE_OUTPUT_BYTES: 1_000_000,
|
|
1300
1312
|
MAX_CODE_LOG_LINES: 50,
|
|
1301
1313
|
MAX_CODE_LOG_LINE_CHARS: 500
|
|
@@ -1305,6 +1317,119 @@ const FLOW_SLUG_PATTERN = /^[a-z][a-z0-9-]{2,62}$/;
|
|
|
1305
1317
|
const FLOW_INPUT_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_]{0,59}$/;
|
|
1306
1318
|
const FLOW_ENDPOINT_PATH_PATTERN = /^[a-z][a-z0-9-]{0,62}$/;
|
|
1307
1319
|
/** A record, user or company id. */ const FLOW_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1320
|
+
const SELECT_FIELD = {
|
|
1321
|
+
name: 'select',
|
|
1322
|
+
type: 'array',
|
|
1323
|
+
itemType: 'string',
|
|
1324
|
+
maxLength: 64
|
|
1325
|
+
};
|
|
1326
|
+
/** The fields an API controller endpoint's DTO takes, checked ahead of the designer's own. */ function contractFields(contract) {
|
|
1327
|
+
switch(contract){
|
|
1328
|
+
case 'get_all':
|
|
1329
|
+
return [
|
|
1330
|
+
{
|
|
1331
|
+
name: 'filter',
|
|
1332
|
+
type: 'object'
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
name: 'pagination',
|
|
1336
|
+
type: 'object',
|
|
1337
|
+
fields: [
|
|
1338
|
+
{
|
|
1339
|
+
name: 'currentPage',
|
|
1340
|
+
type: 'integer',
|
|
1341
|
+
required: true,
|
|
1342
|
+
default: 0,
|
|
1343
|
+
min: 0
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
name: 'pageSize',
|
|
1347
|
+
type: 'integer',
|
|
1348
|
+
required: true,
|
|
1349
|
+
default: 10,
|
|
1350
|
+
min: 1,
|
|
1351
|
+
max: FLOW_LIMITS.MAX_QUERY_LIMIT
|
|
1352
|
+
}
|
|
1353
|
+
]
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
name: 'sort',
|
|
1357
|
+
type: 'object'
|
|
1358
|
+
},
|
|
1359
|
+
SELECT_FIELD,
|
|
1360
|
+
{
|
|
1361
|
+
name: 'withDeleted',
|
|
1362
|
+
type: 'boolean'
|
|
1363
|
+
}
|
|
1364
|
+
];
|
|
1365
|
+
case 'get_by_id':
|
|
1366
|
+
return [
|
|
1367
|
+
{
|
|
1368
|
+
name: 'id',
|
|
1369
|
+
type: 'uuid',
|
|
1370
|
+
required: true
|
|
1371
|
+
},
|
|
1372
|
+
SELECT_FIELD
|
|
1373
|
+
];
|
|
1374
|
+
case 'get_by_ids':
|
|
1375
|
+
return [
|
|
1376
|
+
{
|
|
1377
|
+
name: 'ids',
|
|
1378
|
+
type: 'array',
|
|
1379
|
+
itemType: 'uuid',
|
|
1380
|
+
required: true
|
|
1381
|
+
},
|
|
1382
|
+
SELECT_FIELD
|
|
1383
|
+
];
|
|
1384
|
+
case 'update':
|
|
1385
|
+
case 'update_many':
|
|
1386
|
+
return [
|
|
1387
|
+
{
|
|
1388
|
+
name: 'id',
|
|
1389
|
+
type: 'uuid',
|
|
1390
|
+
required: true
|
|
1391
|
+
}
|
|
1392
|
+
];
|
|
1393
|
+
case 'delete':
|
|
1394
|
+
return [
|
|
1395
|
+
{
|
|
1396
|
+
name: 'id',
|
|
1397
|
+
type: 'array',
|
|
1398
|
+
itemType: 'uuid',
|
|
1399
|
+
required: true
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
name: 'type',
|
|
1403
|
+
type: 'choice',
|
|
1404
|
+
options: [
|
|
1405
|
+
'delete',
|
|
1406
|
+
'restore',
|
|
1407
|
+
'permanent'
|
|
1408
|
+
],
|
|
1409
|
+
required: true
|
|
1410
|
+
}
|
|
1411
|
+
];
|
|
1412
|
+
default:
|
|
1413
|
+
return [];
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
/** A Request step's contract; an unknown one reads as custom, which the validator refuses on save. */ function triggerContract(config) {
|
|
1417
|
+
return config.contract && FLOW_REQUEST_CONTRACTS.includes(config.contract) ? config.contract : 'custom';
|
|
1418
|
+
}
|
|
1419
|
+
/** The body a Request step takes: the contract's, or for custom the declared one. */ function endpointBody(config) {
|
|
1420
|
+
const contract = triggerContract(config);
|
|
1421
|
+
const declared = Array.isArray(config.inputSchema) ? config.inputSchema : [];
|
|
1422
|
+
const own = contractFields(contract);
|
|
1423
|
+
const taken = new Set(own.map((f)=>f.name));
|
|
1424
|
+
return {
|
|
1425
|
+
contract,
|
|
1426
|
+
bodyType: contract === 'custom' ? config.bodyType ?? 'object' : LIST_BODY_CONTRACTS.has(contract) ? 'list' : 'object',
|
|
1427
|
+
inputSchema: [
|
|
1428
|
+
...own,
|
|
1429
|
+
...declared.filter((f)=>!taken.has(f?.name))
|
|
1430
|
+
]
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1308
1433
|
/** Who may start a run at a Request step; an unknown mode reads as the default, which the validator refuses on save. */ function endpointAuth(config) {
|
|
1309
1434
|
const authMode = config.authMode && FLOW_AUTH_MODES.includes(config.authMode) ? config.authMode : DEFAULT_AUTH_MODE;
|
|
1310
1435
|
return {
|
|
@@ -1327,8 +1452,7 @@ const FLOW_ENDPOINT_PATH_PATTERN = /^[a-z][a-z0-9-]{0,62}$/;
|
|
|
1327
1452
|
return {
|
|
1328
1453
|
nodeId: node.id,
|
|
1329
1454
|
path,
|
|
1330
|
-
|
|
1331
|
-
inputSchema: Array.isArray(config.inputSchema) ? config.inputSchema : [],
|
|
1455
|
+
...endpointBody(config),
|
|
1332
1456
|
...endpointAuth(config),
|
|
1333
1457
|
isTransactional: config.isTransactional === true,
|
|
1334
1458
|
timeoutMs: config.timeoutMs ?? FLOW_LIMITS.DEFAULT_TIMEOUT_MS,
|
|
@@ -1389,11 +1513,14 @@ const FLOW_ENDPOINT_PATH_PATTERN = /^[a-z][a-z0-9-]{0,62}$/;
|
|
|
1389
1513
|
__webpack_require__.d(__webpack_exports__, {
|
|
1390
1514
|
IE: () => (startEndpoint),
|
|
1391
1515
|
Xr: () => (flowEndpoints),
|
|
1516
|
+
_h: () => (contractFields),
|
|
1392
1517
|
a5: () => (portsOf),
|
|
1393
1518
|
um: () => (triggerPath),
|
|
1519
|
+
v7: () => (triggerContract),
|
|
1394
1520
|
vS: () => (findEndpoint),
|
|
1395
1521
|
xA: () => (isStoredApiKey)
|
|
1396
1522
|
}, {
|
|
1523
|
+
A4: FLOW_RESPONSE_FORMATS,
|
|
1397
1524
|
At: NON_CONTINUABLE_NODE_TYPES,
|
|
1398
1525
|
B9: FLOW_EMAIL_TARGETS,
|
|
1399
1526
|
Dn: RECORD_WRITE_TARGETS,
|
|
@@ -1415,6 +1542,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1415
1542
|
fP: isFunctionFlow,
|
|
1416
1543
|
fZ: FLOW_INPUT_NAME_PATTERN,
|
|
1417
1544
|
iM: FLOW_ACCESS_SUBJECTS,
|
|
1545
|
+
j_: FLOW_REQUEST_CONTRACTS,
|
|
1418
1546
|
q2: FLOW_NODE_TYPES,
|
|
1419
1547
|
sk: FLOW_BRANCH_COMPANIES,
|
|
1420
1548
|
v1: FLOW_EMAIL_MODES,
|
|
@@ -1439,6 +1567,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1439
1567
|
'updated_by_id',
|
|
1440
1568
|
'deleted_by_id'
|
|
1441
1569
|
];
|
|
1570
|
+
/** A RELATION field is indexed unless the request says otherwise: child lists, parent-id filters and lookups all read by it. */ const indexedByDefault = (spec)=>spec.isIndexed ?? spec.fieldType === _enums_field_type_enum_js__rspack_import_2/* .FieldType.RELATION */.P.RELATION;
|
|
1442
1571
|
/** Field types stored as unbounded text or JSON: an index or unique constraint on them fails (MySQL) or breaks on large values (PostgreSQL). */ const NON_INDEXABLE_FIELD_TYPES = [
|
|
1443
1572
|
_enums_field_type_enum_js__rspack_import_2/* .FieldType.LONG_TEXT */.P.LONG_TEXT,
|
|
1444
1573
|
_enums_field_type_enum_js__rspack_import_2/* .FieldType.JSON */.P.JSON,
|
|
@@ -1506,12 +1635,17 @@ const NAME_HASH_LENGTH = 8;
|
|
|
1506
1635
|
const room = maxLength - prefix.length - hash.length - 2;
|
|
1507
1636
|
return `${prefix}_${`${table}_${column}`.slice(0, room)}_${hash}`;
|
|
1508
1637
|
}
|
|
1509
|
-
|
|
1638
|
+
/** The predicate of a plain index over live rows only (`performance.partialIndexes`, PostgreSQL). */ const LIVE_ROWS_WHERE = '"deleted_at" IS NULL';
|
|
1639
|
+
/** `liveOnly` (PostgreSQL only - MySQL has no partial indexes): the index covers rows that are not soft-deleted. */ const plainIndex = (table, column, driver, adapter, liveOnly = false)=>new typeorm__rspack_import_1.TableIndex({
|
|
1510
1640
|
name: indexName('idx', table, column, adapter.maxIdentifierLength(driver)),
|
|
1511
1641
|
columnNames: [
|
|
1512
1642
|
column
|
|
1513
|
-
]
|
|
1643
|
+
],
|
|
1644
|
+
...liveOnly && driver === 'postgres' ? {
|
|
1645
|
+
where: LIVE_ROWS_WHERE
|
|
1646
|
+
} : {}
|
|
1514
1647
|
});
|
|
1648
|
+
/** Whether an index read back from the database covers live rows only (PostgreSQL reports `(deleted_at IS NULL)`). */ const isLiveRowsIndex = (index)=>/^\(*"?deleted_at"?\s+IS\s+NULL\)*$/i.test((index.where ?? '').trim());
|
|
1515
1649
|
const tableUnique = (table, column, driver, adapter)=>new typeorm__rspack_import_1.TableUnique({
|
|
1516
1650
|
name: indexName('uq', table, column, adapter.maxIdentifierLength(driver)),
|
|
1517
1651
|
columnNames: [
|
|
@@ -1589,11 +1723,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1589
1723
|
G7: sameColumns,
|
|
1590
1724
|
HK: auditColumns,
|
|
1591
1725
|
OG: softDeleteColumn,
|
|
1726
|
+
YS: isLiveRowsIndex,
|
|
1592
1727
|
d4: isIndexableFieldType,
|
|
1593
|
-
gW: NON_INDEXABLE_FIELD_TYPES,
|
|
1594
1728
|
mq: SYSTEM_COLUMN_NAMES,
|
|
1595
1729
|
uy: tableUnique,
|
|
1596
|
-
v7: plainIndex
|
|
1730
|
+
v7: plainIndex,
|
|
1731
|
+
vx: LIVE_ROWS_WHERE,
|
|
1732
|
+
w5: indexedByDefault
|
|
1597
1733
|
});
|
|
1598
1734
|
|
|
1599
1735
|
|